tokmon 0.20.2 → 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.
@@ -1,105 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./timeline-D0GFoRzM.js","./chart-CDwPcOeB.js","./breakdown-Dhq6Rqnu.js"])))=>i.map(i=>d[i]);
2
- var QE=Object.defineProperty;var JE=(e,t,n)=>t in e?QE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var L=(e,t,n)=>JE(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 D5=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function YE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Oh={exports:{}},Sa={},Ah={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 yv;function XE(){if(yv)return Pe;yv=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,C={};function b(M,J,pe){this.props=M,this.context=J,this.refs=C,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=C,this.updater=pe||v}var j=E.prototype=new _;j.constructor=E,w(j,b.prototype),j.isPureReactComponent=!0;var R=Array.isArray,F=Object.prototype.hasOwnProperty,A={current:null},T={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)F.call(J,he)&&!T.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:A.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:A};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=A.current),J.key!==void 0&&(ce=""+J.key),M.type&&M.type.defaultProps)var Ce=M.type.defaultProps;for(Ee in J)F.call(J,Ee)&&!T.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 xv;function yl(){return xv||(xv=1,Ah.exports=XE()),Ah.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 vv;function ZE(){if(vv)return Sa;vv=1;var e=yl(),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 Sv;function eP(){return Sv||(Sv=1,Oh.exports=ZE()),Oh.exports}var y=eP(),z=yl();const Ka=YE(z);var Gu={},Dh={exports:{}},on={},zh={exports:{}},Uh={};/**
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 wv;function tP(){return wv||(wv=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,C=!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(C=!1,j(Y),!w)if(n(d)!==null)w=!0,K(F);else{var se=n(h);se!==null&&q(R,se.startTime-Y)}}function F(Y,se){w=!1,C&&(C=!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 A=!1,T=null,U=-1,V=5,Z=-1;function te(){return!(e.unstable_now()-Z<V)}function ae(){if(T!==null){var Y=e.unstable_now();Z=Y;var se=!0;try{se=T(!0,Y)}finally{se?P():(A=!1,T=null)}}else A=!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){T=Y,A||(A=!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(F))},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)&&(C?(_(U),U=-1):C=!0,q(R,ee-M))):(Y.sortIndex=J,t(d,Y),w||v||(w=!0,K(F))),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}}}})(Uh)),Uh}var kv;function nP(){return kv||(kv=1,zh.exports=tP()),zh.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 Cv;function rP(){if(Cv)return on;Cv=1;var e=yl(),t=nP();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 C(r,o,l,c,g,S,k){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=k}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){b[r]=new C(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 C(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){b[r]=new C(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){b[r]=new C(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 C(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){b[r]=new C(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){b[r]=new C(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){b[r]=new C(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){b[r]=new C(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 C(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 C(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 C(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){b[r]=new C(r,1,!1,r.toLowerCase(),null,!1,!1)}),b.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){b[r]=new C(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,F=Symbol.for("react.element"),A=Symbol.for("react.portal"),T=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
- `),k=g.length-1,I=S.length-1;1<=k&&0<=I&&g[k]!==S[I];)I--;for(;1<=k&&0<=I;k--,I--)if(g[k]!==S[I]){if(k!==1||I!==1)do if(k--,I--,0>I||g[k]!==S[I]){var N=`
38
- `+g[k].replace(" at new "," at ");return r.displayName&&N.includes("<anonymous>")&&(N=N.replace("<anonymous>",r.displayName)),N}while(1<=k&&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 T:return"Fragment";case A: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(k){c=""+k,S.call(this,k)}}),Object.defineProperty(r,o,{enumerable:l.enumerable}),{getValue:function(){return c},setValue:function(k){c=""+k},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 _o(r,o){var l=o.checked;return ee({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??r._wrapperState.initialChecked})}function Al(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 Ro(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 Eo(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return ee({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Dl(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 Po,N0=(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(Po=Po||document.createElement("div"),Po.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=Po.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},Z_=["Webkit","ms","Moz","O"];Object.keys(Oi).forEach(function(r){Z_.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Oi[o]=Oi[r]})});function M0(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 T0(r,o){r=r.style;for(var l in o)if(o.hasOwnProperty(l)){var c=l.indexOf("--")===0,g=M0(l,o[l],c);l==="float"&&(l="cssFloat"),c?r.setProperty(l,g):r[l]=g}}var eR=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 Qf(r,o){if(o){if(eR[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 Jf(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 Yf=null;function Xf(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Zf=null,Io=null,jo=null;function $0(r){if(r=oa(r)){if(typeof Zf!="function")throw Error(n(280));var o=r.stateNode;o&&(o=lu(o),Zf(r.stateNode,r.type,o))}}function F0(r){Io?jo?jo.push(r):jo=[r]:Io=r}function L0(){if(Io){var r=Io,o=jo;if(jo=Io=null,$0(r),o)for(r=0;r<o.length;r++)$0(o[r])}}function O0(r,o){return r(o)}function A0(){}var ed=!1;function D0(r,o,l){if(ed)return r(o,l);ed=!0;try{return O0(r,o,l)}finally{ed=!1,(Io!==null||jo!==null)&&(A0(),L0())}}function Ai(r,o){var l=r.stateNode;if(l===null)return null;var c=lu(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 td=!1;if(f)try{var Di={};Object.defineProperty(Di,"passive",{get:function(){td=!0}}),window.addEventListener("test",Di,Di),window.removeEventListener("test",Di,Di)}catch{td=!1}function tR(r,o,l,c,g,S,k,I,N){var Q=Array.prototype.slice.call(arguments,3);try{o.apply(l,Q)}catch(oe){this.onError(oe)}}var zi=!1,zl=null,Ul=!1,nd=null,nR={onError:function(r){zi=!0,zl=r}};function rR(r,o,l,c,g,S,k,I,N){zi=!1,zl=null,tR.apply(nR,arguments)}function sR(r,o,l,c,g,S,k,I,N){if(rR.apply(this,arguments),zi){if(zi){var Q=zl;zi=!1,zl=null}else throw Error(n(198));Ul||(Ul=!0,nd=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 z0(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 U0(r){if($s(r)!==r)throw Error(n(188))}function oR(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 U0(g),r;if(S===c)return U0(g),o;S=S.sibling}throw Error(n(188))}if(l.return!==c.return)l=g,c=S;else{for(var k=!1,I=g.child;I;){if(I===l){k=!0,l=g,c=S;break}if(I===c){k=!0,c=g,l=S;break}I=I.sibling}if(!k){for(I=S.child;I;){if(I===l){k=!0,l=S,c=g;break}if(I===c){k=!0,c=S,l=g;break}I=I.sibling}if(!k)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 V0(r){return r=oR(r),r!==null?B0(r):null}function B0(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=B0(r);if(o!==null)return o;r=r.sibling}return null}var q0=t.unstable_scheduleCallback,H0=t.unstable_cancelCallback,iR=t.unstable_shouldYield,aR=t.unstable_requestPaint,ut=t.unstable_now,lR=t.unstable_getCurrentPriorityLevel,rd=t.unstable_ImmediatePriority,W0=t.unstable_UserBlockingPriority,Vl=t.unstable_NormalPriority,uR=t.unstable_LowPriority,G0=t.unstable_IdlePriority,Bl=null,ar=null;function cR(r){if(ar&&typeof ar.onCommitFiberRoot=="function")try{ar.onCommitFiberRoot(Bl,r,void 0,(r.current.flags&128)===128)}catch{}}var qn=Math.clz32?Math.clz32:hR,fR=Math.log,dR=Math.LN2;function hR(r){return r>>>=0,r===0?32:31-(fR(r)/dR|0)|0}var ql=64,Hl=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 Wl(r,o){var l=r.pendingLanes;if(l===0)return 0;var c=0,g=r.suspendedLanes,S=r.pingedLanes,k=l&268435455;if(k!==0){var I=k&~g;I!==0?c=Ui(I):(S&=k,S!==0&&(c=Ui(S)))}else k=l&~g,k!==0?c=Ui(k):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 gR(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 pR(r,o){for(var l=r.suspendedLanes,c=r.pingedLanes,g=r.expirationTimes,S=r.pendingLanes;0<S;){var k=31-qn(S),I=1<<k,N=g[k];N===-1?((I&l)===0||(I&c)!==0)&&(g[k]=gR(I,o)):N<=o&&(r.expiredLanes|=I),S&=~I}}function sd(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function K0(){var r=ql;return ql<<=1,(ql&4194240)===0&&(ql=64),r}function od(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 mR(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 id(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 Q0(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var J0,ad,Y0,X0,Z0,ld=!1,Gl=[],Ur=null,Vr=null,Br=null,Bi=new Map,qi=new Map,qr=[],yR="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 ey(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&&ad(o)),r):(r.eventSystemFlags|=c,o=r.targetContainers,g!==null&&o.indexOf(g)===-1&&o.push(g),r)}function xR(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 ty(r){var o=Fs(r.target);if(o!==null){var l=$s(o);if(l!==null){if(o=l.tag,o===13){if(o=z0(l),o!==null){r.blockedOn=o,Z0(r.priority,function(){Y0(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 Kl(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var l=cd(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(l===null){l=r.nativeEvent;var c=new l.constructor(l.type,l);Yf=c,l.target.dispatchEvent(c),Yf=null}else return o=oa(l),o!==null&&ad(o),r.blockedOn=l,!1;o.shift()}return!0}function ny(r,o,l){Kl(r)&&l.delete(o)}function vR(){ld=!1,Ur!==null&&Kl(Ur)&&(Ur=null),Vr!==null&&Kl(Vr)&&(Vr=null),Br!==null&&Kl(Br)&&(Br=null),Bi.forEach(ny),qi.forEach(ny)}function Wi(r,o){r.blockedOn===o&&(r.blockedOn=null,ld||(ld=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,vR)))}function Gi(r){function o(g){return Wi(g,r)}if(0<Gl.length){Wi(Gl[0],r);for(var l=1;l<Gl.length;l++){var c=Gl[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);)ty(l),l.blockedOn===null&&qr.shift()}var No=R.ReactCurrentBatchConfig,Ql=!0;function SR(r,o,l,c){var g=Ae,S=No.transition;No.transition=null;try{Ae=1,ud(r,o,l,c)}finally{Ae=g,No.transition=S}}function wR(r,o,l,c){var g=Ae,S=No.transition;No.transition=null;try{Ae=4,ud(r,o,l,c)}finally{Ae=g,No.transition=S}}function ud(r,o,l,c){if(Ql){var g=cd(r,o,l,c);if(g===null)Ed(r,o,c,Jl,l),ey(r,c);else if(xR(g,r,o,l,c))c.stopPropagation();else if(ey(r,c),o&4&&-1<yR.indexOf(r)){for(;g!==null;){var S=oa(g);if(S!==null&&J0(S),S=cd(r,o,l,c),S===null&&Ed(r,o,c,Jl,l),S===g)break;g=S}g!==null&&c.stopPropagation()}else Ed(r,o,c,null,l)}}var Jl=null;function cd(r,o,l,c){if(Jl=null,r=Xf(c),r=Fs(r),r!==null)if(o=$s(r),o===null)r=null;else if(l=o.tag,l===13){if(r=z0(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 Jl=r,null}function ry(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(lR()){case rd:return 1;case W0:return 4;case Vl:case uR:return 16;case G0:return 536870912;default:return 16}default:return 16}}var Hr=null,fd=null,Yl=null;function sy(){if(Yl)return Yl;var r,o=fd,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 k=l-r;for(c=1;c<=k&&o[l-c]===g[S-c];c++);return Yl=g.slice(r,1<c?1-c:void 0)}function Xl(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 Zl(){return!0}function oy(){return!1}function gn(r){function o(l,c,g,S,k){this._reactName=l,this._targetInst=g,this.type=c,this.nativeEvent=S,this.target=k,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)?Zl:oy,this.isPropagationStopped=oy,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=Zl)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Zl)},persist:function(){},isPersistent:Zl}),o}var Mo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dd=gn(Mo),Ki=ee({},Mo,{view:0,detail:0}),kR=gn(Ki),hd,gd,Qi,eu=ee({},Ki,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:md,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"?(hd=r.screenX-Qi.screenX,gd=r.screenY-Qi.screenY):gd=hd=0,Qi=r),hd)},movementY:function(r){return"movementY"in r?r.movementY:gd}}),iy=gn(eu),CR=ee({},eu,{dataTransfer:0}),bR=gn(CR),_R=ee({},Ki,{relatedTarget:0}),pd=gn(_R),RR=ee({},Mo,{animationName:0,elapsedTime:0,pseudoElement:0}),ER=gn(RR),PR=ee({},Mo,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),IR=gn(PR),jR=ee({},Mo,{data:0}),ay=gn(jR),NR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},MR={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"},TR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $R(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=TR[r])?!!o[r]:!1}function md(){return $R}var FR=ee({},Ki,{key:function(r){if(r.key){var o=NR[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Xl(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?MR[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:md,charCode:function(r){return r.type==="keypress"?Xl(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Xl(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),LR=gn(FR),OR=ee({},eu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ly=gn(OR),AR=ee({},Ki,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:md}),DR=gn(AR),zR=ee({},Mo,{propertyName:0,elapsedTime:0,pseudoElement:0}),UR=gn(zR),VR=ee({},eu,{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}),BR=gn(VR),qR=[9,13,27,32],yd=f&&"CompositionEvent"in window,Ji=null;f&&"documentMode"in document&&(Ji=document.documentMode);var HR=f&&"TextEvent"in window&&!Ji,uy=f&&(!yd||Ji&&8<Ji&&11>=Ji),cy=" ",fy=!1;function dy(r,o){switch(r){case"keyup":return qR.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hy(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var To=!1;function WR(r,o){switch(r){case"compositionend":return hy(o);case"keypress":return o.which!==32?null:(fy=!0,cy);case"textInput":return r=o.data,r===cy&&fy?null:r;default:return null}}function GR(r,o){if(To)return r==="compositionend"||!yd&&dy(r,o)?(r=sy(),Yl=fd=Hr=null,To=!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 uy&&o.locale!=="ko"?null:o.data;default:return null}}var KR={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 gy(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!KR[r.type]:o==="textarea"}function py(r,o,l,c){F0(c),o=ou(o,"onChange"),0<o.length&&(l=new dd("onChange","change",null,l,c),r.push({event:l,listeners:o}))}var Yi=null,Xi=null;function QR(r){Ty(r,0)}function tu(r){var o=Ao(r);if(Ns(o))return r}function JR(r,o){if(r==="change")return o}var my=!1;if(f){var xd;if(f){var vd="oninput"in document;if(!vd){var yy=document.createElement("div");yy.setAttribute("oninput","return;"),vd=typeof yy.oninput=="function"}xd=vd}else xd=!1;my=xd&&(!document.documentMode||9<document.documentMode)}function xy(){Yi&&(Yi.detachEvent("onpropertychange",vy),Xi=Yi=null)}function vy(r){if(r.propertyName==="value"&&tu(Xi)){var o=[];py(o,Xi,r,Xf(r)),D0(QR,o)}}function YR(r,o,l){r==="focusin"?(xy(),Yi=o,Xi=l,Yi.attachEvent("onpropertychange",vy)):r==="focusout"&&xy()}function XR(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return tu(Xi)}function ZR(r,o){if(r==="click")return tu(o)}function eE(r,o){if(r==="input"||r==="change")return tu(o)}function tE(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Hn=typeof Object.is=="function"?Object.is:tE;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 Sy(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function wy(r,o){var l=Sy(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=Sy(l)}}function ky(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?ky(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Cy(){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 Sd(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 nE(r){var o=Cy(),l=r.focusedElem,c=r.selectionRange;if(o!==l&&l&&l.ownerDocument&&ky(l.ownerDocument.documentElement,l)){if(c!==null&&Sd(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=wy(l,S);var k=wy(l,c);g&&k&&(r.rangeCount!==1||r.anchorNode!==g.node||r.anchorOffset!==g.offset||r.focusNode!==k.node||r.focusOffset!==k.offset)&&(o=o.createRange(),o.setStart(g.node,g.offset),r.removeAllRanges(),S>c?(r.addRange(o),r.extend(k.node,k.offset)):(o.setEnd(k.node,k.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 rE=f&&"documentMode"in document&&11>=document.documentMode,$o=null,wd=null,ea=null,kd=!1;function by(r,o,l){var c=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;kd||$o==null||$o!==Ms(c)||(c=$o,"selectionStart"in c&&Sd(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=ou(wd,"onSelect"),0<c.length&&(o=new dd("onSelect","select",null,o,l),r.push({event:o,listeners:c}),o.target=$o)))}function nu(r,o){var l={};return l[r.toLowerCase()]=o.toLowerCase(),l["Webkit"+r]="webkit"+o,l["Moz"+r]="moz"+o,l}var Fo={animationend:nu("Animation","AnimationEnd"),animationiteration:nu("Animation","AnimationIteration"),animationstart:nu("Animation","AnimationStart"),transitionend:nu("Transition","TransitionEnd")},Cd={},_y={};f&&(_y=document.createElement("div").style,"AnimationEvent"in window||(delete Fo.animationend.animation,delete Fo.animationiteration.animation,delete Fo.animationstart.animation),"TransitionEvent"in window||delete Fo.transitionend.transition);function ru(r){if(Cd[r])return Cd[r];if(!Fo[r])return r;var o=Fo[r],l;for(l in o)if(o.hasOwnProperty(l)&&l in _y)return Cd[r]=o[l];return r}var Ry=ru("animationend"),Ey=ru("animationiteration"),Py=ru("animationstart"),Iy=ru("transitionend"),jy=new Map,Ny="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){jy.set(r,o),a(o,[r])}for(var bd=0;bd<Ny.length;bd++){var _d=Ny[bd],sE=_d.toLowerCase(),oE=_d[0].toUpperCase()+_d.slice(1);Wr(sE,"on"+oE)}Wr(Ry,"onAnimationEnd"),Wr(Ey,"onAnimationIteration"),Wr(Py,"onAnimationStart"),Wr("dblclick","onDoubleClick"),Wr("focusin","onFocus"),Wr("focusout","onBlur"),Wr(Iy,"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(" "),iE=new Set("cancel close invalid load scroll toggle".split(" ").concat(ta));function My(r,o,l){var c=r.type||"unknown-event";r.currentTarget=l,sR(c,o,void 0,r),r.currentTarget=null}function Ty(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 k=c.length-1;0<=k;k--){var I=c[k],N=I.instance,Q=I.currentTarget;if(I=I.listener,N!==S&&g.isPropagationStopped())break e;My(g,I,Q),S=N}else for(k=0;k<c.length;k++){if(I=c[k],N=I.instance,Q=I.currentTarget,I=I.listener,N!==S&&g.isPropagationStopped())break e;My(g,I,Q),S=N}}}if(Ul)throw r=nd,Ul=!1,nd=null,r}function We(r,o){var l=o[Td];l===void 0&&(l=o[Td]=new Set);var c=r+"__bubble";l.has(c)||($y(o,r,2,!1),l.add(c))}function Rd(r,o,l){var c=0;o&&(c|=4),$y(l,r,c,o)}var su="_reactListening"+Math.random().toString(36).slice(2);function na(r){if(!r[su]){r[su]=!0,s.forEach(function(l){l!=="selectionchange"&&(iE.has(l)||Rd(l,!1,r),Rd(l,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[su]||(o[su]=!0,Rd("selectionchange",!1,o))}}function $y(r,o,l,c){switch(ry(o)){case 1:var g=SR;break;case 4:g=wR;break;default:g=ud}l=g.bind(null,o,l,r),g=void 0,!td||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 Ed(r,o,l,c,g){var S=c;if((o&1)===0&&(o&2)===0&&c!==null)e:for(;;){if(c===null)return;var k=c.tag;if(k===3||k===4){var I=c.stateNode.containerInfo;if(I===g||I.nodeType===8&&I.parentNode===g)break;if(k===4)for(k=c.return;k!==null;){var N=k.tag;if((N===3||N===4)&&(N=k.stateNode.containerInfo,N===g||N.nodeType===8&&N.parentNode===g))return;k=k.return}for(;I!==null;){if(k=Fs(I),k===null)return;if(N=k.tag,N===5||N===6){c=S=k;continue e}I=I.parentNode}}c=c.return}D0(function(){var Q=S,oe=Xf(l),ie=[];e:{var ne=jy.get(r);if(ne!==void 0){var fe=dd,ge=r;switch(r){case"keypress":if(Xl(l)===0)break e;case"keydown":case"keyup":fe=LR;break;case"focusin":ge="focus",fe=pd;break;case"focusout":ge="blur",fe=pd;break;case"beforeblur":case"afterblur":fe=pd;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=iy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=bR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=DR;break;case Ry:case Ey:case Py:fe=ER;break;case Iy:fe=UR;break;case"scroll":fe=kR;break;case"wheel":fe=BR;break;case"copy":case"cut":case"paste":fe=IR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=ly}var me=(o&4)!==0,ct=!me&&r==="scroll",B=me?ne!==null?ne+"Capture":null:ne;me=[];for(var $=Q,W;$!==null;){W=$;var le=W.stateNode;if(W.tag===5&&le!==null&&(W=le,B!==null&&(le=Ai($,B),le!=null&&me.push(ra($,le,W)))),ct)break;$=$.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!==Yf&&(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=iy,le="onMouseLeave",B="onMouseEnter",$="mouse",(r==="pointerout"||r==="pointerover")&&(me=ly,le="onPointerLeave",B="onPointerEnter",$="pointer"),ct=fe==null?ne:Ao(fe),W=ge==null?ne:Ao(ge),ne=new me(le,$+"leave",fe,l,oe),ne.target=ct,ne.relatedTarget=W,le=null,Fs(oe)===Q&&(me=new me(B,$+"enter",ge,l,oe),me.target=W,me.relatedTarget=ct,le=me),ct=le,fe&&ge)t:{for(me=fe,B=ge,$=0,W=me;W;W=Lo(W))$++;for(W=0,le=B;le;le=Lo(le))W++;for(;0<$-W;)me=Lo(me),$--;for(;0<W-$;)B=Lo(B),W--;for(;$--;){if(me===B||B!==null&&me===B.alternate)break t;me=Lo(me),B=Lo(B)}me=null}else me=null;fe!==null&&Fy(ie,ne,fe,me,!1),ge!==null&&ct!==null&&Fy(ie,ct,ge,me,!0)}}e:{if(ne=Q?Ao(Q):window,fe=ne.nodeName&&ne.nodeName.toLowerCase(),fe==="select"||fe==="input"&&ne.type==="file")var ye=JR;else if(gy(ne))if(my)ye=eE;else{ye=XR;var xe=YR}else(fe=ne.nodeName)&&fe.toLowerCase()==="input"&&(ne.type==="checkbox"||ne.type==="radio")&&(ye=ZR);if(ye&&(ye=ye(r,Q))){py(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?Ao(Q):window,r){case"focusin":(gy(xe)||xe.contentEditable==="true")&&($o=xe,wd=Q,ea=null);break;case"focusout":ea=wd=$o=null;break;case"mousedown":kd=!0;break;case"contextmenu":case"mouseup":case"dragend":kd=!1,by(ie,l,oe);break;case"selectionchange":if(rE)break;case"keydown":case"keyup":by(ie,l,oe)}var ve;if(yd)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 To?dy(r,l)&&(ke="onCompositionEnd"):r==="keydown"&&l.keyCode===229&&(ke="onCompositionStart");ke&&(uy&&l.locale!=="ko"&&(To||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&To&&(ve=sy()):(Hr=oe,fd="value"in Hr?Hr.value:Hr.textContent,To=!0)),xe=ou(Q,ke),0<xe.length&&(ke=new ay(ke,r,null,l,oe),ie.push({event:ke,listeners:xe}),ve?ke.data=ve:(ve=hy(l),ve!==null&&(ke.data=ve)))),(ve=HR?WR(r,l):GR(r,l))&&(Q=ou(Q,"onBeforeInput"),0<Q.length&&(oe=new ay("onBeforeInput","beforeinput",null,l,oe),ie.push({event:oe,listeners:Q}),oe.data=ve))}Ty(ie,o)})}function ra(r,o,l){return{instance:r,listener:o,currentTarget:l}}function ou(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 Lo(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function Fy(r,o,l,c,g){for(var S=o._reactName,k=[];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&&k.unshift(ra(l,N,I))):g||(N=Ai(l,S),N!=null&&k.push(ra(l,N,I)))),l=l.return}k.length!==0&&r.push({event:o,listeners:k})}var aE=/\r\n?/g,lE=/\u0000|\uFFFD/g;function Ly(r){return(typeof r=="string"?r:""+r).replace(aE,`
39
- `).replace(lE,"")}function iu(r,o,l){if(o=Ly(o),Ly(r)!==o&&l)throw Error(n(425))}function au(){}var Pd=null,Id=null;function jd(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 Nd=typeof setTimeout=="function"?setTimeout:void 0,uE=typeof clearTimeout=="function"?clearTimeout:void 0,Oy=typeof Promise=="function"?Promise:void 0,cE=typeof queueMicrotask=="function"?queueMicrotask:typeof Oy<"u"?function(r){return Oy.resolve(null).then(r).catch(fE)}:Nd;function fE(r){setTimeout(function(){throw r})}function Md(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 Ay(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 Oo=Math.random().toString(36).slice(2),lr="__reactFiber$"+Oo,sa="__reactProps$"+Oo,kr="__reactContainer$"+Oo,Td="__reactEvents$"+Oo,dE="__reactListeners$"+Oo,hE="__reactHandles$"+Oo;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=Ay(r);r!==null;){if(l=r[lr])return l;r=Ay(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 Ao(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function lu(r){return r[sa]||null}var $d=[],Do=-1;function Kr(r){return{current:r}}function Ge(r){0>Do||(r.current=$d[Do],$d[Do]=null,Do--)}function qe(r,o){Do++,$d[Do]=r.current,r.current=o}var Qr={},Lt=Kr(Qr),en=Kr(!1),Ls=Qr;function zo(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 tn(r){return r=r.childContextTypes,r!=null}function uu(){Ge(en),Ge(Lt)}function Dy(r,o,l){if(Lt.current!==Qr)throw Error(n(168));qe(Lt,o),qe(en,l)}function zy(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 cu(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Qr,Ls=Lt.current,qe(Lt,r),qe(en,en.current),!0}function Uy(r,o,l){var c=r.stateNode;if(!c)throw Error(n(169));l?(r=zy(r,o,Ls),c.__reactInternalMemoizedMergedChildContext=r,Ge(en),Ge(Lt),qe(Lt,r)):Ge(en),qe(en,l)}var Cr=null,fu=!1,Fd=!1;function Vy(r){Cr===null?Cr=[r]:Cr.push(r)}function gE(r){fu=!0,Vy(r)}function Jr(){if(!Fd&&Cr!==null){Fd=!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,fu=!1}catch(g){throw Cr!==null&&(Cr=Cr.slice(r+1)),q0(rd,Jr),g}finally{Ae=o,Fd=!1}}return null}var Uo=[],Vo=0,du=null,hu=0,Pn=[],In=0,Os=null,br=1,_r="";function As(r,o){Uo[Vo++]=hu,Uo[Vo++]=du,du=r,hu=o}function By(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 k=g-g%5;S=(c&(1<<k)-1).toString(32),c>>=k,g-=k,br=1<<32-qn(o)+g|l<<g|c,_r=S+r}else br=1<<S|l<<g|c,_r=r}function Ld(r){r.return!==null&&(As(r,1),By(r,1,0))}function Od(r){for(;r===du;)du=Uo[--Vo],Uo[Vo]=null,hu=Uo[--Vo],Uo[Vo]=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 qy(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 Hy(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 Ad(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Dd(r){if(Qe){var o=mn;if(o){var l=o;if(!Hy(r,o)){if(Ad(r))throw Error(n(418));o=Gr(l.nextSibling);var c=pn;o&&Hy(r,o)?qy(c,l):(r.flags=r.flags&-4097|2,Qe=!1,pn=r)}}else{if(Ad(r))throw Error(n(418));r.flags=r.flags&-4097|2,Qe=!1,pn=r}}}function Wy(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;pn=r}function gu(r){if(r!==pn)return!1;if(!Qe)return Wy(r),Qe=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!jd(r.type,r.memoizedProps)),o&&(o=mn)){if(Ad(r))throw Gy(),Error(n(418));for(;o;)qy(r,o),o=Gr(o.nextSibling)}if(Wy(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 Gy(){for(var r=mn;r;)r=Gr(r.nextSibling)}function Bo(){mn=pn=null,Qe=!1}function zd(r){Wn===null?Wn=[r]:Wn.push(r)}var pE=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(k){var I=g.refs;k===null?delete I[S]:I[S]=k},o._stringRef=S,o)}if(typeof r!="string")throw Error(n(284));if(!l._owner)throw Error(n(290,r))}return r}function pu(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function Ky(r){var o=r._init;return o(r._payload)}function Qy(r){function o(B,$){if(r){var W=B.deletions;W===null?(B.deletions=[$],B.flags|=16):W.push($)}}function l(B,$){if(!r)return null;for(;$!==null;)o(B,$),$=$.sibling;return null}function c(B,$){for(B=new Map;$!==null;)$.key!==null?B.set($.key,$):B.set($.index,$),$=$.sibling;return B}function g(B,$){return B=ss(B,$),B.index=0,B.sibling=null,B}function S(B,$,W){return B.index=W,r?(W=B.alternate,W!==null?(W=W.index,W<$?(B.flags|=2,$):W):(B.flags|=2,$)):(B.flags|=1048576,$)}function k(B){return r&&B.alternate===null&&(B.flags|=2),B}function I(B,$,W,le){return $===null||$.tag!==6?($=Nh(W,B.mode,le),$.return=B,$):($=g($,W),$.return=B,$)}function N(B,$,W,le){var ye=W.type;return ye===T?oe(B,$,W.props.children,le,W.key):$!==null&&($.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===K&&Ky(ye)===$.type)?(le=g($,W.props),le.ref=ia(B,$,W),le.return=B,le):(le=Du(W.type,W.key,W.props,null,B.mode,le),le.ref=ia(B,$,W),le.return=B,le)}function Q(B,$,W,le){return $===null||$.tag!==4||$.stateNode.containerInfo!==W.containerInfo||$.stateNode.implementation!==W.implementation?($=Mh(W,B.mode,le),$.return=B,$):($=g($,W.children||[]),$.return=B,$)}function oe(B,$,W,le,ye){return $===null||$.tag!==7?($=Ws(W,B.mode,le,ye),$.return=B,$):($=g($,W),$.return=B,$)}function ie(B,$,W){if(typeof $=="string"&&$!==""||typeof $=="number")return $=Nh(""+$,B.mode,W),$.return=B,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case F:return W=Du($.type,$.key,$.props,null,B.mode,W),W.ref=ia(B,null,$),W.return=B,W;case A:return $=Mh($,B.mode,W),$.return=B,$;case K:var le=$._init;return ie(B,le($._payload),W)}if(hn($)||se($))return $=Ws($,B.mode,W,null),$.return=B,$;pu(B,$)}return null}function ne(B,$,W,le){var ye=$!==null?$.key:null;if(typeof W=="string"&&W!==""||typeof W=="number")return ye!==null?null:I(B,$,""+W,le);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case F:return W.key===ye?N(B,$,W,le):null;case A:return W.key===ye?Q(B,$,W,le):null;case K:return ye=W._init,ne(B,$,ye(W._payload),le)}if(hn(W)||se(W))return ye!==null?null:oe(B,$,W,le,null);pu(B,W)}return null}function fe(B,$,W,le,ye){if(typeof le=="string"&&le!==""||typeof le=="number")return B=B.get(W)||null,I($,B,""+le,ye);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case F:return B=B.get(le.key===null?W:le.key)||null,N($,B,le,ye);case A:return B=B.get(le.key===null?W:le.key)||null,Q($,B,le,ye);case K:var xe=le._init;return fe(B,$,W,xe(le._payload),ye)}if(hn(le)||se(le))return B=B.get(W)||null,oe($,B,le,ye,null);pu($,le)}return null}function ge(B,$,W,le){for(var ye=null,xe=null,ve=$,ke=$=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),$=S(Fe,$,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&&($=S(ve,$,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),$=S(Ct,$,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,$,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=$,ke=$=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),$=S(os,$,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&&($=S(Fe,$,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),$=S(Fe,$,ke),xe===null?ye=Fe:xe.sibling=Fe,xe=Fe);return r&&ve.forEach(function(KE){return o(B,KE)}),Qe&&As(B,ke),ye}function ct(B,$,W,le){if(typeof W=="object"&&W!==null&&W.type===T&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case F:e:{for(var ye=W.key,xe=$;xe!==null;){if(xe.key===ye){if(ye=W.type,ye===T){if(xe.tag===7){l(B,xe.sibling),$=g(xe,W.props.children),$.return=B,B=$;break e}}else if(xe.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===K&&Ky(ye)===xe.type){l(B,xe.sibling),$=g(xe,W.props),$.ref=ia(B,xe,W),$.return=B,B=$;break e}l(B,xe);break}else o(B,xe);xe=xe.sibling}W.type===T?($=Ws(W.props.children,B.mode,le,W.key),$.return=B,B=$):(le=Du(W.type,W.key,W.props,null,B.mode,le),le.ref=ia(B,$,W),le.return=B,B=le)}return k(B);case A:e:{for(xe=W.key;$!==null;){if($.key===xe)if($.tag===4&&$.stateNode.containerInfo===W.containerInfo&&$.stateNode.implementation===W.implementation){l(B,$.sibling),$=g($,W.children||[]),$.return=B,B=$;break e}else{l(B,$);break}else o(B,$);$=$.sibling}$=Mh(W,B.mode,le),$.return=B,B=$}return k(B);case K:return xe=W._init,ct(B,$,xe(W._payload),le)}if(hn(W))return ge(B,$,W,le);if(se(W))return me(B,$,W,le);pu(B,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,$!==null&&$.tag===6?(l(B,$.sibling),$=g($,W),$.return=B,B=$):(l(B,$),$=Nh(W,B.mode,le),$.return=B,B=$),k(B)):l(B,$)}return ct}var qo=Qy(!0),Jy=Qy(!1),mu=Kr(null),yu=null,Ho=null,Ud=null;function Vd(){Ud=Ho=yu=null}function Bd(r){var o=mu.current;Ge(mu),r._currentValue=o}function qd(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 Wo(r,o){yu=r,Ud=Ho=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(nn=!0),r.firstContext=null)}function jn(r){var o=r._currentValue;if(Ud!==r)if(r={context:r,memoizedValue:o,next:null},Ho===null){if(yu===null)throw Error(n(308));Ho=r,yu.dependencies={lanes:0,firstContext:r}}else Ho=Ho.next=r;return o}var Ds=null;function Hd(r){Ds===null?Ds=[r]:Ds.push(r)}function Yy(r,o,l,c){var g=o.interleaved;return g===null?(l.next=l,Hd(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 Wd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xy(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,Hd(c)):(o.next=g.next,g.next=o),c.interleaved=o,Rr(r,l)}function xu(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,id(r,l)}}function Zy(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 k={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};S===null?g=S=k:S=S.next=k,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 vu(r,o,l,c){var g=r.updateQueue;Yr=!1;var S=g.firstBaseUpdate,k=g.lastBaseUpdate,I=g.shared.pending;if(I!==null){g.shared.pending=null;var N=I,Q=N.next;N.next=null,k===null?S=Q:k.next=Q,k=N;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,I=oe.lastBaseUpdate,I!==k&&(I===null?oe.firstBaseUpdate=Q:I.next=Q,oe.lastBaseUpdate=N))}if(S!==null){var ie=g.baseState;k=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,k|=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 k|=g.lane,g=g.next;while(g!==o)}else S===null&&(g.shared.lanes=0);Vs|=k,r.lanes=k,r.memoizedState=ie}}function ex(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 Gd(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 Go(){Ge(ur),Ge(la),Ge(ua)}function tx(r){zs(ua.current);var o=zs(ur.current),l=Bn(o,r.type);o!==l&&(qe(la,r),qe(ur,l))}function Kd(r){la.current===r&&(Ge(ur),Ge(la))}var Ze=Kr(0);function Su(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 Qd=[];function Jd(){for(var r=0;r<Qd.length;r++)Qd[r]._workInProgressVersionPrimary=null;Qd.length=0}var wu=R.ReactCurrentDispatcher,Yd=R.ReactCurrentBatchConfig,Us=0,et=null,mt=null,wt=null,ku=!1,ca=!1,fa=0,mE=0;function Ot(){throw Error(n(321))}function Xd(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 Zd(r,o,l,c,g,S){if(Us=S,et=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,wu.current=r===null||r.memoizedState===null?SE:wE,r=l(c,g),ca){S=0;do{if(ca=!1,fa=0,25<=S)throw Error(n(301));S+=1,wt=mt=null,o.updateQueue=null,wu.current=kE,r=l(c,g)}while(ca)}if(wu.current=_u,o=mt!==null&&mt.next!==null,Us=0,wt=mt=et=null,ku=!1,o)throw Error(n(300));return r}function eh(){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(mt===null){var r=et.alternate;r=r!==null?r.memoizedState:null}else r=mt.next;var o=wt===null?et.memoizedState:wt.next;if(o!==null)wt=o,mt=r;else{if(r===null)throw Error(n(310));mt=r,r={memoizedState:mt.memoizedState,baseState:mt.baseState,baseQueue:mt.baseQueue,queue:mt.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 th(r){var o=Nn(),l=o.queue;if(l===null)throw Error(n(311));l.lastRenderedReducer=r;var c=mt,g=c.baseQueue,S=l.pending;if(S!==null){if(g!==null){var k=g.next;g.next=S.next,S.next=k}c.baseQueue=g=S,l.pending=null}if(g!==null){S=g.next,c=c.baseState;var I=k=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,k=c):N=N.next=ie,et.lanes|=oe,Vs|=oe}Q=Q.next}while(Q!==null&&Q!==S);N===null?k=c:N.next=I,Hn(c,o.memoizedState)||(nn=!0),o.memoizedState=c,o.baseState=k,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 nh(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 k=g=g.next;do S=r(S,k.action),k=k.next;while(k!==g);Hn(S,o.memoizedState)||(nn=!0),o.memoizedState=S,o.baseQueue===null&&(o.baseState=S),l.lastRenderedState=S}return[S,c]}function nx(){}function rx(r,o){var l=et,c=Nn(),g=o(),S=!Hn(c.memoizedState,g);if(S&&(c.memoizedState=g,nn=!0),c=c.queue,rh(ix.bind(null,l,c,r),[r]),c.getSnapshot!==o||S||wt!==null&&wt.memoizedState.tag&1){if(l.flags|=2048,ha(9,ox.bind(null,l,c,g,o),void 0,null),kt===null)throw Error(n(349));(Us&30)!==0||sx(l,o,g)}return g}function sx(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 ox(r,o,l,c){o.value=l,o.getSnapshot=c,ax(o)&&lx(r)}function ix(r,o,l){return l(function(){ax(o)&&lx(r)})}function ax(r){var o=r.getSnapshot;r=r.value;try{var l=o();return!Hn(r,l)}catch{return!0}}function lx(r){var o=Rr(r,1);o!==null&&Jn(o,r,1,-1)}function ux(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=vE.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 cx(){return Nn().memoizedState}function Cu(r,o,l,c){var g=cr();et.flags|=r,g.memoizedState=ha(1|o,l,void 0,c===void 0?null:c)}function bu(r,o,l,c){var g=Nn();c=c===void 0?null:c;var S=void 0;if(mt!==null){var k=mt.memoizedState;if(S=k.destroy,c!==null&&Xd(c,k.deps)){g.memoizedState=ha(o,l,S,c);return}}et.flags|=r,g.memoizedState=ha(1|o,l,S,c)}function fx(r,o){return Cu(8390656,8,r,o)}function rh(r,o){return bu(2048,8,r,o)}function dx(r,o){return bu(4,2,r,o)}function hx(r,o){return bu(4,4,r,o)}function gx(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 px(r,o,l){return l=l!=null?l.concat([r]):null,bu(4,4,gx.bind(null,o,r),l)}function sh(){}function mx(r,o){var l=Nn();o=o===void 0?null:o;var c=l.memoizedState;return c!==null&&o!==null&&Xd(o,c[1])?c[0]:(l.memoizedState=[r,o],r)}function yx(r,o){var l=Nn();o=o===void 0?null:o;var c=l.memoizedState;return c!==null&&o!==null&&Xd(o,c[1])?c[0]:(r=r(),l.memoizedState=[r,o],r)}function xx(r,o,l){return(Us&21)===0?(r.baseState&&(r.baseState=!1,nn=!0),r.memoizedState=l):(Hn(l,o)||(l=K0(),et.lanes|=l,Vs|=l,r.baseState=!0),o)}function yE(r,o){var l=Ae;Ae=l!==0&&4>l?l:4,r(!0);var c=Yd.transition;Yd.transition={};try{r(!1),o()}finally{Ae=l,Yd.transition=c}}function vx(){return Nn().memoizedState}function xE(r,o,l){var c=ns(r);if(l={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null},Sx(r))wx(o,l);else if(l=Yy(r,o,l,c),l!==null){var g=Qt();Jn(l,r,c,g),kx(l,o,c)}}function vE(r,o,l){var c=ns(r),g={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null};if(Sx(r))wx(o,g);else{var S=r.alternate;if(r.lanes===0&&(S===null||S.lanes===0)&&(S=o.lastRenderedReducer,S!==null))try{var k=o.lastRenderedState,I=S(k,l);if(g.hasEagerState=!0,g.eagerState=I,Hn(I,k)){var N=o.interleaved;N===null?(g.next=g,Hd(o)):(g.next=N.next,N.next=g),o.interleaved=g;return}}catch{}finally{}l=Yy(r,o,g,c),l!==null&&(g=Qt(),Jn(l,r,c,g),kx(l,o,c))}}function Sx(r){var o=r.alternate;return r===et||o!==null&&o===et}function wx(r,o){ca=ku=!0;var l=r.pending;l===null?o.next=o:(o.next=l.next,l.next=o),r.pending=o}function kx(r,o,l){if((l&4194240)!==0){var c=o.lanes;c&=r.pendingLanes,l|=c,o.lanes=l,id(r,l)}}var _u={readContext:jn,useCallback:Ot,useContext:Ot,useEffect:Ot,useImperativeHandle:Ot,useInsertionEffect:Ot,useLayoutEffect:Ot,useMemo:Ot,useReducer:Ot,useRef:Ot,useState:Ot,useDebugValue:Ot,useDeferredValue:Ot,useTransition:Ot,useMutableSource:Ot,useSyncExternalStore:Ot,useId:Ot,unstable_isNewReconciler:!1},SE={readContext:jn,useCallback:function(r,o){return cr().memoizedState=[r,o===void 0?null:o],r},useContext:jn,useEffect:fx,useImperativeHandle:function(r,o,l){return l=l!=null?l.concat([r]):null,Cu(4194308,4,gx.bind(null,o,r),l)},useLayoutEffect:function(r,o){return Cu(4194308,4,r,o)},useInsertionEffect:function(r,o){return Cu(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=xE.bind(null,et,r),[c.memoizedState,r]},useRef:function(r){var o=cr();return r={current:r},o.memoizedState=r},useState:ux,useDebugValue:sh,useDeferredValue:function(r){return cr().memoizedState=r},useTransition:function(){var r=ux(!1),o=r[0];return r=yE.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||sx(c,o,l)}g.memoizedState=l;var S={value:l,getSnapshot:o};return g.queue=S,fx(ix.bind(null,c,S,r),[r]),c.flags|=2048,ha(9,ox.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=mE++,o=":"+o+"r"+l.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},wE={readContext:jn,useCallback:mx,useContext:jn,useEffect:rh,useImperativeHandle:px,useInsertionEffect:dx,useLayoutEffect:hx,useMemo:yx,useReducer:th,useRef:cx,useState:function(){return th(da)},useDebugValue:sh,useDeferredValue:function(r){var o=Nn();return xx(o,mt.memoizedState,r)},useTransition:function(){var r=th(da)[0],o=Nn().memoizedState;return[r,o]},useMutableSource:nx,useSyncExternalStore:rx,useId:vx,unstable_isNewReconciler:!1},kE={readContext:jn,useCallback:mx,useContext:jn,useEffect:rh,useImperativeHandle:px,useInsertionEffect:dx,useLayoutEffect:hx,useMemo:yx,useReducer:nh,useRef:cx,useState:function(){return nh(da)},useDebugValue:sh,useDeferredValue:function(r){var o=Nn();return mt===null?o.memoizedState=r:xx(o,mt.memoizedState,r)},useTransition:function(){var r=nh(da)[0],o=Nn().memoizedState;return[r,o]},useMutableSource:nx,useSyncExternalStore:rx,useId:vx,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 oh(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 Ru={isMounted:function(r){return(r=r._reactInternals)?$s(r)===r:!1},enqueueSetState:function(r,o,l){r=r._reactInternals;var c=Qt(),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),xu(o,r,g))},enqueueReplaceState:function(r,o,l){r=r._reactInternals;var c=Qt(),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),xu(o,r,g))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var l=Qt(),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),xu(o,r,c))}};function Cx(r,o,l,c,g,S,k){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(c,S,k):o.prototype&&o.prototype.isPureReactComponent?!Zi(l,c)||!Zi(g,S):!0}function bx(r,o,l){var c=!1,g=Qr,S=o.contextType;return typeof S=="object"&&S!==null?S=jn(S):(g=tn(o)?Ls:Lt.current,c=o.contextTypes,S=(c=c!=null)?zo(r,g):Qr),o=new o(l,S),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Ru,r.stateNode=o,o._reactInternals=r,c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=g,r.__reactInternalMemoizedMaskedChildContext=S),o}function _x(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&&Ru.enqueueReplaceState(o,o.state,null)}function ih(r,o,l,c){var g=r.stateNode;g.props=l,g.state=r.memoizedState,g.refs={},Wd(r);var S=o.contextType;typeof S=="object"&&S!==null?g.context=jn(S):(S=tn(o)?Ls:Lt.current,g.context=zo(r,S)),g.state=r.memoizedState,S=o.getDerivedStateFromProps,typeof S=="function"&&(oh(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&&Ru.enqueueReplaceState(g,g.state,null),vu(r,l,g,c),g.state=r.memoizedState),typeof g.componentDidMount=="function"&&(r.flags|=4194308)}function Ko(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 ah(r,o,l){return{value:r,source:null,stack:l??null,digest:o??null}}function lh(r,o){try{console.error(o.value)}catch(l){setTimeout(function(){throw l})}}var CE=typeof WeakMap=="function"?WeakMap:Map;function Rx(r,o,l){l=Er(-1,l),l.tag=3,l.payload={element:null};var c=o.value;return l.callback=function(){Tu||(Tu=!0,Ch=c),lh(r,o)},l}function Ex(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(){lh(r,o)}}var S=r.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(l.callback=function(){lh(r,o),typeof c!="function"&&(es===null?es=new Set([this]):es.add(this));var k=o.stack;this.componentDidCatch(o.value,{componentStack:k!==null?k:""})}),l}function Px(r,o,l){var c=r.pingCache;if(c===null){c=r.pingCache=new CE;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=OE.bind(null,r,o,l),o.then(r,r))}function Ix(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 jx(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 bE=R.ReactCurrentOwner,nn=!1;function Kt(r,o,l,c){o.child=r===null?Jy(o,null,l,c):qo(o,r.child,l,c)}function Nx(r,o,l,c,g){l=l.render;var S=o.ref;return Wo(o,g),c=Zd(r,o,l,c,S,g),l=eh(),r!==null&&!nn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~g,Pr(r,o,g)):(Qe&&l&&Ld(o),o.flags|=1,Kt(r,o,c,g),o.child)}function Mx(r,o,l,c,g){if(r===null){var S=l.type;return typeof S=="function"&&!jh(S)&&S.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(o.tag=15,o.type=S,Tx(r,o,S,c,g)):(r=Du(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 k=S.memoizedProps;if(l=l.compare,l=l!==null?l:Zi,l(k,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 Tx(r,o,l,c,g){if(r!==null){var S=r.memoizedProps;if(Zi(S,c)&&r.ref===o.ref)if(nn=!1,o.pendingProps=c=S,(r.lanes&g)!==0)(r.flags&131072)!==0&&(nn=!0);else return o.lanes=r.lanes,Pr(r,o,g)}return uh(r,o,l,c,g)}function $x(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(Jo,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(Jo,yn),yn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=S!==null?S.baseLanes:l,qe(Jo,yn),yn|=c}else S!==null?(c=S.baseLanes|l,o.memoizedState=null):c=l,qe(Jo,yn),yn|=c;return Kt(r,o,g,l),o.child}function Fx(r,o){var l=o.ref;(r===null&&l!==null||r!==null&&r.ref!==l)&&(o.flags|=512,o.flags|=2097152)}function uh(r,o,l,c,g){var S=tn(l)?Ls:Lt.current;return S=zo(o,S),Wo(o,g),l=Zd(r,o,l,c,S,g),c=eh(),r!==null&&!nn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~g,Pr(r,o,g)):(Qe&&c&&Ld(o),o.flags|=1,Kt(r,o,l,g),o.child)}function Lx(r,o,l,c,g){if(tn(l)){var S=!0;cu(o)}else S=!1;if(Wo(o,g),o.stateNode===null)Pu(r,o),bx(o,l,c),ih(o,l,c,g),c=!0;else if(r===null){var k=o.stateNode,I=o.memoizedProps;k.props=I;var N=k.context,Q=l.contextType;typeof Q=="object"&&Q!==null?Q=jn(Q):(Q=tn(l)?Ls:Lt.current,Q=zo(o,Q));var oe=l.getDerivedStateFromProps,ie=typeof oe=="function"||typeof k.getSnapshotBeforeUpdate=="function";ie||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(I!==c||N!==Q)&&_x(o,k,c,Q),Yr=!1;var ne=o.memoizedState;k.state=ne,vu(o,c,k,g),N=o.memoizedState,I!==c||ne!==N||en.current||Yr?(typeof oe=="function"&&(oh(o,l,oe,c),N=o.memoizedState),(I=Yr||Cx(o,l,I,c,ne,N,Q))?(ie||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(o.flags|=4194308)):(typeof k.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=c,o.memoizedState=N),k.props=c,k.state=N,k.context=Q,c=I):(typeof k.componentDidMount=="function"&&(o.flags|=4194308),c=!1)}else{k=o.stateNode,Xy(r,o),I=o.memoizedProps,Q=o.type===o.elementType?I:Gn(o.type,I),k.props=Q,ie=o.pendingProps,ne=k.context,N=l.contextType,typeof N=="object"&&N!==null?N=jn(N):(N=tn(l)?Ls:Lt.current,N=zo(o,N));var fe=l.getDerivedStateFromProps;(oe=typeof fe=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(I!==ie||ne!==N)&&_x(o,k,c,N),Yr=!1,ne=o.memoizedState,k.state=ne,vu(o,c,k,g);var ge=o.memoizedState;I!==ie||ne!==ge||en.current||Yr?(typeof fe=="function"&&(oh(o,l,fe,c),ge=o.memoizedState),(Q=Yr||Cx(o,l,Q,c,ne,ge,N)||!1)?(oe||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(c,ge,N),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(c,ge,N)),typeof k.componentDidUpdate=="function"&&(o.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof k.componentDidUpdate!="function"||I===r.memoizedProps&&ne===r.memoizedState||(o.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||I===r.memoizedProps&&ne===r.memoizedState||(o.flags|=1024),o.memoizedProps=c,o.memoizedState=ge),k.props=c,k.state=ge,k.context=N,c=Q):(typeof k.componentDidUpdate!="function"||I===r.memoizedProps&&ne===r.memoizedState||(o.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||I===r.memoizedProps&&ne===r.memoizedState||(o.flags|=1024),c=!1)}return ch(r,o,l,c,S,g)}function ch(r,o,l,c,g,S){Fx(r,o);var k=(o.flags&128)!==0;if(!c&&!k)return g&&Uy(o,l,!1),Pr(r,o,S);c=o.stateNode,bE.current=o;var I=k&&typeof l.getDerivedStateFromError!="function"?null:c.render();return o.flags|=1,r!==null&&k?(o.child=qo(o,r.child,null,S),o.child=qo(o,null,I,S)):Kt(r,o,I,S),o.memoizedState=c.state,g&&Uy(o,l,!0),o.child}function Ox(r){var o=r.stateNode;o.pendingContext?Dy(r,o.pendingContext,o.pendingContext!==o.context):o.context&&Dy(r,o.context,!1),Gd(r,o.containerInfo)}function Ax(r,o,l,c,g){return Bo(),zd(g),o.flags|=256,Kt(r,o,l,c),o.child}var fh={dehydrated:null,treeContext:null,retryLane:0};function dh(r){return{baseLanes:r,cachePool:null,transitions:null}}function Dx(r,o,l){var c=o.pendingProps,g=Ze.current,S=!1,k=(o.flags&128)!==0,I;if((I=k)||(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 Dd(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):(k=c.children,r=c.fallback,S?(c=o.mode,S=o.child,k={mode:"hidden",children:k},(c&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=k):S=zu(k,c,0,null),r=Ws(r,c,l,null),S.return=o,r.return=o,S.sibling=r,o.child=S,o.child.memoizedState=dh(l),o.memoizedState=fh,r):hh(o,k));if(g=r.memoizedState,g!==null&&(I=g.dehydrated,I!==null))return _E(r,o,k,c,I,g,l);if(S){S=c.fallback,k=o.mode,g=r.child,I=g.sibling;var N={mode:"hidden",children:c.children};return(k&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,k,l,null),S.flags|=2),S.return=o,c.return=o,c.sibling=S,o.child=c,c=S,S=o.child,k=r.child.memoizedState,k=k===null?dh(l):{baseLanes:k.baseLanes|l,cachePool:null,transitions:k.transitions},S.memoizedState=k,S.childLanes=r.childLanes&~l,o.memoizedState=fh,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 hh(r,o){return o=zu({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Eu(r,o,l,c){return c!==null&&zd(c),qo(o,r.child,null,l),r=hh(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function _E(r,o,l,c,g,S,k){if(l)return o.flags&256?(o.flags&=-257,c=ah(Error(n(422))),Eu(r,o,k,c)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(S=c.fallback,g=o.mode,c=zu({mode:"visible",children:c.children},g,0,null),S=Ws(S,g,k,null),S.flags|=2,c.return=o,S.return=o,c.sibling=S,o.child=c,(o.mode&1)!==0&&qo(o,r.child,null,k),o.child.memoizedState=dh(k),o.memoizedState=fh,S);if((o.mode&1)===0)return Eu(r,o,k,null);if(g.data==="$!"){if(c=g.nextSibling&&g.nextSibling.dataset,c)var I=c.dgst;return c=I,S=Error(n(419)),c=ah(S,c,void 0),Eu(r,o,k,c)}if(I=(k&r.childLanes)!==0,nn||I){if(c=kt,c!==null){switch(k&-k){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|k))!==0?0:g,g!==0&&g!==S.retryLane&&(S.retryLane=g,Rr(r,g),Jn(c,r,g,-1))}return Ih(),c=ah(Error(n(421))),Eu(r,o,k,c)}return g.data==="$?"?(o.flags|=128,o.child=r.child,o=AE.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=hh(o,c.children),o.flags|=4096,o)}function zx(r,o,l){r.lanes|=o;var c=r.alternate;c!==null&&(c.lanes|=o),qd(r.return,o,l)}function gh(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 Ux(r,o,l){var c=o.pendingProps,g=c.revealOrder,S=c.tail;if(Kt(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&&zx(r,l,o);else if(r.tag===19)zx(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&&Su(r)===null&&(g=l),l=l.sibling;l=g,l===null?(g=o.child,o.child=null):(g=l.sibling,l.sibling=null),gh(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&&Su(r)===null){o.child=g;break}r=g.sibling,g.sibling=l,l=g,g=r}gh(o,!0,l,null,S);break;case"together":gh(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Pu(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 RE(r,o,l){switch(o.tag){case 3:Ox(o),Bo();break;case 5:tx(o);break;case 1:tn(o.type)&&cu(o);break;case 4:Gd(o,o.stateNode.containerInfo);break;case 10:var c=o.type._context,g=o.memoizedProps.value;qe(mu,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?Dx(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 Ux(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,$x(r,o,l)}return Pr(r,o,l)}var Vx,ph,Bx,qx;Vx=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}},ph=function(){},Bx=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=_o(r,g),c=_o(r,c),S=[];break;case"select":g=ee({},g,{value:void 0}),c=ee({},c,{value:void 0}),S=[];break;case"textarea":g=Eo(r,g),c=Eo(r,c),S=[];break;default:typeof g.onClick!="function"&&typeof c.onClick=="function"&&(r.onclick=au)}Qf(l,c);var k;l=null;for(Q in g)if(!c.hasOwnProperty(Q)&&g.hasOwnProperty(Q)&&g[Q]!=null)if(Q==="style"){var I=g[Q];for(k in I)I.hasOwnProperty(k)&&(l||(l={}),l[k]="")}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(k in I)!I.hasOwnProperty(k)||N&&N.hasOwnProperty(k)||(l||(l={}),l[k]="");for(k in N)N.hasOwnProperty(k)&&I[k]!==N[k]&&(l||(l={}),l[k]=N[k])}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)}},qx=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 At(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 EE(r,o,l){var c=o.pendingProps;switch(Od(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return At(o),null;case 1:return tn(o.type)&&uu(),At(o),null;case 3:return c=o.stateNode,Go(),Ge(en),Ge(Lt),Jd(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(gu(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Wn!==null&&(Rh(Wn),Wn=null))),ph(r,o),At(o),null;case 5:Kd(o);var g=zs(ua.current);if(l=o.type,r!==null&&o.stateNode!=null)Bx(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 At(o),null}if(r=zs(ur.current),gu(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":Al(c,S),We("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!S.multiple},We("invalid",c);break;case"textarea":Dl(c,S),We("invalid",c)}Qf(l,S),g=null;for(var k in S)if(S.hasOwnProperty(k)){var I=S[k];k==="children"?typeof I=="string"?c.textContent!==I&&(S.suppressHydrationWarning!==!0&&iu(c.textContent,I,r),g=["children",I]):typeof I=="number"&&c.textContent!==""+I&&(S.suppressHydrationWarning!==!0&&iu(c.textContent,I,r),g=["children",""+I]):i.hasOwnProperty(k)&&I!=null&&k==="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=au)}c=g,o.updateQueue=c,c!==null&&(o.flags|=4)}else{k=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=k.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof c.is=="string"?r=k.createElement(l,{is:c.is}):(r=k.createElement(l),l==="select"&&(k=r,c.multiple?k.multiple=!0:c.size&&(k.size=c.size))):r=k.createElementNS(r,l),r[lr]=o,r[sa]=c,Vx(r,o,!1,!1),o.stateNode=r;e:{switch(k=Jf(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":Al(r,c),g=_o(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":Dl(r,c),g=Eo(r,c),We("invalid",r);break;default:g=c}Qf(l,g),I=g;for(S in I)if(I.hasOwnProperty(S)){var N=I[S];S==="style"?T0(r,N):S==="dangerouslySetInnerHTML"?(N=N?N.__html:void 0,N!=null&&N0(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,k))}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=au)}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 At(o),null;case 6:if(r&&o.stateNode!=null)qx(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),gu(o)){if(c=o.stateNode,l=o.memoizedProps,c[lr]=o,(S=c.nodeValue!==l)&&(r=pn,r!==null))switch(r.tag){case 3:iu(c.nodeValue,l,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&iu(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 At(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)Gy(),Bo(),o.flags|=98560,S=!1;else if(S=gu(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 Bo(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;At(o),S=!1}else Wn!==null&&(Rh(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?yt===0&&(yt=3):Ih())),o.updateQueue!==null&&(o.flags|=4),At(o),null);case 4:return Go(),ph(r,o),r===null&&na(o.stateNode.containerInfo),At(o),null;case 10:return Bd(o.type._context),At(o),null;case 17:return tn(o.type)&&uu(),At(o),null;case 19:if(Ge(Ze),S=o.memoizedState,S===null)return At(o),null;if(c=(o.flags&128)!==0,k=S.rendering,k===null)if(c)ga(S,!1);else{if(yt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(k=Su(r),k!==null){for(o.flags|=128,ga(S,!1),c=k.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,k=S.alternate,k===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=k.childLanes,S.lanes=k.lanes,S.child=k.child,S.subtreeFlags=0,S.deletions=null,S.memoizedProps=k.memoizedProps,S.memoizedState=k.memoizedState,S.updateQueue=k.updateQueue,S.type=k.type,r=k.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()>Yo&&(o.flags|=128,c=!0,ga(S,!1),o.lanes=4194304)}else{if(!c)if(r=Su(k),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"&&!k.alternate&&!Qe)return At(o),null}else 2*ut()-S.renderingStartTime>Yo&&l!==1073741824&&(o.flags|=128,c=!0,ga(S,!1),o.lanes=4194304);S.isBackwards?(k.sibling=o.child,o.child=k):(l=S.last,l!==null?l.sibling=k:o.child=k,S.last=k)}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):(At(o),null);case 22:case 23:return Ph(),c=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==c&&(o.flags|=8192),c&&(o.mode&1)!==0?(yn&1073741824)!==0&&(At(o),o.subtreeFlags&6&&(o.flags|=8192)):At(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function PE(r,o){switch(Od(o),o.tag){case 1:return tn(o.type)&&uu(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return Go(),Ge(en),Ge(Lt),Jd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Kd(o),null;case 13:if(Ge(Ze),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));Bo()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return Ge(Ze),null;case 4:return Go(),null;case 10:return Bd(o.type._context),null;case 22:case 23:return Ph(),null;case 24:return null;default:return null}}var Iu=!1,Dt=!1,IE=typeof WeakSet=="function"?WeakSet:Set,de=null;function Qo(r,o){var l=r.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(c){rt(r,o,c)}else l.current=null}function mh(r,o,l){try{l()}catch(c){rt(r,o,c)}}var Hx=!1;function jE(r,o){if(Pd=Ql,r=Cy(),Sd(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 k=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=k+g),ie!==S||c!==0&&ie.nodeType!==3||(N=k+c),ie.nodeType===3&&(k+=ie.nodeValue.length),(fe=ie.firstChild)!==null;)ne=ie,ie=fe;for(;;){if(ie===r)break t;if(ne===l&&++Q===g&&(I=k),ne===S&&++oe===c&&(N=k),(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(Id={focusedElem:r,selectionRange:l},Ql=!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,$=B.getSnapshotBeforeUpdate(o.elementType===o.type?me:Gn(o.type,me),ct);B.__reactInternalSnapshotBeforeUpdate=$}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){rt(o,o.return,le)}if(r=o.sibling,r!==null){r.return=o.return,de=r;break}de=o.return}return ge=Hx,Hx=!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&&mh(o,l,S)}g=g.next}while(g!==c)}}function ju(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 yh(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 Wx(r){var o=r.alternate;o!==null&&(r.alternate=null,Wx(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[Td],delete o[dE],delete o[hE])),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 Gx(r){return r.tag===5||r.tag===3||r.tag===4}function Kx(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Gx(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 xh(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=au));else if(c!==4&&(r=r.child,r!==null))for(xh(r,o,l),r=r.sibling;r!==null;)xh(r,o,l),r=r.sibling}function vh(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(vh(r,o,l),r=r.sibling;r!==null;)vh(r,o,l),r=r.sibling}var Tt=null,Kn=!1;function Zr(r,o,l){for(l=l.child;l!==null;)Qx(r,o,l),l=l.sibling}function Qx(r,o,l){if(ar&&typeof ar.onCommitFiberUnmount=="function")try{ar.onCommitFiberUnmount(Bl,l)}catch{}switch(l.tag){case 5:Dt||Qo(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?Md(r.parentNode,l):r.nodeType===1&&Md(r,l),Gi(r)):Md(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(!Dt&&(c=l.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){g=c=c.next;do{var S=g,k=S.destroy;S=S.tag,k!==void 0&&((S&2)!==0||(S&4)!==0)&&mh(l,o,k),g=g.next}while(g!==c)}Zr(r,o,l);break;case 1:if(!Dt&&(Qo(l,o),c=l.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=l.memoizedProps,c.state=l.memoizedState,c.componentWillUnmount()}catch(I){rt(l,o,I)}Zr(r,o,l);break;case 21:Zr(r,o,l);break;case 22:l.mode&1?(Dt=(c=Dt)||l.memoizedState!==null,Zr(r,o,l),Dt=c):Zr(r,o,l);break;default:Zr(r,o,l)}}function Jx(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var l=r.stateNode;l===null&&(l=r.stateNode=new IE),o.forEach(function(c){var g=DE.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,k=o,I=k;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));Qx(S,k,g),Tt=null,Kn=!1;var N=g.alternate;N!==null&&(N.return=null),g.return=null}catch(Q){rt(g,o,Q)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Yx(o,r),o=o.sibling}function Yx(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),ju(3,r)}catch(me){rt(r,r.return,me)}try{pa(5,r,r.return)}catch(me){rt(r,r.return,me)}}break;case 1:Qn(o,r),fr(r),c&512&&l!==null&&Qo(l,l.return);break;case 5:if(Qn(o,r),fr(r),c&512&&l!==null&&Qo(l,l.return),r.flags&32){var g=r.stateNode;try{Li(g,"")}catch(me){rt(r,r.return,me)}}if(c&4&&(g=r.stateNode,g!=null)){var S=r.memoizedProps,k=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),Jf(I,k);var Q=Jf(I,S);for(k=0;k<N.length;k+=2){var oe=N[k],ie=N[k+1];oe==="style"?T0(g,ie):oe==="dangerouslySetInnerHTML"?N0(g,ie):oe==="children"?Li(g,ie):j(g,oe,ie,Q)}switch(I){case"input":Ro(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){rt(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){rt(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){rt(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||(kh=ut())),c&4&&Jx(r);break;case 22:if(oe=l!==null&&l.memoizedState!==null,r.mode&1?(Dt=(Q=Dt)||oe,Qn(o,r),Dt=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:Qo(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){rt(c,l,me)}}break;case 5:Qo(ne,ne.return);break;case 22:if(ne.memoizedState!==null){ev(ie);continue}}fe!==null?(fe.return=ne,de=fe):ev(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,k=N!=null&&N.hasOwnProperty("display")?N.display:null,I.style.display=M0("display",k))}catch(me){rt(r,r.return,me)}}}else if(ie.tag===6){if(oe===null)try{ie.stateNode.nodeValue=Q?"":ie.memoizedProps}catch(me){rt(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&&Jx(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(Gx(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=Kx(r);vh(r,S,g);break;case 3:case 4:var k=c.stateNode.containerInfo,I=Kx(r);xh(r,I,k);break;default:throw Error(n(161))}}catch(N){rt(r,r.return,N)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function NE(r,o,l){de=r,Xx(r)}function Xx(r,o,l){for(var c=(r.mode&1)!==0;de!==null;){var g=de,S=g.child;if(g.tag===22&&c){var k=g.memoizedState!==null||Iu;if(!k){var I=g.alternate,N=I!==null&&I.memoizedState!==null||Dt;I=Iu;var Q=Dt;if(Iu=k,(Dt=N)&&!Q)for(de=g;de!==null;)k=de,N=k.child,k.tag===22&&k.memoizedState!==null?tv(g):N!==null?(N.return=k,de=N):tv(g);for(;S!==null;)de=S,Xx(S),S=S.sibling;de=g,Iu=I,Dt=Q}Zx(r)}else(g.subtreeFlags&8772)!==0&&S!==null?(S.return=g,de=S):Zx(r)}}function Zx(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:Dt||ju(5,o);break;case 1:var c=o.stateNode;if(o.flags&4&&!Dt)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&&ex(o,S,c);break;case 3:var k=o.updateQueue;if(k!==null){if(l=null,o.child!==null)switch(o.child.tag){case 5:l=o.child.stateNode;break;case 1:l=o.child.stateNode}ex(o,k,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))}Dt||o.flags&512&&yh(o)}catch(ne){rt(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 ev(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 tv(r){for(;de!==null;){var o=de;try{switch(o.tag){case 0:case 11:case 15:var l=o.return;try{ju(4,o)}catch(N){rt(o,l,N)}break;case 1:var c=o.stateNode;if(typeof c.componentDidMount=="function"){var g=o.return;try{c.componentDidMount()}catch(N){rt(o,g,N)}}var S=o.return;try{yh(o)}catch(N){rt(o,S,N)}break;case 5:var k=o.return;try{yh(o)}catch(N){rt(o,k,N)}}}catch(N){rt(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 ME=Math.ceil,Nu=R.ReactCurrentDispatcher,Sh=R.ReactCurrentOwner,Mn=R.ReactCurrentBatchConfig,Te=0,kt=null,ht=null,$t=0,yn=0,Jo=Kr(0),yt=0,ma=null,Vs=0,Mu=0,wh=0,ya=null,rn=null,kh=0,Yo=1/0,Ir=null,Tu=!1,Ch=null,es=null,$u=!1,ts=null,Fu=0,xa=0,bh=null,Lu=-1,Ou=0;function Qt(){return(Te&6)!==0?ut():Lu!==-1?Lu:Lu=ut()}function ns(r){return(r.mode&1)===0?1:(Te&2)!==0&&$t!==0?$t&-$t:pE.transition!==null?(Ou===0&&(Ou=K0()),Ou):(r=Ae,r!==0||(r=window.event,r=r===void 0?16:ry(r.type)),r)}function Jn(r,o,l,c){if(50<xa)throw xa=0,bh=null,Error(n(185));Vi(r,l,c),((Te&2)===0||r!==kt)&&(r===kt&&((Te&2)===0&&(Mu|=l),yt===4&&rs(r,$t)),sn(r,c),l===1&&Te===0&&(o.mode&1)===0&&(Yo=ut()+500,fu&&Jr()))}function sn(r,o){var l=r.callbackNode;pR(r,o);var c=Wl(r,r===kt?$t:0);if(c===0)l!==null&&H0(l),r.callbackNode=null,r.callbackPriority=0;else if(o=c&-c,r.callbackPriority!==o){if(l!=null&&H0(l),o===1)r.tag===0?gE(rv.bind(null,r)):Vy(rv.bind(null,r)),cE(function(){(Te&6)===0&&Jr()}),l=null;else{switch(Q0(c)){case 1:l=rd;break;case 4:l=W0;break;case 16:l=Vl;break;case 536870912:l=G0;break;default:l=Vl}l=fv(l,nv.bind(null,r))}r.callbackPriority=o,r.callbackNode=l}}function nv(r,o){if(Lu=-1,Ou=0,(Te&6)!==0)throw Error(n(327));var l=r.callbackNode;if(Xo()&&r.callbackNode!==l)return null;var c=Wl(r,r===kt?$t:0);if(c===0)return null;if((c&30)!==0||(c&r.expiredLanes)!==0||o)o=Au(r,c);else{o=c;var g=Te;Te|=2;var S=ov();(kt!==r||$t!==o)&&(Ir=null,Yo=ut()+500,qs(r,o));do try{FE();break}catch(I){sv(r,I)}while(!0);Vd(),Nu.current=S,Te=g,ht!==null?o=0:(kt=null,$t=0,o=yt)}if(o!==0){if(o===2&&(g=sd(r),g!==0&&(c=g,o=_h(r,g))),o===1)throw l=ma,qs(r,0),rs(r,c),sn(r,ut()),l;if(o===6)rs(r,c);else{if(g=r.current.alternate,(c&30)===0&&!TE(g)&&(o=Au(r,c),o===2&&(S=sd(r),S!==0&&(c=S,o=_h(r,S))),o===1))throw l=ma,qs(r,0),rs(r,c),sn(r,ut()),l;switch(r.finishedWork=g,r.finishedLanes=c,o){case 0:case 1:throw Error(n(345));case 2:Hs(r,rn,Ir);break;case 3:if(rs(r,c),(c&130023424)===c&&(o=kh+500-ut(),10<o)){if(Wl(r,0)!==0)break;if(g=r.suspendedLanes,(g&c)!==c){Qt(),r.pingedLanes|=r.suspendedLanes&g;break}r.timeoutHandle=Nd(Hs.bind(null,r,rn,Ir),o);break}Hs(r,rn,Ir);break;case 4:if(rs(r,c),(c&4194240)===c)break;for(o=r.eventTimes,g=-1;0<c;){var k=31-qn(c);S=1<<k,k=o[k],k>g&&(g=k),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*ME(c/1960))-c,10<c){r.timeoutHandle=Nd(Hs.bind(null,r,rn,Ir),c);break}Hs(r,rn,Ir);break;case 5:Hs(r,rn,Ir);break;default:throw Error(n(329))}}}return sn(r,ut()),r.callbackNode===l?nv.bind(null,r):null}function _h(r,o){var l=ya;return r.current.memoizedState.isDehydrated&&(qs(r,o).flags|=256),r=Au(r,o),r!==2&&(o=rn,rn=l,o!==null&&Rh(o)),r}function Rh(r){rn===null?rn=r:rn.push.apply(rn,r)}function TE(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&=~wh,o&=~Mu,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 rv(r){if((Te&6)!==0)throw Error(n(327));Xo();var o=Wl(r,0);if((o&1)===0)return sn(r,ut()),null;var l=Au(r,o);if(r.tag!==0&&l===2){var c=sd(r);c!==0&&(o=c,l=_h(r,c))}if(l===1)throw l=ma,qs(r,0),rs(r,o),sn(r,ut()),l;if(l===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,Hs(r,rn,Ir),sn(r,ut()),null}function Eh(r,o){var l=Te;Te|=1;try{return r(o)}finally{Te=l,Te===0&&(Yo=ut()+500,fu&&Jr())}}function Bs(r){ts!==null&&ts.tag===0&&(Te&6)===0&&Xo();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 Ph(){yn=Jo.current,Ge(Jo)}function qs(r,o){r.finishedWork=null,r.finishedLanes=0;var l=r.timeoutHandle;if(l!==-1&&(r.timeoutHandle=-1,uE(l)),ht!==null)for(l=ht.return;l!==null;){var c=l;switch(Od(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&uu();break;case 3:Go(),Ge(en),Ge(Lt),Jd();break;case 5:Kd(c);break;case 4:Go();break;case 13:Ge(Ze);break;case 19:Ge(Ze);break;case 10:Bd(c.type._context);break;case 22:case 23:Ph()}l=l.return}if(kt=r,ht=r=ss(r.current,null),$t=yn=o,yt=0,ma=null,wh=Mu=Vs=0,rn=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 k=S.next;S.next=g,c.next=k}l.pending=c}Ds=null}return r}function sv(r,o){do{var l=ht;try{if(Vd(),wu.current=_u,ku){for(var c=et.memoizedState;c!==null;){var g=c.queue;g!==null&&(g.pending=null),c=c.next}ku=!1}if(Us=0,wt=mt=et=null,ca=!1,fa=0,Sh.current=null,l===null||l.return===null){yt=1,ma=o,ht=null;break}e:{var S=r,k=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=Ix(k);if(fe!==null){fe.flags&=-257,jx(fe,k,I,S,o),fe.mode&1&&Px(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){Px(S,Q,o),Ih();break e}N=Error(n(426))}}else if(Qe&&I.mode&1){var ct=Ix(k);if(ct!==null){(ct.flags&65536)===0&&(ct.flags|=256),jx(ct,k,I,S,o),zd(Ko(N,I));break e}}S=N=Ko(N,I),yt!==4&&(yt=2),ya===null?ya=[S]:ya.push(S),S=k;do{switch(S.tag){case 3:S.flags|=65536,o&=-o,S.lanes|=o;var B=Rx(S,N,o);Zy(S,B);break e;case 1:I=N;var $=S.type,W=S.stateNode;if((S.flags&128)===0&&(typeof $.getDerivedStateFromError=="function"||W!==null&&typeof W.componentDidCatch=="function"&&(es===null||!es.has(W)))){S.flags|=65536,o&=-o,S.lanes|=o;var le=Ex(S,I,o);Zy(S,le);break e}}S=S.return}while(S!==null)}av(l)}catch(ye){o=ye,ht===l&&l!==null&&(ht=l=l.return);continue}break}while(!0)}function ov(){var r=Nu.current;return Nu.current=_u,r===null?_u:r}function Ih(){(yt===0||yt===3||yt===2)&&(yt=4),kt===null||(Vs&268435455)===0&&(Mu&268435455)===0||rs(kt,$t)}function Au(r,o){var l=Te;Te|=2;var c=ov();(kt!==r||$t!==o)&&(Ir=null,qs(r,o));do try{$E();break}catch(g){sv(r,g)}while(!0);if(Vd(),Te=l,Nu.current=c,ht!==null)throw Error(n(261));return kt=null,$t=0,yt}function $E(){for(;ht!==null;)iv(ht)}function FE(){for(;ht!==null&&!iR();)iv(ht)}function iv(r){var o=cv(r.alternate,r,yn);r.memoizedProps=r.pendingProps,o===null?av(r):ht=o,Sh.current=null}function av(r){var o=r;do{var l=o.alternate;if(r=o.return,(o.flags&32768)===0){if(l=EE(l,o,yn),l!==null){ht=l;return}}else{if(l=PE(l,o),l!==null){l.flags&=32767,ht=l;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{yt=6,ht=null;return}}if(o=o.sibling,o!==null){ht=o;return}ht=o=r}while(o!==null);yt===0&&(yt=5)}function Hs(r,o,l){var c=Ae,g=Mn.transition;try{Mn.transition=null,Ae=1,LE(r,o,l,c)}finally{Mn.transition=g,Ae=c}return null}function LE(r,o,l,c){do Xo();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(mR(r,S),r===kt&&(ht=kt=null,$t=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||$u||($u=!0,fv(Vl,function(){return Xo(),null})),S=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||S){S=Mn.transition,Mn.transition=null;var k=Ae;Ae=1;var I=Te;Te|=4,Sh.current=null,jE(r,l),Yx(l,r),nE(Id),Ql=!!Pd,Id=Pd=null,r.current=l,NE(l),aR(),Te=I,Ae=k,Mn.transition=S}else r.current=l;if($u&&($u=!1,ts=r,Fu=g),S=r.pendingLanes,S===0&&(es=null),cR(l.stateNode),sn(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(Tu)throw Tu=!1,r=Ch,Ch=null,r;return(Fu&1)!==0&&r.tag!==0&&Xo(),S=r.pendingLanes,(S&1)!==0?r===bh?xa++:(xa=0,bh=r):xa=0,Jr(),null}function Xo(){if(ts!==null){var r=Q0(Fu),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,Fu=0,(Te&6)!==0)throw Error(n(331));var g=Te;for(Te|=4,de=r.current;de!==null;){var S=de,k=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(Wx(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&&k!==null)k.return=S,de=k;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 $=r.current;for(de=$;de!==null;){k=de;var W=k.child;if((k.subtreeFlags&2064)!==0&&W!==null)W.return=k,de=W;else e:for(k=$;de!==null;){if(I=de,(I.flags&2048)!==0)try{switch(I.tag){case 0:case 11:case 15:ju(9,I)}}catch(ye){rt(I,I.return,ye)}if(I===k){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(Bl,r)}catch{}c=!0}return c}finally{Ae=l,Mn.transition=o}}return!1}function lv(r,o,l){o=Ko(l,o),o=Rx(r,o,1),r=Xr(r,o,1),o=Qt(),r!==null&&(Vi(r,1,o),sn(r,o))}function rt(r,o,l){if(r.tag===3)lv(r,r,l);else for(;o!==null;){if(o.tag===3){lv(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=Ko(l,r),r=Ex(o,r,1),o=Xr(o,r,1),r=Qt(),o!==null&&(Vi(o,1,r),sn(o,r));break}}o=o.return}}function OE(r,o,l){var c=r.pingCache;c!==null&&c.delete(o),o=Qt(),r.pingedLanes|=r.suspendedLanes&l,kt===r&&($t&l)===l&&(yt===4||yt===3&&($t&130023424)===$t&&500>ut()-kh?qs(r,0):wh|=l),sn(r,o)}function uv(r,o){o===0&&((r.mode&1)===0?o=1:(o=Hl,Hl<<=1,(Hl&130023424)===0&&(Hl=4194304)));var l=Qt();r=Rr(r,o),r!==null&&(Vi(r,o,l),sn(r,l))}function AE(r){var o=r.memoizedState,l=0;o!==null&&(l=o.retryLane),uv(r,l)}function DE(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),uv(r,l)}var cv;cv=function(r,o,l){if(r!==null)if(r.memoizedProps!==o.pendingProps||en.current)nn=!0;else{if((r.lanes&l)===0&&(o.flags&128)===0)return nn=!1,RE(r,o,l);nn=(r.flags&131072)!==0}else nn=!1,Qe&&(o.flags&1048576)!==0&&By(o,hu,o.index);switch(o.lanes=0,o.tag){case 2:var c=o.type;Pu(r,o),r=o.pendingProps;var g=zo(o,Lt.current);Wo(o,l),g=Zd(null,o,c,r,g,l);var S=eh();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,tn(c)?(S=!0,cu(o)):S=!1,o.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,Wd(o),g.updater=Ru,o.stateNode=g,g._reactInternals=o,ih(o,c,r,l),o=ch(null,o,c,!0,S,l)):(o.tag=0,Qe&&S&&Ld(o),Kt(null,o,g,l),o=o.child),o;case 16:c=o.elementType;e:{switch(Pu(r,o),r=o.pendingProps,g=c._init,c=g(c._payload),o.type=c,g=o.tag=UE(c),r=Gn(c,r),g){case 0:o=uh(null,o,c,r,l);break e;case 1:o=Lx(null,o,c,r,l);break e;case 11:o=Nx(null,o,c,r,l);break e;case 14:o=Mx(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),uh(r,o,c,g,l);case 1:return c=o.type,g=o.pendingProps,g=o.elementType===c?g:Gn(c,g),Lx(r,o,c,g,l);case 3:e:{if(Ox(o),r===null)throw Error(n(387));c=o.pendingProps,S=o.memoizedState,g=S.element,Xy(r,o),vu(o,c,null,l);var k=o.memoizedState;if(c=k.element,S.isDehydrated)if(S={element:c,isDehydrated:!1,cache:k.cache,pendingSuspenseBoundaries:k.pendingSuspenseBoundaries,transitions:k.transitions},o.updateQueue.baseState=S,o.memoizedState=S,o.flags&256){g=Ko(Error(n(423)),o),o=Ax(r,o,c,l,g);break e}else if(c!==g){g=Ko(Error(n(424)),o),o=Ax(r,o,c,l,g);break e}else for(mn=Gr(o.stateNode.containerInfo.firstChild),pn=o,Qe=!0,Wn=null,l=Jy(o,null,c,l),o.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(Bo(),c===g){o=Pr(r,o,l);break e}Kt(r,o,c,l)}o=o.child}return o;case 5:return tx(o),r===null&&Dd(o),c=o.type,g=o.pendingProps,S=r!==null?r.memoizedProps:null,k=g.children,jd(c,g)?k=null:S!==null&&jd(c,S)&&(o.flags|=32),Fx(r,o),Kt(r,o,k,l),o.child;case 6:return r===null&&Dd(o),null;case 13:return Dx(r,o,l);case 4:return Gd(o,o.stateNode.containerInfo),c=o.pendingProps,r===null?o.child=qo(o,null,c,l):Kt(r,o,c,l),o.child;case 11:return c=o.type,g=o.pendingProps,g=o.elementType===c?g:Gn(c,g),Nx(r,o,c,g,l);case 7:return Kt(r,o,o.pendingProps,l),o.child;case 8:return Kt(r,o,o.pendingProps.children,l),o.child;case 12:return Kt(r,o,o.pendingProps.children,l),o.child;case 10:e:{if(c=o.type._context,g=o.pendingProps,S=o.memoizedProps,k=g.value,qe(mu,c._currentValue),c._currentValue=k,S!==null)if(Hn(S.value,k)){if(S.children===g.children&&!en.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){k=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),qd(S.return,l,o),I.lanes|=l;break}N=N.next}}else if(S.tag===10)k=S.type===o.type?null:S.child;else if(S.tag===18){if(k=S.return,k===null)throw Error(n(341));k.lanes|=l,I=k.alternate,I!==null&&(I.lanes|=l),qd(k,l,o),k=S.sibling}else k=S.child;if(k!==null)k.return=S;else for(k=S;k!==null;){if(k===o){k=null;break}if(S=k.sibling,S!==null){S.return=k.return,k=S;break}k=k.return}S=k}Kt(r,o,g.children,l),o=o.child}return o;case 9:return g=o.type,c=o.pendingProps.children,Wo(o,l),g=jn(g),c=c(g),o.flags|=1,Kt(r,o,c,l),o.child;case 14:return c=o.type,g=Gn(c,o.pendingProps),g=Gn(c.type,g),Mx(r,o,c,g,l);case 15:return Tx(r,o,o.type,o.pendingProps,l);case 17:return c=o.type,g=o.pendingProps,g=o.elementType===c?g:Gn(c,g),Pu(r,o),o.tag=1,tn(c)?(r=!0,cu(o)):r=!1,Wo(o,l),bx(o,c,g),ih(o,c,g,l),ch(null,o,c,!0,r,l);case 19:return Ux(r,o,l);case 22:return $x(r,o,l)}throw Error(n(156,o.tag))};function fv(r,o){return q0(r,o)}function zE(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 zE(r,o,l,c)}function jh(r){return r=r.prototype,!(!r||!r.isReactComponent)}function UE(r){if(typeof r=="function")return jh(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 Du(r,o,l,c,g,S){var k=2;if(c=r,typeof r=="function")jh(r)&&(k=1);else if(typeof r=="string")k=5;else e:switch(r){case T:return Ws(l.children,g,S,o);case U:k=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 zu(l,g,S,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case Z:k=10;break e;case te:k=9;break e;case ae:k=11;break e;case X:k=14;break e;case K:k=16,c=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Tn(k,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 zu(r,o,l,c){return r=Tn(22,r,c,o),r.elementType=q,r.lanes=l,r.stateNode={isHidden:!1},r}function Nh(r,o,l){return r=Tn(6,r,null,o),r.lanes=l,r}function Mh(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 VE(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=od(0),this.expirationTimes=od(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=od(0),this.identifierPrefix=c,this.onRecoverableError=g,this.mutableSourceEagerHydrationData=null}function Th(r,o,l,c,g,S,k,I,N){return r=new VE(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},Wd(S),r}function BE(r,o,l){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:A,key:c==null?null:""+c,children:r,containerInfo:o,implementation:l}}function dv(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(tn(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(tn(l))return zy(r,l,o)}return o}function hv(r,o,l,c,g,S,k,I,N){return r=Th(l,c,!0,r,g,S,k,I,N),r.context=dv(null),l=r.current,c=Qt(),g=ns(l),S=Er(c,g),S.callback=o??null,Xr(l,S,g),r.current.lanes=g,Vi(r,g,c),sn(r,c),r}function Uu(r,o,l,c){var g=o.current,S=Qt(),k=ns(g);return l=dv(l),o.context===null?o.context=l:o.pendingContext=l,o=Er(S,k),o.payload={element:r},c=c===void 0?null:c,c!==null&&(o.callback=c),r=Xr(g,o,k),r!==null&&(Jn(r,g,k,S),xu(r,g,k)),k}function Vu(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 gv(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var l=r.retryLane;r.retryLane=l!==0&&l<o?l:o}}function $h(r,o){gv(r,o),(r=r.alternate)&&gv(r,o)}function qE(){return null}var pv=typeof reportError=="function"?reportError:function(r){console.error(r)};function Fh(r){this._internalRoot=r}Bu.prototype.render=Fh.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Uu(r,o,null,null)},Bu.prototype.unmount=Fh.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;Bs(function(){Uu(null,r,null,null)}),o[kr]=null}};function Bu(r){this._internalRoot=r}Bu.prototype.unstable_scheduleHydration=function(r){if(r){var o=X0();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&&ty(r)}};function Lh(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function qu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function mv(){}function HE(r,o,l,c,g){if(g){if(typeof c=="function"){var S=c;c=function(){var Q=Vu(k);S.call(Q)}}var k=hv(o,c,r,0,null,!1,!1,"",mv);return r._reactRootContainer=k,r[kr]=k.current,na(r.nodeType===8?r.parentNode:r),Bs(),k}for(;g=r.lastChild;)r.removeChild(g);if(typeof c=="function"){var I=c;c=function(){var Q=Vu(N);I.call(Q)}}var N=Th(r,0,!1,null,null,!1,!1,"",mv);return r._reactRootContainer=N,r[kr]=N.current,na(r.nodeType===8?r.parentNode:r),Bs(function(){Uu(o,N,l,c)}),N}function Hu(r,o,l,c,g){var S=l._reactRootContainer;if(S){var k=S;if(typeof g=="function"){var I=g;g=function(){var N=Vu(k);I.call(N)}}Uu(o,k,r,g)}else k=HE(l,o,r,g,c);return Vu(k)}J0=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var l=Ui(o.pendingLanes);l!==0&&(id(o,l|1),sn(o,ut()),(Te&6)===0&&(Yo=ut()+500,Jr()))}break;case 13:Bs(function(){var c=Rr(r,1);if(c!==null){var g=Qt();Jn(c,r,1,g)}}),$h(r,1)}},ad=function(r){if(r.tag===13){var o=Rr(r,134217728);if(o!==null){var l=Qt();Jn(o,r,134217728,l)}$h(r,134217728)}},Y0=function(r){if(r.tag===13){var o=ns(r),l=Rr(r,o);if(l!==null){var c=Qt();Jn(l,r,o,c)}$h(r,o)}},X0=function(){return Ae},Z0=function(r,o){var l=Ae;try{return Ae=r,o()}finally{Ae=l}},Zf=function(r,o,l){switch(o){case"input":if(Ro(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=lu(c);if(!g)throw Error(n(90));Ns(c),Ro(c,g)}}}break;case"textarea":Fi(r,l);break;case"select":o=l.value,o!=null&&zr(r,!!l.multiple,o,!1)}},O0=Eh,A0=Bs;var WE={usingClientEntryPoint:!1,Events:[oa,Ao,lu,F0,L0,Eh]},va={findFiberByHostInstance:Fs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},GE={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=V0(r),r===null?null:r.stateNode},findFiberByHostInstance:va.findFiberByHostInstance||qE,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 Wu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wu.isDisabled&&Wu.supportsFiber)try{Bl=Wu.inject(GE),ar=Wu}catch{}}return on.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=WE,on.createPortal=function(r,o){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Lh(o))throw Error(n(200));return BE(r,o,null,l)},on.createRoot=function(r,o){if(!Lh(r))throw Error(n(299));var l=!1,c="",g=pv;return o!=null&&(o.unstable_strictMode===!0&&(l=!0),o.identifierPrefix!==void 0&&(c=o.identifierPrefix),o.onRecoverableError!==void 0&&(g=o.onRecoverableError)),o=Th(r,1,!1,null,null,l,!1,c,g),r[kr]=o.current,na(r.nodeType===8?r.parentNode:r),new Fh(o)},on.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=V0(o),r=r===null?null:r.stateNode,r},on.flushSync=function(r){return Bs(r)},on.hydrate=function(r,o,l){if(!qu(o))throw Error(n(200));return Hu(null,r,o,!0,l)},on.hydrateRoot=function(r,o,l){if(!Lh(r))throw Error(n(405));var c=l!=null&&l.hydratedSources||null,g=!1,S="",k=pv;if(l!=null&&(l.unstable_strictMode===!0&&(g=!0),l.identifierPrefix!==void 0&&(S=l.identifierPrefix),l.onRecoverableError!==void 0&&(k=l.onRecoverableError)),o=hv(o,null,r,1,l??null,g,!1,S,k),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 Bu(o)},on.render=function(r,o,l){if(!qu(o))throw Error(n(200));return Hu(null,r,o,!1,l)},on.unmountComponentAtNode=function(r){if(!qu(r))throw Error(n(40));return r._reactRootContainer?(Bs(function(){Hu(null,null,r,!1,function(){r._reactRootContainer=null,r[kr]=null})}),!0):!1},on.unstable_batchedUpdates=Eh,on.unstable_renderSubtreeIntoContainer=function(r,o,l,c){if(!qu(l))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Hu(r,o,l,!1,c)},on.version="18.3.1-next-f1338f8080-20240426",on}var bv;function g1(){if(bv)return Dh.exports;bv=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(),Dh.exports=rP(),Dh.exports}var _v;function sP(){if(_v)return Gu;_v=1;var e=g1();return Gu.createRoot=e.createRoot,Gu.hydrateRoot=e.hydrateRoot,Gu}var oP=sP(),iP={};const Wp=uP();function Ye(e,...t){if(!Wp)return;const n=lP(e,...t);performance.mark(n);try{console.log(e,...t)}catch{console.log(n)}}function aP(e,...t){Wp&&console.warn(e,...t)}function lP(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 uP(){if(typeof window>"u")return(iP.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 cP={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 xl(e){return`[nuqs] ${cP[e]}
42
- See https://nuqs.dev/NUQS-${e}`}function fP(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}=${dP(i)}`)}return"?"+t.join("&")}function dP(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 co=z.createContext({useAdapter(){throw new Error(xl(404))}});co.displayName="NuqsAdapterContext";Wp&&typeof window<"u"&&(window.__NuqsAdapterContext&&window.__NuqsAdapterContext!==co&&console.error(xl(303)),window.__NuqsAdapterContext=co);function hP(e){return({children:t,defaultOptions:n,processUrlSearchParams:s,...i})=>z.createElement(co.Provider,{...i,value:{useAdapter:e,defaultOptions:n,processUrlSearchParams:s}},t)}function gP(e){const t=z.useContext(co);if(!("useAdapter"in t))throw new Error(xl(404));return t.useAdapter(e)}const pP=()=>z.useContext(co).defaultOptions,mP=()=>z.useContext(co).processUrlSearchParams;function yP(){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 xP(e){return{method:"throttle",timeMs:e}}const Da=xP(yP());function vP(e){return e===null||Array.isArray(e)&&e.length===0}function SP(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 Gp(){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 zg(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 Ug(){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 wP(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 Vg(){return new URLSearchParams(location.search)}var p1=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=Vg}){var t;return((t=this.resolvers)==null?void 0:t.promise)??Promise.resolve(e())}flush({getSearchParamsSnapshot:e=Vg,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=Ug();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 zg(()=>{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():zg(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=SP(h,d,i);t&&(i=t(i));try{return wP(f,()=>{n(i,u)}),[i,null]}catch(d){return console.error(xl(429),a.map(([h])=>h).join(),d),[i,d]}}};const fc=new p1;function kP(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 CP=class{constructor(e){L(this,"callback");L(this,"resolvers",Ug());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,zg(()=>{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=Ug(),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}},bP=class{constructor(e=new p1){L(this,"throttleQueue");L(this,"queues",new Map);L(this,"queuedQuerySync",Gp());this.throttleQueue=e}useQueuedQueries(e){return kP(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??Vg;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 CP(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 Vh=new bP(fc);function m1(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 Rv(e,t,n){return s=>{if(!(t.length===0||t.some(a=>!m1(s.getAll(a),e.getAll(a)))))return Ye("[nuqs `%s`] no change, returning previous",t.join(","),s),s;const i=y1(e,t,n);return Ye("[nuqs `%s`] subbed search params change\n from %O\n to %O",t.join(","),s,i),i}}function y1(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 _P="__nuqs__",Bg=Gp();function RP(e){return function(n,s){const i=new URL(location.href);i.search=fP(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,_P,i),Bg.emit("update",n),s.scroll===!0&&window.scrollTo({top:0})}}const x1=z.createContext({fullPageNavigationOnShallowFalseUpdates:!1});function EP(e){const{fullPageNavigationOnShallowFalseUpdates:t}=z.useContext(x1),[n,s]=z.useState(()=>typeof location>"u"?new URLSearchParams:y1(new URLSearchParams(location.search),e,!1));return z.useEffect(()=>{const i=()=>{s(Rv(new URLSearchParams(location.search),e,!1))},a=u=>{s(Rv(u,e,!0))};return Bg.on("update",a),window.addEventListener("popstate",i),()=>{Bg.off("update",a),window.removeEventListener("popstate",i)}},[e.join("&")]),{searchParams:n,updateUrl:z.useMemo(()=>RP(t),[t])}}const PP=hP(EP);function IP({children:e,fullPageNavigationOnShallowFalseUpdates:t=!1,...n}){return z.createElement(x1.Provider,{value:{fullPageNavigationOnShallowFalseUpdates:t}},z.createElement(PP,{...n,children:e}))}var Ma=typeof window<"u"?z.useLayoutEffect:z.useEffect;function Bh(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 jP(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 NP(e){const t=z.useRef(null);return z.useImperativeHandle(e,()=>t.current,[]),t}const v1=!1;function Qa(e){return e[e.length-1]}function MP(e){return typeof e=="function"}function Xs(e,t){return MP(e)?e(t):e}const S1=Object.prototype.hasOwnProperty,Ev=Object.prototype.propertyIsEnumerable;function w1(e){for(const t in e)if(S1.call(e,t))return!0;return!1}const TP=()=>Object.create(null),Gs=(e,t)=>Zs(e,t,TP);function Zs(e,t,n=()=>({}),s=0){if(e===t)return e;if(s>500)return t;const i=t,a=jv(e)&&jv(i);if(!a&&!(Rc(e)&&Rc(i)))return i;const u=a?e:Pv(e);if(!u)return i;const f=a?i:Pv(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],C=i[v];if(w===C){m[v]=w,(a?x<d:S1.call(e,v))&&p++;continue}if(w===null||C===null||typeof w!="object"||typeof C!="object"){m[v]=C;continue}const b=Zs(w,C,n,s+1);m[v]=b,b===w&&p++}return d===h&&p===d?e:m}function Pv(e){const t=Object.getOwnPropertyNames(e);for(const i of t)if(!Ev.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(!Ev.call(e,i))return!1;s.push(i)}return s}function Rc(e){if(!Iv(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!Iv(n)||!n.hasOwnProperty("isPrototypeOf"))}function Iv(e){return Object.prototype.toString.call(e)==="[object Object]"}function jv(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(Rc(e)&&Rc(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 pi(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 $P(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function Nv(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 $P(t)}const FP=["http:","https:","mailto:","tel:"];function Ec(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+=Nv(e.slice(n,i.index))+i[0],n=t.lastIndex;s=s+Nv(n?e.slice(n):e);let a=!1;return s.startsWith("//")&&(a=!0,s="/"+s.replace(/^\/+/,"")),{path:s,handledProtocolRelativeURL:a}}function LP(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function OP(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,k1=5;function AP(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 C1(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=AP(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 af(e,t,n,s,i,a,u){var d,h,m,p,x,v,w,C,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,F=((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 T=C1(E,f,t);let U;const V=f,Z=T[5];switch(f=Z+1,a++,T[0]){case 0:{const te=E.substring(T[2],T[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,T[1]),ae=E.substring(T[4],Z),P=R&&!!(te||ae),H=te?P?te:te.toLowerCase():void 0,X=ae?P?ae:ae.toLowerCase():void 0,K=!F&&((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=Hh(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,T[1]),ae=E.substring(T[4],Z),P=R&&!!(te||ae),H=te?P?te:te.toLowerCase():void 0,X=ae?P?ae:ae.toLowerCase():void 0,K=!F&&((C=i.optional)==null?void 0:C.find(q=>!q.parse&&q.caseSensitive===P&&q.prefix===H&&q.suffix===X));if(K)U=K;else{const q=Hh(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,T[1]),ae=E.substring(T[4],Z),P=R&&!!(te||ae),H=te?P?te:te.toLowerCase():void 0,X=ae?P?ae:ae.toLowerCase():void 0,K=Hh(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(F&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const T=eo(n.fullPath??n.from);T.kind=k1,T.parent=i,a++,T.depth=a,i.pathless??(i.pathless=[]),i.pathless.push(T),i=T}const A=(n.path||!n.children)&&!n.isRoot;if(A&&E.endsWith("/")){const T=eo(n.fullPath??n.from);T.kind=cs,T.parent=i,a++,T.depth=a,i.index=T,i=T}i.parse=F??null,i.priority=((_=(b=n.options)==null?void 0:b.params)==null?void 0:_.priority)??0,A&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(const E of n.children)af(e,t,E,f,i,a,u)}function qh(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(qh);for(const i of e.dynamic)ls(i)}if((n=e.optional)!=null&&n.length){e.optional.sort(qh);for(const i of e.optional)ls(i)}if((s=e.wildcard)!=null&&s.length){e.wildcard.sort(qh);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 Hh(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 DP(e,t){const n=eo("/"),s=new Uint16Array(6);for(const i of e)af(!1,s,i,1,n,0);ls(n),t.masksTree=n,t.flatCache=Ya(1e3)}function zP(e,t){e||(e="/");const n=t.flatCache.get(e);if(n)return n;const s=Kp(e,t.masksTree);return t.flatCache.set(e,s),s}function UP(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("/"),af(t,new Uint16Array(6),{from:e},1,u,0),i.singleCache.set(a,u)),Kp(s,u,n)}function VP(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=Kp(e,t.segmentTree,n)}catch(u){if(u instanceof URIError)a=null;else throw u}return a&&(a.branch=_1(a.route)),t.matchCache.set(s,a),a}function BP(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function qP(e,t=!1,n){const s=eo(e.fullPath),i=new Uint16Array(6),a={},u={};let f=0;return af(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=BP(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 Kp(e,t,n=!1){const s=e.split("/"),i=WP(e,s,t,n);if(!i)return null;const[a]=b1(e,s,i);return{route:i.node.route,rawParams:a}}function b1(e,t,n){var m,p,x,v,w,C,b,_,E,j;const s=HP(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===k1){h--,u--,d--;continue}const F=t[u],A=d;if(F&&(d+=F.length),R.kind===1){i??(i=n.node.fullPath.split("/"));const T=i[h],U=((w=R.prefix)==null?void 0:w.length)??0;if(T.charCodeAt(U)===123){const V=((C=R.suffix)==null?void 0:C.length)??0,Z=T.substring(U+2,T.length-V-1),te=F.substring(U,F.length-V);a[Z]=decodeURIComponent(te)}else{const V=T.substring(1);a[V]=decodeURIComponent(F)}}else if(R.kind===3){if(n.skipped&1<<f){u--,d=A-1;continue}i??(i=n.node.fullPath.split("/"));const T=i[h],U=((b=R.prefix)==null?void 0:b.length)??0,V=((_=R.suffix)==null?void 0:_.length)??0,Z=T.substring(U+3,T.length-V-1),te=R.suffix||R.prefix?F.substring(U,F.length-V):F;te&&(a[Z]=decodeURIComponent(te))}else if(R.kind===2){const T=R,U=e.substring(A+(((E=T.prefix)==null?void 0:E.length)??0),e.length-(((j=T.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 _1(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function HP(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function WP(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:C,dynamics:b,optionals:_}=m;let{extract:E,rawParams:j}=m;if(p.kind===2&&p.route&&!Qu(h,m))continue;if(p.parse){if(!Mv(e,t,m))continue;j=m.rawParams,E=m.extract}s&&p.route&&p.kind!==cs&&Qu(d,m)&&(d=m);const R=x===u;if(R&&(p.route&&(!a||p.kind===cs||p.kind===2)&&Qu(h,m)&&(h=m),!p.optional&&!p.wildcard&&!p.index&&!p.pathless))continue;const F=R?void 0:t[x];let A;if(R&&p.index){const T={node:p.index,index:x,skipped:v,depth:w+1,statics:C,dynamics:b,optionals:_,extract:E,rawParams:j};let U=!0;if(p.index.parse&&(Mv(e,t,T)||(U=!1)),U){if(!b&&!_&&!v&&GP(C,u))return T;Qu(h,T)&&(h=T)}}if(p.wildcard)for(let T=p.wildcard.length-1;T>=0;T--){const U=p.wildcard[T],{prefix:V,suffix:Z}=U;if(!(V&&(R||!(U.caseSensitive?F:A??(A=F.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:C,dynamics:b,optionals:_,extract:E,rawParams:j})}}if(p.optional){const T=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:T,depth:U,statics:C,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?F:A??(A=F.toLowerCase());if(te&&!P.startsWith(te)||ae&&!P.endsWith(ae))continue}f.push({node:Z,index:x+1,skipped:v,depth:U,statics:C,dynamics:b,optionals:_+Ku(u,x),extract:E,rawParams:j})}}if(!R&&p.dynamic&&F)for(let T=p.dynamic.length-1;T>=0;T--){const U=p.dynamic[T],{prefix:V,suffix:Z}=U;if(V||Z){const te=U.caseSensitive?F:A??(A=F.toLowerCase());if(V&&!te.startsWith(V)||Z&&!te.endsWith(Z))continue}f.push({node:U,index:x+1,skipped:v,depth:w+1,statics:C,dynamics:b+Ku(u,x),optionals:_,extract:E,rawParams:j})}if(!R&&p.staticInsensitive){const T=p.staticInsensitive.get(A??(A=F.toLowerCase()));T&&f.push({node:T,index:x+1,skipped:v,depth:w+1,statics:C+Ku(u,x),dynamics:b,optionals:_,extract:E,rawParams:j})}if(!R&&p.static){const T=p.static.get(F);T&&f.push({node:T,index:x+1,skipped:v,depth:w+1,statics:C+Ku(u,x),dynamics:b,optionals:_,extract:E,rawParams:j})}if(p.pathless){const T=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:T,statics:C,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 Ku(e,t){return 2**(e-t-1)}function GP(e,t){return e===2**(t-1)-1}function Mv(e,t,n){let s,i;try{[s,i]=b1(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 Qu(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 dc(e){return Qp(e.filter(t=>t!==void 0).join("/"))}function Qp(e){return e.replace(/\/{2,}/g,"/")}function R1(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 E1(e){return Mr(R1(e))}function Pc(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function KP(e,t,n){return Pc(e,n)===Pc(t,n)}function QP({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=Qp(f.join("/"))||"/";return u&&s&&s.set(u,d),d}function JP(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 Wh(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=>$v(i,n)).join("/"):$v(s,n)}function Tv({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=C1(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]),C=e.substring(d[4],p);if(!v){i=!0,(w||C)&&(h+="/"+w+C);continue}const b=Wh("_splat",t,n);h+="/"+w+b+C;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]),C=e.substring(d[4],p),b=Wh(v,t,n)??"undefined";h+="/"+w+b+C;continue}if(x===3){const v=e.substring(d[2],d[3]),w=t[v];if(w==null)continue;a[v]=w;const C=e.substring(m,d[1]),b=e.substring(d[4],p),_=Wh(v,t,n)??"";h+="/"+C+_+b;continue}}return e.endsWith("/")&&(h+="/"),{usedParams:a,interpolatedPath:h||"/",isMissingParams:i}}function $v(e,t){const n=encodeURIComponent(e);return(t==null?void 0:t(n))??n}function Vt(e){return(e==null?void 0:e.isNotFound)===!0}function YP(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 Gh(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function XP(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]=Gh(i):Array.isArray(a)?a.push(Gh(i)):n[s]=[a,Gh(i)]}return n}const ZP=tI(JSON.parse),eI=nI(JSON.stringify,JSON.parse);function tI(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=XP(t);for(const s in n){const i=n[s];if(typeof i=="string")try{n[s]=e(i)}catch{}}return n}}function nI(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=YP(i,s);return a?`?${a}`:""}}const no="__root__";function rI(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 an(e){return e instanceof Response&&!!e.options}const qg=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},sI=e=>e.stores.matchesId.get().some(t=>{var n;return(n=e.stores.matchStores.get(t))==null?void 0:n.get()._forcePending}),lf=(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},Fv=(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(!(!an(n)&&!Vt(n)))throw an(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:an(n)?"redirected":Vt(n)?"notFound":u.status==="pending"?"success":u.status,context:ro(e,t.index),isFetching:!1,error:n})),Vt(n)&&!n.routeId&&(n.routeId=t.routeId),(a=t._nonReactive.loadPromise)==null||a.resolve()),an(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},P1=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Lv=(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&&!an(n)&&!Vt(n)&&(e.serialError??(e.serialError=n))},I1=(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&&!lf(e,t)&&(n.options.loader||n.options.beforeLoad||N1(n))&&typeof i=="number"&&i!==1/0&&(n.options.pendingComponent??((a=e.router.options)==null?void 0:a.defaultPendingComponent))){const u=setTimeout(()=>{qg(e)},i);s._nonReactive.pendingTimeout=u}},oI=(e,t,n)=>{const s=e.router.getMatch(t);if(!s._nonReactive.beforeLoadPromise&&!s._nonReactive.loaderPromise)return;I1(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()},iI=(e,t,n,s)=>{const i=e.router.getMatch(t);let a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=pi(()=>{a==null||a.resolve(),a=void 0});const{paramsError:u,searchError:f}=i;u&&ka(e,n,u),f&&ka(e,n,f),I1(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,F=>({...F,isFetching:!1}))};if(!s.options.beforeLoad){e.router.batch(()=>{m(),p()});return}i._nonReactive.beforeLoadPromise=pi();const x={...ro(e,n,!1),...i.__routeContext},{search:v,params:w,cause:C}=i,b=lf(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":C,matches:e.matches,routeId:s.id,...e.router.options.additionalContext},E=R=>{if(R===void 0){e.router.batch(()=>{m(),p()});return}(an(R)||Vt(R))&&(m(),ka(e,n,R)),e.router.batch(()=>{m(),e.updateMatch(t,F=>({...F,__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)},aI=(e,t)=>{const{id:n,routeId:s}=e.matches[t],i=e.router.looseRoutesById[s],a=()=>f(),u=()=>iI(e,n,t,i),f=()=>{if(P1(e,n))return;const d=oI(e,n,i);return Ja(d)?d.then(u):u()};return a()},lI=(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}))},j1=(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=lf(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}},Ov=async(e,t,n,s,i)=>{var a,u,f,d,h;try{const m=e.router.getMatch(n);try{(!(v1??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(j1(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 C=m._nonReactive.minPendingPromise;C&&await C,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,Vt(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)}!an(x)&&!Vt(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)}},uI=async(e,t,n)=>{var v,w,C,b;async function s(_,E,j,R,F){const A=Date.now()-E.updatedAt,T=_?F.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:F.options.staleTime??e.router.options.defaultStaleTime??0,U=F.options.shouldReload,V=typeof U=="function"?U(j1(e,t,i,n,F)):U,{status:Z,invalid:te}=R,ae=A>=T&&(!!e.forceStaleReload||R.cause==="enter"||j!==void 0&&j!==R.id);u=Z==="success"&&(te||(V??ae)),_&&F.options.preload===!1||(u&&!e.sync&&m?(f=!0,(async()=>{var P,H;try{await Ov(e,t,i,n,F);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){an(X)&&await e.router.navigate(X.options)}})()):Z!=="success"||u?await Ov(e,t,i,n,F):Lv(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(P1(e,i)){if(!e.router.getMatch(i))return e.matches[n];Lv(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(F=>F.routeId===a))==null?void 0:w.id,R=lf(e,i);if(_._nonReactive.loaderPromise){if(_.status==="success"&&!e.sync&&!_.preload&&m)return _;await _._nonReactive.loaderPromise;const F=e.router.getMatch(i),A=F._nonReactive.error||F.error;A&&fs(e,F,A),F.status==="pending"&&await s(R,_,j,F,d)}else{const F=R&&!e.router.stores.matchStores.has(i),A=e.router.getMatch(i);A._nonReactive.loaderPromise=pi(),F!==A.preload&&e.updateMatch(i,T=>({...T,preload:F})),await s(R,_,j,A,d)}}const p=e.router.getMatch(i);f||((C=p._nonReactive.loaderPromise)==null||C.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 Av(e){var x,v;const t=e,n=[];sI(t.router)&&qg(t);let s;for(let w=0;w<t.matches.length;w++){try{const C=aI(t,w);Ja(C)&&await C}catch(C){if(an(C))throw C;if(Vt(C))s=C;else if(!t.preload)throw C;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const i=t.firstBadMatchIndex??t.matches.length,a=s&&!t.preload?Fv(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(uI(t,n,w));try{await Promise.all(n)}catch{const w=await Promise.allSettled(n);for(const C of w){if(C.status!=="rejected")continue;const b=C.reason;if(an(b))throw b;Vt(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=Fv(t,h);w===void 0&&Tr();const C=t.matches[w],b=t.router.looseRoutesById[C.routeId],_=(x=t.router.options)==null?void 0:x.defaultNotFoundComponent;!b.options.notFoundComponent&&_&&(b.options.notFoundComponent=_),h.routeId=C.routeId;const E=C.routeId===t.router.routeTree.id;t.updateMatch(C.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,C=>({...C,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:C,routeId:b}=t.matches[w],_=t.router.looseRoutesById[b];try{const E=lI(t,C,_);if(E){const j=await E;t.updateMatch(C,R=>({...R,...j}))}}catch(E){console.error(`Error executing head for route ${b}:`,E)}}const p=qg(t);if(Ja(p)&&await p,h)throw h;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Dv(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=hc){!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===hc?(()=>{if(e._componentsPromise===void 0){const s=Dv(e,hc);s?e._componentsPromise=s.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Dv(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function N1(e){var t;for(const n of hc)if((t=e.options[n])!=null&&t.preload)return!0;return!1}const hc=["component","errorComponent","pendingComponent","notFoundComponent"];function cI(e){return{input:({url:t})=>{for(const n of e)t=Hg(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=M1(e[n],t);return t}}}function fI(e){const t=E1(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=dc(["/",t,a.pathname]),a)}}function Hg(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 M1(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 dI(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),C=n(e.statusCode),b=n(e.redirect),_=n([]),E=n([]),j=n([]),R=s(()=>Kh(u,_.get())),F=s(()=>Kh(f,E.get())),A=s(()=>Kh(d,j.get())),T=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:C.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:C,redirect:b,matchesId:_,pendingIds:E,cachedIds:j,matches:R,pendingMatches:F,cachedMatches:A,firstId:T,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){Qh(q,u,_,n,i)}function X(q){Qh(q,f,E,n,i)}function K(q){Qh(q,d,j,n,i)}return P}function Kh(e,t){const n=[];for(const s of t){const i=e.get(s);i&&n.push(i.get())}return n}function Qh(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)}OP(n.get(),a)||n.set(a)})}var ps="__TSR_index",zv="popstate",Uv="beforeunload";function hI(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=Vv(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=Vv(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 Vv(e,t){t||(t={});const n=Jp();return{...t,key:n,__TSR_key:n,[ps]:e}}function T1(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=Jp();t.history.replaceState({[ps]:0,key:Z,__TSR_key:Z},"")}let h=d(),m,p=!1,x=!1,v=!1,w=!1;const C=()=>h;let b,_;const E=()=>{b&&(T._ignoreSubscribers=!0,(b.isPush?t.history.pushState:t.history.replaceState)(b.state,"",b.href),T._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(),T.notify({type:Z})},F=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),T.notify(K);return}}}h=d(),T.notify(K)},A=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=""},T=hI({getLocation:C,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(Uv,A,{capture:!0}),t.removeEventListener(zv,F)},onBlocked:()=>{m&&h!==m&&(h=m)},getBlockers:a,setBlockers:u,notifyOnIndexChange:!1});return t.addEventListener(Uv,A,{capture:!0}),t.addEventListener(zv,F),t.history.pushState=function(...Z){const te=n.apply(t.history,Z);return T._ignoreSubscribers||R("PUSH"),te},t.history.replaceState=function(...Z){const te=s.apply(t.history,Z);return T._ignoreSubscribers||R("REPLACE"),te},T}function gI(e){const t=typeof document<"u"?window:void 0;return T1({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 pI(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Za(e,t){const n=pI(e),s=n.indexOf("#"),i=n.indexOf("?"),a=Jp();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 Jp(){return(Math.random()+1).toString(36).substring(7)}function ui(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 Wg=new WeakMap;var mI=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=JP(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=T1()),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=dI(xI(this.latestLocation),p),II(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=E1(d);x&&x!=="/"&&p.push(fI({basepath:d})),h&&p.push(h),this.rewrite=p.length===0?void 0:p.length===1?p[0]:cI(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=qP(this.routeTree,this.options.caseSensitive,(s,i)=>{s.init({originalIndex:i})});return this.options.routeMasks&&DP(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=Hg(this.rewrite,v),C=this.options.parseSearch(w.search),b=this.options.stringifySearch(C);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,C),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)=>QP({base:n,to:s.includes("//")?Qp(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=>vI({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)),C=this.routesByPath[Mr(v)];let b;if(C)b=this.getRouteBranch(C);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&&w1(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(Tv({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,gc(H.options.validateSearch,{...P,...E}))}catch{}}),E=P}E=SI({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,F=R?`#${R}`:"";let A=a.state===!0?u.state:a.state?Xs(a.state,u.state):{};A=Zs(u.state,A);const T=`${_}${j}${F}`;let U,V,Z=!1;if(this.rewrite){const P=new URL(T,this.origin),H=M1(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=LP(T),V=U;return{publicHref:V,href:U,pathname:_,search:E,searchStr:j,state:A,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=zP(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=pi(()=>{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=Hg(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(Ec(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?Wg.set(this.latestLocation,s):Wg.delete(this.latestLocation);const x=this.latestLocation,v=ui(x,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...v}),this.emit({type:"onBeforeLoad",...v}),await Av({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,C=null,b=null,_=null;this.batch(()=>{const R=this.stores.pendingMatches.get(),F=R.length,A=this.stores.matches.get();w=F?A.filter(V=>!this.stores.pendingMatchStores.has(V.id)):null;const T=new Set;for(const V of this.stores.pendingMatchStores.values())V.routeId&&T.add(V.routeId);const U=new Set;for(const V of this.stores.matchStores.values())V.routeId&&U.add(V.routeId);C=F?A.filter(V=>!T.has(V.routeId)):null,b=F?R.filter(V=>!U.has(V.routeId)):null,_=F?R.filter(V=>U.has(V.routeId)):A,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),F&&(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,F]of[[C,"onLeave"],[b,"onEnter"],[_,"onStay"]])if(R)for(const A of R)(j=(E=this.looseRoutesById[A.routeId].options)[F])==null||j.call(E,A)})})}})}catch(x){an(x)?(i=x,this.navigate({...i.options,replace:!0,ignoreBlocker:!0})):Vt(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(ui(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&&Ec(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 Av({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(an(d))return d.options.reloadDocument?void 0:await this.preloadRoute({...d.options,_fromLocation:s});Vt(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=UP(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??eI,parseSearch:e.parseSearch??ZP,protocolAllowlist:e.protocolAllowlist??FP}),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=_1(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?kI(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 C,b,_;{const H=(w==null?void 0:w.search)??e.search,X=(w==null?void 0:w._strictSearch)??void 0;try{const K=gc(v.options.validateSearch,{...H})??void 0;C={...H,...K},b={...X,...K},_=void 0}catch(K){let q=K;if(K instanceof Ic||(q=new Ic(K.message,{cause:K})),t!=null&&t.throwOnError)throw q;C=H,b={},_=q}}const E=((p=(m=v.options).loaderDeps)==null?void 0:p.call(m,{search:C}))??"",j=E?JSON.stringify(E):"",{interpolatedPath:R,usedParams:F}=Tv({path:v.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),A=v.id+R+j,T=this.getMatch(A),U=h.get(v.id),V=(T==null?void 0:T._strictParams)??F;let Z;if(!T)try{Bv(v,V)}catch(H){if(Vt(H)||an(H)?Z=H:Z=new yI(H.message,{cause:H}),t!=null&&t.throwOnError)throw Z}Object.assign(i,V);const te=U?"stay":"enter";let ae;if(T)ae={...T,cause:te,params:(U==null?void 0:U.params)??i,_strictParams:V,search:Gs(U?U.search:T.search,C),_strictSearch:b};else{const H=v.options.loader||v.options.beforeLoad||v.lazyFn||N1(v)?"pending":"success";ae={id:A,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,C):C,_strictSearch:b,searchError:void 0,status:H,isFetching:!1,error:void 0,paramsError:Z,__routeContext:void 0,_nonReactive:{loadPromise:pi()},__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],C=this.getMatch(v.id),b=h.get(v.routeId);if(v.params=b?Gs(b.params,i):i,!C){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,gc(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{Bv(p,m)}catch{}d=m}return{matchedRoutes:t,fullPath:s.fullPath,search:i,params:d}}},Ic=class extends Error{},yI=class extends Error{};function xI(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function gc(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new Ic("Async validation not supported");if(n.issues)throw new Ic(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 vI({pathname:e,routesById:t,processedTree:n}){const s=Object.create(null),i=Mr(e);let a;const u=VP(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 SI({search:e,dest:t,destRoutes:n,_includeValidateSearch:s}){return wI(n)(e,t,s??!1)}function wI(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=gc(d,v);if(x&&w)for(const C in w)C in v||(x.defaulted||(x.defaulted=new Map)).set(C,w[C]);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 kI(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 Bv(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 CI(){try{return sessionStorage}catch{return}}const bI="tsr-scroll-restoration-v1_3",ci=CI();function _I(){try{return JSON.parse((ci==null?void 0:ci.getItem("tsr-scroll-restoration-v1_3"))||"{}")}catch{return{}}}function RI(){try{ci==null||ci.setItem(bI,JSON.stringify(is))}catch{}}const is=_I(),qv="data-scroll-restoration-id",EI=e=>e.state.__TSR_key||e.href;function PI(e){const t=e.getAttribute(qv);if(t)return`[${qv}="${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 Ju=!1;const oi="window";function Gg(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function Hv(e){const t=[];for(const n of e){if(n===oi)continue;const s=Gg(n);s&&t.push(s)}return t}function II(e,t){const n=e.options.scrollRestoration,s=e._scroll;n&&(s.restoring=!0);const i=e.options.getScrollRestorationKey||EI,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(!(Ju||!s.restoring))if(h.target===document)u(oi,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===oi?m[oi]=x:p.isConnected&&(m[PI(p)]=x)};n&&!s.restoration&&(s.restoration=!0,Ju=!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())),RI()})),!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),C=h.fromLocation&&i(h.fromLocation);if(s.restoring&&C&&C!==w){const _=is[C];if(_){let E=is[w];for(const j in _){if(j===oi){if(x)continue}else{const R=Gg(j);if(!R||x&&p&&(v??(v=Hv(p)),v.includes(R)))continue}E||(E=is[w]={}),E[j]??(E[j]=_[j])}}}Ju=!0;try{const _=h.toLocation.hash,E=h.toLocation.state.__hashScrollIntoViewOptions??!0;let j=!1;if(x){const R=Wg.get(h.toLocation),F=_&&E&&(R==="PUSH"||R==="REPLACE"),A=s.restoring?is[w]:void 0;if(A)for(const T in A){const{scrollX:U,scrollY:V}=A[T];if(T===oi){if(F)continue;scrollTo({top:V,left:U,behavior:m}),j=!0}else{const Z=Gg(T);Z&&(Z.scrollLeft=U,Z.scrollTop=V)}}if(!j&&!_){const T={top:0,left:0,behavior:m};if(scrollTo(T),p){v??(v=Hv(p));for(const U of v)U.scrollTo(T)}}}!j&&_&&E&&((b=document.getElementById(_))==null||b.scrollIntoView(E))}finally{Ju=!1}}))}const jI="Error preloading route! ☝️";var $1=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=R1(i));const a=(n==null?void 0:n.id)||i;let u=s?no:dc([this.parentRoute.id==="__root__"?"":this.parentRoute.id,a]);i==="__root__"&&(i="/"),u!=="__root__"&&(u=dc(["/",u]));const f=u==="__root__"?"/":dc([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=>rI({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.")}},NI=class extends $1{constructor(e){super(e)}};function Yp(e){const t=e.errorComponent??Xp;return y.jsx(MI,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:s})=>n?z.createElement(t,{error:n,reset:s}):e.children})}var MI=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 Xp({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 TI({children:e,fallback:t=null}){return F1()?y.jsx(Ka.Fragment,{children:e}):y.jsx(Ka.Fragment,{children:t})}function F1(){return Ka.useSyncExternalStore($I,()=>!0,()=>!1)}function $I(){return()=>{}}var L1=z.createContext(null);function En(e){return z.useContext(L1)}var uf=z.createContext(void 0),FI=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 LI({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 C=m.depsTail=h.subsTail={version:p,dep:h,sub:m,prevDep:x,nextDep:v,prevSub:w,nextSub:void 0};v!==void 0&&(v.prevDep=C),x!==void 0?x.nextDep=C:m.deps=C,w!==void 0?w.nextSub=C:h.subs=C}function i(h,m=h.sub){const p=h.dep,x=h.prevDep,v=h.nextDep,w=h.nextSub,C=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=C:p.subsTail=C,C!==void 0?C.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 C=(h=w).nextSub;C!==void 0&&(p={value:m,prev:p},m=C);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,C=w.flags;if(m.flags&16)v=!0;else if((C&17)===17){if(e(w)){const b=w.subs;b.nextSub!==void 0&&f(b),v=!0}}else if((C&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 OI(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 Kg=[];let pc=0;const{link:Wv,unlink:AI,propagate:DI,checkDirty:O1,shallowPropagate:Gv}=LI({update(e){return e._update()},notify(e){Kg[Qg++]=e,e.flags&=~Je.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Je.Mutable|Je.Dirty,jc(e))}});let Yu=0,Qg=0,dr,Jg=0;function A1(e){try{++Jg,e()}finally{--Jg||D1()}}function jc(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=AI(n,e)}function D1(){if(!(Jg>0)){for(;Yu<Qg;){const e=Kg[Yu];Kg[Yu++]=void 0,e.notify()}Yu=0,Qg=0}}function Kv(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&&Wv(i,dr,pc),i._snapshot},subscribe(a){const u=OI(a),f={current:!1},d=zI(()=>{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,++pc,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),jc(i)}}};return n?(i.flags=Je.Mutable|Je.Dirty,i.get=function(){const a=i.flags;if(a&Je.Dirty||a&Je.Pending&&O1(i.deps,i)){if(i._update()){const u=i.subs;u!==void 0&&Gv(u)}}else a&Je.Pending&&(i.flags=a&~Je.Pending);return dr!==void 0&&Wv(i,dr,pc),i._snapshot}):i.set=function(a){if(i._update(a)){const u=i.subs;u!==void 0&&(DI(u),Gv(u),D1())}},i}function zI(e){const t=()=>{const s=dr;dr=n,++pc,n.depsTail=void 0,n.flags=Je.Watching|Je.RecursedCheck;try{return e()}finally{dr=s,n.flags&=~Je.RecursedCheck,jc(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&&O1(this.deps,this)?t():this.flags=Je.Watching},stop(){this.flags=Je.None,this.depsTail=void 0,jc(this)}};return t(),n}var Jh={exports:{}},Yh={},Xh={exports:{}},Zh={};/**
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 Qv;function UI(){if(Qv)return Zh;Qv=1;var e=yl();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}}),C=w[0].inst,b=w[1];return a(function(){C.value=v,C.getSnapshot=x,d(C)&&b({inst:C})},[p,v,x]),i(function(){return d(C)&&b({inst:C}),p(function(){d(C)&&b({inst:C})})},[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 Zh.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,Zh}var Jv;function VI(){return Jv||(Jv=1,Xh.exports=UI()),Xh.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 Yv;function BI(){if(Yv)return Yh;Yv=1;var e=yl(),t=VI();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 Yh.useSyncExternalStoreWithSelector=function(h,m,p,x,v){var w=a(null);if(w.current===null){var C={hasValue:!1,value:null};w.current=C}else C=w.current;w=f(function(){function _(A){if(!E){if(E=!0,j=A,A=x(A),v!==void 0&&C.hasValue){var T=C.value;if(v(T,A))return R=T}return R=A}if(T=R,s(j,A))return T;var U=x(A);return v!==void 0&&v(T,U)?(j=A,T):(j=A,R=U)}var E=!1,j,R,F=p===void 0?null:p;return[function(){return _(m())},F===null?void 0:function(){return _(F())}]},[m,p,x,v]);var b=i(h,w[0],w[1]);return u(function(){C.hasValue=!0,C.value=b},[b]),d(b),b},Yh}var Xv;function qI(){return Xv||(Xv=1,Jh.exports=BI()),Jh.exports}var HI=qI();function WI(e,t){return e===t}function Jt(e,t,n=WI){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 HI.useSyncExternalStoreWithSelector(s,i,i,t,n)}var eg={get(){},subscribe(){return{unsubscribe(){}}}};function z1(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 mo(e){const t=En(),n=z.useContext(e.from?FI:uf),s=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),i=z1(e,t),a=Jt(s??eg,u=>u?i(u):eg);if(a!==eg)return a;(e.shouldThrow??!0)&&Tr()}function U1(e){return mo({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function V1(e){const{select:t,...n}=e;return mo({...n,select:s=>t?t(s.loaderDeps):s.loaderDeps})}function B1(e){return mo({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 q1(e){return mo({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function H1(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 W1(e){return mo({...e,select:t=>e.select?e.select(t.context):t.context})}var GI=g1();function KI(e,t){const n=En(),s=NP(t),{activeProps:i,inactiveProps:a,activeOptions:u,to:f,preload:d,preloadDelay:h,preloadIntentProximity:m,hashScrollIntoView:p,replace:x,startTransition:v,resetScroll:w,viewTransition:C,children:b,target:_,disabled:E,style:j,className:R,onClick:F,onBlur:A,onFocus:T,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=F1(),pe=z.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),he=Jt(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(()=>ej(be,$e,n.history,E),[E,$e,be,n.history]),Ee=z.useMemo(()=>{if(Ce!=null&&Ce.external)return Ec(Ce.href,n.protocolAllowlist)?void 0:Ce.href;if(!tj(f)&&!(typeof f!="string"||f.indexOf(":")===-1))try{return new URL(f),Ec(f,n.protocolAllowlist)?void 0:f}catch{}},[f,Ce,n.protocolAllowlist]),lt=z.useMemo(()=>{if(Ee)return!1;if(u!=null&&u.exact){if(!KP(he.pathname,ce.pathname,n.basepath))return!1}else{const Oe=Pc(he.pathname,n.basepath),Mt=Pc(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,{})??QI:tg,Ns=lt?tg:Xs(a,{})??tg,Ms=[R,Sr.className,Ns.className].filter(Boolean).join(" "),_o=(j||Sr.style||Ns.style)&&{...j,...Sr.style,...Ns.style},[Al,$i]=z.useState(!1),Ro=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(jI)})},[n,pe,ce]);jP(s,z.useCallback(Oe=>{Oe!=null&&Oe.isIntersecting&&hn()},[hn]),ZI,{disabled:!!E||wr!=="viewport"}),z.useEffect(()=>{Ro.current||!E&&wr==="render"&&(hn(),Ro.current=!0)},[E,hn,wr]);const zr=Oe=>{const Mt=Oe.currentTarget.getAttribute("target"),Bn=_!==void 0?_:Mt;if(!E&&!nj(Oe)&&!Oe.defaultPrevented&&(!Bn||Bn==="_self")&&Oe.button===0){Oe.preventDefault(),GI.flushSync(()=>{$i(!0)});const Po=n.subscribe("onResolved",()=>{Po(),$i(!1)});n.navigate({...pe,replace:x,resetScroll:w,hashScrollIntoView:p,startTransition:v,viewTransition:C,ignoreBlocker:te})}};if(Ee)return{...M,ref:s,href:Ee,...b&&{children:b},..._&&{target:_},...E&&{disabled:E},...j&&{style:j},...R&&{className:R},...F&&{onClick:F},...A&&{onBlur:A},...T&&{onFocus:T},...U&&{onMouseEnter:U},...V&&{onMouseLeave:V},...Z&&{onTouchStart:Z}};const Eo=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)},Dl=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:Zo([F,zr]),onBlur:Zo([A,Fi]),onFocus:Zo([T,Eo]),onMouseEnter:Zo([U,Eo]),onMouseLeave:Zo([V,Fi]),onTouchStart:Zo([Z,Dl]),disabled:!!E,target:_,..._o&&{style:_o},...Ms&&{className:Ms},...E&&JI,...lt&&YI,...J&&Al&&XI}}var tg={},QI={className:"active"},JI={role:"link","aria-disabled":!0},YI={"data-status":"active","aria-current":"page"},XI={"data-transitioning":"transitioning"},Ca=new WeakMap,ZI={rootMargin:"100px"},Zo=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function ej(e,t,n,s){if(!s)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function tj(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Zp=z.forwardRef((e,t)=>{const{_asChild:n,...s}=e,{type:i,...a}=KI(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 nj(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var rj=class extends $1{constructor(e){super(e),this.useMatch=t=>mo({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>W1({...t,from:this.id}),this.useSearch=t=>q1({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>B1({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>V1({...t,from:this.id}),this.useLoaderData=t=>U1({...t,from:this.id}),this.useNavigate=()=>H1({from:this.fullPath}),this.Link=Ka.forwardRef((t,n)=>y.jsx(Zp,{ref:n,from:this.fullPath,...t}))}};function G1(e){return new rj(e)}var sj=class extends NI{constructor(e){super(e),this.useMatch=t=>mo({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>W1({...t,from:this.id}),this.useSearch=t=>q1({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>B1({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>V1({...t,from:this.id}),this.useLoaderData=t=>U1({...t,from:this.id}),this.useNavigate=()=>H1({from:this.fullPath}),this.Link=Ka.forwardRef((t,n)=>y.jsx(Zp,{ref:n,from:this.fullPath,...t}))}};function oj(e){return new sj(e)}function ij(e){const t=En(),n=`not-found-${Jt(t.stores.location,s=>s.pathname)}-${Jt(t.stores.status,s=>s)}`;return y.jsx(Yp,{getResetKey:()=>n,onCatch:(s,i)=>{var a;if(Vt(s))(a=e.onCatch)==null||a.call(e,s,i);else throw s},errorComponent:({error:s})=>{var i;if(Vt(s))return(i=e.fallback)==null?void 0:i.call(e,s);throw s},children:e.children})}function aj(){return y.jsx("p",{children:"Not Found"})}function ii(e){return y.jsx(y.Fragment,{children:e.children})}function K1(e,t,n){return t.options.notFoundComponent?y.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?y.jsx(e.options.defaultNotFoundComponent,{...n}):y.jsx(aj,{})}function lj(e){return null}function uj(){return lj(En()),null}var cj=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,fj=(e,t)=>e[0]===t[0]&&e[1]===t[1],Q1=z.memo(function({matchId:t}){const n=En(),s=n.stores.matchStores.get(t);s||Tr();const i=Jt(n.stores.loadedAt,u=>u),a=Jt(s,u=>u,cj);return y.jsx(dj,{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 dj({router:e,matchId:t,resetKey:n,matchState:s}){var w,C;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??(((C=i.options.errorComponent)==null?void 0:C.preload)||m))?z.Suspense:ii,x=f?Yp:ii,v=h?ij:ii;return y.jsxs(i.isRoot?i.options.shellComponent??ii:ii,{children:[y.jsx(uf.Provider,{value:t,children:y.jsx(p,{fallback:u,children:y.jsx(x,{getResetKey:()=>n,errorComponent:f||Xp,onCatch:(b,_)=>{if(Vt(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(TI,{fallback:u,children:y.jsx(Zv,{matchId:t})}):y.jsx(Zv,{matchId:t})})})})}),s.parentRouteId===no?y.jsxs(y.Fragment,{children:[y.jsx(hj,{}),e.options.scrollRestoration&&v1?y.jsx(uj,{}):null]}):null]})}function hj(){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",...ui(e.stores.location.get(),s??n)}),t.current=n},[Jt(e.stores.resolvedLocation,n=>n==null?void 0:n.state.__TSR_key),e]),null}var Zv=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=Jt(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(J1,{})},[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=pi();p._nonReactive.minPendingPromise=x,setTimeout(()=>{x.resolve(),p._nonReactive.minPendingPromise=void 0},m)}}throw s(a,"loadPromise")}if(a.status==="notFound")return Vt(a.error)||Tr(),K1(n,f,a.error);if(a.status==="redirected")throw an(a.error)||Tr(),s(a,"loadPromise");if(a.status==="error")throw a.error;return h}),J1=z.memo(function(){const t=En(),n=z.useContext(uf);let s,i=!1,a;{const h=n?t.stores.matchStores.get(n):void 0;[s,i]=Jt(h,m=>[m==null?void 0:m.routeId,(m==null?void 0:m.globalNotFound)??!1],fj),a=Jt(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(),K1(t,u,void 0);if(!a)return null;const d=y.jsx(Q1,{matchId:a});return s===no?y.jsx(z.Suspense,{fallback:f,children:d}):d});function gj(){const e=En(),t=z.useRef({router:e,mounted:!1}),[n,s]=z.useState(!1),i=Jt(e.stores.isLoading,p=>p),a=Jt(e.stores.hasPending,p=>p),u=Bh(i),f=i||n||a,d=Bh(f),h=i||a,m=Bh(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",...ui(e.stores.location.get(),e.stores.resolvedLocation.get())})},[u,e,i]),Ma(()=>{m&&!h&&e.emit({type:"onBeforeRouteMount",...ui(e.stores.location.get(),e.stores.resolvedLocation.get())})},[h,m,e]),Ma(()=>{if(d&&!f){const p=ui(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...p}),A1(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())})}},[f,d,e]),null}function pj(){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?ii:z.Suspense,{fallback:n,children:[y.jsx(gj,{}),y.jsx(mj,{})]});return e.options.InnerWrap?y.jsx(e.options.InnerWrap,{children:s}):s}function mj(){const e=En(),t=Jt(e.stores.firstId,i=>i),n=Jt(e.stores.loadedAt,i=>i),s=t?y.jsx(Q1,{matchId:t}):null;return y.jsx(uf.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?s:y.jsx(Yp,{getResetKey:()=>n,errorComponent:Xp,onCatch:void 0,children:s})})}var yj=e=>({createMutableStore:Kv,createReadonlyStore:Kv,batch:A1}),xj=e=>new vj(e),vj=class extends mI{constructor(e){super(e,yj)}};function Sj({router:e,children:t,...n}){w1(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const s=y.jsx(L1.Provider,{value:e,children:t});return e.options.Wrap?y.jsx(e.options.Wrap,{children:s}):s}function wj({router:e,...t}){return y.jsx(Sj,{router:e,...t,children:y.jsx(pj,{})})}function kj(e){const t=En({warn:(e==null?void 0:e.router)===void 0}),n=(e==null?void 0:e.router)||t;return Jt(n.stores.__store,z1(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},Cj={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 bj(e){return e?e.startsWith("#")?e:vn[e]??el:el}const so=bj;function _j(e){return Cj[e]??el}const eS=["#00d7ff","#00d787","#e6b450","#d75f87","#5f87ff","#af87ff","#5fd7a7","#ff8787","#d7af5f","#87d7ff","#d787d7","#9ee493","#ffb454","#7aa2f7","#bb9af7"],tS=new Map;function em(e){const t=tS.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=eS[n%eS.length];return tS.set(e,s),s}const z5={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 nS=["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 U5(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 Y1(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 X1(e,t=0){return Number.isFinite(e)?`${(e*100).toFixed(t)}%`:"0%"}function Rj(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`${nS[Number(t[2])-1]} ${Number(t[3])}`;const n=/^(\d{4})-(\d{2})$/.exec(e);return n?`${nS[Number(n[2])-1]} ${n[1]}`:e}function nl(e){return e.input+e.output+e.cacheCreate+e.cacheRead}const ds=864e5,Ej=["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)},vl=e=>new Date(e).toISOString().slice(0,10),rl=e=>(new Date(e).getUTCDay()+6)%7,Pj=e=>{const t=$r(e);return vl(t-rl(t)*ds)},Ij={period:"all"},Z1=[{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 ek(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 tk(e,t){const n=ek(e,t);return e.accounts.filter(s=>!(!s.hasUsage||t.account!=="all"&&s.id!==t.account||n&&!n.has(s.providerId)))}function Yg(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 jj(e,t){const n=ek(e,t);return e.accounts.filter(s=>!(!s.hasUsage&&!Yg(s)||t.account!=="all"&&s.id!==t.account||n&&!n.has(s.providerId)))}function nk(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 rk(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 vl($r(t)-(n-1)*ds)}function Nj(e,t,n){if(!n||e==="all")return null;const s=rk(e,n);if(t==="daily")return s;const i=t==="monthly"?365:84,a=vl($r(n)-(i-1)*ds);return s&&s<a?s:a}function Mj(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 Tj(e,t,n){var h;if(!e)return[];const s=tk(e,t),i=nk(s),a=Nj(t.period,n,i),u=a?n==="monthly"?a.slice(0,7):n==="weekly"?Pj(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(C=>f.has(C.name)):p.breakdown;if(f&&x.length===0)continue;const v=d.get(p.label),w=Mj(x);if(!v)d.set(p.label,{label:p.label,models:x.map(C=>C.name).sort(),...w,total:nl(w),breakdown:x.map(C=>({...C}))});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 C=new Map(v.breakdown.map(b=>[b.name,b]));for(const b of x){const _=C.get(b.name);_?(_.input+=b.input,_.output+=b.output,_.cacheCreate+=b.cacheCreate,_.cacheRead+=b.cacheRead,_.cacheSavings+=b.cacheSavings,_.cost+=b.cost,_.count+=b.count):C.set(b.name,{...b})}v.breakdown=[...C.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 ng(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 mc=(e,t,n,s,i)=>{e.cost+=t,e.tokens+=n,e.cacheSavings+=s,e.calls+=i};function $j(){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 Fj(e,t){var s;const n=i=>[i.cost,i.tokens,i.cacheSavings,i.calls];mc(e.today,...n(ng(t,"today"))),mc(e.week,...n(ng(t,"week"))),mc(e.month,...n(ng(t,"month"))),e.burnRate+=((s=t.dashboard)==null?void 0:s.burnRate)??0}function Lj(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;mc(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 Oj(e){return[...e.timelineMap.values()].sort((t,n)=>t.date.localeCompare(n.date))}function Aj(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:em(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 Dj(e,t){var E,j;const n=e?tk(e,t):[],s=nk(n),i=rk(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=$j(),h=R=>!i||R>=i;for(const R of n){Fj(d,R);const F=R.providerId,A=u.get(F)??R.color;for(const T of((E=R.table)==null?void 0:E.daily)??[])h(T.label)&&Lj(d,T,F,A,a)}for(const R of d.provAgg.values()){const F=f.get(R.id);F&&(R.name=F)}const m=Oj(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 F of((j=R.table)==null?void 0:j.daily)??[]){if(!h(F.label))continue;const A=a?F.breakdown.filter(U=>a.has(U.name)):F.breakdown;if(a&&A.length===0)continue;let T=w.get(F.label);T||(T={tokens:0,calls:0,cacheSavings:0,models:new Map},w.set(F.label,T));for(const U of A)T.tokens+=nl(U),T.calls+=U.count,T.cacheSavings+=U.cacheSavings,T.models.set(U.name,(T.models.get(U.name)??0)+U.cost)}const C=m.map(R=>{const F=w.get(R.date);return{date:R.date,cost:R.total,tokens:(F==null?void 0:F.tokens)??0,calls:(F==null?void 0:F.calls)??0,cacheSavings:(F==null?void 0:F.cacheSavings)??0,models:F?[...F.models.entries()].map(([A,T])=>({name:A,cost:T})).sort((A,T)=>T.cost-A.cost):[]}}),b=[...d.provAgg.values()].sort((R,F)=>F.cost-R.cost),_=Aj(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:C,cardAccounts:e?jj(e,t):[],byProvider:b,byModel:_,tokenComposition:d.tokenComposition,modelOptions:[...d.modelOptionSet].sort(),latestDay:s,rangeStart:i}}function Gt({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 zj=e=>y.jsxs(Gt,{...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"})]}),mi=e=>y.jsx(Gt,{...e,children:y.jsx("path",{d:"M20 6 9 17l-5-5"})}),Uj=e=>y.jsxs(Gt,{...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"})]}),Vj=e=>y.jsxs(Gt,{...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"})]}),rg=e=>y.jsx(Gt,{...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"})}),Bj=e=>y.jsxs(Gt,{...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"})]}),tm=e=>y.jsx(Gt,{...e,children:y.jsx("path",{d:"m6 9 6 6 6-6"})}),qj=e=>y.jsxs(Gt,{...e,children:[y.jsx("circle",{cx:"11",cy:"11",r:"8"}),y.jsx("path",{d:"m21 21-4.3-4.3"})]}),yi=e=>y.jsxs(Gt,{...e,children:[y.jsx("path",{d:"M18 6 6 18"}),y.jsx("path",{d:"m6 6 12 12"})]}),Hj=e=>y.jsxs(Gt,{...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"})]}),Wj=e=>y.jsx(Gt,{...e,children:y.jsx("path",{d:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"})}),Gj=e=>y.jsxs(Gt,{...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"})]}),Kj=e=>y.jsx(Gt,{...e,children:y.jsx("path",{d:"M12 5v14M5 12h14"})}),Qj=e=>y.jsx(Gt,{...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"})}),rS=e=>y.jsxs(Gt,{...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"})]}),sk=e=>y.jsx(Gt,{...e,children:y.jsx("path",{d:"m18 15-6-6-6 6"})}),nm="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} ${nm} ${t===p.value?h:m}`,children:p.label},String(p.value)))})}function sS({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 ${nm}`,children:[y.jsxs("span",{className:"text-fg-faint",children:[e,":"]}),y.jsx("span",{className:"text-fg",children:t}),y.jsx(tm,{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 oS({children:e}){return y.jsx("div",{className:"flex flex-col",children:e})}function Xu({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 ${nm} ${e?"bg-bg-3 text-fg-bright":"text-fg-dim hover:bg-bg-3 hover:text-fg"}`,children:n})}function Jj({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),C=_=>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:()=>C(_.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(sS,{label:"account",value:n.account==="all"?"all":w?v(w):"all",children:_=>y.jsxs(oS,{children:[y.jsx(Xu,{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(Xu,{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(sS,{label:"model",value:n.models.length===0?"all":n.models.length===1?Or(n.models[0]):`${n.models.length} models`,children:()=>y.jsxs(oS,{children:[y.jsx(Xu,{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(Xu,{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:Z1.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(yi,{className:"size-3","aria-hidden":!0})," clear"]})]})]})})}function Yj(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 Xj=(()=>{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 ei=null;function ok(e={}){return ei||(e.includeStyleProperties?(ei=e.includeStyleProperties,ei):(ei=ms(window.getComputedStyle(document.documentElement)),ei))}function Nc(e,t){const s=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return s?parseFloat(s.replace("px","")):0}function Zj(e){const t=Nc(e,"border-left-width"),n=Nc(e,"border-right-width");return e.clientWidth+t+n}function e2(e){const t=Nc(e,"border-top-width"),n=Nc(e,"border-bottom-width");return e.clientHeight+t+n}function ik(e,t={}){const n=t.width||Zj(e),s=t.height||e2(e);return{width:n,height:s}}function t2(){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 n2(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 r2(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 Mc(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 s2(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function o2(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),s2(i)}const ln=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||ln(n,t)};function i2(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function a2(e,t){return ok(t).map(n=>{const s=e.getPropertyValue(n),i=e.getPropertyPriority(n);return`${n}: ${s}${i?" !important":""};`}).join(" ")}function l2(e,t,n,s){const i=`.${e}:${t}`,a=n.cssText?i2(n):a2(n,s);return document.createTextNode(`${i}{${a}}`)}function iS(e,t,n,s){const i=window.getComputedStyle(e,n),a=i.getPropertyValue("content");if(a===""||a==="none")return;const u=Xj();try{t.className=`${t.className} ${u}`}catch{return}const f=document.createElement("style");f.appendChild(l2(u,n,i,s)),t.appendChild(f)}function u2(e,t,n){iS(e,t,":before",n),iS(e,t,":after",n)}const aS="application/font-woff",lS="image/jpeg",c2={woff:aS,woff2:aS,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:lS,jpeg:lS,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function f2(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function rm(e){const t=f2(e).toLowerCase();return c2[t]||""}function d2(e){return e.split(/,/)[1]}function Xg(e){return e.search(/^(data:)/)!==-1}function h2(e,t){return`data:${t};base64,${e}`}async function ak(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 sg={};function g2(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 sm(e,t,n){const s=g2(e,t,n.includeQueryParams);if(sg[s]!=null)return sg[s];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let i;try{const a=await ak(e,n.fetchRequestInit,({res:u,result:f})=>(t||(t=u.headers.get("Content-Type")||""),d2(f)));i=h2(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 sg[s]=i,i}async function p2(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):Mc(t)}async function m2(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 Mc(f)}const n=e.poster,s=rm(n),i=await sm(n,s,t);return Mc(i)}async function y2(e,t){var n;try{if(!((n=e==null?void 0:e.contentDocument)===null||n===void 0)&&n.body)return await cf(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function x2(e,t){return ln(e,HTMLCanvasElement)?p2(e):ln(e,HTMLVideoElement)?m2(e,t):ln(e,HTMLIFrameElement)?y2(e,t):e.cloneNode(lk(e))}const v2=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",lk=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function S2(e,t,n){var s,i;if(lk(t))return t;let a=[];return v2(e)&&e.assignedNodes?a=ms(e.assignedNodes()):ln(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||ln(e,HTMLVideoElement)||await a.reduce((u,f)=>u.then(()=>cf(f,n)).then(d=>{d&&t.appendChild(d)}),Promise.resolve()),t}function w2(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):ok(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`),ln(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 k2(e,t){ln(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),ln(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function C2(e,t){if(ln(e,HTMLSelectElement)){const s=Array.from(t.children).find(i=>e.value===i.getAttribute("value"));s&&s.setAttribute("selected","")}}function b2(e,t,n){return ln(t,Element)&&(w2(e,t,n),u2(e,t,n),k2(e,t),C2(e,t)),t}async function _2(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 cf(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 cf(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(s=>x2(s,t)).then(s=>S2(e,s,t)).then(s=>b2(e,s,t)).then(s=>_2(s,t))}const uk=/url\((['"]?)([^'"]+?)\1\)/g,R2=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,E2=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function P2(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function I2(e){const t=[];return e.replace(uk,(n,s,i)=>(t.push(i),n)),t.filter(n=>!Xg(n))}async function j2(e,t,n,s,i){try{const a=n?Yj(t,n):t,u=rm(t);let f;return i||(f=await sm(a,u,s)),e.replace(P2(t),`$1${f}$3`)}catch{}return e}function N2(e,{preferredFontFormat:t}){return t?e.replace(E2,n=>{for(;;){const[s,,i]=R2.exec(n)||[];if(!i)return"";if(i===t)return`src: ${s};`}}):e}function ck(e){return e.search(uk)!==-1}async function fk(e,t,n){if(!ck(e))return e;const s=N2(e,n);return I2(s).reduce((a,u)=>a.then(f=>j2(f,u,t,n)),Promise.resolve(s))}async function ti(e,t,n){var s;const i=(s=t.style)===null||s===void 0?void 0:s.getPropertyValue(e);if(i){const a=await fk(i,null,n);return t.style.setProperty(e,a,t.style.getPropertyPriority(e)),!0}return!1}async function M2(e,t){await ti("background",e,t)||await ti("background-image",e,t),await ti("mask",e,t)||await ti("-webkit-mask",e,t)||await ti("mask-image",e,t)||await ti("-webkit-mask-image",e,t)}async function T2(e,t){const n=ln(e,HTMLImageElement);if(!(n&&!Xg(e.src))&&!(ln(e,SVGImageElement)&&!Xg(e.href.baseVal)))return;const s=n?e.src:e.href.baseVal,i=await sm(s,rm(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 $2(e,t){const s=ms(e.childNodes).map(i=>dk(i,t));await Promise.all(s).then(()=>e)}async function dk(e,t){ln(e,Element)&&(await M2(e,t),await T2(e,t),await $2(e,t))}function F2(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 uS={};async function cS(e){let t=uS[e];if(t!=null)return t;const s=await(await fetch(e)).text();return t={url:e,cssText:s},uS[e]=t,t}async function fS(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),ak(f,t.fetchRequestInit,({result:d})=>(n=n.replace(u,`url(${d})`),[u,d]))});return Promise.all(a).then(()=>n)}function dS(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 L2(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=cS(d).then(m=>fS(m,t)).then(m=>dS(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(cS(i.href).then(f=>fS(f,t)).then(f=>dS(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 O2(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>ck(t.style.getPropertyValue("src")))}async function A2(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=ms(e.ownerDocument.styleSheets),s=await L2(n,t);return O2(s)}function hk(e){return e.trim().replace(/["']/g,"")}function D2(e){const t=new Set;function n(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(a=>{t.add(hk(a))}),Array.from(s.children).forEach(a=>{a instanceof HTMLElement&&n(a)})}return n(e),t}async function z2(e,t){const n=await A2(e,t),s=D2(e);return(await Promise.all(n.filter(a=>s.has(hk(a.style.fontFamily))).map(a=>{const u=a.parentStyleSheet?a.parentStyleSheet.href:null;return fk(a.cssText,u,t)}))).join(`
59
- `)}async function U2(e,t){const n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await z2(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 V2(e,t={}){const{width:n,height:s}=ik(e,t),i=await cf(e,t,!0);return await U2(i,t),await dk(i,t),F2(i,t),await o2(i,n,s)}async function gk(e,t={}){const{width:n,height:s}=ik(e,t),i=await V2(e,t),a=await Mc(i),u=document.createElement("canvas"),f=u.getContext("2d"),d=t.pixelRatio||t2(),h=t.canvasWidth||n,m=t.canvasHeight||s;return u.width=h*d,u.height=m*d,t.skipAutoScale||n2(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 B2(e,t={}){return(await gk(e,t)).toDataURL()}async function q2(e,t={}){const n=await gk(e,t);return await r2(n)}const pk="#0a0a0a";async function mk(){try{await document.fonts.ready}catch{}await new Promise(e=>requestAnimationFrame(()=>e(null)))}async function H2(e,t={}){return await mk(),B2(e,{pixelRatio:t.pixelRatio??2,backgroundColor:t.backgroundColor??pk,cacheBust:!0,skipFonts:!1})}function W2(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}async function G2(e,t,n){W2(await H2(e,n),t)}async function K2(e,t){try{await mk();const n=await q2(e,{pixelRatio:(t==null?void 0:t.pixelRatio)??2,backgroundColor:(t==null?void 0:t.backgroundColor)??pk,cacheBust:!0});return!n||!navigator.clipboard||typeof ClipboardItem>"u"?!1:(await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),!0)}catch{return!1}}function Q2(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 og=["▁","▂","▃","▄","▅","▆","▇","█"];function sl({data:e,color:t="var(--color-accent)",className:n=""}){const s=og.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?og[Math.floor(s/2)].repeat(e.length):e.map(f=>og[i<=0?0:Math.max(0,Math.min(s,Math.floor(f/i*(s+.999))))]).join("")})}function Zu({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 J2({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 Tc({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 hS=e=>e==="all time"?"all time":`last ${e}`,Y2=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 · ",hS(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(ec,{label:"tokens",value:wn(t.totals.tokens)}):y.jsx(ec,{label:"spend",value:Ue(t.totals.cost)}),y.jsx(ec,{label:"cache saved",value:Ue(t.totals.cacheSavings),className:"text-positive"}),y.jsx(ec,{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 · ",hS(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:X1(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(Tc,{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(Tc,{variant:"corner"})]})});function ec({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 X2=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(Tc,{variant:"footer"})}):y.jsx(Tc,{variant:"corner"})]})}),Z2=600,gS=360,eN=e=>e==="light"?"#f4f5f5":"#0a0a0a";function tN({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),[C,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 F=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,C,h,f,v]);const A=Math.min(Z2/_.w,gS/_.h,1),T={pixelRatio:Number(p),backgroundColor:eN(f)},U=Q2(n?"summary":e.captureName),V=async()=>{s.current&&(await G2(s.current,U,T),F("dl"))},Z=async()=>{s.current&&F(await K2(s.current,T)?"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(yi,{className:"size-4"})}),y.jsx("div",{className:"flex items-center justify-center bg-bg-0 px-6 pb-5 pt-9",style:{minHeight:gS+24},children:y.jsx("div",{className:"overflow-hidden rounded",style:{width:_.w*A,height:_.h*A},children:y.jsx("div",{style:{width:_.w,height:_.h,transform:`scale(${A})`,transformOrigin:"top left"},children:y.jsx("div",{className:f==="light"?"light":"dark",children:n?y.jsx(Y2,{ref:s,derived:e.derived,periodLabel:e.periodLabel,tz:e.tz,version:e.version,opts:{glow:v,wmPos:h}}):y.jsx(X2,{ref:s,node:e.node,title:e.captureName,framed:C,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:C?"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(mi,{className:"size-3.5 text-positive"}):j==="fail"?y.jsx(yi,{className:"size-3.5 text-warning"}):y.jsx(Uj,{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(mi,{className:"size-3.5 text-positive"}):y.jsx(Vj,{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 yk=z.createContext(()=>{}),xk=()=>z.useContext(yk);function nN({children:e}){const[t,n]=z.useState(null);return y.jsxs(yk.Provider,{value:n,children:[e,t&&y.jsx(tN,{source:t,onClose:()=>n(null)})]})}function rN({derived:e,periodLabel:t,tz:n,version:s}){const i=xk();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(Bj,{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:[]},sN=["claude","codex","cursor"],ig=["cyan","magenta","green","yellow","blue","red"],ol=[...za],oN=["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 iN(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 pS(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=n?e:t}function vk(e){try{return new Intl.DateTimeFormat("en-CA",{timeZone:e}),!0}catch{return!1}}function om(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:pS(e.interval,Ra.interval,1),billingInterval:pS(e.billingInterval,Ra.billingInterval,1),clearScreen:typeof e.clearScreen=="boolean"?e.clearScreen:Ra.clearScreen,timezone:typeof e.timezone=="string"&&e.timezone.trim()&&vk(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?[...sN]:[]}}catch{return{...Ra}}}function aN(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,48)}function Sk(e,t){const n=aN(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 lN(e){const t=new Set(e.map(n=>n.color).filter(Boolean));for(const n of ig)if(!t.has(n))return n;return ig[e.length%ig.length]}function im(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 Ft=(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}}},uN={pipe(){return Ft(this,arguments)}},ff=(function(){function e(){}return e.prototype=uN,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,am=_s(!0),wk=_s(!1),df=_s(void 0),Sl=df;function kk(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 Zg=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},ep=new WeakSet;function lm(e){return typeof e=="string"}function Ck(e){return typeof e=="number"}function cN(e){return typeof e=="boolean"}function hf(e){return typeof e=="function"}function fN(e){return e!==void 0}function dN(e){return e!=null}function hN(e){return!1}function bk(e){return!0}function gN(e){return typeof e=="object"&&e!==null||hf(e)}const De=re(2,(e,t)=>gN(e)&&t in e);function pN(e){return De(e,Symbol.iterator)||lm(e)}const Xt="~effect/interfaces/Hash",dt=e=>{switch(typeof e){case"number":return um(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(ep.has(e))return tp(e);if(lg.has(e))return lg.get(e);const t=SN(e,()=>mN(e)?e[Xt]():typeof e=="function"?tp(e):Array.isArray(e)||ArrayBuffer.isView(e)?_k(e):e instanceof Map?xN(e):e instanceof Set?vN(e):cm(e));return lg.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`)}},tp=e=>(ag.has(e)||ag.set(e,um(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),ag.get(e)),Xn=re(2,(e,t)=>e*53^t),gf=e=>e&3221225471|e>>>1&1073741824,mN=e=>De(e,Xt),um=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 gf(t)},_t=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return gf(t)},yN=(e,t)=>{let n=12289;for(const s of t)n^=Xn(dt(s),dt(e[s]));return gf(n)},cm=e=>yN(e,Zg(e)),fm=(e,t)=>n=>{let s=e;for(const i of n)s^=t(i);return gf(s)},_k=fm(6151,dt),xN=fm(_t("Map"),([e,t])=>Xn(dt(e),dt(t))),vN=fm(_t("Set"),dt),ag=new WeakMap,lg=new WeakMap,ug=new WeakSet;function SN(e,t){if(ug.has(e))return _t("[Circular]");ug.add(e);const n=t();return ug.delete(e),n}const Zt="~effect/interfaces/Equal";function kn(){return arguments.length===1?e=>fo(e,arguments[0]):fo(arguments[0],arguments[1])}function fo(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"||ep.has(e)||ep.has(t)?!1:CN(e,t,kN)}function wN(e,t,n){const s=cg.has(e),i=fg.has(t);if(s&&i)return!0;if(s||i)return!1;cg.add(e),fg.add(t);const a=n();return cg.delete(e),fg.delete(t),a}const cg=new WeakSet,fg=new WeakSet;function kN(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=mS(e),s=mS(t);if(n!==s)return!1;const i=n&&s;return typeof e=="function"&&!i?!1:wN(e,t,()=>i?e[Zt](t):Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:bN(e,t):ArrayBuffer.isView(e)?!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength?!1:_N(e,t):e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:PN(e,t):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:jN(e,t):RN(e,t))}function CN(e,t,n){let s=tc.get(e);if(!s)s=new WeakMap,tc.set(e,s);else if(s.has(t))return s.get(t);const i=n(e,t);s.set(t,i);let a=tc.get(t);return a||(a=new WeakMap,tc.set(t,a)),a.set(e,i),i}const tc=new WeakMap;function bN(e,t){for(let n=0;n<e.length;n++)if(!fo(e[n],t[n]))return!1;return!0}function _N(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 RN(e,t){const n=Zg(e),s=Zg(t);if(n.size!==s.size)return!1;for(const i of n)if(!s.has(i)||!fo(e[i],t[i]))return!1;return!0}function EN(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 PN=EN(fo,fo);function IN(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 jN=IN(fo),mS=e=>De(e,Zt),NN=()=>kn,MN=e=>(t,n)=>t===n||e(t,n),TN=(e,t)=>e===t,$N=()=>TN;function FN(e){return MN((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 Rk=e=>e.length>0,pf=Symbol.for("~effect/Redactable"),LN=e=>De(e,pf);function mf(e){return LN(e)?Ek(e):e}function Ek(e){var t;return e[pf](((t=globalThis[Ua])==null?void 0:t.context)??ON)}const Ua="~effect/Fiber/currentFiber",ON={"~effect/Context":{},mapUnsafe:new Map,pipe(){return Ft(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 yS;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 DN(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=zN(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 yS;if(s.add(h),pf in h)return vt(Ek(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=>`${$c(w)}:${d(h[w],m)}`).join(",")}}`;return u(h,v)}const x=`{
63
- ${p.map(v=>`${a(m+1)}${$c(v)}: ${d(h[v],m+1)}`).join(`,
64
- `)}
65
- ${a(m)}}`;return u(h,x)}return String(h)}return d(e,0)}const yS="[Circular]";function $c(e){return typeof e=="string"?JSON.stringify(e):String(e)}function AN(e){return e.map(t=>`[${$c(t)}]`).join("")}function DN(e){try{return e.toISOString()}catch{return"Invalid Date"}}function zN(e){try{const t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function Pk(e,t){let n=[];const s=JSON.stringify(e,(i,a)=>typeof a=="object"&&a!==null?n.includes(a)?void 0:n.push(a)&&mf(a):a,t==null?void 0:t.space);return n=void 0,s}const ho=Symbol.for("nodejs.util.inspect.custom"),wl=e=>{try{if(De(e,"toJSON")&&hf(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(wl)}catch{return"[toJSON threw]"}return mf(e)},UN=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?VN(e,t):String(e)}catch{return String(e)}},VN=(e,t)=>{let n=[];const s=JSON.stringify(e,(i,a)=>typeof a=="object"&&a!==null?n.includes(a)?void 0:n.push(a)&&mf(a):a,t);return n=void 0,s},xS={toJSON(){return wl(this)},[ho](){return this.toJSON()},toString(){return vt(this.toJSON())}};class yf{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 yf(this.self)}}const xi="~effect/Utils/internal",Ik={[xi]:e=>e()},BN={[xi]:e=>{try{return e()}finally{}}};var Jw;const qN=((Jw=Ik[xi](()=>new Error().stack))==null?void 0:Jw.includes(xi))===!0,Yt=qN?Ik[xi]:BN[xi],Es="~effect/Effect",il="~effect/Exit",HN={_A:_e,_E:_e,_R:_e},jk=`${Es}/identifier`,Ie=`${Es}/args`,It=`${Es}/evaluate`,Cn=`${Es}/successCont`,gr=`${Es}/failureCont`,go=`${Es}/ensureCont`,Js=Symbol.for("effect/Effect/Yield"),Ps={pipe(){return Ft(this,arguments)},toJSON(){return{...this}},toString(){return vt(this.toJSON(),{ignoreToString:!0,space:2})},[ho](){return this.toJSON()}},xf={[Symbol.iterator](){return new yf(this)}},WN={...xf,pipe(){return Ft(this,arguments)}},GN={[Es]:HN,...Ps,[Symbol.iterator](){return new yf(this)},asEffect(){return this},toJSON(){return{_id:"Effect",op:this[jk],...Ie in this?{args:this[Ie]}:void 0}}},Ht=e=>De(e,Es),Nk=e=>De(e,il),yc="~effect/Cause",xc="~effect/Cause/Reason",vf=e=>De(e,yc),KN=e=>De(e,xc);var Yw;class yo{constructor(t){L(this,Yw);L(this,"reasons");this[yc]=yc,this.reasons=t}pipe(){return Ft(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${vt(this.reasons)})`}[(Yw=yc,ho)](){return this.toJSON()}[Zt](t){return vf(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((n,s)=>kn(n,t.reasons[s]))}[Xt](){return _k(this.reasons)}}const vS=new WeakMap;var Xw;class dm{constructor(t,n,s){L(this,Xw);L(this,"annotations");L(this,"_tag");if(this[xc]=xc,this._tag=t,n!==Sf&&typeof s=="object"&&s!==null&&n.size>0){const i=vS.get(s);i&&(n=new Map([...i,...n])),vS.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 Ft(this,arguments)}toString(){return vt(this)}[(Xw=xc,ho)](){return this.toString()}}const Sf=new Map;class Mk extends dm{constructor(n,s=Sf){super("Fail",s,n);L(this,"error");this.error=n}toString(){return`Fail(${vt(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[Zt](n){return hm(n)&&kn(this.error,n.error)&&kn(this.annotations,n.annotations)}[Xt](){return Xn(_t(this._tag))(Xn(dt(this.error))(dt(this.annotations)))}}const al=e=>new yo(e),QN=new yo([]),Tk=e=>new yo([new Mk(e)]);class $k extends dm{constructor(n,s=Sf){super("Die",s,n);L(this,"defect");this.defect=n}toString(){return`Die(${vt(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[Zt](n){return YN(n)&&kn(this.defect,n.defect)&&kn(this.annotations,n.annotations)}[Xt](){return Xn(_t(this._tag))(Xn(dt(this.defect))(dt(this.annotations)))}}const JN=e=>new yo([new $k(e)]),np=re(e=>vf(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new yo(e.reasons.map(s=>s.annotate(t,n)))),hm=e=>e._tag==="Fail",YN=e=>e._tag==="Die",gm=e=>e._tag==="Interrupt";function XN(e){return vi("Effect.evaluate: Not implemented")}const kl=e=>({...GN,[jk]:e.op,[It]:e[It]??XN,[Cn]:e[Cn],[gr]:e[gr],[go]:e[go]}),rr=e=>{const t=kl(e);return function(){const n=Object.create(t);return n[Ie]=e.single===!1?arguments:arguments[0],n}},Fk=e=>{const t={...kl(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]}},[Zt](n){return Nk(n)&&n._tag===this._tag&&kn(this[Ie],n[Ie])},[Xt](){return Xn(_t(e.op),dt(this[Ie]))}};return function(n){const s=Object.create(t);return s[Ie]=n,s}},at=Fk({op:"Success",prop:"value",[It](e){const t=e.getCont(Cn);return t?t[Cn](this[Ie],e,this):e.yieldWith(this)}}),wf={key:"effect/Cause/StackTrace"},ZN={key:"effect/Cause/InterruptorStackTrace"},On=Fk({op:"Failure",prop:"cause",[It](e){let t=this[Ie],n=!1;e.currentStackFrame&&(t=np(t,{mapUnsafe:new Map([[wf.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(Tk(e)),vi=e=>On(JN(e)),Ve=rr({op:"WithFiber",[It](e){return this[Ie](e)}}),eM=(function(){class e extends globalThis.Error{asEffect(){return yr(this)}}return Object.assign(e.prototype,WN),e})(),Lk=(function(){const e=Symbol.for("effect/Data/Error/plainArgs");return class extends eM{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}}}})(),pm=e=>{class t extends Lk{constructor(){super(...arguments);L(this,"_tag",e)}}return t.prototype.name=e,t},SS="~effect/Cause/NoSuchElementError";var Zw,e1;class tM extends(e1=pm("NoSuchElementError"),Zw=SS,e1){constructor(n){super({message:n});L(this,Zw,SS)}}const ll="~effect/Cause/Done",nM=e=>De(e,ll),Ok={[ll]:ll,_tag:"Done",value:void 0},mm=e=>e===void 0?Ok:{[ll]:ll,_tag:"Done",value:e},rM=yr(Ok),sM=e=>e===void 0?rM:yr(mm(e)),Ak="~effect/data/Option",Dk={[Ak]:{_A:e=>e},...Ps,...xf},zk=Object.assign(Object.create(Dk),{_tag:"Some",_op:"Some",[Zt](e){return Uk(e)&&Bk(e)&&kn(this.value,e.value)},[Xt](){return Xn(dt(this._tag))(dt(this.value))},toString(){return`some(${vt(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:wl(this.value)}},asEffect(){return at(this.value)}});Object.defineProperty(zk,"valueOrUndefined",{get(){return this.value}});const oM=dt("None"),iM=Object.assign(Object.create(Dk),{_tag:"None",_op:"None",valueOrUndefined:void 0,[Zt](e){return Uk(e)&&Vk(e)},[Xt](){return oM},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}},asEffect(){return yr(new tM)}}),Uk=e=>De(e,Ak),Vk=e=>e._tag==="None",Bk=e=>e._tag==="Some",aM=Object.create(iM),lM=e=>{const t=Object.create(zk);return t.value=e,t},qk="~effect/data/Result",Hk={[qk]:{_A:e=>e,_E:e=>e},...Ps,...xf},uM=Object.assign(Object.create(Hk),{_tag:"Success",_op:"Success",[Zt](e){return Wk(e)&&Kk(e)&&kn(this.success,e.success)},[Xt](){return Xn(dt(this._tag))(dt(this.success))},toString(){return`success(${vt(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:wl(this.success)}},asEffect(){return at(this.success)}}),cM=Object.assign(Object.create(Hk),{_tag:"Failure",_op:"Failure",[Zt](e){return Wk(e)&&Gk(e)&&kn(this.failure,e.failure)},[Xt](){return Xn(dt(this._tag))(dt(this.failure))},toString(){return`failure(${vt(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:wl(this.failure)}},asEffect(){return yr(this.failure)}}),Wk=e=>De(e,qk),Gk=e=>e._tag==="Failure",Kk=e=>e._tag==="Success",fM=e=>{const t=Object.create(cM);return t.failure=e,t},dM=e=>{const t=Object.create(uM);return t.success=e,t};function ym(e){return(t,n)=>t===n?0:e(t,n)}const hM=ym((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),gM=re(2,(e,t)=>ym((n,s)=>e(t(n),t(s)))),pM=e=>re(2,(t,n)=>e(t,n)===1),mM=e=>re(2,(t,n)=>t===n||e(t,n)<1?t:n),An=()=>aM,Me=lM,xo=Vk,ks=Bk,yM=re(2,(e,t)=>xo(e)?t():e.value),Qk=yM(df),xm=re(2,(e,t)=>xo(e)?An():Me(t(e.value))),xM=re(2,(e,t)=>xo(e)?An():t(e.value)?Me(e.value):An()),Dr=dM,Zn=fM,jt=Gk,vM=Kk,SM={[Symbol.iterator](){return wM}},wM={next(){return{done:!0,value:void 0}}},kM=()=>SM,CM=re(2,(e,t)=>Object.hasOwn(e,t)),bM=e=>Object.keys(e),_M=e=>re(2,(t,n)=>{for(const s of bM(t))if(!CM(n,s)||!e(t[s],n[s]))return!1;return!0}),RM=e=>{const t=_M(e);return(n,s)=>t(n,s)&&t(s,n)},wS=globalThis.Array,mr=e=>wS.isArray(e)?e:wS.from(e),Jk=re(2,(e,t)=>[...e,t]),EM=re(2,(e,t)=>mr(e).concat(mr(t))),kS=Rk,Fc=Rk;function PM(e,t){return e<0||e>=t.length}const IM=re(2,(e,t)=>{const n=Math.floor(t);if(PM(n,e))throw new Error(`Index out of bounds: ${n}`);return e[n]}),jM=IM(0),NM=e=>e.slice(1),MM=re(3,(e,t,n)=>{const s=mr(e),i=mr(t);return Fc(s)?Fc(i)?LM(n)(EM(s,i)):s:i}),TM=re(2,(e,t)=>MM(e,t,NN())),$M=()=>[],FM=re(2,(e,t)=>e.map(t)),LM=re(2,(e,t)=>{const n=mr(e);if(Fc(n)){const s=[jM(n)],i=NM(n);for(const a of i)s.every(u=>!t(a,u))&&s.push(a);return s}return[]}),CS="~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,OM),Object.defineProperty(s,"stack",{get(){return t.stack}}),arguments.length>0?(s.key=arguments[0],(i=arguments[1])!=null&&i.defaultValue&&(s[Lc]=Lc,s.defaultValue=arguments[1].defaultValue),s):function(a,u){return s.key=a,u!=null&&u.make&&(s.make=u.make),s}},OM={[CS]:CS,...Ps,...xf,toJSON(){return{_id:"Service",key:this.key,stack:this.stack}},asEffect(){return(this.asEffect=_s(Ve(t=>at(io(t.context,this)))))()},of(e){return e},context(e){return Si(this,e)},use(e){return Ve(t=>e(io(t.context,this)))},useSync(e){return Ve(t=>at(e(io(t.context,this))))}},Lc="~effect/Context/Reference",Yk="~effect/Context",ys=e=>{const t=Object.create(AM);return t.mapUnsafe=e,t.mutable=!1,t},AM={...Ps,[Yk]:{_Services:e=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[Zt](e){if(!Xk(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},[Xt](){return um(this.mapUnsafe.size)}},Xk=e=>De(e,Yk),Zk=e=>De(e,Lc),er=()=>DM,DM=ys(new Map),Si=(e,t)=>ys(new Map([[e.key,t]])),Is=re(3,(e,t,n)=>eC(e,s=>{s.set(t.key,n)})),zM=re(3,(e,t,n)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):Zk(t)?Cf(t):n()),kf=re(2,(e,t)=>{if(!e.mapUnsafe.has(t.key)){if(Lc in t)return Cf(t);throw VM(t)}return e.mapUnsafe.get(t.key)}),io=kf,UM=(e,t)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):Cf(t),dg="~effect/Context/defaultValue",Cf=e=>dg in e?e[dg]:e[dg]=e.defaultValue(),VM=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},BM=re(2,(e,t)=>e.mapUnsafe.has(t.key)?Me(e.mapUnsafe.get(t.key)):Zk(t)?Me(Cf(t)):An()),wi=re(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:eC(e,n=>{t.mapUnsafe.forEach((s,i)=>n.set(i,s))})),qM=(...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)},eC=(e,t)=>{if(e.mutable)return t(e.mapUnsafe),e;const n=new Map(e.mapUnsafe);return t(n),ys(n)},Xe=Un,Oc="~effect/time/Duration",HM=BigInt(0),tC=BigInt(1e3),WM=BigInt(1e6),GM=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,ki=e=>{switch(typeof e){case"number":return Ac(e);case"bigint":return RS(e);case"string":{const t=GM.exec(e);if(!t)break;const[n,s,i]=t,a=Number(s);switch(i){case"nano":case"nanos":return RS(BigInt(s));case"micro":case"micros":return XM(BigInt(s));case"milli":case"millis":return Ac(a);case"second":case"seconds":return ZM(a);case"minute":case"minutes":return eT(a);case"hour":case"hours":return tT(a);case"day":case"days":return nT(a);case"week":case"weeks":return rT(a)}break}case"object":{if(e===null)break;if(Oc in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(Ck)?bS(e):Number.isNaN(e[0])||Number.isNaN(e[1])?fi:e[0]===-1/0||e[1]===-1/0?rC:e[0]===1/0||e[1]===1/0?nC:Bt(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 Bt(n);let s=BigInt(n)*WM;return t.microseconds&&(s+=BigInt(t.microseconds)*tC),t.nanoseconds&&(s+=BigInt(t.nanoseconds)),Bt(s)}}return bS(e)},bS=e=>{throw new Error(`Invalid Input: ${e}`)},_S={_tag:"Millis",millis:0},KM={_tag:"Infinity"},QM={_tag:"NegativeInfinity"},JM={[Oc]:Oc,[Xt](){return cm(this.value)},[Zt](e){return YM(e)&&uT(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"}}},[ho](){return this.toJSON()},pipe(){return Ft(this,arguments)}},Bt=e=>{const t=Object.create(JM);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=_S: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?KM:QM:e===HM?t.value=_S:t.value={_tag:"Nanos",nanos:e},t},YM=e=>De(e,Oc),fi=Bt(0),nC=Bt(1/0),rC=Bt(-1/0),RS=e=>Bt(e),XM=e=>Bt(e*tC),Ac=e=>Bt(e),ZM=e=>Bt(e*1e3),eT=e=>Bt(e*6e4),tT=e=>Bt(e*36e5),nT=e=>Bt(e*864e5),rT=e=>Bt(e*6048e5),sC=e=>sT(e,{onMillis:_e,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),ES=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))}},sT=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)()}}),vm=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(ES(e),t.value.nanos):n.onNanos(e.value.nanos,ES(t))),oT=ym((e,t)=>vm(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})),iT=(e,t)=>vm(e,t,{onMillis:(n,s)=>n===s,onNanos:(n,s)=>n===s,onInfinity:(n,s)=>n.value._tag===s.value._tag}),aT=mM(oT),lT=re(2,(e,t)=>vm(e,t,{onMillis:(n,s)=>Bt(n+s),onNanos:(n,s)=>Bt(n+s),onInfinity:(n,s)=>{const i=n.value._tag,a=s.value._tag;return i==="Infinity"&&a==="NegativeInfinity"||i==="NegativeInfinity"&&a==="Infinity"?fi:i==="Infinity"||a==="Infinity"?nC:i==="NegativeInfinity"||a==="NegativeInfinity"?rC:fi}})),uT=re(2,(e,t)=>iT(e,t)),cT=e=>t=>!jt(e(t)),fT=e=>t=>t.has(e)?Dr(t):Zn(t),dT=re(2,(e,t)=>n=>{const s=e(n);return jt(s)?s:t(s.success)}),oC=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}),iC=Xe("effect/Scheduler",{defaultValue:()=>new lC}),aC="setImmediate"in globalThis?e=>{const t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{const t=setTimeout(e,0);return()=>clearTimeout(t)};class hT{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 lC{constructor(t="async",n=aC){L(this,"executionMode");L(this,"setImmediate");this.executionMode=t,this.setImmediate=n}shouldYield(t){return t.currentOpCount>=t.maxOpsBeforeYield}makeDispatcher(){return new gT(this.setImmediate)}}class gT{constructor(t=aC){L(this,"tasks",new hT);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 pT=Xe("effect/Scheduler/MaxOpsBeforeYield",{defaultValue:()=>2048}),mT=Xe("effect/Scheduler/PreventSchedulerYield",{defaultValue:()=>!1}),uC="effect/Tracer/ParentSpan";class yT extends Un()(uC){}const xT=e=>e,rp=Xe("effect/Tracer/DisablePropagation",{defaultValue:wk}),vT=Xe("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),ST=Xe("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),cC="effect/Tracer",wT=Xe(cC,{defaultValue:()=>xT({span:e=>new kT(e)})});class kT{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=Qk(t.parent))==null?void 0:n.traceId)??PS(32),this.spanId=PS(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 PS=(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}})(),CT="effect/observability/Metric/FiberRuntimeMetricsKey",bT=Xe("effect/References/CurrentConcurrency",{defaultValue:()=>"unbounded"}),fC=Xe("effect/References/CurrentStackFrame",{defaultValue:df}),_T=Xe("effect/References/TracerEnabled",{defaultValue:am}),dC=Xe("effect/References/TracerTimingEnabled",{defaultValue:am}),RT=Xe("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),ET=Xe("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),Sm=Xe("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),PT=Xe("effect/References/CurrentLogLevel",{defaultValue:()=>"Info"}),IT=Xe("effect/References/MinimumLogLevel",{defaultValue:()=>"Info"}),jT=Xe("effect/References/CurrentLogSpans",{defaultValue:()=>[]}),NT=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:TT(()=>n.stack)}},MT=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}},TT=MT(3),$T="dev";class hC extends dm{constructor(n,s=Sf){super("Interrupt",s,"Interrupted");L(this,"fiberId");this.fiberId=n}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[Zt](n){return gm(n)&&this.fiberId===n.fiberId&&this.annotations===n.annotations}[Xt](){return Xn(_t(`${this._tag}:${this.fiberId}`))(tp(this.annotations))}}const FT=e=>new hC(e),wm=e=>new yo([new hC(e)]),LT=e=>{const t=e.reasons.find(hm);return t?Dr(t):Zn(e)},vo=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)},OT=e=>e.reasons.some(gm),km=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)},AT=e=>{const t=km(e);return jt(t)?DT:t.success},DT=new Set,zT=e=>e.reasons.length>0&&e.reasons.every(gm),UT=re(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;const n=new yo(TM(e.reasons,t.reasons));return kn(e,n)?e:n}),VT=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},Cm=e=>{const t=VT(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")},BT=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(sp(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=GT(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(sp(a,n[0].annotations))}return Error.stackTraceLimit=s,t},sp=(e,t)=>{const n=typeof e;let s;if(e&&n==="object"){if(s=new globalThis.Error(qT(e),{cause:e.cause?sp(e.cause):void 0}),typeof e.name=="string"&&(s.name=e.name),typeof e.stack=="string")s.stack=WT(e.stack,s,t);else{const i=`${s.name}: ${s.message}`;s.stack=t?gC(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:Pk(e):`Unknown error: ${e}`);return s},qT=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 Pk(e)},HT=/\((.*)\)/g,WT=(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?gC(a.join(`
71
- `),n):a.join(`
72
- `)},gC=(e,t)=>{const n=t==null?void 0:t.get(wf.key);return n&&(e=`${e}
73
- ${pC(n)}`),e},GT=(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(ZN.key);n.push(` at fiber (${i})`),a&&n.push(pC(a))}return n.join(`
74
- `)},pC=e=>{const t=[];let n=e,s=0;for(;n&&s<10;){const i=n.stack();if(i){const a=i.matchAll(HT);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
- `)},mC=e=>BT(e).map(t=>t.cause?`${t.stack} {
76
- ${yC(t.cause," ")}
77
- }`:t.stack).join(`
78
- `),yC=(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
- ${yC(e.cause,`${t} `)}
82
- ${t}}`),s},op=`~effect/Fiber/${$T}`,KT={_A:_e,_E:_e},QT={id:0},bm=()=>globalThis[Ua];var t1;t1=op;class xC{constructor(t,n=!0){L(this,t1);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[op]=KT,this.setContext(t),this.id=++QT.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 UM(this.context,t)}addObserver(t){return this._exit?(t(this._exit),Sl):(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=wm(t);this.currentStackFrame&&(s=np(s,Si(wf,this.currentStackFrame))),n&&(s=np(s,n)),this._interruptedCause=this._interruptedCause?UT(this._interruptedCause,s):s,this.interruptible&&this.evaluate(Wt(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(Rm,()=>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(vi(u)):vi(`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[go]&&n[go](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 Ft(this,arguments)}setContext(t){this.context=t;const n=this.getRef(iC);n!==this.currentScheduler&&(this.currentScheduler=n,this._dispatcher=void 0),this.currentSpan=t.mapUnsafe.get(uC),this.currentLogLevel=this.getRef(PT),this.minimumLogLevel=this.getRef(IT),this.currentStackFrame=t.mapUnsafe.get(fC.key),this.maxOpsBeforeYield=this.getRef(pT),this.currentPreventYield=this.getRef(mT),this.runtimeMetrics=t.mapUnsafe.get(CT);const s=t.mapUnsafe.get(cC);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 bf=e=>{if(!e.currentStackFrame)return;const t=new Map;return t.set(wf.key,e.currentStackFrame),ys(t)},vC=e=>{const t=e;return t._exit?Re(t._exit):sr(n=>t._exit?n(Re(t._exit)):xt(e.addObserver(s=>n(Re(s)))))},SC=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(),xt(()=>i==null?void 0:i())}),_m=e=>Ve(t=>JT(e,t.id)),JT=re(e=>De(e[0],op),(e,t,n)=>Ve(s=>{let i=bf(s);return i=i&&n?wi(i,n):i??n,e.interruptUnsafe(t,i),RC(vC(e))})),Dc=e=>Ve(t=>{const n=bf(t);for(const s of e)s.interruptUnsafe(t.id,n);return RC(SC(e))}),Re=at,Wt=On,_f=yr,xt=rr({op:"Sync",[It](e){const t=this[Ie](),n=e.getCont(Cn);return n?n[Cn](t,e):e.yieldWith(at(t))}}),St=rr({op:"Suspend",[It](e){return this[Ie]()}}),YT=rr({op:"Yield",[It](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(Dn)},this[Ie]??0),e.yieldWith(()=>{t=!0})}}),Rm=YT(0),XT=e=>Re(Me(e)),ZT=Re(An()),Rf=e=>vi(e),wC=e=>St(()=>_f(Yt(e))),it=Re(void 0),e$=e=>kC(function(t,n){Yt(()=>e(n)).then(s=>t(Re(s)),s=>t(Rf(s)))},e.length!==0),t$=e=>Ve(t=>e(t.id)),kC=rr({op:"Async",single:!1,[It](e){const t=Yt(()=>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(n$(()=>(n=!0,i==null||i.abort(),a??Dn))),Js)}}),n$=rr({op:"AsyncFinalizer",[go](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Mf))},[gr](e,t){return OT(e)?Le(this[Ie](),()=>Wt(e)):Wt(e)}}),sr=e=>kC(e,e.length>=2),r$=sr(Sl),s$=(...e)=>St(()=>ul(e.length===1?e[0]():e[1].call(e[0].self))),CC=(e,...t)=>{const n=t.length===0?function(){return St(()=>ul(e.apply(this,arguments)))}:function(){let s=St(()=>ul(e.apply(this,arguments)));for(let i=0;i<t.length;i++)s=t[i](s,...arguments);return s};return bC(e.length,n)},bC=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),o$=(e,...t)=>bC(e.length,t.length===0?function(){return IS(()=>e.apply(this,arguments))}:function(){let n=IS(()=>e.apply(this,arguments));for(const s of t)n=s(n);return n}),IS=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=>ul(t,d))):St(()=>ul(e())))}}}}catch(t){return Rf(t)}},ul=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)}),Cl=re(2,(e,t)=>Le(e,n=>Ht(t)?t:Yt(()=>t(n)))),_C=re(2,(e,t)=>Le(e,n=>ji(Ht(t)?t:Yt(()=>t(n)),n))),RC=e=>Le(e,t=>Dn),i$=(e,t)=>Ve(n=>sr(s=>{let i=!1;const a=new Set,u=d=>{i=!0,s(a.size===0?d:Le(OC(Dc(a)),()=>d))};let f=0;for(const d of e){if(i)break;const h=f++,m=$f(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)})),EC=re(e=>Ht(e[1]),(e,t,n)=>i$([e,t],n)),Le=re(2,(e,t)=>{const n=Object.create(a$);return n[Ie]=e,n[Cn]=t.length!==1?s=>t(s):t,n}),a$=kl({op:"OnSuccess",[It](e){return e._stack.push(this),this[Ie]}}),bn=e=>il in e,l$=re(2,(e,t)=>bn(e)?e._tag==="Success"?t(e.value):e:Le(e,t)),u$=e=>Le(e,_e),pt=re(2,(e,t)=>Le(e,n=>Re(Yt(()=>t(n))))),c$=re(2,(e,t)=>bn(e)?y$(e,t):pt(e,t)),f$=re(2,(e,t)=>bn(e)?x$(e,t):M$(e,t)),d$=re(2,(e,t)=>bn(e)?v$(e,t):T$(e,t)),h$=re(2,(e,t)=>{if(bn(e)){if(e._tag==="Success")return e;const n=vo(e.cause);return jt(n)?e:t(n.success)}return Pf(e,t)}),g$=e=>On(wm(e)),Em=e=>e._tag==="Success",p$=e=>e._tag==="Failure",m$=e=>e._tag==="Failure"?Dr(e.cause):Zn(e),Dn=at(void 0),y$=re(2,(e,t)=>e._tag==="Success"?at(t(e.value)):e),x$=re(2,(e,t)=>{if(e._tag==="Success")return e;const n=vo(e.cause);return jt(n)?e:yr(t(n.success))}),v$=re(2,(e,t)=>{if(e._tag==="Success")return at(t.onSuccess(e.value));const n=vo(e.cause);return jt(n)?e:yr(t.onFailure(n.success))}),S$=re(2,(e,t)=>Em(e)?t:e),w$=e=>{const t=[];for(const n of e)n._tag==="Failure"&&t.push(...n.cause.reasons);return t.length===0?Dn:On(al(t))},k$=e=>Em(e)?Me(e.value):An(),C$=e=>Ve(t=>Re(BM(t.context,e))),Ef=re(2,(e,t)=>Ve(n=>{const s=n.context,i=t(s);return s===i?e:(n.setContext(i),LC(e,()=>{n.setContext(s)}))})),PC=re(3,(e,t,n)=>Ef(e,s=>{const i=kf(s,t),a=n(i);return i===a?s:Is(s,t,a)})),b$=()=>_$,_$=Ve(e=>Re(e.context)),IC=e=>Ve(t=>e(t.context)),bl=re(2,(e,t)=>bn(e)?e:Ef(e,wi(t))),_l=function(){return arguments.length===1?re(2,(e,t)=>jS(e,arguments[0],t)):re(3,(e,t,n)=>jS(e,t,n)).apply(this,arguments)},jS=(e,t,n)=>Ef(e,s=>s.mapUnsafe.get(t.key)===n?s:Is(s,t,n)),R$=re(e=>Ht(e[1]),(e,t,n)=>E$(e,t,(s,i)=>[s,i],n)),E$=re(e=>Ht(e[1]),(e,t,n,s)=>s!=null&&s.concurrent?pt(tF([e,t],{concurrency:2}),([i,a])=>Yt(()=>n(i,a))):Le(e,i=>pt(t,a=>Yt(()=>n(i,a))))),P$=re(e=>Ht(e[0]),(e,t)=>Nm({while:am,body:_s(t!=null&&t.disableYield?e:Le(e,n=>Rm)),step:Sl})),Rl=re(2,(e,t)=>{const n=Object.create(I$);return n[Ie]=e,n[gr]=t.length!==1?s=>t(s):t,n}),I$=kl({op:"OnFailure",[It](e){return e._stack.push(this),this[Ie]}}),jC=re(3,(e,t,n)=>Rl(e,s=>{const i=t(s);return jt(i)?Wt(i.failure):Yt(()=>n(i.success,s))})),Pf=re(2,(e,t)=>jC(e,vo,n=>t(n))),j$=re(2,(e,t)=>Rl(e,n=>Cl(Yt(()=>t(n)),Wt(n)))),N$=re(e=>Ht(e[0]),(e,t,n,s)=>Rl(e,i=>{const a=vo(i);if(jt(a))return Wt(a.failure);const u=t(a.success);return jt(u)?s?Yt(()=>s(u.failure)):Wt(i):Yt(()=>n(u.success))})),M$=re(2,(e,t)=>Pf(e,n=>wC(()=>t(n)))),T$=re(2,(e,t)=>Pm(e,{onFailure:n=>wC(()=>t.onFailure(n)),onSuccess:n=>xt(()=>t.onSuccess(n))})),$$=e=>Pf(e,Rf),F$=re(e=>Ht(e[0]),(e,t)=>{if(!(t!=null&&t.log))return Pm(e,{onFailure:s=>it,onSuccess:s=>it});const n=YC(t.log===!0?void 0:t.log);return If(e,{onFailure(s){const i=LT(s);return jt(i)?Wt(i.failure):t.message===void 0?n(s):n(t.message,s)},onSuccess:s=>it})}),hg=e=>A$(e,{onFailure:Zn,onSuccess:Dr}),If=re(2,(e,t)=>{const n=Object.create(L$);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}),L$=kl({op:"OnSuccessAndFailure",[It](e){return e._stack.push(this),this[Ie]}}),Pm=re(2,(e,t)=>If(e,{onFailure:n=>{const s=n.reasons.find(hm);return s?Yt(()=>t.onFailure(s.error)):Wt(n)},onSuccess:t.onSuccess})),O$=re(2,(e,t)=>Pm(e,{onFailure:n=>xt(()=>t.onFailure(n)),onSuccess:n=>xt(()=>t.onSuccess(n))})),A$=re(2,(e,t)=>{if(bn(e)){if(e._tag==="Success")return at(t.onSuccess(e.value));const n=vo(e.cause);return jt(n)?e:at(t.onFailure(n.success))}return O$(e,t)}),jf=e=>bn(e)?at(e):D$(e),D$=rr({op:"Exit",[It](e){return e._stack.push(this),this[Ie]},[Cn](e,t,n){return Re(n??at(e))},[gr](e,t,n){return Re(n??On(e))}}),z$=re(2,(e,t)=>Cl($m(t),e)),NC=re(2,(e,t)=>EC(e,Le($m(t.duration),t.orElse))),U$=re(2,(e,t)=>NC(e,{duration:t,orElse:()=>_f(new bF)})),NS="~effect/Scope",MS="~effect/Scope/Closeable",Nf=Un("effect/Scope"),MC=(e,t)=>St(()=>TC(e,t)??it),TC=(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):V$(e,s,t)},V$=CC(function*(e,t,n){let s=[];const i=[],a=Array.from(t.values()),u=bm();for(let f=a.length-1;f>=0;f--){const d=a[f];e.strategy==="sequential"?s.push(yield*jf(d(n))):i.push($f(u,d(n),!0,!0,"inherit"))}return i.length>0&&(s=yield*SC(i)),yield*w$(s)}),B$=(e,t)=>{const n=jm(t);if(e.state._tag==="Closed")return n.state=e.state,n;const s={};return cl(e,s,i=>MC(n,i)),cl(n,s,i=>xt(()=>Im(e,s))),n},Ci=(e,t)=>St(()=>e.state._tag==="Closed"?t(e.state.exit):(cl(e,{},t),it)),q$=(e,t)=>Ci(e,_s(t)),cl=(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)},Im=(e,t)=>{e.state._tag==="Open"&&e.state.finalizers.delete(t)},jm=(e="sequential")=>({[MS]:MS,[NS]:NS,strategy:e,state:H$}),H$={_tag:"Empty"},$C=Nf.asEffect(),W$=_l(Nf),FC=e=>St(()=>{const t=jm();return js(e(t),n=>St(()=>TC(t,n)??it))}),G$=(e,t,n)=>IC(s=>zC(i=>Le($C,a=>_C(n!=null&&n.interruptible?i(e):e,u=>Ci(a,f=>bl(t(u,f),s)))))),LC=rr({op:"OnExit",single:!1,[It](e){return e._stack.push(this),this[Ie][0]},[go](e){e.interruptible&&this[Ie][2]!==!0&&(e._stack.push(Mf),e.interruptible=!1)},[Cn](e,t,n){n??(n=at(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,LC),K$=re(2,(e,t)=>js(e,n=>t)),Q$=re(3,(e,t,n)=>js(e,s=>{const i=t(s);return jt(i)?it:n(i.success,s)})),J$=re(2,(e,t)=>Q$(e,m$,t)),Y$=re(3,(e,t,n)=>js(e,s=>{if(s._tag!=="Failure")return it;const i=t(s.cause);return jt(i)?it:n(i.success,s.cause)})),X$=re(2,(e,t)=>Y$(km,t)(e)),Z$=Ve(e=>Wt(wm(e.id))),OC=e=>Ve(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(Mf)),e)),AC=rr({op:"SetInterruptible",[go](e){if(e.interruptible=this[Ie],e._interruptedCause&&e.interruptible)return()=>Wt(e._interruptedCause)}}),Mf=AC(!0),eF=AC(!1),DC=e=>Ve(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(eF),t._interruptedCause?Wt(t._interruptedCause):e)),zC=e=>Ve(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Mf),e(DC)):e(_e)),tF=(e,t)=>pN(e)?(t==null?void 0:t.mode)==="result"?Ys(e,hg,t):Ys(e,_e,t):t!=null&&t.discard?t.mode==="result"?Ys(Object.values(e),hg,t):Ys(Object.values(e),_e,t):St(()=>{const n={};return ji(Ys(Object.entries(e),([s,i])=>pt((t==null?void 0:t.mode)==="result"?hg(i):i,a=>{n[s]=a}),{discard:!0,concurrency:t==null?void 0:t.concurrency}),n)}),Nm=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(bT):(n==null?void 0:n.concurrency)??1,a=i==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,i);if(a===1)return nF(e,t,n);const u=mr(e);let f=u.length;if(f===0)return n!=null&&n.discard?it:Re([]);const d=n!=null&&n.discard?void 0:new Array(f),h=rF({f:t,out:d},u,{concurrency:a});return h?ji(h,d):Re(d)})),nF=(e,t,n)=>St(()=>{const s=n!=null&&n.discard?void 0:[],i=e[Symbol.iterator]();let a=i.next(),u=0;return ji(Nm({while:()=>!a.done,body:()=>t(a.value,u++),step:f=>{s&&s.push(f),a=i.next()}}),s)}),UC=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,C;const b=()=>{let _=!1;for(;!w&&u<f;u++){const E=i[u],j=C??t(s,E,u);if(bn(j)){if(w=n(s,E,j,u),w)break}else{if(d===1)return Le(jf(j),R=>(w=n(s,E,R,u),u++,w??b()??it));if(m){C=void 0;const R=$f(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 F=u;if(R.addObserver(A=>{if(p.delete(R),w){if(!v&&A._tag==="Failure")for(const T of A.cause.reasons)T._tag!=="Interrupt"&&(w._tag==="Failure"?w.cause.reasons.push(T):w=On(al([T])))}else{const T=n(s,E,A,F);T&&(w=T._tag==="Failure"?On(al(T.cause.reasons.slice())):T,b())}if(_){const T=b();T&&x(T)}else h&&p.size===0&&x(w??it)}),p.size<d)continue;_=!0,u++;return}else return sr(R=>{m=bm(),C=j,x=R;const F=b();return F?R(F):St(()=>(w=Dn,v=!0,p?Dc(p):it))})}}if(h=!0,w){if(p&&p.size>0){const E=bf(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(it);else return Dn};return b()}},Tf=()=>UC,rF=UC({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)}}),$f=(e,t,n=!1,s=!1,i=!1)=>{const a=i==="inherit"?e.interruptible:!i,u=new xC(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},VC=re(e=>Ht(e[0]),(e,t,n)=>Ve(s=>{const i=$f(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={};cl(t,a,()=>t$(f=>f===i.id?it:_m(i))),i.addObserver(()=>Im(t,a))}else i.interruptUnsafe(s.id,bf(s));return Re(i)})),sF=re(e=>Ht(e[0]),(e,t)=>Le($C,n=>VC(e,n,t))),El=e=>(t,n)=>{const s=new xC(n!=null&&n.scheduler?Is(e,iC,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},oF=re(2,(e,t)=>{if(e._exit)return e;if(t.state._tag==="Closed")return e.interruptUnsafe(e.id),e;const n={};return cl(t,n,()=>_m(e)),e.addObserver(()=>Im(t,n)),e}),iF=El(er()),BC=e=>{const t=El(e);return(n,s)=>{const i=t(n,s);return s!=null&&s.onExit&&i.addObserver(s.onExit),a=>i.interruptUnsafe(a)}},aF=BC(er()),Mm=e=>{const t=El(e);return(n,s)=>{const i=t(n,s);return new Promise(a=>{i.addObserver(u=>a(u))})}},lF=Mm(er()),qC=e=>{const t=Mm(e);return(n,s)=>t(n,s).then(i=>{if(i._tag==="Failure")throw Cm(i.cause);return i.value})},uF=qC(er()),Tm=e=>{const t=El(e);return n=>{var a;if(bn(n))return n;const s=new lC("sync"),i=t(n,{scheduler:s});return(a=i.currentDispatcher)==null||a.flush(),i._exit??vi(new _F(i))}},cF=Tm(er()),HC=e=>{const t=Tm(e);return n=>{const s=t(n);if(s._tag==="Failure")throw Cm(s.cause);return s.value}},fF=HC(er()),TS=Re(!0),$S=Re(!1);class dF{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?$S:(this.isOpen=!0,this.scheduleUnsafe(t))));L(this,"release",Ve(t=>this.isOpen?$S:this.scheduleUnsafe(t)));L(this,"await",sr(t=>this.isOpen?t(it):(this.waiters.push(t),xt(()=>{const n=this.waiters.indexOf(t);n!==-1&&this.waiters.splice(n,1)}))));L(this,"close",xt(()=>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)),TS}openUnsafe(){return this.isOpen?!1:(this.isOpen=!0,this.flushWaiters(),!0)}closeUnsafe(){return this.isOpen?(this.isOpen=!1,!0):!1}}const hF=e=>new dF(e??!1),ip=BigInt(0),gF={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:ip,endTime:ip,exit:Dn},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},pF=e=>Object.assign(Object.create(gF),e),WC=e=>e?io(e.annotations,rp)?e._tag==="Span"?WC(Qk(e.parent)):An():Me(e):An(),GC=(e,t,n)=>{const s=!e.getRef(_T)||(n==null?void 0:n.annotations)&&io(n.annotations,rp),i=(n==null?void 0:n.parent)!==void 0?Me(n.parent):n!=null&&n.root?An():WC(e.currentSpan);let a;if(s)a=pF({name:t,parent:i,annotations:Is((n==null?void 0:n.annotations)??er(),rp,!0)});else{const u=e.getRef(wT),f=e.getRef(Ni),d=e.getRef(dC),h=e.getRef(RT),m=e.getRef(ET),p=(n==null?void 0:n.level)??e.getRef(vT),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)??xo(i),sampled:(n==null?void 0:n.sampled)??(ks(i)&&i.value.sampled===!1?!1:!QC(e.getRef(ST),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},mF=(e,t)=>OC(Ve(n=>{const s=kf(n.context,Nf),i=GC(n,e,t??{}),a=n.getRef(Ni),u=n.getRef(dC);return ji(Ci(s,f=>xF(i,f,a,u)),i)})),yF=(e,t)=>(t=typeof t=="function"?t:df,PC(fC,n=>({name:e,stack:t,parent:n}))),xF=(e,t,n,s)=>xt(()=>{e.status._tag!=="Ended"&&e.end(s?n.currentTimeNanosUnsafe():ip,t)}),vF=(e,...t)=>{const n=t.length===1?void 0:t[0],s=t[t.length-1];return Ve(i=>{const a=GC(i,e,n),u=i.getRef(Ni);return js(Yt(()=>s(a)),f=>xt(()=>{a.status._tag!=="Ended"&&a.end(u.currentTimeNanosUnsafe(),f)}))})},FS=_l(yT),SF=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=NT(n),s=yF(t.name,n==null?void 0:n.captureStackTrace)),e?FS(s(arguments[0]),t):i=>FS(s(i),t)},Ni=Xe("effect/Clock",{defaultValue:()=>new kF}),wF=2**31-1;class kF{constructor(){L(this,"currentTimeMillis",xt(()=>this.currentTimeMillisUnsafe()));L(this,"currentTimeNanos",xt(()=>this.currentTimeNanosUnsafe()))}currentTimeMillisUnsafe(){return Date.now()}currentTimeNanosUnsafe(){return CF()}sleep(t){const n=sC(t);return n<=0?Rm:sr(s=>{if(n>wF)return;const i=setTimeout(()=>s(it),n);return xt(()=>clearTimeout(i))})}}const LS=(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))})(),CF=(function(){const e=typeof process=="object"&&"hrtime"in process&&typeof process.hrtime.bigint=="function"?process.hrtime:void 0;if(!e)return LS;const t=LS()-e.bigint();return()=>t+e.bigint()})(),KC=e=>Ve(t=>e(t.getRef(Ni))),$m=e=>KC(t=>t.sleep(ki(e))),OS="~effect/Cause/TimeoutError";var n1,r1;class bF extends(r1=pm("TimeoutError"),n1=OS,r1){constructor(n){super({message:n});L(this,n1,OS)}}const AS="~effect/Cause/AsyncFiberError";var s1,o1;class _F extends(o1=pm("AsyncFiberError"),s1=AS,o1){constructor(n){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:n});L(this,s1,AS)}}const RF=Xe("effect/Console/CurrentConsole",{defaultValue:()=>globalThis.console}),EF=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}},PF=gM(hM,EF),QC=pM(PF),IF=Xe("effect/Loggers/CurrentLoggers",{defaultValue:()=>new Set([OF,AF])}),jF=Xe("effect/Logger/LogToStderr",{defaultValue:wk}),NF="~effect/Logger",MF={[NF]:{_Message:_e,_Output:_e},pipe(){return Ft(this,arguments)}},JC=e=>{const t=Object.create(MF);return t.log=e,t},TF=e=>e.replace(/[\s="]/g,"_"),$F=(e,t)=>`${TF(e[0])}=${t-e[1]}ms`,YC=e=>(...t)=>{let n;for(let s=0,i=t.length;s<i;s++){const a=t[s];vf(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=QN),Ve(s=>{const i=e??s.currentLogLevel;if(QC(s.minimumLogLevel,i))return it;const a=s.getRef(Ni),u=s.getRef(IF);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 it})},FF=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")}`,LF=typeof process=="object"&&process!==null&&typeof process.stdout=="object"&&process.stdout!==null;LF&&process.stdout.isTTY;const OF=JC(({cause:e,date:t,fiber:n,logLevel:s,message:i})=>{const a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(mC(e));const u=t.getTime(),f=n.getRef(jT);let d="";for(const x of f)d+=` ${$F(x,u)}`;const h=n.getRef(Sm);Object.keys(h).length>0&&a.push(h);const m=n.getRef(RF);(n.getRef(jF)?m.error:m.log)(`[${FF(t)}] ${s.toUpperCase()} (#${n.id})${d}:`,...a)}),AF=JC(({cause:e,fiber:t,logLevel:n,message:s})=>{const i=t.getRef(Ni),a=t.getRef(Sm),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"]=mC(e)),u.event(UN(Array.isArray(s)&&s.length===1?s[0]:s),i.currentTimeNanosUnsafe(),f)}),DF=vf,zF=KN,ap=al,lp=e=>new Mk(e),up=e=>new $k(e),cp=FT,UF=zT,XC=Cm,Pl=vo,VF=AT,BF=km,Fm=nM,Ff=sM,qF=Nk,gg=at,Va=On,Il=yr,HF=vi,WF=g$,ZC=Dn,GF=Em,eb=p$,KF=k$,QF="~effect/Deferred",JF={[QF]:{_A:_e,_E:_e},pipe(){return Ft(this,arguments)}},Lm=()=>{const e=Object.create(JF);return e.resumes=void 0,e.effect=void 0,e},Om=e=>sr(t=>e.effect?t(e.effect):(e.resumes??(e.resumes=[]),e.resumes.push(t),xt(()=>{const n=e.resumes.indexOf(t);e.resumes.splice(n,1)}))),YF=re(2,(e,t)=>xt(()=>Ba(e,t))),tb=YF,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},XF=re(2,(e,t)=>zC(n=>Le(jf(n(e)),s=>tb(t,s)))),ZF=Sm,DS=Nf,Am=jm,zc=W$,eL=Ci,tL=q$,Uc=B$,Lf=MC,nL="~effect/Layer",zS="~effect/Layer/MemoMap",rL={[nL]:{_ROut:_e,_E:_e,_RIn:_e},pipe(){return Ft(this,arguments)}},nb=e=>{const t=Object.create(rL);return t.build=e,t},Dm=e=>nb((t,n)=>{const s=Uc(n);return js(e(t,s),i=>i._tag==="Failure"?Lf(s,i):it)}),sL=e=>{const t=Dm((n,s)=>n.getOrElseMemoize(t,s,e));return t};class oL{constructor(){L(this,"map",new Map)}get[zS](){return zS}getOrElseMemoize(t,n,s){if(this.map.has(t)){const f=this.map.get(t);return f.observers++,Cl(Ci(n,d=>f.finalizer(d)),f.effect)}const i=Am(),a=Lm(),u={observers:1,effect:Om(a),finalizer:f=>St(()=>(u.observers--,u.observers===0?(this.map.delete(t),Lf(i,f)):it))};return this.map.set(t,u),Ci(n,u.finalizer).pipe(Le(()=>s(this,i)),js(f=>(u.effect=f,tb(a,f))))}}const zm=()=>new oL,sf=class sf extends Un()("effect/Layer/CurrentMemoMap"){};L(sf,"getOrCreate",zM(sf,zm));let fl=sf;const Um=re(3,(e,t,n)=>_l(pt(e.build(t,n),Is(fl,t)),fl,t)),iL=re(2,(e,t)=>Ve(n=>Um(e,fl.getOrCreate(n.context),t))),Vm=function(){return arguments.length===1?e=>US(Si(arguments[0],e)):US(Si(arguments[0],arguments[1]))},US=e=>nb(_s(Re(e))),fp=function(){return arguments.length===1?e=>VS(arguments[0],e):VS(arguments[0],arguments[1])},VS=(e,t)=>dp(pt(t,n=>Si(e,n))),dp=e=>sL((t,n)=>zc(e,n)),rb=(e,t,n)=>{const s=Uc(n,"parallel");return Ys(e,i=>i.build(t,Uc(s,"sequential")),{concurrency:e.length}).pipe(pt(i=>qM(...i)))},sb=(...e)=>Dm((t,n)=>rb(e,t,n)),aL=(e,t,n)=>Dm((s,i)=>Le(Array.isArray(t)?rb(t,s,i):t.build(s,i),a=>e.build(s,i).pipe(bl(a),pt(u=>n(u,a))))),hp=re(2,(e,t)=>aL(e,t,_e)),lL=class extends ff{constructor(t){super(),t&&Object.assign(this,t)}},Vc=re(2,(e,t)=>jC(e,fL,n=>t(n))),BS=e=>e.reasons.some(uL),uL=e=>e._tag==="Fail"&&Fm(e.error),cL=oC(Pl,e=>Fm(e)?Dr(e):Zn(e)),fL=oC(Pl,e=>Fm(e)?Dr(e.value):Zn(e)),ob=re(2,(e,t)=>If(e,{onSuccess:t.onSuccess,onFailure:n=>{const s=cL(n);return jt(s)?t.onFailure(s.failure):t.onDone(s.success.value)}})),ib="~effect/Schedule",qS=Xe("effect/Schedule/CurrentMetadata",{defaultValue:_s({input:void 0,output:void 0,duration:fi,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),dL={[ib]:{_Out:_e,_In:_e,_Env:_e},pipe(){return Ft(this,arguments)}},hL=e=>De(e,ib),jl=e=>{const t=Object.create(dL);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}}},ab=e=>jl(pt(e,t=>{const n=Bm();return(s,i)=>t(n(s,i))})),bi=e=>Rl(e.step,t=>Re(()=>Wt(t))),gL=e=>KC(t=>pt(bi(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($m(f),d)})})})),pL=re(2,(e,t)=>vL(e,(n,s)=>pt(t(n),i=>lT(ki(i),ki(s))))),mL=re(2,(e,t)=>yL(e,t,(n,s)=>[n,s])),yL=re(3,(e,t,n)=>jl(pt(R$(bi(e),bi(t)),([s,i])=>(a,u)=>ob(s(a,u),{onSuccess:f=>i(a,u).pipe(pt(d=>[n(f[0],d[0]),aT(f[1],d[1])]),Vc(d=>Re([n(f[0],d),f[1]]))),onFailure:Wt,onDone:f=>i(a,u).pipe(pt(d=>[n(f,d[0]),d[1]]),Vc(d=>Ff(n(f,d))))})))),xL=(e,t=2)=>{const n=sC(ki(e));return ab(Re(s=>{const i=Ac(n*Math.pow(t,s.attempt-1));return Re([i,i])}))},vL=re(2,(e,t)=>jl(pt(bi(e),n=>(s,i)=>Le(n(s,i),([a,u])=>pt(t(a,u),f=>[a,ki(f)]))))),lb=e=>jl(pt(bi(e),t=>(n,s)=>ob(t(n,s),{onSuccess:i=>Re([s,i[1]]),onFailure:Wt,onDone:()=>Ff(s)}))),SL=e=>vc(cb,({attempt:t})=>Re(t<=e)),ub=e=>{const t=ki(e);return ab(Re(n=>Re([n.attempt-1,t])))},vc=re(2,(e,t)=>jl(pt(bi(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):Ff(f))})}))),cb=ub(fi),wL=(e,t,n)=>FC(s=>Le(n!=null&&n.local?Um(t,zm(),s):iL(t,s),i=>bl(e,i))),kL=re(e=>Ht(e[0]),(e,t,n)=>Xk(t)?bl(e,t):wL(e,Array.isArray(t)?sb(...t):t,n)),CL=re(3,(e,t,n)=>Le(gL(t),s=>{let i=qS.defaultValue(),a;const u=Pf(St(()=>_l(e,qS,i)),f=>(a=f,Le(s(f),d=>(i=d,u))));return Vc(u,f=>Yt(()=>n(a,f)))})),bL=re(2,(e,t)=>{const n=typeof t=="function"?t(_e):hL(t)?t:RL(t);return CL(e,n,_f)}),_L=lb(cb),RL=e=>{let t=e.schedule?lb(e.schedule):_L;return e.while&&(t=vc(t,({input:n})=>{const s=e.while(n);return Ht(s)?s:Re(s)})),e.until&&(t=vc(t,({input:n})=>{const s=e.until(n);return Ht(s)?pt(s,i=>!i):Re(!s)})),e.times!==void 0&&(t=vc(t,({attempt:n})=>Re(n<=e.times))),t},di=Ht,fb=Ys,db=Nm,EL=e$,nt=Re,qm=ZT,PL=XT,Ar=St,Ln=xt,st=it,HS=sr,IL=r$,gp=s$,Ke=_f,jL=Wt,NL=Rf,Bc=Ve,zn=Le,ML=u$,TL=Cl,$L=_C,WS=jf,So=pt,dl=Rl,FL=N$,Sc=$$,LL=j$,OL=bL,AL=F$,DL=U$,zL=NC,UL=z$,hb=EC,VL=If,qc=b$,gb=IC,BL=kL,ao=bl,qL=C$,HL=Ef,WL=_l,GL=FC,pb=G$,mb=K$,KL=J$,yb=js,pp=Z$,Hm=DC,QL=X$,xb=P$,JL=mF,YL=vF,GS=SF,XL=VC,Wm=sF,mp=iF,Hc=El,ZL=BC,eO=aF,qa=uF,tO=qC,nO=lF,rO=Mm,Gm=fF,sO=HC,vb=cF,oO=Tm,lo=CC,iO=YC("Error"),aO=re(e=>di(e[0]),(e,...t)=>PC(e,ZF,n=>{const s={...n};return t.length===1?Object.assign(s,t[0]):s[t[0]]=t[1],s})),Sb=c$,wo=f$,hl=d$,li=l$,lO=h$,yp=o$;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 wb(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function uO(e){return t=>{var n;return(n=wb(t))==null?void 0:n[e]}}const cO=uO("identifier"),Km=Rs(e=>{const t=cO(e);return typeof t=="string"?t:e.getExpected(Km)}),fO=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&"),wc=new WeakMap,kb="~effect/data/Redacted",dO=e=>De(e,kb),KS=(e,t)=>{const n=Object.create(hO);return wc.set(n,e),n},hO={[kb]:{_A:e=>e},label:void 0,...Ps,toJSON(){return this.toString()},toString(){return`<redacted${lm(this.label)?":"+this.label:""}>`},[Xt](){return dt(wc.get(this))},[Zt](e){return dO(e)&&kn(wc.get(this),wc.get(e))}},xp="~effect/SchemaIssue/Issue";function gO(e){return De(e,xp)}var i1;let xr=(i1=xp,class{constructor(){L(this,i1,xp)}toString(){return CO(this)}}),pO=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 mO 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 Cb extends xr{constructor(n){super();L(this,"_tag","MissingKey");L(this,"annotations");this.annotations=n}}class bb 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 Wc extends xr{constructor(n,s){super();L(this,"_tag","InvalidValue");L(this,"actual");L(this,"annotations");this.actual=n,this.annotations=s}}class QS 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 yO 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 vp(e,t){if(gO(t))return t;if(typeof t=="string")return new Wc(Me(e),{message:t});const n=typeof t.issue=="string"?new Wc(Me(e),{message:t.issue}):t.issue;return new tr(t.path,n)}function xO(e,t){if(t!==void 0)return typeof t=="boolean"?t?void 0:new Wc(Me(e)):vp(e,t)}function vO(e,t,n){return Array.isArray(n)?Fc(n)?n.length===1?vp(e,n[0]):new qt(t,Me(e),FM(n,s=>vp(e,s))):void 0:xO(e,n)}const SO=e=>{const t=gl(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return Sp(Km(e.ast),JS(e.actual));case"InvalidValue":return`Invalid data ${JS(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)}`}},wO=e=>gl(e.issue)??gl(e);function Sp(e,t){return`Expected ${e}, got ${t}`}function ai(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:Sp(_b(e.filter),vt(e.actual))}];default:return ai(e.issue,t,n,s)}}case"Encoding":return ai(e.issue,t,n,s);case"Pointer":return ai(e.issue,[...t,...e.path],n,s);case"Composite":return e.issues.flatMap(i=>ai(i,t,n,s));case"AnyOf":{const i=gl(e);if(e.issues.length===0){if(i!==void 0)return[{path:t,message:i}];const a=Sp(Km(e.ast),vt(e.actual));return[{path:t,message:a}]}return e.issues.flatMap(a=>ai(a,t,n,s))}default:return[{path:t,message:n(e)}]}}function _b(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=>_b(s)).join(" & ")}}function kO(){return e=>ai(e,[],SO,wO).map(bO).join(`
83
- `)}const CO=kO();function bO(e){let t=e.message;if(e.path&&e.path.length>0){const n=AN(e.path);t+=`
84
- at ${n}`}return t}function gl(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 gl(e.issue)}}function Ea(e,t="message"){const n=e==null?void 0:e[t];if(typeof n=="string")return n}function JS(e){return xo(e)?"no value provided":vt(e.value)}class _i extends ff{constructor(n){super();L(this,"run");this.run=n}map(n){return new _i((s,i)=>this.run(s,i).pipe(Sb(xm(n))))}compose(n){return YS(this)?n:YS(n)?this:new _i((s,i)=>this.run(s,i).pipe(li(a=>n.run(a,i))))}}const Rb=new _i(nt);function YS(e){return e.run===Rb.run}function Ri(){return Rb}function un(e){return _O(xm(e))}function _O(e){return new _i(t=>nt(e(t)))}function RO(e){return new _i(t=>{const n=xM(t,fN);return ks(n)?nt(n):So(e,Me)})}function EO(){return un(globalThis.String)}function Eb(){return un(globalThis.Number)}const wp="~effect/SchemaTransformation/Transformation";var a1;a1=wp;const of=class of{constructor(t,n){L(this,a1,wp);L(this,"_tag","Transformation");L(this,"decode");L(this,"encode");this.decode=t,this.encode=n}flip(){return new of(this.encode,this.decode)}compose(t){return new of(this.decode.compose(t.decode),t.encode.compose(this.encode))}};let _n=of;function PO(e){return De(e,wp)}const Pb=e=>PO(e)?e:new _n(e.decode,e.encode);function Of(e){return new _n(un(e.decode),un(e.encode))}const IO=new _n(Ri(),Ri());function Qm(){return IO}const Ib=new _n(Eb(),EO()),jb=e=>Of({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 ko(e){return t=>t._tag===e}const Nb=ko("Declaration"),jO=ko("Never"),Gc=ko("Literal"),NO=ko("UniqueSymbol"),MO=ko("Arrays"),TO=ko("Objects"),$O=ko("Union");class Nt{constructor(t,n){L(this,"to");L(this,"transformation");this.to=t,this.transformation=n}}const FO={};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 XS="~effect/Schema";var l1;l1=XS;class fn{constructor(t=void 0,n=void 0,s=void 0,i=void 0){L(this,l1,XS);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 Nl 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)=>xo(s)?qm:Sb(n(s.value,this,i),Me)}recur(n){const s=Pi(this.typeParameters,n);return s===this.typeParameters?this:new Nl(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 LO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Null")}getParser(){return Df(this,null)}getExpected(){return"null"}};const Jm=new LO;let OO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Undefined")}getParser(){return Df(this,void 0)}toCodecJson(){return Et(this,[Mb])}getExpected(){return"undefined"}};const Mb=new Nt(Jm,new _n(un(()=>{}),un(()=>null))),AO=new OO;let DO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Void")}getParser(){return Df(this,void 0)}toCodecJson(){return Et(this,[Mb])}getExpected(){return"void"}};const zO=new DO;let UO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Never")}getParser(){return Co(this,hN)}getExpected(){return"never"}};const VO=new UO;let BO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Any")}getParser(){return Co(this,bk)}getExpected(){return"any"}};const qO=new BO;let HO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Unknown")}getParser(){return Co(this,bk)}getExpected(){return"unknown"}};const Ym=new HO;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 Df(this,this.literal)}toCodecJson(){return typeof this.literal=="bigint"?ZS(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:ZS(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function ZS(e){const t=globalThis.String(e.literal);return Et(e,[new Nt(new Ha(t),new _n(un(()=>e.literal),un(()=>t)))])}let WO=class extends fn{constructor(){super(...arguments);L(this,"_tag","String")}getParser(){return Co(this,lm)}getExpected(){return"string"}};const Tb=new WO;let GO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Number")}getParser(){return Co(this,Ck)}toCodecJson(){return this.checks&&(Fa(this.checks,"isFinite")||Fa(this.checks,"isInt"))?this:Et(this,[s3])}toCodecStringTree(){return this.checks&&(Fa(this.checks,"isFinite")||Fa(this.checks,"isInt"))?Et(this,[p3]):Et(this,[m3])}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 $b=new GO;let KO=class extends fn{constructor(){super(...arguments);L(this,"_tag","Boolean")}getParser(){return Co(this,cN)}getExpected(){return"boolean"}};const QO=new KO;class Ml 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 yp(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,C={ast:s,getParser:m,oinput:p,len:w,tailThreshold:YO(w,u,h),output:new globalThis.Array(w),issues:void 0,options:x},b=Xm(x==null?void 0:x.concurrency),_=JO(C,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 bb(s,v[E]));if(x.errors==="all")C.issues?C.issues.push(j):C.issues=[j];else return yield*Ke(new qt(s,p,[j]))}return C.issues?yield*Ke(new qt(s,p,C.issues)):Me(C.output)})}recur(n){const s=Pi(this.elements,n),i=Pi(this.rest,n);return s===this.elements&&i===this.rest?this:new Ml(this.isMutable,s,i,this.annotations,this.checks,void 0,this.context)}getExpected(){return"array"}}const JO=Tf()({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 Kc(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 Cb((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 Il(new qt(e.ast,e.oinput,[u]))}}});function YO(e,t,n){return Math.max(t,e-n)}const Xm=e=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),Kc=(e,t,n,s)=>{const i=Pl(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 Il(new qt(t,e.oinput,[a]))},Zm="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",XO=new globalThis.RegExp(`(?:${Zm}|Infinity|-Infinity|NaN)`);function Fb(e,t){const n=xs(t);switch(n._tag){case"String":return Object.keys(e);case"TemplateLiteral":{const s=f3(n);return Object.keys(e).filter(i=>s.test(i))}case"Symbol":return Object.getOwnPropertySymbols(e);case"Number":return Object.keys(e).filter(s=>XO.test(s));case"Union":return[...new Set(n.types.flatMap(s=>Fb(e,s)))];default:return[]}}class Lb{constructor(t,n){L(this,"name");L(this,"type");this.name=t,this.type=n}}class ZO{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)&&!Kb(n))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}}class e0 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 Co(s,dN);const d=f>0?Tf()({onItem:yp(function*(h,[m,p]){const v=n(Xb(p.parameter))(Me(m),h.options),w=bn(v)?v:yield*WS(v);if(w._tag==="Failure"){const j=Kc(h,s,m,w);j&&(yield*j);return}const C=Me(h.input[m]),_=n(p.type)(C,h.options),E=bn(_)?_:yield*WS(_);if(E._tag==="Failure"){const j=Kc(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[F,A]=p.merge.decode.combine([j,h.out[j]],[j,R]);$a(h.out,F,A)}else $a(h.out,j,R)}}),step:(h,m,p)=>p._tag==="Failure"?p:void 0}):void 0;return yp(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",C=m.onExcessProperty==="error",b=m.onExcessProperty==="preserve";let _;if(s.indexSignatures.length===0&&(C||b)){_=Reflect.ownKeys(p);for(let R=0;R<_.length;R++){const F=_[R];if(!a.has(F))if(C){const A=new tr([F],new bb(s,p[F]));if(w){v.issues?v.issues.push(A):v.issues=[A];continue}else return yield*Ke(new qt(s,h,[A]))}else $a(x,F,p[F])}}const E=Xm(m==null?void 0:m.concurrency),j=e3(v,u,E);if(j&&(yield*j),d){const R=$M();for(let A=0;A<f;A++){const T=s.indexSignatures[A],U=Fb(p,T.parameter);for(let V=0;V<U.length;V++){const Z=U[V];R.push([Z,T])}}const F=d(v,R,E);F&&(yield*F)}if(v.issues)return yield*Ke(new qt(s,h,v.issues));if(m.propertyOrder==="original"){const R=(_??Reflect.ownKeys(p)).concat(i),F={};for(const A of R)Object.hasOwn(x,A)&&$a(F,A,x[A]);return Me(F)}return Me(x)})}rebuild(n,s){const i=Pi(this.propertySignatures,u=>{const f=n(u.type);return f===u.type?u:new Lb(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 ZO(f,d,h)});return i===this.propertySignatures&&a===this.indexSignatures?this:new e0(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 e3=Tf()({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 Kc(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 Cb((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 Il(new qt(e.ast,e.oinput,[i]))}}});function t0(e,t,n){return new e0(Reflect.ownKeys(e).map(s=>new Lb(s,e[s].ast)),[],n,t)}function Ob(e){return e.ast}function n0(e,t,n){return new Tl(e.map(Ob),t,void 0,n)}function Ab(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(Ab)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function r0(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(Gc(s))return[{key:n.name,literal:s.literal}];if(NO(s))return[{key:n.name,literal:s.symbol}]}return[]});case"Arrays":return e.elements.flatMap((n,s)=>Gc(n)&&!Fr(n)?[{key:s,literal:n.literal}]:[]);case"Suspend":return r0(e.thunk())}}const ew=new WeakMap;function t3(e){var n,s;let t=ew.get(e);if(t)return t;t={};for(const i of e){const a=xs(i);if(jO(a))continue;const u=Ab(a),f=r0(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 ew.set(e,t),t}function tw(e){return t=>{const n=xs(t);return n._tag==="Literal"?n.literal===e:n._tag==="UniqueSymbol"?n.symbol===e:!0}}function n3(e,t){var i,a;const n=t3(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(tw(e))}}return u}return(((a=n.byType)==null?void 0:a[s])??[]).filter(tw(e))}let Tl=class Db 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 nt(i);const u=i.value,f=n3(u,s.types),d={ast:s,recur:n,oinput:i,input:u,out:void 0,successes:[],issues:void 0,options:a},h=Xm(a==null?void 0:a.concurrency),m=r3(d,f,h);return m?zn(m,p=>d.out?nt(d.out):Ke(new QS(s,u,d.issues??[]))):d.out?nt(d.out):Ke(new QS(s,u,d.issues??[]))}}recur(n){const s=Pi(this.types,n);return s===this.types?this:new Db(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(Gc);if(d.length>0)return`${nw(f.isMutable)}[ ${d.map(h=>{var m;return n(h)+rw((m=h.context)==null?void 0:m.isOptional)}).join(", ")}, ... ]`;break}case"Objects":{const d=f.propertySignatures.filter(h=>Gc(h.type));if(d.length>0)return`{ ${d.map(h=>{var m,p;return`${nw((m=h.type.context)==null?void 0:m.isMutable)}${$c(h.name)}${rw((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 r3=Tf()({onItem(e,t){return e.recur(t)(e.oinput,e.options)},step(e,t,n){if(n._tag==="Failure"){const s=Pl(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),Il(new yO(e.ast,e.input,e.successes));if(e.out=n.value,e.successes.push(t),e.ast.mode==="anyOf")return ZC}}}),zb=new Tl([new Ha("Infinity"),new Ha("-Infinity"),new Ha("NaN")],"anyOf"),s3=new Nt(new Tl([$b,zb],"anyOf"),new _n(Eb(),un(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function nw(e){return e?"":"readonly "}function rw(e){return e?"?":""}class Qc extends ff{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 Qc(this.run,{...this.annotations,...n},this.aborted)}abort(){return new Qc(this.run,this.annotations,!0)}and(n,s){return new Jc([this,n],s)}}class Jc extends ff{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 Jc(this.checks,{...this.annotations,...n})}and(n,s){return new Jc([this,n],s)}}function Ub(e,t,n=!1){return new Qc((s,i,a)=>vO(s,i,e(s,i,a)),t,n)}function o3(e,t){const n=e.source;return Ub(s=>e.test(s),{expected:`a string matching the RegExp ${n}`,meta:{_tag:"isPattern",regExp:e},toArbitraryConstraint:{string:{patterns:[e.source]}},...t})}function Af(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:Af(e,n=>{n.encoding.value=t})}function s0(e,t){return e.context===t?e:Af(e,n=>{n.context.value=t})}function Vb(e,t){if(e.checks){const n=e.checks[e.checks.length-1];return Bb(e,Jk(e.checks.slice(0,-1),n.annotate(t)))}return Af(e,n=>{n.annotations.value={...n.annotations.value,...t}})}function Bb(e,t){return e.checks===t?e:Af(e,n=>{n.checks.value=t})}function o0(e,t){return Bb(e,e.checks?[...e.checks,...t]:t)}function qb(e,t){const n=e,s=n[n.length-1],i=t(s.to);return i!==s.to?Jk(e.slice(0,e.length-1),new Nt(i,s.transformation)):e}function i3(e){return t=>t.encoding?Et(t,qb(t.encoding,e)):t}function a3(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 Hb(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 s0(e,n)}const Wb=i3(Gb);function Gb(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 Wb(s0(e,t))}function l3(e,t){const n=new _n(RO(t),Ri()),s=[new Nt(Ym,n)],i=e.context?new Ei(e.context.isOptional,e.context.isMutable,s,e.context.annotations):new Ei(!1,!1,s);return s0(e,i)}function u3(e,t,n){return a3(e,n,t)}function Fr(e){var t;return((t=e.context)==null?void 0:t.isOptional)??!1}const Yc=Rs(e=>{var n;if(e.encoding)return Yc(Et(e,void 0));const t=e;return((n=t.recur)==null?void 0:n.call(t,Yc))??t}),xs=Rs(e=>Yc(uo(e)));function c3(e,t){const n=t,s=n.length,i=n[s-1],a=[new Nt(uo(Et(e,void 0)),n[0].transformation.flip())];for(let f=1;f<s;f++)a.unshift(new Nt(uo(n[f-1].to),n[f].transformation.flip()));const u=uo(i.to);return u.encoding?Et(u,[...u.encoding,...a]):Et(u,a)}const uo=Rs(e=>{var n,s;if(e.encoding)return c3(e,e.encoding);const t=e;return((n=t.flip)==null?void 0:n.call(t,uo))??((s=t.recur)==null?void 0:s.call(t,uo))??t});function Kb(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(Kb);default:return!1}}function Qb(e,t){return e.encodedParts.map(n=>d3(n,Jb(n),t)).join("")}const f3=Rs(e=>new globalThis.RegExp(`^${Qb(e,!0)}$`));function Jb(e){switch(e._tag){case"Literal":return fO(globalThis.String(e.literal));case"String":return h3;case"Number":return Zm;case"BigInt":return y3;case"TemplateLiteral":return Qb(e,!1);case"Union":return e.types.map(Jb).join("|")}}function d3(e,t,n){if($O(e)){if(!n)return`(?:${t})`}else if(!n)return t;return`(${t})`}function Df(e,t){const n=PL(t);return s=>s._tag==="None"?qm:s.value===t?n:Ke(new vr(e,s))}function Co(e,t){return n=>n._tag==="None"?qm:t(n.value)?nt(n):Ke(new vr(e,n))}function Yb(e){function t(n){return n.encoding?Et(n,qb(n.encoding,t)):e(n)}return Rs(t)}const Xb=Yb(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(Xb)}}),h3="[\\s\\S]*?",sw=new globalThis.RegExp(`^${Zm}$`);function g3(e){return o3(sw,{expected:"a string representing a finite number",meta:{_tag:"isStringFinite",regExp:sw},...e})}const Zb=o0(Tb,[g3()]),p3=new Nt(Zb,Ib),m3=new Nt(new Tl([Zb,zb],"anyOf"),Ib),y3="-?\\d+";function kp(e,t,n,s,i){for(let a=0;a<e.length;a++){const u=e[a];if(u._tag==="FilterGroup")kp(u.checks,t,n,s,i);else{const f=u.run(t,s,i);if(f&&(n.push(new pO(t,u,f)),u.aborted||(i==null?void 0:i.errors)!=="all"))return}}}const e_="~effect/Schema/Class",x3="~structural";function v3(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 S3=new Nl([],()=>(e,t)=>v3(e)?nt(e):Ke(new vr(t,Me(e))),{typeConstructor:{_tag:"effect/Json"},generation:{runtime:"Schema.Json",Type:"Schema.Json"},expected:"JSON value",toCodecJson:()=>new Nt(Ym,Qm())}),w3=new Nt(Jm,new _n(Ri(),un(()=>null))),k3=new Nt(S3,Qm()),C3=vC,La=_m,b3=Dc,Cp=bm,_3=oF,t_=hF,R3=Symbol.for("effect/MutableList/Empty"),E3=()=>({head:void 0,tail:void 0,length:0}),ow=()=>({array:[],mutable:!0,offset:0,next:void 0}),bp=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=ow(),e.tail=e.tail.next):e.head=e.tail=ow(),e.tail.array.push(t),e.length++},P3=(e,t)=>I3(e,mr(t),!Array.isArray(t)),I3=(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},kc=e=>{e.head=e.tail=void 0,e.length=0},n_=(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 kc(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&&kc(e),n;i=i.next}return kc(e),n},j3=e=>{if(!e.head)return R3;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:kc(e)),t},N3="~effect/Queue",M3="~effect/Queue/Enqueue",T3="~effect/Queue/Dequeue",pg={_A:_e,_E:_e},$3={[N3]:pg,[M3]:pg,[T3]:pg,...Ps,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:U3(this)}}},F3=e=>Ve(t=>{const n=Object.create($3);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=E3(),n.scheduleRunning=!1,n.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},Re(n)}),L3=e=>F3({capacity:e}),O3=(e,t)=>St(()=>{if(e.state._tag!=="Open")return Re(mr(t));const n=A3(e,t);return n.length===0?at([]):e.strategy==="dropping"?Re(n):W3(e,n)}),A3=(e,t)=>{if(e.state._tag!=="Open")return mr(t);if(e.capacity===Number.POSITIVE_INFINITY||e.strategy==="sliding")return P3(e.messages,t),e.strategy==="sliding"&&n_(e.messages,e.messages.length-e.capacity),aw(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?bp(e.messages,a):s.push(a),i++;return aw(e),s},Oa=re(2,(e,t)=>xt(()=>D3(e,t))),D3=(e,t)=>{if(e.state._tag!=="Open")return!1;const n=On(t),s=S$(n,B3);return e.state.offers.size===0&&e.messages.length===0?(s_(e,s),!0):(e.state={...e.state,_tag:"Closing",exit:s},!0)},iw=e=>Oa(e,Tk(mm())),z3=e=>r_(e,1,Number.POSITIVE_INFINITY),r_=(e,t,n)=>St(()=>H3(e,t,n)??Cl(G3(e),r_(e,1,n))),U3=e=>e.state._tag==="Done"?0:e.messages.length,V3=at(!0),B3=yr(mm()),q3=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}},aw=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>q3(e),0))},H3=(e,t,n)=>{if(e.state._tag==="Done")return e.state.exit;if(n<=0||t<=0)return at([]);if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,mg(e),e.capacity=0;const s=[j3(e.messages)];return mg(e),at(s)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){const s=n_(e.messages,n);return mg(e),at(s)}},W3=(e,t)=>sr(n=>{if(e.state._tag!=="Open")return n(at(t));const s={_tag:"Array",remaining:t,offset:0,resume:n};return e.state.offers.add(s),xt(()=>{e.state._tag==="Open"&&e.state.offers.delete(s)})}),mg=e=>{if(e.state._tag==="Done")return BS(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(s_(e,e.state.exit),BS(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")bp(e.messages,n.message),t--,n.resume(V3),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;bp(e.messages,n.remaining[n.offset]),t--}n.resume(at([])),e.state.offers.delete(n)}}return!1},G3=e=>sr(t=>e.state._tag==="Done"?t(e.state.exit):(e.state.takers.add(t),xt(()=>{e.state._tag!=="Done"&&e.state.takers.delete(t)}))),s_=(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()},K3="~effect/Channel",Q3={[K3]:{_Env:_e,_InErr:_e,_InElem:_e,_OutErr:_e,_OutElem:_e},pipe(){return Ft(this,arguments)}},i0=e=>{const t=Object.create(Q3);return t.transform=(n,s)=>dl(e(n,s),i=>nt(jL(i))),t},J3=e=>i0((t,n)=>e),a0=e=>e.transform,Y3=e=>J3(nt(z3(e))),X3=e=>i0((t,n)=>{let s;return nt(Ar(()=>s||e.pipe(zc(n),zn(i=>a0(i)(t,n)),zn(i=>s=i))))}),Z3=(e,t,n)=>Ar(()=>{const s=Am(),i=a0(e)(Ff(),s);return Vc(zn(i,t),nt).pipe(yb(a=>Lf(s,a)))}),eA=re(2,(e,t)=>i0((n,s)=>So(ao(a0(e)(n,s),t),ao(t)))),tA=re(2,(e,t)=>Z3(e,n=>xb(zn(n,t),{disableYield:!0}))),bo=e=>e,Aa=Rs(e=>{var t;switch(e._tag){case"Declaration":{const n=(t=e.annotations)==null?void 0:t[e_];if(hf(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 zf(e){const t=Aa(Yc(e.ast)),n=l0(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 o_(e){const t=zf(e);return(n,s)=>KF(vb(t(n,s)))}function nA(e){const t=zf(e);return(n,s)=>Gm(wo(t(n,s),i=>new Error(i.toString(),{cause:i})))}function po(e){return l0(e.ast)}function rA(e){return iA(po(e))}const sA=rA;function oA(e){return l0(uo(e.ast))}function l0(e){const t=Cc(e);return(n,s)=>li(t(Me(n),s??FO),i=>i._tag==="None"?Ke(new Wc(i)):nt(i.value))}function iA(e){return(t,n)=>Gm(wo(e(t,n),s=>new Error(s.toString(),{cause:s})))}const Cc=Rs(e=>{var i;let t;const n=(i=wb(e))==null?void 0:i.parseOptions;if(!e.context&&!e.encoding&&!e.checks)return(a,u)=>(t??(t=e.getParser(Cc)),n&&(u={...u,...n}),t(a,u));const s=MO(e)||TO(e)||Nb(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,C=Cc(w);if(d=d?li(d,b=>C(b,u)):C(a,u),v.transformation._tag==="Transformation"){const b=v.transformation.decode;d=li(d,_=>b.run(_,u))}else d=v.transformation.decode(d,u)}d=wo(d,x=>new mO(e,a,x))}t??(t=e.getParser(Cc));let h=d?li(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=lO(h,p=>{const x=[];kp(m.filter(w=>{var C;return(C=w.annotations)==null?void 0:C[x3]}),a.value,x,e,u);const v=kS(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=li(h,p=>{if(ks(p)){const x=p.value,v=[];if(kp(m,x,v,e,u),kS(v))return Ke(new qt(e,p,v))}return nt(p)})}return h}}),_p="~effect/Schema/Schema",aA={[_p]:_p,pipe(){return Ft(this,arguments)},annotate(e){return this.rebuild(Vb(this.ast,e))},annotateKey(e){return this.rebuild(Hb(this.ast,e))},check(...e){return this.rebuild(o0(this.ast,e))}};function u0(e,t){const n=Object.create(aA);return t&&Object.assign(n,t),n.ast=e,n.rebuild=s=>u0(s,t),n.makeEffect=kk(zf(n),wo(s=>new Uf(s))),n.make=nA(n),n.makeOption=o_(n),n}const lw="~effect/Schema/SchemaError";var u1;u1=lw;class Uf{constructor(t){L(this,u1,lw);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 lA=cA(uA);function uA(e){switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}}function cA(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=_p;function Vf(){return(e,t,n)=>Be(new Nl(e.map(Ob),s=>t(s.map(i=>Be(i))),n))}function i_(e,t){return Vf()([],()=>(n,s)=>e(n)?nt(n):Ke(new vr(s,Me(n))),t)}function uw(e){const t=po(e);return(n,s)=>wo(t(n,s),i=>new Uf(i))}const fA=sA;function dA(e){const t=oA(e);return(n,s)=>wo(t(n,s),i=>new Uf(i))}const hA=dA,Be=u0;function c0(e){return De(e,Wa)&&e[Wa]===Wa}const Xc=bo(e=>Be(Gb(e.ast),{schema:e})),Mi=bo(e=>Xc(u_(e)));function vs(e){const t=Be(new Ha(e),{literal:e,transform(n){return t.pipe(tf(vs(n),{decode:un(()=>n),encode:un(()=>e)}))}});return t}const cw=Be(VO),fw=Be(qO),a_=Be(Ym),gA=Be(Jm),pA=Be(AO),gt=Be(Tb),Zc=Be($b),Rp=Be(QO),ef=Be(zO);function f0(e,t){return Be(e,{fields:t,mapFields(n,s){const i=n(this.fields);return f0(t0(i,s!=null&&s.unsafePreserveChecks?this.ast.checks:void 0),i)}})}function Pt(e){return f0(t0(e,void 0),e)}const hi=bo(e=>Be(new Ml(!1,[],[e.ast]),{schema:e})),mA=bo(e=>Be(new Ml(!1,[e.ast],[e.ast]),{schema:e})),yg=bo(e=>Be(new Ml(!0,e.ast.elements,e.ast.rest),{schema:e}));function l_(e,t){return Be(e,{members:t,mapMembers(n,s){const i=n(this.members);return l_(n0(i,this.ast.mode,s!=null&&s.unsafePreserveChecks?this.ast.checks:void 0),i)}})}function nr(e,t){return l_(n0(e,"anyOf",void 0),e)}function Ss(e){const t=e.map(vs);return Be(n0(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 Ep=bo(e=>nr([e,gA])),u_=bo(e=>nr([e,pA]));function tf(e,t){return n=>Be(u3(n.ast,e.ast,t?Pb(t):Qm()),{from:n,to:e})}function yA(e){return t=>Be(l3(t.ast,e),{schema:t})}function dn(e){return vs(e).pipe(yA(nt(e)))}function xA(e,t){return Pt({_tag:dn(e),...t})}function vA(e,t){return i_(n=>n instanceof e,t)}function $l(){return(e,t)=>new Nt(e.ast,Pb(t))}const SA=Ub;function wA(e){return SA(t=>globalThis.Number.isFinite(t),{expected:"a finite number",meta:{_tag:"isFinite"},toArbitraryConstraint:{number:{noDefaultInfinity:!0,noNaN:!0}},...e})}function dw(e,t){const n=Vf()([e,t],([s,i])=>(a,u,f)=>{if(!zF(a))return Ke(new vr(u,Me(a)));switch(a._tag){case"Fail":return hl(po(s)(a.error,f),{onSuccess:lp,onFailure:d=>new qt(u,Me(a),[new tr(["error"],d)])});case"Die":return hl(po(i)(a.defect,f),{onSuccess:up,onFailure:d=>new qt(u,Me(a),[new tr(["defect"],d)])});case"Interrupt":return nt(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])=>$l()(nr([Pt({_tag:vs("Fail"),error:s}),Pt({_tag:vs("Die"),defect:i}),Pt({_tag:vs("Interrupt"),fiberId:u_(bA)})]),Of({decode:a=>{switch(a._tag){case"Fail":return lp(a.error);case"Die":return up(a.defect);case"Interrupt":return cp(a.fiberId)}},encode:_e})),toArbitrary:([s,i])=>c_(s,i),toEquivalence:([s,i])=>f_(s,i),toFormatter:([s,i])=>d_(s,i)});return Be(n.ast,{error:e,defect:t})}function c_(e,t){return(n,s)=>n.oneof(s!=null&&s.isSuspend?{maxDepth:2,depthIdentifier:"Cause.Failure"}:{},n.constant(cp()),n.integer({min:1}).map(cp),e.map(i=>lp(i)),t.map(i=>up(i)))}function f_(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 d_(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 hw(e,t){const n=Vf()([e,t],([s,i])=>{const a=hi(dw(s,i));return(u,f,d)=>DF(u)?hl(po(a)(u.reasons,d),{onSuccess:ap,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])=>$l()(hi(dw(s,i)),Of({decode:ap,encode:({reasons:a})=>a})),toArbitrary:([s,i])=>h_(s,i),toEquivalence:([s,i])=>g_(s,i),toFormatter:([s,i])=>p_(s,i)});return Be(n.ast,{error:e,defect:t})}function h_(e,t){return(n,s)=>n.array(c_(e,t)(n,s)).map(ap)}function g_(e,t){const n=FN(f_(e,t));return(s,i)=>n(s.reasons,i.reasons)}function p_(e,t){const n=d_(e,t);return s=>`Cause([${s.reasons.map(n).join(", ")}])`}const m_=Pt({message:gt,name:Xc(gt),stack:Xc(gt)}),kA=vA(globalThis.Error,{typeConstructor:{_tag:"Error"},generation:{runtime:"Schema.Error",Type:"globalThis.Error"},expected:"Error",toCodecJson:()=>$l()(m_,jb()),toArbitrary:()=>e=>e.string().map(t=>new globalThis.Error(t))}),gw=new _n(Ri(),un(e=>{try{return JSON.parse(JSON.stringify(e))}catch{return vt(e)}})),or=nr([m_.pipe(tf(kA,jb())),fw.pipe(tf(a_.annotate({toCodecJson:()=>$l()(fw,gw),toArbitrary:()=>e=>e.json()}),gw))]);function CA(e,t,n){const s=Vf()([e,t,n],([i,a,u])=>{const f=hw(a,u);return(d,h,m)=>{if(!qF(d))return Ke(new vr(h,Me(d)));switch(d._tag){case"Success":return hl(po(i)(d.value,m),{onSuccess:gg,onFailure:p=>new qt(h,Me(d),[new tr(["value"],p)])});case"Failure":return hl(po(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])=>$l()(nr([Pt({_tag:vs("Success"),value:i}),Pt({_tag:vs("Failure"),cause:hw(a,u)})]),Of({decode:f=>f._tag==="Success"?gg(f.value):Va(f.cause),encode:f=>GF(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=>gg(h)),h_(a,u)(f,d).map(h=>Va(h))),toEquivalence:([i,a,u])=>{const f=g_(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=p_(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 bA=Zc.check(wA()),_A=globalThis.Symbol.for("immer-draftable");function d0(e,t,n,s,i){var d,h,m,p;const a=EA(n,t,s),u=y_(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=_A,h)](){return u}static get ast(){return a(this).ast}static pipe(){return Ft(this,arguments)}static rebuild(x){return a(this).rebuild(x)}static make(x,v){return new this(x,v)}static makeOption(x,v){return o_(a(this))(x??{},v)}static makeEffect(x,v){return wo(zf(a(this))(x??{},v),w=>new Uf(w))}static annotate(x){return this.rebuild(Vb(this.ast,x))}static annotateKey(x){return this.rebuild(Hb(this.ast,x))}static check(...x){return this.rebuild(o0(this.ast,x))}static extend(x){return(v,w)=>{const C={...n.fields,...v};return d0(this,x,f0(t0(C,n.ast.checks,{identifier:x}),C),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 RA(e){return new _n(un(t=>new e(t)),Ri())}function y_(e){return`~effect/Schema/Class/${e}`}function EA(e,t,n){let s;return i=>{if(s===void 0){const a=RA(i),u=Be(new Nl([e.ast],()=>(f,d)=>f instanceof i||De(f,y_(t))?nt(f):Ke(new vr(d,Me(f))),{identifier:t,[e_]:([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":r0(e.ast),...n}));s=e.pipe(tf(u,a))}return s}}function h0(e){return c0(e)}const PA=e=>(t,n)=>{const s=h0(t)?t:Pt(t);return d0(lL,e,s,n,i=>({toString(){return`${i}(${vt({...this})})`}}))},Vn=e=>(t,n)=>{const s=h0(t)?t:Pt(t);return d0(Lk,e,s,n,a=>({name:a}))},IA=e=>(t,n,s)=>Vn(e)(h0(n)?n.mapFields(i=>({_tag:dn(t),...i}),{unsafePreserveChecks:!0}):xA(t,n),s);function xg(e){return Be(x_(e.ast))}const x_=Yb(e=>{const t=jA(e,x_);return t!==e&&Fr(e)?Wb(t):t});function jA(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(hf(i)){const a=Nb(e)?e.typeParameters.map(d=>u0(xs(d))):[],u=i(a),f=t(u.to);return Et(e,f===u.to?[u]:[new Nt(f,u.transformation)])}return Et(e,[w3])}case"Unknown":case"ObjectKeyword":return Et(e,[k3]);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=lA(e.types);return i!==e.types?new Tl(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 NA="~effect/Stream",MA={_R:_e,_E:_e,_A:_e},TA={[NA]:MA,pipe(){return Ft(this,arguments)}},$A=e=>{const t=Object.create(TA);return t.channel=e,t},FA="~effect/Stream",LA=e=>De(e,FA),g0=$A,OA=e=>e.channel,AA=e=>g0(Y3(e)),DA=e=>g0(X3(So(e,OA))),zA=re(2,(e,t)=>g0(eA(e.channel,t))),UA=re(2,(e,t)=>tA(e.channel,n=>{let s=0;return db({while:()=>s<n.length,body:()=>t(n[s++]),step:Sl})})),Pp="~effect/FiberSet",VA=e=>De(e,Pp),BA={[Pp]:Pp,[Symbol.iterator](){return this.state._tag==="Closed"?kM():this.state.backing[Symbol.iterator]()},...Ps,toJSON(){return{_id:"FiberMap",state:this.state}}},qA=(e,t)=>{const n=Object.create(BA);return n.state={_tag:"Open",backing:e},n.deferred=t,n},HA=()=>pb(Ln(()=>qA(new Set,Lm())),e=>Ar(()=>{const t=e.state;if(t._tag==="Closed")return st;e.state={_tag:"Closed"};const n=t.backing;return b3(n).pipe(XF(e.deferred))})),v_=-1,WA=cT(dT(BF,fT(v_))),GA=re(e=>VA(e[0]),(e,t,n)=>{if(e.state._tag==="Closed"){t.interruptUnsafe(v_);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),eb(s)&&((n==null?void 0:n.propagateInterruption)===!0?!WA(s.cause):!UF(s.cause))&&Ba(e.deferred,s))})}),KA=(function(){let e;return()=>(e===void 0&&(e=mp(pp)),e)})(),QA=e=>()=>So(qc(),t=>{const n=Hc(t);return(s,i)=>{if(e.state._tag==="Closed")return KA();const a=n(s,i);return GA(e,a),a}}),pw=e=>Om(e.deferred),JA="~effect/interfaces/PrimaryKey",mw="~effect/ManagedRuntime",YA=(e,t)=>{const n=(t==null?void 0:t.memoMap)??zm(),s=Am("parallel"),i=Uc(s,"sequential"),a={onFiberStart:_3(s)},u=m=>m?{...m,onFiberStart:m.onFiberStart?p=>{a.onFiberStart(p),m.onFiberStart(p)}:a.onFiberStart}:a;let f;const d=Bc(m=>(f||(f=mp($L(Um(e,n,i),p=>Ln(()=>{h.cachedContext=p})),{...a,scheduler:m.currentScheduler})),ML(C3(f)))),h={[mw]:mw,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=NL("ManagedRuntime disposed"),h.cachedContext=void 0,Lf(h.scope,ZC))),runFork(m,p){return h.cachedContext===void 0?mp(ni(h,m),u(p)):Hc(h.cachedContext)(m,u(p))},runCallback(m,p){return h.cachedContext===void 0?eO(ni(h,m),u(p)):ZL(h.cachedContext)(m,u(p))},runSyncExit(m){return h.cachedContext===void 0?vb(ni(h,m)):oO(h.cachedContext)(m)},runSync(m){return h.cachedContext===void 0?Gm(ni(h,m)):sO(h.cachedContext)(m)},runPromiseExit(m,p){return h.cachedContext===void 0?nO(ni(h,m),u(p)):rO(h.cachedContext)(m,u(p))},runPromise(m,p){return h.cachedContext===void 0?qa(ni(h,m),u(p)):tO(h.cachedContext)(m,u(p))}};return h};function ni(e,t){return zn(e.contextEffect,n=>ao(t,n))}const Ip="~effect/rpc/RpcSchema/StreamSchema";function S_(e){return De(e,Ip)}function w_(e){return S_(e)?Me({success:e.success,error:e.error}):An()}const XA=i_(LA);function ZA(e,t){return Be(XA.ast,{[Ip]:Ip,success:e,error:t})}const yw="~effect/rpc/Rpc",eD={[yw]:yw,pipe(){return Ft(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:c0(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:wi(this.annotations,e)})}},as=e=>{function t(){}return Object.setPrototypeOf(t,eD),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},Ti=(e,t)=>{const n=(t==null?void 0:t.success)??ef,s=(t==null?void 0:t.error)??cw,i=(t==null?void 0:t.defect)??or;let a;return t!=null&&t.primaryKey?a=class extends PA(`effect/rpc/Rpc/${e}`)(t.payload){[JA](){return t.primaryKey(this)}}:a=c0(t==null?void 0:t.payload)?t==null?void 0:t.payload:t!=null&&t.payload?Pt(t==null?void 0:t.payload):ef,as({_tag:e,payloadSchema:a,successSchema:t!=null&&t.stream?ZA(n,s):n,errorSchema:t!=null&&t.stream?cw:s,defectSchema:i,annotations:er(),middlewares:new Set})},vg=new WeakMap,tD=e=>{if(vg.has(e))return vg.get(e);const t=e,n=new Set([t.errorSchema]),s=w_(t.successSchema);ks(s)&&n.add(s.value.error);for(const a of t.middlewares)n.add(a.error);const i=CA(ks(s)?ef:t.successSchema,nr([...n]),t.defectSchema);return vg.set(e,i),i},nD="~effect/rpc/Rpc/Wrapper",rD=e=>nD in e,xw=Symbol.for("~effect/http/Headers"),pl=Object.create(null);Object.defineProperties(pl,{[xw]:{value:xw},[pf]:{value(e){return aD(this,io(e,lD))}},toJSON:{value(){return mf(this)}},[Zt]:{value(e){return oD(this,e)}},[Xt]:{value(){return cm(this)}},toString:{value:xS.toString},[ho]:{value:xS[ho]}});const sD=e=>Object.assign(Object.create(pl),e),oD=RM($N()),p0=Object.create(pl),iD=e=>{if(e===void 0)return p0;if(Symbol.iterator in e){const n=Object.create(pl);for(const[s,i]of e)n[s.toLowerCase()]=i;return n}const t=Object.create(pl);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},vw=re(2,(e,t)=>{const n=sD(e);return Object.assign(n,t),n}),aD=re(2,(e,t)=>{const n={...e},s=i=>{if(typeof i=="string"){const a=i.toLowerCase();a in e&&(n[a]=KS(e[a]))}else for(const a in e)i.test(a)&&(n[a]=KS(e[a]))};if(Array.isArray(t))for(let i=0;i<t.length;i++)s(t[i]);else s(t);return n}),lD=Xe("effect/Headers/CurrentRedactedNames",{defaultValue:()=>["authorization","cookie","set-cookie","x-api-key"]}),uD="~effect/http/HttpClientError";class m0 extends Vn(uD)({_tag:dn("HttpError"),kind:Ss(["EncodeError","DecodeError","TransportError","InvalidUrlError","StatusCodeError","EmptyBodyError"]),cause:Mi(or)}){static fromHttpClientError(t){return new m0({_tag:"HttpError",kind:t.reason._tag,cause:t.reason})}}const Sw="~effect/socket/Socket",y0=Un("effect/socket/Socket"),cD=e=>y0.of({[Sw]:Sw,runRaw:e.runRaw,run:e.run??((t,n)=>e.runRaw(s=>typeof s=="string"?t(fD.encode(s)):s instanceof Uint8Array?t(s):t(new Uint8Array(s)),n)),runString:e.runString??(e.run?(t,n)=>e.run(s=>t(Sg.decode(s)),n):(t,n)=>e.runRaw(s=>typeof s=="string"?t(s):s instanceof Uint8Array?t(Sg.decode(s)):t(Sg.decode(new Uint8Array(s))),n)),writer:e.writer}),fD=new TextEncoder,Sg=new TextDecoder,dD="~effect/socket/Socket/CloseEvent",hD=e=>De(e,dD),bc="~effect/socket/Socket/SocketError",gD=e=>De(e,bc);class k_ extends Vn("effect/socket/Socket/SocketReadError")({_tag:dn("SocketReadError"),cause:or}){constructor(){super(...arguments);L(this,"message","An error occurred during Read")}}class pD extends Vn("effect/socket/Socket/SocketWriteError")({_tag:dn("SocketWriteError"),cause:or}){constructor(){super(...arguments);L(this,"message","An error occurred during Write")}}class nf 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 rf extends Vn("effect/socket/Socket/SocketCloseError")({_tag:dn("SocketCloseError"),code:Zc,closeReason:Mi(gt)}){static filterClean(t){return function(n){return gi.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 C_=nr([k_,pD,nf,rf]);var c1,f1;class gi extends(f1=IA(bc)("SocketError",{_tag:dn("SocketError"),reason:C_}),c1=bc,f1){constructor(n){var t=(...yU)=>(super(...yU),L(this,c1,bc),L(this,"message",this.reason.message),this);"cause"in n.reason?t({...n,cause:n.reason.cause}):t(n)}static is(n){return gD(n)}}const mD=e=>!0;class yD extends Un()("~effect/socket/Socket/WebSocket"){}class b_ extends Un()("@effect/platform/Socket/WebSocketConstructor"){}const xD=Vm(b_)((e,t)=>new globalThis.WebSocket(e,t)),vD=(e,t)=>b_.use(n=>SD(pb((typeof e=="string"?nt(e):e).pipe(So(s=>n(s,t==null?void 0:t.protocols))),s=>Ln(()=>s.close(1e3))),t)),SD=(e,t)=>Bc(n=>{let s;const i=t_(!1),a=n.context,u=(t==null?void 0:t.closeCodeIsError)??mD,f=(m,p)=>GL(lo(function*(x){const v=yield*HA().pipe(zc(x)),w=yield*zc(e,x),C=yield*WL(QA(v)(),yD,w);let b=!1;function _(R){if(R.data instanceof Blob){const A=zn(EL(()=>R.data.arrayBuffer()),T=>{const U=m(new Uint8Array(T));return di(U)?U:st});return C(A)}const F=m(R.data);di(F)&&C(F)}function E(R){w.removeEventListener("message",_),w.removeEventListener("close",j),Ba(v.deferred,Ke(new gi({reason:b?new k_({cause:R}):new nf({kind:"Unknown",cause:R})})))}function j(R){const F=typeof R.code=="number"?R.code:1001;w.removeEventListener("message",_),w.removeEventListener("error",E),Ba(v.deferred,Ke(new gi({reason:new rf({code:F,closeReason:R.reason})})))}if(w.addEventListener("close",j,{once:!0}),w.addEventListener("error",E,{once:!0}),w.addEventListener("message",_),w.readyState!==1){const R=Lm();w.addEventListener("open",()=>{b=!0,Ba(R,st)},{once:!0}),yield*Om(R).pipe(zL({duration:(t==null?void 0:t.openTimeout)??1e4,orElse:()=>Ke(new gi({reason:new nf({kind:"Timeout",cause:new Error('timeout waiting for "open"')})}))}),hb(pw(v)))}return b=!0,s=w,i.openUnsafe(),p!=null&&p.onOpen&&(yield*p.onOpen),yield*FL(pw(v),rf.filterClean(R=>!u(R)),()=>st)})).pipe(HL(x=>wi(a,x)),mb(Ln(()=>{i.closeUnsafe(),s=void 0}))),h=nt(m=>i.whenOpen(Ln(()=>{const p=s;hD(m)?p.close(m.code,m.reason):p.send(m)})));return nt(cD({runRaw:f,writer:h}))}),wD=kk(vD,fp(y0));class __ extends Un()("effect/workers/Transferable/Collector"){}const kD=()=>{let e=[];const t=i=>{e.push(...i)},n=()=>e,s=()=>{const i=e;return e=[],i};return __.of({addAllUnsafe:t,addAll:i=>Ln(()=>t(i)),readUnsafe:n,read:Ln(n),clearUnsafe:s,clear:Ln(s)})};class CD extends Vn("effect/workers/WorkerError/WorkerSpawnError")({_tag:dn("WorkerSpawnError"),message:gt,cause:Mi(or)}){}class bD extends Vn("effect/workers/WorkerError/WorkerSendError")({_tag:dn("WorkerSendError"),message:gt,cause:Mi(or)}){}class _D extends Vn("effect/workers/WorkerError/WorkerReceiveError")({_tag:dn("WorkerReceiveError"),message:gt,cause:Mi(or)}){}class RD extends Vn("effect/workers/WorkerError/WorkerUnknownError")({_tag:dn("WorkerUnknownError"),message:gt,cause:Mi(or)}){}const ED=nr([CD,bD,_D,RD]),wg="~effect/rpc/RpcClientError";class jp extends Vn("effect/rpc/RpcClientError/RpcClientDefect")({_tag:dn("RpcClientDefect"),message:gt,cause:or}){}var d1,h1;class ww extends(h1=Vn(wg)({_tag:dn("RpcClientError"),reason:nr([ED,C_,m0,jp])}),d1=wg,h1){constructor(){super(...arguments);L(this,d1,wg)}get message(){return`${this.reason._tag}: ${this.reason.message}`}}const nc=e=>typeof e=="bigint"?e:BigInt(e),PD={_tag:"Ping"};var Np;try{Np=new TextDecoder}catch{}var ue,pr,O=0,He={},Ne,hs,$n=0,hr=0,Rt,Lr,cn=[],je,kw={useRecords:!1,mapsAsObjects:!0};class R_{}const E_=new R_;E_.name="MessagePack 0xC1";var ws=!1,Cw=2,ID;class ml{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 T_(()=>(Tp(),this?this.unpack(t,n):ml.prototype.unpack.call(kw,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,O=n.start||0):(O=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 ml){if(He=this,this.structures)return Ne=this.structures,rc(n);(!Ne||Ne.length>0)&&(Ne=[])}else He=kw,(!Ne||Ne.length>0)&&(Ne=[]);return rc(n)}unpackMultiple(t,n){let s,i=0;try{ws=!0;let a=t.length,u=this?this.unpack(t,a):Bf.unpack(t,a);if(n){if(n(u,i,O)===!1)return;for(;O<a;)if(i=O,n(rc(),i,O)===!1)return}else{for(s=[u];O<a;)i=O,s.push(rc());return s}}catch(a){throw a.lastPosition=i,a.values=s,a}finally{ws=!1,Tp()}}_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 rc(e){try{if(!He.trusted&&!ws){let n=Ne.sharedLength||0;n<Ne.length&&(Ne.length=n)}let t;if(He.randomAccessStructure&&ue[O]<64&&ue[O]>=32&&ID||(t=ft()),Rt&&(O=Rt.postBundlePosition,Rt=null),ws&&(Ne.restoreStructures=null),O==pr)Ne&&Ne.restoreStructures&&bw(),Ne=null,ue=null,Lr&&(Lr=null);else{if(O>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&&bw(),Tp(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||O>pr)&&(t.incomplete=!0),t}}function bw(){for(let e in Ne.restoreStructures)Ne[e]=Ne.restoreStructures[e];Ne.restoreStructures=null}function ft(){let e=ue[O++];if(e<160)if(e<128){if(e<64)return e;{let t=Ne[e&63]||He.getStructures&&P_()[e&63];return t?(t.read||(t.read=x0(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=j_();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>=O)return hs.slice(O-$n,(O+=t)-$n);if(hr==0&&pr<140){let n=t<16?v0(t):I_(t);if(n!=null)return n}return Mp(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)):E_;case 194:return!1;case 195:return!0;case 196:if(t=ue[O++],t===void 0)throw new Error("Unexpected end of buffer");return kg(t);case 197:return t=je.getUint16(O),O+=2,kg(t);case 198:return t=je.getUint32(O),O+=4,kg(t);case 199:return Ks(ue[O++]);case 200:return t=je.getUint16(O),O+=2,Ks(t);case 201:return t=je.getUint32(O),O+=4,Ks(t);case 202:if(t=je.getFloat32(O),He.useFloat32>2){let n=S0[(ue[O]&127)<<1|ue[O+1]>>7];return O+=4,(n*t+(t>0?.5:-.5)>>0)/n}return O+=4,t;case 203:return t=je.getFloat64(O),O+=8,t;case 204:return ue[O++];case 205:return t=je.getUint16(O),O+=2,t;case 206:return t=je.getUint32(O),O+=4,t;case 207:return He.int64AsType==="number"?(t=je.getUint32(O)*4294967296,t+=je.getUint32(O+4)):He.int64AsType==="string"?t=je.getBigUint64(O).toString():He.int64AsType==="auto"?(t=je.getBigUint64(O),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=je.getBigUint64(O),O+=8,t;case 208:return je.getInt8(O++);case 209:return t=je.getInt16(O),O+=2,t;case 210:return t=je.getInt32(O),O+=4,t;case 211:return He.int64AsType==="number"?(t=je.getInt32(O)*4294967296,t+=je.getUint32(O+4)):He.int64AsType==="string"?t=je.getBigInt64(O).toString():He.int64AsType==="auto"?(t=je.getBigInt64(O),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=je.getBigInt64(O),O+=8,t;case 212:if(t=ue[O++],t==114)return jw(ue[O++]&63);{let n=cn[t];if(n)return n.read?(O++,n.read(ft())):n.noBuffer?(O++,n()):n(ue.subarray(O,++O));throw new Error("Unknown extension "+t)}case 213:return t=ue[O],t==114?(O++,jw(ue[O++]&63,ue[O++])):Ks(2);case 214:return Ks(4);case 215:return Ks(8);case 216:return Ks(16);case 217:return t=ue[O++],hr>=O?hs.slice(O-$n,(O+=t)-$n):ND(t);case 218:return t=je.getUint16(O),O+=2,hr>=O?hs.slice(O-$n,(O+=t)-$n):MD(t);case 219:return t=je.getUint32(O),O+=4,hr>=O?hs.slice(O-$n,(O+=t)-$n):TD(t);case 220:return t=je.getUint16(O),O+=2,Rw(t);case 221:return t=je.getUint32(O),O+=4,Rw(t);case 222:return t=je.getUint16(O),O+=2,Ew(t);case 223:return t=je.getUint32(O),O+=4,Ew(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 jD=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function x0(e,t){function n(){if(n.count++>Cw){let i;try{i=e.read=new Function("r","return function(){return "+(He.freezeData?"Object.freeze":"")+"({"+e.map(a=>a==="__proto__"?"__proto_:r()":jD.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(ft)}catch{return Cw=1/0,n()}return e.read0=i,e.highByte===0&&(e.read=_w(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?_w(t,n):n}const _w=(e,t)=>function(){let n=ue[O++];if(n===0)return t();let s=e<32?-(e+(n<<5)):e+(n<<5),i=Ne[s]||P_()[s];if(!i)throw new Error("Record id is not defined for "+s);return i.read||(i.read=x0(i,e)),i.read()};function P_(){let e=T_(()=>(ue=null,He.getStructures()));return Ne=He._mergeStructures(e,Ne)}var Mp=Fl,ND=Fl,MD=Fl,TD=Fl;function Fl(e){let t;if(e<16&&(t=v0(e)))return t;if(e>64&&Np)return Np.decode(ue.subarray(O,O+=e));const n=O+e,s=[];for(t="";O<n;){const i=ue[O++];if((i&128)===0)s.push(i);else if((i&224)===192){const a=ue[O++]&63,u=(i&31)<<6|a;u<128?s.push(65533):s.push(u)}else if((i&240)===224){const a=ue[O++]&63,u=ue[O++]&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[O++]&63,u=ue[O++]&63,f=ue[O++]&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 Rw(e){let t=new Array(e);for(let n=0;n<e;n++)t[n]=ft();return He.freezeData?Object.freeze(t):t}function Ew(e){if(He.mapsAsObjects){let t={};for(let n=0;n<e;n++){let s=j_();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 I_(e){let t=O,n=new Array(e);for(let s=0;s<e;s++){const i=ue[O++];if((i&128)>0){O=t;return}n[s]=i}return bt.apply(String,n)}function v0(e){if(e<4)if(e<2){if(e===0)return"";{let t=ue[O++];if((t&128)>1){O-=1;return}return bt(t)}}else{let t=ue[O++],n=ue[O++];if((t&128)>0||(n&128)>0){O-=2;return}if(e<3)return bt(t,n);let s=ue[O++];if((s&128)>0){O-=3;return}return bt(t,n,s)}else{let t=ue[O++],n=ue[O++],s=ue[O++],i=ue[O++];if((t&128)>0||(n&128)>0||(s&128)>0||(i&128)>0){O-=4;return}if(e<6){if(e===4)return bt(t,n,s,i);{let a=ue[O++];if((a&128)>0){O-=5;return}return bt(t,n,s,i,a)}}else if(e<8){let a=ue[O++],u=ue[O++];if((a&128)>0||(u&128)>0){O-=6;return}if(e<7)return bt(t,n,s,i,a,u);let f=ue[O++];if((f&128)>0){O-=7;return}return bt(t,n,s,i,a,u,f)}else{let a=ue[O++],u=ue[O++],f=ue[O++],d=ue[O++];if((a&128)>0||(u&128)>0||(f&128)>0||(d&128)>0){O-=8;return}if(e<10){if(e===8)return bt(t,n,s,i,a,u,f,d);{let h=ue[O++];if((h&128)>0){O-=9;return}return bt(t,n,s,i,a,u,f,d,h)}}else if(e<12){let h=ue[O++],m=ue[O++];if((h&128)>0||(m&128)>0){O-=10;return}if(e<11)return bt(t,n,s,i,a,u,f,d,h,m);let p=ue[O++];if((p&128)>0){O-=11;return}return bt(t,n,s,i,a,u,f,d,h,m,p)}else{let h=ue[O++],m=ue[O++],p=ue[O++],x=ue[O++];if((h&128)>0||(m&128)>0||(p&128)>0||(x&128)>0){O-=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[O++];if((v&128)>0){O-=13;return}return bt(t,n,s,i,a,u,f,d,h,m,p,x,v)}}else{let v=ue[O++],w=ue[O++];if((v&128)>0||(w&128)>0){O-=14;return}if(e<15)return bt(t,n,s,i,a,u,f,d,h,m,p,x,v,w);let C=ue[O++];if((C&128)>0){O-=15;return}return bt(t,n,s,i,a,u,f,d,h,m,p,x,v,w,C)}}}}}function Pw(){let e=ue[O++],t;if(e<192)t=e-160;else switch(e){case 217:t=ue[O++];break;case 218:t=je.getUint16(O),O+=2;break;case 219:t=je.getUint32(O),O+=4;break;default:throw new Error("Expected string")}return Fl(t)}function kg(e){return He.copyBuffers?Uint8Array.prototype.slice.call(ue,O,O+=e):ue.subarray(O,O+=e)}function Ks(e){let t=ue[O++];if(cn[t]){let n;return cn[t](ue.subarray(O,n=O+=e),s=>{O=s;try{return ft()}finally{O=n}})}else throw new Error("Unknown extension type "+t)}var Iw=new Array(4096);function j_(){let e=ue[O++];if(e>=160&&e<192){if(e=e-160,hr>=O)return hs.slice(O-$n,(O+=e)-$n);if(!(hr==0&&pr<180))return Mp(e)}else return O--,N_(ft());let t=(e<<5^(e>1?je.getUint16(O):e>0?ue[O]:0))&4095,n=Iw[t],s=O,i=O+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 O=s,n.string;i-=3,s=O}for(n=[],Iw[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?v0(e):I_(e);return f!=null?n.string=f:n.string=Mp(e)}function N_(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 jw=(e,t)=>{let n=ft().map(N_),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=x0(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 Nw={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null};cn[101]=()=>{let e=ft();if(!Nw[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return Nw[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(O-4);Lr||(Lr=new Map);let n=ue[O],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[O+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(O-4),n=Lr.get(t);return n.used=!0,n.target};cn[115]=()=>new Set(ft());const M_=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array");let $D=typeof globalThis=="object"?globalThis:window;cn[116]=e=>{let t=e[0],n=Uint8Array.prototype.slice.call(e,1).buffer,s=M_[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 $D[s](n)};cn[120]=()=>{let e=ft();return new RegExp(e[0],e[1])};const FD=[];cn[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=O;return O+=t-e.length,Rt=FD,Rt=[Pw(),Pw()],Rt.position0=0,Rt.position1=0,Rt.postBundlePosition=O,O=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 T_(e){let t=pr,n=O,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,O=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 Tp(){ue=null,Lr=null,Ne=null}const S0=new Array(147);for(let e=0;e<256;e++)S0[e]=+("1e"+Math.floor(45.15-e*.30103));var Bf=new ml({useRecords:!1});Bf.unpack;Bf.unpackMultiple;Bf.unpack;let LD=new Float32Array(1);new Uint8Array(LD.buffer,0,4);let _c;try{_c=new TextEncoder}catch{}let $p,Fp;const Ii=typeof Buffer<"u",sc=Ii?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,$_=Ii?Buffer:Uint8Array,Mw=Ii?4294967296:2144337920;let G,Pa,ze,D=0,zt,tt=null,OD;const AD=21760,DD=/[\u0080-\uFFFF]/,ri=Symbol("record-id");class zD extends ml{constructor(t){super(t),this.offset=0;let n,s,i,a,u=$_.prototype.utf8Write?function(P,H){return G.utf8Write(P,H,G.byteLength-H)}:_c&&_c.encodeInto?function(P,H){return _c.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 C=[],b=0,_=0;this.pack=this.encode=function(P,H){if(G||(G=new sc(8192),ze=G.dataView||(G.dataView=new DataView(G.buffer,0,8192)),D=0),zt=G.length-10,zt-D<2048?(G=new sc(G.length),ze=G.dataView||(G.dataView=new DataView(G.buffer,0,G.length)),zt=G.length-10,D=0):D=D+7&2147483640,n=D,H&HD&&(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[ri]=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)&&!Fp.some(q=>P instanceof q)?ae(P.toJSON?P.toJSON():P):R(P):R(P);let K=tt;if(tt&&$w(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>zt&&V(D),f.offset=D;let ee=UD(G.subarray(n,D),q);return a=null,ee}return f.offset=D,H&BD?(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=VD(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&qD&&(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,C.length>0&&(C=[]);else if(C.length>0&&!d){for(let H=0,X=C.length;H<X;H++)C[H][ri]=0;C=[]}},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>zt&&(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)>AD){let ee,M=(tt[0]?tt[0].length*3+tt[1].length:0)+10;D+M>zt&&(G=V(D+M));let J;tt.position?(J=tt,G[D]=200,D+=3,G[D++]=98,ee=D-n,D+=4,$w(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=DD.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>zt&&(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*S0[(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=$p.length;q<Y;q++){let se=Fp[q];if(P instanceof se){let ee=$p[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>zt&&V(D),{target:G,targetView:ze,position:D-ce}),R)}finally{M&&(G=M,ze=J,D=pe,zt=G.length-10)}he&&(he.length+D>zt&&V(he.length+D),D=Tw(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>zt&&V(q.length+D),D=Tw(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)},F=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},A=this.useRecords===!1?F: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[ri];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[ri];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])},T=typeof this.useRecords=="function"&&this.useRecords,U=T?P=>{T(P)?A(P):F(P)}:A,V=P=>{let H;if(P>16777216){if(P-n>Mw)throw new Error("Packed buffer would be larger than maximum buffer size");H=Math.min(Mw,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 sc(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,zt=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[ri]=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),C.length>=p&&(C.shift()[ri]=0),C.push(P),R(H))},te=(P,H,X,K)=>{let q=G,Y=D,se=zt,ee=n;G=Pa,D=0,n=0,G||(Pa=G=new sc(8192)),zt=G.length-10,Z(P,H,K),Pa=G;let M=D;if(G=q,D=Y,zt=se,n=ee,M>1){let J=D+M-1;J>zt&&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=OD(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=[])}}Fp=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,R_];$p=[{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?Cg(e,16,t):bg(Ii?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==$_&&this.moreTypes?Cg(e,M_.indexOf(n.name),t):bg(e,t)}},{pack(e,t){this.moreTypes?Cg(e,17,t):bg(Ii?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let{target:n,position:s}=t(1);n[s]=193}}];function Cg(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 bg(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 Tw(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 UD(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 $w(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 VD(e,t){return e.isCompatible=n=>{let s=!n||(t.lastNamedStructuresLength||0)===n.length;return s||t._mergeStructures(n),s},e}let F_=new zD({useRecords:!1});F_.pack;F_.pack;const BD=512,qD=1024,HD=2048;class w0 extends Un()("effect/rpc/RpcSerialization"){}const WD=w0.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)}}}),GD=Vm(w0)(WD),KD=e=>Ar(()=>{const t=new Set,n=new Map,s=new Map;let i=(a,u)=>gb(f=>{let d=n.get(a);return d||(d=[],n.set(a,d)),d.push([u,f]),st});return So(e((a,u)=>{const f=s.get(a);return f?f(u):i(a,u)},t),a=>({...a,run(u,f){return gp(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*ao(Ar(()=>f(h)),m)}return yield*yb(IL,()=>(t.delete(u),s.delete(u),st))})}}))});let QD=BigInt(0);const JD=lo(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)??(()=>QD++),u=yield*qc(),f=io(u,DS),d=new Map;let h=!1;yield*tL(f,Bc(E=>(h=!0,m(WF(E.id)))));const m=lo(function*(E){for(const[j,R]of d)d.delete(j),R._tag==="Queue"?yield*E._tag==="Success"?iw(R.queue):Oa(R.queue,E.cause):R.resume(E)}),p=E=>{const j=S_(E.successSchema),R=w(E);return(F,A)=>{const T=A!=null&&A.headers?iD(A.headers):p0,U=(A==null?void 0:A.context)??er();if(!j){const Z=te=>x(E,R,te,E.payloadSchema.make(F),T,U,(A==null?void 0:A.discard)??!1);return i?Z(void 0):YL(`${n}.${E._tag}`,{attributes:t.spanAttributes},Z)}const V=v(E,R,E.payloadSchema.make(F),T,(A==null?void 0:A.streamBufferSize)??16,U);return A!=null&&A.asQueue?V:DA(So(V,AA))}},x=(E,j,R,F,A,T,U)=>Bc(V=>{if(h)return pp;const Z=a(),te=j(P=>t.onFromClient({message:P,context:T,discard:U}),{_tag:"Request",id:Z,tag:E._tag,payload:F,...R?{traceId:R.traceId,spanId:R.spanId,sampled:R.sampled}:{},headers:vw(V.getRef(Lw),A)});if(U)return te;let ae;return QL(HS(P=>{const H={_tag:"Effect",rpc:E,context:T,resume(X){P(X),ae&&!ae.pollUnsafe()&&V.currentDispatcher.scheduleTask(()=>{ae.interruptUnsafe(V.id)},0)}};d.set(Z,H),ae=te.pipe(R?GS(R,{captureStackTrace:!1}):_e,Hc(V.context)),ae.addObserver(X=>{if(X._tag==="Failure")return P(X)})}),P=>(d.delete(Z),TL(La(ae),C(Z,Array.from(P),T))))}),v=lo(function*(E,j,R,F,A,T){if(h)return yield*pp;const U=i?void 0:yield*JL(`${n}.${E._tag}`,{attributes:t.spanAttributes}),V=Cp(),Z=a(),te=kf(V.context,DS);yield*eL(te,P=>d.has(Z)?(d.delete(Z),C(Z,eb(P)?Array.from(VF(P.cause)):[],T)):st);const ae=yield*L3(A);return d.set(Z,{_tag:"Queue",rpc:E,queue:ae,scope:te,context:T}),yield*j(P=>t.onFromClient({message:P,context:T,discard:!1}),{_tag:"Request",id:Z,tag:E._tag,payload:R,...U?{traceId:U.traceId,spanId:U.spanId,sampled:U.sampled}:{},headers:vw(V.getRef(Lw),F)}).pipe(U?GS(U,{captureStackTrace:!1}):_e,dl(P=>Oa(ae,P)),Hm,XL(te,{startImmediately:!0})),ae}),w=E=>{const j=[];for(const R of E.middlewares.values()){const F=u.mapUnsafe.get(`${R.key}/Client`);F&&j.push(F)}return j.length===0?(R,F)=>R(F):function R(F,A,T=j.length-1){return T===-1?F(A):j[T]({rpc:E,request:A,next(U){return R(F,U,T-1)}})}},C=(E,j,R)=>HS(F=>{const A=Cp();t.onFromClient({message:{_tag:"Interrupt",requestId:E,interruptors:j},context:R,discard:!1}).pipe(DL(1e3),Hc(A.context)).addObserver(()=>{F(st)})}),b=E=>{switch(E._tag){case"Chunk":{const j=E.requestId,R=d.get(j);return!R||R._tag!=="Queue"?st:O3(R.queue,E.values).pipe(s?zn(()=>t.onFromClient({message:{_tag:"Ack",requestId:E.requestId},context:R.context,discard:!1})):_e,dl(F=>Oa(R.queue,F)))}case"Exit":{const j=E.requestId,R=d.get(j);return R?(d.delete(j),R._tag==="Effect"?(R.resume(E.exit),st):E.exit._tag==="Success"?iw(R.queue):Oa(R.queue,E.exit.cause)):st}case"Defect":return m(HF(E.defect));case"ClientEnd":return st}};let _;if(t.flatten){const E=new Map;_=function(R,F,A){let T=E.get(R);return T||(T=p(e.requests.get(R)),E.set(R,T)),T(F,A)}}else _={},e.requests.forEach(E=>{_[E._tag]=p(E)});return{client:_,write:b}});let YD=0;const XD=lo(function*(e,t){const n=YD++,{run:s,send:i,supportsAck:a,supportsTransferables:u}=yield*qf,f=new Map,{client:d,write:h}=yield*JD(e,{...t,supportsAck:a,onFromClient({message:m}){switch(m._tag){case"Request":{const p=e.requests.get(m.tag),x=u?kD():void 0,v=Cp(),w={rpc:p,context:x?Is(v.context,__,x):v.context,schemas:ZD(p)};return f.set(m.id,w),w.schemas.encodePayload(m.payload).pipe(ao(w.context),Sc,zn(C=>i(n,{...m,id:String(m.id),payload:C,headers:Object.entries(m.headers)},x&&x.readUnsafe())))}case"Ack":return f.get(m.requestId)?i(n,{_tag:"Ack",requestId:String(m.requestId)}):st;case"Interrupt":return f.get(m.requestId)?(f.delete(m.requestId),i(n,{_tag:"Interrupt",requestId:String(m.requestId)})):st;case"Eof":return st}}});return yield*s(n,m=>{switch(m._tag){case"Chunk":{const p=nc(m.requestId),x=f.get(p);return!x||xo(x.schemas.decodeChunk)?st:x.schemas.decodeChunk.value(m.values).pipe(ao(x.context),Sc,zn(v=>h({_tag:"Chunk",clientId:0,requestId:nc(m.requestId),values:v})),KL(v=>h({_tag:"Exit",clientId:0,requestId:nc(m.requestId),exit:Va(v)})))}case"Exit":{const p=nc(m.requestId),x=f.get(p);return x?(f.delete(p),x.schemas.decodeExit(m.exit).pipe(ao(x.context),Sc,VL({onSuccess:v=>h({_tag:"Exit",clientId:0,requestId:p,exit:v}),onFailure:v=>h({_tag:"Exit",clientId:0,requestId:p,exit:Va(v)})}))):st}case"Defect":return h({_tag:"Defect",clientId:0,defect:r4(m.defect)});case"ClientProtocolError":{const p=Il(m.error);return fb(f.keys(),x=>h({_tag:"Exit",clientId:0,requestId:x,exit:p}))}default:return st}}).pipe(dl(iO),Hm,Wm),d}),Fw=new WeakMap,ZD=e=>{let t=Fw.get(e);if(t!==void 0)return t;const n=w_(e.successSchema);return t={decodeChunk:xm(n,s=>uw(xg(mA(s.success)))),encodePayload:hA(xg(e.payloadSchema)),decodeExit:uw(xg(tD(e)))},Fw.set(e,t),t},Lw=Xe("effect/rpc/RpcClient/CurrentHeaders",{defaultValue:()=>p0});class qf extends Un()("effect/rpc/RpcClient/Protocol"){}L(qf,"make",KD);const e4=e=>qf.make(lo(function*(t,n){const s=yield*y0,i=yield*w0,a=yield*qL(Lp),u=new Map,f=yield*s.writer;let d=i.makeUnsafe();const h=yield*n4(f(d.encode(PD)));let m;const p=Ar(()=>(m=void 0,ks(a)?a.value.onConnect:st)),x=v=>fb(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 C=0;return db({while:()=>C<w.length,body:()=>{const b=w[C++];if(b._tag==="Pong")return h.onPong(),st;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:Sl})}catch(w){return x({_tag:"ClientProtocolError",error:new ww({reason:new jp({message:"Error decoding message",cause:w})})})}},{onOpen:p}).pipe(hb(zn(h.timeout,()=>Ke(new gi({reason:new nf({kind:"Timeout",cause:new Error("ping timeout")})}))))))).pipe(zn(()=>Ke(new gi({reason:new rf({code:1e3})}))),ks(a)?mb(a.value.onDisconnect):_e,LL(v=>{const w=Pl(v),C=vM(w);return C&&w.success.reason._tag==="SocketOpenError"?st:(m=new ww({reason:C?w.success.reason:new jp({message:"Unknown socket error",cause:XC(v)})}),x({_tag:"ClientProtocolError",error:m}))}),OL((e==null?void 0:e.retryPolicy)??t4),aO({module:"RpcClient",method:"makeProtocolSocket"}),Wm),{send(v,w){if(m)return Ke(m);w._tag==="Request"&&u.set(w.id,v);const C=d.encode(w);return C===void 0?st:Sc(f(C))},supportsAck:!0,supportsTransferables:!1}})),t4=xL(500,1.5).pipe(mL(ub(5e3))),n4=lo(function*(e){let t=!0;const n=t_(),s=()=>{t=!0,n.closeUnsafe()},i=()=>{t=!0};return yield*Ar(()=>t?(t=!1,e):n.open).pipe(UL("5 seconds"),AL,xb,Hm,Wm),{timeout:n.await,reset:s,onPong:i}});class Lp extends Un()("effect/rpc/RpcClient/ConnectionHooks"){}const r4=fA(or),s4={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 gp(function*(){const n=yield*qc(),s=di(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 dp(this.toHandlers(e))},of:_e,toLayerHandler(e,t){const n=this;return dp(gp(function*(){const s=yield*qc(),i=di(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 gb(t=>{const n=this.requests.get(e),{handler:s,context:i}=t.mapUnsafe.get(n.key);return nt((a,u)=>{u.rpc=n;const f=s(a,u),d=rD(f)?f.value:f;return di(d)?BL(d,i):zA(d,i)})})},annotate(e,t){return jr({requests:this.requests,annotations:Is(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(Si(e,t))},annotateMerge(e){return jr({requests:this.requests,annotations:wi(this.annotations,e)})},annotateRpcsMerge(e){const t=new Map;for(const[n,s]of this.requests)t.set(n,s.annotateMerge(wi(e,s.annotations)));return jr({requests:t,annotations:this.annotations})}},jr=e=>Object.assign(function(){},s4,{requests:e.requests,annotations:e.annotations}),o4=(...e)=>jr({requests:new Map(e.map(t=>[t._tag,t])),annotations:er()}),i4="/ws",Fn={getConfig:"tokmon.getConfig",setConfig:"tokmon.setConfig",refresh:"tokmon.refresh",browseFs:"tokmon.browseFs",snapshot:"tokmon.snapshot",config:"tokmon.config"},a4=Ss(["all","summary","table","billing","peak"]),Op=Ss(za),l4=Pt({id:gt,providerId:Op,name:gt,homeDir:gt,color:Xc(gt)}),L_=()=>a_,u4=Pt({interval:Zc,billingInterval:Zc,clearScreen:Rp,timezone:Ep(gt),accounts:yg(hi(l4)),activeAccountId:Ep(gt),disabledProviders:yg(hi(Op)),onboarded:Rp,dashboardLayout:Ss(["grid","single"]),defaultFocus:Ss(["all","last"]),ascii:Ss(["auto","on","off"]),knownProviders:yg(hi(Op))}),k0=L_(),c4=Pt({name:gt,path:gt,dir:Rp}),f4=Pt({path:gt,parent:Ep(gt),entries:hi(c4)}),d4=L_(),C0=Pt({}),h4=Ti(Fn.getConfig,{payload:C0,success:k0}),g4=Ti(Fn.setConfig,{payload:u4,success:k0}),p4=Ti(Fn.refresh,{payload:Pt({scope:a4}),success:ef}),m4=Ti(Fn.browseFs,{payload:Pt({path:gt}),success:f4}),y4=Ti(Fn.snapshot,{payload:C0,success:d4,stream:!0}),x4=Ti(Fn.config,{payload:C0,success:k0,stream:!0}),v4=o4(h4,g4,p4,m4,y4,x4);class oc extends Un()("tokmon/client/DaemonRpcClient/TokmonRpcClient"){}const S4=new Function("specifier","return import(specifier)");function w4(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=i4,t&&s.searchParams.set("wsToken",t),s.toString()}function k4(e){return e==="node"?!0:e==="browser"?!1:typeof window>"u"}async function C4(e,t){return k4(t)?(await S4("@effect/platform-node/NodeSocket")).layerWebSocket(e):wD(e).pipe(hp(xD))}function b4(e){const t=e.reconnectAttempts??5,n=e.reconnectBaseDelayMs??250;return pL(SL(t),s=>nt(Ac(Math.min(n*(s+1),2500))))}function _4(e,t={}){const n=w4(e,t.wsToken),s=new Set;let i=null,a=null,u=!1;const f=(x,v)=>{var w;(w=t.onConn)==null||w.call(t,x,v)},d=async()=>{const x=await C4(n,t.transport),v=Vm(Lp,Lp.of({onConnect:Ln(()=>{f("live")}),onDisconnect:Ln(()=>{u||f("reconnecting")})}));return fp(qf,e4({retryPolicy:b4(t)})).pipe(hp(sb(x,GD,v)))},h=async()=>{if(u)throw new Error("daemon RPC client is closed");return i||a||(f("connecting"),a=(async()=>{let x;try{const v=await d(),w=fp(oc,XD(v4)).pipe(hp(v));if(x=YA(w),await x.runPromise(oc.asEffect()),u)throw await x.dispose(),new Error("daemon RPC client is closed");return i={runtime:x},i}catch(v){throw a=null,await(x==null?void 0:x.dispose().catch(()=>{})),u||f("error",v),v}})(),a)},m=async x=>{const v=await h();try{return await v.runtime.runPromise(oc.use(w=>x(w)))}catch(w){throw u||f("error",w),w}},p=(x,v)=>{if(u)return()=>{};let w=null,C=!1;return(async()=>{try{const b=await h();if(u||C)return;w=b.runtime.runFork(oc.use(_=>x(_).pipe(UA(E=>Ln(()=>{try{v(E)}catch{}})))).pipe(dl(_=>Ln(()=>{!u&&!C&&f("error",XC(_))})))),s.add(w),w.addObserver(()=>{w&&s.delete(w)})}catch(b){!u&&!C&&f("error",b)}})(),()=>{C=!0,w&&(s.delete(w),((i==null?void 0:i.runtime.runPromise(La(w)))??qa(La(w))).catch(()=>{}))}};return{getConfig:()=>m(x=>x[Fn.getConfig]({})),setConfig:x=>m(v=>v[Fn.setConfig](x)),refresh:(x="all")=>m(v=>v[Fn.refresh]({scope:x})),browseFs:x=>m(v=>v[Fn.browseFs]({path:x})),subscribeSnapshot:x=>p(v=>v[Fn.snapshot]({}),x),subscribeConfig:x=>p(v=>v[Fn.config]({}),x),async close(){if(u)return;u=!0,f("closed");const x=[...s];s.clear();const v=i??await(a==null?void 0:a.catch(()=>null))??null;await Promise.all(x.map(w=>((v==null?void 0:v.runtime.runPromise(La(w)))??qa(La(w))).catch(()=>{}))),i=null,a=null,v&&await v.runtime.dispose().catch(()=>{})}}}let _g=null;const Ap=new Set;function R4(e){if(e!=="closed")for(const t of Ap)t(e)}function Ll(){return _g||(_g=_4(window.location.origin,{transport:"browser",onConn:R4})),_g}function E4(e){return Ap.add(e),()=>{Ap.delete(e)}}async function P4(){return om(await Ll().getConfig())}async function I4(e){return om(await Ll().setConfig(e))}async function j4(e){return Ll().browseFs(e)}function N4(e){return Ll().subscribeConfig(t=>{e(om(t))})}const ot="focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",Ow='button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])';function O_(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(Ow);(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(Ow),x=Array.from(p).filter(C=>C.offsetParent!==null||C===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 Aw(e,t={}){return{mode:"add",editingId:null,providerId:t.providerId??ol[0],name:t.name??"",homeDir:t.homeDir??"~",color:t.color??lN(e.accounts)}}function M4(e){return{mode:"edit",editingId:e.id,providerId:e.providerId,name:e.name,homeDir:e.homeDir,color:e.color||oo[e.providerId].color}}function T4(e,t){const n=e.mode==="edit"?t.filter(s=>s.id!==e.editingId):t;return e.mode==="edit"?e.editingId??"":Sk(e.name.trim()||"account",n)}function $4(e,t){const n=e.name.trim(),s=e.homeDir.trim()||"~";return n?e.mode==="add"?{ok:!0,account:{id:Sk(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 b0({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 ic({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 Dw({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 ${ot}`,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 ${ot} [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 ${ot}`,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 ${ot} ${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 F4({draft:e,patch:t}){return y.jsxs(b0,{title:"General",children:[y.jsx(Qs,{label:"Refresh interval",hint:"dashboard poll, seconds",children:y.jsx(Dw,{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(Dw,{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(L4,{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 L4({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=im(f);s(d);const h=d.trim();if(!h){a(!1),t(null);return}vk(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 ${ot} ${i?"border-warning":"border-line"}`}),i&&y.jsx("span",{className:"text-[10px] text-warning",children:"invalid timezone"})]})}function O4({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(b0,{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 ${ot} ${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(mi,{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 A4(e,t){return t?t.accounts.find(n=>n.id===e.id)??null:null}function D4({draft:e,patch:t,snapshot:n,onEdit:s,onConfigure:i,onAdd:a}){const u=iN(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(b0,{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 ${ot}`,children:[y.jsx(Kj,{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=A4(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,C=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 ${ot}`,style:{borderColor:C},children:b&&y.jsx("span",{className:"size-2 rounded-full",style:{background:C}})}),y.jsx("span",{className:"size-2.5 shrink-0 rounded-full",style:{background:C},"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(sk,{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(tm,{className:"size-3.5"})}),y.jsx(Ia,{label:"Edit account",onClick:()=>s(m),children:y.jsx(rS,{className:"size-3.5"})}),y.jsx(Ia,{label:"Delete account",danger:!0,onClick:()=>d(m.id),children:y.jsx(Qj,{className:"size-3.5"})})]}):y.jsx(Ia,{label:"Configure account",onClick:()=>i(m),children:y.jsx(rS,{className:"size-3.5"})})})]},`${m.source}:${m.id}`)})})})}function z4(e){const t=(e??"").trim();return t.length>0?t:"~"}function Rg(e){const t=(e??"").trim();return t.length>0?t:"~"}function U4(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 V4({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);O_(a,{active:!0,onEscape:s,initialFocusRef:u});const m=T4(e,t),p=()=>{const x=$4(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(ic,{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 ${ot} ${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(ic,{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:im(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 ${ot}`})}),y.jsx(ic,{label:"Home directory",hint:"path containing the tool's data dir · ~ for default",children:y.jsx(B4,{value:e.homeDir,onChange:x=>n({...e,homeDir:x}),onEnter:p})}),y.jsx(ic,{label:"Accent color",hint:"shows on dashboard, account strip, borders",children:y.jsx("div",{className:"flex flex-wrap gap-1.5",children:oN.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 ${ot} ${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 ${ot}`,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] ${ot}`,children:[y.jsx(mi,{className:"size-3.5"})," ",e.mode==="add"?"Add account":"Save account"]})]})]})})}function B4({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 A=>{const T=++v.current,U=z4(A);d(U),m(!0),x(null);try{const V=await j4(U);if(T!==v.current)return;u(V)}catch(V){if(T!==v.current)return;u(null),x(V instanceof Error?V.message:"cannot read folder")}finally{T===v.current&&m(!1)}},[]);z.useEffect(()=>()=>{v.current++},[]);const C=()=>{i(!0),w(e)},b=()=>{v.current++,i(!1),m(!1),x(null)},_=A=>{h||w(A)},E=()=>{!a||h||(t(Rg(a.path)),b())},j=a?U4(a):[],R=j.filter(A=>A.kind==="entry"),F=Rg((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(rg,{className:"size-4 shrink-0 text-fg-faint"}),y.jsx("input",{type:"text",value:e,placeholder:"~",spellCheck:!1,onChange:A=>{b(),t(im(A.target.value))},onKeyDown:A=>{A.key==="Enter"&&n()},className:`min-w-0 flex-1 bg-transparent py-1.5 font-mono text-sm text-fg ${ot}`})]}),y.jsxs("button",{type:"button",onClick:C,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 ${ot}`,children:[y.jsx(tm,{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(rg,{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:F,children:F}),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 ${ot}`,children:y.jsx(yi,{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 ",Rg(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 ${ot}`,children:"retry"})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"max-h-56 overflow-y-auto py-1",children:[j.map(A=>y.jsxs("button",{type:"button",onClick:()=>_(A.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 ${ot} ${A.kind==="parent"?"text-fg-dim":"text-fg"}`,children:[A.kind==="parent"?y.jsx(sk,{className:"size-3.5 shrink-0"}):y.jsx(rg,{className:"size-3.5 shrink-0 text-fg-faint"}),y.jsx("span",{className:"min-w-0 truncate font-mono",children:A.label})]},A.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 ${ot}`,children:[y.jsx(mi,{className:"size-3.5"})," Select this folder"]})})]})]})]})}const q4=[{value:"general",label:"General"},{value:"providers",label:"Providers"},{value:"accounts",label:"Accounts"}];function H4({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),[C,b]=z.useState("general");z.useEffect(()=>{let j=!0;return P4().then(R=>{j&&i(R)}).catch(R=>{j&&u(R instanceof Error?R.message:"load failed")}),()=>{j=!1}},[]),z.useEffect(()=>{if(!p)return N4(j=>{p||i(j)})},[p]),O_(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 I4(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 ${ot}`,children:y.jsx(yi,{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:q4,value:C,onChange:b,containerClassName:"flex items-center overflow-hidden rounded border border-line bg-bg-1",btnClassName:"px-3 py-1.5 text-[11px] transition"})}),C==="general"&&y.jsx(F4,{draft:s,patch:_}),C==="providers"&&y.jsx(O4,{draft:s,patch:_}),C==="accounts"&&y.jsx(D4,{draft:s,patch:_,snapshot:t,onEdit:j=>w(M4(j)),onConfigure:j=>w(Aw(s,{providerId:j.providerId,name:j.name,homeDir:j.homeDir,color:j.color})),onAdd:()=>w(Aw(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 ${ot}`,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 ${ot}`,children:[y.jsx(mi,{className:"size-3.5"})," ",f?"saving…":"save"]})]})]}),v&&s&&y.jsx(V4,{editor:v,accounts:s.accounts,onChange:w,onCancel:()=>w(null),onSubmit:(j,R,F)=>{_(A=>R==="add"?{...A,accounts:[...A.accounts,j]}:{...A,accounts:A.accounts.map(T=>T.id===F?j:T)}),w(null)}})]})}const W4="modulepreload",G4=function(e,t){return new URL(e,t).href},zw={},A_=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=G4(m,s),m in zw)return;zw[m]=!0;const p=m.endsWith(".css"),x=p?'[rel="stylesheet"]':"";if(!!s)for(let C=f.length-1;C>=0;C--){const b=f[C];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":W4,p||(w.as="script"),w.crossOrigin="",w.href=m,h&&w.setAttribute("nonce",h),document.head.appendChild(w),p)return new Promise((C,b)=>{w.addEventListener("load",C),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 Hf({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(K4,{getNode:()=>f.current,name:s})}),y.jsx("div",{className:`p-4 ${u}`,children:i})]})}function K4({getNode:e,name:t}){const n=xk();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(zj,{className:"size-3.5"})})}function Q4({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 J4({accounts:e,nameOf:t}){return e.length===0?y.jsx(Hf,{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(Y4,{account:n,index:s,providerName:t(n.providerId)},n.id))})}function Y4({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=_j(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(Eg,{label:"today",cost:s.today.cost,tokens:s.today.tokens}),y.jsx(Eg,{label:"week",cost:s.week.cost,tokens:s.week.tokens}),y.jsx(Eg,{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(C=>y.jsx(Z4,{metric:C},C.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(C=>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(C.name)}),y.jsxs("span",{className:"tnum shrink-0 text-cost",children:[Ue(C.usd),y.jsxs("span",{className:"ml-1.5 text-fg-faint",children:[bs(C.requests)," req"]})]})]},C.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 Eg({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 X4(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 Z4({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:[X4(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 ez=[0,.32,.55,.78,1],Uw=e=>e===0?"var(--color-bg-2)":`color-mix(in oklab, var(--color-cost) ${ez[e]*100}%, var(--color-bg-2))`,D_=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function tz(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(vl(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 nz(e,t,n){const s=new Map(e.map(C=>[C.date,n(C)]));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=C=>{if(C<=0||d<=0)return 0;const b=C/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 C=f;C<=u;C+=ds){const b=vl(C),_=rl(C);_===0&&p.some(Boolean)&&(m.push(p),p=new Array(7).fill(null),w++);const E=new Date(C).getUTCMonth();E!==v&&_===0&&(x.push({col:w,text:Ej[E]}),v=E);const j=C>=$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 rz({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(C=>[C.date,C])),[e.calendar]),h=z.useMemo(()=>e.calendar.some(C=>C.cost>0),[e.calendar]),m=C=>h?C.cost:C.tokens,p=z.useMemo(()=>tz(e.calendar,m),[e,h]),x=z.useMemo(()=>nz(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(Hf,{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((C,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((C,b)=>y.jsx("div",{className:"flex flex-1 items-center",children:C},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((C,b)=>y.jsx("div",{className:"flex flex-col gap-[3px]",children:C.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:Uw(_.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(C=>y.jsx("span",{className:"size-[11px] rounded-[2px]",style:{background:Uw(C)}},C)),"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(Zu,{label:"busiest day",value:p.costed?Ue(p.top.cost):wn(p.top.tokens),sub:tl(p.top.date),valueClass:"text-cost"}),y.jsx(Zu,{label:"daily average",value:p.costed?Ue(p.avg):wn(p.avg),sub:`across ${p.active} active days`}),y.jsx(Zu,{label:"top weekday",value:D_[p.busiest],valueClass:"text-fg-bright"}),y.jsx(Zu,{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(sz,{day:f,pinned:!s&&f===a})})]})]})})})}function sz({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:[D_[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:em(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 oz=[{value:"cost",label:"cost"},{value:"tokens",label:"tokens"},{value:"calls",label:"calls"}],Vw="1.75rem minmax(6rem,12rem) minmax(3.5rem,1fr) 3rem 5.5rem 5rem auto auto auto";function iz({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(Hf,{title:"model leaderboard",titleTag:n,captureName:"models",right:y.jsx(Sn,{options:oz,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(J2,{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:Vw},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:Vw},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:X1(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 az(){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 Wf(e){return e instanceof Function}function lz(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function uz(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,C)=>{for(w=String(w);w.length<C;)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 cz(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 fz(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 C of d.split(".")){var w;v=(w=v)==null?void 0:w[C]}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(C=>C.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 Ut="debugHeaders";function Bw(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 dz={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 ac(t,[...f,...h,...d],e)},we(e.options,Ut)),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))),ac(t,n,e,"center")),we(e.options,Ut)),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 ac(t,a,e,"left")},we(e.options,Ut)),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 ac(t,a,e,"right")},we(e.options,Ut)),e.getFooterGroups=Se(()=>[e.getHeaderGroups()],t=>[...t].reverse(),we(e.options,Ut)),e.getLeftFooterGroups=Se(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),we(e.options,Ut)),e.getCenterFooterGroups=Se(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),we(e.options,Ut)),e.getRightFooterGroups=Se(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),we(e.options,Ut)),e.getFlatHeaders=Se(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),we(e.options,Ut)),e.getLeftFlatHeaders=Se(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),we(e.options,Ut)),e.getCenterFlatHeaders=Se(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),we(e.options,Ut)),e.getRightFlatHeaders=Se(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),we(e.options,Ut)),e.getCenterLeafHeaders=Se(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),we(e.options,Ut)),e.getLeftLeafHeaders=Se(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),we(e.options,Ut)),e.getRightLeafHeaders=Se(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),we(e.options,Ut)),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,Ut))}};function ac(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 C;(C=w.columns)!=null&&C.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:[]},C=[];x.forEach(b=>{const _=[...C].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 F=Bw(n,j,{id:[s,v,j.id,b==null?void 0:b.id].filter(Boolean).join("_"),isPlaceholder:R,placeholderId:R?`${C.filter(A=>A.column===j).length}`:void 0,depth:v,index:C.length});F.subHeaders.push(b),C.push(F)}w.headers.push(b),b.headerGroup=w}),d.push(w),v>0&&h(C,v-1)},m=t.map((x,v)=>Bw(n,x,{depth:u,index:v}));h(m,u-1),d.reverse();const p=x=>x.filter(w=>w.column.getIsVisible()).map(w=>{let C=0,b=0,_=[0];w.subHeaders&&w.subHeaders.length?(_=[],p(w.subHeaders).forEach(j=>{let{colSpan:R,rowSpan:F}=j;C+=R,_.push(F)})):C=1;const E=Math.min(..._);return b=b+E,w.colSpan=C,w.rowSpan=b,{colSpan:C,rowSpan:b}});return p((i=(a=d[0])==null?void 0:a.headers)!=null?i:[]),d}const _0=(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:()=>uz(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=>cz(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},hz={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()}}},z_=(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))};z_.autoRemove=e=>Yn(e);const U_=(e,t,n)=>{var s;return!!(!((s=e.getValue(t))==null||(s=s.toString())==null)&&s.includes(n))};U_.autoRemove=e=>Yn(e);const V_=(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())};V_.autoRemove=e=>Yn(e);const B_=(e,t,n)=>{var s;return(s=e.getValue(t))==null?void 0:s.includes(n)};B_.autoRemove=e=>Yn(e);const q_=(e,t,n)=>!n.some(s=>{var i;return!((i=e.getValue(t))!=null&&i.includes(s))});q_.autoRemove=e=>Yn(e)||!(e!=null&&e.length);const H_=(e,t,n)=>n.some(s=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(s)});H_.autoRemove=e=>Yn(e)||!(e!=null&&e.length);const W_=(e,t,n)=>e.getValue(t)===n;W_.autoRemove=e=>Yn(e);const G_=(e,t,n)=>e.getValue(t)==n;G_.autoRemove=e=>Yn(e);const R0=(e,t,n)=>{let[s,i]=n;const a=e.getValue(t);return a>=s&&a<=i};R0.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]};R0.autoRemove=e=>Yn(e)||Yn(e[0])&&Yn(e[1]);const Nr={includesString:z_,includesStringSensitive:U_,equalsString:V_,arrIncludes:B_,arrIncludesAll:q_,arrIncludesSome:H_,equals:W_,weakEquals:G_,inNumberRange:R0};function Yn(e){return e==null||e===""}const gz={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 Wf(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(qw(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(qw(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 qw(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const pz=(e,t,n)=>n.reduce((s,i)=>{const a=i.getValue(e);return s+(typeof a=="number"?a:0)},0),mz=(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},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,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]},vz=(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},Sz=(e,t)=>{if(!t.length)return;const n=t.map(a=>a.getValue(e));if(!lz(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},wz=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),kz=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,Cz=(e,t)=>t.length,Pg={sum:pz,min:mz,max:yz,extent:xz,mean:vz,median:Sz,unique:wz,uniqueCount:kz,count:Cz},bz={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 Pg.sum;if(Object.prototype.toString.call(s)==="[object Date]")return Pg.extent},e.getAggregationFn=()=>{var n,s;if(!e)throw new Error;return Wf(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:Pg[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 _z(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 Rz={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 _z(a,n,s)},we(e.options,"debugTable"))}},Ig=()=>({left:[],right:[]}),Ez={getInitialState:e=>({columnPinning:Ig(),...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?Ig():(n=(s=e.initialState)==null?void 0:s.columnPinning)!=null?n:Ig())},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 Pz(e){return e||(typeof document<"u"?document:null)}const lc={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},jg=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Iz={getDefaultColumnDef:()=>lc,getInitialState:e=>({columnSizing:{},columnSizingInfo:jg(),...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:lc.minSize,(s=a??e.columnDef.size)!=null?s:lc.size),(i=e.columnDef.maxSize)!=null?i:lc.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(),Ng(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=Ng(a)?Math.round(a.touches[0].clientX):a.clientX,h={},m=(_,E)=>{typeof E=="number"&&(t.setColumnSizingInfo(j=>{var R,F;const A=t.options.columnResizeDirection==="rtl"?-1:1,T=(E-((R=j==null?void 0:j.startOffset)!=null?R:0))*A,U=Math.max(T/((F=j==null?void 0:j.startSize)!=null?F: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:T,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=Pz(n),w={moveHandler:_=>p(_.clientX),upHandler:_=>{v==null||v.removeEventListener("mousemove",w.moveHandler),v==null||v.removeEventListener("mouseup",w.upHandler),x(_.clientX)}},C={moveHandler:_=>(_.cancelable&&(_.preventDefault(),_.stopPropagation()),p(_.touches[0].clientX),!1),upHandler:_=>{var E;v==null||v.removeEventListener("touchmove",C.moveHandler),v==null||v.removeEventListener("touchend",C.upHandler),_.cancelable&&(_.preventDefault(),_.stopPropagation()),x((E=_.touches[0])==null?void 0:E.clientX)}},b=jz()?{passive:!1}:!1;Ng(a)?(v==null||v.addEventListener("touchmove",C.moveHandler,b),v==null||v.addEventListener("touchend",C.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?jg():(n=e.initialState.columnSizingInfo)!=null?n:jg())},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 uc=null;function jz(){if(typeof uc=="boolean")return uc;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 uc=e,uc}function Ng(e){return e.type==="touchstart"}const Nz={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 Mz={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()}}},Tz={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 Wf(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)}}},$z={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()}}}},Dp=0,zp=10,Mg=()=>({pageIndex:Dp,pageSize:zp}),Fz={getInitialState:e=>({...e,pagination:{...Mg(),...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?Mg():(i=e.initialState.pagination)!=null?i:Mg())},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?Dp:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageIndex)!=null?i:Dp)},e.resetPageSize=s=>{var i,a;e.setPageSize(s?zp:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageSize)!=null?i:zp)},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}}},Tg=()=>({top:[],bottom:[]}),Lz={getInitialState:e=>({rowPinning:Tg(),...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(C=>!(f!=null&&f.has(C))),bottom:[...((x=d==null?void 0:d.bottom)!=null?x:[]).filter(C=>!(f!=null&&f.has(C))),...Array.from(f)]}}if(n==="top"){var v,w;return{top:[...((v=d==null?void 0:d.top)!=null?v:[]).filter(C=>!(f!=null&&f.has(C))),...Array.from(f)],bottom:((w=d==null?void 0:d.bottom)!=null?w:[]).filter(C=>!(f!=null&&f.has(C)))}}return{top:((h=d==null?void 0:d.top)!=null?h:[]).filter(C=>!(f!=null&&f.has(C))),bottom:((m=d==null?void 0:d.bottom)!=null?m:[]).filter(C=>!(f!=null&&f.has(C)))}})},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?Tg():(n=(s=e.initialState)==null?void 0:s.rowPinning)!=null?n:Tg())},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"))}},Oz={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=>{Up(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?$g(e,n):{rows:[],flatRows:[],rowsById:{}},we(e.options,"debugTable")),e.getFilteredSelectedRowModel=Se(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?$g(e,n):{rows:[],flatRows:[],rowsById:{}},we(e.options,"debugTable")),e.getGroupedSelectedRowModel=Se(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?$g(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 Up(f,e.id,n,(u=s==null?void 0:s.selectChildren)!=null?u:!0,t),f})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return E0(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return Vp(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return Vp(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)}}}},Up=(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=>Up(e,f.id,n,s,i))};function $g(e,t){const n=e.getState().rowSelection,s=[],i={},a=function(u,f){return u.map(d=>{var h;const m=E0(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 E0(e,t){var n;return(n=t[e.id])!=null?n:!1}function Vp(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()&&(E0(u,t)?a=!0:i=!1),u.subRows&&u.subRows.length)){const f=Vp(u,t);f==="all"?a=!0:(f==="some"&&(a=!0),i=!1)}}),i?"all":a?"some":!1}const Bp=/([0-9]+)/gm,Az=(e,t,n)=>K_(Cs(e.getValue(n)).toLowerCase(),Cs(t.getValue(n)).toLowerCase()),Dz=(e,t,n)=>K_(Cs(e.getValue(n)),Cs(t.getValue(n))),zz=(e,t,n)=>P0(Cs(e.getValue(n)).toLowerCase(),Cs(t.getValue(n)).toLowerCase()),Uz=(e,t,n)=>P0(Cs(e.getValue(n)),Cs(t.getValue(n))),Vz=(e,t,n)=>{const s=e.getValue(n),i=t.getValue(n);return s>i?1:s<i?-1:0},Bz=(e,t,n)=>P0(e.getValue(n),t.getValue(n));function P0(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 K_(e,t){const n=e.split(Bp).filter(Boolean),s=t.split(Bp).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:Az,alphanumericCaseSensitive:Dz,text:zz,textCaseSensitive:Uz,datetime:Vz,basic:Bz},qz={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(Bp).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 Wf(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())}},Hz=[dz,Nz,Rz,Ez,hz,gz,Mz,Tz,qz,bz,$z,Fz,Lz,Oz,Iz];function Wz(e){var t,n;const s=[...Hz,...(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 C;return(C=i.options.getRowId==null?void 0:i.options.getRowId(x,v,w))!=null?C:`${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 C=w.header.column.columnDef;return C.accessorKey?C.accessorKey:C.accessorFn?C.id:null},cell:w=>{var C,b;return(C=(b=w.renderValue())==null||b.toString==null?void 0:b.toString())!=null?C:null},...i._features.reduce((w,C)=>Object.assign(w,C.getDefaultColumnDef==null?void 0:C.getDefaultColumnDef()),{}),...x}},we(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:Se(()=>[i._getColumnDefs()],x=>{const v=function(w,C,b){return b===void 0&&(b=0),w.map(_=>{const E=fz(i,_,b,C),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(C=>C.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 Gz(){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=_0(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 Kz(){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:Qz(n),we(e.options,"debugTable"))}function Qz(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 Jz(e,t,n){return n.options.filterFromLeafRows?Yz(e,t,n):Xz(e,t,n)}function Yz(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=_0(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 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++){let v=d[x];if(t(v)){var p;if((p=v.subRows)!=null&&p.length&&h<u){const C=_0(n,v.id,v.original,v.index,v.depth,void 0,v.parentId);C.subRows=f(v.subRows,h+1),v=C}m.push(v),i.push(v),a[v.id]=v}}return m};return{rows:f(e),flatRows:i,rowsById:a}}function Zz(){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 C=w.getFilterFn();C&&i.push({id:x.id,filterFn:C,resolvedValue:(v=C.resolveFilterValue==null?void 0:C.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 C=h.id;v.columnFilters[C]=h.filterFn(v,C,h.resolvedValue,b=>{v.columnFiltersMeta[C]=b})}if(a.length){for(let w=0;w<a.length;w++){m=a[w];const C=m.id;if(m.filterFn(v,C,m.resolvedValue,b=>{v.columnFiltersMeta[C]=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 Jz(t.rows,p,e)},we(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function e5(){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],C=u[w.id],b=C.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),F=j===void 0,A=R===void 0;if(F||A){if(b==="first")return F?-1:1;if(b==="last")return F?1:-1;E=F&&A?0:F?b:-b}}if(E===0&&(E=C.sortingFn(m,p,w.id)),E!==0)return _&&(E*=-1),C.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 Fg(e,t){return e?t5(e)?z.createElement(e,t):e:null}function t5(e){return n5(e)||typeof e=="function"||r5(e)}function n5(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function r5(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function s5(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=z.useState(()=>({current:Wz(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 si=az(),Q_=y.jsx("span",{className:"text-fg-faint",children:"—"}),o5=e=>`${tl(e.label)} ${e.label} ${e.models.map(Or).join(" ")} ${e.models.join(" ")}`.toLowerCase();function i5(e){return z.useMemo(()=>[si.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())})]})}),si.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(", ")})}),si.accessor("total",{header:"tokens",meta:{align:"right"},cell:t=>t.getValue()>0?y.jsx("span",{className:"text-fg",children:wn(t.getValue())}):Q_}),si.accessor("cacheSavings",{header:"saved",meta:{align:"right",hiddenSm:!0},cell:t=>y.jsx("span",{className:"text-positive",children:Ue(t.getValue())})}),si.accessor("count",{header:"calls",meta:{align:"right",hiddenSm:!0},cell:t=>y.jsx("span",{className:"text-fg-dim",children:Y1(t.getValue())})}),si.accessor("cost",{header:"cost",meta:{align:"right"},cell:t=>y.jsx("span",{className:"text-cost",children:Ue(t.getValue())})})],[e])}const a5=e=>`py-2 pr-3${(e==null?void 0:e.align)==="right"?" text-right":""}${e!=null&&e.hiddenSm?" hidden sm:table-cell":""}`;function l5({rows:e,granLabel:t,q:n}){const[s,i]=z.useState([{id:"label",desc:!0}]),[a,u]=z.useState({}),d=i5(t==="monthly"?"month":t==="weekly"?"week":"date"),h=s5({data:e,columns:d,state:{sorting:s,expanded:a,globalFilter:n},onSortingChange:i,onExpandedChange:u,getRowCanExpand:()=>!0,globalFilterFn:(x,v,w)=>!String(w).trim()||o5(x.original).includes(String(w).trim().toLowerCase()),getCoreRowModel:Gz(),getSortedRowModel:e5(),getFilteredRowModel:Zz(),getExpandedRowModel:Kz()}),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(Hf,{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:[Fg(x.column.columnDef.header,x.getContext()),w&&y.jsx("span",{className:"text-accent",children:w==="asc"?"▲":"▼"})]}):y.jsx("span",{className:"text-fg-faint",children:Fg(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:`${a5(v.column.columnDef.meta)}${v.column.id==="label"?" whitespace-nowrap":""} tnum`,children:Fg(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:em(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):Q_}),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:Y1(p.count)}),y.jsx("td",{className:"tnum py-2 text-right text-cost",children:Ue(p.cost)})]})})]})})})}const Gf=()=>A_(()=>import("./timeline-D0GFoRzM.js"),__vite__mapDeps([0,1]),import.meta.url),Ol=()=>A_(()=>import("./breakdown-Dhq6Rqnu.js"),__vite__mapDeps([2,1]),import.meta.url);Gf();Ol();const u5=z.lazy(()=>Gf().then(e=>({default:e.CostTimeline}))),c5=z.lazy(()=>Gf().then(e=>({default:e.CumulativeSpend}))),f5=z.lazy(()=>Gf().then(e=>({default:e.CacheSavings}))),J_=z.lazy(()=>Ol().then(e=>({default:e.CostByModel}))),Y_=z.lazy(()=>Ol().then(e=>({default:e.ProviderDonut}))),Hw=z.lazy(()=>Ol().then(e=>({default:e.TokenComposition}))),d5=z.lazy(()=>Ol().then(e=>({default:e.CacheByModel}))),h5=({className:e})=>y.jsx("div",{className:e,"aria-hidden":!0}),us=({children:e})=>y.jsx(z.Suspense,{fallback:null,children:e}),Ww=[{key:"overview",label:"overview"},{key:"analytics",label:"analytics"},{key:"models",label:"models"},{key:"explore",label:"explore"}],g5=[{value:"daily",label:"daily"},{value:"weekly",label:"weekly"},{value:"monthly",label:"monthly"}];function p5({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(Q4,{derived:e,periodLabel:t}),y.jsx(z.Suspense,{fallback:y.jsx(h5,{className:"h-[clamp(320px,42vh,560px)]"}),children:y.jsx(u5,{derived:e,periodLabel:n,heightClass:"h-[clamp(320px,42vh,560px)]"})}),y.jsx(J4,{accounts:e.cardAccounts,nameOf:i})]})}function m5({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(rz,{derived:e,periodLabel:t})}),y.jsx(us,{children:y.jsx(J_,{derived:e,periodLabel:t})}),y.jsx(us,{children:n?y.jsx(Y_,{derived:e,periodLabel:t}):y.jsx(Hw,{derived:e,periodLabel:t})}),n&&y.jsx(us,{children:y.jsx(Hw,{derived:e,periodLabel:t})}),y.jsx("div",{className:n?void 0:"md:col-span-2",children:y.jsx(us,{children:y.jsx(f5,{derived:e,periodLabel:t})})}),y.jsx("div",{className:"md:col-span-2",children:y.jsx(us,{children:y.jsx(c5,{derived:e,height:300,periodLabel:t})})})]})}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(iz,{derived:e,periodLabel:t})}),y.jsx("div",{className:n?void 0:"md:col-span-2",children:y.jsx(us,{children:y.jsx(J_,{derived:e,metric:"tokens",limit:12,periodLabel:t})})}),n&&y.jsx(us,{children:y.jsx(Y_,{derived:e,periodLabel:t})}),y.jsx("div",{className:"md:col-span-2",children:y.jsx(us,{children:y.jsx(d5,{derived:e,periodLabel:t})})})]})}function x5({snapshot:e,filters:t,periodLabel:n}){const[s,i]=z.useState(""),[a,u]=z.useState("daily"),f=z.useMemo(()=>Tj(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:g5,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(qj,{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(yi,{className:"size-3 text-fg-faint hover:text-fg","aria-hidden":!0})})]})]}),y.jsx(l5,{rows:f,granLabel:a,q:s})]})}function I0(e,t,n){try{return e(t)}catch(s){return aP("[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),I0(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 Lg=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 j0(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:j0});ir({parse:e=>{const t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:j0});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:j0});function v5(e){return S5(e)}function S5(e){return ir({parse:t=>{const n=t;return e.includes(n)?n:null},serialize:String})}function Gw(e,t=","){const n=e.eq??((i,a)=>i===a),s=encodeURIComponent(t);return ir({parse:i=>i===""?[]:i.split(t).map((a,u)=>I0(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 Og=Gp(),w5={};function k5(e,t={}){const n=z.useId(),s=pP(),i=mP(),{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=w5}=t,v=Object.keys(e).join(","),w=z.useMemo(()=>Object.fromEntries(Object.keys(e).map(U=>[U,x[U]??U])),[v,JSON.stringify(x)]),C=gP(Object.values(w)),b=C.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=Vh.useQueuedQueries(Object.values(w)),[R,F]=z.useState(()=>Ag(e,x,b??new URLSearchParams,j).state),A=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}=Ag(e,x,b,j,_.current,A.current);V&&(Ye("[nuq+ %s `%s`] State changed: %O",n,v,{state:U,initialSearchParams:b,queuedQueries:j,queryRef:_.current,stateRef:A.current}),A.current=U,F(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}=Ag(e,x,b,j,_.current,A.current);V&&(Ye("[nuq+ %s `%s`] State changed: %O",n,v,{state:U,initialSearchParams:b,queuedQueries:j,queryRef:_.current,stateRef:A.current}),A.current=U,F(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})=>{F(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,A.current),P):(A.current={...A.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,A.current),A.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),Og.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),Og.off(Z,U[V])}}},[v,w]);const T=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(Kw(A.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);Og.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(xl(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=Vh.push(Ce,Ee,C,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(Vh.abort(be)),fc.push(Ce,Ee),H=!0}}const K=X.reduce((pe,he)=>he(pe),H?fc.flush(C,i):fc.getPendingPromise(C));return ae??K},[v,a,f,u,d,h==null?void 0:h.method,h==null?void 0:h.timeMs,p,w,C.updateUrl,C.getSearchParamsSnapshot,C.rateLimitFactor,i,E]);return[z.useMemo(()=>Kw(R,E),[R,E]),T]}function Ag(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&&m1(i[p]??v,w)?(d[h]=a[h]??null,d):(u=!0,d[h]=(vP(w)?null:I0(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 Kw(e,t){return Object.fromEntries(Object.keys(e).map(n=>[n,e[n]??t[n]??null]))}const C5=["7d","30d","90d","mtd","all"];function b5(){const[e,t]=k5({p:Gw(Lg).withDefault([]),m:Gw(Lg).withDefault([]),a:Lg.withDefault("all"),period:v5(C5).withDefault(Ij.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 _5(){const[e,t]=z.useState(null),[n,s]=z.useState("connecting"),i=z.useRef(null);return z.useEffect(()=>{let a=!1;const u=Ll(),f=E4(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 qp=e=>`/${e}`,X_=z.createContext(null),Kf=()=>{const e=z.useContext(X_);if(!e)throw new Error("useDashboard outside provider");return e};function R5(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 E5(){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 P5({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(Hj,{className:"size-3.5"}):y.jsx(Wj,{className:"size-3.5"})})}function I5({conn:e,freshAt:t}){const n=R5(),s=e==="live"?"var(--color-positive)":e==="error"?"var(--color-warning)":"var(--color-cost)",i=t?Rj(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 Dg({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 j5({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(Gj,{className:"size-3.5"})})}function N5(){var T,U;const{snapshot:e,conn:t}=_5(),[n,s]=b5(),[i,a]=E5(),[u,f]=z.useState(!1),d=z.useMemo(()=>Dj(e,n),[e,n]),h=((T=Z1.find(V=>V.key===n.period))==null?void 0:T.label)??n.period,m=n.period==="all"?void 0:h,p=kj({select:V=>V.location.pathname}),x=((U=Ww.find(V=>qp(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,C=((e==null?void 0:e.accounts)??[]).some(Yg),b=((e==null?void 0:e.accounts)??[]).some(V=>V.hasBilling&&!Yg(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 F=!w||_||E.current||j,A=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(I5,{conn:t,freshAt:(e==null?void 0:e.generatedAt)??null}),y.jsx(j5,{onOpen:()=>f(!0)}),y.jsx(P5,{theme:i,onToggle:a}),F&&(w||C)&&y.jsx(rN,{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:Ww.map(V=>y.jsx(Zp,{to:qp(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(Jj,{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&&!C?b&&!j&&t!=="error"?y.jsx(Dg,{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."}):!F||!A?y.jsx(Dg,{label:t==="error"?"connection lost — retrying…":"reading usage history…"}):y.jsx(X_.Provider,{value:A,children:y.jsx(J1,{})}):y.jsx(Dg,{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(H4,{snapshot:e,onClose:()=>f(!1)})]})}function Qw(){const{derived:e,periodLabel:t,scopeLabel:n,snapshot:s}=Kf();return y.jsx("div",{children:y.jsx(p5,{derived:e,periodLabel:t,scopeLabel:n,providers:s.providers})})}function M5(){const{derived:e,scopeLabel:t}=Kf();return y.jsx("div",{children:y.jsx(m5,{derived:e,scopeLabel:t})})}function T5(){const{derived:e,scopeLabel:t}=Kf();return y.jsx("div",{children:y.jsx(y5,{derived:e,scopeLabel:t})})}function $5(){const{snapshot:e,filters:t,periodLabel:n}=Kf();return y.jsx("div",{children:y.jsx(x5,{snapshot:e,filters:t,periodLabel:n})})}const Hp=oj({component:N5}),cc=(e,t)=>G1({getParentRoute:()=>Hp,path:qp(e),component:t}),F5=Hp.addChildren([G1({getParentRoute:()=>Hp,path:"/",component:Qw}),cc("overview",Qw),cc("analytics",M5),cc("models",T5),cc("explore",$5)]),L5=xj({routeTree:F5,history:gI(),defaultViewTransition:!0});function O5(){return y.jsx(wj,{router:L5})}oP.createRoot(document.getElementById("root")).render(y.jsx(z.StrictMode,{children:y.jsx(IP,{children:y.jsx(nN,{children:y.jsx(O5,{})})})}));export{J2 as E,Hf as P,Ka as R,Sn as S,z5 as T,U5 as a,Ue as b,wn as c,X1 as d,nl as e,tl as f,YE as g,D5 as h,y as j,z as r,Or as s};