@meyicloud/meyi-cost-ui 1.5.4 → 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CostPage.d.ts +3 -1
- package/dist/components/management-account-select.d.ts +1 -0
- package/dist/cost-context.d.ts +15 -0
- package/dist/features/overview/hooks/use-cost-overview.d.ts +1 -4
- package/dist/index.js +15 -15
- package/dist/index.mjs +4321 -4214
- package/dist/services/cost.d.ts +19 -8
- package/dist/style.css +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react"),Pa=require("react-dom");function Aa(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const $=Aa(E);var Jt={exports:{}},Et={};var In;function Ta(){if(In)return Et;In=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(n,r,o){var i=null;if(o!==void 0&&(i=""+o),r.key!==void 0&&(i=""+r.key),"key"in r){o={};for(var c in r)c!=="key"&&(o[c]=r[c])}else o=r;return r=o.ref,{$$typeof:e,type:n,key:i,ref:r!==void 0?r:null,props:o}}return Et.Fragment=t,Et.jsx=s,Et.jsxs=s,Et}var Pt={};var Mn;function Oa(){return Mn||(Mn=1,process.env.NODE_ENV!=="production"&&(function(){function e(R){if(R==null)return null;if(typeof R=="function")return R.$$typeof===k?null:R.displayName||R.name||null;if(typeof R=="string")return R;switch(R){case b:return"Fragment";case y:return"Profiler";case x:return"StrictMode";case _:return"Suspense";case j:return"SuspenseList";case I:return"Activity"}if(typeof R=="object")switch(typeof R.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),R.$$typeof){case g:return"Portal";case N:return R.displayName||"Context";case S:return(R._context.displayName||"Context")+".Consumer";case C:var F=R.render;return R=R.displayName,R||(R=F.displayName||F.name||"",R=R!==""?"ForwardRef("+R+")":"ForwardRef"),R;case w:return F=R.displayName||null,F!==null?F:e(R.type)||"Memo";case P:F=R._payload,R=R._init;try{return e(R(F))}catch{}}return null}function t(R){return""+R}function s(R){try{t(R);var F=!1}catch{F=!0}if(F){F=console;var H=F.error,G=typeof Symbol=="function"&&Symbol.toStringTag&&R[Symbol.toStringTag]||R.constructor.name||"Object";return H.call(F,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",G),t(R)}}function n(R){if(R===b)return"<>";if(typeof R=="object"&&R!==null&&R.$$typeof===P)return"<...>";try{var F=e(R);return F?"<"+F+">":"<...>"}catch{return"<...>"}}function r(){var R=T.A;return R===null?null:R.getOwner()}function o(){return Error("react-stack-top-frame")}function i(R){if(Z.call(R,"key")){var F=Object.getOwnPropertyDescriptor(R,"key").get;if(F&&F.isReactWarning)return!1}return R.key!==void 0}function c(R,F){function H(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",F))}H.isReactWarning=!0,Object.defineProperty(R,"key",{get:H,configurable:!0})}function l(){var R=e(this.type);return Q[R]||(Q[R]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),R=this.props.ref,R!==void 0?R:null}function u(R,F,H,G,W,U){var D=H.ref;return R={$$typeof:p,type:R,key:F,props:H,_owner:G},(D!==void 0?D:null)!==null?Object.defineProperty(R,"ref",{enumerable:!1,get:l}):Object.defineProperty(R,"ref",{enumerable:!1,value:null}),R._store={},Object.defineProperty(R._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(R,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(R,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:W}),Object.defineProperty(R,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.freeze&&(Object.freeze(R.props),Object.freeze(R)),R}function f(R,F,H,G,W,U){var D=F.children;if(D!==void 0)if(G)if(z(D)){for(G=0;G<D.length;G++)d(D[G]);Object.freeze&&Object.freeze(D)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(D);if(Z.call(F,"key")){D=e(R);var X=Object.keys(F).filter(function(ie){return ie!=="key"});G=0<X.length?"{key: someKey, "+X.join(": ..., ")+": ...}":"{key: someKey}",O[D+G]||(X=0<X.length?"{"+X.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,q,$,J,$),A[$+q]=!0)}if($=null,W!==void 0&&(s(W),$=""+W),i(U)&&(s(U.key),$=""+U.key),"key"in U){W={};for(var G in U)G!=="key"&&(W[G]=U[G])}else W=U;return $&&c(W,typeof C=="function"?C.displayName||C.name||"Unknown":C),d(C,$,W,n(),I,M)}function u(C){h(C)?C._store&&(C._store.validated=1):typeof C=="object"&&C!==null&&C.$$typeof===E&&(C._payload.status==="fulfilled"?h(C._payload.value)&&C._payload.value._store&&(C._payload.value._store.validated=1):C._store&&(C._store.validated=1))}function h(C){return typeof C=="object"&&C!==null&&C.$$typeof===g}var m=k,g=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),w=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),T=Symbol.for("react.client.reference"),F=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=Object.prototype.hasOwnProperty,z=Array.isArray,X=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(C){return C()}};var Z,Y={},de=m.react_stack_bottom_frame.bind(m,o)(),fe=X(r(o)),A={};Et.Fragment=x,Et.jsx=function(C,U,W){var q=1e4>F.recentlyCreatedOwnerStacks++;return f(C,U,W,!1,q?Error("react-stack-top-frame"):de,q?X(r(C)):fe)},Et.jsxs=function(C,U,W){var q=1e4>F.recentlyCreatedOwnerStacks++;return f(C,U,W,!0,q?Error("react-stack-top-frame"):de,q?X(r(C)):fe)}})()),Et}var Lr;function Ea(){return Lr||(Lr=1,process.env.NODE_ENV==="production"?Gt.exports=_a():Gt.exports=ka()),Gt.exports}var a=Ea(),Mt=typeof window<"u"?B.useLayoutEffect:B.useEffect;function Is(e){const t=B.useRef({value:e,prev:null}),s=t.current.value;return e!==s&&(t.current={value:e,prev:s}),t.current.prev}function Pa(e,t,s={},r={}){B.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!="function")return;const n=new IntersectionObserver(([o])=>{t(o)},s);return n.observe(e.current),()=>{n.disconnect()}},[t,s,r.disabled,e])}function Ta(e){const t=B.useRef(null);return B.useImperativeHandle(e,()=>t.current,[]),t}const Hn=!1;function Dt(e){return e[e.length-1]}function Aa(e){return typeof e=="function"}function Ze(e,t){return Aa(e)?e(t):e}const qn=Object.prototype.hasOwnProperty,Ir=Object.prototype.propertyIsEnumerable;function Gn(e){for(const t in e)if(qn.call(e,t))return!0;return!1}const Oa=()=>Object.create(null),Ye=(e,t)=>Qe(e,t,Oa);function Qe(e,t,s=()=>({}),r=0){if(e===t)return e;if(r>500)return t;const n=t,o=Fr(e)&&Fr(n);if(!o&&!(ms(e)&&ms(n)))return n;const i=o?e:Mr(e);if(!i)return n;const c=o?n:Mr(n);if(!c)return n;const l=i.length,d=c.length,f=o?new Array(d):s();let u=0;for(let h=0;h<d;h++){const m=o?h:c[h],g=e[m],p=n[m];if(g===p){f[m]=g,(o?h<l:qn.call(e,m))&&u++;continue}if(g===null||p===null||typeof g!="object"||typeof p!="object"){f[m]=p;continue}const x=Qe(g,p,s,r+1);f[m]=x,x===g&&u++}return l===d&&u===l?e:f}function Mr(e){const t=Object.getOwnPropertyNames(e);for(const n of t)if(!Ir.call(e,n))return!1;const s=Object.getOwnPropertySymbols(e);if(s.length===0)return t;const r=t;for(const n of s){if(!Ir.call(e,n))return!1;r.push(n)}return r}function ms(e){if(!Dr(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const s=t.prototype;return!(!Dr(s)||!s.hasOwnProperty("isPrototypeOf"))}function Dr(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fr(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function st(e,t,s){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 r=0,n=e.length;r<n;r++)if(!st(e[r],t[r],s))return!1;return!0}if(ms(e)&&ms(t)){const r=s?.ignoreUndefined??!0;if(s?.partial){for(const i in t)if((!r||t[i]!==void 0)&&!st(e[i],t[i],s))return!1;return!0}let n=0;if(!r)n=Object.keys(e).length;else for(const i in e)e[i]!==void 0&&n++;let o=0;for(const i in t)if((!r||t[i]!==void 0)&&(o++,o>n||!st(e[i],t[i],s)))return!1;return n===o}return!1}function yt(e){let t,s;const r=new Promise((n,o)=>{t=n,s=o});return r.status="pending",r.resolve=n=>{r.status="resolved",r.value=n,t(n),e?.(n)},r.reject=n=>{r.status="rejected",s(n)},r}function Ft(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function Ur(e,t){for(let s=e.length-1;s>=0;s--){const r=e[s];if(t(r))return r}}const La=/[\x00-\x1f\x7f"<>`{}]/g;function Ia(e){return e.replace(La,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function $r(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,s=>{try{return decodeURI(s)}catch{return s}})}return Ia(t)}const Ma=["http:","https:","mailto:","tel:"];function ps(e,t){if(!e)return!1;try{const s=new URL(e);return!t.has(s.protocol)}catch{return!1}}function Pt(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 s=0,r="",n;for(;(n=t.exec(e))!==null;)r+=$r(e.slice(s,n.index))+n[0],s=t.lastIndex;r=r+$r(s?e.slice(s):e);let o=!1;return r.startsWith("//")&&(o=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:o}}function Da(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Fa(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}function Ue(){throw new Error("Invariant failed")}function Ut(e){const t=new Map;let s,r;const n=o=>{o.next&&(o.prev?(o.prev.next=o.next,o.next.prev=o.prev,o.next=void 0,r&&(r.next=o,o.prev=r)):(o.next.prev=void 0,s=o.next,o.next=void 0,r&&(o.prev=r,r.next=o)),r=o)};return{get(o){const i=t.get(o);if(i)return n(i),i.value},set(o,i){if(t.size>=e&&s){const l=s;t.delete(l.key),l.next&&(s=l.next,l.next.prev=void 0),l===r&&(r=void 0)}const c=t.get(o);if(c)c.value=i,n(c);else{const l={key:o,value:i,prev:r};r&&(r.next=l),r=l,s||(s=l),t.set(o,l)}},clear(){t.clear(),s=void 0,r=void 0}}}const Ve=4,Kn=5;function Ua(e){const t=e.indexOf("{");if(t===-1)return null;const s=e.indexOf("}",t);return s===-1||t+1>=e.length?null:[t,s]}function Yn(e,t,s=new Uint16Array(6)){const r=e.indexOf("/",t),n=r===-1?e.length:r,o=e.substring(t,n);if(!o||!o.includes("$"))return s[0]=0,s[1]=t,s[2]=t,s[3]=n,s[4]=n,s[5]=n,s;if(o==="$"){const c=e.length;return s[0]=2,s[1]=t,s[2]=t,s[3]=c,s[4]=c,s[5]=c,s}if(o.charCodeAt(0)===36)return s[0]=1,s[1]=t,s[2]=t+1,s[3]=n,s[4]=n,s[5]=n,s;const i=Ua(o);if(i){const[c,l]=i,d=o.charCodeAt(c+1);if(d===45){if(c+2<o.length&&o.charCodeAt(c+2)===36){const f=c+3,u=l;if(f<u)return s[0]=3,s[1]=t+c,s[2]=t+f,s[3]=t+u,s[4]=t+l+1,s[5]=n,s}}else if(d===36){const f=c+1,u=c+2;return u===l?(s[0]=2,s[1]=t+c,s[2]=t+f,s[3]=t+u,s[4]=t+l+1,s[5]=e.length,s):(s[0]=1,s[1]=t+c,s[2]=t+u,s[3]=t+l,s[4]=t+l+1,s[5]=n,s)}}return s[0]=0,s[1]=t,s[2]=t,s[3]=n,s[4]=n,s[5]=n,s}function _s(e,t,s,r,n,o,i){i?.(s);let c=r;{const l=s.fullPath??s.from,d=l.length,f=s.options?.caseSensitive??e,u=s.options?.params?.parse??s.options?.parseParams;for(;c<d;){const m=Yn(l,c,t);let g;const p=c,x=m[5];switch(c=x+1,o++,m[0]){case 0:{const b=l.substring(m[2],m[3]);if(f){const y=n.static?.get(b);if(y)g=y;else{n.static??=new Map;const R=et(s.fullPath??s.from);R.parent=n,R.depth=o,g=R,n.static.set(b,R)}}else{const y=b.toLowerCase(),R=n.staticInsensitive?.get(y);if(R)g=R;else{n.staticInsensitive??=new Map;const w=et(s.fullPath??s.from);w.parent=n,w.depth=o,g=w,n.staticInsensitive.set(y,w)}}break}case 1:{const b=l.substring(p,m[1]),y=l.substring(m[4],x),R=f&&!!(b||y),w=b?R?b:b.toLowerCase():void 0,_=y?R?y:y.toLowerCase():void 0,N=!u&&n.dynamic?.find(j=>!j.parse&&j.caseSensitive===R&&j.prefix===w&&j.suffix===_);if(N)g=N;else{const j=Ds(1,s.fullPath??s.from,R,w,_);g=j,j.depth=o,j.parent=n,n.dynamic??=[],n.dynamic.push(j)}break}case 3:{const b=l.substring(p,m[1]),y=l.substring(m[4],x),R=f&&!!(b||y),w=b?R?b:b.toLowerCase():void 0,_=y?R?y:y.toLowerCase():void 0,N=!u&&n.optional?.find(j=>!j.parse&&j.caseSensitive===R&&j.prefix===w&&j.suffix===_);if(N)g=N;else{const j=Ds(3,s.fullPath??s.from,R,w,_);g=j,j.parent=n,j.depth=o,n.optional??=[],n.optional.push(j)}break}case 2:{const b=l.substring(p,m[1]),y=l.substring(m[4],x),R=f&&!!(b||y),w=b?R?b:b.toLowerCase():void 0,_=y?R?y:y.toLowerCase():void 0,N=Ds(2,s.fullPath??s.from,R,w,_);g=N,N.parent=n,N.depth=o,n.wildcard??=[],n.wildcard.push(N)}}n=g}if(u&&s.children&&!s.isRoot&&s.id&&s.id.charCodeAt(s.id.lastIndexOf("/")+1)===95){const m=et(s.fullPath??s.from);m.kind=Kn,m.parent=n,o++,m.depth=o,n.pathless??=[],n.pathless.push(m),n=m}const h=(s.path||!s.children)&&!s.isRoot;if(h&&l.endsWith("/")){const m=et(s.fullPath??s.from);m.kind=Ve,m.parent=n,o++,m.depth=o,n.index=m,n=m}n.parse=u??null,n.priority=s.options?.params?.priority??0,h&&!n.route&&(n.route=s,n.fullPath=s.fullPath??s.from)}if(s.children)for(const l of s.children)_s(e,t,l,c,n,o,i)}function Ms(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 ze(e){if(e.pathless)for(const t of e.pathless)ze(t);if(e.static)for(const t of e.static.values())ze(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())ze(t);if(e.dynamic?.length){e.dynamic.sort(Ms);for(const t of e.dynamic)ze(t)}if(e.optional?.length){e.optional.sort(Ms);for(const t of e.optional)ze(t)}if(e.wildcard?.length){e.wildcard.sort(Ms);for(const t of e.wildcard)ze(t)}}function et(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 Ds(e,t,s,r,n){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:s,prefix:r,suffix:n}}function $a(e,t){const s=et("/"),r=new Uint16Array(6);for(const n of e)_s(!1,r,n,1,s,0);ze(s),t.masksTree=s,t.flatCache=Ut(1e3)}function Ba(e,t){e||="/";const s=t.flatCache.get(e);if(s)return s;const r=mr(e,t.masksTree);return t.flatCache.set(e,r),r}function za(e,t,s,r,n){e||="/",r||="/";const o=t?`case\0${e}`:e;let i=n.singleCache.get(o);return i||(i=et("/"),_s(t,new Uint16Array(6),{from:e},1,i,0),n.singleCache.set(o,i)),mr(r,i,s)}function Va(e,t,s=!1){const r=s?e:`nofuzz\0${e}`,n=t.matchCache.get(r);if(n!==void 0)return n;e||="/";let o;try{o=mr(e,t.segmentTree,s)}catch(i){if(i instanceof URIError)o=null;else throw i}return o&&(o.branch=Xn(o.route)),t.matchCache.set(r,o),o}function Wa(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Ha(e,t=!1,s){const r=et(e.fullPath),n=new Uint16Array(6),o={},i={};let c=0;return _s(t,n,e,1,r,0,l=>{if(s?.(l,c),l.id in o){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Duplicate routes found with id: ${String(l.id)}`);Ue()}if(o[l.id]=l,c!==0&&l.path){const d=Wa(l.fullPath);(!i[d]||l.fullPath.endsWith("/"))&&(i[d]=l)}c++}),ze(r),{processedTree:{segmentTree:r,singleCache:Ut(1e3),matchCache:Ut(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:i}}function mr(e,t,s=!1){const r=e.split("/"),n=Ga(e,r,t,s);if(!n)return null;const[o]=Jn(e,r,n);return{route:n.node.route,rawParams:o}}function Jn(e,t,s){const r=qa(s.node);let n=null;const o=Object.create(null);let i=s.extract?.part??0,c=s.extract?.node??0,l=s.extract?.path??0,d=s.extract?.segment??0;for(;c<r.length;i++,c++,l++,d++){const f=r[c];if(f.kind===Ve)break;if(f.kind===Kn){d--,i--,l--;continue}const u=t[i],h=l;if(u&&(l+=u.length),f.kind===1){n??=s.node.fullPath.split("/");const m=n[d],g=f.prefix?.length??0;if(m.charCodeAt(g)===123){const p=f.suffix?.length??0,x=m.substring(g+2,m.length-p-1),b=u.substring(g,u.length-p);o[x]=decodeURIComponent(b)}else{const p=m.substring(1);o[p]=decodeURIComponent(u)}}else if(f.kind===3){if(s.skipped&1<<c){i--,l=h-1;continue}n??=s.node.fullPath.split("/");const m=n[d],g=f.prefix?.length??0,p=f.suffix?.length??0,x=m.substring(g+3,m.length-p-1),b=f.suffix||f.prefix?u.substring(g,u.length-p):u;b&&(o[x]=decodeURIComponent(b))}else if(f.kind===2){const m=f,g=e.substring(h+(m.prefix?.length??0),e.length-(m.suffix?.length??0)),p=decodeURIComponent(g);o["*"]=p,o._splat=p;break}}return s.rawParams&&Object.assign(o,s.rawParams),[o,{part:i,node:c,path:l,segment:d}]}function Xn(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function qa(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Ga(e,t,s,r){if(e==="/"&&s.index)return{node:s.index,skipped:0};const n=!Dt(t),o=n&&e!=="/",i=t.length-(n?1:0),c=[{node:s,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let l=null,d=null;for(;c.length;){const f=c.pop(),{node:u,index:h,skipped:m,depth:g,statics:p,dynamics:x,optionals:b}=f;let{extract:y,rawParams:R}=f;if(u.kind===2&&u.route&&!Yt(d,f))continue;if(u.parse){if(!Br(e,t,f))continue;R=f.rawParams,y=f.extract}r&&u.route&&u.kind!==Ve&&Yt(l,f)&&(l=f);const w=h===i;if(w&&(u.route&&(!o||u.kind===Ve||u.kind===2)&&Yt(d,f)&&(d=f),!u.optional&&!u.wildcard&&!u.index&&!u.pathless))continue;const _=w?void 0:t[h];let N;if(w&&u.index){const j={node:u.index,index:h,skipped:m,depth:g+1,statics:p,dynamics:x,optionals:b,extract:y,rawParams:R};let S=!0;if(u.index.parse&&(Br(e,t,j)||(S=!1)),S){if(!x&&!b&&!m&&Ka(p,i))return j;Yt(d,j)&&(d=j)}}if(u.wildcard)for(let j=u.wildcard.length-1;j>=0;j--){const S=u.wildcard[j],{prefix:E,suffix:D}=S;if(!(E&&(w||!(S.caseSensitive?_:N??=_.toLowerCase()).startsWith(E)))){if(D){if(w)continue;const T=t.slice(h).join("/").slice(-D.length);if((S.caseSensitive?T:T.toLowerCase())!==D)continue}c.push({node:S,index:i,skipped:m,depth:g+1,statics:p,dynamics:x,optionals:b,extract:y,rawParams:R})}}if(u.optional){const j=m|1<<g,S=g+1;for(let E=u.optional.length-1;E>=0;E--){const D=u.optional[E];c.push({node:D,index:h,skipped:j,depth:S,statics:p,dynamics:x,optionals:b,extract:y,rawParams:R})}if(!w)for(let E=u.optional.length-1;E>=0;E--){const D=u.optional[E],{prefix:T,suffix:F}=D;if(T||F){const ee=D.caseSensitive?_:N??=_.toLowerCase();if(T&&!ee.startsWith(T)||F&&!ee.endsWith(F))continue}c.push({node:D,index:h+1,skipped:m,depth:S,statics:p,dynamics:x,optionals:b+Kt(i,h),extract:y,rawParams:R})}}if(!w&&u.dynamic&&_)for(let j=u.dynamic.length-1;j>=0;j--){const S=u.dynamic[j],{prefix:E,suffix:D}=S;if(E||D){const T=S.caseSensitive?_:N??=_.toLowerCase();if(E&&!T.startsWith(E)||D&&!T.endsWith(D))continue}c.push({node:S,index:h+1,skipped:m,depth:g+1,statics:p,dynamics:x+Kt(i,h),optionals:b,extract:y,rawParams:R})}if(!w&&u.staticInsensitive){const j=u.staticInsensitive.get(N??=_.toLowerCase());j&&c.push({node:j,index:h+1,skipped:m,depth:g+1,statics:p+Kt(i,h),dynamics:x,optionals:b,extract:y,rawParams:R})}if(!w&&u.static){const j=u.static.get(_);j&&c.push({node:j,index:h+1,skipped:m,depth:g+1,statics:p+Kt(i,h),dynamics:x,optionals:b,extract:y,rawParams:R})}if(u.pathless){const j=g+1;for(let S=u.pathless.length-1;S>=0;S--){const E=u.pathless[S];c.push({node:E,index:h,skipped:m,depth:j,statics:p,dynamics:x,optionals:b,extract:y,rawParams:R})}}}if(d)return d;if(r&&l){let f=l.index;for(let h=0;h<l.index;h++)f+=t[h].length;const u=f===e.length?"/":e.slice(f);return l.rawParams??=Object.create(null),l.rawParams["**"]=decodeURIComponent(u),l}return null}function Kt(e,t){return 2**(e-t-1)}function Ka(e,t){return e===2**(t-1)-1}function Br(e,t,s){let r,n;try{[r,n]=Jn(e,t,s)}catch{return null}if(s.rawParams=r,s.extract=n,!s.node.parse)return!0;try{if(s.node.parse(r)===!1)return null}catch{}return!0}function Yt(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===Ve)>(e.node.kind===Ve)||t.node.kind===Ve==(e.node.kind===Ve)&&t.depth>e.depth))):!0}function is(e){return pr(e.filter(t=>t!==void 0).join("/"))}function pr(e){return e.replace(/\/{2,}/g,"/")}function Zn(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Fe(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function Qn(e){return Fe(Zn(e))}function gs(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Ya(e,t,s){return gs(e,s)===gs(t,s)}function Ja({base:e,to:t,trailingSlash:s="never",cache:r}){const n=t.startsWith("/"),o=!n&&t===".";let i;if(r){i=n?t:o?e:e+"\0"+t;const d=r.get(i);if(d)return d}let c;if(o)c=e.split("/");else if(n)c=t.split("/");else{for(c=e.split("/");c.length>1&&Dt(c)==="";)c.pop();const d=t.split("/");for(let f=0,u=d.length;f<u;f++){const h=d[f];h===""?f?f===u-1&&c.push(h):c=[h]:h===".."?c.pop():h==="."||c.push(h)}}c.length>1&&(Dt(c)===""?s==="never"&&c.pop():s==="always"&&c.push(""));const l=pr(c.join("/"))||"/";return i&&r&&r.set(i,l),l}function Xa(e){const t=new Map(e.map(n=>[encodeURIComponent(n),n])),s=Array.from(t.keys()).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(s,"g");return n=>n.replace(r,o=>t.get(o)??o)}function Fs(e,t,s){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(n=>Vr(n,s)).join("/"):Vr(r,s)}function zr({path:e,params:t,decoder:s,...r}){let n=!1;const o=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:o,isMissingParams:n};if(!e.includes("$"))return{interpolatedPath:e,usedParams:o,isMissingParams:n};const i=e.length;let c=0,l,d="";for(;c<i;){const f=c;l=Yn(e,f,l);const u=l[5];if(c=u+1,f===u)continue;const h=l[0];if(h===0){d+="/"+e.substring(f,u);continue}if(h===2){const m=t._splat;o._splat=m,o["*"]=m;const g=e.substring(f,l[1]),p=e.substring(l[4],u);if(!m){n=!0,(g||p)&&(d+="/"+g+p);continue}const x=Fs("_splat",t,s);d+="/"+g+x+p;continue}if(h===1){const m=e.substring(l[2],l[3]);!n&&!(m in t)&&(n=!0),o[m]=t[m];const g=e.substring(f,l[1]),p=e.substring(l[4],u),x=Fs(m,t,s)??"undefined";d+="/"+g+x+p;continue}if(h===3){const m=e.substring(l[2],l[3]),g=t[m];if(g==null)continue;o[m]=g;const p=e.substring(f,l[1]),x=e.substring(l[4],u),b=Fs(m,t,s)??"";d+="/"+p+b+x;continue}}return e.endsWith("/")&&(d+="/"),{usedParams:o,interpolatedPath:d||"/",isMissingParams:n}}function Vr(e,t){const s=encodeURIComponent(e);return t?.(s)??s}function ge(e){return e?.isNotFound===!0}function Za(e,t=String){const s=new URLSearchParams;for(const r in e){const n=e[r];n!==void 0&&s.set(r,t(n))}return s.toString()}function Us(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function Qa(e){const t=new URLSearchParams(e),s=Object.create(null);for(const[r,n]of t.entries()){const o=s[r];o==null?s[r]=Us(n):Array.isArray(o)?o.push(Us(n)):s[r]=[o,Us(n)]}return s}const ei=si(JSON.parse),ti=ri(JSON.stringify,JSON.parse);function si(e){return t=>{t[0]==="?"&&(t=t.substring(1));const s=Qa(t);for(const r in s){const n=s[r];if(typeof n=="string")try{s[r]=e(n)}catch{}}return s}}function ri(e,t){const s=typeof t=="function";function r(n){if(typeof n=="object"&&n!==null)try{return e(n)}catch{}else if(s&&typeof n=="string")try{return t(n),e(n)}catch{}return n}return n=>{const o=Za(n,r);return o?`?${o}`:""}}const rt="__root__";function ni(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 s=new Response(null,{status:e.statusCode,headers:t});if(s.options=e,e.throw)throw s;return s}function Se(e){return e instanceof Response&&!!e.options}const tr=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},oi=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),ks=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),nt=(e,t,s=!0)=>{const r={...e.router.options.context??{}},n=s?t:t-1;for(let o=0;o<=n;o++){const i=e.matches[o];if(!i)continue;const c=e.router.getMatch(i.id);c&&Object.assign(r,c.__routeContext,c.__beforeLoadContext)}return r},Wr=(e,t)=>{if(!e.matches.length)return;const s=t.routeId,r=e.matches.findIndex(i=>i.routeId===e.router.routeTree.id),n=r>=0?r:0;let o=s?e.matches.findIndex(i=>i.routeId===s):e.firstBadMatchIndex??e.matches.length-1;o<0&&(o=n);for(let i=o;i>=0;i--){const c=e.matches[i];if(e.router.looseRoutesById[c.routeId].options.notFoundComponent)return i}return s?o:n},We=(e,t,s)=>{if(!(!Se(s)&&!ge(s)))throw Se(s)&&s.redirectHandled&&!s.options.reloadDocument||(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=s,e.updateMatch(t.id,r=>({...r,status:Se(s)?"redirected":ge(s)?"notFound":r.status==="pending"?"success":r.status,context:nt(e,t.index),isFetching:!1,error:s})),ge(s)&&!s.routeId&&(s.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Se(s)&&(e.rendered=!0,s.options._fromLocation=e.location,s.redirectHandled=!0,s=e.router.resolveRedirect(s))),s},eo=(e,t)=>{const s=e.router.getMatch(t);return!!(!s||s._nonReactive.dehydrated)},Hr=(e,t,s)=>{const r=nt(e,s);e.updateMatch(t,n=>({...n,context:r}))},Tt=(e,t,s)=>{const{id:r,routeId:n}=e.matches[t],o=e.router.looseRoutesById[n];if(s instanceof Promise)throw s;e.firstBadMatchIndex??=t,We(e,e.router.getMatch(r),s);try{o.options.onError?.(s)}catch(i){s=i,We(e,e.router.getMatch(r),s)}e.updateMatch(r,i=>(i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,i._nonReactive.loadPromise?.resolve(),{...i,error:s,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Se(s)&&!ge(s)&&(e.serialError??=s)},to=(e,t,s,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;const n=s.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!ks(e,t)&&(s.options.loader||s.options.beforeLoad||ro(s))&&typeof n=="number"&&n!==1/0&&(s.options.pendingComponent??e.router.options?.defaultPendingComponent)){const o=setTimeout(()=>{tr(e)},n);r._nonReactive.pendingTimeout=o}},ai=(e,t,s)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;to(e,t,s,r);const n=()=>{const o=e.router.getMatch(t);o.preload&&(o.status==="redirected"||o.status==="notFound")&&We(e,o,o.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(n):n()},ii=(e,t,s,r)=>{const n=e.router.getMatch(t);let o=n._nonReactive.loadPromise;n._nonReactive.loadPromise=yt(()=>{o?.resolve(),o=void 0});const{paramsError:i,searchError:c}=n;i&&Tt(e,s,i),c&&Tt(e,s,c),to(e,t,r,n);const l=new AbortController;let d=!1;const f=()=>{d||(d=!0,e.updateMatch(t,w=>({...w,isFetching:"beforeLoad",fetchCount:w.fetchCount+1,abortController:l})))},u=()=>{n._nonReactive.beforeLoadPromise?.resolve(),n._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,w=>({...w,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{f(),u()});return}n._nonReactive.beforeLoadPromise=yt();const h={...nt(e,s,!1),...n.__routeContext},{search:m,params:g,cause:p}=n,x=ks(e,t),b={search:m,abortController:l,params:g,preload:x,context:h,location:e.location,navigate:w=>e.router.navigate({...w,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:x?"preload":p,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},y=w=>{if(w===void 0){e.router.batch(()=>{f(),u()});return}(Se(w)||ge(w))&&(f(),Tt(e,s,w)),e.router.batch(()=>{f(),e.updateMatch(t,_=>({..._,__beforeLoadContext:w})),u()})};let R;try{if(R=r.options.beforeLoad(b),Ft(R))return f(),R.catch(w=>{Tt(e,s,w)}).then(y)}catch(w){f(),Tt(e,s,w)}y(R)},ci=(e,t)=>{const{id:s,routeId:r}=e.matches[t],n=e.router.looseRoutesById[r],o=()=>c(),i=()=>ii(e,s,t,n),c=()=>{if(eo(e,s))return;const l=ai(e,s,n);return Ft(l)?l.then(i):i()};return o()},li=(e,t,s)=>{const r=e.router.getMatch(t);if(!r||!s.options.head&&!s.options.scripts&&!s.options.headers)return;const n={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([s.options.head?.(n),s.options.scripts?.(n),s.options.headers?.(n)]).then(([o,i,c])=>({meta:o?.meta,links:o?.links,headScripts:o?.scripts,headers:c,scripts:i,styles:o?.styles}))},so=(e,t,s,r,n)=>{const o=t[r-1],{params:i,loaderDeps:c,abortController:l,cause:d}=e.router.getMatch(s),f=nt(e,r),u=ks(e,s);return{params:i,deps:c,preload:!!u,parentMatchPromise:o,abortController:l,context:f,location:e.location,navigate:h=>e.router.navigate({...h,_fromLocation:e.location}),cause:u?"preload":d,route:n,...e.router.options.additionalContext}},qr=async(e,t,s,r,n)=>{try{const o=e.router.getMatch(s);try{(!(Hn??e.router.isServer)||o.ssr===!0)&&$t(n);const i=n.options.loader,c=typeof i=="function"?i:i?.handler,l=c?.(so(e,t,s,r,n)),d=!!c&&Ft(l);if((d||n._lazyPromise||n._componentsPromise||n.options.head||n.options.scripts||n.options.headers||o._nonReactive.minPendingPromise)&&e.updateMatch(s,u=>({...u,isFetching:"loader"})),c){const u=d?await l:l;We(e,e.router.getMatch(s),u),u!==void 0&&e.updateMatch(s,h=>({...h,loaderData:u}))}n._lazyPromise&&await n._lazyPromise;const f=o._nonReactive.minPendingPromise;f&&await f,n._componentsPromise&&await n._componentsPromise,e.updateMatch(s,u=>({...u,error:void 0,context:nt(e,r),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(i){let c=i;if(c?.name==="AbortError"){if(o.abortController.signal.aborted){o._nonReactive.loaderPromise?.resolve(),o._nonReactive.loaderPromise=void 0;return}e.updateMatch(s,d=>({...d,status:d.status==="pending"?"success":d.status,isFetching:!1,context:nt(e,r)}));return}const l=o._nonReactive.minPendingPromise;l&&await l,ge(i)&&await n.options.notFoundComponent?.preload?.(),We(e,e.router.getMatch(s),i);try{n.options.onError?.(i)}catch(d){c=d,We(e,e.router.getMatch(s),d)}!Se(c)&&!ge(c)&&await $t(n,["errorComponent"]),e.updateMatch(s,d=>({...d,error:c,context:nt(e,r),status:"error",isFetching:!1}))}}catch(o){const i=e.router.getMatch(s);i&&(i._nonReactive.loaderPromise=void 0),We(e,i,o)}},di=async(e,t,s)=>{async function r(m,g,p,x,b){const y=Date.now()-g.updatedAt,R=m?b.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:b.options.staleTime??e.router.options.defaultStaleTime??0,w=b.options.shouldReload,_=typeof w=="function"?w(so(e,t,n,s,b)):w,{status:N,invalid:j}=x,S=y>=R&&(!!e.forceStaleReload||x.cause==="enter"||p!==void 0&&p!==x.id);i=N==="success"&&(j||(_??S)),m&&b.options.preload===!1||(i&&!e.sync&&f?(c=!0,(async()=>{try{await qr(e,t,n,s,b);const E=e.router.getMatch(n);E._nonReactive.loaderPromise?.resolve(),E._nonReactive.loadPromise?.resolve(),E._nonReactive.loaderPromise=void 0,E._nonReactive.loadPromise=void 0}catch(E){Se(E)&&await e.router.navigate(E.options)}})()):N!=="success"||i?await qr(e,t,n,s,b):Hr(e,n,s))}const{id:n,routeId:o}=e.matches[s];let i=!1,c=!1;const l=e.router.looseRoutesById[o],d=l.options.loader,f=((typeof d=="function"?void 0:d?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(eo(e,n)){if(!e.router.getMatch(n))return e.matches[s];Hr(e,n,s)}else{const m=e.router.getMatch(n),g=e.router.stores.matchesId.get()[s],p=(g&&e.router.stores.matchStores.get(g)||null)?.routeId===o?g:e.router.stores.matches.get().find(b=>b.routeId===o)?.id,x=ks(e,n);if(m._nonReactive.loaderPromise){if(m.status==="success"&&!e.sync&&!m.preload&&f)return m;await m._nonReactive.loaderPromise;const b=e.router.getMatch(n),y=b._nonReactive.error||b.error;y&&We(e,b,y),b.status==="pending"&&await r(x,m,p,b,l)}else{const b=x&&!e.router.stores.matchStores.has(n),y=e.router.getMatch(n);y._nonReactive.loaderPromise=yt(),b!==y.preload&&e.updateMatch(n,R=>({...R,preload:b})),await r(x,m,p,y,l)}}const u=e.router.getMatch(n);c||(u._nonReactive.loaderPromise?.resolve(),u._nonReactive.loadPromise?.resolve(),u._nonReactive.loadPromise=void 0),clearTimeout(u._nonReactive.pendingTimeout),u._nonReactive.pendingTimeout=void 0,c||(u._nonReactive.loaderPromise=void 0),u._nonReactive.dehydrated=void 0;const h=c?u.isFetching:!1;return h!==u.isFetching||u.invalid!==!1?(e.updateMatch(n,m=>({...m,isFetching:h,invalid:!1})),e.router.getMatch(n)):u};async function Gr(e){const t=e,s=[];oi(t.router)&&tr(t);let r;for(let h=0;h<t.matches.length;h++){try{const m=ci(t,h);Ft(m)&&await m}catch(m){if(Se(m))throw m;if(ge(m))r=m;else if(!t.preload)throw m;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const n=t.firstBadMatchIndex??t.matches.length,o=r&&!t.preload?Wr(t,r):void 0,i=r&&t.preload?0:o!==void 0?Math.min(o+1,n):n;let c,l;for(let h=0;h<i;h++)s.push(di(t,s,h));try{await Promise.all(s)}catch{const h=await Promise.allSettled(s);for(const m of h){if(m.status!=="rejected")continue;const g=m.reason;if(Se(g))throw g;ge(g)?c??=g:l??=g}if(l!==void 0)throw l}const d=c??(r&&!t.preload?r:void 0);let f=t.firstBadMatchIndex!==void 0?t.firstBadMatchIndex:t.matches.length-1;if(!d&&r&&t.preload)return t.matches;if(d){const h=Wr(t,d);if(h===void 0){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not find match for notFound boundary");Ue()}const m=t.matches[h],g=t.router.looseRoutesById[m.routeId],p=t.router.options?.defaultNotFoundComponent;!g.options.notFoundComponent&&p&&(g.options.notFoundComponent=p),d.routeId=m.routeId;const x=m.routeId===t.router.routeTree.id;t.updateMatch(m.id,b=>({...b,...x?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:d},isFetching:!1})),f=h,await $t(g,["notFoundComponent"])}else if(!t.preload){const h=t.matches[0];h.globalNotFound||t.router.getMatch(h.id)?.globalNotFound&&t.updateMatch(h.id,m=>({...m,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const h=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await $t(h,["errorComponent"])}for(let h=0;h<=f;h++){const{id:m,routeId:g}=t.matches[h],p=t.router.looseRoutesById[g];try{const x=li(t,m,p);if(x){const b=await x;t.updateMatch(m,y=>({...y,...b}))}}catch(x){console.error(`Error executing head for route ${g}:`,x)}}const u=tr(t);if(Ft(u)&&await u,d)throw d;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Kr(e,t){const s=t.map(r=>e.options[r]?.preload?.()).filter(Boolean);if(s.length!==0)return Promise.all(s)}function $t(e,t=cs){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(r=>{const{id:n,...o}=r.options;Object.assign(e.options,o),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const s=()=>e._componentsLoaded?void 0:t===cs?(()=>{if(e._componentsPromise===void 0){const r=Kr(e,cs);r?e._componentsPromise=r.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Kr(e,t);return e._lazyPromise?e._lazyPromise.then(s):s()}function ro(e){for(const t of cs)if(e.options[t]?.preload)return!0;return!1}const cs=["component","errorComponent","pendingComponent","notFoundComponent"];function ui(e){return{input:({url:t})=>{for(const s of e)t=sr(s,t);return t},output:({url:t})=>{for(let s=e.length-1;s>=0;s--)t=no(e[s],t);return t}}}function fi(e){const t=Qn(e.basepath),s=`/${t}`,r=e.caseSensitive?s:s.toLowerCase(),n=`${r}/`;return{input:({url:o})=>{const i=e.caseSensitive?o.pathname:o.pathname.toLowerCase();return i===r?o.pathname="/":i.startsWith(n)&&(o.pathname=o.pathname.slice(s.length)),o},output:({url:o})=>(o.pathname=is(["/",t,o.pathname]),o)}}function sr(e,t){const s=e?.input?.({url:t});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return t}function no(e,t){const s=e?.output?.({url:t});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return t}function hi(e,t){const{createMutableStore:s,createReadonlyStore:r,batch:n,init:o}=t,i=new Map,c=new Map,l=new Map,d=s(e.status),f=s(e.loadedAt),u=s(e.isLoading),h=s(e.isTransitioning),m=s(e.location),g=s(e.resolvedLocation),p=s(e.statusCode),x=s(e.redirect),b=s([]),y=s([]),R=s([]),w=r(()=>$s(i,b.get())),_=r(()=>$s(c,y.get())),N=r(()=>$s(l,R.get())),j=r(()=>b.get()[0]),S=r(()=>b.get().some(Y=>i.get(Y)?.get().status==="pending")),E=r(()=>({locationHref:m.get().href,resolvedLocationHref:g.get()?.href,status:d.get()})),D=r(()=>({status:d.get(),loadedAt:f.get(),isLoading:u.get(),isTransitioning:h.get(),matches:w.get(),location:m.get(),resolvedLocation:g.get(),statusCode:p.get(),redirect:x.get()})),T=Ut(64);function F(Y){let de=T.get(Y);return de||(de=r(()=>{const fe=b.get();for(const A of fe){const C=i.get(A);if(C&&C.routeId===Y)return C.get()}}),T.set(Y,de)),de}const ee={status:d,loadedAt:f,isLoading:u,isTransitioning:h,location:m,resolvedLocation:g,statusCode:p,redirect:x,matchesId:b,pendingIds:y,cachedIds:R,matches:w,pendingMatches:_,cachedMatches:N,firstId:j,hasPending:S,matchRouteDeps:E,matchStores:i,pendingMatchStores:c,cachedMatchStores:l,__store:D,getRouteMatchStore:F,setMatches:z,setPending:X,setCached:Z};z(e.matches),o?.(ee);function z(Y){Bs(Y,i,b,s,n)}function X(Y){Bs(Y,c,y,s,n)}function Z(Y){Bs(Y,l,R,s,n)}return ee}function $s(e,t){const s=[];for(const r of t){const n=e.get(r);n&&s.push(n.get())}return s}function Bs(e,t,s,r,n){const o=e.map(c=>c.id),i=new Set(o);n(()=>{for(const c of t.keys())i.has(c)||t.delete(c);for(const c of e){const l=t.get(c.id);if(!l){const d=r(c);d.routeId=c.routeId,t.set(c.id,d);continue}l.routeId=c.routeId,l.get()!==c&&l.set(c)}Fa(s.get(),o)||s.set(o)})}var He="__TSR_index",Yr="popstate",Jr="beforeunload";function mi(e){let t=e.getLocation();const s=new Set,r=i=>{t=e.getLocation(),s.forEach(c=>c({location:t,action:i}))},n=i=>{e.notifyOnIndexChange??!0?r(i):t=e.getLocation()},o=async({task:i,navigateOpts:c,...l})=>{if(c?.ignoreBlocker??!1){i();return}const d=e.getBlockers?.()??[],f=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&d.length&&f)for(const u of d){const h=xs(l.path,l.state);if(await u.blockerFn({currentLocation:t,nextLocation:h,action:l.type})){e.onBlocked?.();return}}i()};return{get location(){return t},get length(){return e.getLength()},subscribers:s,subscribe:i=>(s.add(i),()=>{s.delete(i)}),push:(i,c,l)=>{const d=t.state[He];c=Xr(d+1,c),o({task:()=>{e.pushState(i,c),r({type:"PUSH"})},navigateOpts:l,type:"PUSH",path:i,state:c})},replace:(i,c,l)=>{const d=t.state[He];c=Xr(d,c),o({task:()=>{e.replaceState(i,c),r({type:"REPLACE"})},navigateOpts:l,type:"REPLACE",path:i,state:c})},go:(i,c)=>{o({task:()=>{e.go(i),n({type:"GO",index:i})},navigateOpts:c,type:"GO"})},back:i=>{o({task:()=>{e.back(i?.ignoreBlocker??!1),n({type:"BACK"})},navigateOpts:i,type:"BACK"})},forward:i=>{o({task:()=>{e.forward(i?.ignoreBlocker??!1),n({type:"FORWARD"})},navigateOpts:i,type:"FORWARD"})},canGoBack:()=>t.state[He]!==0,createHref:i=>e.createHref(i),block:i=>{if(!e.setBlockers)return()=>{};const c=e.getBlockers?.()??[];return e.setBlockers([...c,i]),()=>{const l=e.getBlockers?.()??[];e.setBlockers?.(l.filter(d=>d!==i))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Xr(e,t){t||(t={});const s=gr();return{...t,key:s,__TSR_key:s,[He]:e}}function pi(e){const t=typeof document<"u"?window:void 0,s=t.history.pushState,r=t.history.replaceState;let n=[];const o=()=>n,i=S=>n=S,c=(S=>S),l=(()=>xs(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const S=gr();t.history.replaceState({[He]:0,key:S,__TSR_key:S},"")}let d=l(),f,u=!1,h=!1,m=!1,g=!1;const p=()=>d;let x,b;const y=()=>{x&&(j._ignoreSubscribers=!0,(x.isPush?t.history.pushState:t.history.replaceState)(x.state,"",x.href),j._ignoreSubscribers=!1,x=void 0,b=void 0,f=void 0)},R=(S,E,D)=>{const T=c(E);b||(f=d),d=xs(E,D),x={href:T,state:D,isPush:x?.isPush||S==="push"},b||(b=Promise.resolve().then(()=>y()))},w=S=>{d=l(),j.notify({type:S})},_=async()=>{if(h){h=!1;return}const S=l(),E=S.state[He]-d.state[He],D=E===1,T=E===-1,F=!D&&!T||u;u=!1;const ee=F?"GO":T?"BACK":"FORWARD",z=F?{type:"GO",index:E}:{type:T?"BACK":"FORWARD"};if(m)m=!1;else{const X=o();if(typeof document<"u"&&X.length){for(const Z of X)if(await Z.blockerFn({currentLocation:d,nextLocation:S,action:ee})){h=!0,t.history.go(1),j.notify(z);return}}}d=l(),j.notify(z)},N=S=>{if(g){g=!1;return}let E=!1;const D=o();if(typeof document<"u"&&D.length)for(const T of D){const F=T.enableBeforeUnload??!0;if(F===!0){E=!0;break}if(typeof F=="function"&&F()===!0){E=!0;break}}if(E)return S.preventDefault(),S.returnValue=""},j=mi({getLocation:p,getLength:()=>t.history.length,pushState:(S,E)=>R("push",S,E),replaceState:(S,E)=>R("replace",S,E),back:S=>(S&&(m=!0),g=!0,t.history.back()),forward:S=>{S&&(m=!0),g=!0,t.history.forward()},go:S=>{u=!0,t.history.go(S)},createHref:S=>c(S),flush:y,destroy:()=>{t.history.pushState=s,t.history.replaceState=r,t.removeEventListener(Jr,N,{capture:!0}),t.removeEventListener(Yr,_)},onBlocked:()=>{f&&d!==f&&(d=f)},getBlockers:o,setBlockers:i,notifyOnIndexChange:!1});return t.addEventListener(Jr,N,{capture:!0}),t.addEventListener(Yr,_),t.history.pushState=function(...S){const E=s.apply(t.history,S);return j._ignoreSubscribers||w("PUSH"),E},t.history.replaceState=function(...S){const E=r.apply(t.history,S);return j._ignoreSubscribers||w("REPLACE"),E},j}function gi(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function xs(e,t){const s=gi(e),r=s.indexOf("#"),n=s.indexOf("?"),o=gr();return{href:s,pathname:s.substring(0,r>0?n>0?Math.min(r,n):r:n>0?n:s.length),hash:r>-1?s.substring(r):"",search:n>-1?s.slice(n,r===-1?void 0:r):"",state:t||{[He]:0,key:o,__TSR_key:o}}}function gr(){return(Math.random()+1).toString(36).substring(7)}function xt(e,t){const s=t,r=e;return{fromLocation:s,toLocation:r,pathChanged:s?.pathname!==r.pathname,hrefChanged:s?.href!==r.href,hashChanged:s?.hash!==r.hash}}const rr=new WeakMap;var xi=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=s=>s(),this.update=s=>{process.env.NODE_ENV!=="production"&&s.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const r=this.options,n=this.basepath??r?.basepath??"/",o=this.basepath===void 0,i=r?.rewrite;if(this.options={...r,...s},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Xa(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=pi()),this.origin=this.options.origin,this.origin||(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 f;this.resolvePathCache=Ut(1e3),f=this.buildRouteTree(),this.setRoutes(f)}if(!this.stores&&this.latestLocation){const f=this.getStoreConfig(this);this.batch=f.batch,this.stores=hi(yi(this.latestLocation),f),Pi(this)}let c=!1;const l=this.options.basepath??"/",d=this.options.rewrite;if(o||n!==l||i!==d){this.basepath=l;const f=[],u=Qn(l);u&&u!=="/"&&f.push(fi({basepath:l})),d&&f.push(d),this.rewrite=f.length===0?void 0:f.length===1?f[0]:ui(f),this.history&&this.updateLatestLocation(),c=!0}c&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.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 s=Ha(this.routeTree,this.options.caseSensitive,(r,n)=>{r.init({originalIndex:n})});return this.options.routeMasks&&$a(this.options.routeMasks,s.processedTree),s},this.subscribe=(s,r)=>{const n={eventType:s,fn:r};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=s=>{this.subscribers.forEach(r=>{r.eventType===s.type&&r.fn(s)})},this.parseLocation=(s,r)=>{const n=({pathname:l,search:d,hash:f,href:u,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){const b=this.options.parseSearch(d),y=this.options.stringifySearch(b);return{href:l+y+f,publicHref:l+y+f,pathname:Pt(l).path,external:!1,searchStr:y,search:Ye(r?.search,b),hash:Pt(f.slice(1)).path,state:Qe(r?.state,h)}}const m=new URL(u,this.origin),g=sr(this.rewrite,m),p=this.options.parseSearch(g.search),x=this.options.stringifySearch(p);return g.search=x,{href:g.href.replace(g.origin,""),publicHref:u,pathname:Pt(g.pathname).path,external:!!this.rewrite&&g.origin!==this.origin,searchStr:x,search:Ye(r?.search,p),hash:Pt(g.hash.slice(1)).path,state:Qe(r?.state,h)}},o=n(s),{__tempLocation:i,__tempKey:c}=o.state;if(i&&(!c||c===this.tempLocationKey)){const l=n(i);return l.state.key=o.state.key,l.state.__TSR_key=o.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:o}}return o},this.resolvePathWithBase=(s,r)=>Ja({base:s,to:r.includes("//")?pr(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(s,r,n)=>typeof s=="string"?this.matchRoutesInternal({pathname:s,search:r},n):this.matchRoutesInternal(s,r),this.getMatchedRoutes=s=>vi({pathname:s,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=s=>{const r=this.getMatch(s);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(s=>{this.cancelMatch(s)}),this.stores.matchesId.get().forEach(s=>{if(this.stores.pendingMatchStores.has(s))return;const r=this.stores.matchStores.get(s)?.get();r&&(r.status==="pending"||r.isFetching==="loader")&&this.cancelMatch(s)})},this.buildLocation=s=>{const r=(o={})=>{const i=o._fromLocation||this.pendingBuiltLocation||this.latestLocation,c=this.matchRoutesLightweight(i);if(o.from&&process.env.NODE_ENV!=="production"&&o._isNavigate){const T=this.getMatchedRoutes(o.from).matchedRoutes,F=Ur(c.matchedRoutes,z=>Qr(z.fullPath,o.from)),ee=Ur(T,z=>Qr(z.fullPath,c.fullPath));!F&&!ee&&console.warn(`Could not find match for from: ${o.from}`)}const l=o.unsafeRelative==="path"?i.pathname:o.from??c.fullPath,d=o.to?`${o.to}`:void 0,f=c.search,u=Object.assign(Object.create(null),c.params),h=d?.charCodeAt(0)===47?"/":this.resolvePathWithBase(l,"."),m=d?this.resolvePathWithBase(h,d):h,g=o.params===!1||o.params===null?Object.create(null):(o.params??!0)===!0?u:Object.assign(u,Ze(o.params,u)),p=this.routesByPath[Fe(m)];let x;if(p)x=this.getRouteBranch(p);else if(m.includes("$"))x=[];else{const T=this.getMatchedRoutes(m);x=T.matchedRoutes,this.options.notFoundRoute&&(!T.foundRoute||T.foundRoute.path!=="/"&&T.routeParams["**"])&&(x=[...x,this.options.notFoundRoute])}if(x.length&&Gn(g))for(const T of x){const F=T.options.params?.stringify??T.options.stringifyParams;if(F)try{Object.assign(g,F(g))}catch{}}const b=s.leaveParams?m:Pt(zr({path:m,params:g,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;if(process.env.NODE_ENV!=="production"&&p&&!s.leaveParams)try{const T=this.getMatchedRoutes(b);T.foundRoute?.id!==p.id&&console.warn(`Generated path "${b}" for route "${p.id}" matched route "${T.foundRoute?.id}" instead. This can happen when multiple route templates resolve to the same URL. Use the route template that matches the intended route, or adjust params.stringify if it changed the target path.`)}catch{}let y=f;if(s._includeValidateSearch&&this.options.search?.strict){const T={};x.forEach(F=>{if(F.options.validateSearch)try{Object.assign(T,ls(F.options.validateSearch,{...T,...y}))}catch{}}),y=T}y=wi({search:y,dest:o,destRoutes:x,_includeValidateSearch:s._includeValidateSearch}),y=Ye(f,y);const R=this.options.stringifySearch(y),w=o.hash===!0?i.hash:o.hash?Ze(o.hash,i.hash):void 0,_=w?`#${w}`:"";let N=o.state===!0?i.state:o.state?Ze(o.state,i.state):{};N=Qe(i.state,N);const j=`${b}${R}${_}`;let S,E,D=!1;if(this.rewrite){const T=new URL(j,this.origin),F=no(this.rewrite,T);S=T.href.replace(T.origin,""),F.origin!==this.origin?(E=F.href,D=!0):E=F.pathname+F.search+F.hash}else S=Da(j),E=S;return{publicHref:E,href:S,pathname:b,search:y,searchStr:R,state:N,hash:w??"",external:D,unmaskOnReload:o.unmaskOnReload}},n=(o={},i)=>{const c=r(o);let l=i?r(i):void 0;if(!l){const d=Object.create(null);if(this.options.routeMasks){const f=Ba(c.pathname,this.processedTree);if(f){Object.assign(d,f.rawParams);const{from:u,params:h,...m}=f.route,g=h===!1||h===null?Object.create(null):(h??!0)===!0?d:Object.assign(d,Ze(h,d));i={from:s.from,...m,params:g},l=r(i)}}}return l&&(c.maskedLocation=l),c};return s.mask?n(s,{from:s.from,...s.mask}):n(s)},this.commitLocation=async({viewTransition:s,ignoreBlocker:r,...n})=>{let o;const i=()=>{const d=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];d.forEach(u=>{n.state[u]=this.latestLocation.state[u]});const f=st(n.state,this.latestLocation.state);return d.forEach(u=>{delete n.state[u]}),f},c=Fe(this.latestLocation.href)===Fe(n.href);let l=this.commitLocationPromise;if(this.commitLocationPromise=yt(()=>{l?.resolve(),l=void 0}),c&&i())this.load();else{let{maskedLocation:d,hashScrollIntoView:f,...u}=n;d&&(u={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...u,search:u.searchStr,state:{...u.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(u.unmaskOnReload??this.options.unmaskOnReload??!1)&&(u.state.__tempKey=this.tempLocationKey)),u.state.__hashScrollIntoViewOptions=f??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=s,o=n.replace?"REPLACE":"PUSH",this.history[o==="REPLACE"?"replace":"push"](u.publicHref,u.state,{ignoreBlocker:r})}return this._scroll.next=n.resetScroll??!0,this.history.subscribers.size||this.load(o?{action:{type:o}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:s,resetScroll:r,hashScrollIntoView:n,viewTransition:o,ignoreBlocker:i,href:c,...l}={})=>{if(c){const u=this.history.location.state.__TSR_index,h=xs(c,{__TSR_index:s?u:u+1}),m=new URL(h.pathname,this.origin);l.to=sr(this.rewrite,m).pathname,l.search=this.options.parseSearch(h.search),l.hash=h.hash.slice(1)}const d=this.buildLocation({...l,_includeValidateSearch:!0});this.pendingBuiltLocation=d;const f=this.commitLocation({...d,viewTransition:o,replace:s,resetScroll:r,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this.pendingBuiltLocation===d&&(this.pendingBuiltLocation=void 0)}),f},this.navigate=async({to:s,reloadDocument:r,href:n,publicHref:o,...i})=>{let c=!1;if(n)try{new URL(`${n}`),c=!0}catch{}if(c&&!r&&(r=!0),r){if(s!==void 0||!n){const d=this.buildLocation({to:s,...i});n=n??d.publicHref,o=o??d.publicHref}const l=!c&&o?o:n;if(ps(l,this.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked navigation to dangerous protocol: ${l}`);return}if(!i.ignoreBlocker){const d=this.history.getBlockers?.()??[];for(const f of d)if(f?.blockerFn&&await f.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return}i.replace?window.location.replace(l):window.location.href=l;return}return this.buildAndCommitLocation({...i,href:n,to:s,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const s=this.matchRoutes(this.latestLocation),r=this.stores.cachedMatches.get().filter(n=>!s.some(o=>o.id===n.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(s),this.stores.setCached(r)})},this.load=async s=>{const r=s?.action?.type;let n,o,i;const c=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(d=>{this.startTransition(async()=>{try{this.beforeLoad(),r?rr.set(this.latestLocation,r):rr.delete(this.latestLocation);const f=this.latestLocation,u=xt(f,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...u}),this.emit({type:"onBeforeLoad",...u}),await Gr({router:this,sync:s?.sync,forceStaleReload:c.href===f.href,matches:this.stores.pendingMatches.get(),location:f,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let h=null,m=null,g=null,p=null;this.batch(()=>{const x=this.stores.pendingMatches.get(),b=x.length,y=this.stores.matches.get();h=b?y.filter(_=>!this.stores.pendingMatchStores.has(_.id)):null;const R=new Set;for(const _ of this.stores.pendingMatchStores.values())_.routeId&&R.add(_.routeId);const w=new Set;for(const _ of this.stores.matchStores.values())_.routeId&&w.add(_.routeId);m=b?y.filter(_=>!R.has(_.routeId)):null,g=b?x.filter(_=>!w.has(_.routeId)):null,p=b?x.filter(_=>w.has(_.routeId)):y,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),b&&(this.stores.setMatches(x),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...h.filter(_=>_.status!=="error"&&_.status!=="notFound"&&_.status!=="redirected")]),this.clearExpiredCache())});for(const[x,b]of[[m,"onLeave"],[g,"onEnter"],[p,"onStay"]])if(x)for(const y of x)this.looseRoutesById[y.routeId].options[b]?.(y)})})}})}catch(f){Se(f)?(n=f,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):ge(f)&&(o=f);const u=n?n.status:o?404:this.stores.matches.get().some(h=>h.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(u),this.stores.redirect.set(n)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),d()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let l;this.hasNotFoundMatch()?l=404:this.stores.matches.get().some(d=>d.status==="error")&&(l=500),l!==void 0&&this.stores.statusCode.set(l)},this.startViewTransition=s=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let n;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,i=this.stores.resolvedLocation.get(),c=typeof r.types=="function"?r.types(xt(o,i)):r.types;if(c===!1){s();return}n={update:s,types:c}}else n=s;document.startViewTransition(n)}else s()},this.updateMatch=(s,r)=>{this.startTransition(()=>{const n=this.stores.pendingMatchStores.get(s);if(n){n.set(r);return}const o=this.stores.matchStores.get(s);if(o){o.set(r);return}const i=this.stores.cachedMatchStores.get(s);if(i){const c=r(i.get());c.status==="redirected"?this.stores.cachedMatchStores.delete(s)&&this.stores.cachedIds.set(l=>l.filter(d=>d!==s)):i.set(c)}})},this.getMatch=s=>this.stores.cachedMatchStores.get(s)?.get()??this.stores.pendingMatchStores.get(s)?.get()??this.stores.matchStores.get(s)?.get(),this.invalidate=s=>{const r=n=>s?.filter?.(n)??!0?{...n,invalid:!0,...s?.forcePending||n.status==="error"||n.status==="notFound"?{status:"pending",error:void 0}:void 0}:n;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(r)),this.stores.setCached(this.stores.cachedMatches.get().map(r)),this.stores.setPending(this.stores.pendingMatches.get().map(r))}),this.shouldViewTransition=!1,this.load({sync:s?.sync})},this.getParsedLocationHref=s=>s.publicHref||"/",this.resolveRedirect=s=>{const r=s.headers.get("Location");if(!s.options.href||s.options._builtLocation){const n=s.options._builtLocation??this.buildLocation(s.options),o=this.getParsedLocationHref(n);s.options.href=o,s.headers.set("Location",o)}else if(r)try{const n=new URL(r);if(this.origin&&n.origin===this.origin){const o=n.pathname+n.search+n.hash;s.options.href=o,s.headers.set("Location",o)}}catch{}if(s.options.href&&!s.options._builtLocation&&ps(s.options.href,this.protocolAllowlist))throw new Error(process.env.NODE_ENV!=="production"?`Redirect blocked: unsafe protocol in href "${s.options.href}". Allowed protocols: ${Array.from(this.protocolAllowlist).join(", ")}.`:"Redirect blocked: unsafe protocol");return s.headers.get("Location")||s.headers.set("Location",s.options.href),s},this.clearCache=s=>{const r=s?.filter;r!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(n=>!r(n))):this.stores.setCached([])},this.clearExpiredCache=()=>{const s=Date.now(),r=n=>{const o=this.looseRoutesById[n.routeId];if(!o.options.loader)return!0;const i=(n.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:s-n.updatedAt>=i};this.clearCache({filter:r})},this.loadRouteChunk=$t,this.preloadRoute=async s=>{const r=s._builtLocation??this.buildLocation(s);let n=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:s});const o=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...o,...this.stores.cachedIds.get()]),c=n.filter(l=>!i.has(l.id));if(c.length){const l=this.stores.cachedMatches.get();this.stores.setCached([...l,...c])}try{return n=await Gr({router:this,matches:n,location:r,preload:!0,updateMatch:(l,d)=>{o.has(l)?n=n.map(f=>f.id===l?d(f):f):this.updateMatch(l,d)}}),n}catch(l){if(Se(l))return l.options.reloadDocument?void 0:await this.preloadRoute({...l.options,_fromLocation:r});ge(l)||console.error(l);return}},this.matchRoute=(s,r)=>{const n={...s,to:s.to?this.resolvePathWithBase(s.from||"",s.to):void 0,params:s.params||{},leaveParams:!0},o=this.buildLocation(n);if(r?.pending&&this.stores.status.get()!=="pending")return!1;const i=(r?.pending===void 0?!this.stores.isLoading.get():r.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),c=za(o.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,i.pathname,this.processedTree);return!c||s.params&&!st(c.rawParams,s.params,{partial:!0})?!1:r?.includeSearch??!0?st(i.search,o.search,{partial:!0})?c.rawParams:!1:c.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(s=>s.status==="notFound"||s.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??ti,parseSearch:e.parseSearch??ei,protocolAllowlist:e.protocolAllowlist??Ma}),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:s}){this.routesById=e,this.routesByPath=t,this.processedTree=s;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=Xn(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){const s=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:n}=s;let{matchedRoutes:o}=s,i=!1;(r?r.path!=="/"&&n["**"]:Fe(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:i=!0);const c=i?Ri(this.options.notFoundMode,o):void 0,l=new Array(o.length),d=new Map;for(const f of this.stores.matchStores.values())f.routeId&&d.set(f.routeId,f.get());for(let f=0;f<o.length;f++){const u=o[f],h=l[f-1];let m,g,p;{const F=h?.search??e.search,ee=h?._strictSearch??void 0;try{const z=ls(u.options.validateSearch,{...F})??void 0;m={...F,...z},g={...ee,...z},p=void 0}catch(z){let X=z;if(z instanceof bs||(X=new bs(z.message,{cause:z})),t?.throwOnError)throw X;m=F,g={},p=X}}const x=u.options.loaderDeps?.({search:m})??"",b=x?JSON.stringify(x):"",{interpolatedPath:y,usedParams:R}=zr({path:u.fullPath,params:n,decoder:this.pathParamsDecoder,server:this.isServer}),w=u.id+y+b,_=this.getMatch(w),N=d.get(u.id),j=_?._strictParams??R;let S;if(!_)try{en(u,j)}catch(F){if(ge(F)||Se(F)?S=F:S=new bi(F.message,{cause:F}),t?.throwOnError)throw S}Object.assign(n,j);const E=N?"stay":"enter";let D;if(_)D={..._,cause:E,params:N?.params??n,_strictParams:j,search:Ye(N?N.search:_.search,m),_strictSearch:g};else{const F=u.options.loader||u.options.beforeLoad||u.lazyFn||ro(u)?"pending":"success";D={id:w,ssr:u.options.ssr,index:f,routeId:u.id,params:N?.params??n,_strictParams:j,pathname:y,updatedAt:Date.now(),search:N?Ye(N.search,m):m,_strictSearch:g,searchError:void 0,status:F,isFetching:!1,error:void 0,paramsError:S,__routeContext:void 0,_nonReactive:{loadPromise:yt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:E,loaderDeps:N?Qe(N.loaderDeps,x):x,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:u.options.staticData||{},fullPath:u.fullPath}}t?.preload||(D.globalNotFound=c===u.id),D.searchError=p;const T=this.getParentContext(h);D.context={...T,...D.__routeContext,...D.__beforeLoadContext},l[f]=D}for(let f=0;f<l.length;f++){const u=l[f],h=this.looseRoutesById[u.routeId],m=this.getMatch(u.id),g=d.get(u.routeId);if(u.params=g?Ye(g.params,n):n,!m){const p=l[f-1],x=this.getParentContext(p);if(h.options.context){const b={deps:u.loaderDeps,params:u.params,context:x??{},location:e,navigate:y=>this.navigate({...y,_fromLocation:e}),buildLocation:this.buildLocation,cause:u.cause,abortController:u.abortController,preload:!!u.preload,matches:l,routeId:h.id};u.__routeContext=h.options.context(b)??void 0}u.context={...x,...u.__routeContext,...u.__beforeLoadContext}}}return l}matchRoutesLightweight(e){const t=Dt(this.stores.matchesId.get()),s=this.lightweightCache.get(e);if(s&&s[0]===t)return s[1];const{matchedRoutes:r,routeParams:n}=this.getMatchedRoutes(e.pathname),o=Dt(r),i={...e.search};for(const u of r)try{Object.assign(i,ls(u.options.validateSearch,i))}catch{}const c=t&&this.stores.matchStores.get(t)?.get(),l=c&&c.routeId===o.id&&c.pathname===e.pathname;let d;if(l)d=c.params;else{const u=Object.assign(Object.create(null),n);for(const h of r)try{en(h,u)}catch{}d=u}const f={matchedRoutes:r,fullPath:o.fullPath,search:i,params:d};return this.lightweightCache.set(e,[t,f]),f}},bs=class extends Error{},bi=class extends Error{};const Zr=e=>e.endsWith("/")&&e.length>1?e.slice(0,-1):e;function Qr(e,t){return Zr(e)===Zr(t)}function yi(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function ls(e,t){if(e==null)return{};if("~standard"in e){const s=e["~standard"].validate(t);if(s instanceof Promise)throw new bs("Async validation not supported");if(s.issues)throw new bs(JSON.stringify(s.issues,void 0,2),{cause:s});return s.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function vi({pathname:e,routesById:t,processedTree:s}){const r=Object.create(null),n=Fe(e);let o;const i=Va(n,s,!0);return i&&(o=i.route,Object.assign(r,i.rawParams)),{matchedRoutes:i?.branch||[t.__root__],routeParams:r,foundRoute:o}}function wi({search:e,dest:t,destRoutes:s,_includeValidateSearch:r}){return Si(s)(e,t,r??!1)}function Si(e){let t,s;const r=[];for(const o of e){const i=o.options;if("search"in i)i.search?.middlewares&&r.push(...i.search.middlewares);else if(i.preSearchFilters||i.postSearchFilters){const l=({search:d,next:f})=>{const u=f(i.preSearchFilters?i.preSearchFilters.reduce((h,m)=>m(h),d):d);return i.postSearchFilters?i.postSearchFilters.reduce((h,m)=>m(h),u):u};r.push(l)}const c=i.validateSearch;if(c){const l=({search:d,next:f,meta:u})=>{const h=f(d);if(s)try{const m=ls(c,h);if(u&&m)for(const g in m)g in h||(u.defaulted||=new Map).set(g,m[g]);return{...h,...m}}catch{}return h};r.push(l)}}const n=(o,i,c)=>{if(o>=r.length){if(!t.search)return{};if(t.search===!0)return i;const d=Ze(t.search,i);return c&&(c.explicit=d),d}const l=(d,f)=>{if(f){const u=c||{};return{search:n(o+1,d,u),meta:u}}return n(o+1,d,c)};return r[o]({search:i,next:l,meta:c})};return function(i,c,l){return t=c,s=l,n(0,i)}}function Ri(e,t){if(e!=="root")for(let s=t.length-1;s>=0;s--){const r=t[s];if(r.children)return r.id}return rt}function en(e,t){const s=e.options.params?.parse??e.options.parseParams;if(s){const r=s(t);if(r===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,r)}}function ji(){try{return sessionStorage}catch{return}}const Ni="tsr-scroll-restoration-v1_3",oo=ji();function Ci(){try{return JSON.parse(oo?.getItem("tsr-scroll-restoration-v1_3")||"{}")}catch{return{}}}function _i(){try{oo?.setItem(Ni,JSON.stringify(mt))}catch{process.env.NODE_ENV!=="production"&&console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}const mt=Ci(),tn="data-scroll-restoration-id",ki=e=>e.state.__TSR_key||e.href;function Ei(e){const t=e.getAttribute(tn);if(t)return`[${tn}="${t}"]`;let s="",r=e,n;for(;n=r.parentNode;){let o=1,i=r;for(;i=i.previousElementSibling;)o++;const c=`${r.localName}:nth-child(${o})`;s=s?`${c} > ${s}`:c,r=n}return s}let Jt=!1;const pt="window";function nr(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function sn(e){const t=[];for(const s of e){if(s===pt)continue;const r=nr(s);r&&t.push(r)}return t}function Pi(e,t){const s=e.options.scrollRestoration,r=e._scroll;s&&(r.restoring=!0);const n=e.options.getScrollRestorationKey||ki,o=new Map,i=(d,f,u)=>{const h=o.get(d)||{};h.scrollX=f,h.scrollY=u,o.set(d,h)},c=d=>{if(!(Jt||!r.restoring))if(d.target===document)i(pt,scrollX,scrollY);else{const f=d.target;i(f,f.scrollLeft,f.scrollTop)}},l=d=>{if(!r.restoring)return;const f=mt[d]||={};for(const[u,h]of o)u===pt?f[pt]=h:u.isConnected&&(f[Ei(u)]=h)};s&&!r.restoration&&(r.restoration=!0,Jt=!1,history.scrollRestoration="manual",document.addEventListener("scroll",c,!0),e.subscribe("onBeforeLoad",d=>{d.fromLocation&&l(n(d.fromLocation)),o.clear()}),addEventListener("pagehide",()=>{l(n(e.stores.resolvedLocation.get()??e.stores.location.get())),_i()})),!r.reset&&(r.reset=!0,e.subscribe("onRendered",d=>{const f=e.options.scrollRestorationBehavior,u=e.options.scrollToTopSelectors,h=r.next;let m;if(o.clear(),h||(r.next=!0),typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const g=n(d.toLocation),p=d.fromLocation&&n(d.fromLocation);if(r.restoring&&p&&p!==g){const x=mt[p];if(x){let b=mt[g];for(const y in x){if(y===pt){if(h)continue}else{const R=nr(y);if(!R||h&&u&&(m??=sn(u),m.includes(R)))continue}b||(b=mt[g]={}),b[y]??=x[y]}}}Jt=!0;try{const x=d.toLocation.hash,b=d.toLocation.state.__hashScrollIntoViewOptions??!0;let y=!1;if(h){const R=rr.get(d.toLocation),w=x&&b&&(R==="PUSH"||R==="REPLACE"),_=r.restoring?mt[g]:void 0;if(_)for(const N in _){const{scrollX:j,scrollY:S}=_[N];if(N===pt){if(w)continue;scrollTo({top:S,left:j,behavior:f}),y=!0}else{const E=nr(N);E&&(E.scrollLeft=j,E.scrollTop=S)}}if(!y&&!x){const N={top:0,left:0,behavior:f};if(scrollTo(N),u){m??=sn(u);for(const j of m)j.scrollTo(N)}}}!y&&x&&b&&document.getElementById(x)?.scrollIntoView(b)}finally{Jt=!1}}))}const Ti="Error preloading route! ☝️";var ao=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=>{this.originalIndex=t.originalIndex;const s=this.options,r=!s?.path&&!s?.id;if(this.parentRoute=this.options.getParentRoute?.(),r)this._path=rt;else if(!this.parentRoute){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.");Ue()}let n=r?rt:s?.path;n&&n!=="/"&&(n=Zn(n));const o=s?.id||n;let i=r?rt:is([this.parentRoute.id==="__root__"?"":this.parentRoute.id,o]);n==="__root__"&&(n="/"),i!=="__root__"&&(i=is(["/",i]));const c=i==="__root__"?"/":is([this.parentRoute.fullPath,n]);this._path=n,this._id=i,this._fullPath=c,this._to=Fe(c)},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=>ni({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}},Ai=class extends ao{constructor(e){super(e)}};function xr(e){const t=e.errorComponent??br;return a.jsx(Oi,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:s,reset:r})=>s?B.createElement(t,{error:s,reset:r}):e.children})}var Oi=class extends B.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const s=e.getResetKey();return t.error&&t.resetKey!==s?{resetKey:s,error:null}:{resetKey:s}}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 br({error:e}){const[t,s]=B.useState(process.env.NODE_ENV!=="production");return a.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[a.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),a.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>s(r=>!r),children:t?"Hide Error":"Show Error"})]}),a.jsx("div",{style:{height:".25rem"}}),t?a.jsx("div",{children:a.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?a.jsx("code",{children:e.message}):null})}):null]})}function Li({children:e,fallback:t=null}){return io()?a.jsx(k.Fragment,{children:e}):a.jsx(k.Fragment,{children:t})}function io(){return k.useSyncExternalStore(Ii,()=>!0,()=>!1)}function Ii(){return()=>{}}var co=B.createContext(null);function Ce(e){const t=B.useContext(co);return process.env.NODE_ENV!=="production"&&(t||console.warn("Warning: useRouter must be used inside a <RouterProvider> component!")),t}var Es=B.createContext(void 0),Mi=B.createContext(void 0),se=(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))(se||{});function Di({update:e,notify:t,unwatched:s}){return{link:r,unlink:n,propagate:o,checkDirty:i,shallowPropagate:c};function r(d,f,u){const h=f.depsTail;if(h!==void 0&&h.dep===d)return;const m=h!==void 0?h.nextDep:f.deps;if(m!==void 0&&m.dep===d){m.version=u,f.depsTail=m;return}const g=d.subsTail;if(g!==void 0&&g.version===u&&g.sub===f)return;const p=f.depsTail=d.subsTail={version:u,dep:d,sub:f,prevDep:h,nextDep:m,prevSub:g,nextSub:void 0};m!==void 0&&(m.prevDep=p),h!==void 0?h.nextDep=p:f.deps=p,g!==void 0?g.nextSub=p:d.subs=p}function n(d,f=d.sub){const u=d.dep,h=d.prevDep,m=d.nextDep,g=d.nextSub,p=d.prevSub;return m!==void 0?m.prevDep=h:f.depsTail=h,h!==void 0?h.nextDep=m:f.deps=m,g!==void 0?g.prevSub=p:u.subsTail=p,p!==void 0?p.nextSub=g:(u.subs=g)===void 0&&s(u),m}function o(d){let f=d.nextSub,u;e:do{const h=d.sub;let m=h.flags;if(m&60?m&12?m&4?!(m&48)&&l(d,h)?(h.flags=m|40,m&=1):m=0:h.flags=m&-9|32:m=0:h.flags=m|32,m&2&&t(h),m&1){const g=h.subs;if(g!==void 0){const p=(d=g).nextSub;p!==void 0&&(u={value:f,prev:u},f=p);continue}}if((d=f)!==void 0){f=d.nextSub;continue}for(;u!==void 0;)if(d=u.value,u=u.prev,d!==void 0){f=d.nextSub;continue e}break}while(!0)}function i(d,f){let u,h=0,m=!1;e:do{const g=d.dep,p=g.flags;if(f.flags&16)m=!0;else if((p&17)===17){if(e(g)){const x=g.subs;x.nextSub!==void 0&&c(x),m=!0}}else if((p&33)===33){(d.nextSub!==void 0||d.prevSub!==void 0)&&(u={value:d,prev:u}),d=g.deps,f=g,++h;continue}if(!m){const x=d.nextDep;if(x!==void 0){d=x;continue}}for(;h--;){const x=f.subs,b=x.nextSub!==void 0;if(b?(d=u.value,u=u.prev):d=x,m){if(e(f)){b&&c(x),f=d.sub;continue}m=!1}else f.flags&=-33;f=d.sub;const y=d.nextDep;if(y!==void 0){d=y;continue e}}return m}while(!0)}function c(d){do{const f=d.sub,u=f.flags;(u&48)===32&&(f.flags=u|16,(u&6)===2&&t(f))}while((d=d.nextSub)!==void 0)}function l(d,f){let u=f.depsTail;for(;u!==void 0;){if(u===d)return!0;u=u.prevDep}return!1}}function Fi(e,t,s){const r=typeof e=="object",n=r?e:void 0;return{next:(r?e.next:e)?.bind(n),error:(r?e.error:t)?.bind(n),complete:(r?e.complete:s)?.bind(n)}}const or=[];let ds=0;const{link:rn,unlink:Ui,propagate:$i,checkDirty:lo,shallowPropagate:nn}=Di({update(e){return e._update()},notify(e){or[ar++]=e,e.flags&=~se.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=se.Mutable|se.Dirty,ys(e))}});let Xt=0,ar=0,Oe,ir=0;function uo(e){try{++ir,e()}finally{--ir||fo()}}function ys(e){const t=e.depsTail;let s=t!==void 0?t.nextDep:e.deps;for(;s!==void 0;)s=Ui(s,e)}function fo(){if(!(ir>0)){for(;Xt<ar;){const e=or[Xt];or[Xt++]=void 0,e.notify()}Xt=0,ar=0}}function on(e,t){const s=typeof e=="function",r=e,n={_snapshot:s?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:s?se.None:se.Mutable,get(){return Oe!==void 0&&rn(n,Oe,ds),n._snapshot},subscribe(o){const i=Fi(o),c={current:!1},l=Bi(()=>{n.get(),c.current?i.next?.(n._snapshot):c.current=!0});return{unsubscribe:()=>{l.stop()}}},_update(o){const i=Oe,c=t?.compare??Object.is;if(s)Oe=n,++ds,n.depsTail=void 0;else if(o===void 0)return!1;s&&(n.flags=se.Mutable|se.RecursedCheck);try{const l=n._snapshot,d=typeof o=="function"?o(l):o===void 0&&s?r(l):o;return l===void 0||!c(l,d)?(n._snapshot=d,!0):!1}finally{Oe=i,s&&(n.flags&=~se.RecursedCheck),ys(n)}}};return s?(n.flags=se.Mutable|se.Dirty,n.get=function(){const o=n.flags;if(o&se.Dirty||o&se.Pending&&lo(n.deps,n)){if(n._update()){const i=n.subs;i!==void 0&&nn(i)}}else o&se.Pending&&(n.flags=o&~se.Pending);return Oe!==void 0&&rn(n,Oe,ds),n._snapshot}):n.set=function(o){if(n._update(o)){const i=n.subs;i!==void 0&&($i(i),nn(i),fo())}},n}function Bi(e){const t=()=>{const r=Oe;Oe=s,++ds,s.depsTail=void 0,s.flags=se.Watching|se.RecursedCheck;try{return e()}finally{Oe=r,s.flags&=~se.RecursedCheck,ys(s)}},s={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:se.Watching|se.RecursedCheck,notify(){const r=this.flags;r&se.Dirty||r&se.Pending&&lo(this.deps,this)?t():this.flags=se.Watching},stop(){this.flags=se.None,this.depsTail=void 0,ys(this)}};return t(),s}var Zt={exports:{}},zs={},Qt={exports:{}},Vs={};var an;function zi(){if(an)return Vs;an=1;var e=k;function t(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var s=typeof Object.is=="function"?Object.is:t,r=e.useState,n=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function c(u,h){var m=h(),g=r({inst:{value:m,getSnapshot:h}}),p=g[0].inst,x=g[1];return o(function(){p.value=m,p.getSnapshot=h,l(p)&&x({inst:p})},[u,m,h]),n(function(){return l(p)&&x({inst:p}),u(function(){l(p)&&x({inst:p})})},[u]),i(m),m}function l(u){var h=u.getSnapshot;u=u.value;try{var m=h();return!s(u,m)}catch{return!0}}function d(u,h){return h()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return Vs.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Vs}var Ws={};var cn;function Vi(){return cn||(cn=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}function t(m,g){f||n.startTransition===void 0||(f=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var p=g();if(!u){var x=g();o(p,x)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}x=i({inst:{value:p,getSnapshot:g}});var b=x[0].inst,y=x[1];return l(function(){b.value=p,b.getSnapshot=g,s(b)&&y({inst:b})},[m,p,g]),c(function(){return s(b)&&y({inst:b}),m(function(){s(b)&&y({inst:b})})},[m]),d(p),p}function s(m){var g=m.getSnapshot;m=m.value;try{var p=g();return!o(m,p)}catch{return!0}}function r(m,g){return g()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=k,o=typeof Object.is=="function"?Object.is:e,i=n.useState,c=n.useEffect,l=n.useLayoutEffect,d=n.useDebugValue,f=!1,u=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Ws.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ws}var ln;function ho(){return ln||(ln=1,process.env.NODE_ENV==="production"?Qt.exports=zi():Qt.exports=Vi()),Qt.exports}var dn;function Wi(){if(dn)return zs;dn=1;var e=k,t=ho();function s(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var r=typeof Object.is=="function"?Object.is:s,n=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,c=e.useMemo,l=e.useDebugValue;return zs.useSyncExternalStoreWithSelector=function(d,f,u,h,m){var g=o(null);if(g.current===null){var p={hasValue:!1,value:null};g.current=p}else p=g.current;g=c(function(){function b(N){if(!y){if(y=!0,R=N,N=h(N),m!==void 0&&p.hasValue){var j=p.value;if(m(j,N))return w=j}return w=N}if(j=w,r(R,N))return j;var S=h(N);return m!==void 0&&m(j,S)?(R=N,j):(R=N,w=S)}var y=!1,R,w,_=u===void 0?null:u;return[function(){return b(f())},_===null?void 0:function(){return b(_())}]},[f,u,h,m]);var x=n(d,g[0],g[1]);return i(function(){p.hasValue=!0,p.value=x},[x]),l(x),x},zs}var Hs={};var un;function Hi(){return un||(un=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=k,s=ho(),r=typeof Object.is=="function"?Object.is:e,n=s.useSyncExternalStore,o=t.useRef,i=t.useEffect,c=t.useMemo,l=t.useDebugValue;Hs.useSyncExternalStoreWithSelector=function(d,f,u,h,m){var g=o(null);if(g.current===null){var p={hasValue:!1,value:null};g.current=p}else p=g.current;g=c(function(){function b(N){if(!y){if(y=!0,R=N,N=h(N),m!==void 0&&p.hasValue){var j=p.value;if(m(j,N))return w=j}return w=N}if(j=w,r(R,N))return j;var S=h(N);return m!==void 0&&m(j,S)?(R=N,j):(R=N,w=S)}var y=!1,R,w,_=u===void 0?null:u;return[function(){return b(f())},_===null?void 0:function(){return b(_())}]},[f,u,h,m]);var x=n(d,g[0],g[1]);return i(function(){p.hasValue=!0,p.value=x},[x]),l(x),x},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Hs}var fn;function qi(){return fn||(fn=1,process.env.NODE_ENV==="production"?Zt.exports=Wi():Zt.exports=Hi()),Zt.exports}var Gi=qi();function Ki(e,t){return e===t}function je(e,t,s=Ki){const r=k.useCallback(i=>{if(!e)return()=>{};const{unsubscribe:c}=e.subscribe(i);return c},[e]),n=k.useCallback(()=>e?.get(),[e]);return Gi.useSyncExternalStoreWithSelector(r,n,n,t,s)}var qs={get(){},subscribe(){return{unsubscribe(){}}}};function Yi(e,t){const s=B.useRef();return r=>{const n=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?s.current=Qe(s.current,n):n}}function dt(e){const t=Ce(),s=B.useContext(e.from?Mi:Es),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(s),n=Yi(e,t),o=je(r??qs,i=>i?n(i):qs);if(o!==qs)return o;if(e.shouldThrow??!0){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`);Ue()}}function mo(e){return dt({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function po(e){const{select:t,...s}=e;return dt({...s,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function go(e){return dt({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const s=e.strict===!1?t.params:t._strictParams;return e.select?e.select(s):s}})}function xo(e){return dt({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function bo(e){const t=Ce();return B.useCallback(s=>t.navigate({...s,from:s.from??e?.from}),[e?.from,t])}function yo(e){return dt({...e,select:t=>e.select?e.select(t.context):t.context})}function Ji(e,t){const s=Ce(),r=Ta(t),{activeProps:n,inactiveProps:o,activeOptions:i,to:c,preload:l,preloadDelay:d,preloadIntentProximity:f,hashScrollIntoView:u,replace:h,startTransition:m,resetScroll:g,viewTransition:p,children:x,target:b,disabled:y,style:R,className:w,onClick:_,onBlur:N,onFocus:j,onMouseEnter:S,onMouseLeave:E,onTouchStart:D,ignoreBlocker:T,params:F,search:ee,hash:z,state:X,mask:Z,reloadDocument:Y,unsafeRelative:de,from:fe,_fromLocation:A,...C}=e,U=io(),W=B.useMemo(()=>e,[s,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),q=je(s.stores.location,te=>te,(te,we)=>te.href===we.href),I=B.useMemo(()=>{const te={_fromLocation:q,...W};return s.buildLocation(te)},[s,q,W]),M=I.maskedLocation?I.maskedLocation.publicHref:I.publicHref,$=I.maskedLocation?I.maskedLocation.external:I.external,J=B.useMemo(()=>sc(M,$,s.history,y),[y,$,M,s.history]),G=B.useMemo(()=>{if(J?.external){if(ps(J.href,s.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${J.href}`);return}return J.href}if(!rc(c)&&!(typeof c!="string"||c.indexOf(":")===-1))try{if(new URL(c),ps(c,s.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${c}`);return}return c}catch{}},[c,J,s.protocolAllowlist]),ue=B.useMemo(()=>{if(G)return!1;if(i?.exact){if(!Ya(q.pathname,I.pathname,s.basepath))return!1}else{const te=gs(q.pathname,s.basepath),we=gs(I.pathname,s.basepath);if(!(te.startsWith(we)&&(te.length===we.length||te[we.length]==="/")))return!1}return(i?.includeSearch??!0)&&!st(q.search,I.search,{partial:!i?.exact,ignoreUndefined:!i?.explicitUndefined})?!1:i?.includeHash?U&&q.hash===I.hash:!0},[i?.exact,i?.explicitUndefined,i?.includeHash,i?.includeSearch,q,G,U,I.hash,I.pathname,I.search,s.basepath]),be=ue?Ze(n,{})??Xi:Gs,ne=ue?Gs:Ze(o,{})??Gs,Ie=[w,be.className,ne.className].filter(Boolean).join(" "),_e=(R||be.style||ne.style)&&{...R,...be.style,...ne.style},[ke,V]=B.useState(!1),me=B.useRef(!1),ye=e.reloadDocument||G?!1:l??s.options.defaultPreload,Ee=d??s.options.defaultPreloadDelay??0,Te=B.useCallback(()=>{s.preloadRoute({...W,_builtLocation:I}).catch(te=>{console.warn(te),console.warn(Ti)})},[s,W,I]);Pa(r,B.useCallback(te=>{te?.isIntersecting&&Te()},[Te]),tc,{disabled:!!y||ye!=="viewport"}),B.useEffect(()=>{me.current||!y&&ye==="render"&&(Te(),me.current=!0)},[y,Te,ye]);const Ls=te=>{const we=te.currentTarget.getAttribute("target"),Ke=b!==void 0?b:we;if(!y&&!nc(te)&&!te.defaultPrevented&&(!Ke||Ke==="_self")&&te.button===0){te.preventDefault(),Na.flushSync(()=>{V(!0)});const ja=s.subscribe("onResolved",()=>{ja(),V(!1)});s.navigate({...W,replace:h,resetScroll:g,hashScrollIntoView:u,startTransition:m,viewTransition:p,ignoreBlocker:T})}};if(G)return{...C,ref:r,href:G,...x&&{children:x},...b&&{target:b},...y&&{disabled:y},...R&&{style:R},...w&&{className:w},..._&&{onClick:_},...N&&{onBlur:N},...j&&{onFocus:j},...S&&{onMouseEnter:S},...E&&{onMouseLeave:E},...D&&{onTouchStart:D}};const $e=te=>{if(y||ye!=="intent")return;if(!Ee){Te();return}const we=te.currentTarget;if(At.has(we))return;const Ke=setTimeout(()=>{At.delete(we),Te()},Ee);At.set(we,Ke)},Ra=te=>{y||ye!=="intent"||Te()},Tr=te=>{if(y||!ye||!Ee)return;const we=te.currentTarget,Ke=At.get(we);Ke&&(clearTimeout(Ke),At.delete(we))};return{...C,...be,...ne,href:J?.href,ref:r,onClick:ft([_,Ls]),onBlur:ft([N,Tr]),onFocus:ft([j,$e]),onMouseEnter:ft([S,$e]),onMouseLeave:ft([E,Tr]),onTouchStart:ft([D,Ra]),disabled:!!y,target:b,..._e&&{style:_e},...Ie&&{className:Ie},...y&&Zi,...ue&&Qi,...U&&ke&&ec}}var Gs={},Xi={className:"active"},Zi={role:"link","aria-disabled":!0},Qi={"data-status":"active","aria-current":"page"},ec={"data-transitioning":"transitioning"},At=new WeakMap,tc={rootMargin:"100px"},ft=e=>t=>{for(const s of e)if(s){if(t.defaultPrevented)return;s(t)}};function sc(e,t,s,r){if(!r)return t?{href:e,external:!0}:{href:s.createHref(e)||"/",external:!1}}function rc(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var vs=B.forwardRef((e,t)=>{const{_asChild:s,...r}=e,{type:n,...o}=Ji(r,t),i=typeof r.children=="function"?r.children({isActive:o["data-status"]==="active"}):r.children;if(!s){const{disabled:c,...l}=o;return B.createElement("a",l,i)}return B.createElement(s,o,i)});function nc(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var oc=class extends ao{constructor(e){super(e),this.useMatch=t=>dt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>yo({...t,from:this.id}),this.useSearch=t=>xo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>go({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>po({...t,from:this.id}),this.useLoaderData=t=>mo({...t,from:this.id}),this.useNavigate=()=>bo({from:this.fullPath}),this.Link=k.forwardRef((t,s)=>a.jsx(vs,{ref:s,from:this.fullPath,...t}))}};function zt(e){return new oc(e)}var ac=class extends Ai{constructor(e){super(e),this.useMatch=t=>dt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>yo({...t,from:this.id}),this.useSearch=t=>xo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>go({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>po({...t,from:this.id}),this.useLoaderData=t=>mo({...t,from:this.id}),this.useNavigate=()=>bo({from:this.fullPath}),this.Link=k.forwardRef((t,s)=>a.jsx(vs,{ref:s,from:this.fullPath,...t}))}};function ic(e){return new ac(e)}function cc(e){const t=Ce(),s=`not-found-${je(t.stores.location,r=>r.pathname)}-${je(t.stores.status,r=>r)}`;return a.jsx(xr,{getResetKey:()=>s,onCatch:(r,n)=>{if(ge(r))e.onCatch?.(r,n);else throw r},errorComponent:({error:r})=>{if(ge(r))return e.fallback?.(r);throw r},children:e.children})}function lc(){return a.jsx("p",{children:"Not Found"})}function gt(e){return a.jsx(a.Fragment,{children:e.children})}function vo(e,t,s){return t.options.notFoundComponent?a.jsx(t.options.notFoundComponent,{...s}):e.options.defaultNotFoundComponent?a.jsx(e.options.defaultNotFoundComponent,{...s}):(process.env.NODE_ENV!=="production"&&(t.options.notFoundComponent||console.warn(`Warning: A notFoundError was encountered on the route with ID "${t.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`)),a.jsx(lc,{}))}function dc(e){return null}function uc(){return dc(Ce()),null}var fc=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,hc=(e,t)=>e[0]===t[0]&&e[1]===t[1],wo=B.memo(function({matchId:t}){const s=Ce(),r=s.stores.matchStores.get(t);if(!r){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find match for matchId "${t}". Please file an issue!`);Ue()}const n=je(s.stores.loadedAt,i=>i),o=je(r,i=>i,fc);return a.jsx(mc,{router:s,matchId:t,resetKey:n,matchState:B.useMemo(()=>{const i=o.routeId,c=s.routesById[i].parentRoute?.id;return{routeId:i,ssr:o.ssr,_displayPending:o._displayPending,parentRouteId:c}},[o._displayPending,o.routeId,o.ssr,s.routesById])})});function mc({router:e,matchId:t,resetKey:s,matchState:r}){const n=e.routesById[r.routeId],o=n.options.pendingComponent??e.options.defaultPendingComponent,i=o?a.jsx(o,{}):null,c=n.options.errorComponent??e.options.defaultErrorComponent,l=n.options.onCatch??e.options.defaultOnCatch,d=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,f=r.ssr===!1||r.ssr==="data-only",u=(!n.isRoot||n.options.wrapInSuspense||f)&&(n.options.wrapInSuspense??o??(n.options.errorComponent?.preload||f))?B.Suspense:gt,h=c?xr:gt,m=d?cc:gt;return a.jsxs(n.isRoot?n.options.shellComponent??gt:gt,{children:[a.jsx(Es.Provider,{value:t,children:a.jsx(u,{fallback:i,children:a.jsx(h,{getResetKey:()=>s,errorComponent:c||br,onCatch:(g,p)=>{if(ge(g))throw g.routeId??=r.routeId,g;process.env.NODE_ENV!=="production"&&console.warn(`Warning: Error in route match: ${t}`),l?.(g,p)},children:a.jsx(m,{fallback:g=>{if(g.routeId??=r.routeId,!d||g.routeId&&g.routeId!==r.routeId||!g.routeId&&!n.isRoot)throw g;return B.createElement(d,g)},children:f||r._displayPending?a.jsx(Li,{fallback:i,children:a.jsx(hn,{matchId:t})}):a.jsx(hn,{matchId:t})})})})}),r.parentRouteId===rt?a.jsxs(a.Fragment,{children:[a.jsx(pc,{}),e.options.scrollRestoration&&Hn?a.jsx(uc,{}):null]}):null]})}function pc(){const e=Ce(),t=B.useRef();return Mt(()=>{const s=e.stores.resolvedLocation.get(),r=t.current;s&&(!r||r.href!==s.href)&&e.emit({type:"onRendered",...xt(e.stores.location.get(),r??s)}),t.current=s},[je(e.stores.resolvedLocation,s=>s?.state.__TSR_key),e]),null}var hn=B.memo(function({matchId:t}){const s=Ce(),r=(f,u)=>s.getMatch(f.id)?._nonReactive[u]??f._nonReactive[u],n=s.stores.matchStores.get(t);if(!n){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find match for matchId "${t}". Please file an issue!`);Ue()}const o=je(n,f=>f),i=o.routeId,c=s.routesById[i],l=B.useMemo(()=>{const f=(s.routesById[i].options.remountDeps??s.options.defaultRemountDeps)?.({routeId:i,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch});return f?JSON.stringify(f):void 0},[i,o.loaderDeps,o._strictParams,o._strictSearch,s.options.defaultRemountDeps,s.routesById]),d=B.useMemo(()=>{const f=c.options.component??s.options.defaultComponent;return f?a.jsx(f,{},l):a.jsx(So,{})},[l,c.options.component,s.options.defaultComponent]);if(o._displayPending)throw r(o,"displayPendingPromise");if(o._forcePending)throw r(o,"minPendingPromise");if(o.status==="pending"){const f=c.options.pendingMinMs??s.options.defaultPendingMinMs;if(f){const u=s.getMatch(o.id);if(u&&!u._nonReactive.minPendingPromise){const h=yt();u._nonReactive.minPendingPromise=h,setTimeout(()=>{h.resolve(),u._nonReactive.minPendingPromise=void 0},f)}}throw r(o,"loadPromise")}if(o.status==="notFound"){if(!ge(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a notFound error");Ue()}return vo(s,c,o.error)}if(o.status==="redirected"){if(!Se(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a redirect error");Ue()}throw r(o,"loadPromise")}if(o.status==="error")throw o.error;return d}),So=B.memo(function(){const t=Ce(),s=B.useContext(Es);let r,n=!1,o;{const d=s?t.stores.matchStores.get(s):void 0;[r,n]=je(d,f=>[f?.routeId,f?.globalNotFound??!1],hc),o=je(t.stores.matchesId,f=>f[f.findIndex(u=>u===s)+1])}const i=r?t.routesById[r]:void 0,c=t.options.defaultPendingComponent?a.jsx(t.options.defaultPendingComponent,{}):null;if(n){if(!i){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not resolve route for Outlet render");Ue()}return vo(t,i,void 0)}if(!o)return null;const l=a.jsx(wo,{matchId:o});return r===rt?a.jsx(B.Suspense,{fallback:c,children:l}):l});function gc(){const e=Ce(),t=B.useRef({router:e,mounted:!1}),[s,r]=B.useState(!1),n=je(e.stores.isLoading,u=>u),o=je(e.stores.hasPending,u=>u),i=Is(n),c=n||s||o,l=Is(c),d=n||o,f=Is(d);return e.startTransition=u=>{r(!0),B.startTransition(()=>{u(),r(!1)})},B.useEffect(()=>{const u=e.history.subscribe(e.load),h=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Fe(e.latestLocation.publicHref)!==Fe(h.publicHref)&&e.commitLocation({...h,replace:!0}),()=>{u()}},[e,e.history]),Mt(()=>{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(h){console.error(h)}})()},[e]),Mt(()=>{i&&!n&&e.emit({type:"onLoad",...xt(e.stores.location.get(),e.stores.resolvedLocation.get())})},[i,e,n]),Mt(()=>{f&&!d&&e.emit({type:"onBeforeRouteMount",...xt(e.stores.location.get(),e.stores.resolvedLocation.get())})},[d,f,e]),Mt(()=>{if(l&&!c){const u=xt(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...u}),uo(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())})}},[c,l,e]),null}function xc(){const e=Ce(),t=e.routesById[rt].options.pendingComponent??e.options.defaultPendingComponent,s=t?a.jsx(t,{}):null,r=a.jsxs(typeof document<"u"&&e.ssr?gt:B.Suspense,{fallback:s,children:[a.jsx(gc,{}),a.jsx(bc,{})]});return e.options.InnerWrap?a.jsx(e.options.InnerWrap,{children:r}):r}function bc(){const e=Ce(),t=je(e.stores.firstId,n=>n),s=je(e.stores.loadedAt,n=>n),r=t?a.jsx(wo,{matchId:t}):null;return a.jsx(Es.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:a.jsx(xr,{getResetKey:()=>s,errorComponent:br,onCatch:process.env.NODE_ENV!=="production"?n=>{console.warn("Warning: The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!"),console.warn(`Warning: ${n.message||n.toString()}`)}:void 0,children:r})})}var yc=e=>({createMutableStore:on,createReadonlyStore:on,batch:uo}),Ro=e=>new vc(e),vc=class extends xi{constructor(e){super(e,yc)}};function wc({router:e,children:t,...s}){Gn(s)&&e.update({...e.options,...s,context:{...e.options.context,...s.context}});const r=a.jsx(co.Provider,{value:e,children:t});return e.options.Wrap?a.jsx(e.options.Wrap,{children:r}):r}function Sc({router:e,...t}){return a.jsx(wc,{router:e,...t,children:a.jsx(xc,{})})}function jo(e,t){return function(){return e.apply(t,arguments)}}const{toString:Rc}=Object.prototype,{getPrototypeOf:vt}=Object,{iterator:Vt,toStringTag:No}=Symbol,ws=(({hasOwnProperty:e})=>(t,s)=>e.call(t,s))(Object.prototype),Bt=(e,t)=>{let s=e;const r=[];for(;s!=null&&s!==Object.prototype;){if(r.indexOf(s)!==-1)return!1;if(r.push(s),ws(s,t))return!0;s=vt(s)}return!1},jc=(e,t)=>e!=null&&Bt(e,t)?e[t]:void 0,yr=(e=>t=>{const s=Rc.call(t);return e[s]||(e[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),Pe=e=>(e=e.toLowerCase(),t=>yr(t)===e),Ps=e=>t=>typeof t===e,{isArray:it}=Array,wt=Ps("undefined");function jt(e){return e!==null&&!wt(e)&&e.constructor!==null&&!wt(e.constructor)&&Re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Co=Pe("ArrayBuffer");function Nc(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Co(e.buffer),t}const Cc=Ps("string"),Re=Ps("function"),_o=Ps("number"),Nt=e=>e!==null&&typeof e=="object",_c=e=>e===!0||e===!1,us=e=>{if(!Nt(e))return!1;const t=vt(e);return(t===null||t===Object.prototype||vt(t)===null)&&!Bt(e,No)&&!Bt(e,Vt)},kc=e=>{if(!Nt(e)||jt(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Ec=Pe("Date"),Pc=Pe("File"),Tc=e=>!!(e&&typeof e.uri<"u"),Ac=e=>e&&typeof e.getParts<"u",Oc=Pe("Blob"),Lc=Pe("FileList"),Ic=e=>Nt(e)&&Re(e.pipe);function Mc(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const mn=Mc(),pn=typeof mn.FormData<"u"?mn.FormData:void 0,Dc=e=>{if(!e)return!1;if(pn&&e instanceof pn)return!0;const t=vt(e);if(!t||t===Object.prototype||!Re(e.append))return!1;const s=yr(e);return s==="formdata"||s==="object"&&Re(e.toString)&&e.toString()==="[object FormData]"},Fc=Pe("URLSearchParams"),[Uc,$c,Bc,zc]=["ReadableStream","Request","Response","Headers"].map(Pe),Vc=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Wt(e,t,{allOwnKeys:s=!1}={}){if(e===null||typeof e>"u")return;let r,n;if(typeof e!="object"&&(e=[e]),it(e))for(r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else{if(jt(e))return;const o=s?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(r=0;r<i;r++)c=o[r],t.call(null,e[c],c,e)}}function ko(e,t){if(jt(e))return null;t=t.toLowerCase();const s=Object.keys(e);let r=s.length,n;for(;r-- >0;)if(n=s[r],t===n.toLowerCase())return n;return null}const tt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Eo=e=>!wt(e)&&e!==tt;function cr(...e){const{caseless:t,skipUndefined:s}=Eo(this)&&this||{},r={},n=(o,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const c=t&&typeof i=="string"&&ko(r,i)||i,l=ws(r,c)?r[c]:void 0;us(l)&&us(o)?r[c]=cr(l,o):us(o)?r[c]=cr({},o):it(o)?r[c]=o.slice():(!s||!wt(o))&&(r[c]=o)};for(let o=0,i=e.length;o<i;o++){const c=e[o];if(!c||jt(c)||(Wt(c,n),typeof c!="object"||it(c)))continue;const l=Object.getOwnPropertySymbols(c);for(let d=0;d<l.length;d++){const f=l[d];tl.call(c,f)&&n(c[f],f)}}return r}const Wc=(e,t,s,{allOwnKeys:r}={})=>(Wt(t,(n,o)=>{s&&Re(n)?Object.defineProperty(e,o,{__proto__:null,value:jo(n,s),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),Hc=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),qc=(e,t,s,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),s&&Object.assign(e.prototype,s)},Gc=(e,t,s,r)=>{let n,o,i;const c={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),o=n.length;o-- >0;)i=n[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=s!==!1&&vt(e)}while(e&&(!s||s(e,t))&&e!==Object.prototype);return t},Kc=(e,t,s)=>{e=String(e),(s===void 0||s>e.length)&&(s=e.length),s-=t.length;const r=e.indexOf(t,s);return r!==-1&&r===s},Yc=e=>{if(!e)return null;if(it(e))return e;let t=e.length;if(!_o(t))return null;const s=new Array(t);for(;t-- >0;)s[t]=e[t];return s},Jc=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&vt(Uint8Array)),Xc=(e,t)=>{const r=(e&&e[Vt]).call(e);let n;for(;(n=r.next())&&!n.done;){const o=n.value;t.call(e,o[0],o[1])}},Zc=(e,t)=>{let s;const r=[];for(;(s=e.exec(t))!==null;)r.push(s);return r},Qc=Pe("HTMLFormElement"),el=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,r,n){return r.toUpperCase()+n}),{propertyIsEnumerable:tl}=Object.prototype,sl=Pe("RegExp"),Po=(e,t)=>{const s=Object.getOwnPropertyDescriptors(e),r={};Wt(s,(n,o)=>{let i;(i=t(n,o,e))!==!1&&(r[o]=i||n)}),Object.defineProperties(e,r)},rl=e=>{Po(e,(t,s)=>{if(Re(e)&&["arguments","caller","callee"].includes(s))return!1;const r=e[s];if(Re(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},nl=(e,t)=>{const s={},r=n=>{n.forEach(o=>{s[o]=!0})};return it(e)?r(e):r(String(e).split(t)),s},ol=()=>{},al=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function il(e){return!!(e&&Re(e.append)&&e[No]==="FormData"&&e[Vt])}const cl=e=>{const t=new WeakSet,s=r=>{if(Nt(r)){if(t.has(r))return;if(jt(r))return r;if(!("toJSON"in r)){t.add(r);const n=it(r)?[]:{};return Wt(r,(o,i)=>{const c=s(o);!wt(c)&&(n[i]=c)}),t.delete(r),n}}return r};return s(e)},ll=Pe("AsyncFunction"),dl=e=>e&&(Nt(e)||Re(e))&&Re(e.then)&&Re(e.catch),To=((e,t)=>e?setImmediate:t?((s,r)=>(tt.addEventListener("message",({source:n,data:o})=>{n===tt&&o===s&&r.length&&r.shift()()},!1),n=>{r.push(n),tt.postMessage(s,"*")}))(`axios@${Math.random()}`,[]):s=>setTimeout(s))(typeof setImmediate=="function",Re(tt.postMessage)),ul=typeof queueMicrotask<"u"?queueMicrotask.bind(tt):typeof process<"u"&&process.nextTick||To,Ao=e=>e!=null&&Re(e[Vt]),fl=e=>e!=null&&Bt(e,Vt)&&Ao(e),v={isArray:it,isArrayBuffer:Co,isBuffer:jt,isFormData:Dc,isArrayBufferView:Nc,isString:Cc,isNumber:_o,isBoolean:_c,isObject:Nt,isPlainObject:us,isEmptyObject:kc,isReadableStream:Uc,isRequest:$c,isResponse:Bc,isHeaders:zc,isUndefined:wt,isDate:Ec,isFile:Pc,isReactNativeBlob:Tc,isReactNative:Ac,isBlob:Oc,isRegExp:sl,isFunction:Re,isStream:Ic,isURLSearchParams:Fc,isTypedArray:Jc,isFileList:Lc,forEach:Wt,merge:cr,extend:Wc,trim:Vc,stripBOM:Hc,inherits:qc,toFlatObject:Gc,kindOf:yr,kindOfTest:Pe,endsWith:Kc,toArray:Yc,forEachEntry:Xc,matchAll:Zc,isHTMLForm:Qc,hasOwnProperty:ws,hasOwnProp:ws,hasOwnInPrototypeChain:Bt,getSafeProp:jc,reduceDescriptors:Po,freezeMethods:rl,toObjectSet:nl,toCamelCase:el,noop:ol,toFiniteNumber:al,findKey:ko,global:tt,isContextDefined:Eo,isSpecCompliantForm:il,toJSONObject:cl,isAsyncFn:ll,isThenable:dl,setImmediate:To,asap:ul,isIterable:Ao,isSafeIterable:fl},hl=v.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ml=e=>{const t={};let s,r,n;return e&&e.split(`
|
|
7
|
-
`).forEach(function(i){
|
|
8
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...s){const r=new this(t);return s.forEach(n=>r.set(n)),r}static accessor(t){const r=(this[gn]=this[gn]={accessors:{}}).accessors,n=this.prototype;function o(i){const c=Ot(i);r[c]||(Rl(n,i),r[c]=!0)}return v.isArray(t)?t.forEach(o):o(t),this}};xe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);v.reduceDescriptors(xe.prototype,({value:e},t)=>{let s=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[s]=r}}});v.freezeMethods(xe);const jl="[REDACTED ****]";function Nl(e){if(v.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(v.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Cl(e,t){const s=new Set(t.map(o=>String(o).toLowerCase())),r=[],n=o=>{if(o===null||typeof o!="object"||v.isBuffer(o))return o;if(r.indexOf(o)!==-1)return;o instanceof xe&&(o=o.toJSON()),r.push(o);let i;if(v.isArray(o))i=[],o.forEach((c,l)=>{const d=n(c);v.isUndefined(d)||(i[l]=d)});else{if(!v.isPlainObject(o)&&Nl(o))return r.pop(),o;i=Object.create(null);for(const[c,l]of Object.entries(o)){const d=s.has(c.toLowerCase())?jl:n(l);v.isUndefined(d)||(i[c]=d)}}return r.pop(),i};return n(e)}let P=class Lo extends Error{static from(t,s,r,n,o,i){const c=new Lo(t.message,s||t.code,r,n,o);return Object.defineProperty(c,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),c.name=t.name,t.status!=null&&c.status==null&&(c.status=t.status),i&&Object.assign(c,i),c}constructor(t,s,r,n,o){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,s&&(this.code=s),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status)}toJSON(){const t=this.config,s=t&&v.hasOwnProp(t,"redact")?t.redact:void 0,r=v.isArray(s)&&s.length>0?Cl(t,s):v.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};P.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";P.ERR_BAD_OPTION="ERR_BAD_OPTION";P.ECONNABORTED="ECONNABORTED";P.ETIMEDOUT="ETIMEDOUT";P.ECONNREFUSED="ECONNREFUSED";P.ERR_NETWORK="ERR_NETWORK";P.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";P.ERR_DEPRECATED="ERR_DEPRECATED";P.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";P.ERR_BAD_REQUEST="ERR_BAD_REQUEST";P.ERR_CANCELED="ERR_CANCELED";P.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";P.ERR_INVALID_URL="ERR_INVALID_URL";P.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const _l=null,Io=100;function lr(e){return v.isPlainObject(e)||v.isArray(e)}function Mo(e){return v.endsWith(e,"[]")?e.slice(0,-2):e}function Ys(e,t,s){return e?e.concat(t).map(function(n,o){return n=Mo(n),!s&&o?"["+n+"]":n}).join(s?".":""):t}function kl(e){return v.isArray(e)&&!e.some(lr)}const El=v.toFlatObject(v,{},null,function(t){return/^is[A-Z]/.test(t)});function Ts(e,t,s){if(!v.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,s=v.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,R){return!v.isUndefined(R[y])});const r=s.metaTokens,n=s.visitor||g,o=s.dots,i=s.indexes,c=s.Blob||typeof Blob<"u"&&Blob,l=s.maxDepth===void 0?Io:s.maxDepth,d=c&&v.isSpecCompliantForm(t),f=[];if(!v.isFunction(n))throw new TypeError("visitor must be a function");function u(b){if(b===null)return"";if(v.isDate(b))return b.toISOString();if(v.isBoolean(b))return b.toString();if(!d&&v.isBlob(b))throw new P("Blob is not supported. Use a Buffer instead.");if(v.isArrayBuffer(b)||v.isTypedArray(b)){if(d&&typeof c=="function")return new c([b]);if(typeof Buffer<"u")return Buffer.from(b);throw new P("Blob is not supported. Use a Buffer instead.",P.ERR_NOT_SUPPORT)}return b}function h(b){if(b>l)throw new P("Object is too deeply nested ("+b+" levels). Max depth: "+l,P.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(b,y){if(l===1/0)return JSON.stringify(b);const R=[];return JSON.stringify(b,function(_,N){if(!v.isObject(N))return N;for(;R.length&&R[R.length-1]!==this;)R.pop();return R.push(N),h(y+R.length-1),N})}function g(b,y,R){let w=b;if(v.isReactNative(t)&&v.isReactNativeBlob(b))return t.append(Ys(R,y,o),u(b)),!1;if(b&&!R&&typeof b=="object"){if(v.endsWith(y,"{}"))y=r?y:y.slice(0,-2),b=m(b,1);else if(v.isArray(b)&&kl(b)||(v.isFileList(b)||v.endsWith(y,"[]"))&&(w=v.toArray(b)))return y=Mo(y),w.forEach(function(N,j){!(v.isUndefined(N)||N===null)&&t.append(i===!0?Ys([y],j,o):i===null?y:y+"[]",u(N))}),!1}return lr(b)?!0:(t.append(Ys(R,y,o),u(b)),!1)}const p=Object.assign(El,{defaultVisitor:g,convertValue:u,isVisitable:lr});function x(b,y,R=0){if(!v.isUndefined(b)){if(h(R),f.indexOf(b)!==-1)throw new Error("Circular reference detected in "+y.join("."));f.push(b),v.forEach(b,function(_,N){(!(v.isUndefined(_)||_===null)&&n.call(t,_,v.isString(N)?N.trim():N,y,p))===!0&&x(_,y?y.concat(N):[N],R+1)}),f.pop()}}if(!v.isObject(e))throw new TypeError("data must be an object");return x(e),t}function xn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function wr(e,t){this._pairs=[],e&&Ts(e,this,t)}const Do=wr.prototype;Do.append=function(t,s){this._pairs.push([t,s])};Do.toString=function(t){const s=t?r=>t.call(this,r,xn):xn;return this._pairs.map(function(n){return s(n[0])+"="+s(n[1])},"").join("&")};function Pl(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Fo(e,t,s){if(!t)return e;e=e||"";const r=v.isFunction(s)?{serialize:s}:s,n=v.getSafeProp(r,"encode")||Pl,o=v.getSafeProp(r,"serialize");let i;if(o?i=o(t,r):i=v.isURLSearchParams(t)?t.toString():new wr(t,r).toString(n),i){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class bn{constructor(){this.handlers=[]}use(t,s,r){return this.handlers.push({fulfilled:t,rejected:s,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){v.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Sr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Tl=typeof URLSearchParams<"u"?URLSearchParams:wr,Al=typeof FormData<"u"?FormData:null,Ol=typeof Blob<"u"?Blob:null,Ll={isBrowser:!0,classes:{URLSearchParams:Tl,FormData:Al,Blob:Ol},protocols:["http","https","file","blob","url","data"]},Rr=typeof window<"u"&&typeof document<"u",dr=typeof navigator=="object"&&navigator||void 0,Il=Rr&&(!dr||["ReactNative","NativeScript","NS"].indexOf(dr.product)<0),Ml=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Dl=Rr&&window.location.href||"http://localhost",Fl=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Rr,hasStandardBrowserEnv:Il,hasStandardBrowserWebWorkerEnv:Ml,navigator:dr,origin:Dl},Symbol.toStringTag,{value:"Module"})),he={...Fl,...Ll};function Ul(e,t){return Ts(e,new he.classes.URLSearchParams,{visitor:function(s,r,n,o){return he.isNode&&v.isBuffer(s)?(this.append(r,s.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}const yn=Io;function Uo(e){if(e>yn)throw new P("FormData field is too deeply nested ("+e+" levels). Max depth: "+yn,P.ERR_FORM_DATA_DEPTH_EXCEEDED)}function $l(e){const t=[],s=/\w+|\[(\w*)]/g;let r;for(;(r=s.exec(e))!==null;)Uo(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function Bl(e){const t={},s=Object.keys(e);let r;const n=s.length;let o;for(r=0;r<n;r++)o=s[r],t[o]=e[o];return t}function $o(e){function t(s,r,n,o){Uo(o);let i=s[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),l=o>=s.length;return i=!i&&v.isArray(n)?n.length:i,l?(v.hasOwnProp(n,i)?n[i]=v.isArray(n[i])?n[i].concat(r):[n[i],r]:n[i]=r,!c):((!v.hasOwnProp(n,i)||!v.isObject(n[i]))&&(n[i]=[]),t(s,r,n[i],o)&&v.isArray(n[i])&&(n[i]=Bl(n[i])),!c)}if(v.isFormData(e)&&v.isFunction(e.entries)){const s={};return v.forEachEntry(e,(r,n)=>{t($l(r),n,s,0)}),s}return null}const ht=(e,t)=>e!=null&&v.hasOwnProp(e,t)?e[t]:void 0;function zl(e,t,s){if(v.isString(e))try{return(t||JSON.parse)(e),v.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(s||JSON.stringify)(e)}const Ht={transitional:Sr,adapter:["xhr","http","fetch"],transformRequest:[function(t,s){const r=s.getContentType()||"",n=r.indexOf("application/json")>-1,o=v.isObject(t);if(o&&v.isHTMLForm(t)&&(t=new FormData(t)),v.isFormData(t))return n?JSON.stringify($o(t)):t;if(v.isArrayBuffer(t)||v.isBuffer(t)||v.isStream(t)||v.isFile(t)||v.isBlob(t)||v.isReadableStream(t))return t;if(v.isArrayBufferView(t))return t.buffer;if(v.isURLSearchParams(t))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){const l=ht(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Ul(t,l).toString();if((c=v.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=ht(this,"env"),f=d&&d.FormData;return Ts(c?{"files[]":t}:t,f&&new f,l)}}return o||n?(s.setContentType("application/json",!1),zl(t)):t}],transformResponse:[function(t){const s=ht(this,"transitional")||Ht.transitional,r=s&&s.forcedJSONParsing,n=ht(this,"responseType"),o=n==="json";if(v.isResponse(t)||v.isReadableStream(t))return t;if(t&&v.isString(t)&&(r&&!n||o)){const c=!(s&&s.silentJSONParsing)&&o;try{return JSON.parse(t,ht(this,"parseReviver"))}catch(l){if(c)throw l.name==="SyntaxError"?P.from(l,P.ERR_BAD_RESPONSE,this,null,ht(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:he.classes.FormData,Blob:he.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};v.forEach(["delete","get","head","post","put","patch","query"],e=>{Ht.headers[e]={}});function Js(e,t){const s=this||Ht,r=t||s,n=xe.from(r.headers);let o=r.data;return v.forEach(e,function(c){o=c.call(s,o,n.normalize(),t?t.status:void 0)}),n.normalize(),o}function Bo(e){return!!(e&&e.__CANCEL__)}let qt=class extends P{constructor(t,s,r){super(t??"canceled",P.ERR_CANCELED,s,r),this.name="CanceledError",this.__CANCEL__=!0}};function zo(e,t,s){const r=s.config.validateStatus;!s.status||!r||r(s.status)?e(s):t(new P("Request failed with status code "+s.status,s.status>=400&&s.status<500?P.ERR_BAD_REQUEST:P.ERR_BAD_RESPONSE,s.config,s.request,s))}function Vl(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Wl(e,t){e=e||10;const s=new Array(e),r=new Array(e);let n=0,o=0,i;return t=t!==void 0?t:1e3,function(l){const d=Date.now(),f=r[o];i||(i=d),s[n]=l,r[n]=d;let u=o,h=0;for(;u!==n;)h+=s[u++],u=u%e;if(n=(n+1)%e,n===o&&(o=(o+1)%e),d-i<t)return;const m=f&&d-f;return m?Math.round(h*1e3/m):void 0}}function Hl(e,t){let s=0,r=1e3/t,n,o;const i=(d,f=Date.now())=>{s=f,n=null,o&&(clearTimeout(o),o=null),e(...d)};return[(...d)=>{const f=Date.now(),u=f-s;u>=r?i(d,f):(n=d,o||(o=setTimeout(()=>{o=null,i(n)},r-u)))},()=>n&&i(n)]}const Ss=(e,t,s=3)=>{let r=0;const n=Wl(50,250);return Hl(o=>{if(!o||typeof o.loaded!="number")return;const i=o.loaded,c=o.lengthComputable?o.total:void 0,l=c!=null?Math.min(i,c):i,d=Math.max(0,l-r),f=n(d);r=Math.max(r,l);const u={loaded:l,total:c,progress:c?l/c:void 0,bytes:d,rate:f||void 0,estimated:f&&c?(c-l)/f:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(u)},s)},vn=(e,t)=>{const s=e!=null;return[r=>t[0]({lengthComputable:s,total:e,loaded:r}),t[1]]},wn=e=>(...t)=>v.asap(()=>e(...t)),ql=he.hasStandardBrowserEnv?((e,t)=>s=>(s=new URL(s,he.origin),e.protocol===s.protocol&&e.host===s.host&&(t||e.port===s.port)))(new URL(he.origin),he.navigator&&/(msie|trident)/i.test(he.navigator.userAgent)):()=>!0,Gl=he.hasStandardBrowserEnv?{write(e,t,s,r,n,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];v.isNumber(s)&&c.push(`expires=${new Date(s).toUTCString()}`),v.isString(r)&&c.push(`path=${r}`),v.isString(n)&&c.push(`domain=${n}`),o===!0&&c.push("secure"),v.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let s=0;s<t.length;s++){const r=t[s].replace(/^\s+/,""),n=r.indexOf("=");if(n!==-1&&r.slice(0,n)===e)try{return decodeURIComponent(r.slice(n+1))}catch{return r.slice(n+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Kl(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Yl(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Jl=/^https?:(?!\/\/)/i,Xl=/[\t\n\r]/g;function Zl(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Ql(e){return Zl(e).replace(Xl,"")}function Sn(e,t){if(typeof e=="string"&&Jl.test(Ql(e)))throw new P('Invalid URL: missing "//" after protocol',P.ERR_INVALID_URL,t)}function Vo(e,t,s,r){Sn(t,r);let n=!Kl(t);return e&&(n||s===!1)?(Sn(e,r),Yl(e,t)):t}const Rn=e=>e instanceof xe?{...e}:e;function ct(e,t){e=e||{},t=t||{};const s=Object.create(null);Object.defineProperty(s,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(f,u,h,m){return v.isPlainObject(f)&&v.isPlainObject(u)?v.merge.call({caseless:m},f,u):v.isPlainObject(u)?v.merge({},u):v.isArray(u)?u.slice():u}function n(f,u,h,m){if(v.isUndefined(u)){if(!v.isUndefined(f))return r(void 0,f,h,m)}else return r(f,u,h,m)}function o(f,u){if(!v.isUndefined(u))return r(void 0,u)}function i(f,u){if(v.isUndefined(u)){if(!v.isUndefined(f))return r(void 0,f)}else return r(void 0,u)}function c(f){const u=v.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!v.isUndefined(u))if(v.isPlainObject(u)){if(v.hasOwnProp(u,f))return u[f]}else return;const h=v.hasOwnProp(e,"transitional")?e.transitional:void 0;if(v.isPlainObject(h)&&v.hasOwnProp(h,f))return h[f]}function l(f,u,h){if(v.hasOwnProp(t,h))return r(f,u);if(v.hasOwnProp(e,h))return r(void 0,f)}const d={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,allowedSocketPaths:i,responseEncoding:i,validateStatus:l,headers:(f,u,h)=>n(Rn(f),Rn(u),h,!0)};return v.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const h=v.hasOwnProp(d,u)?d[u]:n,m=v.hasOwnProp(e,u)?e[u]:void 0,g=v.hasOwnProp(t,u)?t[u]:void 0,p=h(m,g,u);v.isUndefined(p)&&h!==l||(s[u]=p)}),v.hasOwnProp(t,"validateStatus")&&v.isUndefined(t.validateStatus)&&c("validateStatusUndefinedResolves")===!1&&(v.hasOwnProp(e,"validateStatus")?s.validateStatus=r(void 0,e.validateStatus):delete s.validateStatus),s}const ed=["content-type","content-length"];function td(e,t,s){if(s!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([r,n])=>{ed.includes(r.toLowerCase())&&e.set(r,n)})}const sd=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,s)=>String.fromCharCode(parseInt(s,16)));function Wo(e){const t=ct({},e),s=h=>v.hasOwnProp(t,h)?t[h]:void 0,r=s("data");let n=s("withXSRFToken");const o=s("xsrfHeaderName"),i=s("xsrfCookieName");let c=s("headers");const l=s("auth"),d=s("baseURL"),f=s("allowAbsoluteUrls"),u=s("url");if(t.headers=c=xe.from(c),t.url=Fo(Vo(d,u,f,t),s("params"),s("paramsSerializer")),l){const h=v.getSafeProp(l,"username")||"",m=v.getSafeProp(l,"password")||"";try{c.set("Authorization","Basic "+btoa(h+":"+(m?sd(m):"")))}catch(g){throw P.from(g,P.ERR_BAD_OPTION_VALUE,e)}}if(v.isFormData(r)&&(he.hasStandardBrowserEnv||he.hasStandardBrowserWebWorkerEnv||v.isReactNative(r)?c.setContentType(void 0):v.isFunction(r.getHeaders)&&td(c,r.getHeaders(),s("formDataHeaderPolicy"))),he.hasStandardBrowserEnv&&(v.isFunction(n)&&(n=n(t)),n===!0||n==null&&ql(t.url))){const m=o&&i&&Gl.read(i);m&&c.set(o,m)}return t}const rd=typeof XMLHttpRequest<"u",nd=rd&&function(e){return new Promise(function(s,r){const n=Wo(e);let o=n.data;const i=xe.from(n.headers).normalize();let{responseType:c,onUploadProgress:l,onDownloadProgress:d}=n,f,u,h,m,g;function p(){m&&m(),g&&g(),n.cancelToken&&n.cancelToken.unsubscribe(f),n.signal&&n.signal.removeEventListener("abort",f)}let x=new XMLHttpRequest;x.open(n.method.toUpperCase(),n.url,!0),x.timeout=n.timeout;function b(){if(!x)return;const R=xe.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),_={data:!c||c==="text"||c==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:R,config:e,request:x};zo(function(j){s(j),p()},function(j){r(j),p()},_),x=null}"onloadend"in x?x.onloadend=b:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.startsWith("file:"))||setTimeout(b)},x.onabort=function(){x&&(r(new P("Request aborted",P.ECONNABORTED,e,x)),p(),x=null)},x.onerror=function(w){const _=w&&w.message?w.message:"Network Error",N=new P(_,P.ERR_NETWORK,e,x);N.event=w||null,r(N),p(),x=null},x.ontimeout=function(){let w=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const _=n.transitional||Sr;n.timeoutErrorMessage&&(w=n.timeoutErrorMessage),r(new P(w,_.clarifyTimeoutError?P.ETIMEDOUT:P.ECONNABORTED,e,x)),p(),x=null},o===void 0&&i.setContentType(null),"setRequestHeader"in x&&v.forEach(Oo(i),function(w,_){x.setRequestHeader(_,w)}),v.isUndefined(n.withCredentials)||(x.withCredentials=!!n.withCredentials),c&&c!=="json"&&(x.responseType=n.responseType),d&&([h,g]=Ss(d,!0),x.addEventListener("progress",h)),l&&x.upload&&([u,m]=Ss(l),x.upload.addEventListener("progress",u),x.upload.addEventListener("loadend",m)),(n.cancelToken||n.signal)&&(f=R=>{x&&(r(!R||R.type?new qt(null,e,x):R),x.abort(),p(),x=null)},n.cancelToken&&n.cancelToken.subscribe(f),n.signal&&(n.signal.aborted?f():n.signal.addEventListener("abort",f)));const y=Vl(n.url);if(y&&!he.protocols.includes(y)){r(new P("Unsupported protocol "+y+":",P.ERR_BAD_REQUEST,e)),p();return}x.send(o||null)})},od=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const s=new AbortController;let r=!1;const n=function(l){if(!r){r=!0,i();const d=l instanceof Error?l:this.reason;s.abort(d instanceof P?d:new qt(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,n(new P(`timeout of ${t}ms exceeded`,P.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(n):l.removeEventListener("abort",n)}),e=null)};e.forEach(l=>l.addEventListener("abort",n,{once:!0}));const{signal:c}=s;return c.unsubscribe=()=>v.asap(i),c},ad=function*(e,t){let s=e.byteLength;if(s<t){yield e;return}let r=0,n;for(;r<s;)n=r+t,yield e.slice(r,n),r=n},id=async function*(e,t){for await(const s of cd(e))yield*ad(s,t)},cd=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:s,value:r}=await t.read();if(s)break;yield r}}finally{await t.cancel()}},jn=(e,t,s,r)=>{const n=id(e,t);let o=0,i,c=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:d,value:f}=await n.next();if(d){c(),l.close();return}let u=f.byteLength;if(s){let h=o+=u;s(h)}l.enqueue(new Uint8Array(f))}catch(d){throw c(d),d}},cancel(l){return c(l),n.return()}},{highWaterMark:2})},Rs=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,ld=(e,t,s)=>t+2<s&&Rs(e.charCodeAt(t+1))&&Rs(e.charCodeAt(t+2));function dd(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const s=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(s)){let i=r.length;const c=r.length;for(let m=0;m<c;m++)if(r.charCodeAt(m)===37&&m+2<c){const g=r.charCodeAt(m+1),p=r.charCodeAt(m+2);Rs(g)&&Rs(p)&&(i-=2,m+=2)}let l=0,d=c-1;const f=m=>m>=2&&r.charCodeAt(m-2)===37&&r.charCodeAt(m-1)===51&&(r.charCodeAt(m)===68||r.charCodeAt(m)===100);d>=0&&(r.charCodeAt(d)===61?(l++,d--):f(d)&&(l++,d-=3)),l===1&&d>=0&&(r.charCodeAt(d)===61||f(d))&&l++;const h=Math.floor(i/4)*3-(l||0);return h>0?h:0}let o=0;for(let i=0,c=r.length;i<c;i++){const l=r.charCodeAt(i);if(l===37&&ld(r,i,c))o+=1,i+=2;else if(l<128)o+=1;else if(l<2048)o+=2;else if(l>=55296&&l<=56319&&i+1<c){const d=r.charCodeAt(i+1);d>=56320&&d<=57343?(o+=4,i++):o+=3}else o+=3}return o}const jr="1.18.1",Nn=64*1024,{isFunction:es}=v,ud=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,s)=>String.fromCharCode(parseInt(s,16))),Cn=e=>{if(!v.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},_n=(e,...t)=>{try{return!!e(...t)}catch{return!1}},fd=e=>{const t=e.indexOf("://");let s=e;return t!==-1&&(s=s.slice(t+3)),s.includes("@")||s.includes(":")},hd=e=>{const t=v.global!==void 0&&v.global!==null?v.global:globalThis,{ReadableStream:s,TextEncoder:r}=t;e=v.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:n,Request:o,Response:i}=e,c=n?es(n):typeof fetch=="function",l=es(o),d=es(i);if(!c)return!1;const f=c&&es(s),u=c&&(typeof r=="function"?(b=>y=>b.encode(y))(new r):async b=>new Uint8Array(await new o(b).arrayBuffer())),h=l&&f&&_n(()=>{let b=!1;const y=new o(he.origin,{body:new s,method:"POST",get duplex(){return b=!0,"half"}}),R=y.headers.has("Content-Type");return y.body!=null&&y.body.cancel(),b&&!R}),m=d&&f&&_n(()=>v.isReadableStream(new i("").body)),g={stream:m&&(b=>b.body)};c&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(y,R)=>{let w=y&&y[b];if(w)return w.call(y);throw new P(`Response type '${b}' is not supported`,P.ERR_NOT_SUPPORT,R)})});const p=async b=>{if(b==null)return 0;if(v.isBlob(b))return b.size;if(v.isSpecCompliantForm(b))return(await new o(he.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(v.isArrayBufferView(b)||v.isArrayBuffer(b))return b.byteLength;if(v.isURLSearchParams(b)&&(b=b+""),v.isString(b))return(await u(b)).byteLength},x=async(b,y)=>{const R=v.toFiniteNumber(b.getContentLength());return R??p(y)};return async b=>{let{url:y,method:R,data:w,signal:_,cancelToken:N,timeout:j,onDownloadProgress:S,onUploadProgress:E,responseType:D,headers:T,withCredentials:F="same-origin",fetchOptions:ee,maxContentLength:z,maxBodyLength:X}=Wo(b);const Z=v.isNumber(z)&&z>-1,Y=v.isNumber(X)&&X>-1,de=M=>v.hasOwnProp(b,M)?b[M]:void 0;let fe=n||fetch;D=D?(D+"").toLowerCase():"text";let A=od([_,N&&N.toAbortSignal()],j),C=null;const U=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let W,q=null;const I=()=>new P("Request body larger than maxBodyLength limit",P.ERR_BAD_REQUEST,b,C);try{let M;const $=de("auth");if($){const V=v.getSafeProp($,"username")||"",me=v.getSafeProp($,"password")||"";M={username:V,password:me}}if(fd(y)){const V=new URL(y,he.origin);if(!M&&(V.username||V.password)){const me=Cn(V.username),ye=Cn(V.password);M={username:me,password:ye}}(V.username||V.password)&&(V.username="",V.password="",y=V.href)}if(M&&(T.delete("authorization"),T.set("Authorization","Basic "+btoa(ud((M.username||"")+":"+(M.password||""))))),Z&&typeof y=="string"&&y.startsWith("data:")&&dd(y)>z)throw new P("maxContentLength size of "+z+" exceeded",P.ERR_BAD_RESPONSE,b,C);if(Y&&R!=="get"&&R!=="head"){const V=await p(w);if(typeof V=="number"&&isFinite(V)&&(W=V,V>X))throw I()}const J=Y&&(v.isReadableStream(w)||v.isStream(w)),G=(V,me,ye)=>jn(V,Nn,Ee=>{if(Y&&Ee>X)throw q=I();me&&me(Ee)},ye);if(h&&R!=="get"&&R!=="head"&&(E||J)){if(W=W??await x(T,w),W!==0||J){let V=new o(y,{method:"POST",body:w,duplex:"half"}),me;if(v.isFormData(w)&&(me=V.headers.get("content-type"))&&T.setContentType(me),V.body){const[ye,Ee]=E&&vn(W,Ss(wn(E)))||[];w=G(V.body,ye,Ee)}}}else if(J&&!l&&f&&R!=="get"&&R!=="head")w=G(w);else if(J&&l&&!h&&R!=="get"&&R!=="head")throw new P("Stream request bodies are not supported by the current fetch implementation",P.ERR_NOT_SUPPORT,b,C);v.isString(F)||(F=F?"include":"omit");const ue=l&&"credentials"in o.prototype;if(v.isFormData(w)){const V=T.getContentType();V&&/^multipart\/form-data/i.test(V)&&!/boundary=/i.test(V)&&T.delete("content-type")}T.set("User-Agent","axios/"+jr,!1);const be={...ee,signal:A,method:R.toUpperCase(),headers:Oo(T.normalize()),body:w,duplex:"half",credentials:ue?F:void 0};C=l&&new o(y,be);let ne=await(l?fe(C,ee):fe(y,be));const Ie=xe.from(ne.headers);if(Z){const V=v.toFiniteNumber(Ie.getContentLength());if(V!=null&&V>z)throw new P("maxContentLength size of "+z+" exceeded",P.ERR_BAD_RESPONSE,b,C)}const _e=m&&(D==="stream"||D==="response");if(m&&ne.body&&(S||Z||_e&&U)){const V={};["status","statusText","headers"].forEach($e=>{V[$e]=ne[$e]});const me=v.toFiniteNumber(Ie.getContentLength()),[ye,Ee]=S&&vn(me,Ss(wn(S),!0))||[];let Te=0;const Ls=$e=>{if(Z&&(Te=$e,Te>z))throw new P("maxContentLength size of "+z+" exceeded",P.ERR_BAD_RESPONSE,b,C);ye&&ye($e)};ne=new i(jn(ne.body,Nn,Ls,()=>{Ee&&Ee(),U&&U()}),V)}D=D||"text";let ke=await g[v.findKey(g,D)||"text"](ne,b);if(Z&&!m&&!_e){let V;if(ke!=null&&(typeof ke.byteLength=="number"?V=ke.byteLength:typeof ke.size=="number"?V=ke.size:typeof ke=="string"&&(V=typeof r=="function"?new r().encode(ke).byteLength:ke.length)),typeof V=="number"&&V>z)throw new P("maxContentLength size of "+z+" exceeded",P.ERR_BAD_RESPONSE,b,C)}return!_e&&U&&U(),await new Promise((V,me)=>{zo(V,me,{data:ke,headers:xe.from(ne.headers),status:ne.status,statusText:ne.statusText,config:b,request:C})})}catch(M){if(U&&U(),A&&A.aborted&&A.reason instanceof P){const $=A.reason;throw $.config=b,C&&($.request=C),M!==$&&Object.defineProperty($,"cause",{__proto__:null,value:M,writable:!0,enumerable:!1,configurable:!0}),$}if(q)throw C&&!q.request&&(q.request=C),q;if(M instanceof P)throw C&&!M.request&&(M.request=C),M;if(M&&M.name==="TypeError"&&/Load failed|fetch/i.test(M.message)){const $=new P("Network Error",P.ERR_NETWORK,b,C,M&&M.response);throw Object.defineProperty($,"cause",{__proto__:null,value:M.cause||M,writable:!0,enumerable:!1,configurable:!0}),$}throw P.from(M,M&&M.code,b,C,M&&M.response)}}},md=new Map,Ho=e=>{let t=e&&e.env||{};const{fetch:s,Request:r,Response:n}=t,o=[r,n,s];let i=o.length,c=i,l,d,f=md;for(;c--;)l=o[c],d=f.get(l),d===void 0&&f.set(l,d=c?new Map:hd(t)),f=d;return d};Ho();const Nr={http:_l,xhr:nd,fetch:{get:Ho}};v.forEach(Nr,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const kn=e=>`- ${e}`,pd=e=>v.isFunction(e)||e===null||e===!1;function gd(e,t){e=v.isArray(e)?e:[e];const{length:s}=e;let r,n;const o={};for(let i=0;i<s;i++){r=e[i];let c;if(n=r,!pd(r)&&(n=Nr[(c=String(r)).toLowerCase()],n===void 0))throw new P(`Unknown adapter '${c}'`);if(n&&(v.isFunction(n)||(n=n.get(t))))break;o[c||"#"+i]=n}if(!n){const i=Object.entries(o).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build"));let c=s?i.length>1?`since :
|
|
9
|
-
`+i.map(
|
|
10
|
-
`):" "+
|
|
11
|
-
`);return i===-1?"":
|
|
6
|
+
<%s key={someKey} {...props} />`,G,D,X,D),O[D+G]=!0)}if(D=null,H!==void 0&&(s(H),D=""+H),i(F)&&(s(F.key),D=""+F.key),"key"in F){H={};for(var V in F)V!=="key"&&(H[V]=F[V])}else H=F;return D&&c(H,typeof R=="function"?R.displayName||R.name||"Unknown":R),u(R,D,H,r(),W,U)}function d(R){h(R)?R._store&&(R._store.validated=1):typeof R=="object"&&R!==null&&R.$$typeof===P&&(R._payload.status==="fulfilled"?h(R._payload.value)&&R._payload.value._store&&(R._payload.value._store.validated=1):R._store&&(R._store.validated=1))}function h(R){return typeof R=="object"&&R!==null&&R.$$typeof===p}var m=E,p=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),N=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),T=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,z=Array.isArray,J=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(R){return R()}};var Y,Q={},he=m.react_stack_bottom_frame.bind(m,o)(),me=J(n(o)),O={};Pt.Fragment=b,Pt.jsx=function(R,F,H){var G=1e4>T.recentlyCreatedOwnerStacks++;return f(R,F,H,!1,G?Error("react-stack-top-frame"):he,G?J(n(R)):me)},Pt.jsxs=function(R,F,H){var G=1e4>T.recentlyCreatedOwnerStacks++;return f(R,F,H,!0,G?Error("react-stack-top-frame"):he,G?J(n(R)):me)}})()),Pt}var Dn;function La(){return Dn||(Dn=1,process.env.NODE_ENV==="production"?Jt.exports=Ta():Jt.exports=Oa()),Jt.exports}var a=La(),Ft=typeof window<"u"?$.useLayoutEffect:$.useEffect;function Ds(e){const t=$.useRef({value:e,prev:null}),s=t.current.value;return e!==s&&(t.current={value:e,prev:s}),t.current.prev}function Ia(e,t,s={},n={}){$.useEffect(()=>{if(!e.current||n.disabled||typeof IntersectionObserver!="function")return;const r=new IntersectionObserver(([o])=>{t(o)},s);return r.observe(e.current),()=>{r.disconnect()}},[t,s,n.disabled,e])}function Ma(e){const t=$.useRef(null);return $.useImperativeHandle(e,()=>t.current,[]),t}const Gr=!1;function Ut(e){return e[e.length-1]}function Da(e){return typeof e=="function"}function Ze(e,t){return Da(e)?e(t):e}const Kr=Object.prototype.hasOwnProperty,Fn=Object.prototype.propertyIsEnumerable;function Yr(e){for(const t in e)if(Kr.call(e,t))return!0;return!1}const Fa=()=>Object.create(null),Ye=(e,t)=>Qe(e,t,Fa);function Qe(e,t,s=()=>({}),n=0){if(e===t)return e;if(n>500)return t;const r=t,o=Bn(e)&&Bn(r);if(!o&&!(gs(e)&&gs(r)))return r;const i=o?e:Un(e);if(!i)return r;const c=o?r:Un(r);if(!c)return r;const l=i.length,u=c.length,f=o?new Array(u):s();let d=0;for(let h=0;h<u;h++){const m=o?h:c[h],p=e[m],g=r[m];if(p===g){f[m]=p,(o?h<l:Kr.call(e,m))&&d++;continue}if(p===null||g===null||typeof p!="object"||typeof g!="object"){f[m]=g;continue}const b=Qe(p,g,s,n+1);f[m]=b,b===p&&d++}return l===u&&d===l?e:f}function Un(e){const t=Object.getOwnPropertyNames(e);for(const r of t)if(!Fn.call(e,r))return!1;const s=Object.getOwnPropertySymbols(e);if(s.length===0)return t;const n=t;for(const r of s){if(!Fn.call(e,r))return!1;n.push(r)}return n}function gs(e){if(!$n(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const s=t.prototype;return!(!$n(s)||!s.hasOwnProperty("isPrototypeOf"))}function $n(e){return Object.prototype.toString.call(e)==="[object Object]"}function Bn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function nt(e,t,s){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 n=0,r=e.length;n<r;n++)if(!nt(e[n],t[n],s))return!1;return!0}if(gs(e)&&gs(t)){const n=s?.ignoreUndefined??!0;if(s?.partial){for(const i in t)if((!n||t[i]!==void 0)&&!nt(e[i],t[i],s))return!1;return!0}let r=0;if(!n)r=Object.keys(e).length;else for(const i in e)e[i]!==void 0&&r++;let o=0;for(const i in t)if((!n||t[i]!==void 0)&&(o++,o>r||!nt(e[i],t[i],s)))return!1;return r===o}return!1}function yt(e){let t,s;const n=new Promise((r,o)=>{t=r,s=o});return n.status="pending",n.resolve=r=>{n.status="resolved",n.value=r,t(r),e?.(r)},n.reject=r=>{n.status="rejected",s(r)},n}function $t(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function zn(e,t){for(let s=e.length-1;s>=0;s--){const n=e[s];if(t(n))return n}}const Ua=/[\x00-\x1f\x7f"<>`{}]/g;function $a(e){return e.replace(Ua,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function Vn(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,s=>{try{return decodeURI(s)}catch{return s}})}return $a(t)}const Ba=["http:","https:","mailto:","tel:"];function xs(e,t){if(!e)return!1;try{const s=new URL(e);return!t.has(s.protocol)}catch{return!1}}function At(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 s=0,n="",r;for(;(r=t.exec(e))!==null;)n+=Vn(e.slice(s,r.index))+r[0],s=t.lastIndex;n=n+Vn(s?e.slice(s):e);let o=!1;return n.startsWith("//")&&(o=!0,n="/"+n.replace(/^\/+/,"")),{path:n,handledProtocolRelativeURL:o}}function za(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Va(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}function Ue(){throw new Error("Invariant failed")}function Bt(e){const t=new Map;let s,n;const r=o=>{o.next&&(o.prev?(o.prev.next=o.next,o.next.prev=o.prev,o.next=void 0,n&&(n.next=o,o.prev=n)):(o.next.prev=void 0,s=o.next,o.next=void 0,n&&(o.prev=n,n.next=o)),n=o)};return{get(o){const i=t.get(o);if(i)return r(i),i.value},set(o,i){if(t.size>=e&&s){const l=s;t.delete(l.key),l.next&&(s=l.next,l.next.prev=void 0),l===n&&(n=void 0)}const c=t.get(o);if(c)c.value=i,r(c);else{const l={key:o,value:i,prev:n};n&&(n.next=l),n=l,s||(s=l),t.set(o,l)}},clear(){t.clear(),s=void 0,n=void 0}}}const Ve=4,Jr=5;function Wa(e){const t=e.indexOf("{");if(t===-1)return null;const s=e.indexOf("}",t);return s===-1||t+1>=e.length?null:[t,s]}function Xr(e,t,s=new Uint16Array(6)){const n=e.indexOf("/",t),r=n===-1?e.length:n,o=e.substring(t,r);if(!o||!o.includes("$"))return s[0]=0,s[1]=t,s[2]=t,s[3]=r,s[4]=r,s[5]=r,s;if(o==="$"){const c=e.length;return s[0]=2,s[1]=t,s[2]=t,s[3]=c,s[4]=c,s[5]=c,s}if(o.charCodeAt(0)===36)return s[0]=1,s[1]=t,s[2]=t+1,s[3]=r,s[4]=r,s[5]=r,s;const i=Wa(o);if(i){const[c,l]=i,u=o.charCodeAt(c+1);if(u===45){if(c+2<o.length&&o.charCodeAt(c+2)===36){const f=c+3,d=l;if(f<d)return s[0]=3,s[1]=t+c,s[2]=t+f,s[3]=t+d,s[4]=t+l+1,s[5]=r,s}}else if(u===36){const f=c+1,d=c+2;return d===l?(s[0]=2,s[1]=t+c,s[2]=t+f,s[3]=t+d,s[4]=t+l+1,s[5]=e.length,s):(s[0]=1,s[1]=t+c,s[2]=t+d,s[3]=t+l,s[4]=t+l+1,s[5]=r,s)}}return s[0]=0,s[1]=t,s[2]=t,s[3]=r,s[4]=r,s[5]=r,s}function Es(e,t,s,n,r,o,i){i?.(s);let c=n;{const l=s.fullPath??s.from,u=l.length,f=s.options?.caseSensitive??e,d=s.options?.params?.parse??s.options?.parseParams;for(;c<u;){const m=Xr(l,c,t);let p;const g=c,b=m[5];switch(c=b+1,o++,m[0]){case 0:{const x=l.substring(m[2],m[3]);if(f){const y=r.static?.get(x);if(y)p=y;else{r.static??=new Map;const S=et(s.fullPath??s.from);S.parent=r,S.depth=o,p=S,r.static.set(x,S)}}else{const y=x.toLowerCase(),S=r.staticInsensitive?.get(y);if(S)p=S;else{r.staticInsensitive??=new Map;const N=et(s.fullPath??s.from);N.parent=r,N.depth=o,p=N,r.staticInsensitive.set(y,N)}}break}case 1:{const x=l.substring(g,m[1]),y=l.substring(m[4],b),S=f&&!!(x||y),N=x?S?x:x.toLowerCase():void 0,C=y?S?y:y.toLowerCase():void 0,_=!d&&r.dynamic?.find(j=>!j.parse&&j.caseSensitive===S&&j.prefix===N&&j.suffix===C);if(_)p=_;else{const j=Us(1,s.fullPath??s.from,S,N,C);p=j,j.depth=o,j.parent=r,r.dynamic??=[],r.dynamic.push(j)}break}case 3:{const x=l.substring(g,m[1]),y=l.substring(m[4],b),S=f&&!!(x||y),N=x?S?x:x.toLowerCase():void 0,C=y?S?y:y.toLowerCase():void 0,_=!d&&r.optional?.find(j=>!j.parse&&j.caseSensitive===S&&j.prefix===N&&j.suffix===C);if(_)p=_;else{const j=Us(3,s.fullPath??s.from,S,N,C);p=j,j.parent=r,j.depth=o,r.optional??=[],r.optional.push(j)}break}case 2:{const x=l.substring(g,m[1]),y=l.substring(m[4],b),S=f&&!!(x||y),N=x?S?x:x.toLowerCase():void 0,C=y?S?y:y.toLowerCase():void 0,_=Us(2,s.fullPath??s.from,S,N,C);p=_,_.parent=r,_.depth=o,r.wildcard??=[],r.wildcard.push(_)}}r=p}if(d&&s.children&&!s.isRoot&&s.id&&s.id.charCodeAt(s.id.lastIndexOf("/")+1)===95){const m=et(s.fullPath??s.from);m.kind=Jr,m.parent=r,o++,m.depth=o,r.pathless??=[],r.pathless.push(m),r=m}const h=(s.path||!s.children)&&!s.isRoot;if(h&&l.endsWith("/")){const m=et(s.fullPath??s.from);m.kind=Ve,m.parent=r,o++,m.depth=o,r.index=m,r=m}r.parse=d??null,r.priority=s.options?.params?.priority??0,h&&!r.route&&(r.route=s,r.fullPath=s.fullPath??s.from)}if(s.children)for(const l of s.children)Es(e,t,l,c,r,o,i)}function Fs(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 ze(e){if(e.pathless)for(const t of e.pathless)ze(t);if(e.static)for(const t of e.static.values())ze(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())ze(t);if(e.dynamic?.length){e.dynamic.sort(Fs);for(const t of e.dynamic)ze(t)}if(e.optional?.length){e.optional.sort(Fs);for(const t of e.optional)ze(t)}if(e.wildcard?.length){e.wildcard.sort(Fs);for(const t of e.wildcard)ze(t)}}function et(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 Us(e,t,s,n,r){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:s,prefix:n,suffix:r}}function Ha(e,t){const s=et("/"),n=new Uint16Array(6);for(const r of e)Es(!1,n,r,1,s,0);ze(s),t.masksTree=s,t.flatCache=Bt(1e3)}function qa(e,t){e||="/";const s=t.flatCache.get(e);if(s)return s;const n=xn(e,t.masksTree);return t.flatCache.set(e,n),n}function Ga(e,t,s,n,r){e||="/",n||="/";const o=t?`case\0${e}`:e;let i=r.singleCache.get(o);return i||(i=et("/"),Es(t,new Uint16Array(6),{from:e},1,i,0),r.singleCache.set(o,i)),xn(n,i,s)}function Ka(e,t,s=!1){const n=s?e:`nofuzz\0${e}`,r=t.matchCache.get(n);if(r!==void 0)return r;e||="/";let o;try{o=xn(e,t.segmentTree,s)}catch(i){if(i instanceof URIError)o=null;else throw i}return o&&(o.branch=Qr(o.route)),t.matchCache.set(n,o),o}function Ya(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Ja(e,t=!1,s){const n=et(e.fullPath),r=new Uint16Array(6),o={},i={};let c=0;return Es(t,r,e,1,n,0,l=>{if(s?.(l,c),l.id in o){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Duplicate routes found with id: ${String(l.id)}`);Ue()}if(o[l.id]=l,c!==0&&l.path){const u=Ya(l.fullPath);(!i[u]||l.fullPath.endsWith("/"))&&(i[u]=l)}c++}),ze(n),{processedTree:{segmentTree:n,singleCache:Bt(1e3),matchCache:Bt(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:i}}function xn(e,t,s=!1){const n=e.split("/"),r=Za(e,n,t,s);if(!r)return null;const[o]=Zr(e,n,r);return{route:r.node.route,rawParams:o}}function Zr(e,t,s){const n=Xa(s.node);let r=null;const o=Object.create(null);let i=s.extract?.part??0,c=s.extract?.node??0,l=s.extract?.path??0,u=s.extract?.segment??0;for(;c<n.length;i++,c++,l++,u++){const f=n[c];if(f.kind===Ve)break;if(f.kind===Jr){u--,i--,l--;continue}const d=t[i],h=l;if(d&&(l+=d.length),f.kind===1){r??=s.node.fullPath.split("/");const m=r[u],p=f.prefix?.length??0;if(m.charCodeAt(p)===123){const g=f.suffix?.length??0,b=m.substring(p+2,m.length-g-1),x=d.substring(p,d.length-g);o[b]=decodeURIComponent(x)}else{const g=m.substring(1);o[g]=decodeURIComponent(d)}}else if(f.kind===3){if(s.skipped&1<<c){i--,l=h-1;continue}r??=s.node.fullPath.split("/");const m=r[u],p=f.prefix?.length??0,g=f.suffix?.length??0,b=m.substring(p+3,m.length-g-1),x=f.suffix||f.prefix?d.substring(p,d.length-g):d;x&&(o[b]=decodeURIComponent(x))}else if(f.kind===2){const m=f,p=e.substring(h+(m.prefix?.length??0),e.length-(m.suffix?.length??0)),g=decodeURIComponent(p);o["*"]=g,o._splat=g;break}}return s.rawParams&&Object.assign(o,s.rawParams),[o,{part:i,node:c,path:l,segment:u}]}function Qr(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Xa(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Za(e,t,s,n){if(e==="/"&&s.index)return{node:s.index,skipped:0};const r=!Ut(t),o=r&&e!=="/",i=t.length-(r?1:0),c=[{node:s,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let l=null,u=null;for(;c.length;){const f=c.pop(),{node:d,index:h,skipped:m,depth:p,statics:g,dynamics:b,optionals:x}=f;let{extract:y,rawParams:S}=f;if(d.kind===2&&d.route&&!Zt(u,f))continue;if(d.parse){if(!Wn(e,t,f))continue;S=f.rawParams,y=f.extract}n&&d.route&&d.kind!==Ve&&Zt(l,f)&&(l=f);const N=h===i;if(N&&(d.route&&(!o||d.kind===Ve||d.kind===2)&&Zt(u,f)&&(u=f),!d.optional&&!d.wildcard&&!d.index&&!d.pathless))continue;const C=N?void 0:t[h];let _;if(N&&d.index){const j={node:d.index,index:h,skipped:m,depth:p+1,statics:g,dynamics:b,optionals:x,extract:y,rawParams:S};let w=!0;if(d.index.parse&&(Wn(e,t,j)||(w=!1)),w){if(!b&&!x&&!m&&Qa(g,i))return j;Zt(u,j)&&(u=j)}}if(d.wildcard)for(let j=d.wildcard.length-1;j>=0;j--){const w=d.wildcard[j],{prefix:P,suffix:I}=w;if(!(P&&(N||!(w.caseSensitive?C:_??=C.toLowerCase()).startsWith(P)))){if(I){if(N)continue;const k=t.slice(h).join("/").slice(-I.length);if((w.caseSensitive?k:k.toLowerCase())!==I)continue}c.push({node:w,index:i,skipped:m,depth:p+1,statics:g,dynamics:b,optionals:x,extract:y,rawParams:S})}}if(d.optional){const j=m|1<<p,w=p+1;for(let P=d.optional.length-1;P>=0;P--){const I=d.optional[P];c.push({node:I,index:h,skipped:j,depth:w,statics:g,dynamics:b,optionals:x,extract:y,rawParams:S})}if(!N)for(let P=d.optional.length-1;P>=0;P--){const I=d.optional[P],{prefix:k,suffix:T}=I;if(k||T){const Z=I.caseSensitive?C:_??=C.toLowerCase();if(k&&!Z.startsWith(k)||T&&!Z.endsWith(T))continue}c.push({node:I,index:h+1,skipped:m,depth:w,statics:g,dynamics:b,optionals:x+Xt(i,h),extract:y,rawParams:S})}}if(!N&&d.dynamic&&C)for(let j=d.dynamic.length-1;j>=0;j--){const w=d.dynamic[j],{prefix:P,suffix:I}=w;if(P||I){const k=w.caseSensitive?C:_??=C.toLowerCase();if(P&&!k.startsWith(P)||I&&!k.endsWith(I))continue}c.push({node:w,index:h+1,skipped:m,depth:p+1,statics:g,dynamics:b+Xt(i,h),optionals:x,extract:y,rawParams:S})}if(!N&&d.staticInsensitive){const j=d.staticInsensitive.get(_??=C.toLowerCase());j&&c.push({node:j,index:h+1,skipped:m,depth:p+1,statics:g+Xt(i,h),dynamics:b,optionals:x,extract:y,rawParams:S})}if(!N&&d.static){const j=d.static.get(C);j&&c.push({node:j,index:h+1,skipped:m,depth:p+1,statics:g+Xt(i,h),dynamics:b,optionals:x,extract:y,rawParams:S})}if(d.pathless){const j=p+1;for(let w=d.pathless.length-1;w>=0;w--){const P=d.pathless[w];c.push({node:P,index:h,skipped:m,depth:j,statics:g,dynamics:b,optionals:x,extract:y,rawParams:S})}}}if(u)return u;if(n&&l){let f=l.index;for(let h=0;h<l.index;h++)f+=t[h].length;const d=f===e.length?"/":e.slice(f);return l.rawParams??=Object.create(null),l.rawParams["**"]=decodeURIComponent(d),l}return null}function Xt(e,t){return 2**(e-t-1)}function Qa(e,t){return e===2**(t-1)-1}function Wn(e,t,s){let n,r;try{[n,r]=Zr(e,t,s)}catch{return null}if(s.rawParams=n,s.extract=r,!s.node.parse)return!0;try{if(s.node.parse(n)===!1)return null}catch{}return!0}function Zt(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===Ve)>(e.node.kind===Ve)||t.node.kind===Ve==(e.node.kind===Ve)&&t.depth>e.depth))):!0}function ls(e){return bn(e.filter(t=>t!==void 0).join("/"))}function bn(e){return e.replace(/\/{2,}/g,"/")}function eo(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Fe(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function to(e){return Fe(eo(e))}function bs(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function ei(e,t,s){return bs(e,s)===bs(t,s)}function ti({base:e,to:t,trailingSlash:s="never",cache:n}){const r=t.startsWith("/"),o=!r&&t===".";let i;if(n){i=r?t:o?e:e+"\0"+t;const u=n.get(i);if(u)return u}let c;if(o)c=e.split("/");else if(r)c=t.split("/");else{for(c=e.split("/");c.length>1&&Ut(c)==="";)c.pop();const u=t.split("/");for(let f=0,d=u.length;f<d;f++){const h=u[f];h===""?f?f===d-1&&c.push(h):c=[h]:h===".."?c.pop():h==="."||c.push(h)}}c.length>1&&(Ut(c)===""?s==="never"&&c.pop():s==="always"&&c.push(""));const l=bn(c.join("/"))||"/";return i&&n&&n.set(i,l),l}function si(e){const t=new Map(e.map(r=>[encodeURIComponent(r),r])),s=Array.from(t.keys()).map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),n=new RegExp(s,"g");return r=>r.replace(n,o=>t.get(o)??o)}function $s(e,t,s){const n=t[e];return typeof n!="string"?n:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(n)?n:n.split("/").map(r=>qn(r,s)).join("/"):qn(n,s)}function Hn({path:e,params:t,decoder:s,...n}){let r=!1;const o=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:o,isMissingParams:r};if(!e.includes("$"))return{interpolatedPath:e,usedParams:o,isMissingParams:r};const i=e.length;let c=0,l,u="";for(;c<i;){const f=c;l=Xr(e,f,l);const d=l[5];if(c=d+1,f===d)continue;const h=l[0];if(h===0){u+="/"+e.substring(f,d);continue}if(h===2){const m=t._splat;o._splat=m,o["*"]=m;const p=e.substring(f,l[1]),g=e.substring(l[4],d);if(!m){r=!0,(p||g)&&(u+="/"+p+g);continue}const b=$s("_splat",t,s);u+="/"+p+b+g;continue}if(h===1){const m=e.substring(l[2],l[3]);!r&&!(m in t)&&(r=!0),o[m]=t[m];const p=e.substring(f,l[1]),g=e.substring(l[4],d),b=$s(m,t,s)??"undefined";u+="/"+p+b+g;continue}if(h===3){const m=e.substring(l[2],l[3]),p=t[m];if(p==null)continue;o[m]=p;const g=e.substring(f,l[1]),b=e.substring(l[4],d),x=$s(m,t,s)??"";u+="/"+g+x+b;continue}}return e.endsWith("/")&&(u+="/"),{usedParams:o,interpolatedPath:u||"/",isMissingParams:r}}function qn(e,t){const s=encodeURIComponent(e);return t?.(s)??s}function xe(e){return e?.isNotFound===!0}function ni(e,t=String){const s=new URLSearchParams;for(const n in e){const r=e[n];r!==void 0&&s.set(n,t(r))}return s.toString()}function Bs(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function ri(e){const t=new URLSearchParams(e),s=Object.create(null);for(const[n,r]of t.entries()){const o=s[n];o==null?s[n]=Bs(r):Array.isArray(o)?o.push(Bs(r)):s[n]=[o,Bs(r)]}return s}const oi=ii(JSON.parse),ai=ci(JSON.stringify,JSON.parse);function ii(e){return t=>{t[0]==="?"&&(t=t.substring(1));const s=ri(t);for(const n in s){const r=s[n];if(typeof r=="string")try{s[n]=e(r)}catch{}}return s}}function ci(e,t){const s=typeof t=="function";function n(r){if(typeof r=="object"&&r!==null)try{return e(r)}catch{}else if(s&&typeof r=="string")try{return t(r),e(r)}catch{}return r}return r=>{const o=ni(r,n);return o?`?${o}`:""}}const rt="__root__";function li(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 s=new Response(null,{status:e.statusCode,headers:t});if(s.options=e,e.throw)throw s;return s}function we(e){return e instanceof Response&&!!e.options}const nn=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},di=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),Ps=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),ot=(e,t,s=!0)=>{const n={...e.router.options.context??{}},r=s?t:t-1;for(let o=0;o<=r;o++){const i=e.matches[o];if(!i)continue;const c=e.router.getMatch(i.id);c&&Object.assign(n,c.__routeContext,c.__beforeLoadContext)}return n},Gn=(e,t)=>{if(!e.matches.length)return;const s=t.routeId,n=e.matches.findIndex(i=>i.routeId===e.router.routeTree.id),r=n>=0?n:0;let o=s?e.matches.findIndex(i=>i.routeId===s):e.firstBadMatchIndex??e.matches.length-1;o<0&&(o=r);for(let i=o;i>=0;i--){const c=e.matches[i];if(e.router.looseRoutesById[c.routeId].options.notFoundComponent)return i}return s?o:r},We=(e,t,s)=>{if(!(!we(s)&&!xe(s)))throw we(s)&&s.redirectHandled&&!s.options.reloadDocument||(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=s,e.updateMatch(t.id,n=>({...n,status:we(s)?"redirected":xe(s)?"notFound":n.status==="pending"?"success":n.status,context:ot(e,t.index),isFetching:!1,error:s})),xe(s)&&!s.routeId&&(s.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),we(s)&&(e.rendered=!0,s.options._fromLocation=e.location,s.redirectHandled=!0,s=e.router.resolveRedirect(s))),s},so=(e,t)=>{const s=e.router.getMatch(t);return!!(!s||s._nonReactive.dehydrated)},Kn=(e,t,s)=>{const n=ot(e,s);e.updateMatch(t,r=>({...r,context:n}))},Tt=(e,t,s)=>{const{id:n,routeId:r}=e.matches[t],o=e.router.looseRoutesById[r];if(s instanceof Promise)throw s;e.firstBadMatchIndex??=t,We(e,e.router.getMatch(n),s);try{o.options.onError?.(s)}catch(i){s=i,We(e,e.router.getMatch(n),s)}e.updateMatch(n,i=>(i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,i._nonReactive.loadPromise?.resolve(),{...i,error:s,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!we(s)&&!xe(s)&&(e.serialError??=s)},no=(e,t,s,n)=>{if(n._nonReactive.pendingTimeout!==void 0)return;const r=s.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!Ps(e,t)&&(s.options.loader||s.options.beforeLoad||oo(s))&&typeof r=="number"&&r!==1/0&&(s.options.pendingComponent??e.router.options?.defaultPendingComponent)){const o=setTimeout(()=>{nn(e)},r);n._nonReactive.pendingTimeout=o}},ui=(e,t,s)=>{const n=e.router.getMatch(t);if(!n._nonReactive.beforeLoadPromise&&!n._nonReactive.loaderPromise)return;no(e,t,s,n);const r=()=>{const o=e.router.getMatch(t);o.preload&&(o.status==="redirected"||o.status==="notFound")&&We(e,o,o.error)};return n._nonReactive.beforeLoadPromise?n._nonReactive.beforeLoadPromise.then(r):r()},fi=(e,t,s,n)=>{const r=e.router.getMatch(t);let o=r._nonReactive.loadPromise;r._nonReactive.loadPromise=yt(()=>{o?.resolve(),o=void 0});const{paramsError:i,searchError:c}=r;i&&Tt(e,s,i),c&&Tt(e,s,c),no(e,t,n,r);const l=new AbortController;let u=!1;const f=()=>{u||(u=!0,e.updateMatch(t,N=>({...N,isFetching:"beforeLoad",fetchCount:N.fetchCount+1,abortController:l})))},d=()=>{r._nonReactive.beforeLoadPromise?.resolve(),r._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,N=>({...N,isFetching:!1}))};if(!n.options.beforeLoad){e.router.batch(()=>{f(),d()});return}r._nonReactive.beforeLoadPromise=yt();const h={...ot(e,s,!1),...r.__routeContext},{search:m,params:p,cause:g}=r,b=Ps(e,t),x={search:m,abortController:l,params:p,preload:b,context:h,location:e.location,navigate:N=>e.router.navigate({...N,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:b?"preload":g,matches:e.matches,routeId:n.id,...e.router.options.additionalContext},y=N=>{if(N===void 0){e.router.batch(()=>{f(),d()});return}(we(N)||xe(N))&&(f(),Tt(e,s,N)),e.router.batch(()=>{f(),e.updateMatch(t,C=>({...C,__beforeLoadContext:N})),d()})};let S;try{if(S=n.options.beforeLoad(x),$t(S))return f(),S.catch(N=>{Tt(e,s,N)}).then(y)}catch(N){f(),Tt(e,s,N)}y(S)},hi=(e,t)=>{const{id:s,routeId:n}=e.matches[t],r=e.router.looseRoutesById[n],o=()=>c(),i=()=>fi(e,s,t,r),c=()=>{if(so(e,s))return;const l=ui(e,s,r);return $t(l)?l.then(i):i()};return o()},mi=(e,t,s)=>{const n=e.router.getMatch(t);if(!n||!s.options.head&&!s.options.scripts&&!s.options.headers)return;const r={ssr:e.router.options.ssr,matches:e.matches,match:n,params:n.params,loaderData:n.loaderData};return Promise.all([s.options.head?.(r),s.options.scripts?.(r),s.options.headers?.(r)]).then(([o,i,c])=>({meta:o?.meta,links:o?.links,headScripts:o?.scripts,headers:c,scripts:i,styles:o?.styles}))},ro=(e,t,s,n,r)=>{const o=t[n-1],{params:i,loaderDeps:c,abortController:l,cause:u}=e.router.getMatch(s),f=ot(e,n),d=Ps(e,s);return{params:i,deps:c,preload:!!d,parentMatchPromise:o,abortController:l,context:f,location:e.location,navigate:h=>e.router.navigate({...h,_fromLocation:e.location}),cause:d?"preload":u,route:r,...e.router.options.additionalContext}},Yn=async(e,t,s,n,r)=>{try{const o=e.router.getMatch(s);try{(!(Gr??e.router.isServer)||o.ssr===!0)&&zt(r);const i=r.options.loader,c=typeof i=="function"?i:i?.handler,l=c?.(ro(e,t,s,n,r)),u=!!c&&$t(l);if((u||r._lazyPromise||r._componentsPromise||r.options.head||r.options.scripts||r.options.headers||o._nonReactive.minPendingPromise)&&e.updateMatch(s,d=>({...d,isFetching:"loader"})),c){const d=u?await l:l;We(e,e.router.getMatch(s),d),d!==void 0&&e.updateMatch(s,h=>({...h,loaderData:d}))}r._lazyPromise&&await r._lazyPromise;const f=o._nonReactive.minPendingPromise;f&&await f,r._componentsPromise&&await r._componentsPromise,e.updateMatch(s,d=>({...d,error:void 0,context:ot(e,n),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(i){let c=i;if(c?.name==="AbortError"){if(o.abortController.signal.aborted){o._nonReactive.loaderPromise?.resolve(),o._nonReactive.loaderPromise=void 0;return}e.updateMatch(s,u=>({...u,status:u.status==="pending"?"success":u.status,isFetching:!1,context:ot(e,n)}));return}const l=o._nonReactive.minPendingPromise;l&&await l,xe(i)&&await r.options.notFoundComponent?.preload?.(),We(e,e.router.getMatch(s),i);try{r.options.onError?.(i)}catch(u){c=u,We(e,e.router.getMatch(s),u)}!we(c)&&!xe(c)&&await zt(r,["errorComponent"]),e.updateMatch(s,u=>({...u,error:c,context:ot(e,n),status:"error",isFetching:!1}))}}catch(o){const i=e.router.getMatch(s);i&&(i._nonReactive.loaderPromise=void 0),We(e,i,o)}},pi=async(e,t,s)=>{async function n(m,p,g,b,x){const y=Date.now()-p.updatedAt,S=m?x.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:x.options.staleTime??e.router.options.defaultStaleTime??0,N=x.options.shouldReload,C=typeof N=="function"?N(ro(e,t,r,s,x)):N,{status:_,invalid:j}=b,w=y>=S&&(!!e.forceStaleReload||b.cause==="enter"||g!==void 0&&g!==b.id);i=_==="success"&&(j||(C??w)),m&&x.options.preload===!1||(i&&!e.sync&&f?(c=!0,(async()=>{try{await Yn(e,t,r,s,x);const P=e.router.getMatch(r);P._nonReactive.loaderPromise?.resolve(),P._nonReactive.loadPromise?.resolve(),P._nonReactive.loaderPromise=void 0,P._nonReactive.loadPromise=void 0}catch(P){we(P)&&await e.router.navigate(P.options)}})()):_!=="success"||i?await Yn(e,t,r,s,x):Kn(e,r,s))}const{id:r,routeId:o}=e.matches[s];let i=!1,c=!1;const l=e.router.looseRoutesById[o],u=l.options.loader,f=((typeof u=="function"?void 0:u?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(so(e,r)){if(!e.router.getMatch(r))return e.matches[s];Kn(e,r,s)}else{const m=e.router.getMatch(r),p=e.router.stores.matchesId.get()[s],g=(p&&e.router.stores.matchStores.get(p)||null)?.routeId===o?p:e.router.stores.matches.get().find(x=>x.routeId===o)?.id,b=Ps(e,r);if(m._nonReactive.loaderPromise){if(m.status==="success"&&!e.sync&&!m.preload&&f)return m;await m._nonReactive.loaderPromise;const x=e.router.getMatch(r),y=x._nonReactive.error||x.error;y&&We(e,x,y),x.status==="pending"&&await n(b,m,g,x,l)}else{const x=b&&!e.router.stores.matchStores.has(r),y=e.router.getMatch(r);y._nonReactive.loaderPromise=yt(),x!==y.preload&&e.updateMatch(r,S=>({...S,preload:x})),await n(b,m,g,y,l)}}const d=e.router.getMatch(r);c||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,c||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;const h=c?d.isFetching:!1;return h!==d.isFetching||d.invalid!==!1?(e.updateMatch(r,m=>({...m,isFetching:h,invalid:!1})),e.router.getMatch(r)):d};async function Jn(e){const t=e,s=[];di(t.router)&&nn(t);let n;for(let h=0;h<t.matches.length;h++){try{const m=hi(t,h);$t(m)&&await m}catch(m){if(we(m))throw m;if(xe(m))n=m;else if(!t.preload)throw m;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const r=t.firstBadMatchIndex??t.matches.length,o=n&&!t.preload?Gn(t,n):void 0,i=n&&t.preload?0:o!==void 0?Math.min(o+1,r):r;let c,l;for(let h=0;h<i;h++)s.push(pi(t,s,h));try{await Promise.all(s)}catch{const h=await Promise.allSettled(s);for(const m of h){if(m.status!=="rejected")continue;const p=m.reason;if(we(p))throw p;xe(p)?c??=p:l??=p}if(l!==void 0)throw l}const u=c??(n&&!t.preload?n:void 0);let f=t.firstBadMatchIndex!==void 0?t.firstBadMatchIndex:t.matches.length-1;if(!u&&n&&t.preload)return t.matches;if(u){const h=Gn(t,u);if(h===void 0){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not find match for notFound boundary");Ue()}const m=t.matches[h],p=t.router.looseRoutesById[m.routeId],g=t.router.options?.defaultNotFoundComponent;!p.options.notFoundComponent&&g&&(p.options.notFoundComponent=g),u.routeId=m.routeId;const b=m.routeId===t.router.routeTree.id;t.updateMatch(m.id,x=>({...x,...b?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:u},isFetching:!1})),f=h,await zt(p,["notFoundComponent"])}else if(!t.preload){const h=t.matches[0];h.globalNotFound||t.router.getMatch(h.id)?.globalNotFound&&t.updateMatch(h.id,m=>({...m,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const h=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await zt(h,["errorComponent"])}for(let h=0;h<=f;h++){const{id:m,routeId:p}=t.matches[h],g=t.router.looseRoutesById[p];try{const b=mi(t,m,g);if(b){const x=await b;t.updateMatch(m,y=>({...y,...x}))}}catch(b){console.error(`Error executing head for route ${p}:`,b)}}const d=nn(t);if($t(d)&&await d,u)throw u;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Xn(e,t){const s=t.map(n=>e.options[n]?.preload?.()).filter(Boolean);if(s.length!==0)return Promise.all(s)}function zt(e,t=ds){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(n=>{const{id:r,...o}=n.options;Object.assign(e.options,o),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const s=()=>e._componentsLoaded?void 0:t===ds?(()=>{if(e._componentsPromise===void 0){const n=Xn(e,ds);n?e._componentsPromise=n.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Xn(e,t);return e._lazyPromise?e._lazyPromise.then(s):s()}function oo(e){for(const t of ds)if(e.options[t]?.preload)return!0;return!1}const ds=["component","errorComponent","pendingComponent","notFoundComponent"];function gi(e){return{input:({url:t})=>{for(const s of e)t=rn(s,t);return t},output:({url:t})=>{for(let s=e.length-1;s>=0;s--)t=ao(e[s],t);return t}}}function xi(e){const t=to(e.basepath),s=`/${t}`,n=e.caseSensitive?s:s.toLowerCase(),r=`${n}/`;return{input:({url:o})=>{const i=e.caseSensitive?o.pathname:o.pathname.toLowerCase();return i===n?o.pathname="/":i.startsWith(r)&&(o.pathname=o.pathname.slice(s.length)),o},output:({url:o})=>(o.pathname=ls(["/",t,o.pathname]),o)}}function rn(e,t){const s=e?.input?.({url:t});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return t}function ao(e,t){const s=e?.output?.({url:t});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return t}function bi(e,t){const{createMutableStore:s,createReadonlyStore:n,batch:r,init:o}=t,i=new Map,c=new Map,l=new Map,u=s(e.status),f=s(e.loadedAt),d=s(e.isLoading),h=s(e.isTransitioning),m=s(e.location),p=s(e.resolvedLocation),g=s(e.statusCode),b=s(e.redirect),x=s([]),y=s([]),S=s([]),N=n(()=>zs(i,x.get())),C=n(()=>zs(c,y.get())),_=n(()=>zs(l,S.get())),j=n(()=>x.get()[0]),w=n(()=>x.get().some(Q=>i.get(Q)?.get().status==="pending")),P=n(()=>({locationHref:m.get().href,resolvedLocationHref:p.get()?.href,status:u.get()})),I=n(()=>({status:u.get(),loadedAt:f.get(),isLoading:d.get(),isTransitioning:h.get(),matches:N.get(),location:m.get(),resolvedLocation:p.get(),statusCode:g.get(),redirect:b.get()})),k=Bt(64);function T(Q){let he=k.get(Q);return he||(he=n(()=>{const me=x.get();for(const O of me){const R=i.get(O);if(R&&R.routeId===Q)return R.get()}}),k.set(Q,he)),he}const Z={status:u,loadedAt:f,isLoading:d,isTransitioning:h,location:m,resolvedLocation:p,statusCode:g,redirect:b,matchesId:x,pendingIds:y,cachedIds:S,matches:N,pendingMatches:C,cachedMatches:_,firstId:j,hasPending:w,matchRouteDeps:P,matchStores:i,pendingMatchStores:c,cachedMatchStores:l,__store:I,getRouteMatchStore:T,setMatches:z,setPending:J,setCached:Y};z(e.matches),o?.(Z);function z(Q){Vs(Q,i,x,s,r)}function J(Q){Vs(Q,c,y,s,r)}function Y(Q){Vs(Q,l,S,s,r)}return Z}function zs(e,t){const s=[];for(const n of t){const r=e.get(n);r&&s.push(r.get())}return s}function Vs(e,t,s,n,r){const o=e.map(c=>c.id),i=new Set(o);r(()=>{for(const c of t.keys())i.has(c)||t.delete(c);for(const c of e){const l=t.get(c.id);if(!l){const u=n(c);u.routeId=c.routeId,t.set(c.id,u);continue}l.routeId=c.routeId,l.get()!==c&&l.set(c)}Va(s.get(),o)||s.set(o)})}var He="__TSR_index",Zn="popstate",Qn="beforeunload";function yi(e){let t=e.getLocation();const s=new Set,n=i=>{t=e.getLocation(),s.forEach(c=>c({location:t,action:i}))},r=i=>{e.notifyOnIndexChange??!0?n(i):t=e.getLocation()},o=async({task:i,navigateOpts:c,...l})=>{if(c?.ignoreBlocker??!1){i();return}const u=e.getBlockers?.()??[],f=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&u.length&&f)for(const d of u){const h=ys(l.path,l.state);if(await d.blockerFn({currentLocation:t,nextLocation:h,action:l.type})){e.onBlocked?.();return}}i()};return{get location(){return t},get length(){return e.getLength()},subscribers:s,subscribe:i=>(s.add(i),()=>{s.delete(i)}),push:(i,c,l)=>{const u=t.state[He];c=er(u+1,c),o({task:()=>{e.pushState(i,c),n({type:"PUSH"})},navigateOpts:l,type:"PUSH",path:i,state:c})},replace:(i,c,l)=>{const u=t.state[He];c=er(u,c),o({task:()=>{e.replaceState(i,c),n({type:"REPLACE"})},navigateOpts:l,type:"REPLACE",path:i,state:c})},go:(i,c)=>{o({task:()=>{e.go(i),r({type:"GO",index:i})},navigateOpts:c,type:"GO"})},back:i=>{o({task:()=>{e.back(i?.ignoreBlocker??!1),r({type:"BACK"})},navigateOpts:i,type:"BACK"})},forward:i=>{o({task:()=>{e.forward(i?.ignoreBlocker??!1),r({type:"FORWARD"})},navigateOpts:i,type:"FORWARD"})},canGoBack:()=>t.state[He]!==0,createHref:i=>e.createHref(i),block:i=>{if(!e.setBlockers)return()=>{};const c=e.getBlockers?.()??[];return e.setBlockers([...c,i]),()=>{const l=e.getBlockers?.()??[];e.setBlockers?.(l.filter(u=>u!==i))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:n}}function er(e,t){t||(t={});const s=yn();return{...t,key:s,__TSR_key:s,[He]:e}}function vi(e){const t=typeof document<"u"?window:void 0,s=t.history.pushState,n=t.history.replaceState;let r=[];const o=()=>r,i=w=>r=w,c=(w=>w),l=(()=>ys(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const w=yn();t.history.replaceState({[He]:0,key:w,__TSR_key:w},"")}let u=l(),f,d=!1,h=!1,m=!1,p=!1;const g=()=>u;let b,x;const y=()=>{b&&(j._ignoreSubscribers=!0,(b.isPush?t.history.pushState:t.history.replaceState)(b.state,"",b.href),j._ignoreSubscribers=!1,b=void 0,x=void 0,f=void 0)},S=(w,P,I)=>{const k=c(P);x||(f=u),u=ys(P,I),b={href:k,state:I,isPush:b?.isPush||w==="push"},x||(x=Promise.resolve().then(()=>y()))},N=w=>{u=l(),j.notify({type:w})},C=async()=>{if(h){h=!1;return}const w=l(),P=w.state[He]-u.state[He],I=P===1,k=P===-1,T=!I&&!k||d;d=!1;const Z=T?"GO":k?"BACK":"FORWARD",z=T?{type:"GO",index:P}:{type:k?"BACK":"FORWARD"};if(m)m=!1;else{const J=o();if(typeof document<"u"&&J.length){for(const Y of J)if(await Y.blockerFn({currentLocation:u,nextLocation:w,action:Z})){h=!0,t.history.go(1),j.notify(z);return}}}u=l(),j.notify(z)},_=w=>{if(p){p=!1;return}let P=!1;const I=o();if(typeof document<"u"&&I.length)for(const k of I){const T=k.enableBeforeUnload??!0;if(T===!0){P=!0;break}if(typeof T=="function"&&T()===!0){P=!0;break}}if(P)return w.preventDefault(),w.returnValue=""},j=yi({getLocation:g,getLength:()=>t.history.length,pushState:(w,P)=>S("push",w,P),replaceState:(w,P)=>S("replace",w,P),back:w=>(w&&(m=!0),p=!0,t.history.back()),forward:w=>{w&&(m=!0),p=!0,t.history.forward()},go:w=>{d=!0,t.history.go(w)},createHref:w=>c(w),flush:y,destroy:()=>{t.history.pushState=s,t.history.replaceState=n,t.removeEventListener(Qn,_,{capture:!0}),t.removeEventListener(Zn,C)},onBlocked:()=>{f&&u!==f&&(u=f)},getBlockers:o,setBlockers:i,notifyOnIndexChange:!1});return t.addEventListener(Qn,_,{capture:!0}),t.addEventListener(Zn,C),t.history.pushState=function(...w){const P=s.apply(t.history,w);return j._ignoreSubscribers||N("PUSH"),P},t.history.replaceState=function(...w){const P=n.apply(t.history,w);return j._ignoreSubscribers||N("REPLACE"),P},j}function wi(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function ys(e,t){const s=wi(e),n=s.indexOf("#"),r=s.indexOf("?"),o=yn();return{href:s,pathname:s.substring(0,n>0?r>0?Math.min(n,r):n:r>0?r:s.length),hash:n>-1?s.substring(n):"",search:r>-1?s.slice(r,n===-1?void 0:n):"",state:t||{[He]:0,key:o,__TSR_key:o}}}function yn(){return(Math.random()+1).toString(36).substring(7)}function bt(e,t){const s=t,n=e;return{fromLocation:s,toLocation:n,pathChanged:s?.pathname!==n.pathname,hrefChanged:s?.href!==n.href,hashChanged:s?.hash!==n.hash}}const on=new WeakMap;var Si=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.lightweightCache=new WeakMap,this.startTransition=s=>s(),this.update=s=>{process.env.NODE_ENV!=="production"&&s.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const n=this.options,r=this.basepath??n?.basepath??"/",o=this.basepath===void 0,i=n?.rewrite;if(this.options={...n,...s},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=si(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=vi()),this.origin=this.options.origin,this.origin||(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 f;this.resolvePathCache=Bt(1e3),f=this.buildRouteTree(),this.setRoutes(f)}if(!this.stores&&this.latestLocation){const f=this.getStoreConfig(this);this.batch=f.batch,this.stores=bi(Ri(this.latestLocation),f),Ii(this)}let c=!1;const l=this.options.basepath??"/",u=this.options.rewrite;if(o||r!==l||i!==u){this.basepath=l;const f=[],d=to(l);d&&d!=="/"&&f.push(xi({basepath:l})),u&&f.push(u),this.rewrite=f.length===0?void 0:f.length===1?f[0]:gi(f),this.history&&this.updateLatestLocation(),c=!0}c&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.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 s=Ja(this.routeTree,this.options.caseSensitive,(n,r)=>{n.init({originalIndex:r})});return this.options.routeMasks&&Ha(this.options.routeMasks,s.processedTree),s},this.subscribe=(s,n)=>{const r={eventType:s,fn:n};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}},this.emit=s=>{this.subscribers.forEach(n=>{n.eventType===s.type&&n.fn(s)})},this.parseLocation=(s,n)=>{const r=({pathname:l,search:u,hash:f,href:d,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){const x=this.options.parseSearch(u),y=this.options.stringifySearch(x);return{href:l+y+f,publicHref:l+y+f,pathname:At(l).path,external:!1,searchStr:y,search:Ye(n?.search,x),hash:At(f.slice(1)).path,state:Qe(n?.state,h)}}const m=new URL(d,this.origin),p=rn(this.rewrite,m),g=this.options.parseSearch(p.search),b=this.options.stringifySearch(g);return p.search=b,{href:p.href.replace(p.origin,""),publicHref:d,pathname:At(p.pathname).path,external:!!this.rewrite&&p.origin!==this.origin,searchStr:b,search:Ye(n?.search,g),hash:At(p.hash.slice(1)).path,state:Qe(n?.state,h)}},o=r(s),{__tempLocation:i,__tempKey:c}=o.state;if(i&&(!c||c===this.tempLocationKey)){const l=r(i);return l.state.key=o.state.key,l.state.__TSR_key=o.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:o}}return o},this.resolvePathWithBase=(s,n)=>ti({base:s,to:n.includes("//")?bn(n):n,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(s,n,r)=>typeof s=="string"?this.matchRoutesInternal({pathname:s,search:n},r):this.matchRoutesInternal(s,n),this.getMatchedRoutes=s=>Ni({pathname:s,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=s=>{const n=this.getMatch(s);n&&(n.abortController.abort(),clearTimeout(n._nonReactive.pendingTimeout),n._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(s=>{this.cancelMatch(s)}),this.stores.matchesId.get().forEach(s=>{if(this.stores.pendingMatchStores.has(s))return;const n=this.stores.matchStores.get(s)?.get();n&&(n.status==="pending"||n.isFetching==="loader")&&this.cancelMatch(s)})},this.buildLocation=s=>{const n=(o={})=>{const i=o._fromLocation||this.pendingBuiltLocation||this.latestLocation,c=this.matchRoutesLightweight(i);if(o.from&&process.env.NODE_ENV!=="production"&&o._isNavigate){const k=this.getMatchedRoutes(o.from).matchedRoutes,T=zn(c.matchedRoutes,z=>sr(z.fullPath,o.from)),Z=zn(k,z=>sr(z.fullPath,c.fullPath));!T&&!Z&&console.warn(`Could not find match for from: ${o.from}`)}const l=o.unsafeRelative==="path"?i.pathname:o.from??c.fullPath,u=o.to?`${o.to}`:void 0,f=c.search,d=Object.assign(Object.create(null),c.params),h=u?.charCodeAt(0)===47?"/":this.resolvePathWithBase(l,"."),m=u?this.resolvePathWithBase(h,u):h,p=o.params===!1||o.params===null?Object.create(null):(o.params??!0)===!0?d:Object.assign(d,Ze(o.params,d)),g=this.routesByPath[Fe(m)];let b;if(g)b=this.getRouteBranch(g);else if(m.includes("$"))b=[];else{const k=this.getMatchedRoutes(m);b=k.matchedRoutes,this.options.notFoundRoute&&(!k.foundRoute||k.foundRoute.path!=="/"&&k.routeParams["**"])&&(b=[...b,this.options.notFoundRoute])}if(b.length&&Yr(p))for(const k of b){const T=k.options.params?.stringify??k.options.stringifyParams;if(T)try{Object.assign(p,T(p))}catch{}}const x=s.leaveParams?m:At(Hn({path:m,params:p,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;if(process.env.NODE_ENV!=="production"&&g&&!s.leaveParams)try{const k=this.getMatchedRoutes(x);k.foundRoute?.id!==g.id&&console.warn(`Generated path "${x}" for route "${g.id}" matched route "${k.foundRoute?.id}" instead. This can happen when multiple route templates resolve to the same URL. Use the route template that matches the intended route, or adjust params.stringify if it changed the target path.`)}catch{}let y=f;if(s._includeValidateSearch&&this.options.search?.strict){const k={};b.forEach(T=>{if(T.options.validateSearch)try{Object.assign(k,us(T.options.validateSearch,{...k,...y}))}catch{}}),y=k}y=Ci({search:y,dest:o,destRoutes:b,_includeValidateSearch:s._includeValidateSearch}),y=Ye(f,y);const S=this.options.stringifySearch(y),N=o.hash===!0?i.hash:o.hash?Ze(o.hash,i.hash):void 0,C=N?`#${N}`:"";let _=o.state===!0?i.state:o.state?Ze(o.state,i.state):{};_=Qe(i.state,_);const j=`${x}${S}${C}`;let w,P,I=!1;if(this.rewrite){const k=new URL(j,this.origin),T=ao(this.rewrite,k);w=k.href.replace(k.origin,""),T.origin!==this.origin?(P=T.href,I=!0):P=T.pathname+T.search+T.hash}else w=za(j),P=w;return{publicHref:P,href:w,pathname:x,search:y,searchStr:S,state:_,hash:N??"",external:I,unmaskOnReload:o.unmaskOnReload}},r=(o={},i)=>{const c=n(o);let l=i?n(i):void 0;if(!l){const u=Object.create(null);if(this.options.routeMasks){const f=qa(c.pathname,this.processedTree);if(f){Object.assign(u,f.rawParams);const{from:d,params:h,...m}=f.route,p=h===!1||h===null?Object.create(null):(h??!0)===!0?u:Object.assign(u,Ze(h,u));i={from:s.from,...m,params:p},l=n(i)}}}return l&&(c.maskedLocation=l),c};return s.mask?r(s,{from:s.from,...s.mask}):r(s)},this.commitLocation=async({viewTransition:s,ignoreBlocker:n,...r})=>{let o;const i=()=>{const u=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];u.forEach(d=>{r.state[d]=this.latestLocation.state[d]});const f=nt(r.state,this.latestLocation.state);return u.forEach(d=>{delete r.state[d]}),f},c=Fe(this.latestLocation.href)===Fe(r.href);let l=this.commitLocationPromise;if(this.commitLocationPromise=yt(()=>{l?.resolve(),l=void 0}),c&&i())this.load();else{let{maskedLocation:u,hashScrollIntoView:f,...d}=r;u&&(d={...u,state:{...u.state,__tempKey:void 0,__tempLocation:{...d,search:d.searchStr,state:{...d.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(d.unmaskOnReload??this.options.unmaskOnReload??!1)&&(d.state.__tempKey=this.tempLocationKey)),d.state.__hashScrollIntoViewOptions=f??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=s,o=r.replace?"REPLACE":"PUSH",this.history[o==="REPLACE"?"replace":"push"](d.publicHref,d.state,{ignoreBlocker:n})}return this._scroll.next=r.resetScroll??!0,this.history.subscribers.size||this.load(o?{action:{type:o}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:s,resetScroll:n,hashScrollIntoView:r,viewTransition:o,ignoreBlocker:i,href:c,...l}={})=>{if(c){const d=this.history.location.state.__TSR_index,h=ys(c,{__TSR_index:s?d:d+1}),m=new URL(h.pathname,this.origin);l.to=rn(this.rewrite,m).pathname,l.search=this.options.parseSearch(h.search),l.hash=h.hash.slice(1)}const u=this.buildLocation({...l,_includeValidateSearch:!0});this.pendingBuiltLocation=u;const f=this.commitLocation({...u,viewTransition:o,replace:s,resetScroll:n,hashScrollIntoView:r,ignoreBlocker:i});return queueMicrotask(()=>{this.pendingBuiltLocation===u&&(this.pendingBuiltLocation=void 0)}),f},this.navigate=async({to:s,reloadDocument:n,href:r,publicHref:o,...i})=>{let c=!1;if(r)try{new URL(`${r}`),c=!0}catch{}if(c&&!n&&(n=!0),n){if(s!==void 0||!r){const u=this.buildLocation({to:s,...i});r=r??u.publicHref,o=o??u.publicHref}const l=!c&&o?o:r;if(xs(l,this.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked navigation to dangerous protocol: ${l}`);return}if(!i.ignoreBlocker){const u=this.history.getBlockers?.()??[];for(const f of u)if(f?.blockerFn&&await f.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return}i.replace?window.location.replace(l):window.location.href=l;return}return this.buildAndCommitLocation({...i,href:r,to:s,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const s=this.matchRoutes(this.latestLocation),n=this.stores.cachedMatches.get().filter(r=>!s.some(o=>o.id===r.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(s),this.stores.setCached(n)})},this.load=async s=>{const n=s?.action?.type;let r,o,i;const c=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(u=>{this.startTransition(async()=>{try{this.beforeLoad(),n?on.set(this.latestLocation,n):on.delete(this.latestLocation);const f=this.latestLocation,d=bt(f,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...d}),this.emit({type:"onBeforeLoad",...d}),await Jn({router:this,sync:s?.sync,forceStaleReload:c.href===f.href,matches:this.stores.pendingMatches.get(),location:f,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let h=null,m=null,p=null,g=null;this.batch(()=>{const b=this.stores.pendingMatches.get(),x=b.length,y=this.stores.matches.get();h=x?y.filter(C=>!this.stores.pendingMatchStores.has(C.id)):null;const S=new Set;for(const C of this.stores.pendingMatchStores.values())C.routeId&&S.add(C.routeId);const N=new Set;for(const C of this.stores.matchStores.values())C.routeId&&N.add(C.routeId);m=x?y.filter(C=>!S.has(C.routeId)):null,p=x?b.filter(C=>!N.has(C.routeId)):null,g=x?b.filter(C=>N.has(C.routeId)):y,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),x&&(this.stores.setMatches(b),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...h.filter(C=>C.status!=="error"&&C.status!=="notFound"&&C.status!=="redirected")]),this.clearExpiredCache())});for(const[b,x]of[[m,"onLeave"],[p,"onEnter"],[g,"onStay"]])if(b)for(const y of b)this.looseRoutesById[y.routeId].options[x]?.(y)})})}})}catch(f){we(f)?(r=f,this.navigate({...r.options,replace:!0,ignoreBlocker:!0})):xe(f)&&(o=f);const d=r?r.status:o?404:this.stores.matches.get().some(h=>h.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(d),this.stores.redirect.set(r)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),u()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let l;this.hasNotFoundMatch()?l=404:this.stores.matches.get().some(u=>u.status==="error")&&(l=500),l!==void 0&&this.stores.statusCode.set(l)},this.startViewTransition=s=>{const n=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,n&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let r;if(typeof n=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,i=this.stores.resolvedLocation.get(),c=typeof n.types=="function"?n.types(bt(o,i)):n.types;if(c===!1){s();return}r={update:s,types:c}}else r=s;document.startViewTransition(r)}else s()},this.updateMatch=(s,n)=>{this.startTransition(()=>{const r=this.stores.pendingMatchStores.get(s);if(r){r.set(n);return}const o=this.stores.matchStores.get(s);if(o){o.set(n);return}const i=this.stores.cachedMatchStores.get(s);if(i){const c=n(i.get());c.status==="redirected"?this.stores.cachedMatchStores.delete(s)&&this.stores.cachedIds.set(l=>l.filter(u=>u!==s)):i.set(c)}})},this.getMatch=s=>this.stores.cachedMatchStores.get(s)?.get()??this.stores.pendingMatchStores.get(s)?.get()??this.stores.matchStores.get(s)?.get(),this.invalidate=s=>{const n=r=>s?.filter?.(r)??!0?{...r,invalid:!0,...s?.forcePending||r.status==="error"||r.status==="notFound"?{status:"pending",error:void 0}:void 0}:r;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(n)),this.stores.setCached(this.stores.cachedMatches.get().map(n)),this.stores.setPending(this.stores.pendingMatches.get().map(n))}),this.shouldViewTransition=!1,this.load({sync:s?.sync})},this.getParsedLocationHref=s=>s.publicHref||"/",this.resolveRedirect=s=>{const n=s.headers.get("Location");if(!s.options.href||s.options._builtLocation){const r=s.options._builtLocation??this.buildLocation(s.options),o=this.getParsedLocationHref(r);s.options.href=o,s.headers.set("Location",o)}else if(n)try{const r=new URL(n);if(this.origin&&r.origin===this.origin){const o=r.pathname+r.search+r.hash;s.options.href=o,s.headers.set("Location",o)}}catch{}if(s.options.href&&!s.options._builtLocation&&xs(s.options.href,this.protocolAllowlist))throw new Error(process.env.NODE_ENV!=="production"?`Redirect blocked: unsafe protocol in href "${s.options.href}". Allowed protocols: ${Array.from(this.protocolAllowlist).join(", ")}.`:"Redirect blocked: unsafe protocol");return s.headers.get("Location")||s.headers.set("Location",s.options.href),s},this.clearCache=s=>{const n=s?.filter;n!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(r=>!n(r))):this.stores.setCached([])},this.clearExpiredCache=()=>{const s=Date.now(),n=r=>{const o=this.looseRoutesById[r.routeId];if(!o.options.loader)return!0;const i=(r.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return r.status==="error"?!0:s-r.updatedAt>=i};this.clearCache({filter:n})},this.loadRouteChunk=zt,this.preloadRoute=async s=>{const n=s._builtLocation??this.buildLocation(s);let r=this.matchRoutes(n,{throwOnError:!0,preload:!0,dest:s});const o=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...o,...this.stores.cachedIds.get()]),c=r.filter(l=>!i.has(l.id));if(c.length){const l=this.stores.cachedMatches.get();this.stores.setCached([...l,...c])}try{return r=await Jn({router:this,matches:r,location:n,preload:!0,updateMatch:(l,u)=>{o.has(l)?r=r.map(f=>f.id===l?u(f):f):this.updateMatch(l,u)}}),r}catch(l){if(we(l))return l.options.reloadDocument?void 0:await this.preloadRoute({...l.options,_fromLocation:n});xe(l)||console.error(l);return}},this.matchRoute=(s,n)=>{const r={...s,to:s.to?this.resolvePathWithBase(s.from||"",s.to):void 0,params:s.params||{},leaveParams:!0},o=this.buildLocation(r);if(n?.pending&&this.stores.status.get()!=="pending")return!1;const i=(n?.pending===void 0?!this.stores.isLoading.get():n.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),c=Ga(o.pathname,n?.caseSensitive??!1,n?.fuzzy??!1,i.pathname,this.processedTree);return!c||s.params&&!nt(c.rawParams,s.params,{partial:!0})?!1:n?.includeSearch??!0?nt(i.search,o.search,{partial:!0})?c.rawParams:!1:c.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(s=>s.status==="notFound"||s.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??ai,parseSearch:e.parseSearch??oi,protocolAllowlist:e.protocolAllowlist??Ba}),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:s}){this.routesById=e,this.routesByPath=t,this.processedTree=s;const n=this.options.notFoundRoute;n&&(n.init({originalIndex:99999999999}),this.routesById[n.id]=n)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=Qr(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){const s=this.getMatchedRoutes(e.pathname),{foundRoute:n,routeParams:r}=s;let{matchedRoutes:o}=s,i=!1;(n?n.path!=="/"&&r["**"]:Fe(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:i=!0);const c=i?ki(this.options.notFoundMode,o):void 0,l=new Array(o.length),u=new Map;for(const f of this.stores.matchStores.values())f.routeId&&u.set(f.routeId,f.get());for(let f=0;f<o.length;f++){const d=o[f],h=l[f-1];let m,p,g;{const T=h?.search??e.search,Z=h?._strictSearch??void 0;try{const z=us(d.options.validateSearch,{...T})??void 0;m={...T,...z},p={...Z,...z},g=void 0}catch(z){let J=z;if(z instanceof vs||(J=new vs(z.message,{cause:z})),t?.throwOnError)throw J;m=T,p={},g=J}}const b=d.options.loaderDeps?.({search:m})??"",x=b?JSON.stringify(b):"",{interpolatedPath:y,usedParams:S}=Hn({path:d.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),N=d.id+y+x,C=this.getMatch(N),_=u.get(d.id),j=C?._strictParams??S;let w;if(!C)try{nr(d,j)}catch(T){if(xe(T)||we(T)?w=T:w=new ji(T.message,{cause:T}),t?.throwOnError)throw w}Object.assign(r,j);const P=_?"stay":"enter";let I;if(C)I={...C,cause:P,params:_?.params??r,_strictParams:j,search:Ye(_?_.search:C.search,m),_strictSearch:p};else{const T=d.options.loader||d.options.beforeLoad||d.lazyFn||oo(d)?"pending":"success";I={id:N,ssr:d.options.ssr,index:f,routeId:d.id,params:_?.params??r,_strictParams:j,pathname:y,updatedAt:Date.now(),search:_?Ye(_.search,m):m,_strictSearch:p,searchError:void 0,status:T,isFetching:!1,error:void 0,paramsError:w,__routeContext:void 0,_nonReactive:{loadPromise:yt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:P,loaderDeps:_?Qe(_.loaderDeps,b):b,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:d.options.staticData||{},fullPath:d.fullPath}}t?.preload||(I.globalNotFound=c===d.id),I.searchError=g;const k=this.getParentContext(h);I.context={...k,...I.__routeContext,...I.__beforeLoadContext},l[f]=I}for(let f=0;f<l.length;f++){const d=l[f],h=this.looseRoutesById[d.routeId],m=this.getMatch(d.id),p=u.get(d.routeId);if(d.params=p?Ye(p.params,r):r,!m){const g=l[f-1],b=this.getParentContext(g);if(h.options.context){const x={deps:d.loaderDeps,params:d.params,context:b??{},location:e,navigate:y=>this.navigate({...y,_fromLocation:e}),buildLocation:this.buildLocation,cause:d.cause,abortController:d.abortController,preload:!!d.preload,matches:l,routeId:h.id};d.__routeContext=h.options.context(x)??void 0}d.context={...b,...d.__routeContext,...d.__beforeLoadContext}}}return l}matchRoutesLightweight(e){const t=Ut(this.stores.matchesId.get()),s=this.lightweightCache.get(e);if(s&&s[0]===t)return s[1];const{matchedRoutes:n,routeParams:r}=this.getMatchedRoutes(e.pathname),o=Ut(n),i={...e.search};for(const d of n)try{Object.assign(i,us(d.options.validateSearch,i))}catch{}const c=t&&this.stores.matchStores.get(t)?.get(),l=c&&c.routeId===o.id&&c.pathname===e.pathname;let u;if(l)u=c.params;else{const d=Object.assign(Object.create(null),r);for(const h of n)try{nr(h,d)}catch{}u=d}const f={matchedRoutes:n,fullPath:o.fullPath,search:i,params:u};return this.lightweightCache.set(e,[t,f]),f}},vs=class extends Error{},ji=class extends Error{};const tr=e=>e.endsWith("/")&&e.length>1?e.slice(0,-1):e;function sr(e,t){return tr(e)===tr(t)}function Ri(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function us(e,t){if(e==null)return{};if("~standard"in e){const s=e["~standard"].validate(t);if(s instanceof Promise)throw new vs("Async validation not supported");if(s.issues)throw new vs(JSON.stringify(s.issues,void 0,2),{cause:s});return s.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function Ni({pathname:e,routesById:t,processedTree:s}){const n=Object.create(null),r=Fe(e);let o;const i=Ka(r,s,!0);return i&&(o=i.route,Object.assign(n,i.rawParams)),{matchedRoutes:i?.branch||[t.__root__],routeParams:n,foundRoute:o}}function Ci({search:e,dest:t,destRoutes:s,_includeValidateSearch:n}){return _i(s)(e,t,n??!1)}function _i(e){let t,s;const n=[];for(const o of e){const i=o.options;if("search"in i)i.search?.middlewares&&n.push(...i.search.middlewares);else if(i.preSearchFilters||i.postSearchFilters){const l=({search:u,next:f})=>{const d=f(i.preSearchFilters?i.preSearchFilters.reduce((h,m)=>m(h),u):u);return i.postSearchFilters?i.postSearchFilters.reduce((h,m)=>m(h),d):d};n.push(l)}const c=i.validateSearch;if(c){const l=({search:u,next:f,meta:d})=>{const h=f(u);if(s)try{const m=us(c,h);if(d&&m)for(const p in m)p in h||(d.defaulted||=new Map).set(p,m[p]);return{...h,...m}}catch{}return h};n.push(l)}}const r=(o,i,c)=>{if(o>=n.length){if(!t.search)return{};if(t.search===!0)return i;const u=Ze(t.search,i);return c&&(c.explicit=u),u}const l=(u,f)=>{if(f){const d=c||{};return{search:r(o+1,u,d),meta:d}}return r(o+1,u,c)};return n[o]({search:i,next:l,meta:c})};return function(i,c,l){return t=c,s=l,r(0,i)}}function ki(e,t){if(e!=="root")for(let s=t.length-1;s>=0;s--){const n=t[s];if(n.children)return n.id}return rt}function nr(e,t){const s=e.options.params?.parse??e.options.parseParams;if(s){const n=s(t);if(n===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,n)}}function Ei(){try{return sessionStorage}catch{return}}const Pi="tsr-scroll-restoration-v1_3",io=Ei();function Ai(){try{return JSON.parse(io?.getItem("tsr-scroll-restoration-v1_3")||"{}")}catch{return{}}}function Ti(){try{io?.setItem(Pi,JSON.stringify(pt))}catch{process.env.NODE_ENV!=="production"&&console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}const pt=Ai(),rr="data-scroll-restoration-id",Oi=e=>e.state.__TSR_key||e.href;function Li(e){const t=e.getAttribute(rr);if(t)return`[${rr}="${t}"]`;let s="",n=e,r;for(;r=n.parentNode;){let o=1,i=n;for(;i=i.previousElementSibling;)o++;const c=`${n.localName}:nth-child(${o})`;s=s?`${c} > ${s}`:c,n=r}return s}let Qt=!1;const gt="window";function an(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function or(e){const t=[];for(const s of e){if(s===gt)continue;const n=an(s);n&&t.push(n)}return t}function Ii(e,t){const s=e.options.scrollRestoration,n=e._scroll;s&&(n.restoring=!0);const r=e.options.getScrollRestorationKey||Oi,o=new Map,i=(u,f,d)=>{const h=o.get(u)||{};h.scrollX=f,h.scrollY=d,o.set(u,h)},c=u=>{if(!(Qt||!n.restoring))if(u.target===document)i(gt,scrollX,scrollY);else{const f=u.target;i(f,f.scrollLeft,f.scrollTop)}},l=u=>{if(!n.restoring)return;const f=pt[u]||={};for(const[d,h]of o)d===gt?f[gt]=h:d.isConnected&&(f[Li(d)]=h)};s&&!n.restoration&&(n.restoration=!0,Qt=!1,history.scrollRestoration="manual",document.addEventListener("scroll",c,!0),e.subscribe("onBeforeLoad",u=>{u.fromLocation&&l(r(u.fromLocation)),o.clear()}),addEventListener("pagehide",()=>{l(r(e.stores.resolvedLocation.get()??e.stores.location.get())),Ti()})),!n.reset&&(n.reset=!0,e.subscribe("onRendered",u=>{const f=e.options.scrollRestorationBehavior,d=e.options.scrollToTopSelectors,h=n.next;let m;if(o.clear(),h||(n.next=!0),typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const p=r(u.toLocation),g=u.fromLocation&&r(u.fromLocation);if(n.restoring&&g&&g!==p){const b=pt[g];if(b){let x=pt[p];for(const y in b){if(y===gt){if(h)continue}else{const S=an(y);if(!S||h&&d&&(m??=or(d),m.includes(S)))continue}x||(x=pt[p]={}),x[y]??=b[y]}}}Qt=!0;try{const b=u.toLocation.hash,x=u.toLocation.state.__hashScrollIntoViewOptions??!0;let y=!1;if(h){const S=on.get(u.toLocation),N=b&&x&&(S==="PUSH"||S==="REPLACE"),C=n.restoring?pt[p]:void 0;if(C)for(const _ in C){const{scrollX:j,scrollY:w}=C[_];if(_===gt){if(N)continue;scrollTo({top:w,left:j,behavior:f}),y=!0}else{const P=an(_);P&&(P.scrollLeft=j,P.scrollTop=w)}}if(!y&&!b){const _={top:0,left:0,behavior:f};if(scrollTo(_),d){m??=or(d);for(const j of m)j.scrollTo(_)}}}!y&&b&&x&&document.getElementById(b)?.scrollIntoView(x)}finally{Qt=!1}}))}const Mi="Error preloading route! ☝️";var co=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=>{this.originalIndex=t.originalIndex;const s=this.options,n=!s?.path&&!s?.id;if(this.parentRoute=this.options.getParentRoute?.(),n)this._path=rt;else if(!this.parentRoute){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.");Ue()}let r=n?rt:s?.path;r&&r!=="/"&&(r=eo(r));const o=s?.id||r;let i=n?rt:ls([this.parentRoute.id==="__root__"?"":this.parentRoute.id,o]);r==="__root__"&&(r="/"),i!=="__root__"&&(i=ls(["/",i]));const c=i==="__root__"?"/":ls([this.parentRoute.fullPath,r]);this._path=r,this._id=i,this._fullPath=c,this._to=Fe(c)},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=>li({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}},Di=class extends co{constructor(e){super(e)}};function vn(e){const t=e.errorComponent??wn;return a.jsx(Fi,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:s,reset:n})=>s?$.createElement(t,{error:s,reset:n}):e.children})}var Fi=class extends $.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const s=e.getResetKey();return t.error&&t.resetKey!==s?{resetKey:s,error:null}:{resetKey:s}}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 wn({error:e}){const[t,s]=$.useState(process.env.NODE_ENV!=="production");return a.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[a.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),a.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>s(n=>!n),children:t?"Hide Error":"Show Error"})]}),a.jsx("div",{style:{height:".25rem"}}),t?a.jsx("div",{children:a.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?a.jsx("code",{children:e.message}):null})}):null]})}function Ui({children:e,fallback:t=null}){return lo()?a.jsx(E.Fragment,{children:e}):a.jsx(E.Fragment,{children:t})}function lo(){return E.useSyncExternalStore($i,()=>!0,()=>!1)}function $i(){return()=>{}}var uo=$.createContext(null);function _e(e){const t=$.useContext(uo);return process.env.NODE_ENV!=="production"&&(t||console.warn("Warning: useRouter must be used inside a <RouterProvider> component!")),t}var As=$.createContext(void 0),Bi=$.createContext(void 0),re=(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))(re||{});function zi({update:e,notify:t,unwatched:s}){return{link:n,unlink:r,propagate:o,checkDirty:i,shallowPropagate:c};function n(u,f,d){const h=f.depsTail;if(h!==void 0&&h.dep===u)return;const m=h!==void 0?h.nextDep:f.deps;if(m!==void 0&&m.dep===u){m.version=d,f.depsTail=m;return}const p=u.subsTail;if(p!==void 0&&p.version===d&&p.sub===f)return;const g=f.depsTail=u.subsTail={version:d,dep:u,sub:f,prevDep:h,nextDep:m,prevSub:p,nextSub:void 0};m!==void 0&&(m.prevDep=g),h!==void 0?h.nextDep=g:f.deps=g,p!==void 0?p.nextSub=g:u.subs=g}function r(u,f=u.sub){const d=u.dep,h=u.prevDep,m=u.nextDep,p=u.nextSub,g=u.prevSub;return m!==void 0?m.prevDep=h:f.depsTail=h,h!==void 0?h.nextDep=m:f.deps=m,p!==void 0?p.prevSub=g:d.subsTail=g,g!==void 0?g.nextSub=p:(d.subs=p)===void 0&&s(d),m}function o(u){let f=u.nextSub,d;e:do{const h=u.sub;let m=h.flags;if(m&60?m&12?m&4?!(m&48)&&l(u,h)?(h.flags=m|40,m&=1):m=0:h.flags=m&-9|32:m=0:h.flags=m|32,m&2&&t(h),m&1){const p=h.subs;if(p!==void 0){const g=(u=p).nextSub;g!==void 0&&(d={value:f,prev:d},f=g);continue}}if((u=f)!==void 0){f=u.nextSub;continue}for(;d!==void 0;)if(u=d.value,d=d.prev,u!==void 0){f=u.nextSub;continue e}break}while(!0)}function i(u,f){let d,h=0,m=!1;e:do{const p=u.dep,g=p.flags;if(f.flags&16)m=!0;else if((g&17)===17){if(e(p)){const b=p.subs;b.nextSub!==void 0&&c(b),m=!0}}else if((g&33)===33){(u.nextSub!==void 0||u.prevSub!==void 0)&&(d={value:u,prev:d}),u=p.deps,f=p,++h;continue}if(!m){const b=u.nextDep;if(b!==void 0){u=b;continue}}for(;h--;){const b=f.subs,x=b.nextSub!==void 0;if(x?(u=d.value,d=d.prev):u=b,m){if(e(f)){x&&c(b),f=u.sub;continue}m=!1}else f.flags&=-33;f=u.sub;const y=u.nextDep;if(y!==void 0){u=y;continue e}}return m}while(!0)}function c(u){do{const f=u.sub,d=f.flags;(d&48)===32&&(f.flags=d|16,(d&6)===2&&t(f))}while((u=u.nextSub)!==void 0)}function l(u,f){let d=f.depsTail;for(;d!==void 0;){if(d===u)return!0;d=d.prevDep}return!1}}function Vi(e,t,s){const n=typeof e=="object",r=n?e:void 0;return{next:(n?e.next:e)?.bind(r),error:(n?e.error:t)?.bind(r),complete:(n?e.complete:s)?.bind(r)}}const cn=[];let fs=0;const{link:ar,unlink:Wi,propagate:Hi,checkDirty:fo,shallowPropagate:ir}=zi({update(e){return e._update()},notify(e){cn[ln++]=e,e.flags&=~re.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=re.Mutable|re.Dirty,ws(e))}});let es=0,ln=0,Le,dn=0;function ho(e){try{++dn,e()}finally{--dn||mo()}}function ws(e){const t=e.depsTail;let s=t!==void 0?t.nextDep:e.deps;for(;s!==void 0;)s=Wi(s,e)}function mo(){if(!(dn>0)){for(;es<ln;){const e=cn[es];cn[es++]=void 0,e.notify()}es=0,ln=0}}function cr(e,t){const s=typeof e=="function",n=e,r={_snapshot:s?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:s?re.None:re.Mutable,get(){return Le!==void 0&&ar(r,Le,fs),r._snapshot},subscribe(o){const i=Vi(o),c={current:!1},l=qi(()=>{r.get(),c.current?i.next?.(r._snapshot):c.current=!0});return{unsubscribe:()=>{l.stop()}}},_update(o){const i=Le,c=t?.compare??Object.is;if(s)Le=r,++fs,r.depsTail=void 0;else if(o===void 0)return!1;s&&(r.flags=re.Mutable|re.RecursedCheck);try{const l=r._snapshot,u=typeof o=="function"?o(l):o===void 0&&s?n(l):o;return l===void 0||!c(l,u)?(r._snapshot=u,!0):!1}finally{Le=i,s&&(r.flags&=~re.RecursedCheck),ws(r)}}};return s?(r.flags=re.Mutable|re.Dirty,r.get=function(){const o=r.flags;if(o&re.Dirty||o&re.Pending&&fo(r.deps,r)){if(r._update()){const i=r.subs;i!==void 0&&ir(i)}}else o&re.Pending&&(r.flags=o&~re.Pending);return Le!==void 0&&ar(r,Le,fs),r._snapshot}):r.set=function(o){if(r._update(o)){const i=r.subs;i!==void 0&&(Hi(i),ir(i),mo())}},r}function qi(e){const t=()=>{const n=Le;Le=s,++fs,s.depsTail=void 0,s.flags=re.Watching|re.RecursedCheck;try{return e()}finally{Le=n,s.flags&=~re.RecursedCheck,ws(s)}},s={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:re.Watching|re.RecursedCheck,notify(){const n=this.flags;n&re.Dirty||n&re.Pending&&fo(this.deps,this)?t():this.flags=re.Watching},stop(){this.flags=re.None,this.depsTail=void 0,ws(this)}};return t(),s}var ts={exports:{}},Ws={},ss={exports:{}},Hs={};var lr;function Gi(){if(lr)return Hs;lr=1;var e=E;function t(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var s=typeof Object.is=="function"?Object.is:t,n=e.useState,r=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function c(d,h){var m=h(),p=n({inst:{value:m,getSnapshot:h}}),g=p[0].inst,b=p[1];return o(function(){g.value=m,g.getSnapshot=h,l(g)&&b({inst:g})},[d,m,h]),r(function(){return l(g)&&b({inst:g}),d(function(){l(g)&&b({inst:g})})},[d]),i(m),m}function l(d){var h=d.getSnapshot;d=d.value;try{var m=h();return!s(d,m)}catch{return!0}}function u(d,h){return h()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:c;return Hs.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Hs}var qs={};var dr;function Ki(){return dr||(dr=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}function t(m,p){f||r.startTransition===void 0||(f=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var g=p();if(!d){var b=p();o(g,b)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}b=i({inst:{value:g,getSnapshot:p}});var x=b[0].inst,y=b[1];return l(function(){x.value=g,x.getSnapshot=p,s(x)&&y({inst:x})},[m,g,p]),c(function(){return s(x)&&y({inst:x}),m(function(){s(x)&&y({inst:x})})},[m]),u(g),g}function s(m){var p=m.getSnapshot;m=m.value;try{var g=p();return!o(m,g)}catch{return!0}}function n(m,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=E,o=typeof Object.is=="function"?Object.is:e,i=r.useState,c=r.useEffect,l=r.useLayoutEffect,u=r.useDebugValue,f=!1,d=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;qs.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),qs}var ur;function po(){return ur||(ur=1,process.env.NODE_ENV==="production"?ss.exports=Gi():ss.exports=Ki()),ss.exports}var fr;function Yi(){if(fr)return Ws;fr=1;var e=E,t=po();function s(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var n=typeof Object.is=="function"?Object.is:s,r=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,c=e.useMemo,l=e.useDebugValue;return Ws.useSyncExternalStoreWithSelector=function(u,f,d,h,m){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=c(function(){function x(_){if(!y){if(y=!0,S=_,_=h(_),m!==void 0&&g.hasValue){var j=g.value;if(m(j,_))return N=j}return N=_}if(j=N,n(S,_))return j;var w=h(_);return m!==void 0&&m(j,w)?(S=_,j):(S=_,N=w)}var y=!1,S,N,C=d===void 0?null:d;return[function(){return x(f())},C===null?void 0:function(){return x(C())}]},[f,d,h,m]);var b=r(u,p[0],p[1]);return i(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},Ws}var Gs={};var hr;function Ji(){return hr||(hr=1,process.env.NODE_ENV!=="production"&&(function(){function e(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=E,s=po(),n=typeof Object.is=="function"?Object.is:e,r=s.useSyncExternalStore,o=t.useRef,i=t.useEffect,c=t.useMemo,l=t.useDebugValue;Gs.useSyncExternalStoreWithSelector=function(u,f,d,h,m){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=c(function(){function x(_){if(!y){if(y=!0,S=_,_=h(_),m!==void 0&&g.hasValue){var j=g.value;if(m(j,_))return N=j}return N=_}if(j=N,n(S,_))return j;var w=h(_);return m!==void 0&&m(j,w)?(S=_,j):(S=_,N=w)}var y=!1,S,N,C=d===void 0?null:d;return[function(){return x(f())},C===null?void 0:function(){return x(C())}]},[f,d,h,m]);var b=r(u,p[0],p[1]);return i(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Gs}var mr;function Xi(){return mr||(mr=1,process.env.NODE_ENV==="production"?ts.exports=Yi():ts.exports=Ji()),ts.exports}var Zi=Xi();function Qi(e,t){return e===t}function Re(e,t,s=Qi){const n=E.useCallback(i=>{if(!e)return()=>{};const{unsubscribe:c}=e.subscribe(i);return c},[e]),r=E.useCallback(()=>e?.get(),[e]);return Zi.useSyncExternalStoreWithSelector(n,r,r,t,s)}var Ks={get(){},subscribe(){return{unsubscribe(){}}}};function ec(e,t){const s=$.useRef();return n=>{const r=e?.select?e.select(n):n;return e?.structuralSharing??t.options.defaultStructuralSharing?s.current=Qe(s.current,r):r}}function ut(e){const t=_e(),s=$.useContext(e.from?Bi:As),n=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(s),r=ec(e,t),o=Re(n??Ks,i=>i?r(i):Ks);if(o!==Ks)return o;if(e.shouldThrow??!0){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`);Ue()}}function go(e){return ut({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function xo(e){const{select:t,...s}=e;return ut({...s,select:n=>t?t(n.loaderDeps):n.loaderDeps})}function bo(e){return ut({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const s=e.strict===!1?t.params:t._strictParams;return e.select?e.select(s):s}})}function yo(e){return ut({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function vo(e){const t=_e();return $.useCallback(s=>t.navigate({...s,from:s.from??e?.from}),[e?.from,t])}function wo(e){return ut({...e,select:t=>e.select?e.select(t.context):t.context})}function tc(e,t){const s=_e(),n=Ma(t),{activeProps:r,inactiveProps:o,activeOptions:i,to:c,preload:l,preloadDelay:u,preloadIntentProximity:f,hashScrollIntoView:d,replace:h,startTransition:m,resetScroll:p,viewTransition:g,children:b,target:x,disabled:y,style:S,className:N,onClick:C,onBlur:_,onFocus:j,onMouseEnter:w,onMouseLeave:P,onTouchStart:I,ignoreBlocker:k,params:T,search:Z,hash:z,state:J,mask:Y,reloadDocument:Q,unsafeRelative:he,from:me,_fromLocation:O,...R}=e,F=lo(),H=$.useMemo(()=>e,[s,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),G=Re(s.stores.location,ne=>ne,(ne,ve)=>ne.href===ve.href),W=$.useMemo(()=>{const ne={_fromLocation:G,...H};return s.buildLocation(ne)},[s,G,H]),U=W.maskedLocation?W.maskedLocation.publicHref:W.publicHref,D=W.maskedLocation?W.maskedLocation.external:W.external,X=$.useMemo(()=>ic(U,D,s.history,y),[y,D,U,s.history]),V=$.useMemo(()=>{if(X?.external){if(xs(X.href,s.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${X.href}`);return}return X.href}if(!cc(c)&&!(typeof c!="string"||c.indexOf(":")===-1))try{if(new URL(c),xs(c,s.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${c}`);return}return c}catch{}},[c,X,s.protocolAllowlist]),ie=$.useMemo(()=>{if(V)return!1;if(i?.exact){if(!ei(G.pathname,W.pathname,s.basepath))return!1}else{const ne=bs(G.pathname,s.basepath),ve=bs(W.pathname,s.basepath);if(!(ne.startsWith(ve)&&(ne.length===ve.length||ne[ve.length]==="/")))return!1}return(i?.includeSearch??!0)&&!nt(G.search,W.search,{partial:!i?.exact,ignoreUndefined:!i?.explicitUndefined})?!1:i?.includeHash?F&&G.hash===W.hash:!0},[i?.exact,i?.explicitUndefined,i?.includeHash,i?.includeSearch,G,V,F,W.hash,W.pathname,W.search,s.basepath]),le=ie?Ze(r,{})??sc:Ys,te=ie?Ys:Ze(o,{})??Ys,Ce=[N,le.className,te.className].filter(Boolean).join(" "),Ne=(S||le.style||te.style)&&{...S,...le.style,...te.style},[ke,B]=$.useState(!1),pe=$.useRef(!1),ye=e.reloadDocument||V?!1:l??s.options.defaultPreload,Ee=u??s.options.defaultPreloadDelay??0,Te=$.useCallback(()=>{s.preloadRoute({...H,_builtLocation:W}).catch(ne=>{console.warn(ne),console.warn(Mi)})},[s,H,W]);Ia(n,$.useCallback(ne=>{ne?.isIntersecting&&Te()},[Te]),ac,{disabled:!!y||ye!=="viewport"}),$.useEffect(()=>{pe.current||!y&&ye==="render"&&(Te(),pe.current=!0)},[y,Te,ye]);const Ms=ne=>{const ve=ne.currentTarget.getAttribute("target"),Ke=x!==void 0?x:ve;if(!y&&!lc(ne)&&!ne.defaultPrevented&&(!Ke||Ke==="_self")&&ne.button===0){ne.preventDefault(),Pa.flushSync(()=>{B(!0)});const Ea=s.subscribe("onResolved",()=>{Ea(),B(!1)});s.navigate({...H,replace:h,resetScroll:p,hashScrollIntoView:d,startTransition:m,viewTransition:g,ignoreBlocker:k})}};if(V)return{...R,ref:n,href:V,...b&&{children:b},...x&&{target:x},...y&&{disabled:y},...S&&{style:S},...N&&{className:N},...C&&{onClick:C},..._&&{onBlur:_},...j&&{onFocus:j},...w&&{onMouseEnter:w},...P&&{onMouseLeave:P},...I&&{onTouchStart:I}};const $e=ne=>{if(y||ye!=="intent")return;if(!Ee){Te();return}const ve=ne.currentTarget;if(Ot.has(ve))return;const Ke=setTimeout(()=>{Ot.delete(ve),Te()},Ee);Ot.set(ve,Ke)},ka=ne=>{y||ye!=="intent"||Te()},Ln=ne=>{if(y||!ye||!Ee)return;const ve=ne.currentTarget,Ke=Ot.get(ve);Ke&&(clearTimeout(Ke),Ot.delete(ve))};return{...R,...le,...te,href:X?.href,ref:n,onClick:ht([C,Ms]),onBlur:ht([_,Ln]),onFocus:ht([j,$e]),onMouseEnter:ht([w,$e]),onMouseLeave:ht([P,Ln]),onTouchStart:ht([I,ka]),disabled:!!y,target:x,...Ne&&{style:Ne},...Ce&&{className:Ce},...y&&nc,...ie&&rc,...F&&ke&&oc}}var Ys={},sc={className:"active"},nc={role:"link","aria-disabled":!0},rc={"data-status":"active","aria-current":"page"},oc={"data-transitioning":"transitioning"},Ot=new WeakMap,ac={rootMargin:"100px"},ht=e=>t=>{for(const s of e)if(s){if(t.defaultPrevented)return;s(t)}};function ic(e,t,s,n){if(!n)return t?{href:e,external:!0}:{href:s.createHref(e)||"/",external:!1}}function cc(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Ss=$.forwardRef((e,t)=>{const{_asChild:s,...n}=e,{type:r,...o}=tc(n,t),i=typeof n.children=="function"?n.children({isActive:o["data-status"]==="active"}):n.children;if(!s){const{disabled:c,...l}=o;return $.createElement("a",l,i)}return $.createElement(s,o,i)});function lc(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var dc=class extends co{constructor(e){super(e),this.useMatch=t=>ut({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>wo({...t,from:this.id}),this.useSearch=t=>yo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>bo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>xo({...t,from:this.id}),this.useLoaderData=t=>go({...t,from:this.id}),this.useNavigate=()=>vo({from:this.fullPath}),this.Link=E.forwardRef((t,s)=>a.jsx(Ss,{ref:s,from:this.fullPath,...t}))}};function Ht(e){return new dc(e)}var uc=class extends Di{constructor(e){super(e),this.useMatch=t=>ut({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>wo({...t,from:this.id}),this.useSearch=t=>yo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>bo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>xo({...t,from:this.id}),this.useLoaderData=t=>go({...t,from:this.id}),this.useNavigate=()=>vo({from:this.fullPath}),this.Link=E.forwardRef((t,s)=>a.jsx(Ss,{ref:s,from:this.fullPath,...t}))}};function fc(e){return new uc(e)}function hc(e){const t=_e(),s=`not-found-${Re(t.stores.location,n=>n.pathname)}-${Re(t.stores.status,n=>n)}`;return a.jsx(vn,{getResetKey:()=>s,onCatch:(n,r)=>{if(xe(n))e.onCatch?.(n,r);else throw n},errorComponent:({error:n})=>{if(xe(n))return e.fallback?.(n);throw n},children:e.children})}function mc(){return a.jsx("p",{children:"Not Found"})}function xt(e){return a.jsx(a.Fragment,{children:e.children})}function So(e,t,s){return t.options.notFoundComponent?a.jsx(t.options.notFoundComponent,{...s}):e.options.defaultNotFoundComponent?a.jsx(e.options.defaultNotFoundComponent,{...s}):(process.env.NODE_ENV!=="production"&&(t.options.notFoundComponent||console.warn(`Warning: A notFoundError was encountered on the route with ID "${t.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`)),a.jsx(mc,{}))}function pc(e){return null}function gc(){return pc(_e()),null}var xc=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,bc=(e,t)=>e[0]===t[0]&&e[1]===t[1],jo=$.memo(function({matchId:t}){const s=_e(),n=s.stores.matchStores.get(t);if(!n){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find match for matchId "${t}". Please file an issue!`);Ue()}const r=Re(s.stores.loadedAt,i=>i),o=Re(n,i=>i,xc);return a.jsx(yc,{router:s,matchId:t,resetKey:r,matchState:$.useMemo(()=>{const i=o.routeId,c=s.routesById[i].parentRoute?.id;return{routeId:i,ssr:o.ssr,_displayPending:o._displayPending,parentRouteId:c}},[o._displayPending,o.routeId,o.ssr,s.routesById])})});function yc({router:e,matchId:t,resetKey:s,matchState:n}){const r=e.routesById[n.routeId],o=r.options.pendingComponent??e.options.defaultPendingComponent,i=o?a.jsx(o,{}):null,c=r.options.errorComponent??e.options.defaultErrorComponent,l=r.options.onCatch??e.options.defaultOnCatch,u=r.isRoot?r.options.notFoundComponent??e.options.notFoundRoute?.options.component:r.options.notFoundComponent,f=n.ssr===!1||n.ssr==="data-only",d=(!r.isRoot||r.options.wrapInSuspense||f)&&(r.options.wrapInSuspense??o??(r.options.errorComponent?.preload||f))?$.Suspense:xt,h=c?vn:xt,m=u?hc:xt;return a.jsxs(r.isRoot?r.options.shellComponent??xt:xt,{children:[a.jsx(As.Provider,{value:t,children:a.jsx(d,{fallback:i,children:a.jsx(h,{getResetKey:()=>s,errorComponent:c||wn,onCatch:(p,g)=>{if(xe(p))throw p.routeId??=n.routeId,p;process.env.NODE_ENV!=="production"&&console.warn(`Warning: Error in route match: ${t}`),l?.(p,g)},children:a.jsx(m,{fallback:p=>{if(p.routeId??=n.routeId,!u||p.routeId&&p.routeId!==n.routeId||!p.routeId&&!r.isRoot)throw p;return $.createElement(u,p)},children:f||n._displayPending?a.jsx(Ui,{fallback:i,children:a.jsx(pr,{matchId:t})}):a.jsx(pr,{matchId:t})})})})}),n.parentRouteId===rt?a.jsxs(a.Fragment,{children:[a.jsx(vc,{}),e.options.scrollRestoration&&Gr?a.jsx(gc,{}):null]}):null]})}function vc(){const e=_e(),t=$.useRef();return Ft(()=>{const s=e.stores.resolvedLocation.get(),n=t.current;s&&(!n||n.href!==s.href)&&e.emit({type:"onRendered",...bt(e.stores.location.get(),n??s)}),t.current=s},[Re(e.stores.resolvedLocation,s=>s?.state.__TSR_key),e]),null}var pr=$.memo(function({matchId:t}){const s=_e(),n=(f,d)=>s.getMatch(f.id)?._nonReactive[d]??f._nonReactive[d],r=s.stores.matchStores.get(t);if(!r){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find match for matchId "${t}". Please file an issue!`);Ue()}const o=Re(r,f=>f),i=o.routeId,c=s.routesById[i],l=$.useMemo(()=>{const f=(s.routesById[i].options.remountDeps??s.options.defaultRemountDeps)?.({routeId:i,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch});return f?JSON.stringify(f):void 0},[i,o.loaderDeps,o._strictParams,o._strictSearch,s.options.defaultRemountDeps,s.routesById]),u=$.useMemo(()=>{const f=c.options.component??s.options.defaultComponent;return f?a.jsx(f,{},l):a.jsx(Ro,{})},[l,c.options.component,s.options.defaultComponent]);if(o._displayPending)throw n(o,"displayPendingPromise");if(o._forcePending)throw n(o,"minPendingPromise");if(o.status==="pending"){const f=c.options.pendingMinMs??s.options.defaultPendingMinMs;if(f){const d=s.getMatch(o.id);if(d&&!d._nonReactive.minPendingPromise){const h=yt();d._nonReactive.minPendingPromise=h,setTimeout(()=>{h.resolve(),d._nonReactive.minPendingPromise=void 0},f)}}throw n(o,"loadPromise")}if(o.status==="notFound"){if(!xe(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a notFound error");Ue()}return So(s,c,o.error)}if(o.status==="redirected"){if(!we(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a redirect error");Ue()}throw n(o,"loadPromise")}if(o.status==="error")throw o.error;return u}),Ro=$.memo(function(){const t=_e(),s=$.useContext(As);let n,r=!1,o;{const u=s?t.stores.matchStores.get(s):void 0;[n,r]=Re(u,f=>[f?.routeId,f?.globalNotFound??!1],bc),o=Re(t.stores.matchesId,f=>f[f.findIndex(d=>d===s)+1])}const i=n?t.routesById[n]:void 0,c=t.options.defaultPendingComponent?a.jsx(t.options.defaultPendingComponent,{}):null;if(r){if(!i){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not resolve route for Outlet render");Ue()}return So(t,i,void 0)}if(!o)return null;const l=a.jsx(jo,{matchId:o});return n===rt?a.jsx($.Suspense,{fallback:c,children:l}):l});function wc(){const e=_e(),t=$.useRef({router:e,mounted:!1}),[s,n]=$.useState(!1),r=Re(e.stores.isLoading,d=>d),o=Re(e.stores.hasPending,d=>d),i=Ds(r),c=r||s||o,l=Ds(c),u=r||o,f=Ds(u);return e.startTransition=d=>{n(!0),$.startTransition(()=>{d(),n(!1)})},$.useEffect(()=>{const d=e.history.subscribe(e.load),h=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Fe(e.latestLocation.publicHref)!==Fe(h.publicHref)&&e.commitLocation({...h,replace:!0}),()=>{d()}},[e,e.history]),Ft(()=>{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(h){console.error(h)}})()},[e]),Ft(()=>{i&&!r&&e.emit({type:"onLoad",...bt(e.stores.location.get(),e.stores.resolvedLocation.get())})},[i,e,r]),Ft(()=>{f&&!u&&e.emit({type:"onBeforeRouteMount",...bt(e.stores.location.get(),e.stores.resolvedLocation.get())})},[u,f,e]),Ft(()=>{if(l&&!c){const d=bt(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...d}),ho(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())})}},[c,l,e]),null}function Sc(){const e=_e(),t=e.routesById[rt].options.pendingComponent??e.options.defaultPendingComponent,s=t?a.jsx(t,{}):null,n=a.jsxs(typeof document<"u"&&e.ssr?xt:$.Suspense,{fallback:s,children:[a.jsx(wc,{}),a.jsx(jc,{})]});return e.options.InnerWrap?a.jsx(e.options.InnerWrap,{children:n}):n}function jc(){const e=_e(),t=Re(e.stores.firstId,r=>r),s=Re(e.stores.loadedAt,r=>r),n=t?a.jsx(jo,{matchId:t}):null;return a.jsx(As.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?n:a.jsx(vn,{getResetKey:()=>s,errorComponent:wn,onCatch:process.env.NODE_ENV!=="production"?r=>{console.warn("Warning: The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!"),console.warn(`Warning: ${r.message||r.toString()}`)}:void 0,children:n})})}var Rc=e=>({createMutableStore:cr,createReadonlyStore:cr,batch:ho}),No=e=>new Nc(e),Nc=class extends Si{constructor(e){super(e,Rc)}};function Cc({router:e,children:t,...s}){Yr(s)&&e.update({...e.options,...s,context:{...e.options.context,...s.context}});const n=a.jsx(uo.Provider,{value:e,children:t});return e.options.Wrap?a.jsx(e.options.Wrap,{children:n}):n}function _c({router:e,...t}){return a.jsx(Cc,{router:e,...t,children:a.jsx(Sc,{})})}function Co(e,t){return function(){return e.apply(t,arguments)}}const{toString:kc}=Object.prototype,{getPrototypeOf:vt}=Object,{iterator:qt,toStringTag:_o}=Symbol,js=(({hasOwnProperty:e})=>(t,s)=>e.call(t,s))(Object.prototype),Vt=(e,t)=>{let s=e;const n=[];for(;s!=null&&s!==Object.prototype;){if(n.indexOf(s)!==-1)return!1;if(n.push(s),js(s,t))return!0;s=vt(s)}return!1},Ec=(e,t)=>e!=null&&Vt(e,t)?e[t]:void 0,Sn=(e=>t=>{const s=kc.call(t);return e[s]||(e[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),Ae=e=>(e=e.toLowerCase(),t=>Sn(t)===e),Ts=e=>t=>typeof t===e,{isArray:ct}=Array,wt=Ts("undefined");function Rt(e){return e!==null&&!wt(e)&&e.constructor!==null&&!wt(e.constructor)&&Se(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ko=Ae("ArrayBuffer");function Pc(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ko(e.buffer),t}const Ac=Ts("string"),Se=Ts("function"),Eo=Ts("number"),Nt=e=>e!==null&&typeof e=="object",Tc=e=>e===!0||e===!1,hs=e=>{if(!Nt(e))return!1;const t=vt(e);return(t===null||t===Object.prototype||vt(t)===null)&&!Vt(e,_o)&&!Vt(e,qt)},Oc=e=>{if(!Nt(e)||Rt(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Lc=Ae("Date"),Ic=Ae("File"),Mc=e=>!!(e&&typeof e.uri<"u"),Dc=e=>e&&typeof e.getParts<"u",Fc=Ae("Blob"),Uc=Ae("FileList"),$c=e=>Nt(e)&&Se(e.pipe);function Bc(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const gr=Bc(),xr=typeof gr.FormData<"u"?gr.FormData:void 0,zc=e=>{if(!e)return!1;if(xr&&e instanceof xr)return!0;const t=vt(e);if(!t||t===Object.prototype||!Se(e.append))return!1;const s=Sn(e);return s==="formdata"||s==="object"&&Se(e.toString)&&e.toString()==="[object FormData]"},Vc=Ae("URLSearchParams"),[Wc,Hc,qc,Gc]=["ReadableStream","Request","Response","Headers"].map(Ae),Kc=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Gt(e,t,{allOwnKeys:s=!1}={}){if(e===null||typeof e>"u")return;let n,r;if(typeof e!="object"&&(e=[e]),ct(e))for(n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else{if(Rt(e))return;const o=s?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(n=0;n<i;n++)c=o[n],t.call(null,e[c],c,e)}}function Po(e,t){if(Rt(e))return null;t=t.toLowerCase();const s=Object.keys(e);let n=s.length,r;for(;n-- >0;)if(r=s[n],t===r.toLowerCase())return r;return null}const tt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ao=e=>!wt(e)&&e!==tt;function un(...e){const{caseless:t,skipUndefined:s}=Ao(this)&&this||{},n={},r=(o,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const c=t&&typeof i=="string"&&Po(n,i)||i,l=js(n,c)?n[c]:void 0;hs(l)&&hs(o)?n[c]=un(l,o):hs(o)?n[c]=un({},o):ct(o)?n[c]=o.slice():(!s||!wt(o))&&(n[c]=o)};for(let o=0,i=e.length;o<i;o++){const c=e[o];if(!c||Rt(c)||(Gt(c,r),typeof c!="object"||ct(c)))continue;const l=Object.getOwnPropertySymbols(c);for(let u=0;u<l.length;u++){const f=l[u];al.call(c,f)&&r(c[f],f)}}return n}const Yc=(e,t,s,{allOwnKeys:n}={})=>(Gt(t,(r,o)=>{s&&Se(r)?Object.defineProperty(e,o,{__proto__:null,value:Co(r,s),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),Jc=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Xc=(e,t,s,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),s&&Object.assign(e.prototype,s)},Zc=(e,t,s,n)=>{let r,o,i;const c={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),o=r.length;o-- >0;)i=r[o],(!n||n(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=s!==!1&&vt(e)}while(e&&(!s||s(e,t))&&e!==Object.prototype);return t},Qc=(e,t,s)=>{e=String(e),(s===void 0||s>e.length)&&(s=e.length),s-=t.length;const n=e.indexOf(t,s);return n!==-1&&n===s},el=e=>{if(!e)return null;if(ct(e))return e;let t=e.length;if(!Eo(t))return null;const s=new Array(t);for(;t-- >0;)s[t]=e[t];return s},tl=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&vt(Uint8Array)),sl=(e,t)=>{const n=(e&&e[qt]).call(e);let r;for(;(r=n.next())&&!r.done;){const o=r.value;t.call(e,o[0],o[1])}},nl=(e,t)=>{let s;const n=[];for(;(s=e.exec(t))!==null;)n.push(s);return n},rl=Ae("HTMLFormElement"),ol=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,n,r){return n.toUpperCase()+r}),{propertyIsEnumerable:al}=Object.prototype,il=Ae("RegExp"),To=(e,t)=>{const s=Object.getOwnPropertyDescriptors(e),n={};Gt(s,(r,o)=>{let i;(i=t(r,o,e))!==!1&&(n[o]=i||r)}),Object.defineProperties(e,n)},cl=e=>{To(e,(t,s)=>{if(Se(e)&&["arguments","caller","callee"].includes(s))return!1;const n=e[s];if(Se(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},ll=(e,t)=>{const s={},n=r=>{r.forEach(o=>{s[o]=!0})};return ct(e)?n(e):n(String(e).split(t)),s},dl=()=>{},ul=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function fl(e){return!!(e&&Se(e.append)&&e[_o]==="FormData"&&e[qt])}const hl=e=>{const t=new WeakSet,s=n=>{if(Nt(n)){if(t.has(n))return;if(Rt(n))return n;if(!("toJSON"in n)){t.add(n);const r=ct(n)?[]:{};return Gt(n,(o,i)=>{const c=s(o);!wt(c)&&(r[i]=c)}),t.delete(n),r}}return n};return s(e)},ml=Ae("AsyncFunction"),pl=e=>e&&(Nt(e)||Se(e))&&Se(e.then)&&Se(e.catch),Oo=((e,t)=>e?setImmediate:t?((s,n)=>(tt.addEventListener("message",({source:r,data:o})=>{r===tt&&o===s&&n.length&&n.shift()()},!1),r=>{n.push(r),tt.postMessage(s,"*")}))(`axios@${Math.random()}`,[]):s=>setTimeout(s))(typeof setImmediate=="function",Se(tt.postMessage)),gl=typeof queueMicrotask<"u"?queueMicrotask.bind(tt):typeof process<"u"&&process.nextTick||Oo,Lo=e=>e!=null&&Se(e[qt]),xl=e=>e!=null&&Vt(e,qt)&&Lo(e),v={isArray:ct,isArrayBuffer:ko,isBuffer:Rt,isFormData:zc,isArrayBufferView:Pc,isString:Ac,isNumber:Eo,isBoolean:Tc,isObject:Nt,isPlainObject:hs,isEmptyObject:Oc,isReadableStream:Wc,isRequest:Hc,isResponse:qc,isHeaders:Gc,isUndefined:wt,isDate:Lc,isFile:Ic,isReactNativeBlob:Mc,isReactNative:Dc,isBlob:Fc,isRegExp:il,isFunction:Se,isStream:$c,isURLSearchParams:Vc,isTypedArray:tl,isFileList:Uc,forEach:Gt,merge:un,extend:Yc,trim:Kc,stripBOM:Jc,inherits:Xc,toFlatObject:Zc,kindOf:Sn,kindOfTest:Ae,endsWith:Qc,toArray:el,forEachEntry:sl,matchAll:nl,isHTMLForm:rl,hasOwnProperty:js,hasOwnProp:js,hasOwnInPrototypeChain:Vt,getSafeProp:Ec,reduceDescriptors:To,freezeMethods:cl,toObjectSet:ll,toCamelCase:ol,noop:dl,toFiniteNumber:ul,findKey:Po,global:tt,isContextDefined:Ao,isSpecCompliantForm:fl,toJSONObject:hl,isAsyncFn:ml,isThenable:pl,setImmediate:Oo,asap:gl,isIterable:Lo,isSafeIterable:xl},bl=v.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),yl=e=>{const t={};let s,n,r;return e&&e.split(`
|
|
7
|
+
`).forEach(function(i){r=i.indexOf(":"),s=i.substring(0,r).trim().toLowerCase(),n=i.substring(r+1).trim(),!(!s||t[s]&&bl[s])&&(s==="set-cookie"?t[s]?t[s].push(n):t[s]=[n]:t[s]=t[s]?t[s]+", "+n:n)}),t};function vl(e){let t=0,s=e.length;for(;t<s;){const n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;s>t;){const n=e.charCodeAt(s-1);if(n!==9&&n!==32)break;s-=1}return t===0&&s===e.length?e:e.slice(t,s)}const wl=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Sl=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function jn(e,t){return v.isArray(e)?e.map(s=>jn(s,t)):vl(String(e).replace(t,""))}const jl=e=>jn(e,wl),Rl=e=>jn(e,Sl);function Io(e){const t=Object.create(null);return v.forEach(e.toJSON(),(s,n)=>{t[n]=Rl(s)}),t}const br=Symbol("internals");function Lt(e){return e&&String(e).trim().toLowerCase()}function ms(e){return e===!1||e==null?e:v.isArray(e)?e.map(ms):jl(String(e))}function Nl(e){const t=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=s.exec(e);)t[n[1]]=n[2];return t}const Cl=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Js(e,t,s,n,r){if(v.isFunction(n))return n.call(this,t,s);if(r&&(t=s),!!v.isString(t)){if(v.isString(n))return t.indexOf(n)!==-1;if(v.isRegExp(n))return n.test(t)}}function _l(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,s,n)=>s.toUpperCase()+n)}function kl(e,t){const s=v.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+s,{__proto__:null,value:function(r,o,i){return this[n].call(this,t,r,o,i)},configurable:!0})})}let be=class{constructor(t){t&&this.set(t)}set(t,s,n){const r=this;function o(c,l,u){const f=Lt(l);if(!f)return;const d=v.findKey(r,f);(!d||r[d]===void 0||u===!0||u===void 0&&r[d]!==!1)&&(r[d||l]=ms(c))}const i=(c,l)=>v.forEach(c,(u,f)=>o(u,f,l));if(v.isPlainObject(t)||t instanceof this.constructor)i(t,s);else if(v.isString(t)&&(t=t.trim())&&!Cl(t))i(yl(t),s);else if(v.isObject(t)&&v.isSafeIterable(t)){let c=Object.create(null),l,u;for(const f of t){if(!v.isArray(f))throw new TypeError("Object iterator must return a key-value pair");u=f[0],v.hasOwnProp(c,u)?(l=c[u],c[u]=v.isArray(l)?[...l,f[1]]:[l,f[1]]):c[u]=f[1]}i(c,s)}else t!=null&&o(s,t,n);return this}get(t,s){if(t=Lt(t),t){const n=v.findKey(this,t);if(n){const r=this[n];if(!s)return r;if(s===!0)return Nl(r);if(v.isFunction(s))return s.call(this,r,n);if(v.isRegExp(s))return s.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,s){if(t=Lt(t),t){const n=v.findKey(this,t);return!!(n&&this[n]!==void 0&&(!s||Js(this,this[n],n,s)))}return!1}delete(t,s){const n=this;let r=!1;function o(i){if(i=Lt(i),i){const c=v.findKey(n,i);c&&(!s||Js(n,n[c],c,s))&&(delete n[c],r=!0)}}return v.isArray(t)?t.forEach(o):o(t),r}clear(t){const s=Object.keys(this);let n=s.length,r=!1;for(;n--;){const o=s[n];(!t||Js(this,this[o],o,t,!0))&&(delete this[o],r=!0)}return r}normalize(t){const s=this,n={};return v.forEach(this,(r,o)=>{const i=v.findKey(n,o);if(i){s[i]=ms(r),delete s[o];return}const c=t?_l(o):String(o).trim();c!==o&&delete s[o],s[c]=ms(r),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const s=Object.create(null);return v.forEach(this,(n,r)=>{n!=null&&n!==!1&&(s[r]=t&&v.isArray(n)?n.join(", "):n)}),s}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,s])=>t+": "+s).join(`
|
|
8
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...s){const n=new this(t);return s.forEach(r=>n.set(r)),n}static accessor(t){const n=(this[br]=this[br]={accessors:{}}).accessors,r=this.prototype;function o(i){const c=Lt(i);n[c]||(kl(r,i),n[c]=!0)}return v.isArray(t)?t.forEach(o):o(t),this}};be.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);v.reduceDescriptors(be.prototype,({value:e},t)=>{let s=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[s]=n}}});v.freezeMethods(be);const El="[REDACTED ****]";function Pl(e){if(v.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(v.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Al(e,t){const s=new Set(t.map(o=>String(o).toLowerCase())),n=[],r=o=>{if(o===null||typeof o!="object"||v.isBuffer(o))return o;if(n.indexOf(o)!==-1)return;o instanceof be&&(o=o.toJSON()),n.push(o);let i;if(v.isArray(o))i=[],o.forEach((c,l)=>{const u=r(c);v.isUndefined(u)||(i[l]=u)});else{if(!v.isPlainObject(o)&&Pl(o))return n.pop(),o;i=Object.create(null);for(const[c,l]of Object.entries(o)){const u=s.has(c.toLowerCase())?El:r(l);v.isUndefined(u)||(i[c]=u)}}return n.pop(),i};return r(e)}let A=class Mo extends Error{static from(t,s,n,r,o,i){const c=new Mo(t.message,s||t.code,n,r,o);return Object.defineProperty(c,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),c.name=t.name,t.status!=null&&c.status==null&&(c.status=t.status),i&&Object.assign(c,i),c}constructor(t,s,n,r,o){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,s&&(this.code=s),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){const t=this.config,s=t&&v.hasOwnProp(t,"redact")?t.redact:void 0,n=v.isArray(s)&&s.length>0?Al(t,s):v.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}};A.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";A.ERR_BAD_OPTION="ERR_BAD_OPTION";A.ECONNABORTED="ECONNABORTED";A.ETIMEDOUT="ETIMEDOUT";A.ECONNREFUSED="ECONNREFUSED";A.ERR_NETWORK="ERR_NETWORK";A.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";A.ERR_DEPRECATED="ERR_DEPRECATED";A.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";A.ERR_BAD_REQUEST="ERR_BAD_REQUEST";A.ERR_CANCELED="ERR_CANCELED";A.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";A.ERR_INVALID_URL="ERR_INVALID_URL";A.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Tl=null,Do=100;function fn(e){return v.isPlainObject(e)||v.isArray(e)}function Fo(e){return v.endsWith(e,"[]")?e.slice(0,-2):e}function Xs(e,t,s){return e?e.concat(t).map(function(r,o){return r=Fo(r),!s&&o?"["+r+"]":r}).join(s?".":""):t}function Ol(e){return v.isArray(e)&&!e.some(fn)}const Ll=v.toFlatObject(v,{},null,function(t){return/^is[A-Z]/.test(t)});function Os(e,t,s){if(!v.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,s=v.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,S){return!v.isUndefined(S[y])});const n=s.metaTokens,r=s.visitor||p,o=s.dots,i=s.indexes,c=s.Blob||typeof Blob<"u"&&Blob,l=s.maxDepth===void 0?Do:s.maxDepth,u=c&&v.isSpecCompliantForm(t),f=[];if(!v.isFunction(r))throw new TypeError("visitor must be a function");function d(x){if(x===null)return"";if(v.isDate(x))return x.toISOString();if(v.isBoolean(x))return x.toString();if(!u&&v.isBlob(x))throw new A("Blob is not supported. Use a Buffer instead.");if(v.isArrayBuffer(x)||v.isTypedArray(x)){if(u&&typeof c=="function")return new c([x]);if(typeof Buffer<"u")return Buffer.from(x);throw new A("Blob is not supported. Use a Buffer instead.",A.ERR_NOT_SUPPORT)}return x}function h(x){if(x>l)throw new A("Object is too deeply nested ("+x+" levels). Max depth: "+l,A.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(x,y){if(l===1/0)return JSON.stringify(x);const S=[];return JSON.stringify(x,function(C,_){if(!v.isObject(_))return _;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(_),h(y+S.length-1),_})}function p(x,y,S){let N=x;if(v.isReactNative(t)&&v.isReactNativeBlob(x))return t.append(Xs(S,y,o),d(x)),!1;if(x&&!S&&typeof x=="object"){if(v.endsWith(y,"{}"))y=n?y:y.slice(0,-2),x=m(x,1);else if(v.isArray(x)&&Ol(x)||(v.isFileList(x)||v.endsWith(y,"[]"))&&(N=v.toArray(x)))return y=Fo(y),N.forEach(function(_,j){!(v.isUndefined(_)||_===null)&&t.append(i===!0?Xs([y],j,o):i===null?y:y+"[]",d(_))}),!1}return fn(x)?!0:(t.append(Xs(S,y,o),d(x)),!1)}const g=Object.assign(Ll,{defaultVisitor:p,convertValue:d,isVisitable:fn});function b(x,y,S=0){if(!v.isUndefined(x)){if(h(S),f.indexOf(x)!==-1)throw new Error("Circular reference detected in "+y.join("."));f.push(x),v.forEach(x,function(C,_){(!(v.isUndefined(C)||C===null)&&r.call(t,C,v.isString(_)?_.trim():_,y,g))===!0&&b(C,y?y.concat(_):[_],S+1)}),f.pop()}}if(!v.isObject(e))throw new TypeError("data must be an object");return b(e),t}function yr(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function Rn(e,t){this._pairs=[],e&&Os(e,this,t)}const Uo=Rn.prototype;Uo.append=function(t,s){this._pairs.push([t,s])};Uo.toString=function(t){const s=t?n=>t.call(this,n,yr):yr;return this._pairs.map(function(r){return s(r[0])+"="+s(r[1])},"").join("&")};function Il(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function $o(e,t,s){if(!t)return e;e=e||"";const n=v.isFunction(s)?{serialize:s}:s,r=v.getSafeProp(n,"encode")||Il,o=v.getSafeProp(n,"serialize");let i;if(o?i=o(t,n):i=v.isURLSearchParams(t)?t.toString():new Rn(t,n).toString(r),i){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class vr{constructor(){this.handlers=[]}use(t,s,n){return this.handlers.push({fulfilled:t,rejected:s,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){v.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Nn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Ml=typeof URLSearchParams<"u"?URLSearchParams:Rn,Dl=typeof FormData<"u"?FormData:null,Fl=typeof Blob<"u"?Blob:null,Ul={isBrowser:!0,classes:{URLSearchParams:Ml,FormData:Dl,Blob:Fl},protocols:["http","https","file","blob","url","data"]},Cn=typeof window<"u"&&typeof document<"u",hn=typeof navigator=="object"&&navigator||void 0,$l=Cn&&(!hn||["ReactNative","NativeScript","NS"].indexOf(hn.product)<0),Bl=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",zl=Cn&&window.location.href||"http://localhost",Vl=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Cn,hasStandardBrowserEnv:$l,hasStandardBrowserWebWorkerEnv:Bl,navigator:hn,origin:zl},Symbol.toStringTag,{value:"Module"})),fe={...Vl,...Ul};function Wl(e,t){return Os(e,new fe.classes.URLSearchParams,{visitor:function(s,n,r,o){return fe.isNode&&v.isBuffer(s)?(this.append(n,s.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}const wr=Do;function Bo(e){if(e>wr)throw new A("FormData field is too deeply nested ("+e+" levels). Max depth: "+wr,A.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Hl(e){const t=[],s=/\w+|\[(\w*)]/g;let n;for(;(n=s.exec(e))!==null;)Bo(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function ql(e){const t={},s=Object.keys(e);let n;const r=s.length;let o;for(n=0;n<r;n++)o=s[n],t[o]=e[o];return t}function zo(e){function t(s,n,r,o){Bo(o);let i=s[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),l=o>=s.length;return i=!i&&v.isArray(r)?r.length:i,l?(v.hasOwnProp(r,i)?r[i]=v.isArray(r[i])?r[i].concat(n):[r[i],n]:r[i]=n,!c):((!v.hasOwnProp(r,i)||!v.isObject(r[i]))&&(r[i]=[]),t(s,n,r[i],o)&&v.isArray(r[i])&&(r[i]=ql(r[i])),!c)}if(v.isFormData(e)&&v.isFunction(e.entries)){const s={};return v.forEachEntry(e,(n,r)=>{t(Hl(n),r,s,0)}),s}return null}const mt=(e,t)=>e!=null&&v.hasOwnProp(e,t)?e[t]:void 0;function Gl(e,t,s){if(v.isString(e))try{return(t||JSON.parse)(e),v.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(s||JSON.stringify)(e)}const Kt={transitional:Nn,adapter:["xhr","http","fetch"],transformRequest:[function(t,s){const n=s.getContentType()||"",r=n.indexOf("application/json")>-1,o=v.isObject(t);if(o&&v.isHTMLForm(t)&&(t=new FormData(t)),v.isFormData(t))return r?JSON.stringify(zo(t)):t;if(v.isArrayBuffer(t)||v.isBuffer(t)||v.isStream(t)||v.isFile(t)||v.isBlob(t)||v.isReadableStream(t))return t;if(v.isArrayBufferView(t))return t.buffer;if(v.isURLSearchParams(t))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){const l=mt(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return Wl(t,l).toString();if((c=v.isFileList(t))||n.indexOf("multipart/form-data")>-1){const u=mt(this,"env"),f=u&&u.FormData;return Os(c?{"files[]":t}:t,f&&new f,l)}}return o||r?(s.setContentType("application/json",!1),Gl(t)):t}],transformResponse:[function(t){const s=mt(this,"transitional")||Kt.transitional,n=s&&s.forcedJSONParsing,r=mt(this,"responseType"),o=r==="json";if(v.isResponse(t)||v.isReadableStream(t))return t;if(t&&v.isString(t)&&(n&&!r||o)){const c=!(s&&s.silentJSONParsing)&&o;try{return JSON.parse(t,mt(this,"parseReviver"))}catch(l){if(c)throw l.name==="SyntaxError"?A.from(l,A.ERR_BAD_RESPONSE,this,null,mt(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:fe.classes.FormData,Blob:fe.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};v.forEach(["delete","get","head","post","put","patch","query"],e=>{Kt.headers[e]={}});function Zs(e,t){const s=this||Kt,n=t||s,r=be.from(n.headers);let o=n.data;return v.forEach(e,function(c){o=c.call(s,o,r.normalize(),t?t.status:void 0)}),r.normalize(),o}function Vo(e){return!!(e&&e.__CANCEL__)}let Yt=class extends A{constructor(t,s,n){super(t??"canceled",A.ERR_CANCELED,s,n),this.name="CanceledError",this.__CANCEL__=!0}};function Wo(e,t,s){const n=s.config.validateStatus;!s.status||!n||n(s.status)?e(s):t(new A("Request failed with status code "+s.status,s.status>=400&&s.status<500?A.ERR_BAD_REQUEST:A.ERR_BAD_RESPONSE,s.config,s.request,s))}function Kl(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Yl(e,t){e=e||10;const s=new Array(e),n=new Array(e);let r=0,o=0,i;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),f=n[o];i||(i=u),s[r]=l,n[r]=u;let d=o,h=0;for(;d!==r;)h+=s[d++],d=d%e;if(r=(r+1)%e,r===o&&(o=(o+1)%e),u-i<t)return;const m=f&&u-f;return m?Math.round(h*1e3/m):void 0}}function Jl(e,t){let s=0,n=1e3/t,r,o;const i=(u,f=Date.now())=>{s=f,r=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const f=Date.now(),d=f-s;d>=n?i(u,f):(r=u,o||(o=setTimeout(()=>{o=null,i(r)},n-d)))},()=>r&&i(r)]}const Rs=(e,t,s=3)=>{let n=0;const r=Yl(50,250);return Jl(o=>{if(!o||typeof o.loaded!="number")return;const i=o.loaded,c=o.lengthComputable?o.total:void 0,l=c!=null?Math.min(i,c):i,u=Math.max(0,l-n),f=r(u);n=Math.max(n,l);const d={loaded:l,total:c,progress:c?l/c:void 0,bytes:u,rate:f||void 0,estimated:f&&c?(c-l)/f:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(d)},s)},Sr=(e,t)=>{const s=e!=null;return[n=>t[0]({lengthComputable:s,total:e,loaded:n}),t[1]]},jr=e=>(...t)=>v.asap(()=>e(...t)),Xl=fe.hasStandardBrowserEnv?((e,t)=>s=>(s=new URL(s,fe.origin),e.protocol===s.protocol&&e.host===s.host&&(t||e.port===s.port)))(new URL(fe.origin),fe.navigator&&/(msie|trident)/i.test(fe.navigator.userAgent)):()=>!0,Zl=fe.hasStandardBrowserEnv?{write(e,t,s,n,r,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];v.isNumber(s)&&c.push(`expires=${new Date(s).toUTCString()}`),v.isString(n)&&c.push(`path=${n}`),v.isString(r)&&c.push(`domain=${r}`),o===!0&&c.push("secure"),v.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let s=0;s<t.length;s++){const n=t[s].replace(/^\s+/,""),r=n.indexOf("=");if(r!==-1&&n.slice(0,r)===e)try{return decodeURIComponent(n.slice(r+1))}catch{return n.slice(r+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ql(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ed(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const td=/^https?:(?!\/\/)/i,sd=/[\t\n\r]/g;function nd(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function rd(e){return nd(e).replace(sd,"")}function Rr(e,t){if(typeof e=="string"&&td.test(rd(e)))throw new A('Invalid URL: missing "//" after protocol',A.ERR_INVALID_URL,t)}function Ho(e,t,s,n){Rr(t,n);let r=!Ql(t);return e&&(r||s===!1)?(Rr(e,n),ed(e,t)):t}const Nr=e=>e instanceof be?{...e}:e;function lt(e,t){e=e||{},t=t||{};const s=Object.create(null);Object.defineProperty(s,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(f,d,h,m){return v.isPlainObject(f)&&v.isPlainObject(d)?v.merge.call({caseless:m},f,d):v.isPlainObject(d)?v.merge({},d):v.isArray(d)?d.slice():d}function r(f,d,h,m){if(v.isUndefined(d)){if(!v.isUndefined(f))return n(void 0,f,h,m)}else return n(f,d,h,m)}function o(f,d){if(!v.isUndefined(d))return n(void 0,d)}function i(f,d){if(v.isUndefined(d)){if(!v.isUndefined(f))return n(void 0,f)}else return n(void 0,d)}function c(f){const d=v.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!v.isUndefined(d))if(v.isPlainObject(d)){if(v.hasOwnProp(d,f))return d[f]}else return;const h=v.hasOwnProp(e,"transitional")?e.transitional:void 0;if(v.isPlainObject(h)&&v.hasOwnProp(h,f))return h[f]}function l(f,d,h){if(v.hasOwnProp(t,h))return n(f,d);if(v.hasOwnProp(e,h))return n(void 0,f)}const u={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,allowedSocketPaths:i,responseEncoding:i,validateStatus:l,headers:(f,d,h)=>r(Nr(f),Nr(d),h,!0)};return v.forEach(Object.keys({...e,...t}),function(d){if(d==="__proto__"||d==="constructor"||d==="prototype")return;const h=v.hasOwnProp(u,d)?u[d]:r,m=v.hasOwnProp(e,d)?e[d]:void 0,p=v.hasOwnProp(t,d)?t[d]:void 0,g=h(m,p,d);v.isUndefined(g)&&h!==l||(s[d]=g)}),v.hasOwnProp(t,"validateStatus")&&v.isUndefined(t.validateStatus)&&c("validateStatusUndefinedResolves")===!1&&(v.hasOwnProp(e,"validateStatus")?s.validateStatus=n(void 0,e.validateStatus):delete s.validateStatus),s}const od=["content-type","content-length"];function ad(e,t,s){if(s!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([n,r])=>{od.includes(n.toLowerCase())&&e.set(n,r)})}const id=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,s)=>String.fromCharCode(parseInt(s,16)));function qo(e){const t=lt({},e),s=h=>v.hasOwnProp(t,h)?t[h]:void 0,n=s("data");let r=s("withXSRFToken");const o=s("xsrfHeaderName"),i=s("xsrfCookieName");let c=s("headers");const l=s("auth"),u=s("baseURL"),f=s("allowAbsoluteUrls"),d=s("url");if(t.headers=c=be.from(c),t.url=$o(Ho(u,d,f,t),s("params"),s("paramsSerializer")),l){const h=v.getSafeProp(l,"username")||"",m=v.getSafeProp(l,"password")||"";try{c.set("Authorization","Basic "+btoa(h+":"+(m?id(m):"")))}catch(p){throw A.from(p,A.ERR_BAD_OPTION_VALUE,e)}}if(v.isFormData(n)&&(fe.hasStandardBrowserEnv||fe.hasStandardBrowserWebWorkerEnv||v.isReactNative(n)?c.setContentType(void 0):v.isFunction(n.getHeaders)&&ad(c,n.getHeaders(),s("formDataHeaderPolicy"))),fe.hasStandardBrowserEnv&&(v.isFunction(r)&&(r=r(t)),r===!0||r==null&&Xl(t.url))){const m=o&&i&&Zl.read(i);m&&c.set(o,m)}return t}const cd=typeof XMLHttpRequest<"u",ld=cd&&function(e){return new Promise(function(s,n){const r=qo(e);let o=r.data;const i=be.from(r.headers).normalize();let{responseType:c,onUploadProgress:l,onDownloadProgress:u}=r,f,d,h,m,p;function g(){m&&m(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(f),r.signal&&r.signal.removeEventListener("abort",f)}let b=new XMLHttpRequest;b.open(r.method.toUpperCase(),r.url,!0),b.timeout=r.timeout;function x(){if(!b)return;const S=be.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),C={data:!c||c==="text"||c==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:S,config:e,request:b};Wo(function(j){s(j),g()},function(j){n(j),g()},C),b=null}"onloadend"in b?b.onloadend=x:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.startsWith("file:"))||setTimeout(x)},b.onabort=function(){b&&(n(new A("Request aborted",A.ECONNABORTED,e,b)),g(),b=null)},b.onerror=function(N){const C=N&&N.message?N.message:"Network Error",_=new A(C,A.ERR_NETWORK,e,b);_.event=N||null,n(_),g(),b=null},b.ontimeout=function(){let N=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const C=r.transitional||Nn;r.timeoutErrorMessage&&(N=r.timeoutErrorMessage),n(new A(N,C.clarifyTimeoutError?A.ETIMEDOUT:A.ECONNABORTED,e,b)),g(),b=null},o===void 0&&i.setContentType(null),"setRequestHeader"in b&&v.forEach(Io(i),function(N,C){b.setRequestHeader(C,N)}),v.isUndefined(r.withCredentials)||(b.withCredentials=!!r.withCredentials),c&&c!=="json"&&(b.responseType=r.responseType),u&&([h,p]=Rs(u,!0),b.addEventListener("progress",h)),l&&b.upload&&([d,m]=Rs(l),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",m)),(r.cancelToken||r.signal)&&(f=S=>{b&&(n(!S||S.type?new Yt(null,e,b):S),b.abort(),g(),b=null)},r.cancelToken&&r.cancelToken.subscribe(f),r.signal&&(r.signal.aborted?f():r.signal.addEventListener("abort",f)));const y=Kl(r.url);if(y&&!fe.protocols.includes(y)){n(new A("Unsupported protocol "+y+":",A.ERR_BAD_REQUEST,e)),g();return}b.send(o||null)})},dd=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const s=new AbortController;let n=!1;const r=function(l){if(!n){n=!0,i();const u=l instanceof Error?l:this.reason;s.abort(u instanceof A?u:new Yt(u instanceof Error?u.message:u))}};let o=t&&setTimeout(()=>{o=null,r(new A(`timeout of ${t}ms exceeded`,A.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(r):l.removeEventListener("abort",r)}),e=null)};e.forEach(l=>l.addEventListener("abort",r,{once:!0}));const{signal:c}=s;return c.unsubscribe=()=>v.asap(i),c},ud=function*(e,t){let s=e.byteLength;if(s<t){yield e;return}let n=0,r;for(;n<s;)r=n+t,yield e.slice(n,r),n=r},fd=async function*(e,t){for await(const s of hd(e))yield*ud(s,t)},hd=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:s,value:n}=await t.read();if(s)break;yield n}}finally{await t.cancel()}},Cr=(e,t,s,n)=>{const r=fd(e,t);let o=0,i,c=l=>{i||(i=!0,n&&n(l))};return new ReadableStream({async pull(l){try{const{done:u,value:f}=await r.next();if(u){c(),l.close();return}let d=f.byteLength;if(s){let h=o+=d;s(h)}l.enqueue(new Uint8Array(f))}catch(u){throw c(u),u}},cancel(l){return c(l),r.return()}},{highWaterMark:2})},Ns=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,md=(e,t,s)=>t+2<s&&Ns(e.charCodeAt(t+1))&&Ns(e.charCodeAt(t+2));function pd(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const s=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(s)){let i=n.length;const c=n.length;for(let m=0;m<c;m++)if(n.charCodeAt(m)===37&&m+2<c){const p=n.charCodeAt(m+1),g=n.charCodeAt(m+2);Ns(p)&&Ns(g)&&(i-=2,m+=2)}let l=0,u=c-1;const f=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);u>=0&&(n.charCodeAt(u)===61?(l++,u--):f(u)&&(l++,u-=3)),l===1&&u>=0&&(n.charCodeAt(u)===61||f(u))&&l++;const h=Math.floor(i/4)*3-(l||0);return h>0?h:0}let o=0;for(let i=0,c=n.length;i<c;i++){const l=n.charCodeAt(i);if(l===37&&md(n,i,c))o+=1,i+=2;else if(l<128)o+=1;else if(l<2048)o+=2;else if(l>=55296&&l<=56319&&i+1<c){const u=n.charCodeAt(i+1);u>=56320&&u<=57343?(o+=4,i++):o+=3}else o+=3}return o}const _n="1.18.1",_r=64*1024,{isFunction:ns}=v,gd=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,s)=>String.fromCharCode(parseInt(s,16))),kr=e=>{if(!v.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Er=(e,...t)=>{try{return!!e(...t)}catch{return!1}},xd=e=>{const t=e.indexOf("://");let s=e;return t!==-1&&(s=s.slice(t+3)),s.includes("@")||s.includes(":")},bd=e=>{const t=v.global!==void 0&&v.global!==null?v.global:globalThis,{ReadableStream:s,TextEncoder:n}=t;e=v.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:r,Request:o,Response:i}=e,c=r?ns(r):typeof fetch=="function",l=ns(o),u=ns(i);if(!c)return!1;const f=c&&ns(s),d=c&&(typeof n=="function"?(x=>y=>x.encode(y))(new n):async x=>new Uint8Array(await new o(x).arrayBuffer())),h=l&&f&&Er(()=>{let x=!1;const y=new o(fe.origin,{body:new s,method:"POST",get duplex(){return x=!0,"half"}}),S=y.headers.has("Content-Type");return y.body!=null&&y.body.cancel(),x&&!S}),m=u&&f&&Er(()=>v.isReadableStream(new i("").body)),p={stream:m&&(x=>x.body)};c&&["text","arrayBuffer","blob","formData","stream"].forEach(x=>{!p[x]&&(p[x]=(y,S)=>{let N=y&&y[x];if(N)return N.call(y);throw new A(`Response type '${x}' is not supported`,A.ERR_NOT_SUPPORT,S)})});const g=async x=>{if(x==null)return 0;if(v.isBlob(x))return x.size;if(v.isSpecCompliantForm(x))return(await new o(fe.origin,{method:"POST",body:x}).arrayBuffer()).byteLength;if(v.isArrayBufferView(x)||v.isArrayBuffer(x))return x.byteLength;if(v.isURLSearchParams(x)&&(x=x+""),v.isString(x))return(await d(x)).byteLength},b=async(x,y)=>{const S=v.toFiniteNumber(x.getContentLength());return S??g(y)};return async x=>{let{url:y,method:S,data:N,signal:C,cancelToken:_,timeout:j,onDownloadProgress:w,onUploadProgress:P,responseType:I,headers:k,withCredentials:T="same-origin",fetchOptions:Z,maxContentLength:z,maxBodyLength:J}=qo(x);const Y=v.isNumber(z)&&z>-1,Q=v.isNumber(J)&&J>-1,he=U=>v.hasOwnProp(x,U)?x[U]:void 0;let me=r||fetch;I=I?(I+"").toLowerCase():"text";let O=dd([C,_&&_.toAbortSignal()],j),R=null;const F=O&&O.unsubscribe&&(()=>{O.unsubscribe()});let H,G=null;const W=()=>new A("Request body larger than maxBodyLength limit",A.ERR_BAD_REQUEST,x,R);try{let U;const D=he("auth");if(D){const B=v.getSafeProp(D,"username")||"",pe=v.getSafeProp(D,"password")||"";U={username:B,password:pe}}if(xd(y)){const B=new URL(y,fe.origin);if(!U&&(B.username||B.password)){const pe=kr(B.username),ye=kr(B.password);U={username:pe,password:ye}}(B.username||B.password)&&(B.username="",B.password="",y=B.href)}if(U&&(k.delete("authorization"),k.set("Authorization","Basic "+btoa(gd((U.username||"")+":"+(U.password||""))))),Y&&typeof y=="string"&&y.startsWith("data:")&&pd(y)>z)throw new A("maxContentLength size of "+z+" exceeded",A.ERR_BAD_RESPONSE,x,R);if(Q&&S!=="get"&&S!=="head"){const B=await g(N);if(typeof B=="number"&&isFinite(B)&&(H=B,B>J))throw W()}const X=Q&&(v.isReadableStream(N)||v.isStream(N)),V=(B,pe,ye)=>Cr(B,_r,Ee=>{if(Q&&Ee>J)throw G=W();pe&&pe(Ee)},ye);if(h&&S!=="get"&&S!=="head"&&(P||X)){if(H=H??await b(k,N),H!==0||X){let B=new o(y,{method:"POST",body:N,duplex:"half"}),pe;if(v.isFormData(N)&&(pe=B.headers.get("content-type"))&&k.setContentType(pe),B.body){const[ye,Ee]=P&&Sr(H,Rs(jr(P)))||[];N=V(B.body,ye,Ee)}}}else if(X&&!l&&f&&S!=="get"&&S!=="head")N=V(N);else if(X&&l&&!h&&S!=="get"&&S!=="head")throw new A("Stream request bodies are not supported by the current fetch implementation",A.ERR_NOT_SUPPORT,x,R);v.isString(T)||(T=T?"include":"omit");const ie=l&&"credentials"in o.prototype;if(v.isFormData(N)){const B=k.getContentType();B&&/^multipart\/form-data/i.test(B)&&!/boundary=/i.test(B)&&k.delete("content-type")}k.set("User-Agent","axios/"+_n,!1);const le={...Z,signal:O,method:S.toUpperCase(),headers:Io(k.normalize()),body:N,duplex:"half",credentials:ie?T:void 0};R=l&&new o(y,le);let te=await(l?me(R,Z):me(y,le));const Ce=be.from(te.headers);if(Y){const B=v.toFiniteNumber(Ce.getContentLength());if(B!=null&&B>z)throw new A("maxContentLength size of "+z+" exceeded",A.ERR_BAD_RESPONSE,x,R)}const Ne=m&&(I==="stream"||I==="response");if(m&&te.body&&(w||Y||Ne&&F)){const B={};["status","statusText","headers"].forEach($e=>{B[$e]=te[$e]});const pe=v.toFiniteNumber(Ce.getContentLength()),[ye,Ee]=w&&Sr(pe,Rs(jr(w),!0))||[];let Te=0;const Ms=$e=>{if(Y&&(Te=$e,Te>z))throw new A("maxContentLength size of "+z+" exceeded",A.ERR_BAD_RESPONSE,x,R);ye&&ye($e)};te=new i(Cr(te.body,_r,Ms,()=>{Ee&&Ee(),F&&F()}),B)}I=I||"text";let ke=await p[v.findKey(p,I)||"text"](te,x);if(Y&&!m&&!Ne){let B;if(ke!=null&&(typeof ke.byteLength=="number"?B=ke.byteLength:typeof ke.size=="number"?B=ke.size:typeof ke=="string"&&(B=typeof n=="function"?new n().encode(ke).byteLength:ke.length)),typeof B=="number"&&B>z)throw new A("maxContentLength size of "+z+" exceeded",A.ERR_BAD_RESPONSE,x,R)}return!Ne&&F&&F(),await new Promise((B,pe)=>{Wo(B,pe,{data:ke,headers:be.from(te.headers),status:te.status,statusText:te.statusText,config:x,request:R})})}catch(U){if(F&&F(),O&&O.aborted&&O.reason instanceof A){const D=O.reason;throw D.config=x,R&&(D.request=R),U!==D&&Object.defineProperty(D,"cause",{__proto__:null,value:U,writable:!0,enumerable:!1,configurable:!0}),D}if(G)throw R&&!G.request&&(G.request=R),G;if(U instanceof A)throw R&&!U.request&&(U.request=R),U;if(U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)){const D=new A("Network Error",A.ERR_NETWORK,x,R,U&&U.response);throw Object.defineProperty(D,"cause",{__proto__:null,value:U.cause||U,writable:!0,enumerable:!1,configurable:!0}),D}throw A.from(U,U&&U.code,x,R,U&&U.response)}}},yd=new Map,Go=e=>{let t=e&&e.env||{};const{fetch:s,Request:n,Response:r}=t,o=[n,r,s];let i=o.length,c=i,l,u,f=yd;for(;c--;)l=o[c],u=f.get(l),u===void 0&&f.set(l,u=c?new Map:bd(t)),f=u;return u};Go();const kn={http:Tl,xhr:ld,fetch:{get:Go}};v.forEach(kn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Pr=e=>`- ${e}`,vd=e=>v.isFunction(e)||e===null||e===!1;function wd(e,t){e=v.isArray(e)?e:[e];const{length:s}=e;let n,r;const o={};for(let i=0;i<s;i++){n=e[i];let c;if(r=n,!vd(n)&&(r=kn[(c=String(n)).toLowerCase()],r===void 0))throw new A(`Unknown adapter '${c}'`);if(r&&(v.isFunction(r)||(r=r.get(t))))break;o[c||"#"+i]=r}if(!r){const i=Object.entries(o).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let c=s?i.length>1?`since :
|
|
9
|
+
`+i.map(Pr).join(`
|
|
10
|
+
`):" "+Pr(i[0]):"as no adapter specified";throw new A("There is no suitable adapter to dispatch the request "+c,A.ERR_NOT_SUPPORT)}return r}const Ko={getAdapter:wd,adapters:kn};function Qs(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Yt(null,e)}function Ar(e){return Qs(e),e.headers=be.from(e.headers),e.data=Zs.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ko.getAdapter(e.adapter||Kt.adapter,e)(e).then(function(n){Qs(e),e.response=n;try{n.data=Zs.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=be.from(n.headers),n},function(n){if(!Vo(n)&&(Qs(e),n&&n.response)){e.response=n.response;try{n.response.data=Zs.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=be.from(n.response.headers)}return Promise.reject(n)})}const Ls={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ls[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Tr={};Ls.transitional=function(t,s,n){function r(o,i){return"[Axios v"+_n+"] Transitional option '"+o+"'"+i+(n?". "+n:"")}return(o,i,c)=>{if(t===!1)throw new A(r(i," has been removed"+(s?" in "+s:"")),A.ERR_DEPRECATED);return s&&!Tr[i]&&(Tr[i]=!0,console.warn(r(i," has been deprecated since v"+s+" and will be removed in the near future"))),t?t(o,i,c):!0}};Ls.spelling=function(t){return(s,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Sd(e,t,s){if(typeof e!="object"||e===null)throw new A("options must be an object",A.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let r=n.length;for(;r-- >0;){const o=n[r],i=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(i){const c=e[o],l=c===void 0||i(c,o,e);if(l!==!0)throw new A("option "+o+" must be "+l,A.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new A("Unknown option "+o,A.ERR_BAD_OPTION)}}const ps={assertOptions:Sd,validators:Ls},ge=ps.validators;let at=class{constructor(t){this.defaults=t||{},this.interceptors={request:new vr,response:new vr}}async request(t,s){try{return await this._request(t,s)}catch(n){if(n instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const o=(()=>{if(!r.stack)return"";const i=r.stack.indexOf(`
|
|
11
|
+
`);return i===-1?"":r.stack.slice(i+1)})();try{if(!n.stack)n.stack=o;else if(o){const i=o.indexOf(`
|
|
12
12
|
`),c=i===-1?-1:o.indexOf(`
|
|
13
|
-
`,i+1),l=c===-1?"":o.slice(c+1);String(
|
|
14
|
-
`+o)}}catch{}}throw r}}_request(t,s){typeof t=="string"?(s=s||{},s.url=t):s=t||{},s=ct(this.defaults,s);const{transitional:r,paramsSerializer:n,headers:o}=s;r!==void 0&&hs.assertOptions(r,{silentJSONParsing:pe.transitional(pe.boolean),forcedJSONParsing:pe.transitional(pe.boolean),clarifyTimeoutError:pe.transitional(pe.boolean),legacyInterceptorReqResOrdering:pe.transitional(pe.boolean),advertiseZstdAcceptEncoding:pe.transitional(pe.boolean),validateStatusUndefinedResolves:pe.transitional(pe.boolean)},!1),n!=null&&(v.isFunction(n)?s.paramsSerializer={serialize:n}:hs.assertOptions(n,{encode:pe.function,serialize:pe.function},!0)),s.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?s.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:s.allowAbsoluteUrls=!0),hs.assertOptions(s,{baseUrl:pe.spelling("baseURL"),withXsrfToken:pe.spelling("withXSRFToken")},!0),s.method=(s.method||this.defaults.method||"get").toLowerCase();let i=o&&v.merge(o.common,o[s.method]);o&&v.forEach(["delete","get","head","post","put","patch","query","common"],g=>{delete o[g]}),s.headers=xe.concat(i,o);const c=[];let l=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(s)===!1)return;l=l&&p.synchronous;const x=s.transitional||Sr;x&&x.legacyInterceptorReqResOrdering?c.unshift(p.fulfilled,p.rejected):c.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let f,u=0,h;if(!l){const g=[En.bind(this),void 0];for(g.unshift(...c),g.push(...d),h=g.length,f=Promise.resolve(s);u<h;)f=f.then(g[u++],g[u++]);return f}h=c.length;let m=s;for(;u<h;){const g=c[u++],p=c[u++];try{m=g(m)}catch(x){p.call(this,x);break}}try{f=En.call(this,m)}catch(g){return Promise.reject(g)}for(u=0,h=d.length;u<h;)f=f.then(d[u++],d[u++]);return f}getUri(t){t=ct(this.defaults,t);const s=Vo(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Fo(s,t.params,t.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(t){ot.prototype[t]=function(s,r){return this.request(ct(r||{},{method:t,url:s,data:r&&v.hasOwnProp(r,"data")?r.data:void 0}))}});v.forEach(["post","put","patch","query"],function(t){function s(r){return function(o,i,c){return this.request(ct(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}ot.prototype[t]=s(),t!=="query"&&(ot.prototype[t+"Form"]=s(!0))});let bd=class Go{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(o){s=o});const r=this;this.promise.then(n=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](n);r._listeners=null}),this.promise.then=n=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(n);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new qt(o,i,c),s(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const s=this._listeners.indexOf(t);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){const t=new AbortController,s=r=>{t.abort(r)};return this.subscribe(s),t.signal.unsubscribe=()=>this.unsubscribe(s),t.signal}static source(){let t;return{token:new Go(function(n){t=n}),cancel:t}}};function yd(e){return function(s){return e.apply(null,s)}}function vd(e){return v.isObject(e)&&e.isAxiosError===!0}const ur={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ur).forEach(([e,t])=>{ur[t]=e});function Ko(e){const t=new ot(e),s=jo(ot.prototype.request,t);return v.extend(s,ot.prototype,t,{allOwnKeys:!0}),v.extend(s,t,null,{allOwnKeys:!0}),s.create=function(n){return Ko(ct(e,n))},s}const oe=Ko(Ht);oe.Axios=ot;oe.CanceledError=qt;oe.CancelToken=bd;oe.isCancel=Bo;oe.VERSION=jr;oe.toFormData=Ts;oe.AxiosError=P;oe.Cancel=oe.CanceledError;oe.all=function(t){return Promise.all(t)};oe.spread=yd;oe.isAxiosError=vd;oe.mergeConfig=ct;oe.AxiosHeaders=xe;oe.formToJSON=e=>$o(v.isHTMLForm(e)?new FormData(e):e);oe.getAdapter=qo.getAdapter;oe.HttpStatusCode=ur;oe.default=oe;const{Axios:rh,AxiosError:nh,CanceledError:oh,isCancel:ah,CancelToken:ih,VERSION:ch,all:lh,Cancel:dh,isAxiosError:uh,spread:fh,toFormData:hh,AxiosHeaders:mh,HttpStatusCode:ph,formToJSON:gh,getAdapter:xh,mergeConfig:bh,create:yh}=oe,re=oe.create({baseURL:"/api/v1/cost"});function Yo(e,t){re.defaults.baseURL=`${e.replace(/\/$/,"")}/cost`,t?re.defaults.headers.common.Authorization=`Bearer ${t}`:delete re.defaults.headers.common.Authorization}function wd(e){e.interceptors.request.use(t=>{if(typeof window<"u"){const s=window.localStorage.getItem("access_token");s?(t.headers=t.headers||{},t.headers.Authorization=`Bearer ${s}`):t.headers&&delete t.headers.Authorization}return t})}const Sd=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Rd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,r)=>r?r.toUpperCase():s.toLowerCase()),Tn=e=>{const t=Rd(e);return t.charAt(0).toUpperCase()+t.slice(1)},Jo=(...e)=>e.filter((t,s,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===s).join(" ").trim(),jd=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Nd={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Cd=k.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:n="",children:o,iconNode:i,...c},l)=>k.createElement("svg",{ref:l,...Nd,width:t,height:t,stroke:e,strokeWidth:r?Number(s)*24/Number(t):s,className:Jo("lucide",n),...!o&&!jd(c)&&{"aria-hidden":"true"},...c},[...i.map(([d,f])=>k.createElement(d,f)),...Array.isArray(o)?o:[o]]));const Q=(e,t)=>{const s=k.forwardRef(({className:r,...n},o)=>k.createElement(Cd,{ref:o,iconNode:t,className:Jo(`lucide-${Sd(Tn(e))}`,`lucide-${e}`,r),...n}));return s.displayName=Tn(e),s};const _d=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],kd=Q("building-2",_d);const Ed=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],Xo=Q("calendar-clock",Ed);const Pd=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Td=Q("chart-column",Pd);const Ad=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Od=Q("chevron-down",Ad);const Ld=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Id=Q("chevron-left",Ld);const Md=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Dd=Q("chevron-right",Md);const Fd=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],lt=Q("circle-alert",Fd);const Ud=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],$d=Q("circle-check",Ud);const Bd=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],js=Q("cloud",Bd);const zd=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Zo=Q("database",zd);const Vd=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Qo=Q("dollar-sign",Vd);const Wd=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Cr=Q("download",Wd);const Hd=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ea=Q("external-link",Hd);const qd=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Gd=Q("eye",qd);const Kd=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],Yd=Q("file-down",Kd);const Jd=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ta=Q("file-text",Jd);const Xd=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Zd=Q("list",Xd);const Qd=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],bt=Q("loader-circle",Qd);const eu=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],tu=Q("map-pin",eu);const su=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ru=Q("plus",su);const nu=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],St=Q("refresh-cw",nu);const ou=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],_r=Q("search",ou);const au=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],sa=Q("server",au);const iu=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ra=Q("settings-2",iu);const cu=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],An=Q("sparkles",cu);const lu=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],du=Q("trash-2",lu);const uu=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],fu=Q("trending-down",uu);const hu=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],na=Q("trending-up",hu);const mu=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Os=Q("x",mu);function oa(e){var t,s,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(s=oa(e[t]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function pu(){for(var e,t,s=0,r="",n=arguments.length;s<n;s++)(e=arguments[s])&&(t=oa(e))&&(r&&(r+=" "),r+=t);return r}const gu=(e,t)=>{const s=new Array(e.length+t.length);for(let r=0;r<e.length;r++)s[r]=e[r];for(let r=0;r<t.length;r++)s[e.length+r]=t[r];return s},xu=(e,t)=>({classGroupId:e,validator:t}),aa=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),Ns="-",On=[],bu="arbitrary..",yu=e=>{const t=wu(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return vu(i);const c=i.split(Ns),l=c[0]===""&&c.length>1?1:0;return ia(c,l,t)},getConflictingClassGroupIds:(i,c)=>{if(c){const l=r[i],d=s[i];return l?d?gu(d,l):l:d||On}return s[i]||On}}},ia=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const n=e[t],o=s.nextPart.get(n);if(o){const d=ia(e,t+1,o);if(d)return d}const i=s.validators;if(i===null)return;const c=t===0?e.join(Ns):e.slice(t).join(Ns),l=i.length;for(let d=0;d<l;d++){const f=i[d];if(f.validator(c))return f.classGroupId}},vu=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),s=t.indexOf(":"),r=t.slice(0,s);return r?bu+r:void 0})(),wu=e=>{const{theme:t,classGroups:s}=e;return Su(s,t)},Su=(e,t)=>{const s=aa();for(const r in e){const n=e[r];kr(n,s,r,t)}return s},kr=(e,t,s,r)=>{const n=e.length;for(let o=0;o<n;o++){const i=e[o];Ru(i,t,s,r)}},Ru=(e,t,s,r)=>{if(typeof e=="string"){ju(e,t,s);return}if(typeof e=="function"){Nu(e,t,s,r);return}Cu(e,t,s,r)},ju=(e,t,s)=>{const r=e===""?t:ca(t,e);r.classGroupId=s},Nu=(e,t,s,r)=>{if(_u(e)){kr(e(r),t,s,r);return}t.validators===null&&(t.validators=[]),t.validators.push(xu(s,e))},Cu=(e,t,s,r)=>{const n=Object.entries(e),o=n.length;for(let i=0;i<o;i++){const[c,l]=n[i];kr(l,ca(t,c),s,r)}},ca=(e,t)=>{let s=e;const r=t.split(Ns),n=r.length;for(let o=0;o<n;o++){const i=r[o];let c=s.nextPart.get(i);c||(c=aa(),s.nextPart.set(i,c)),s=c}return s},_u=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,ku=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=Object.create(null),r=Object.create(null);const n=(o,i)=>{s[o]=i,t++,t>e&&(t=0,r=s,s=Object.create(null))};return{get(o){let i=s[o];if(i!==void 0)return i;if((i=r[o])!==void 0)return n(o,i),i},set(o,i){o in s?s[o]=i:n(o,i)}}},fr="!",Ln=":",Eu=[],In=(e,t,s,r,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:r,isExternal:n}),Pu=e=>{const{prefix:t,experimentalParseClassName:s}=e;let r=n=>{const o=[];let i=0,c=0,l=0,d;const f=n.length;for(let p=0;p<f;p++){const x=n[p];if(i===0&&c===0){if(x===Ln){o.push(n.slice(l,p)),l=p+1;continue}if(x==="/"){d=p;continue}}x==="["?i++:x==="]"?i--:x==="("?c++:x===")"&&c--}const u=o.length===0?n:n.slice(l);let h=u,m=!1;u.endsWith(fr)?(h=u.slice(0,-1),m=!0):u.startsWith(fr)&&(h=u.slice(1),m=!0);const g=d&&d>l?d-l:void 0;return In(o,m,h,g)};if(t){const n=t+Ln,o=r;r=i=>i.startsWith(n)?o(i.slice(n.length)):In(Eu,!1,i,void 0,!0)}if(s){const n=r;r=o=>s({className:o,parseClassName:n})}return r},Tu=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((s,r)=>{t.set(s,1e6+r)}),s=>{const r=[];let n=[];for(let o=0;o<s.length;o++){const i=s[o],c=i[0]==="[",l=t.has(i);c||l?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(i)):n.push(i)}return n.length>0&&(n.sort(),r.push(...n)),r}},Au=e=>({cache:ku(e.cacheSize),parseClassName:Pu(e),sortModifiers:Tu(e),postfixLookupClassGroupIds:Ou(e),...yu(e)}),Ou=e=>{const t=Object.create(null),s=e.postfixLookupClassGroups;if(s)for(let r=0;r<s.length;r++)t[s[r]]=!0;return t},Lu=/\s+/,Iu=(e,t)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:n,sortModifiers:o,postfixLookupClassGroupIds:i}=t,c=[],l=e.trim().split(Lu);let d="";for(let f=l.length-1;f>=0;f-=1){const u=l[f],{isExternal:h,modifiers:m,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:x}=s(u);if(h){d=u+(d.length>0?" "+d:d);continue}let b=!!x,y;if(b){const j=p.substring(0,x);y=r(j);const S=y&&i[y]?r(p):void 0;S&&S!==y&&(y=S,b=!1)}else y=r(p);if(!y){if(!b){d=u+(d.length>0?" "+d:d);continue}if(y=r(p),!y){d=u+(d.length>0?" "+d:d);continue}b=!1}const R=m.length===0?"":m.length===1?m[0]:o(m).join(":"),w=g?R+fr:R,_=w+y;if(c.indexOf(_)>-1)continue;c.push(_);const N=n(y,b);for(let j=0;j<N.length;++j){const S=N[j];c.push(w+S)}d=u+(d.length>0?" "+d:d)}return d},Mu=(...e)=>{let t=0,s,r,n="";for(;t<e.length;)(s=e[t++])&&(r=la(s))&&(n&&(n+=" "),n+=r);return n},la=e=>{if(typeof e=="string")return e;let t,s="";for(let r=0;r<e.length;r++)e[r]&&(t=la(e[r]))&&(s&&(s+=" "),s+=t);return s},Du=(e,...t)=>{let s,r,n,o;const i=l=>{const d=t.reduce((f,u)=>u(f),e());return s=Au(d),r=s.cache.get,n=s.cache.set,o=c,c(l)},c=l=>{const d=r(l);if(d)return d;const f=Iu(l,s);return n(l,f),f};return o=i,(...l)=>o(Mu(...l))},Fu=[],ie=e=>{const t=s=>s[e]||Fu;return t.isThemeGetter=!0,t},da=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ua=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Uu=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,$u=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bu=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,zu=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Vu=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Wu=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Be=e=>Uu.test(e),H=e=>!!e&&!Number.isNaN(Number(e)),Ae=e=>!!e&&Number.isInteger(Number(e)),Zs=e=>e.endsWith("%")&&H(e.slice(0,-1)),Me=e=>$u.test(e),fa=()=>!0,Hu=e=>Bu.test(e)&&!zu.test(e),Er=()=>!1,qu=e=>Vu.test(e),Gu=e=>Wu.test(e),Ku=e=>!O(e)&&!L(e),Yu=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Ju=e=>Ge(e,pa,Er),O=e=>da.test(e),Je=e=>Ge(e,ga,Hu),Mn=e=>Ge(e,nf,H),Xu=e=>Ge(e,ba,fa),Zu=e=>Ge(e,xa,Er),Dn=e=>Ge(e,ha,Er),Qu=e=>Ge(e,ma,Gu),ts=e=>Ge(e,ya,qu),L=e=>ua.test(e),Lt=e=>ut(e,ga),ef=e=>ut(e,xa),Fn=e=>ut(e,ha),tf=e=>ut(e,pa),sf=e=>ut(e,ma),ss=e=>ut(e,ya,!0),rf=e=>ut(e,ba,!0),Ge=(e,t,s)=>{const r=da.exec(e);return r?r[1]?t(r[1]):s(r[2]):!1},ut=(e,t,s=!1)=>{const r=ua.exec(e);return r?r[1]?t(r[1]):s:!1},ha=e=>e==="position"||e==="percentage",ma=e=>e==="image"||e==="url",pa=e=>e==="length"||e==="size"||e==="bg-size",ga=e=>e==="length",nf=e=>e==="number",xa=e=>e==="family-name",ba=e=>e==="number"||e==="weight",ya=e=>e==="shadow",of=()=>{const e=ie("color"),t=ie("font"),s=ie("text"),r=ie("font-weight"),n=ie("tracking"),o=ie("leading"),i=ie("breakpoint"),c=ie("container"),l=ie("spacing"),d=ie("radius"),f=ie("shadow"),u=ie("inset-shadow"),h=ie("text-shadow"),m=ie("drop-shadow"),g=ie("blur"),p=ie("perspective"),x=ie("aspect"),b=ie("ease"),y=ie("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...w(),L,O],N=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],S=()=>[L,O,l],E=()=>[Be,"full","auto",...S()],D=()=>[Ae,"none","subgrid",L,O],T=()=>["auto",{span:["full",Ae,L,O]},Ae,L,O],F=()=>[Ae,"auto",L,O],ee=()=>["auto","min","max","fr",L,O],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...S()],Y=()=>[Be,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],de=()=>[Be,"screen","full","dvw","lvw","svw","min","max","fit",...S()],fe=()=>[Be,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],A=()=>[e,L,O],C=()=>[...w(),Fn,Dn,{position:[L,O]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",tf,Ju,{size:[L,O]}],q=()=>[Zs,Lt,Je],I=()=>["","none","full",d,L,O],M=()=>["",H,Lt,Je],$=()=>["solid","dashed","dotted","double"],J=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>[H,Zs,Fn,Dn],ue=()=>["","none",g,L,O],be=()=>["none",H,L,O],ne=()=>["none",H,L,O],Ie=()=>[H,L,O],_e=()=>[Be,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Me],breakpoint:[Me],color:[fa],container:[Me],"drop-shadow":[Me],ease:["in","out","in-out"],font:[Ku],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Me],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Me],shadow:[Me],spacing:["px",H],text:[Me],"text-shadow":[Me],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Be,O,L,x]}],container:["container"],"container-type":[{"@container":["","normal","size",L,O]}],"container-named":[Yu],columns:[{columns:[H,O,L,c]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[Ae,"auto",L,O]}],basis:[{basis:[Be,"full","auto",c,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[H,Be,"auto","initial","none",O]}],grow:[{grow:["",H,L,O]}],shrink:[{shrink:["",H,L,O]}],order:[{order:[Ae,"first","last","none",L,O]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:T()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:T()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pbs:[{pbs:S()}],pbe:[{pbe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:Z()}],mx:[{mx:Z()}],my:[{my:Z()}],ms:[{ms:Z()}],me:[{me:Z()}],mbs:[{mbs:Z()}],mbe:[{mbe:Z()}],mt:[{mt:Z()}],mr:[{mr:Z()}],mb:[{mb:Z()}],ml:[{ml:Z()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...de()]}],"min-inline-size":[{"min-inline":["auto",...de()]}],"max-inline-size":[{"max-inline":["none",...de()]}],"block-size":[{block:["auto",...fe()]}],"min-block-size":[{"min-block":["auto",...fe()]}],"max-block-size":[{"max-block":["none",...fe()]}],w:[{w:[c,"screen",...Y()]}],"min-w":[{"min-w":[c,"screen","none",...Y()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[i]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",s,Lt,Je]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,rf,Xu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zs,O]}],"font-family":[{font:[ef,Zu,t]}],"font-features":[{"font-features":[O]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,L,O]}],"line-clamp":[{"line-clamp":[H,"none",L,Mn]}],leading:[{leading:[o,...S()]}],"list-image":[{"list-image":["none",L,O]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",L,O]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:[H,"from-font","auto",L,Je]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[H,"auto",L,O]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"tab-size":[{tab:[Ae,L,O]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",L,O]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",L,O]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:C()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ae,L,O],radial:["",L,O],conic:[Ae,L,O]},sf,Qu]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:M()}],"border-w-x":[{"border-x":M()}],"border-w-y":[{"border-y":M()}],"border-w-s":[{"border-s":M()}],"border-w-e":[{"border-e":M()}],"border-w-bs":[{"border-bs":M()}],"border-w-be":[{"border-be":M()}],"border-w-t":[{"border-t":M()}],"border-w-r":[{"border-r":M()}],"border-w-b":[{"border-b":M()}],"border-w-l":[{"border-l":M()}],"divide-x":[{"divide-x":M()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":M()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...$(),"hidden","none"]}],"divide-style":[{divide:[...$(),"hidden","none"]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-bs":[{"border-bs":A()}],"border-color-be":[{"border-be":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:[...$(),"none","hidden"]}],"outline-offset":[{"outline-offset":[H,L,O]}],"outline-w":[{outline:["",H,Lt,Je]}],"outline-color":[{outline:A()}],shadow:[{shadow:["","none",f,ss,ts]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":["none",u,ss,ts]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[H,Je]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":M()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":["none",h,ss,ts]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[H,L,O]}],"mix-blend":[{"mix-blend":[...J(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":J()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[H]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[L,O]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[H]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:C()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",L,O]}],filter:[{filter:["","none",L,O]}],blur:[{blur:ue()}],brightness:[{brightness:[H,L,O]}],contrast:[{contrast:[H,L,O]}],"drop-shadow":[{"drop-shadow":["","none",m,ss,ts]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:["",H,L,O]}],"hue-rotate":[{"hue-rotate":[H,L,O]}],invert:[{invert:["",H,L,O]}],saturate:[{saturate:[H,L,O]}],sepia:[{sepia:["",H,L,O]}],"backdrop-filter":[{"backdrop-filter":["","none",L,O]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[H,L,O]}],"backdrop-contrast":[{"backdrop-contrast":[H,L,O]}],"backdrop-grayscale":[{"backdrop-grayscale":["",H,L,O]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[H,L,O]}],"backdrop-invert":[{"backdrop-invert":["",H,L,O]}],"backdrop-opacity":[{"backdrop-opacity":[H,L,O]}],"backdrop-saturate":[{"backdrop-saturate":[H,L,O]}],"backdrop-sepia":[{"backdrop-sepia":["",H,L,O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",L,O]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[H,"initial",L,O]}],ease:[{ease:["linear","initial",b,L,O]}],delay:[{delay:[H,L,O]}],animate:[{animate:["none",y,L,O]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,L,O]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:ne()}],"scale-x":[{"scale-x":ne()}],"scale-y":[{"scale-y":ne()}],"scale-z":[{"scale-z":ne()}],"scale-3d":["scale-3d"],skew:[{skew:Ie()}],"skew-x":[{"skew-x":Ie()}],"skew-y":[{"skew-y":Ie()}],transform:[{transform:[L,O,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:_e()}],"translate-x":[{"translate-x":_e()}],"translate-y":[{"translate-y":_e()}],"translate-z":[{"translate-z":_e()}],"translate-none":["translate-none"],zoom:[{zoom:[Ae,L,O]}],accent:[{accent:A()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:A()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",L,O]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":A()}],"scrollbar-track-color":[{"scrollbar-track":A()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mbs":[{"scroll-mbs":S()}],"scroll-mbe":[{"scroll-mbe":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pbs":[{"scroll-pbs":S()}],"scroll-pbe":[{"scroll-pbe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",L,O]}],fill:[{fill:["none",...A()]}],"stroke-w":[{stroke:[H,Lt,Je,Mn]}],stroke:[{stroke:["none",...A()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},af=Du(of);function Ct(...e){return af(pu(e))}function K(e,t="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:2}).format(e)}const ce=B.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Ct("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ce.displayName="Card";const ve=B.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Ct("flex flex-col space-y-1.5 p-6",e),...t}));ve.displayName="CardHeader";const Ne=B.forwardRef(({className:e,...t},s)=>a.jsx("h3",{ref:s,className:Ct("font-semibold leading-none tracking-tight",e),...t}));Ne.displayName="CardTitle";const cf=B.forwardRef(({className:e,...t},s)=>a.jsx("p",{ref:s,className:Ct("text-sm text-muted-foreground",e),...t}));cf.displayName="CardDescription";const le=B.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Ct("p-6 pt-0",e),...t}));le.displayName="CardContent";const lf=B.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Ct("flex items-center p-6 pt-0",e),...t}));lf.displayName="CardFooter";function Cs({status:e,error:t}){const s=e?.action==="connect_source"||e?.state==="not_configured",r=e?.message||t||"CUR status could not be loaded. Verify the cost source, discovery job, and Athena configuration.";return a.jsx("section",{className:"rounded-md border bg-card p-6","aria-live":"polite",children:a.jsxs("div",{className:"flex items-start gap-3",children:[e?.state==="unavailable"||t?a.jsx(lt,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}):a.jsx(Zo,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"font-semibold",children:s?"Enable AWS Cost and Usage Reports":"CUR data is not ready"}),a.jsx("p",{className:"mt-1 max-w-3xl text-sm text-muted-foreground",children:r}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs(vs,{to:s?"/sources":"/cur-discovery",className:"inline-flex items-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground",children:[a.jsx(ea,{className:"h-4 w-4"}),s?"Connect AWS source":"Review CUR discovery"]}),!s&&a.jsx(vs,{to:"/sources",className:"rounded-md border px-3 py-2 text-sm font-medium hover:bg-muted",children:"Cost sources"})]})]})]})})}function df({points:e,currency:t="USD"}){const[s,r]=k.useState(null);if(!e.length)return a.jsx("p",{className:"py-20 text-center text-sm text-muted-foreground",children:"No trend data for this period."});const n=900,o=260,i=70,c=24,l=22,d=48,f=n-i-c,u=o-l-d,h=Math.max(...e.map(x=>x.value),1),m=e.map((x,b)=>({...x,x:i+(e.length===1?f/2:b*f/(e.length-1)),y:l+u-x.value/h*u})),g=s==null?null:m[s],p=x=>{const b=x.currentTarget.getBoundingClientRect(),y=(x.clientX-b.left)/b.width*n;let R=0;for(let w=1;w<m.length;w+=1)Math.abs(m[w].x-y)<Math.abs(m[R].x-y)&&(R=w);r(R)};return a.jsxs("div",{className:"relative w-full",children:[a.jsxs("svg",{viewBox:`0 0 ${n} ${o}`,className:"h-72 w-full",onMouseMove:p,onMouseLeave:()=>r(null),role:"img","aria-label":"Cost trend line chart",children:[[0,.25,.5,.75,1].map(x=>{const b=l+u*x;return a.jsxs("g",{children:[a.jsx("line",{x1:i,y1:b,x2:n-c,y2:b,stroke:"#d8e0e7",strokeDasharray:"4 4"}),a.jsx("text",{x:i-10,y:b+4,textAnchor:"end",fill:"currentColor",className:"text-[10px] text-muted-foreground",children:K(h*(1-x),t)})]},x)}),a.jsx("line",{x1:i,y1:l+u,x2:n-c,y2:l+u,stroke:"#aebbc5"}),a.jsx("polyline",{points:m.map(x=>`${x.x},${x.y}`).join(" "),fill:"none",stroke:"#1f5f85",strokeWidth:"4",strokeLinejoin:"round",strokeLinecap:"round"}),g&&a.jsx("line",{x1:g.x,y1:l,x2:g.x,y2:l+u,stroke:"#1f5f85",strokeDasharray:"3 4",opacity:"0.45"}),m.map((x,b)=>a.jsxs("g",{children:[a.jsx("circle",{cx:x.x,cy:x.y,r:s===b?7:5,fill:"#1f5f85",stroke:"white",strokeWidth:"2"}),a.jsx("text",{x:x.x,y:o-17,textAnchor:"middle",fill:"currentColor",className:"text-[11px] text-muted-foreground",children:x.label})]},x.key))]}),g&&a.jsxs("div",{className:"pointer-events-none absolute z-20 min-w-44 rounded-lg border bg-popover p-3 text-popover-foreground shadow-xl",style:{left:`${g.x/n*100}%`,top:`${Math.max(g.y/o*100-4,2)}%`,transform:g.x>n*.75?"translate(-100%, -100%)":"translate(-50%, -100%)"},children:[a.jsx("p",{className:"text-xs font-semibold",children:g.label}),a.jsx("p",{className:"mt-1 text-sm font-bold text-primary",children:K(g.value,t)}),g.details?.slice(0,5).map(x=>a.jsxs("div",{className:"mt-1 flex justify-between gap-4 text-xs",children:[a.jsx("span",{className:"max-w-40 truncate text-muted-foreground",children:x.label}),a.jsx("span",{children:K(x.value,t)})]},x.label))]})]})}const Un=e=>e.length>16?`${e.slice(0,14)}...`:e,uf=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t||"USD",notation:"compact",maximumFractionDigits:1}).format(e);function ff({title:e,items:t,currency:s}){const o={top:38,right:18,bottom:72,left:76},i=720-o.left-o.right,c=320-o.top-o.bottom,l=Math.max(...t.map(u=>u.amount),1),d=i/t.length,f=Math.min(56,d*.58);return a.jsxs("svg",{viewBox:"0 0 720 320",className:"h-80 w-full",role:"img","aria-label":`${e} cost bar chart`,children:[[0,.25,.5,.75,1].map(u=>{const h=o.top+c-u*c;return a.jsxs("g",{children:[a.jsx("line",{x1:o.left,y1:h,x2:720-o.right,y2:h,stroke:"currentColor",opacity:u===0?.3:.12,vectorEffect:"non-scaling-stroke"}),a.jsx("text",{x:o.left-12,y:h+4,textAnchor:"end",fill:"currentColor",opacity:"0.7",fontSize:"11",children:uf(l*u,s)})]},u)}),a.jsx("line",{x1:o.left,y1:o.top,x2:o.left,y2:o.top+c,stroke:"currentColor",opacity:"0.3",vectorEffect:"non-scaling-stroke"}),t.map((u,h)=>{const m=o.left+d*h+d/2,g=Math.max(u.amount/l*c,3),p=o.top+c-g;return a.jsxs("g",{tabIndex:0,"aria-label":`${u.label}: ${K(u.amount,s)}`,className:"outline-none focus-visible:opacity-75",children:[a.jsxs("title",{children:[u.label,": ",K(u.amount,s)]}),a.jsx("rect",{x:m-f/2,y:p,width:f,height:g,rx:"4",className:"fill-primary opacity-80 transition-opacity hover:opacity-100"}),a.jsx("text",{x:m,y:Math.max(p-8,16),textAnchor:"middle",fill:"currentColor",fontSize:"11",fontWeight:"600",children:K(u.amount,s)}),a.jsx("text",{x:m,y:278,textAnchor:"middle",fill:"currentColor",opacity:"0.72",fontSize:"11",children:Un(u.label)}),u.accountId&&a.jsx("text",{x:m,y:295,textAnchor:"middle",fill:"currentColor",opacity:"0.55",fontSize:"9",children:Un(u.accountId)})]},u.key||u.label)}),a.jsxs("text",{x:"18",y:o.top+c/2,transform:`rotate(-90 18 ${o.top+c/2})`,textAnchor:"middle",fill:"currentColor",opacity:"0.65",fontSize:"11",children:["Cost (",s,")"]})]})}const va="min-h-32 transition-all duration-200 ease-out hover:-translate-y-1 hover:scale-[1.01] hover:border-primary/30 hover:shadow-lg";function Qs({title:e,icon:t,items:s,currency:r}){const[n,o]=k.useState("chart"),i=s.slice(0,6),c=Math.max(...i.map(l=>l.amount),1);return a.jsxs(ce,{className:"min-w-0",children:[a.jsxs(ve,{className:"flex flex-row items-center justify-between gap-3 pb-3",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"text-primary",children:t}),a.jsx(Ne,{className:"truncate text-sm",children:e})]}),a.jsxs("div",{className:"flex rounded-md border p-0.5","aria-label":`${e} view`,children:[a.jsx("button",{type:"button",onClick:()=>o("chart"),"aria-label":`Show ${e} as bar chart`,"aria-pressed":n==="chart",title:"Bar chart",className:`rounded p-1.5 ${n==="chart"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(Td,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:()=>o("list"),"aria-label":`Show ${e} as list`,"aria-pressed":n==="list",title:"List",className:`rounded p-1.5 ${n==="list"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(Zd,{className:"h-4 w-4"})})]})]}),a.jsx(le,{children:i.length?n==="chart"?a.jsx(ff,{title:e,items:i,currency:r}):a.jsx("div",{className:"space-y-3",children:i.map(l=>a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[a.jsxs("span",{className:"truncate text-muted-foreground",title:l.label,children:[l.label,l.accountId?a.jsxs("span",{className:"ml-1 text-xs",children:["(",l.accountId,")"]}):null]}),a.jsx("span",{className:"shrink-0 font-medium",children:K(l.amount,r)})]}),a.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:"h-full rounded-full bg-primary/75",style:{width:`${l.amount/c*100}%`}})})]},l.key||l.label))}):a.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No cost data for this period."})})]})}function hf(){return a.jsxs("div",{"aria-live":"polite","aria-busy":"true",className:"contents",children:[a.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:Array.from({length:4},(e,t)=>a.jsxs(ce,{className:va,children:[a.jsx(ve,{className:"pb-2",children:a.jsx("div",{className:"h-3 w-24 animate-pulse rounded bg-muted"})}),a.jsxs(le,{children:[a.jsx("div",{className:"h-6 w-3/4 animate-pulse rounded bg-muted"}),a.jsx("div",{className:"mt-3 h-3 w-1/2 animate-pulse rounded bg-muted/80"})]})]},t))}),a.jsxs(ce,{children:[a.jsx(ve,{children:a.jsx("div",{className:"h-4 w-36 animate-pulse rounded bg-muted"})}),a.jsx(le,{children:a.jsx("div",{className:"h-72 animate-pulse rounded-lg bg-muted/70"})})]}),a.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:Array.from({length:3},(e,t)=>a.jsxs(ce,{children:[a.jsx(ve,{children:a.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted"})}),a.jsx(le,{className:"space-y-4",children:Array.from({length:5},(s,r)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("div",{className:"h-3 w-2/5 animate-pulse rounded bg-muted"}),a.jsx("div",{className:"h-3 w-20 animate-pulse rounded bg-muted"})]}),a.jsx("div",{className:"mt-2 h-1.5 animate-pulse rounded bg-muted/80"})]},r))})]},t))})]})}function mf({data:e,period:t,selectedMonth:s}){const r=e.topServices[0],n=e.topAccounts[0],o=new Date,[i,c]=s.split("-").map(Number),l=t==="monthly"?new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(i,c-1,1)):String(o.getFullYear()),d=[{label:"Total cost",value:a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"block",children:K(e.totalCost,e.currency)}),a.jsxs("span",{className:"mt-1 block text-sm font-medium text-muted-foreground",children:["Accounts: ",e.activeAccounts]})]}),helper:l,icon:a.jsx(Qo,{})},{label:"Active resources",value:e.activeResources==null?a.jsx("span",{className:"text-sm",title:e.activeResourcesMessage,children:"CUR access required"}):Number(e.activeResources).toLocaleString(),helper:`${l} across all accounts`,icon:a.jsx(js,{})},{label:"Highest cost service",value:r?a.jsx("span",{className:"whitespace-pre-line text-sm",children:`Service - ${r.label}
|
|
15
|
-
Cost - ${K(
|
|
16
|
-
Account Id - ${
|
|
17
|
-
Cost - ${K(n.amount,e.currency)}`}):"-",helper:l,icon:a.jsx(js,{})}];return a.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:d.map(f=>a.jsxs(ce,{className:va,children:[a.jsxs(ve,{className:"flex flex-row items-center justify-between pb-2",children:[a.jsx(Ne,{className:"text-xs font-medium text-muted-foreground",children:f.label}),a.jsx("span",{className:"text-muted-foreground [&>svg]:h-4 [&>svg]:w-4",children:f.icon})]}),a.jsxs(le,{children:[a.jsx("div",{className:"break-words text-base font-semibold leading-snug xl:text-lg",children:f.value}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:f.helper})]})]},f.label))})}const ae={getOverview:e=>re.get("/overview",{params:e}).then(t=>t.data),getAccounts:()=>re.get("/accounts").then(e=>e.data),getReports:e=>re.get("/reports",{params:e}).then(t=>t.data),getFilterOptions:e=>re.get("/filter-options",{params:{start:e?.start,end:e?.end,tagKey:e?.filterTagKey}}).then(t=>t.data),getTags:e=>re.get("/tags",{params:e}).then(t=>t.data),getDataStatus:e=>re.get("/data-status",{params:e}).then(t=>t.data),getAnalysisStatus:()=>re.get("/analysis/status").then(e=>e.data),getLatestAnalysis:()=>re.get("/analysis/latest").then(e=>e.data.analysis),getAnalysisSchedule:()=>re.get("/analysis/schedule").then(e=>e.data),updateAnalysisSchedule:e=>re.put("/analysis/schedule",e).then(t=>t.data),getAnalysisReports:()=>re.get("/analysis/reports").then(e=>e.data.reports),removeAnalysisReport:e=>re.delete(`/analysis/reports/${e}`).then(t=>t.data),downloadAnalysisPdf:e=>re.get(`/analysis/reports/${e}/pdf`,{responseType:"blob"}).then(t=>t.data),getSources:()=>re.get("/sources").then(e=>e.data),createSource:e=>re.post("/sources",e).then(t=>t.data),getSourceStatus:e=>re.get(`/sources/${e}/status`).then(t=>t.data),verifySource:e=>re.post(`/sources/${e}/verify`).then(t=>t.data),downloadSourceTemplate:e=>re.get(`/sources/${e}/template`,{responseType:"blob"}).then(t=>t.data)};function pf(){const e=new Date,t=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`,[s,r]=k.useState(null),[n,o]=k.useState(!0),[i,c]=k.useState(null),[l,d]=k.useState(null),[f,u]=k.useState("monthly"),[h,m]=k.useState(t),[g,p]=k.useState([]),[x,b]=k.useState(""),y=k.useRef(0),R=Array.from({length:e.getMonth()+1},(j,S)=>({value:`${e.getFullYear()}-${String(S+1).padStart(2,"0")}`,label:new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(e.getFullYear(),S,1))})),w=async(j=f,S=h,E=x)=>{const D=++y.current;o(!0),r(null),c(null);try{let T;if(j==="yearly")T={period:j,start:`${e.getFullYear()}-01-01`};else{const[X,Z]=S.split("-").map(Number),Y=S===t?e.getDate():new Date(X,Z,0).getDate();T={period:j,start:`${S}-01`,end:`${S}-${String(Y).padStart(2,"0")}`}}const F=E?{managementAccountId:E}:void 0,ee=await ae.getDataStatus(F);if(D===y.current&&d(ee),!ee.ready)return;const z=await ae.getOverview({...T,...F});D===y.current&&r(z)}catch(T){D===y.current&&c(T?.response?.data?.error||T.message||"Failed to load AWS costs")}finally{D===y.current&&o(!1)}};return k.useEffect(()=>{ae.getSources().then(({sources:j})=>p(j.filter(S=>S.status==="CONNECTED"&&S.managementAccountId))).catch(()=>p([]))},[]),k.useEffect(()=>{w(f,h,x)},[f,h,x]),{data:s,dataStatus:l,loading:n,error:i,period:f,selectedMonth:h,monthOptions:R,sources:g,managementAccountId:x,changeManagementAccount:b,changePeriod:j=>{j!==f&&(o(!0),r(null),u(j))},changeMonth:j=>{j===h||!R.some(S=>S.value===j)||(o(!0),r(null),m(j))},refresh:()=>w(f,h,x)}}function gf(){const{data:e,dataStatus:t,loading:s,error:r,period:n,selectedMonth:o,monthOptions:i,sources:c,managementAccountId:l,changeManagementAccount:d,changePeriod:f,changeMonth:u,refresh:h}=pf();return a.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(Qo,{className:"h-6 w-6 text-primary"}),"Cloud Cost Management"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Costs across connected AWS management accounts and their member accounts"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.length>1&&a.jsxs("select",{"aria-label":"Management account",value:l,onChange:m=>d(m.target.value),disabled:s,className:"max-w-64 rounded-lg border bg-background px-3 py-2 text-sm shadow-sm disabled:opacity-50",children:[a.jsx("option",{value:"",children:"All management accounts"}),c.map(m=>a.jsxs("option",{value:m.managementAccountId||"",children:["Management account ",m.managementAccountId]},m.connectionId))]}),n==="monthly"&&a.jsx("select",{"aria-label":"Cost month",value:o,onChange:m=>u(m.target.value),disabled:s,className:"rounded-lg border bg-background px-3 py-2 text-sm shadow-sm disabled:opacity-50",children:i.map(m=>a.jsx("option",{value:m.value,children:m.label},m.value))}),a.jsx("div",{className:"flex rounded-lg border p-1",children:["monthly","yearly"].map(m=>a.jsx("button",{onClick:()=>f(m),className:`rounded-md px-3 py-1.5 text-sm capitalize transition-colors ${n===m?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:m},m))}),a.jsx("button",{onClick:()=>{h()},disabled:s,className:"rounded-lg border p-2 hover:bg-muted",children:a.jsx(St,{className:`h-4 w-4 ${s?"animate-spin":""}`})})]})]}),r&&e&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(lt,{className:"h-4 w-4"}),r]}),s?a.jsx(hf,{}):t&&!t.ready?a.jsx(Cs,{status:t}):r&&!e?a.jsx(Cs,{status:t,error:r}):e?a.jsxs(a.Fragment,{children:[e.dataSource&&a.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[a.jsx("span",{children:"Source: AWS CUR via SaaS Athena - gross positive unblended charges"}),a.jsxs("span",{children:["CUR: Ready",t?.lastDataAt?`, updated ${new Date(t.lastDataAt).toLocaleString()}`:""]})]}),a.jsx(mf,{data:e,period:n,selectedMonth:o}),e.message&&!/historical data beyond 14 months/i.test(e.message)&&a.jsx(ce,{children:a.jsx(le,{className:"py-8 text-center text-sm text-muted-foreground",children:e.message})}),a.jsxs(ce,{children:[a.jsxs(ve,{className:"flex flex-row items-center gap-2",children:[a.jsx(na,{className:"h-4 w-4 text-primary"}),a.jsxs(Ne,{className:"text-sm",children:["Cost Trend - ",n==="monthly"?"Monthly":"Yearly"]})]}),a.jsx(le,{children:a.jsx(df,{points:e.trends.map(m=>({key:m.month,label:n==="yearly"?m.month.slice(0,4):new Date(`${m.month}T00:00:00Z`).toLocaleDateString(void 0,{month:"short",year:"2-digit"}),value:m.amount})),currency:e.currency})})]}),a.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[a.jsx(Qs,{title:"Top services",icon:a.jsx(sa,{className:"h-4 w-4"}),items:e.topServices,currency:e.currency}),a.jsx(Qs,{title:"AWS accounts",icon:a.jsx(kd,{className:"h-4 w-4"}),items:e.topAccounts,currency:e.currency}),a.jsx(Qs,{title:"Regional distribution",icon:a.jsx(tu,{className:"h-4 w-4"}),items:e.topRegions,currency:e.currency})]})]}):null]})}const rs=["#6264e9","#eb67ad","#31c39a","#f29a05","#579bea","#9078ed","#f7842c","#24b9ad","#8ac926","#ffca3a","#6a4c93","#1982c4"];function $n(e,t){const s=new Date(e.length===10?`${e}T00:00:00Z`:e);return Number.isFinite(s.getTime())?s.toLocaleDateString(void 0,t?{month:"short",day:"numeric",year:"numeric"}:{month:"short",year:"numeric"}):e}function xf({timeline:e,currency:t="USD",daily:s=!1}){const[r,n]=k.useState(null),[o,i]=k.useState(null),c=k.useMemo(()=>{const h=new Map;for(const m of e)for(const g of m.groups)h.set(g.label,(h.get(g.label)||0)+g.amount);return[...h.entries()].sort((m,g)=>g[1]-m[1]).map(([m],g)=>({label:m,color:rs[g%rs.length]}))},[e]),l=new Map(c.map(h=>[h.label,h.color])),d=Math.max(...e.map(h=>h.total),1),f=r??o,u=f==null?null:e[f];return e.length?a.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_288px]",onMouseLeave:()=>n(null),children:[a.jsxs("div",{children:[a.jsxs("div",{className:"grid min-h-80 grid-cols-[64px_1fr] gap-3",children:[a.jsx("div",{className:"flex h-64 flex-col justify-between pb-1 text-right text-[11px] text-muted-foreground",children:[1,.75,.5,.25,0].map(h=>a.jsx("span",{children:K(d*h,t)},h))}),a.jsxs("div",{children:[a.jsxs("div",{className:"relative flex h-64 items-end justify-around border-b px-4",children:[[0,25,50,75].map(h=>a.jsx("span",{className:"pointer-events-none absolute left-0 right-0 border-t border-dashed border-slate-200",style:{top:`${h}%`}},h)),e.map((h,m)=>a.jsx("button",{type:"button",onMouseEnter:()=>n(m),onMouseLeave:()=>n(null),onPointerDown:g=>g.preventDefault(),onFocus:()=>i(m),onBlur:()=>i(null),className:"group z-10 flex h-full min-w-10 flex-1 items-end justify-center px-2 outline-none focus-visible:ring-2 focus-visible:ring-primary",children:a.jsx("span",{className:"flex w-full max-w-16 flex-col-reverse overflow-hidden rounded-t-sm shadow-sm transition group-hover:brightness-95",style:{height:`${Math.max(h.total/d*100,1)}%`},children:h.groups.map(g=>a.jsx("span",{style:{backgroundColor:l.get(g.label)||rs[0],height:`${h.total?g.amount/h.total*100:0}%`}},g.key||g.label))})},`${h.start}-${m}`))]}),a.jsx("div",{className:"flex justify-around px-4 pt-2",children:e.map((h,m)=>a.jsx("span",{className:"min-w-10 flex-1 text-center text-[11px] text-muted-foreground",children:$n(h.start,s)},`${h.start}-label-${m}`))})]})]}),a.jsxs("div",{className:"mt-5 flex flex-wrap gap-x-4 gap-y-2",children:[c.slice(0,8).map(h=>a.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[a.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:h.color}}),h.label]},h.label)),c.length>8&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",c.length-8," more"]})]})]}),a.jsx("aside",{"aria-live":"polite",className:"min-h-44",children:u?a.jsxs("div",{role:"tooltip",className:"rounded-2xl border bg-popover p-4 text-popover-foreground shadow-lg",children:[a.jsx("p",{className:"font-semibold",children:$n(u.start,s)}),a.jsxs("div",{className:"mt-3 space-y-2",children:[[...u.groups].sort((h,m)=>m.amount-h.amount).slice(0,5).map(h=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:l.get(h.label)||rs[0]}}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:h.label}),a.jsx("strong",{children:K(h.amount,t)})]},h.key||h.label)),u.groups.length>5&&a.jsxs("p",{className:"text-xs italic text-muted-foreground",children:["+ ",u.groups.length-5," others"]})]}),a.jsxs("div",{className:"mt-3 flex justify-between border-t pt-3 text-sm",children:[a.jsx("strong",{children:"Total"}),a.jsx("strong",{className:"text-primary",children:K(u.total,t)})]})]}):a.jsx("div",{className:"flex min-h-44 items-center justify-center rounded-2xl border border-dashed p-4 text-center text-xs text-muted-foreground",children:"Hover over a bar to view its cost details."})})]}):a.jsx("p",{className:"py-24 text-center text-sm text-muted-foreground",children:"No trend data for this period."})}function bf({rows:e,currency:t}){const s=e.slice(0,8),r=Math.max(1,...s.flatMap(n=>[n.current?.amount||0,n.previous?.amount||0]));return a.jsxs(ce,{className:"bg-primary/5",children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm",children:"Comparison Overview"})}),a.jsx(le,{children:a.jsxs("div",{className:"rounded-xl border bg-card p-5",children:[a.jsx("div",{className:"flex h-72 items-end gap-4 border-b border-l px-4 pt-4",children:s.map(n=>a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-center",children:[a.jsxs("div",{className:"flex h-56 w-full items-end justify-center gap-1",children:[a.jsx("div",{title:`Current: ${K(n.current?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-indigo-500",style:{height:`${Math.max((n.current?.amount||0)/r*100,n.current?.amount?1:0)}%`}}),a.jsx("div",{title:`Previous: ${K(n.previous?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-pink-400",style:{height:`${Math.max((n.previous?.amount||0)/r*100,n.previous?.amount?1:0)}%`}})]}),a.jsx("span",{title:n.label,className:"mt-2 w-full truncate text-center text-[10px] text-muted-foreground",children:n.label})]},n.key))}),a.jsxs("div",{className:"mt-4 flex gap-5 text-xs",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("i",{className:"h-2.5 w-2.5 rounded-full bg-indigo-500"}),"Current Period"]}),a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("i",{className:"h-2.5 w-2.5 rounded-full bg-pink-400"}),"Previous Period"]})]})]})})]})}function Le({label:e,value:t,helper:s,accent:r=!1,trend:n}){return a.jsxs("div",{className:"rounded-xl border bg-card p-5 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[n!=null&&(n<0?a.jsx(fu,{className:"h-4 w-4 text-red-500"}):a.jsx(na,{className:"h-4 w-4 text-emerald-500"})),a.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:e})]}),a.jsx("p",{className:`mt-2 text-2xl font-bold ${r?"text-primary":n!=null&&n<0?"text-red-500":""}`,children:t}),s&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s})]})}function ns({label:e,options:t,selected:s,onChange:r}){const n=s.length?`${s.length} selected`:e;return a.jsxs("details",{className:"group relative",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between rounded-lg border bg-background px-3 py-3 text-sm text-primary",children:[a.jsx("span",{children:n}),a.jsx(Od,{className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),a.jsx("div",{className:"absolute z-30 mt-1 max-h-64 w-full overflow-auto rounded-lg border bg-popover p-2 shadow-xl",children:t.length?t.map(o=>a.jsxs("label",{className:"flex cursor-pointer items-start gap-2 rounded px-2 py-2 text-xs hover:bg-muted",children:[a.jsx("input",{type:"checkbox",checked:s.includes(o.value),onChange:i=>r(i.target.checked?[...s,o.value]:s.filter(c=>c!==o.value))}),a.jsx("span",{className:"min-w-0 break-words",children:o.label})]},o.value)):a.jsx("p",{className:"p-2 text-xs text-muted-foreground",children:"No values available."})})]})}function yf(){return a.jsxs("div",{"aria-live":"polite","aria-busy":"true",className:"space-y-5",children:[a.jsxs("section",{className:"rounded-xl bg-primary/5 p-5",children:[a.jsxs("div",{className:"flex items-center gap-3 text-sm font-medium text-primary",children:[a.jsx(bt,{className:"h-5 w-5 animate-spin"}),"Loading live AWS cost report..."]}),a.jsx("div",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[1,2,3].map(e=>a.jsx("div",{className:"h-28 animate-pulse rounded-xl border bg-card/70"},e))})]}),a.jsx("div",{className:"h-80 animate-pulse rounded-xl border bg-muted/40"}),a.jsx("div",{className:"h-64 animate-pulse rounded-xl border bg-muted/40"})]})}const qe=10,hr=new Date,vf=new Date(Date.UTC(hr.getUTCFullYear(),hr.getUTCMonth()-2,1)).toISOString().slice(0,10),wf=hr.toISOString().slice(0,10),It={services:[],regions:[],accountIds:[],tagKey:"",tagValues:[]},at={service:{tab:"Services",title:"Service Cost Summary",pdfTitle:"Service Cost Report",top:"Top service cost",count:"Service count",item:"Service",empty:"No service cost data found."},account:{tab:"Accounts",title:"Account Cost Summary",pdfTitle:"Account Cost Report",top:"Top account cost",count:"Account count",item:"Linked account",empty:"No linked account cost data found."},region:{tab:"Regions",title:"Regional Cost Summary",pdfTitle:"Region Cost Report",top:"Top region cost",count:"Region count",item:"Region",empty:"No regional cost data found."},resource:{tab:"Resources",title:"Resource Cost Summary",pdfTitle:"Resource Cost Report",top:"Top resource cost",count:"Resource count",item:"Resource",empty:"Resource-level cost data requires resource IDs in the CUR export."},tag:{tab:"Tags",title:"Tag Cost Summary",pdfTitle:"Tag Cost Report",top:"Top tag value cost",count:"Tag value count",item:"Tag value",empty:"No cost allocation tag data found."}};function Bn(e){return e?new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"longOffset"}).format(new Date(e)).replace("GMT","UTC"):"Not updated yet"}function zn(e,t){const s=new Date(`${e}T00:00:00Z`);if(t==="monthly"){const n=new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),0)),o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),1)),i=new Date(o);i.setUTCDate(i.getUTCDate()-1);const c=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1));return{currentStart:o.toISOString().slice(0,10),currentEnd:n.toISOString().slice(0,10),previousStart:c.toISOString().slice(0,10),previousEnd:i.toISOString().slice(0,10)}}const r=new Date(s);return r.setUTCDate(r.getUTCDate()-1),{currentStart:e,currentEnd:e,previousStart:r.toISOString().slice(0,10),previousEnd:r.toISOString().slice(0,10)}}function Rt(e,t,s){const r=new Date(`${e}T00:00:00Z`),n=new Date(`${t}T00:00:00Z`);if(s==="monthly"&&r.getUTCFullYear()===n.getUTCFullYear()&&r.getUTCMonth()===n.getUTCMonth())return new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"}).format(r);const o=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"});return`${o.format(r)} – ${o.format(n)}`}function Sf(e){const t=new Map;return e.current.summary.forEach(s=>t.set(s.key||s.label,{current:s})),e.previous.summary.forEach(s=>{const r=s.key||s.label;t.set(r,{...t.get(r),previous:s})}),[...t.entries()].map(([s,r])=>{const n=r.current?.amount||0,o=r.previous?.amount||0,i=n-o;return{key:s,label:r.current?.label||r.previous?.label||s,...r,difference:i,change:o?i/Math.abs(o)*100:0}}).sort((s,r)=>Math.max(r.current?.amount||0,r.previous?.amount||0)-Math.max(s.current?.amount||0,s.previous?.amount||0))}function Xe(e){return e?.length?e.map(t=>`${t.label}
|
|
13
|
+
`,i+1),l=c===-1?"":o.slice(c+1);String(n.stack).endsWith(l)||(n.stack+=`
|
|
14
|
+
`+o)}}catch{}}throw n}}_request(t,s){typeof t=="string"?(s=s||{},s.url=t):s=t||{},s=lt(this.defaults,s);const{transitional:n,paramsSerializer:r,headers:o}=s;n!==void 0&&ps.assertOptions(n,{silentJSONParsing:ge.transitional(ge.boolean),forcedJSONParsing:ge.transitional(ge.boolean),clarifyTimeoutError:ge.transitional(ge.boolean),legacyInterceptorReqResOrdering:ge.transitional(ge.boolean),advertiseZstdAcceptEncoding:ge.transitional(ge.boolean),validateStatusUndefinedResolves:ge.transitional(ge.boolean)},!1),r!=null&&(v.isFunction(r)?s.paramsSerializer={serialize:r}:ps.assertOptions(r,{encode:ge.function,serialize:ge.function},!0)),s.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?s.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:s.allowAbsoluteUrls=!0),ps.assertOptions(s,{baseUrl:ge.spelling("baseURL"),withXsrfToken:ge.spelling("withXSRFToken")},!0),s.method=(s.method||this.defaults.method||"get").toLowerCase();let i=o&&v.merge(o.common,o[s.method]);o&&v.forEach(["delete","get","head","post","put","patch","query","common"],p=>{delete o[p]}),s.headers=be.concat(i,o);const c=[];let l=!0;this.interceptors.request.forEach(function(g){if(typeof g.runWhen=="function"&&g.runWhen(s)===!1)return;l=l&&g.synchronous;const b=s.transitional||Nn;b&&b.legacyInterceptorReqResOrdering?c.unshift(g.fulfilled,g.rejected):c.push(g.fulfilled,g.rejected)});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let f,d=0,h;if(!l){const p=[Ar.bind(this),void 0];for(p.unshift(...c),p.push(...u),h=p.length,f=Promise.resolve(s);d<h;)f=f.then(p[d++],p[d++]);return f}h=c.length;let m=s;for(;d<h;){const p=c[d++],g=c[d++];try{m=p(m)}catch(b){g.call(this,b);break}}try{f=Ar.call(this,m)}catch(p){return Promise.reject(p)}for(d=0,h=u.length;d<h;)f=f.then(u[d++],u[d++]);return f}getUri(t){t=lt(this.defaults,t);const s=Ho(t.baseURL,t.url,t.allowAbsoluteUrls,t);return $o(s,t.params,t.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(t){at.prototype[t]=function(s,n){return this.request(lt(n||{},{method:t,url:s,data:n&&v.hasOwnProp(n,"data")?n.data:void 0}))}});v.forEach(["post","put","patch","query"],function(t){function s(n){return function(o,i,c){return this.request(lt(c||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}at.prototype[t]=s(),t!=="query"&&(at.prototype[t+"Form"]=s(!0))});let jd=class Yo{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(o){s=o});const n=this;this.promise.then(r=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](r);n._listeners=null}),this.promise.then=r=>{let o;const i=new Promise(c=>{n.subscribe(c),o=c}).then(r);return i.cancel=function(){n.unsubscribe(o)},i},t(function(o,i,c){n.reason||(n.reason=new Yt(o,i,c),s(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const s=this._listeners.indexOf(t);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){const t=new AbortController,s=n=>{t.abort(n)};return this.subscribe(s),t.signal.unsubscribe=()=>this.unsubscribe(s),t.signal}static source(){let t;return{token:new Yo(function(r){t=r}),cancel:t}}};function Rd(e){return function(s){return e.apply(null,s)}}function Nd(e){return v.isObject(e)&&e.isAxiosError===!0}const mn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(mn).forEach(([e,t])=>{mn[t]=e});function Jo(e){const t=new at(e),s=Co(at.prototype.request,t);return v.extend(s,at.prototype,t,{allOwnKeys:!0}),v.extend(s,t,null,{allOwnKeys:!0}),s.create=function(r){return Jo(lt(e,r))},s}const ae=Jo(Kt);ae.Axios=at;ae.CanceledError=Yt;ae.CancelToken=jd;ae.isCancel=Vo;ae.VERSION=_n;ae.toFormData=Os;ae.AxiosError=A;ae.Cancel=ae.CanceledError;ae.all=function(t){return Promise.all(t)};ae.spread=Rd;ae.isAxiosError=Nd;ae.mergeConfig=lt;ae.AxiosHeaders=be;ae.formToJSON=e=>zo(v.isHTMLForm(e)?new FormData(e):e);ae.getAdapter=Ko.getAdapter;ae.HttpStatusCode=mn;ae.default=ae;const{Axios:ih,AxiosError:ch,CanceledError:lh,isCancel:dh,CancelToken:uh,VERSION:fh,all:hh,Cancel:mh,isAxiosError:ph,spread:gh,toFormData:xh,AxiosHeaders:bh,HttpStatusCode:yh,formToJSON:vh,getAdapter:wh,mergeConfig:Sh,create:jh}=ae,se=ae.create({baseURL:"/api/v1/cost"});function Xo(e,t){se.defaults.baseURL=`${e.replace(/\/$/,"")}/cost`,t?se.defaults.headers.common.Authorization=`Bearer ${t}`:delete se.defaults.headers.common.Authorization}function Cd(e){e.interceptors.request.use(t=>{if(typeof window<"u"){const s=window.localStorage.getItem("access_token");s?(t.headers=t.headers||{},t.headers.Authorization=`Bearer ${s}`):t.headers&&delete t.headers.Authorization}return t})}const _d=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),kd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,n)=>n?n.toUpperCase():s.toLowerCase()),Or=e=>{const t=kd(e);return t.charAt(0).toUpperCase()+t.slice(1)},Zo=(...e)=>e.filter((t,s,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===s).join(" ").trim(),Ed=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Pd={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Ad=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:n,className:r="",children:o,iconNode:i,...c},l)=>E.createElement("svg",{ref:l,...Pd,width:t,height:t,stroke:e,strokeWidth:n?Number(s)*24/Number(t):s,className:Zo("lucide",r),...!o&&!Ed(c)&&{"aria-hidden":"true"},...c},[...i.map(([u,f])=>E.createElement(u,f)),...Array.isArray(o)?o:[o]]));const ee=(e,t)=>{const s=E.forwardRef(({className:n,...r},o)=>E.createElement(Ad,{ref:o,iconNode:t,className:Zo(`lucide-${_d(Or(e))}`,`lucide-${e}`,n),...r}));return s.displayName=Or(e),s};const Td=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],Qo=ee("building-2",Td);const Od=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],ea=ee("calendar-clock",Od);const Ld=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Id=ee("chart-column",Ld);const Md=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Dd=ee("chevron-down",Md);const Fd=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ud=ee("chevron-left",Fd);const $d=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Bd=ee("chevron-right",$d);const zd=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],dt=ee("circle-alert",zd);const Vd=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Wd=ee("circle-check",Vd);const Hd=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],Cs=ee("cloud",Hd);const qd=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],ta=ee("database",qd);const Gd=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],sa=ee("dollar-sign",Gd);const Kd=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],En=ee("download",Kd);const Yd=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],na=ee("external-link",Yd);const Jd=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Xd=ee("eye",Jd);const Zd=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],Qd=ee("file-down",Zd);const eu=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ra=ee("file-text",eu);const tu=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],su=ee("list",tu);const nu=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],st=ee("loader-circle",nu);const ru=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],ou=ee("map-pin",ru);const au=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],iu=ee("plus",au);const cu=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],St=ee("refresh-cw",cu);const lu=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Pn=ee("search",lu);const du=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],oa=ee("server",du);const uu=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],aa=ee("settings-2",uu);const fu=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Lr=ee("sparkles",fu);const hu=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ia=ee("trash-2",hu);const mu=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],pu=ee("trending-down",mu);const gu=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],ca=ee("trending-up",gu);const xu=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Wt=ee("x",xu);function la(e){var t,s,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(s=la(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function bu(){for(var e,t,s=0,n="",r=arguments.length;s<r;s++)(e=arguments[s])&&(t=la(e))&&(n&&(n+=" "),n+=t);return n}const yu=(e,t)=>{const s=new Array(e.length+t.length);for(let n=0;n<e.length;n++)s[n]=e[n];for(let n=0;n<t.length;n++)s[e.length+n]=t[n];return s},vu=(e,t)=>({classGroupId:e,validator:t}),da=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),_s="-",Ir=[],wu="arbitrary..",Su=e=>{const t=Ru(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return ju(i);const c=i.split(_s),l=c[0]===""&&c.length>1?1:0;return ua(c,l,t)},getConflictingClassGroupIds:(i,c)=>{if(c){const l=n[i],u=s[i];return l?u?yu(u,l):l:u||Ir}return s[i]||Ir}}},ua=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const r=e[t],o=s.nextPart.get(r);if(o){const u=ua(e,t+1,o);if(u)return u}const i=s.validators;if(i===null)return;const c=t===0?e.join(_s):e.slice(t).join(_s),l=i.length;for(let u=0;u<l;u++){const f=i[u];if(f.validator(c))return f.classGroupId}},ju=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),s=t.indexOf(":"),n=t.slice(0,s);return n?wu+n:void 0})(),Ru=e=>{const{theme:t,classGroups:s}=e;return Nu(s,t)},Nu=(e,t)=>{const s=da();for(const n in e){const r=e[n];An(r,s,n,t)}return s},An=(e,t,s,n)=>{const r=e.length;for(let o=0;o<r;o++){const i=e[o];Cu(i,t,s,n)}},Cu=(e,t,s,n)=>{if(typeof e=="string"){_u(e,t,s);return}if(typeof e=="function"){ku(e,t,s,n);return}Eu(e,t,s,n)},_u=(e,t,s)=>{const n=e===""?t:fa(t,e);n.classGroupId=s},ku=(e,t,s,n)=>{if(Pu(e)){An(e(n),t,s,n);return}t.validators===null&&(t.validators=[]),t.validators.push(vu(s,e))},Eu=(e,t,s,n)=>{const r=Object.entries(e),o=r.length;for(let i=0;i<o;i++){const[c,l]=r[i];An(l,fa(t,c),s,n)}},fa=(e,t)=>{let s=e;const n=t.split(_s),r=n.length;for(let o=0;o<r;o++){const i=n[o];let c=s.nextPart.get(i);c||(c=da(),s.nextPart.set(i,c)),s=c}return s},Pu=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Au=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=Object.create(null),n=Object.create(null);const r=(o,i)=>{s[o]=i,t++,t>e&&(t=0,n=s,s=Object.create(null))};return{get(o){let i=s[o];if(i!==void 0)return i;if((i=n[o])!==void 0)return r(o,i),i},set(o,i){o in s?s[o]=i:r(o,i)}}},pn="!",Mr=":",Tu=[],Dr=(e,t,s,n,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:n,isExternal:r}),Ou=e=>{const{prefix:t,experimentalParseClassName:s}=e;let n=r=>{const o=[];let i=0,c=0,l=0,u;const f=r.length;for(let g=0;g<f;g++){const b=r[g];if(i===0&&c===0){if(b===Mr){o.push(r.slice(l,g)),l=g+1;continue}if(b==="/"){u=g;continue}}b==="["?i++:b==="]"?i--:b==="("?c++:b===")"&&c--}const d=o.length===0?r:r.slice(l);let h=d,m=!1;d.endsWith(pn)?(h=d.slice(0,-1),m=!0):d.startsWith(pn)&&(h=d.slice(1),m=!0);const p=u&&u>l?u-l:void 0;return Dr(o,m,h,p)};if(t){const r=t+Mr,o=n;n=i=>i.startsWith(r)?o(i.slice(r.length)):Dr(Tu,!1,i,void 0,!0)}if(s){const r=n;n=o=>s({className:o,parseClassName:r})}return n},Lu=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((s,n)=>{t.set(s,1e6+n)}),s=>{const n=[];let r=[];for(let o=0;o<s.length;o++){const i=s[o],c=i[0]==="[",l=t.has(i);c||l?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(i)):r.push(i)}return r.length>0&&(r.sort(),n.push(...r)),n}},Iu=e=>({cache:Au(e.cacheSize),parseClassName:Ou(e),sortModifiers:Lu(e),postfixLookupClassGroupIds:Mu(e),...Su(e)}),Mu=e=>{const t=Object.create(null),s=e.postfixLookupClassGroups;if(s)for(let n=0;n<s.length;n++)t[s[n]]=!0;return t},Du=/\s+/,Fu=(e,t)=>{const{parseClassName:s,getClassGroupId:n,getConflictingClassGroupIds:r,sortModifiers:o,postfixLookupClassGroupIds:i}=t,c=[],l=e.trim().split(Du);let u="";for(let f=l.length-1;f>=0;f-=1){const d=l[f],{isExternal:h,modifiers:m,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:b}=s(d);if(h){u=d+(u.length>0?" "+u:u);continue}let x=!!b,y;if(x){const j=g.substring(0,b);y=n(j);const w=y&&i[y]?n(g):void 0;w&&w!==y&&(y=w,x=!1)}else y=n(g);if(!y){if(!x){u=d+(u.length>0?" "+u:u);continue}if(y=n(g),!y){u=d+(u.length>0?" "+u:u);continue}x=!1}const S=m.length===0?"":m.length===1?m[0]:o(m).join(":"),N=p?S+pn:S,C=N+y;if(c.indexOf(C)>-1)continue;c.push(C);const _=r(y,x);for(let j=0;j<_.length;++j){const w=_[j];c.push(N+w)}u=d+(u.length>0?" "+u:u)}return u},Uu=(...e)=>{let t=0,s,n,r="";for(;t<e.length;)(s=e[t++])&&(n=ha(s))&&(r&&(r+=" "),r+=n);return r},ha=e=>{if(typeof e=="string")return e;let t,s="";for(let n=0;n<e.length;n++)e[n]&&(t=ha(e[n]))&&(s&&(s+=" "),s+=t);return s},$u=(e,...t)=>{let s,n,r,o;const i=l=>{const u=t.reduce((f,d)=>d(f),e());return s=Iu(u),n=s.cache.get,r=s.cache.set,o=c,c(l)},c=l=>{const u=n(l);if(u)return u;const f=Fu(l,s);return r(l,f),f};return o=i,(...l)=>o(Uu(...l))},Bu=[],ce=e=>{const t=s=>s[e]||Bu;return t.isThemeGetter=!0,t},ma=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pa=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zu=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Vu=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Wu=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Hu=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,qu=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Gu=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Be=e=>zu.test(e),q=e=>!!e&&!Number.isNaN(Number(e)),Oe=e=>!!e&&Number.isInteger(Number(e)),en=e=>e.endsWith("%")&&q(e.slice(0,-1)),Me=e=>Vu.test(e),ga=()=>!0,Ku=e=>Wu.test(e)&&!Hu.test(e),Tn=()=>!1,Yu=e=>qu.test(e),Ju=e=>Gu.test(e),Xu=e=>!L(e)&&!M(e),Zu=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Qu=e=>Ge(e,ya,Tn),L=e=>ma.test(e),Je=e=>Ge(e,va,Ku),Fr=e=>Ge(e,cf,q),ef=e=>Ge(e,Sa,ga),tf=e=>Ge(e,wa,Tn),Ur=e=>Ge(e,xa,Tn),sf=e=>Ge(e,ba,Ju),rs=e=>Ge(e,ja,Yu),M=e=>pa.test(e),It=e=>ft(e,va),nf=e=>ft(e,wa),$r=e=>ft(e,xa),rf=e=>ft(e,ya),of=e=>ft(e,ba),os=e=>ft(e,ja,!0),af=e=>ft(e,Sa,!0),Ge=(e,t,s)=>{const n=ma.exec(e);return n?n[1]?t(n[1]):s(n[2]):!1},ft=(e,t,s=!1)=>{const n=pa.exec(e);return n?n[1]?t(n[1]):s:!1},xa=e=>e==="position"||e==="percentage",ba=e=>e==="image"||e==="url",ya=e=>e==="length"||e==="size"||e==="bg-size",va=e=>e==="length",cf=e=>e==="number",wa=e=>e==="family-name",Sa=e=>e==="number"||e==="weight",ja=e=>e==="shadow",lf=()=>{const e=ce("color"),t=ce("font"),s=ce("text"),n=ce("font-weight"),r=ce("tracking"),o=ce("leading"),i=ce("breakpoint"),c=ce("container"),l=ce("spacing"),u=ce("radius"),f=ce("shadow"),d=ce("inset-shadow"),h=ce("text-shadow"),m=ce("drop-shadow"),p=ce("blur"),g=ce("perspective"),b=ce("aspect"),x=ce("ease"),y=ce("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...N(),M,L],_=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],w=()=>[M,L,l],P=()=>[Be,"full","auto",...w()],I=()=>[Oe,"none","subgrid",M,L],k=()=>["auto",{span:["full",Oe,M,L]},Oe,M,L],T=()=>[Oe,"auto",M,L],Z=()=>["auto","min","max","fr",M,L],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...w()],Q=()=>[Be,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],he=()=>[Be,"screen","full","dvw","lvw","svw","min","max","fit",...w()],me=()=>[Be,"screen","full","lh","dvh","lvh","svh","min","max","fit",...w()],O=()=>[e,M,L],R=()=>[...N(),$r,Ur,{position:[M,L]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",rf,Qu,{size:[M,L]}],G=()=>[en,It,Je],W=()=>["","none","full",u,M,L],U=()=>["",q,It,Je],D=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>[q,en,$r,Ur],ie=()=>["","none",p,M,L],le=()=>["none",q,M,L],te=()=>["none",q,M,L],Ce=()=>[q,M,L],Ne=()=>[Be,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Me],breakpoint:[Me],color:[ga],container:[Me],"drop-shadow":[Me],ease:["in","out","in-out"],font:[Xu],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Me],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Me],shadow:[Me],spacing:["px",q],text:[Me],"text-shadow":[Me],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Be,L,M,b]}],container:["container"],"container-type":[{"@container":["","normal","size",M,L]}],"container-named":[Zu],columns:[{columns:[q,L,M,c]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{"inset-s":P(),start:P()}],end:[{"inset-e":P(),end:P()}],"inset-bs":[{"inset-bs":P()}],"inset-be":[{"inset-be":P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[Oe,"auto",M,L]}],basis:[{basis:[Be,"full","auto",c,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[q,Be,"auto","initial","none",L]}],grow:[{grow:["",q,M,L]}],shrink:[{shrink:["",q,M,L]}],order:[{order:[Oe,"first","last","none",M,L]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Z()}],"auto-rows":[{"auto-rows":Z()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mbs:[{mbs:Y()}],mbe:[{mbe:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...he()]}],"min-inline-size":[{"min-inline":["auto",...he()]}],"max-inline-size":[{"max-inline":["none",...he()]}],"block-size":[{block:["auto",...me()]}],"min-block-size":[{"min-block":["auto",...me()]}],"max-block-size":[{"max-block":["none",...me()]}],w:[{w:[c,"screen",...Q()]}],"min-w":[{"min-w":[c,"screen","none",...Q()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[i]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",s,It,Je]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,af,ef]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",en,L]}],"font-family":[{font:[nf,tf,t]}],"font-features":[{"font-features":[L]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,M,L]}],"line-clamp":[{"line-clamp":[q,"none",M,Fr]}],leading:[{leading:[o,...w()]}],"list-image":[{"list-image":["none",M,L]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",M,L]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...D(),"wavy"]}],"text-decoration-thickness":[{decoration:[q,"from-font","auto",M,Je]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[q,"auto",M,L]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"tab-size":[{tab:[Oe,M,L]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",M,L]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",M,L]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Oe,M,L],radial:["",M,L],conic:[Oe,M,L]},of,sf]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:W()}],"rounded-s":[{"rounded-s":W()}],"rounded-e":[{"rounded-e":W()}],"rounded-t":[{"rounded-t":W()}],"rounded-r":[{"rounded-r":W()}],"rounded-b":[{"rounded-b":W()}],"rounded-l":[{"rounded-l":W()}],"rounded-ss":[{"rounded-ss":W()}],"rounded-se":[{"rounded-se":W()}],"rounded-ee":[{"rounded-ee":W()}],"rounded-es":[{"rounded-es":W()}],"rounded-tl":[{"rounded-tl":W()}],"rounded-tr":[{"rounded-tr":W()}],"rounded-br":[{"rounded-br":W()}],"rounded-bl":[{"rounded-bl":W()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-bs":[{"border-bs":U()}],"border-w-be":[{"border-be":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...D(),"hidden","none"]}],"divide-style":[{divide:[...D(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-bs":[{"border-bs":O()}],"border-color-be":[{"border-be":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...D(),"none","hidden"]}],"outline-offset":[{"outline-offset":[q,M,L]}],"outline-w":[{outline:["",q,It,Je]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",f,os,rs]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",d,os,rs]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[q,Je]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",h,os,rs]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[q,M,L]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[q]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[M,L]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[q]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",M,L]}],filter:[{filter:["","none",M,L]}],blur:[{blur:ie()}],brightness:[{brightness:[q,M,L]}],contrast:[{contrast:[q,M,L]}],"drop-shadow":[{"drop-shadow":["","none",m,os,rs]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",q,M,L]}],"hue-rotate":[{"hue-rotate":[q,M,L]}],invert:[{invert:["",q,M,L]}],saturate:[{saturate:[q,M,L]}],sepia:[{sepia:["",q,M,L]}],"backdrop-filter":[{"backdrop-filter":["","none",M,L]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[q,M,L]}],"backdrop-contrast":[{"backdrop-contrast":[q,M,L]}],"backdrop-grayscale":[{"backdrop-grayscale":["",q,M,L]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[q,M,L]}],"backdrop-invert":[{"backdrop-invert":["",q,M,L]}],"backdrop-opacity":[{"backdrop-opacity":[q,M,L]}],"backdrop-saturate":[{"backdrop-saturate":[q,M,L]}],"backdrop-sepia":[{"backdrop-sepia":["",q,M,L]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",M,L]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[q,"initial",M,L]}],ease:[{ease:["linear","initial",x,M,L]}],delay:[{delay:[q,M,L]}],animate:[{animate:["none",y,M,L]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,M,L]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:Ce()}],"skew-x":[{"skew-x":Ce()}],"skew-y":[{"skew-y":Ce()}],transform:[{transform:[M,L,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ne()}],"translate-x":[{"translate-x":Ne()}],"translate-y":[{"translate-y":Ne()}],"translate-z":[{"translate-z":Ne()}],"translate-none":["translate-none"],zoom:[{zoom:[Oe,M,L]}],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",M,L]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":O()}],"scrollbar-track-color":[{"scrollbar-track":O()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",M,L]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[q,It,Je,Fr]}],stroke:[{stroke:["none",...O()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},df=$u(lf);function Ct(...e){return df(bu(e))}function K(e,t="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:2}).format(e)}const de=$.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Ct("rounded-xl border bg-card text-card-foreground shadow",e),...t}));de.displayName="Card";const je=$.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Ct("flex flex-col space-y-1.5 p-6",e),...t}));je.displayName="CardHeader";const Pe=$.forwardRef(({className:e,...t},s)=>a.jsx("h3",{ref:s,className:Ct("font-semibold leading-none tracking-tight",e),...t}));Pe.displayName="CardTitle";const uf=$.forwardRef(({className:e,...t},s)=>a.jsx("p",{ref:s,className:Ct("text-sm text-muted-foreground",e),...t}));uf.displayName="CardDescription";const ue=$.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Ct("p-6 pt-0",e),...t}));ue.displayName="CardContent";const ff=$.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Ct("flex items-center p-6 pt-0",e),...t}));ff.displayName="CardFooter";function ks({status:e,error:t}){const s=e?.action==="connect_source"||e?.state==="not_configured",n=e?.message||t||"CUR status could not be loaded. Verify the cost source, discovery job, and Athena configuration.";return a.jsx("section",{className:"rounded-md border bg-card p-6","aria-live":"polite",children:a.jsxs("div",{className:"flex items-start gap-3",children:[e?.state==="unavailable"||t?a.jsx(dt,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}):a.jsx(ta,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"font-semibold",children:s?"Enable AWS Cost and Usage Reports":"CUR data is not ready"}),a.jsx("p",{className:"mt-1 max-w-3xl text-sm text-muted-foreground",children:n}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs(Ss,{to:s?"/sources":"/cur-discovery",className:"inline-flex items-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground",children:[a.jsx(na,{className:"h-4 w-4"}),s?"Connect AWS source":"Review CUR discovery"]}),!s&&a.jsx(Ss,{to:"/sources",className:"rounded-md border px-3 py-2 text-sm font-medium hover:bg-muted",children:"Cost sources"})]})]})]})})}const oe={getOverview:e=>se.get("/overview",{params:e}).then(t=>t.data),getAccounts:e=>se.get("/accounts",{params:e}).then(t=>t.data),getReports:e=>se.get("/reports",{params:e}).then(t=>t.data),getFilterOptions:e=>se.get("/filter-options",{params:{start:e?.start,end:e?.end,tagKey:e?.filterTagKey,managementAccountId:e?.managementAccountId}}).then(t=>t.data),getTags:e=>se.get("/tags",{params:e}).then(t=>t.data),getDataStatus:e=>se.get("/data-status",{params:e}).then(t=>t.data),getAnalysisStatus:e=>se.get("/analysis/status",{params:e}).then(t=>t.data),getLatestAnalysis:e=>se.get("/analysis/latest",{params:e}).then(t=>t.data.analysis),getAnalysisSchedule:e=>se.get("/analysis/schedule",{params:e}).then(t=>t.data),updateAnalysisSchedule:(e,t)=>se.put("/analysis/schedule",e,{params:t}).then(s=>s.data),getAnalysisReports:e=>se.get("/analysis/reports",{params:e}).then(t=>t.data.reports),removeAnalysisReport:e=>se.delete(`/analysis/reports/${e}`).then(t=>t.data),downloadAnalysisPdf:e=>se.get(`/analysis/reports/${e}/pdf`,{responseType:"blob"}).then(t=>t.data),getSources:()=>se.get("/sources").then(e=>e.data),createSource:e=>se.post("/sources",e).then(t=>t.data),getSourceStatus:e=>se.get(`/sources/${e}/status`).then(t=>t.data),verifySource:e=>se.post(`/sources/${e}/verify`).then(t=>t.data),removeSource:(e,t)=>se.delete(`/sources/${e}`,{data:{deleteAwsResources:t}}).then(s=>s.data),downloadSourceTemplate:e=>se.get(`/sources/${e}/template`,{responseType:"blob"}).then(t=>t.data),getCurDiscovery:e=>se.get("/cur-discovery",{params:e}).then(t=>t.data)},Ra=E.createContext("user"),hf=Ra.Provider,mf=()=>E.useContext(Ra),Na=E.createContext(null);function pf({tenantId:e="default",children:t}){const s=`meyi-cost:selected-management-account:${e||"default"}`,[n,r]=E.useState([]),[o,i]=E.useState(""),[c,l]=E.useState(!0),u=E.useCallback(async()=>{l(!0);try{const m=((await oe.getSources()).sources||[]).filter(p=>!!p.managementAccountId);r(m),i(p=>{const b=window.localStorage.getItem(s)||""||p,x=m.some(y=>y.managementAccountId===b)?b:m[0]?.managementAccountId||"";return x?window.localStorage.setItem(s,x):window.localStorage.removeItem(s),x})}catch{r([]),i("")}finally{l(!1)}},[s]);E.useEffect(()=>{u()},[u]);const f=E.useCallback(h=>{/^\d{12}$/.test(h)&&(window.localStorage.setItem(s,h),i(h))},[s]),d=E.useMemo(()=>({sources:n,managementAccountId:o,loading:c,selectManagementAccount:f,refreshSources:u}),[n,o,c,f,u]);return a.jsx(Na.Provider,{value:d,children:t})}function _t(){const e=E.useContext(Na);if(!e)throw new Error("useCostAccount must be used inside CostAccountProvider");return e}function Is(){const{sources:e,managementAccountId:t,loading:s,selectManagementAccount:n}=_t();return e.length?a.jsxs("label",{className:"flex items-center gap-2",children:[a.jsx(Qo,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"sr-only",children:"Management account"}),a.jsx("select",{"aria-label":"Management account",value:t,onChange:r=>n(r.target.value),disabled:s,className:"max-w-72 rounded-md border bg-background px-3 py-2 text-sm shadow-sm disabled:opacity-50",children:e.map(r=>a.jsxs("option",{value:r.managementAccountId||"",children:["Management account ",r.managementAccountId]},r.connectionId))})]}):null}function gf({points:e,currency:t="USD"}){const[s,n]=E.useState(null);if(!e.length)return a.jsx("p",{className:"py-20 text-center text-sm text-muted-foreground",children:"No trend data for this period."});const r=900,o=260,i=70,c=24,l=22,u=48,f=r-i-c,d=o-l-u,h=Math.max(...e.map(b=>b.value),1),m=e.map((b,x)=>({...b,x:i+(e.length===1?f/2:x*f/(e.length-1)),y:l+d-b.value/h*d})),p=s==null?null:m[s],g=b=>{const x=b.currentTarget.getBoundingClientRect(),y=(b.clientX-x.left)/x.width*r;let S=0;for(let N=1;N<m.length;N+=1)Math.abs(m[N].x-y)<Math.abs(m[S].x-y)&&(S=N);n(S)};return a.jsxs("div",{className:"relative w-full",children:[a.jsxs("svg",{viewBox:`0 0 ${r} ${o}`,className:"h-72 w-full",onMouseMove:g,onMouseLeave:()=>n(null),role:"img","aria-label":"Cost trend line chart",children:[[0,.25,.5,.75,1].map(b=>{const x=l+d*b;return a.jsxs("g",{children:[a.jsx("line",{x1:i,y1:x,x2:r-c,y2:x,stroke:"#d8e0e7",strokeDasharray:"4 4"}),a.jsx("text",{x:i-10,y:x+4,textAnchor:"end",fill:"currentColor",className:"text-[10px] text-muted-foreground",children:K(h*(1-b),t)})]},b)}),a.jsx("line",{x1:i,y1:l+d,x2:r-c,y2:l+d,stroke:"#aebbc5"}),a.jsx("polyline",{points:m.map(b=>`${b.x},${b.y}`).join(" "),fill:"none",stroke:"#1f5f85",strokeWidth:"4",strokeLinejoin:"round",strokeLinecap:"round"}),p&&a.jsx("line",{x1:p.x,y1:l,x2:p.x,y2:l+d,stroke:"#1f5f85",strokeDasharray:"3 4",opacity:"0.45"}),m.map((b,x)=>a.jsxs("g",{children:[a.jsx("circle",{cx:b.x,cy:b.y,r:s===x?7:5,fill:"#1f5f85",stroke:"white",strokeWidth:"2"}),a.jsx("text",{x:b.x,y:o-17,textAnchor:"middle",fill:"currentColor",className:"text-[11px] text-muted-foreground",children:b.label})]},b.key))]}),p&&a.jsxs("div",{className:"pointer-events-none absolute z-20 min-w-44 rounded-lg border bg-popover p-3 text-popover-foreground shadow-xl",style:{left:`${p.x/r*100}%`,top:`${Math.max(p.y/o*100-4,2)}%`,transform:p.x>r*.75?"translate(-100%, -100%)":"translate(-50%, -100%)"},children:[a.jsx("p",{className:"text-xs font-semibold",children:p.label}),a.jsx("p",{className:"mt-1 text-sm font-bold text-primary",children:K(p.value,t)}),p.details?.slice(0,5).map(b=>a.jsxs("div",{className:"mt-1 flex justify-between gap-4 text-xs",children:[a.jsx("span",{className:"max-w-40 truncate text-muted-foreground",children:b.label}),a.jsx("span",{children:K(b.value,t)})]},b.label))]})]})}const Br=e=>e.length>16?`${e.slice(0,14)}...`:e,xf=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t||"USD",notation:"compact",maximumFractionDigits:1}).format(e);function bf({title:e,items:t,currency:s}){const o={top:38,right:18,bottom:72,left:76},i=720-o.left-o.right,c=320-o.top-o.bottom,l=Math.max(...t.map(d=>d.amount),1),u=i/t.length,f=Math.min(56,u*.58);return a.jsxs("svg",{viewBox:"0 0 720 320",className:"h-80 w-full",role:"img","aria-label":`${e} cost bar chart`,children:[[0,.25,.5,.75,1].map(d=>{const h=o.top+c-d*c;return a.jsxs("g",{children:[a.jsx("line",{x1:o.left,y1:h,x2:720-o.right,y2:h,stroke:"currentColor",opacity:d===0?.3:.12,vectorEffect:"non-scaling-stroke"}),a.jsx("text",{x:o.left-12,y:h+4,textAnchor:"end",fill:"currentColor",opacity:"0.7",fontSize:"11",children:xf(l*d,s)})]},d)}),a.jsx("line",{x1:o.left,y1:o.top,x2:o.left,y2:o.top+c,stroke:"currentColor",opacity:"0.3",vectorEffect:"non-scaling-stroke"}),t.map((d,h)=>{const m=o.left+u*h+u/2,p=Math.max(d.amount/l*c,3),g=o.top+c-p;return a.jsxs("g",{tabIndex:0,"aria-label":`${d.label}: ${K(d.amount,s)}`,className:"outline-none focus-visible:opacity-75",children:[a.jsxs("title",{children:[d.label,": ",K(d.amount,s)]}),a.jsx("rect",{x:m-f/2,y:g,width:f,height:p,rx:"4",className:"fill-primary opacity-80 transition-opacity hover:opacity-100"}),a.jsx("text",{x:m,y:Math.max(g-8,16),textAnchor:"middle",fill:"currentColor",fontSize:"11",fontWeight:"600",children:K(d.amount,s)}),a.jsx("text",{x:m,y:278,textAnchor:"middle",fill:"currentColor",opacity:"0.72",fontSize:"11",children:Br(d.label)}),d.accountId&&a.jsx("text",{x:m,y:295,textAnchor:"middle",fill:"currentColor",opacity:"0.55",fontSize:"9",children:Br(d.accountId)})]},d.key||d.label)}),a.jsxs("text",{x:"18",y:o.top+c/2,transform:`rotate(-90 18 ${o.top+c/2})`,textAnchor:"middle",fill:"currentColor",opacity:"0.65",fontSize:"11",children:["Cost (",s,")"]})]})}const Ca="min-h-32 transition-all duration-200 ease-out hover:-translate-y-1 hover:scale-[1.01] hover:border-primary/30 hover:shadow-lg";function tn({title:e,icon:t,items:s,currency:n}){const[r,o]=E.useState("chart"),i=s.slice(0,6),c=Math.max(...i.map(l=>l.amount),1);return a.jsxs(de,{className:"min-w-0",children:[a.jsxs(je,{className:"flex flex-row items-center justify-between gap-3 pb-3",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"text-primary",children:t}),a.jsx(Pe,{className:"truncate text-sm",children:e})]}),a.jsxs("div",{className:"flex rounded-md border p-0.5","aria-label":`${e} view`,children:[a.jsx("button",{type:"button",onClick:()=>o("chart"),"aria-label":`Show ${e} as bar chart`,"aria-pressed":r==="chart",title:"Bar chart",className:`rounded p-1.5 ${r==="chart"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(Id,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:()=>o("list"),"aria-label":`Show ${e} as list`,"aria-pressed":r==="list",title:"List",className:`rounded p-1.5 ${r==="list"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(su,{className:"h-4 w-4"})})]})]}),a.jsx(ue,{children:i.length?r==="chart"?a.jsx(bf,{title:e,items:i,currency:n}):a.jsx("div",{className:"space-y-3",children:i.map(l=>a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[a.jsxs("span",{className:"truncate text-muted-foreground",title:l.label,children:[l.label,l.accountId?a.jsxs("span",{className:"ml-1 text-xs",children:["(",l.accountId,")"]}):null]}),a.jsx("span",{className:"shrink-0 font-medium",children:K(l.amount,n)})]}),a.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:"h-full rounded-full bg-primary/75",style:{width:`${l.amount/c*100}%`}})})]},l.key||l.label))}):a.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No cost data for this period."})})]})}function yf(){return a.jsxs("div",{"aria-live":"polite","aria-busy":"true",className:"contents",children:[a.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:Array.from({length:4},(e,t)=>a.jsxs(de,{className:Ca,children:[a.jsx(je,{className:"pb-2",children:a.jsx("div",{className:"h-3 w-24 animate-pulse rounded bg-muted"})}),a.jsxs(ue,{children:[a.jsx("div",{className:"h-6 w-3/4 animate-pulse rounded bg-muted"}),a.jsx("div",{className:"mt-3 h-3 w-1/2 animate-pulse rounded bg-muted/80"})]})]},t))}),a.jsxs(de,{children:[a.jsx(je,{children:a.jsx("div",{className:"h-4 w-36 animate-pulse rounded bg-muted"})}),a.jsx(ue,{children:a.jsx("div",{className:"h-72 animate-pulse rounded-lg bg-muted/70"})})]}),a.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:Array.from({length:3},(e,t)=>a.jsxs(de,{children:[a.jsx(je,{children:a.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted"})}),a.jsx(ue,{className:"space-y-4",children:Array.from({length:5},(s,n)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("div",{className:"h-3 w-2/5 animate-pulse rounded bg-muted"}),a.jsx("div",{className:"h-3 w-20 animate-pulse rounded bg-muted"})]}),a.jsx("div",{className:"mt-2 h-1.5 animate-pulse rounded bg-muted/80"})]},n))})]},t))})]})}function vf({data:e,period:t,selectedMonth:s}){const n=e.topServices[0],r=e.topAccounts[0],o=new Date,[i,c]=s.split("-").map(Number),l=t==="monthly"?new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(i,c-1,1)):String(o.getFullYear()),u=[{label:"Total cost",value:a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"block",children:K(e.totalCost,e.currency)}),a.jsxs("span",{className:"mt-1 block text-sm font-medium text-muted-foreground",children:["Accounts: ",e.activeAccounts]})]}),helper:l,icon:a.jsx(sa,{})},{label:"Active resources",value:e.activeResources==null?a.jsx("span",{className:"text-sm",title:e.activeResourcesMessage,children:"CUR access required"}):Number(e.activeResources).toLocaleString(),helper:`${l} across all accounts`,icon:a.jsx(Cs,{})},{label:"Highest cost service",value:n?a.jsx("span",{className:"whitespace-pre-line text-sm",children:`Service - ${n.label}
|
|
15
|
+
Cost - ${K(n.amount,e.currency)}`}):"-",helper:l,icon:a.jsx(oa,{})},{label:"Highest cost account",value:r?a.jsx("span",{className:"whitespace-pre-line text-sm",children:`Account Name - ${r.label}
|
|
16
|
+
Account Id - ${r.accountId||r.key||"Unknown"}
|
|
17
|
+
Cost - ${K(r.amount,e.currency)}`}):"-",helper:l,icon:a.jsx(Cs,{})}];return a.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:u.map(f=>a.jsxs(de,{className:Ca,children:[a.jsxs(je,{className:"flex flex-row items-center justify-between pb-2",children:[a.jsx(Pe,{className:"text-xs font-medium text-muted-foreground",children:f.label}),a.jsx("span",{className:"text-muted-foreground [&>svg]:h-4 [&>svg]:w-4",children:f.icon})]}),a.jsxs(ue,{children:[a.jsx("div",{className:"break-words text-base font-semibold leading-snug xl:text-lg",children:f.value}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:f.helper})]})]},f.label))})}function wf(){const e=new Date,t=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`,[s,n]=E.useState(null),[r,o]=E.useState(!0),[i,c]=E.useState(null),[l,u]=E.useState(null),[f,d]=E.useState("monthly"),[h,m]=E.useState(t),{managementAccountId:p,loading:g}=_t(),b=E.useRef(0),x=Array.from({length:e.getMonth()+1},(C,_)=>({value:`${e.getFullYear()}-${String(_+1).padStart(2,"0")}`,label:new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(e.getFullYear(),_,1))})),y=async(C=f,_=h,j=p)=>{const w=++b.current;o(!0),n(null),c(null);try{let P;if(C==="yearly")P={period:C,start:`${e.getFullYear()}-01-01`};else{const[Z,z]=_.split("-").map(Number),J=_===t?e.getDate():new Date(Z,z,0).getDate();P={period:C,start:`${_}-01`,end:`${_}-${String(J).padStart(2,"0")}`}}const I=j?{managementAccountId:j}:void 0,k=await oe.getDataStatus(I);if(w===b.current&&u(k),!k.ready)return;const T=await oe.getOverview({...P,...I});w===b.current&&n(T)}catch(P){w===b.current&&c(P?.response?.data?.error||P.message||"Failed to load AWS costs")}finally{w===b.current&&o(!1)}};return E.useEffect(()=>{g||y(f,h,p)},[f,h,p,g]),{data:s,dataStatus:l,loading:r||g,error:i,period:f,selectedMonth:h,monthOptions:x,changePeriod:C=>{C!==f&&(o(!0),n(null),d(C))},changeMonth:C=>{C===h||!x.some(_=>_.value===C)||(o(!0),n(null),m(C))},refresh:()=>y(f,h,p)}}function Sf(){const{data:e,dataStatus:t,loading:s,error:n,period:r,selectedMonth:o,monthOptions:i,changePeriod:c,changeMonth:l,refresh:u}=wf();return a.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(sa,{className:"h-6 w-6 text-primary"}),"Cloud Cost Management"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Costs for the selected AWS management account and its member accounts"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(Is,{}),r==="monthly"&&a.jsx("select",{"aria-label":"Cost month",value:o,onChange:f=>l(f.target.value),disabled:s,className:"rounded-lg border bg-background px-3 py-2 text-sm shadow-sm disabled:opacity-50",children:i.map(f=>a.jsx("option",{value:f.value,children:f.label},f.value))}),a.jsx("div",{className:"flex rounded-lg border p-1",children:["monthly","yearly"].map(f=>a.jsx("button",{onClick:()=>c(f),className:`rounded-md px-3 py-1.5 text-sm capitalize transition-colors ${r===f?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:f},f))}),a.jsx("button",{onClick:()=>{u()},disabled:s,className:"rounded-lg border p-2 hover:bg-muted",children:a.jsx(St,{className:`h-4 w-4 ${s?"animate-spin":""}`})})]})]}),n&&e&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(dt,{className:"h-4 w-4"}),n]}),s?a.jsx(yf,{}):t&&!t.ready?a.jsx(ks,{status:t}):n&&!e?a.jsx(ks,{status:t,error:n}):e?a.jsxs(a.Fragment,{children:[e.dataSource&&a.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[a.jsx("span",{children:"Source: AWS CUR via SaaS Athena - gross positive unblended charges"}),a.jsxs("span",{children:["CUR: Ready",t?.lastDataAt?`, updated ${new Date(t.lastDataAt).toLocaleString()}`:""]})]}),a.jsx(vf,{data:e,period:r,selectedMonth:o}),e.message&&!/historical data beyond 14 months/i.test(e.message)&&a.jsx(de,{children:a.jsx(ue,{className:"py-8 text-center text-sm text-muted-foreground",children:e.message})}),a.jsxs(de,{children:[a.jsxs(je,{className:"flex flex-row items-center gap-2",children:[a.jsx(ca,{className:"h-4 w-4 text-primary"}),a.jsxs(Pe,{className:"text-sm",children:["Cost Trend - ",r==="monthly"?"Monthly":"Yearly"]})]}),a.jsx(ue,{children:a.jsx(gf,{points:e.trends.map(f=>({key:f.month,label:r==="yearly"?f.month.slice(0,4):new Date(`${f.month}T00:00:00Z`).toLocaleDateString(void 0,{month:"short",year:"2-digit"}),value:f.amount})),currency:e.currency})})]}),a.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[a.jsx(tn,{title:"Top services",icon:a.jsx(oa,{className:"h-4 w-4"}),items:e.topServices,currency:e.currency}),a.jsx(tn,{title:"AWS accounts",icon:a.jsx(Qo,{className:"h-4 w-4"}),items:e.topAccounts,currency:e.currency}),a.jsx(tn,{title:"Regional distribution",icon:a.jsx(ou,{className:"h-4 w-4"}),items:e.topRegions,currency:e.currency})]})]}):null]})}const as=["#6264e9","#eb67ad","#31c39a","#f29a05","#579bea","#9078ed","#f7842c","#24b9ad","#8ac926","#ffca3a","#6a4c93","#1982c4"];function zr(e,t){const s=new Date(e.length===10?`${e}T00:00:00Z`:e);return Number.isFinite(s.getTime())?s.toLocaleDateString(void 0,t?{month:"short",day:"numeric",year:"numeric"}:{month:"short",year:"numeric"}):e}function jf({timeline:e,currency:t="USD",daily:s=!1}){const[n,r]=E.useState(null),[o,i]=E.useState(null),c=E.useMemo(()=>{const h=new Map;for(const m of e)for(const p of m.groups)h.set(p.label,(h.get(p.label)||0)+p.amount);return[...h.entries()].sort((m,p)=>p[1]-m[1]).map(([m],p)=>({label:m,color:as[p%as.length]}))},[e]),l=new Map(c.map(h=>[h.label,h.color])),u=Math.max(...e.map(h=>h.total),1),f=n??o,d=f==null?null:e[f];return e.length?a.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_288px]",onMouseLeave:()=>r(null),children:[a.jsxs("div",{children:[a.jsxs("div",{className:"grid min-h-80 grid-cols-[64px_1fr] gap-3",children:[a.jsx("div",{className:"flex h-64 flex-col justify-between pb-1 text-right text-[11px] text-muted-foreground",children:[1,.75,.5,.25,0].map(h=>a.jsx("span",{children:K(u*h,t)},h))}),a.jsxs("div",{children:[a.jsxs("div",{className:"relative flex h-64 items-end justify-around border-b px-4",children:[[0,25,50,75].map(h=>a.jsx("span",{className:"pointer-events-none absolute left-0 right-0 border-t border-dashed border-slate-200",style:{top:`${h}%`}},h)),e.map((h,m)=>a.jsx("button",{type:"button",onMouseEnter:()=>r(m),onMouseLeave:()=>r(null),onPointerDown:p=>p.preventDefault(),onFocus:()=>i(m),onBlur:()=>i(null),className:"group z-10 flex h-full min-w-10 flex-1 items-end justify-center px-2 outline-none focus-visible:ring-2 focus-visible:ring-primary",children:a.jsx("span",{className:"flex w-full max-w-16 flex-col-reverse overflow-hidden rounded-t-sm shadow-sm transition group-hover:brightness-95",style:{height:`${Math.max(h.total/u*100,1)}%`},children:h.groups.map(p=>a.jsx("span",{style:{backgroundColor:l.get(p.label)||as[0],height:`${h.total?p.amount/h.total*100:0}%`}},p.key||p.label))})},`${h.start}-${m}`))]}),a.jsx("div",{className:"flex justify-around px-4 pt-2",children:e.map((h,m)=>a.jsx("span",{className:"min-w-10 flex-1 text-center text-[11px] text-muted-foreground",children:zr(h.start,s)},`${h.start}-label-${m}`))})]})]}),a.jsxs("div",{className:"mt-5 flex flex-wrap gap-x-4 gap-y-2",children:[c.slice(0,8).map(h=>a.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[a.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:h.color}}),h.label]},h.label)),c.length>8&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",c.length-8," more"]})]})]}),a.jsx("aside",{"aria-live":"polite",className:"min-h-44",children:d?a.jsxs("div",{role:"tooltip",className:"rounded-2xl border bg-popover p-4 text-popover-foreground shadow-lg",children:[a.jsx("p",{className:"font-semibold",children:zr(d.start,s)}),a.jsxs("div",{className:"mt-3 space-y-2",children:[[...d.groups].sort((h,m)=>m.amount-h.amount).slice(0,5).map(h=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:l.get(h.label)||as[0]}}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:h.label}),a.jsx("strong",{children:K(h.amount,t)})]},h.key||h.label)),d.groups.length>5&&a.jsxs("p",{className:"text-xs italic text-muted-foreground",children:["+ ",d.groups.length-5," others"]})]}),a.jsxs("div",{className:"mt-3 flex justify-between border-t pt-3 text-sm",children:[a.jsx("strong",{children:"Total"}),a.jsx("strong",{className:"text-primary",children:K(d.total,t)})]})]}):a.jsx("div",{className:"flex min-h-44 items-center justify-center rounded-2xl border border-dashed p-4 text-center text-xs text-muted-foreground",children:"Hover over a bar to view its cost details."})})]}):a.jsx("p",{className:"py-24 text-center text-sm text-muted-foreground",children:"No trend data for this period."})}function Rf({rows:e,currency:t}){const s=e.slice(0,8),n=Math.max(1,...s.flatMap(r=>[r.current?.amount||0,r.previous?.amount||0]));return a.jsxs(de,{className:"bg-primary/5",children:[a.jsx(je,{children:a.jsx(Pe,{className:"text-sm",children:"Comparison Overview"})}),a.jsx(ue,{children:a.jsxs("div",{className:"rounded-xl border bg-card p-5",children:[a.jsx("div",{className:"flex h-72 items-end gap-4 border-b border-l px-4 pt-4",children:s.map(r=>a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-center",children:[a.jsxs("div",{className:"flex h-56 w-full items-end justify-center gap-1",children:[a.jsx("div",{title:`Current: ${K(r.current?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-indigo-500",style:{height:`${Math.max((r.current?.amount||0)/n*100,r.current?.amount?1:0)}%`}}),a.jsx("div",{title:`Previous: ${K(r.previous?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-pink-400",style:{height:`${Math.max((r.previous?.amount||0)/n*100,r.previous?.amount?1:0)}%`}})]}),a.jsx("span",{title:r.label,className:"mt-2 w-full truncate text-center text-[10px] text-muted-foreground",children:r.label})]},r.key))}),a.jsxs("div",{className:"mt-4 flex gap-5 text-xs",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("i",{className:"h-2.5 w-2.5 rounded-full bg-indigo-500"}),"Current Period"]}),a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("i",{className:"h-2.5 w-2.5 rounded-full bg-pink-400"}),"Previous Period"]})]})]})})]})}function Ie({label:e,value:t,helper:s,accent:n=!1,trend:r}){return a.jsxs("div",{className:"rounded-xl border bg-card p-5 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[r!=null&&(r<0?a.jsx(pu,{className:"h-4 w-4 text-red-500"}):a.jsx(ca,{className:"h-4 w-4 text-emerald-500"})),a.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:e})]}),a.jsx("p",{className:`mt-2 text-2xl font-bold ${n?"text-primary":r!=null&&r<0?"text-red-500":""}`,children:t}),s&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s})]})}function is({label:e,options:t,selected:s,onChange:n}){const r=s.length?`${s.length} selected`:e;return a.jsxs("details",{className:"group relative",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between rounded-lg border bg-background px-3 py-3 text-sm text-primary",children:[a.jsx("span",{children:r}),a.jsx(Dd,{className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),a.jsx("div",{className:"absolute z-30 mt-1 max-h-64 w-full overflow-auto rounded-lg border bg-popover p-2 shadow-xl",children:t.length?t.map(o=>a.jsxs("label",{className:"flex cursor-pointer items-start gap-2 rounded px-2 py-2 text-xs hover:bg-muted",children:[a.jsx("input",{type:"checkbox",checked:s.includes(o.value),onChange:i=>n(i.target.checked?[...s,o.value]:s.filter(c=>c!==o.value))}),a.jsx("span",{className:"min-w-0 break-words",children:o.label})]},o.value)):a.jsx("p",{className:"p-2 text-xs text-muted-foreground",children:"No values available."})})]})}function Nf(){return a.jsxs("div",{"aria-live":"polite","aria-busy":"true",className:"space-y-5",children:[a.jsxs("section",{className:"rounded-xl bg-primary/5 p-5",children:[a.jsxs("div",{className:"flex items-center gap-3 text-sm font-medium text-primary",children:[a.jsx(st,{className:"h-5 w-5 animate-spin"}),"Loading live AWS cost report..."]}),a.jsx("div",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[1,2,3].map(e=>a.jsx("div",{className:"h-28 animate-pulse rounded-xl border bg-card/70"},e))})]}),a.jsx("div",{className:"h-80 animate-pulse rounded-xl border bg-muted/40"}),a.jsx("div",{className:"h-64 animate-pulse rounded-xl border bg-muted/40"})]})}const qe=10,gn=new Date,Cf=new Date(Date.UTC(gn.getUTCFullYear(),gn.getUTCMonth()-2,1)).toISOString().slice(0,10),_f=gn.toISOString().slice(0,10),Mt={services:[],regions:[],accountIds:[],tagKey:"",tagValues:[]},it={service:{tab:"Services",title:"Service Cost Summary",pdfTitle:"Service Cost Report",top:"Top service cost",count:"Service count",item:"Service",empty:"No service cost data found."},account:{tab:"Accounts",title:"Account Cost Summary",pdfTitle:"Account Cost Report",top:"Top account cost",count:"Account count",item:"Linked account",empty:"No linked account cost data found."},region:{tab:"Regions",title:"Regional Cost Summary",pdfTitle:"Region Cost Report",top:"Top region cost",count:"Region count",item:"Region",empty:"No regional cost data found."},resource:{tab:"Resources",title:"Resource Cost Summary",pdfTitle:"Resource Cost Report",top:"Top resource cost",count:"Resource count",item:"Resource",empty:"Resource-level cost data requires resource IDs in the CUR export."},tag:{tab:"Tags",title:"Tag Cost Summary",pdfTitle:"Tag Cost Report",top:"Top tag value cost",count:"Tag value count",item:"Tag value",empty:"No cost allocation tag data found."}};function Vr(e){return e?new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"longOffset"}).format(new Date(e)).replace("GMT","UTC"):"Not updated yet"}function Wr(e,t){const s=new Date(`${e}T00:00:00Z`);if(t==="monthly"){const r=new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),0)),o=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),1)),i=new Date(o);i.setUTCDate(i.getUTCDate()-1);const c=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1));return{currentStart:o.toISOString().slice(0,10),currentEnd:r.toISOString().slice(0,10),previousStart:c.toISOString().slice(0,10),previousEnd:i.toISOString().slice(0,10)}}const n=new Date(s);return n.setUTCDate(n.getUTCDate()-1),{currentStart:e,currentEnd:e,previousStart:n.toISOString().slice(0,10),previousEnd:n.toISOString().slice(0,10)}}function jt(e,t,s){const n=new Date(`${e}T00:00:00Z`),r=new Date(`${t}T00:00:00Z`);if(s==="monthly"&&n.getUTCFullYear()===r.getUTCFullYear()&&n.getUTCMonth()===r.getUTCMonth())return new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"}).format(n);const o=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"});return`${o.format(n)} – ${o.format(r)}`}function kf(e){const t=new Map;return e.current.summary.forEach(s=>t.set(s.key||s.label,{current:s})),e.previous.summary.forEach(s=>{const n=s.key||s.label;t.set(n,{...t.get(n),previous:s})}),[...t.entries()].map(([s,n])=>{const r=n.current?.amount||0,o=n.previous?.amount||0,i=r-o;return{key:s,label:n.current?.label||n.previous?.label||s,...n,difference:i,change:o?i/Math.abs(o)*100:0}}).sort((s,n)=>Math.max(n.current?.amount||0,n.previous?.amount||0)-Math.max(s.current?.amount||0,s.previous?.amount||0))}function Xe(e){return e?.length?e.map(t=>`${t.label}
|
|
18
18
|
${K(t.amount,"USD")}`).join(`
|
|
19
|
-
`):"—"}function Vn({values:e}){const[t,s]=k.useState(!1);return a.jsxs("div",{className:"relative",children:[a.jsxs("button",{type:"button",onClick:()=>s(r=>!r),className:"inline-flex items-center gap-2 text-primary",children:[a.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-1 text-xs font-semibold",children:e.length}),a.jsx("span",{children:"›"})]}),t&&a.jsxs("div",{className:"absolute right-0 top-8 z-20 w-72 rounded-lg border bg-popover p-3 shadow-xl",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsx("strong",{className:"text-xs",children:"Cost distribution"}),a.jsx("button",{onClick:()=>s(!1),children:a.jsx(Os,{className:"h-3.5 w-3.5"})})]}),e.length?e.map(r=>a.jsxs("div",{className:"flex justify-between gap-3 border-t py-2 text-xs",children:[a.jsx("span",{className:"min-w-0 truncate",title:r.label,children:r.label}),a.jsx("strong",{children:K(r.amount,"USD")})]},r.key)):a.jsx("p",{className:"text-xs text-muted-foreground",children:"No related values."})]})]})}function wa({page:e,pages:t,total:s,onChange:r}){const n=s?(e-1)*qe+1:0,o=Math.min(e*qe,s);return a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t px-4 py-4 text-xs text-muted-foreground",children:[a.jsxs("span",{children:["Showing ",n,"–",o," of ",s]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{"aria-label":"Previous page",disabled:e<=1,onClick:()=>r(e-1),className:"rounded-md border p-1.5 disabled:opacity-40",children:a.jsx(Id,{className:"h-4 w-4"})}),a.jsxs("span",{children:["Page ",e," of ",t]}),a.jsx("button",{"aria-label":"Next page",disabled:e>=t,onClick:()=>r(e+1),className:"rounded-md border p-1.5 disabled:opacity-40",children:a.jsx(Dd,{className:"h-4 w-4"})})]})]})}function Rf({groupBy:e,report:t}){const[s,r]=k.useState(""),[n,o]=k.useState(1),[i,c]=k.useState(null),[l,d]=k.useState({percentage:!0,accounts:!0,regions:!0}),f=at[e],u=k.useMemo(()=>{const p=s.trim().toLowerCase();return p?t.summary.filter(x=>`${x.label} ${x.accountId||""}`.toLowerCase().includes(p)):t.summary},[t,s]),h=Math.max(1,Math.ceil(u.length/qe)),m=u.slice((n-1)*qe,n*qe),g=3+Number(l.percentage)+Number(l.accounts)+Number(l.regions);return k.useEffect(()=>{o(1)},[t,s,e]),a.jsxs(ce,{children:[a.jsxs(ve,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Ne,{className:"text-sm text-primary",children:"Cost and usage breakdown"}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs("label",{className:"flex items-center gap-2 rounded-full border bg-background px-4 py-2 text-sm",children:[a.jsx(_r,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search breakdown",value:s,onChange:p=>r(p.target.value),placeholder:"Search...",className:"w-48 bg-transparent outline-none"})]}),a.jsxs("details",{className:"relative",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 rounded-md border px-3 py-2 text-sm text-primary",children:[a.jsx(ra,{className:"h-4 w-4"}),"Column visibility"]}),a.jsx("div",{className:"absolute right-0 z-20 mt-1 w-48 rounded-md border bg-popover p-3 shadow-xl",children:Object.entries(l).map(([p,x])=>a.jsxs("label",{className:"flex gap-2 py-1 text-xs capitalize",children:[a.jsx("input",{type:"checkbox",checked:x,onChange:b=>d(y=>({...y,[p]:b.target.checked}))}),p]},p))})]})]})]}),a.jsx(le,{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-primary/5 text-left text-xs uppercase text-primary",children:[a.jsx("th",{className:"px-4 py-4",children:f.item}),a.jsx("th",{className:"px-4",children:"Cost"}),l.percentage&&a.jsx("th",{className:"px-4",children:"Percentage"}),l.accounts&&a.jsx("th",{className:"px-4",children:"Accounts"}),l.regions&&a.jsx("th",{className:"px-4",children:"Regions"}),a.jsx("th",{className:"px-4 text-center",children:"Actions"})]})}),a.jsx("tbody",{children:m.length?m.map(p=>a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsxs("td",{className:"max-w-72 px-4 py-4 font-medium",children:[a.jsx("div",{className:"truncate",title:p.label,children:p.label}),e==="account"&&a.jsx("div",{className:"font-mono text-xs text-muted-foreground",children:p.accountId||p.key})]}),a.jsx("td",{className:"px-4 font-semibold",children:K(p.amount,t.currency)}),l.percentage&&a.jsxs("td",{className:"px-4",children:[a.jsx("span",{className:"mr-2 inline-block h-1.5 w-12 overflow-hidden rounded-full bg-primary/15 align-middle",children:a.jsx("span",{className:"block h-full bg-primary",style:{width:`${Math.min(p.percentage||0,100)}%`}})}),a.jsxs("strong",{className:"text-primary",children:[p.percentage?.toFixed(2),"%"]})]}),l.accounts&&a.jsx("td",{className:"px-4",children:a.jsx(Vn,{values:p.accounts||[]})}),l.regions&&a.jsx("td",{className:"px-4",children:a.jsx(Vn,{values:p.regions||[]})}),a.jsx("td",{className:"px-4 text-center",children:a.jsx("button",{type:"button",onClick:()=>c(p),title:"View cost details",className:"text-primary hover:opacity-70",children:a.jsx(Gd,{className:"h-4 w-4"})})})]},p.key||p.label)):a.jsx("tr",{children:a.jsx("td",{colSpan:g,className:"py-12 text-center text-muted-foreground",children:f.empty})})})]})}),a.jsx(wa,{page:n,pages:h,total:u.length,onChange:o}),i&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",onClick:()=>c(null),children:a.jsxs("div",{className:"max-h-[80vh] w-full max-w-2xl overflow-auto rounded-xl bg-card p-6 shadow-2xl",onClick:p=>p.stopPropagation(),children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs uppercase text-muted-foreground",children:f.item}),a.jsx("h3",{className:"mt-1 text-lg font-semibold",children:i.label})]}),a.jsx("button",{onClick:()=>c(null),children:a.jsx(Os,{})})]}),a.jsxs("div",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[a.jsx(Le,{label:"Cost",value:K(i.amount,t.currency)}),a.jsx(Le,{label:"Accounts",value:String(i.accounts?.length||0)}),a.jsx(Le,{label:"Regions",value:String(i.regions?.length||0)})]}),a.jsxs("div",{className:"mt-5 grid gap-5 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"mb-2 text-sm font-semibold",children:"Accounts"}),(i.accounts||[]).map(p=>a.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[a.jsx("span",{children:p.label}),a.jsx("strong",{children:K(p.amount,t.currency)})]},p.key))]}),a.jsxs("div",{children:[a.jsx("h4",{className:"mb-2 text-sm font-semibold",children:"Regions"}),(i.regions||[]).map(p=>a.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[a.jsx("span",{children:p.label}),a.jsx("strong",{children:K(p.amount,t.currency)})]},p.key))]})]})]})})]})}function jf({rows:e,groupBy:t,comparison:s,granularity:r}){const[n,o]=k.useState(""),[i,c]=k.useState(1),l=k.useMemo(()=>{const m=n.trim().toLowerCase();return m?e.filter(g=>g.label.toLowerCase().includes(m)):e},[e,n]),d=Math.max(1,Math.ceil(l.length/qe)),f=l.slice((i-1)*qe,i*qe),u=Rt(s.currentStart,s.currentEnd,r),h=Rt(s.previousStart,s.previousEnd,r);return k.useEffect(()=>{c(1)},[n,t,s]),a.jsxs(ce,{children:[a.jsxs(ve,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Ne,{className:"text-sm text-primary",children:"Comparison Details"}),a.jsxs("label",{className:"flex items-center gap-2 rounded-full border bg-background px-4 py-2 text-sm",children:[a.jsx(_r,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search comparison",value:n,onChange:m=>o(m.target.value),placeholder:"Search...",className:"w-48 bg-transparent outline-none"})]})]}),a.jsx(le,{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-primary/5 text-left text-xs uppercase text-primary",children:[a.jsxs("th",{className:"px-4 py-4",children:[at[t].item," name"]}),a.jsxs("th",{className:"px-4",children:[u,a.jsx("small",{className:"block font-normal",children:"Cost"})]}),a.jsxs("th",{className:"px-4",children:[h,a.jsx("small",{className:"block font-normal",children:"Cost"})]}),a.jsx("th",{className:"px-4",children:"Difference"}),a.jsx("th",{className:"px-4",children:"Change %"})]})}),a.jsx("tbody",{children:f.length?f.map(m=>a.jsxs("tr",{className:"border-b",children:[a.jsx("td",{className:"max-w-80 px-4 py-4 font-medium",children:a.jsx("div",{className:"truncate",title:m.label,children:m.label})}),a.jsx("td",{className:"px-4",children:K(m.current?.amount||0,s.current.currency)}),a.jsx("td",{className:"px-4",children:K(m.previous?.amount||0,s.previous.currency)}),a.jsxs("td",{className:`px-4 font-medium ${m.difference<0?"text-red-500":"text-emerald-600"}`,children:[m.difference>=0?"+":"",K(m.difference,s.current.currency)]}),a.jsxs("td",{className:`px-4 font-medium ${m.change<0?"text-red-500":m.change>0?"text-emerald-600":"text-muted-foreground"}`,children:[m.change>0?"+":"",m.change.toFixed(1),"%"]})]},m.key)):a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"py-12 text-center text-muted-foreground",children:"No comparison data found."})})})]})}),a.jsx(wa,{page:i,pages:d,total:l.length,onChange:c})]})}function Nf(e){const{mode:t,groupBy:s,start:r,end:n,granularity:o,reportTagKey:i,options:c,filters:l,loading:d,filtersLoading:f,comparisonPeriods:u}=e;return a.jsxs("aside",{className:"space-y-4",children:[a.jsxs(ce,{className:"bg-primary/5",children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm uppercase text-primary",children:"Report parameters"})}),a.jsxs(le,{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>e.onModeChange("standard"),className:`rounded-md px-4 py-2 text-xs font-semibold ${t==="standard"?"bg-primary text-primary-foreground":"border text-primary"}`,children:"Standard"}),a.jsx("button",{onClick:()=>e.onModeChange("compare"),className:`rounded-md px-4 py-2 text-xs font-semibold ${t==="compare"?"bg-primary text-primary-foreground":"border text-primary"}`,children:"Compare"})]}),t==="standard"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Start date",a.jsx("input",{type:"date",value:r,onChange:h=>e.onStartChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground"})]}),a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["End date",a.jsx("input",{type:"date",value:n,onChange:h=>e.onEndChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground"})]})]}),a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Granularity",a.jsxs("select",{value:o,onChange:h=>e.onGranularityChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground",children:[a.jsx("option",{value:"monthly",children:"Monthly"}),a.jsx("option",{value:"daily",children:"Daily"})]})]}),t==="compare"&&a.jsxs("p",{className:"rounded-md bg-background p-2 text-xs text-muted-foreground",children:["Current: ",u.currentStart," to ",u.currentEnd,a.jsx("br",{}),"Previous: ",u.previousStart," to ",u.previousEnd]}),s==="tag"&&a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Group by tag key",a.jsx("select",{value:i,onChange:h=>e.onReportTagKeyChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground",children:c.tagKeys.map(h=>a.jsx("option",{children:h},h))})]}),a.jsxs("button",{onClick:e.onRun,disabled:d,className:"flex w-full items-center justify-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:[a.jsx(St,{className:`h-4 w-4 ${d?"animate-spin":""}`}),"Run report"]})]})]}),a.jsxs(ce,{className:"bg-primary/5",children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm uppercase text-primary",children:"Filter by"})}),a.jsxs(le,{className:"space-y-3",children:[a.jsx(ns,{label:"Services",options:c.services,selected:l.services,onChange:h=>e.onFiltersChange(m=>({...m,services:h}))}),a.jsx(ns,{label:"Region",options:c.regions,selected:l.regions,onChange:h=>e.onFiltersChange(m=>({...m,regions:h}))}),a.jsx(ns,{label:"Linked Account",options:c.accounts,selected:l.accountIds,onChange:h=>e.onFiltersChange(m=>({...m,accountIds:h}))}),a.jsxs("select",{value:l.tagKey,onChange:h=>{const m=h.target.value;e.onFiltersChange(g=>({...g,tagKey:m,tagValues:[]})),m&&e.onLoadTagValues(m)},className:"w-full rounded-lg border bg-background px-3 py-3 text-sm text-primary",children:[a.jsx("option",{value:"",children:"Tag key"}),c.tagKeys.map(h=>a.jsx("option",{children:h},h))]}),l.tagKey&&a.jsx(ns,{label:"Tag values",options:c.tagValues.map(h=>({value:h,label:h})),selected:l.tagValues,onChange:h=>e.onFiltersChange(m=>({...m,tagValues:h}))}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[a.jsx("button",{onClick:e.onApply,disabled:f||d,className:"rounded-md bg-primary px-3 py-2 text-sm font-semibold text-primary-foreground disabled:opacity-50",children:"Apply Filters"}),a.jsx("button",{onClick:e.onReset,disabled:d,className:"rounded-md border bg-background px-3 py-2 text-sm text-primary disabled:opacity-50",children:"Reset"})]})]})]})]})}function Cf(){const[e,t]=k.useState("service"),[s,r]=k.useState("standard"),[n,o]=k.useState(vf),[i,c]=k.useState(wf),[l,d]=k.useState("monthly"),[f,u]=k.useState("Name"),[h,m]=k.useState({services:[],regions:[],accounts:[],tagKeys:[],tagValues:[]}),[g,p]=k.useState(It),[x,b]=k.useState(It),[y,R]=k.useState(null),[w,_]=k.useState(null),[N,j]=k.useState(!0),[S,E]=k.useState(!1),[D,T]=k.useState(null),[F,ee]=k.useState(null),z=k.useRef(0),X=k.useMemo(()=>w?Sf(w):[],[w]),Z=zn(i,l),Y=(I,M,$,J)=>({start:M,end:$,groupBy:J,granularity:l,tagKey:f,services:I.services.join(","),regions:I.regions.join(","),accountIds:I.accountIds.join(","),filterTagKey:I.tagKey||void 0,tagValues:I.tagValues.join(",")}),de=async(I="")=>{E(!0);try{const M=F||await ae.getDataStatus();if(ee(M),!M.ready)return;const $=await ae.getFilterOptions({start:n,end:i,filterTagKey:I||void 0});m(J=>I?{...J,tagValues:$.tagValues}:$),!I&&$.tagKeys.length&&!$.tagKeys.includes(f)&&u($.tagKeys[0])}catch(M){T(M?.response?.data?.error||M.message||"Failed to load filter values")}finally{E(!1)}},fe=async(I=x,M=s,$=e)=>{const J=++z.current;j(!0),T(null),R(null),_(null);try{const G=await ae.getDataStatus();if(J===z.current&&ee(G),!G.ready)return;if(M==="compare"){const ue=zn(i,l),[be,ne]=await Promise.all([ae.getReports(Y(I,ue.currentStart,ue.currentEnd,$)),ae.getReports(Y(I,ue.previousStart,ue.previousEnd,$))]);J===z.current&&(R(be),_({current:be,previous:ne,...ue}))}else{const ue=await ae.getReports(Y(I,n,i,$));J===z.current&&R(ue)}}catch(G){J===z.current&&T(G?.response?.data?.error||G.message||"Failed to generate cost report")}finally{J===z.current&&j(!1)}};return k.useEffect(()=>{fe(x,s,e)},[e,s]),k.useEffect(()=>{de()},[]),{groupBy:e,mode:s,start:n,end:i,granularity:l,reportTagKey:f,options:h,draftFilters:g,report:y,comparison:w,loading:N,filtersLoading:S,error:D,dataStatus:F,comparedRows:X,selectedComparisonPeriods:Z,setStart:o,setEnd:c,setGranularity:d,setReportTagKey:u,setDraftFilters:p,changeGroup:I=>{I!==e&&(j(!0),R(null),_(null),t(I))},changeMode:I=>{I!==s&&(j(!0),R(null),_(null),r(I))},applyFilters:()=>{const I={...g,services:[...g.services],regions:[...g.regions],accountIds:[...g.accountIds],tagValues:[...g.tagValues]};b(I),fe(I)},resetFilters:()=>{p(It),b(It),fe(It)},runReport:()=>{de(),fe()},loadOptions:de}}function _f(e){const{report:t,comparison:s,rows:r,groupBy:n,mode:o,start:i,end:c}=e,l=at[n];let d,f;o==="compare"&&s?(d=[[l.item,"Current Cost","Previous Cost","Difference","Change %"].join(","),...r.map(h=>[`"${h.label.replace(/"/g,'""')}"`,h.current?.amount||0,h.previous?.amount||0,h.difference,h.change.toFixed(2)].join(","))].join(`
|
|
20
|
-
`),f=`comparison-report-${
|
|
21
|
-
`),f=`${n}-summary-report-${Date.now()}.csv`);const u=document.createElement("a");u.href=URL.createObjectURL(new Blob([d],{type:"text/csv"})),u.download=f,u.click(),URL.revokeObjectURL(u.href)}async function kf(e){const{report:t,comparison:s,rows:r,groupBy:n,mode:o,start:i,end:c,granularity:l}=e,d=at[n],[{jsPDF:f},{default:u}]=await Promise.all([Promise.resolve().then(()=>require("./jspdf.es.min-C10id8ME.cjs")).then(p=>p.jspdf_es_min),Promise.resolve().then(()=>require("./jspdf.plugin.autotable-CvTok6mL.cjs"))]),h=new f({orientation:"landscape",unit:"pt",format:"a4"}),m=(p,x,b)=>{h.setFontSize(7),h.setTextColor(100),h.text(`Report generated · All costs in ${t.currency} · ${x} to ${b}`,40,h.internal.pageSize.height-18),h.text(`Page ${p.pageNumber}`,h.internal.pageSize.width-70,h.internal.pageSize.height-18)};if(o==="compare"&&s){h.setFontSize(18),h.setTextColor(25),h.text("Comparison Report",40,42),h.setFontSize(9),h.setTextColor(98,86,230),h.text("TOTAL COST",40,66),h.setTextColor(40),h.text(`Previous Cost: ${s.previous.totalCost}`,40,82),h.text(`Current Cost: ${s.current.totalCost}`,220,82),h.text(`Granularity: ${l}`,400,82),u(h,{startY:100,head:[[`${d.item} Name`,"Current Cost","Previous Cost","Current Period","Previous Period","Change %","Current Accounts","Previous Accounts","Current Regions","Previous Regions"]],body:r.map(p=>[p.label,p.current?.amount?.toFixed(2)||"0.00",p.previous?.amount?.toFixed(2)||"0.00",Rt(s.currentStart,s.currentEnd,l),Rt(s.previousStart,s.previousEnd,l),`${p.change.toFixed(4)}%`,Xe(p.current?.accounts),Xe(p.previous?.accounts),Xe(p.current?.regions),Xe(p.previous?.regions)]),styles:{fontSize:6,cellPadding:3,overflow:"linebreak"},headStyles:{fillColor:[242,237,255],textColor:[82,35,190]},didDrawPage:p=>m(p,s.previousStart,s.currentEnd),margin:{bottom:32}}),h.save(`comparison-report-${n}-${Date.now()}.pdf`);return}h.setFontSize(18),h.setTextColor(25),h.text(d.pdfTitle,40,42),h.setFontSize(9),h.setTextColor(98,86,230),h.text("REPORT METADATA",40,66),h.setTextColor(40),h.text(`Tenant ID: ${t.tenantId||"Current tenant"}`,40,82),h.text(`Date Range: ${i} to ${c}`,40,97),h.text(`Accrued Total Cost: ${K(t.totalCost,t.currency)}`,40,112),h.setTextColor(98,86,230),h.text("COST SUMMARY BREAKDOWN",40,136);const g=n==="account";u(h,{startY:146,head:[g?["Account ID","Account Name","Total Cost","Percentage","Regions"]:[`${d.item} Name`,"Total Cost","Percentage","Accounts","Regions"]],body:t.summary.map(p=>g?[p.accountId||p.key||"—",p.label,K(p.amount,t.currency),`${(p.percentage||0).toFixed(2)}%`,Xe(p.regions)]:[p.label,K(p.amount,t.currency),`${(p.percentage||0).toFixed(2)}%`,Xe(p.accounts),Xe(p.regions)]),styles:{fontSize:7,cellPadding:4,overflow:"linebreak"},headStyles:{fillColor:[242,237,255],textColor:[82,35,190]},didDrawPage:p=>m(p,i,c),margin:{bottom:32}}),h.save(`${n}-summary-report-${Date.now()}.pdf`)}function Ef(){const e=Cf(),{groupBy:t,mode:s,report:r,comparison:n,comparedRows:o,loading:i,error:c,dataStatus:l,granularity:d,start:f,end:u}=e,h=at[t],m=r?.summary[0],g=n?n.current.totalCost-n.previous.totalCost:0,p=n?.previous.totalCost?g/Math.abs(n.previous.totalCost)*100:0,x=r?{report:r,comparison:n,rows:o,groupBy:t,mode:s,start:f,end:u,granularity:d}:null,b=a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>x&&void kf(x),disabled:!x||i,className:"flex items-center gap-2 rounded-md border bg-card px-3 py-1.5 text-sm disabled:opacity-50",children:[a.jsx(Yd,{className:"h-4 w-4"}),"PDF"]}),a.jsxs("button",{onClick:()=>x&&_f(x),disabled:!x||i,className:"flex items-center gap-2 rounded-md border bg-card px-3 py-1.5 text-sm disabled:opacity-50",children:[a.jsx(Cr,{className:"h-4 w-4"}),"CSV"]})]});return a.jsxs("div",{className:"flex w-full flex-col gap-5 p-2 md:p-6",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(ta,{className:"h-6 w-6 text-primary"}),"Cost reports"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Analyse live AWS cost by service, linked account, region, resource, or cost allocation tag"})]}),!i&&(l&&!l.ready||c&&!l)?a.jsx(Cs,{status:l,error:c}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex gap-1 overflow-x-auto border-b",children:Object.keys(at).map(y=>a.jsx("button",{onClick:()=>e.changeGroup(y),className:`border-b-2 px-4 py-3 text-sm font-medium ${t===y?"border-primary text-primary":"border-transparent text-muted-foreground"}`,children:at[y].tab},y))}),a.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px]",children:[a.jsxs("div",{className:"space-y-5",children:[c&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(lt,{className:"h-4 w-4"}),c]}),i?a.jsx(yf,{}):s==="compare"&&n?a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"rounded-xl bg-primary/5 p-4",children:[a.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold",children:"Comparison Cost Summary"}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Updated On: ",Bn(n.current.updatedAt)]})]}),b]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[a.jsx(Le,{label:"Period accrued total",value:`${K(n.current.totalCost,n.current.currency)} vs ${K(n.previous.totalCost,n.previous.currency)}`,helper:`${p>=0?"+":""}${p.toFixed(1)}% from previous period`,trend:p}),a.jsx(Le,{label:Rt(n.currentStart,n.currentEnd,d),value:K(n.current.totalCost,n.current.currency),helper:"Current period spending"}),a.jsx(Le,{label:Rt(n.previousStart,n.previousEnd,d),value:K(n.previous.totalCost,n.previous.currency),helper:"Previous period spending"}),a.jsx(Le,{label:d==="monthly"?"Monthly change":"Period change",value:`${g>=0?"+":""}${K(g,n.current.currency)}`,helper:`${p>=0?"+":""}${p.toFixed(1)}% from previous period`,trend:g})]})]}),a.jsx(bf,{rows:o,currency:n.current.currency}),a.jsx(jf,{rows:o,groupBy:t,comparison:n,granularity:d})]}):r?a.jsxs(a.Fragment,{children:[r.message&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border bg-muted/50 p-3 text-sm text-muted-foreground",children:[a.jsx(lt,{className:"h-4 w-4"}),r.message]}),a.jsxs("section",{className:"rounded-xl bg-primary/5 p-4",children:[a.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold",children:h.title}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Updated On: ",Bn(r.updatedAt)]})]}),b]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[a.jsx(Le,{label:"Accrued cost",value:K(r.totalCost,r.currency)}),a.jsx(Le,{label:h.top,value:m?K(m.amount,r.currency):"-",accent:!0}),a.jsx(Le,{label:h.count,value:String(r.count||0),accent:!0})]})]}),a.jsxs(ce,{children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm",children:"Cost Trend"})}),a.jsx(le,{children:a.jsx(xf,{timeline:r.timeline||[],currency:r.currency||"USD",daily:d==="daily"})})]}),a.jsx(Rf,{groupBy:t,report:r})]}):null]}),a.jsx(Nf,{mode:s,groupBy:t,start:f,end:u,granularity:d,reportTagKey:e.reportTagKey,options:e.options,filters:e.draftFilters,loading:i,filtersLoading:e.filtersLoading,comparisonPeriods:e.selectedComparisonPeriods,onModeChange:e.changeMode,onStartChange:e.setStart,onEndChange:e.setEnd,onGranularityChange:e.setGranularity,onReportTagKeyChange:e.setReportTagKey,onFiltersChange:e.setDraftFilters,onLoadTagValues:y=>{e.loadOptions(y)},onRun:e.runReport,onApply:e.applyFilters,onReset:e.resetFilters})]})]})]})}const Wn={READY:"bg-emerald-500/10 text-emerald-600 border-emerald-500/30",RUNNING:"bg-blue-500/10 text-blue-600 border-blue-500/30",WAITING_FOR_DATA:"bg-amber-500/10 text-amber-600 border-amber-500/30",WAITING_FOR_TABLE:"bg-amber-500/10 text-amber-600 border-amber-500/30",FAILED:"bg-destructive/10 text-destructive border-destructive/30",PENDING:"bg-muted text-muted-foreground border-border"},Pf={INFO:"text-muted-foreground",WARN:"text-amber-600",ERROR:"text-destructive"},os=e=>e?new Date(e).toLocaleString():"—";function Tf({status:e}){return a.jsx("span",{className:`rounded-full border px-2 py-0.5 text-xs font-medium ${Wn[e]||Wn.PENDING}`,children:e.replace(/_/g," ")})}function De({label:e,value:t,mono:s}){return a.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:e}),a.jsx("span",{className:`break-all text-sm ${s?"font-mono text-xs":""}`,children:t||"—"})]})}function Af(){const[e,t]=k.useState([]),[s,r]=k.useState([]),[n,o]=k.useState(!0),[i,c]=k.useState(null),l=k.useCallback(async()=>{o(!0),c(null);try{const d=await re.get("/cur-discovery",{params:{logLimit:100}});t(d.data?.jobs||[]),r(d.data?.logs||[])}catch(d){c(d?.response?.data?.error||d?.message||"Unable to load CUR discovery status")}finally{o(!1)}},[]);return k.useEffect(()=>{l()},[l]),a.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(_r,{className:"h-6 w-6 text-primary"}),"CUR Discovery"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Progress of the scheduled job that locates this tenant’s Cost and Usage Report table. Cost data becomes available after it reports Ready."})]}),a.jsx("button",{onClick:()=>{l()},disabled:n,className:"rounded-lg border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh",children:a.jsx(St,{className:`h-4 w-4 ${n?"animate-spin":""}`})})]}),i&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(lt,{className:"h-4 w-4"}),i]}),!n&&!i&&!e.length&&a.jsx(ce,{children:a.jsx(le,{className:"py-10 text-center text-sm text-muted-foreground",children:"No discovery job exists for this tenant yet. One is created automatically once the AWS connection is verified and the Cost plugin is entitled."})}),e.map(d=>a.jsxs(ce,{children:[a.jsxs(ve,{className:"flex flex-row flex-wrap items-center gap-3",children:[a.jsx(Zo,{className:"h-4 w-4 text-primary"}),a.jsxs(Ne,{className:"text-sm",children:["Connection ",d.connectionId]}),a.jsx(Tf,{status:d.status}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["attempt ",d.attemptCount]}),a.jsxs("span",{className:"ms-auto text-xs text-muted-foreground",children:["next check ",os(d.nextRunAt)]})]}),a.jsxs(le,{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[a.jsx(De,{label:"Source",value:d.curS3Uri||`s3://${d.bucket}/${d.prefix}`,mono:!0}),a.jsx(De,{label:"Tenant partition",value:d.tenantPartition,mono:!0}),a.jsx(De,{label:"Region",value:d.region}),a.jsx(De,{label:"Glue database",value:d.database,mono:!0}),a.jsx(De,{label:"Discovered table",value:d.table,mono:!0}),a.jsx(De,{label:"Table location",value:d.tableLocation,mono:!0}),a.jsx(De,{label:"Sample object",value:d.sampleObjectKey,mono:!0}),a.jsx(De,{label:"Last data",value:os(d.lastDataAt)}),a.jsx(De,{label:"Last checked",value:os(d.lastFinishedAt||d.lastStartedAt)}),d.lastError&&a.jsx("div",{className:"md:col-span-2 lg:col-span-3 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:d.lastError})]})]},d.id)),e.length>0&&a.jsxs(ce,{children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm",children:"Recent activity"})}),a.jsx(le,{children:s.length?a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b text-left text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"py-2 pe-4 font-medium",children:"Time"}),a.jsx("th",{className:"py-2 pe-4 font-medium",children:"Level"}),a.jsx("th",{className:"py-2 pe-4 font-medium",children:"Event"}),a.jsx("th",{className:"py-2 font-medium",children:"Message"})]})}),a.jsx("tbody",{children:s.map(d=>a.jsxs("tr",{className:"border-b last:border-0 align-top",children:[a.jsx("td",{className:"whitespace-nowrap py-2 pe-4 text-xs text-muted-foreground",children:os(d.createdAt)}),a.jsx("td",{className:`py-2 pe-4 text-xs font-medium ${Pf[d.level]||""}`,children:d.level}),a.jsx("td",{className:"whitespace-nowrap py-2 pe-4 font-mono text-xs",children:d.event}),a.jsx("td",{className:"py-2",children:d.message})]},d.id))})]})}):a.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No log entries recorded yet."})})]})]})}const Of=e=>e.launchUrl||`https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create?stackName=${encodeURIComponent(e.stackName||`MeyiConnect-${e.connectionId}-Management`)}`,Lf=e=>e==="CONNECTED"?"border-emerald-500/30 bg-emerald-500/10 text-emerald-600":e==="FAILED"?"border-destructive/30 bg-destructive/10 text-destructive":"border-amber-500/30 bg-amber-500/10 text-amber-700",as=e=>e?.response?.data?.error||e?.response?.data?.message||e?.message||"Request failed";function If(){const[e,t]=k.useState([]),[s,r]=k.useState(!0),[n,o]=k.useState(!1),[i,c]=k.useState(""),[l,d]=k.useState(!1),[f,u]=k.useState(null),[h,m]=k.useState(null),[g,p]=k.useState(null),x=k.useCallback(async()=>{r(!0),p(null);try{t((await ae.getSources()).sources||[])}catch(w){p(as(w))}finally{r(!1)}},[]);k.useEffect(()=>{x()},[x]);const b=async w=>{if(w.preventDefault(),!/^\d{12}$/.test(i)){p("AWS account ID must contain exactly 12 digits");return}m("create"),p(null);try{const _=await ae.createSource({managementAccountId:i,regionMode:l?"ALL":"SINGLE"});u(_.connectionId),o(!1),c(""),d(!1),await x()}catch(_){p(as(_))}finally{m(null)}},y=async w=>{m(`download-${w}`),p(null);try{const _=await ae.downloadSourceTemplate(w),N=URL.createObjectURL(_),j=document.createElement("a");j.href=N,j.download=`meyi-connect-cost-${w}.yaml`,j.click(),URL.revokeObjectURL(N),u(w)}catch(_){p(as(_))}finally{m(null)}},R=async w=>{m(`verify-${w}`),p(null);try{const _=await ae.verifySource(w);_.status==="FAILED"&&p(_.message||"AWS connection verification failed"),await x()}catch(_){p(as(_))}finally{m(null)}};return a.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(js,{className:"h-6 w-6 text-primary"}),"Cost Sources"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"AWS accounts connected to this tenant for Cost and Usage Report data."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{x()},disabled:s,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh sources",title:"Refresh sources",children:a.jsx(St,{className:`h-4 w-4 ${s?"animate-spin":""}`})}),a.jsxs("button",{type:"button",onClick:()=>{p(null),o(!0)},className:"flex items-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:opacity-90",children:[a.jsx(ru,{className:"h-4 w-4"}),"Add AWS account"]})]})]}),g&&a.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(lt,{className:"mt-0.5 h-4 w-4 shrink-0"}),g]}),!s&&e.length===0&&a.jsxs("div",{className:"rounded-md border border-dashed py-14 text-center",children:[a.jsx(js,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground"}),a.jsx("p",{className:"font-medium",children:"No AWS Cost source"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Add an AWS account to begin collecting tenant cost data."})]}),e.length>0&&a.jsx("div",{className:"overflow-x-auto rounded-md border",children:a.jsxs("table",{className:"w-full min-w-[780px] text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-muted/50 text-left text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 font-medium",children:"AWS account"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Connection"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Scope"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:e.map(w=>a.jsxs("tr",{className:`border-b last:border-0 ${f===w.connectionId?"bg-muted/30":""}`,children:[a.jsx("td",{className:"px-4 py-3 font-mono",children:w.managementAccountId||"Pending"}),a.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:w.connectionId}),a.jsxs("td",{className:"px-4 py-3",children:[w.accountScope," / ",w.regionMode]}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:`rounded-full border px-2 py-1 text-xs font-medium ${Lf(w.status)}`,children:w.status.replace(/_/g," ")}),w.stackSetStatus&&a.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:w.stackSetStatus.replace(/_/g," ")})]}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{y(w.connectionId)},disabled:!!h,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50",title:"Download CloudFormation template","aria-label":"Download CloudFormation template",children:h===`download-${w.connectionId}`?a.jsx(bt,{className:"h-4 w-4 animate-spin"}):a.jsx(Cr,{className:"h-4 w-4"})}),a.jsx("a",{href:Of(w),target:"_blank",rel:"noreferrer",className:"rounded-md border p-2 hover:bg-muted",title:`Open AWS CloudFormation as ${w.stackName||`MeyiConnect-${w.connectionId}-Management`}`,"aria-label":"Open AWS CloudFormation",children:a.jsx(ea,{className:"h-4 w-4"})}),a.jsxs("button",{type:"button",onClick:()=>{R(w.connectionId)},disabled:!!h||w.status==="CONNECTED",className:"flex items-center gap-2 rounded-md border px-3 py-2 font-medium hover:bg-muted disabled:opacity-50",children:[h===`verify-${w.connectionId}`?a.jsx(bt,{className:"h-4 w-4 animate-spin"}):w.status==="CONNECTED"?a.jsx($d,{className:"h-4 w-4 text-emerald-600"}):a.jsx(St,{className:"h-4 w-4"}),w.status==="CONNECTED"?"Connected":"Verify"]})]})})]},w.connectionId))})]})}),n&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"add-source-title",children:a.jsxs("form",{onSubmit:w=>{b(w)},className:"w-full max-w-md rounded-md border bg-background p-5 shadow-xl",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsx("h2",{id:"add-source-title",className:"text-lg font-semibold",children:"Add AWS account"}),a.jsx("button",{type:"button",onClick:()=>o(!1),className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(Os,{className:"h-4 w-4"})})]}),a.jsx("label",{className:"mt-5 block text-sm font-medium",htmlFor:"aws-account-id",children:"AWS account ID"}),a.jsx("input",{id:"aws-account-id",value:i,onChange:w=>c(w.target.value.replace(/\D/g,"").slice(0,12)),inputMode:"numeric",autoComplete:"off",placeholder:"123456789012",className:"mt-2 h-10 w-full rounded-md border bg-background px-3 font-mono outline-none focus:ring-2 focus:ring-ring"}),a.jsxs("label",{className:"mt-4 flex items-start gap-3 rounded-md border p-3",children:[a.jsx("input",{type:"checkbox",checked:l,onChange:w=>d(w.target.checked),className:"mt-1 h-4 w-4"}),a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm font-medium",children:"All enabled AWS regions"}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:"Use organization-wide StackSet deployment across enabled regions."})]})]}),a.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:()=>o(!1),className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsxs("button",{type:"submit",disabled:h==="create"||i.length!==12,className:"flex items-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:[h==="create"&&a.jsx(bt,{className:"h-4 w-4 animate-spin"}),"Create source"]})]})]})})]})}const Sa=k.createContext("user"),Mf=Sa.Provider,Df=()=>k.useContext(Sa),Ff=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Uf=["UTC","Asia/Kolkata","America/New_York","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];function $f({open:e,schedule:t,saving:s,onClose:r,onSave:n}){const[o,i]=k.useState(t);if(k.useEffect(()=>i(t),[t,e]),!e)return null;const c=l=>i(d=>({...d,frequency:l}));return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4",role:"presentation",onMouseDown:l=>{l.target===l.currentTarget&&r()},children:a.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"cost-ai-schedule-title",className:"w-full max-w-lg overflow-hidden rounded-lg border bg-background shadow-xl",children:[a.jsxs("div",{className:"flex items-start justify-between border-b px-5 py-4",children:[a.jsxs("div",{children:[a.jsxs("h2",{id:"cost-ai-schedule-title",className:"flex items-center gap-2 text-base font-semibold",children:[a.jsx(Xo,{className:"h-4 w-4 text-primary"}),"AI report schedule"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Reports run automatically against completed AWS CUR periods."})]}),a.jsx("button",{type:"button",onClick:r,className:"rounded-md p-1.5 hover:bg-muted","aria-label":"Close",children:a.jsx(Os,{className:"h-4 w-4"})})]}),a.jsxs("form",{className:"space-y-5 p-5",onSubmit:l=>{l.preventDefault(),n({enabled:o.enabled,frequency:o.frequency,time:o.time,timezone:o.timezone,dayOfWeek:o.dayOfWeek,dayOfMonth:o.dayOfMonth}).then(r)},children:[a.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border p-3",children:[a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm font-medium",children:"Scheduled reports"}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:"Generate reports without a manual action"})]}),a.jsx("input",{type:"checkbox",checked:o.enabled,onChange:l=>i(d=>({...d,enabled:l.target.checked})),className:"h-4 w-4 accent-primary"})]}),a.jsxs("fieldset",{disabled:!o.enabled||s,className:"space-y-5 disabled:opacity-60",children:[a.jsxs("div",{children:[a.jsx("span",{className:"mb-2 block text-sm font-medium",children:"Frequency"}),a.jsx("div",{className:"grid grid-cols-3 rounded-lg border p-1",children:["daily","weekly","monthly"].map(l=>a.jsx("button",{type:"button",onClick:()=>c(l),className:`rounded-md px-3 py-2 text-sm capitalize ${o.frequency===l?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:l},l))})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("label",{className:"text-sm font-medium",children:["Run time",a.jsx("input",{type:"time",required:!0,value:o.time,onChange:l=>i(d=>({...d,time:l.target.value})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal"})]}),a.jsxs("label",{className:"text-sm font-medium",children:["Timezone",a.jsx("select",{value:o.timezone,onChange:l=>i(d=>({...d,timezone:l.target.value})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:[...new Set([o.timezone,...Uf])].map(l=>a.jsx("option",{children:l},l))})]})]}),o.frequency==="weekly"&&a.jsxs("label",{className:"block text-sm font-medium",children:["Day of week",a.jsx("select",{value:o.dayOfWeek??1,onChange:l=>i(d=>({...d,dayOfWeek:Number(l.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:Ff.map((l,d)=>a.jsx("option",{value:d,children:l},l))})]}),o.frequency==="monthly"&&a.jsxs("label",{className:"block text-sm font-medium",children:["Day of month",a.jsx("input",{type:"number",min:1,max:28,value:o.dayOfMonth??1,onChange:l=>i(d=>({...d,dayOfMonth:Number(l.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Daily reports cover the previous day, weekly reports the previous seven complete days, and monthly reports the previous calendar month."})]}),a.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[a.jsx("button",{type:"button",onClick:r,className:"rounded-lg border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsx("button",{type:"submit",disabled:s,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:s?"Saving":"Save schedule"})]})]})]})})}function Bf(){const[e,t]=k.useState(null),[s,r]=k.useState(null),[n,o]=k.useState(null),[i,c]=k.useState([]),[l,d]=k.useState(!0),[f,u]=k.useState(!1),[h,m]=k.useState(null),[g,p]=k.useState(null),x=k.useRef(!0),b=k.useCallback(async(_=!1)=>{_||d(!0);try{const[N,j,S,E]=await Promise.all([ae.getAnalysisStatus(),ae.getDataStatus(),ae.getAnalysisSchedule(),ae.getAnalysisReports()]);if(!x.current)return;t(N),r(j),o(S),c(E),p(null)}catch(N){x.current&&p(N?.response?.data?.error||N?.message||"Unable to load scheduled AI reports")}finally{x.current&&!_&&d(!1)}},[]);return k.useEffect(()=>(x.current=!0,b(),()=>{x.current=!1}),[b]),k.useEffect(()=>{if(!i.some(N=>N.status==="PENDING"||N.status==="RUNNING"))return;const _=window.setInterval(()=>{b(!0)},15e3);return()=>window.clearInterval(_)},[b,i]),{status:e,dataStatus:s,schedule:n,reports:i,loading:l,saving:f,removingId:h,error:g,load:b,saveSchedule:async _=>{u(!0),p(null);try{const N=await ae.updateAnalysisSchedule(_);x.current&&o(N)}catch(N){throw p(N?.response?.data?.error||N?.message||"Unable to save the AI report schedule"),N}finally{x.current&&u(!1)}},download:async _=>{try{const N=await ae.downloadAnalysisPdf(_.id),j=URL.createObjectURL(N),S=document.createElement("a");S.href=j,S.download=`meyi-cost-analysis-${_.period.Start}.pdf`,S.click(),URL.revokeObjectURL(j)}catch(N){p(N?.response?.data?.error||N?.message||"Unable to download the PDF report")}},remove:async _=>{if(window.confirm(`Remove the AI cost report for ${_.period.Start} through ${_.period.End}?`)){m(_.id),p(null);try{await ae.removeAnalysisReport(_.id),x.current&&c(N=>N.filter(j=>j.id!==_.id))}catch(N){x.current&&p(N?.response?.data?.error||N?.message||"Unable to remove the AI report")}finally{x.current&&m(null)}}}}}const er=e=>e?new Date(e).toLocaleString():"Not scheduled",zf=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString(),Vf=e=>{const t=new Date(`${e}T00:00:00Z`);return t.setUTCDate(t.getUTCDate()-1),t.toLocaleDateString()},Wf={COMPLETED:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700",RUNNING:"border-blue-500/30 bg-blue-500/10 text-blue-700",PENDING:"border-amber-500/30 bg-amber-500/10 text-amber-700",FAILED:"border-destructive/30 bg-destructive/10 text-destructive"};function Hf(){const e=Bf(),t=Df(),[s,r]=k.useState(!1),n=t.toLowerCase()==="admin";return a.jsxs("div",{className:"flex min-w-0 max-w-full flex-col gap-6 overflow-x-hidden p-2 md:p-6",children:[a.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(An,{className:"h-6 w-6 text-primary"}),"AI Cost Analysis"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Scheduled Cost reports generated from AWS CUR data"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{e.load()},disabled:e.loading,className:"rounded-lg border p-2.5 hover:bg-muted disabled:opacity-50",title:"Refresh reports","aria-label":"Refresh reports",children:a.jsx(St,{className:`h-4 w-4 ${e.loading?"animate-spin":""}`})}),n&&e.schedule&&a.jsxs("button",{type:"button",onClick:()=>r(!0),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground",children:[a.jsx(ra,{className:"h-4 w-4"}),"Report settings"]})]})]}),e.error&&a.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive",children:[a.jsx(lt,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.error]}),e.loading?a.jsx("div",{className:"h-72 animate-pulse rounded-lg bg-muted"}):e.dataStatus&&!e.dataStatus.ready?a.jsx(Cs,{status:e.dataStatus}):e.status&&!e.status.enabled?a.jsx(ce,{children:a.jsxs(le,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(An,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("h2",{className:"mt-4 text-base font-semibold",children:e.status.reason==="AI_PROVIDER_REQUIRED"?"Configure an AI provider":"AI cost analysis is not enabled"}),a.jsx("p",{className:"mt-2 max-w-xl text-sm text-muted-foreground",children:e.status.reason==="AI_PROVIDER_REQUIRED"?"Configure and activate an AI provider in Meyi Connect before scheduled cost reports can run.":"An administrator must enable the Cost AI deployment setting before scheduled reports can run."})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border bg-card px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Xo,{className:"h-5 w-5 text-primary"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold",children:e.schedule?.enabled?`${e.schedule.frequency[0].toUpperCase()}${e.schedule.frequency.slice(1)} reports enabled`:"Scheduled reports disabled"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e.schedule?.enabled?`Next run ${er(e.schedule.nextRunAt)} (${e.schedule.timezone})`:n?"Open report settings to configure a schedule":"An administrator can configure the report schedule"})]})]}),e.schedule?.lastRunAt&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last run ",er(e.schedule.lastRunAt)]})]}),e.reports.length?a.jsx("div",{className:"overflow-hidden rounded-lg border bg-card",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full min-w-[960px] text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-muted/40 text-left text-xs text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 font-medium",children:"Report period"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Schedule"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"AI provider"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Generated"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Total cost"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:e.reports.map(o=>a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsxs("td",{className:"px-4 py-3 font-medium",children:[zf(o.period.Start)," - ",Vf(o.period.End)]}),a.jsx("td",{className:"px-4 py-3 capitalize text-muted-foreground",children:o.frequency}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:"capitalize",children:o.provider||"-"}),o.modelId&&a.jsx("p",{className:"max-w-48 truncate text-xs text-muted-foreground",title:o.modelId,children:o.modelId})]}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:er(o.completedAt||o.startedAt||o.createdAt)}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-xs font-medium ${Wf[o.status]}`,children:[(o.status==="RUNNING"||o.status==="PENDING")&&a.jsx(bt,{className:"h-3 w-3 animate-spin"}),o.status.toLowerCase()]}),o.error&&a.jsx("p",{className:"mt-1 max-w-xs truncate text-xs text-destructive",title:o.error,children:o.error})]}),a.jsx("td",{className:"px-4 py-3",children:o.facts?new Intl.NumberFormat(void 0,{style:"currency",currency:o.facts.currency}).format(o.facts.currentTotal):"-"}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{e.download(o)},disabled:!o.pdfReady,className:"inline-flex h-9 items-center gap-2 rounded-lg border px-3 text-sm font-medium hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40",title:o.pdfReady?"Download PDF":"PDF not ready",children:[a.jsx(Cr,{className:"h-4 w-4"}),"Download"]}),n&&a.jsx("button",{type:"button",onClick:()=>{e.remove(o)},disabled:e.removingId===o.id||o.status==="RUNNING"||o.status==="PENDING",className:"inline-flex h-9 w-9 items-center justify-center rounded-lg border text-destructive hover:bg-destructive/10 disabled:cursor-not-allowed disabled:opacity-40",title:"Remove report","aria-label":"Remove report",children:e.removingId===o.id?a.jsx(bt,{className:"h-4 w-4 animate-spin"}):a.jsx(du,{className:"h-4 w-4"})})]})})]},o.id))})]})})}):a.jsx(ce,{children:a.jsxs(le,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(ta,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("h2",{className:"mt-4 text-base font-semibold",children:"No scheduled reports yet"}),a.jsx("p",{className:"mt-2 max-w-lg text-sm text-muted-foreground",children:"The first report will appear here after the configured schedule runs."})]})})]}),e.schedule&&a.jsx($f,{open:s,schedule:e.schedule,saving:e.saving,onClose:()=>r(!1),onSave:e.saveSchedule})]})}const _t=ic({component:So}),qf=zt({getParentRoute:()=>_t,path:"/",component:gf}),Gf=zt({getParentRoute:()=>_t,path:"/reports",component:Ef}),Kf=zt({getParentRoute:()=>_t,path:"/cur-discovery",component:Af}),Yf=zt({getParentRoute:()=>_t,path:"/analysis",component:Hf}),Jf=zt({getParentRoute:()=>_t,path:"/sources",component:If});function Pr(){return _t.addChildren([qf,Yf,Gf,Jf,Kf])}function Xf(e="/cost"){return Ro({routeTree:Pr(),basepath:e})}function Zf({apiBase:e,token:t,basePath:s="/cost",userRole:r="user"}){Yo(e,t);const n=k.useMemo(()=>Ro({routeTree:Pr(),basepath:s}),[s]);return a.jsx(Mf,{value:r,children:a.jsx(Sc,{router:n})})}const Qf=[{title:"Overview",url:"/",icon:"DollarSign",roles:["admin","user"]},{title:"AI Analysis",url:"/analysis",icon:"Sparkles",roles:["admin","user"]},{title:"Reports",url:"/reports",icon:"FileText",roles:["admin","user"]},{title:"Sources",url:"/sources",icon:"CloudCog",roles:["admin"]},{title:"CUR Discovery",url:"/cur-discovery",icon:"Search",roles:["admin"]}];exports.CostPage=Zf;exports.api=re;exports.attachAuthInterceptors=wd;exports.configureApi=Yo;exports.costNavItems=Qf;exports.createCostRouter=Xf;exports.createRouteTree=Pr;
|
|
19
|
+
`):"—"}function Hr({values:e}){const[t,s]=E.useState(!1);return a.jsxs("div",{className:"relative",children:[a.jsxs("button",{type:"button",onClick:()=>s(n=>!n),className:"inline-flex items-center gap-2 text-primary",children:[a.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-1 text-xs font-semibold",children:e.length}),a.jsx("span",{children:"›"})]}),t&&a.jsxs("div",{className:"absolute right-0 top-8 z-20 w-72 rounded-lg border bg-popover p-3 shadow-xl",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsx("strong",{className:"text-xs",children:"Cost distribution"}),a.jsx("button",{onClick:()=>s(!1),children:a.jsx(Wt,{className:"h-3.5 w-3.5"})})]}),e.length?e.map(n=>a.jsxs("div",{className:"flex justify-between gap-3 border-t py-2 text-xs",children:[a.jsx("span",{className:"min-w-0 truncate",title:n.label,children:n.label}),a.jsx("strong",{children:K(n.amount,"USD")})]},n.key)):a.jsx("p",{className:"text-xs text-muted-foreground",children:"No related values."})]})]})}function _a({page:e,pages:t,total:s,onChange:n}){const r=s?(e-1)*qe+1:0,o=Math.min(e*qe,s);return a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t px-4 py-4 text-xs text-muted-foreground",children:[a.jsxs("span",{children:["Showing ",r,"–",o," of ",s]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{"aria-label":"Previous page",disabled:e<=1,onClick:()=>n(e-1),className:"rounded-md border p-1.5 disabled:opacity-40",children:a.jsx(Ud,{className:"h-4 w-4"})}),a.jsxs("span",{children:["Page ",e," of ",t]}),a.jsx("button",{"aria-label":"Next page",disabled:e>=t,onClick:()=>n(e+1),className:"rounded-md border p-1.5 disabled:opacity-40",children:a.jsx(Bd,{className:"h-4 w-4"})})]})]})}function Ef({groupBy:e,report:t}){const[s,n]=E.useState(""),[r,o]=E.useState(1),[i,c]=E.useState(null),[l,u]=E.useState({percentage:!0,accounts:!0,regions:!0}),f=it[e],d=E.useMemo(()=>{const g=s.trim().toLowerCase();return g?t.summary.filter(b=>`${b.label} ${b.accountId||""}`.toLowerCase().includes(g)):t.summary},[t,s]),h=Math.max(1,Math.ceil(d.length/qe)),m=d.slice((r-1)*qe,r*qe),p=3+Number(l.percentage)+Number(l.accounts)+Number(l.regions);return E.useEffect(()=>{o(1)},[t,s,e]),a.jsxs(de,{children:[a.jsxs(je,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Pe,{className:"text-sm text-primary",children:"Cost and usage breakdown"}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs("label",{className:"flex items-center gap-2 rounded-full border bg-background px-4 py-2 text-sm",children:[a.jsx(Pn,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search breakdown",value:s,onChange:g=>n(g.target.value),placeholder:"Search...",className:"w-48 bg-transparent outline-none"})]}),a.jsxs("details",{className:"relative",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 rounded-md border px-3 py-2 text-sm text-primary",children:[a.jsx(aa,{className:"h-4 w-4"}),"Column visibility"]}),a.jsx("div",{className:"absolute right-0 z-20 mt-1 w-48 rounded-md border bg-popover p-3 shadow-xl",children:Object.entries(l).map(([g,b])=>a.jsxs("label",{className:"flex gap-2 py-1 text-xs capitalize",children:[a.jsx("input",{type:"checkbox",checked:b,onChange:x=>u(y=>({...y,[g]:x.target.checked}))}),g]},g))})]})]})]}),a.jsx(ue,{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-primary/5 text-left text-xs uppercase text-primary",children:[a.jsx("th",{className:"px-4 py-4",children:f.item}),a.jsx("th",{className:"px-4",children:"Cost"}),l.percentage&&a.jsx("th",{className:"px-4",children:"Percentage"}),l.accounts&&a.jsx("th",{className:"px-4",children:"Accounts"}),l.regions&&a.jsx("th",{className:"px-4",children:"Regions"}),a.jsx("th",{className:"px-4 text-center",children:"Actions"})]})}),a.jsx("tbody",{children:m.length?m.map(g=>a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsxs("td",{className:"max-w-72 px-4 py-4 font-medium",children:[a.jsx("div",{className:"truncate",title:g.label,children:g.label}),e==="account"&&a.jsx("div",{className:"font-mono text-xs text-muted-foreground",children:g.accountId||g.key})]}),a.jsx("td",{className:"px-4 font-semibold",children:K(g.amount,t.currency)}),l.percentage&&a.jsxs("td",{className:"px-4",children:[a.jsx("span",{className:"mr-2 inline-block h-1.5 w-12 overflow-hidden rounded-full bg-primary/15 align-middle",children:a.jsx("span",{className:"block h-full bg-primary",style:{width:`${Math.min(g.percentage||0,100)}%`}})}),a.jsxs("strong",{className:"text-primary",children:[g.percentage?.toFixed(2),"%"]})]}),l.accounts&&a.jsx("td",{className:"px-4",children:a.jsx(Hr,{values:g.accounts||[]})}),l.regions&&a.jsx("td",{className:"px-4",children:a.jsx(Hr,{values:g.regions||[]})}),a.jsx("td",{className:"px-4 text-center",children:a.jsx("button",{type:"button",onClick:()=>c(g),title:"View cost details",className:"text-primary hover:opacity-70",children:a.jsx(Xd,{className:"h-4 w-4"})})})]},g.key||g.label)):a.jsx("tr",{children:a.jsx("td",{colSpan:p,className:"py-12 text-center text-muted-foreground",children:f.empty})})})]})}),a.jsx(_a,{page:r,pages:h,total:d.length,onChange:o}),i&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",onClick:()=>c(null),children:a.jsxs("div",{className:"max-h-[80vh] w-full max-w-2xl overflow-auto rounded-xl bg-card p-6 shadow-2xl",onClick:g=>g.stopPropagation(),children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs uppercase text-muted-foreground",children:f.item}),a.jsx("h3",{className:"mt-1 text-lg font-semibold",children:i.label})]}),a.jsx("button",{onClick:()=>c(null),children:a.jsx(Wt,{})})]}),a.jsxs("div",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[a.jsx(Ie,{label:"Cost",value:K(i.amount,t.currency)}),a.jsx(Ie,{label:"Accounts",value:String(i.accounts?.length||0)}),a.jsx(Ie,{label:"Regions",value:String(i.regions?.length||0)})]}),a.jsxs("div",{className:"mt-5 grid gap-5 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"mb-2 text-sm font-semibold",children:"Accounts"}),(i.accounts||[]).map(g=>a.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[a.jsx("span",{children:g.label}),a.jsx("strong",{children:K(g.amount,t.currency)})]},g.key))]}),a.jsxs("div",{children:[a.jsx("h4",{className:"mb-2 text-sm font-semibold",children:"Regions"}),(i.regions||[]).map(g=>a.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[a.jsx("span",{children:g.label}),a.jsx("strong",{children:K(g.amount,t.currency)})]},g.key))]})]})]})})]})}function Pf({rows:e,groupBy:t,comparison:s,granularity:n}){const[r,o]=E.useState(""),[i,c]=E.useState(1),l=E.useMemo(()=>{const m=r.trim().toLowerCase();return m?e.filter(p=>p.label.toLowerCase().includes(m)):e},[e,r]),u=Math.max(1,Math.ceil(l.length/qe)),f=l.slice((i-1)*qe,i*qe),d=jt(s.currentStart,s.currentEnd,n),h=jt(s.previousStart,s.previousEnd,n);return E.useEffect(()=>{c(1)},[r,t,s]),a.jsxs(de,{children:[a.jsxs(je,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Pe,{className:"text-sm text-primary",children:"Comparison Details"}),a.jsxs("label",{className:"flex items-center gap-2 rounded-full border bg-background px-4 py-2 text-sm",children:[a.jsx(Pn,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search comparison",value:r,onChange:m=>o(m.target.value),placeholder:"Search...",className:"w-48 bg-transparent outline-none"})]})]}),a.jsx(ue,{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-primary/5 text-left text-xs uppercase text-primary",children:[a.jsxs("th",{className:"px-4 py-4",children:[it[t].item," name"]}),a.jsxs("th",{className:"px-4",children:[d,a.jsx("small",{className:"block font-normal",children:"Cost"})]}),a.jsxs("th",{className:"px-4",children:[h,a.jsx("small",{className:"block font-normal",children:"Cost"})]}),a.jsx("th",{className:"px-4",children:"Difference"}),a.jsx("th",{className:"px-4",children:"Change %"})]})}),a.jsx("tbody",{children:f.length?f.map(m=>a.jsxs("tr",{className:"border-b",children:[a.jsx("td",{className:"max-w-80 px-4 py-4 font-medium",children:a.jsx("div",{className:"truncate",title:m.label,children:m.label})}),a.jsx("td",{className:"px-4",children:K(m.current?.amount||0,s.current.currency)}),a.jsx("td",{className:"px-4",children:K(m.previous?.amount||0,s.previous.currency)}),a.jsxs("td",{className:`px-4 font-medium ${m.difference<0?"text-red-500":"text-emerald-600"}`,children:[m.difference>=0?"+":"",K(m.difference,s.current.currency)]}),a.jsxs("td",{className:`px-4 font-medium ${m.change<0?"text-red-500":m.change>0?"text-emerald-600":"text-muted-foreground"}`,children:[m.change>0?"+":"",m.change.toFixed(1),"%"]})]},m.key)):a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"py-12 text-center text-muted-foreground",children:"No comparison data found."})})})]})}),a.jsx(_a,{page:i,pages:u,total:l.length,onChange:c})]})}function Af(e){const{mode:t,groupBy:s,start:n,end:r,granularity:o,reportTagKey:i,options:c,filters:l,loading:u,filtersLoading:f,comparisonPeriods:d}=e;return a.jsxs("aside",{className:"space-y-4",children:[a.jsxs(de,{className:"bg-primary/5",children:[a.jsx(je,{children:a.jsx(Pe,{className:"text-sm uppercase text-primary",children:"Report parameters"})}),a.jsxs(ue,{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>e.onModeChange("standard"),className:`rounded-md px-4 py-2 text-xs font-semibold ${t==="standard"?"bg-primary text-primary-foreground":"border text-primary"}`,children:"Standard"}),a.jsx("button",{onClick:()=>e.onModeChange("compare"),className:`rounded-md px-4 py-2 text-xs font-semibold ${t==="compare"?"bg-primary text-primary-foreground":"border text-primary"}`,children:"Compare"})]}),t==="standard"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Start date",a.jsx("input",{type:"date",value:n,onChange:h=>e.onStartChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground"})]}),a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["End date",a.jsx("input",{type:"date",value:r,onChange:h=>e.onEndChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground"})]})]}),a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Granularity",a.jsxs("select",{value:o,onChange:h=>e.onGranularityChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground",children:[a.jsx("option",{value:"monthly",children:"Monthly"}),a.jsx("option",{value:"daily",children:"Daily"})]})]}),t==="compare"&&a.jsxs("p",{className:"rounded-md bg-background p-2 text-xs text-muted-foreground",children:["Current: ",d.currentStart," to ",d.currentEnd,a.jsx("br",{}),"Previous: ",d.previousStart," to ",d.previousEnd]}),s==="tag"&&a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Group by tag key",a.jsx("select",{value:i,onChange:h=>e.onReportTagKeyChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground",children:c.tagKeys.map(h=>a.jsx("option",{children:h},h))})]}),a.jsxs("button",{onClick:e.onRun,disabled:u,className:"flex w-full items-center justify-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:[a.jsx(St,{className:`h-4 w-4 ${u?"animate-spin":""}`}),"Run report"]})]})]}),a.jsxs(de,{className:"bg-primary/5",children:[a.jsx(je,{children:a.jsx(Pe,{className:"text-sm uppercase text-primary",children:"Filter by"})}),a.jsxs(ue,{className:"space-y-3",children:[a.jsx(is,{label:"Services",options:c.services,selected:l.services,onChange:h=>e.onFiltersChange(m=>({...m,services:h}))}),a.jsx(is,{label:"Region",options:c.regions,selected:l.regions,onChange:h=>e.onFiltersChange(m=>({...m,regions:h}))}),a.jsx(is,{label:"Linked Account",options:c.accounts,selected:l.accountIds,onChange:h=>e.onFiltersChange(m=>({...m,accountIds:h}))}),a.jsxs("select",{value:l.tagKey,onChange:h=>{const m=h.target.value;e.onFiltersChange(p=>({...p,tagKey:m,tagValues:[]})),m&&e.onLoadTagValues(m)},className:"w-full rounded-lg border bg-background px-3 py-3 text-sm text-primary",children:[a.jsx("option",{value:"",children:"Tag key"}),c.tagKeys.map(h=>a.jsx("option",{children:h},h))]}),l.tagKey&&a.jsx(is,{label:"Tag values",options:c.tagValues.map(h=>({value:h,label:h})),selected:l.tagValues,onChange:h=>e.onFiltersChange(m=>({...m,tagValues:h}))}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[a.jsx("button",{onClick:e.onApply,disabled:f||u,className:"rounded-md bg-primary px-3 py-2 text-sm font-semibold text-primary-foreground disabled:opacity-50",children:"Apply Filters"}),a.jsx("button",{onClick:e.onReset,disabled:u,className:"rounded-md border bg-background px-3 py-2 text-sm text-primary disabled:opacity-50",children:"Reset"})]})]})]})]})}function Tf(){const{managementAccountId:e,loading:t}=_t(),[s,n]=E.useState("service"),[r,o]=E.useState("standard"),[i,c]=E.useState(Cf),[l,u]=E.useState(_f),[f,d]=E.useState("monthly"),[h,m]=E.useState("Name"),[p,g]=E.useState({services:[],regions:[],accounts:[],tagKeys:[],tagValues:[]}),[b,x]=E.useState(Mt),[y,S]=E.useState(Mt),[N,C]=E.useState(null),[_,j]=E.useState(null),[w,P]=E.useState(!0),[I,k]=E.useState(!1),[T,Z]=E.useState(null),[z,J]=E.useState(null),Y=E.useRef(0),Q=E.useMemo(()=>_?kf(_):[],[_]),he=Wr(l,f),me=(D,X,V,ie)=>({start:X,end:V,groupBy:ie,granularity:f,tagKey:h,services:D.services.join(","),regions:D.regions.join(","),accountIds:D.accountIds.join(","),filterTagKey:D.tagKey||void 0,tagValues:D.tagValues.join(","),managementAccountId:e}),O=async(D="")=>{k(!0);try{const X=await oe.getDataStatus({managementAccountId:e});if(J(X),!X.ready)return;const V=await oe.getFilterOptions({start:i,end:l,filterTagKey:D||void 0,managementAccountId:e});g(ie=>D?{...ie,tagValues:V.tagValues}:V),!D&&V.tagKeys.length&&!V.tagKeys.includes(h)&&m(V.tagKeys[0])}catch(X){Z(X?.response?.data?.error||X.message||"Failed to load filter values")}finally{k(!1)}},R=async(D=y,X=r,V=s)=>{const ie=++Y.current;P(!0),Z(null),C(null),j(null);try{const le=await oe.getDataStatus({managementAccountId:e});if(ie===Y.current&&J(le),!le.ready)return;if(X==="compare"){const te=Wr(l,f),[Ce,Ne]=await Promise.all([oe.getReports(me(D,te.currentStart,te.currentEnd,V)),oe.getReports(me(D,te.previousStart,te.previousEnd,V))]);ie===Y.current&&(C(Ce),j({current:Ce,previous:Ne,...te}))}else{const te=await oe.getReports(me(D,i,l,V));ie===Y.current&&C(te)}}catch(le){ie===Y.current&&Z(le?.response?.data?.error||le.message||"Failed to generate cost report")}finally{ie===Y.current&&P(!1)}};return E.useEffect(()=>{t||(J(null),g({services:[],regions:[],accounts:[],tagKeys:[],tagValues:[]}),R(y,r,s),O())},[s,r,e,t]),{groupBy:s,mode:r,start:i,end:l,granularity:f,reportTagKey:h,options:p,draftFilters:b,report:N,comparison:_,loading:w||t,filtersLoading:I,error:T,dataStatus:z,comparedRows:Q,selectedComparisonPeriods:he,setStart:c,setEnd:u,setGranularity:d,setReportTagKey:m,setDraftFilters:x,changeGroup:D=>{D!==s&&(P(!0),C(null),j(null),n(D))},changeMode:D=>{D!==r&&(P(!0),C(null),j(null),o(D))},applyFilters:()=>{const D={...b,services:[...b.services],regions:[...b.regions],accountIds:[...b.accountIds],tagValues:[...b.tagValues]};S(D),R(D)},resetFilters:()=>{x(Mt),S(Mt),R(Mt)},runReport:()=>{O(),R()},loadOptions:O}}function Of(e){const{report:t,comparison:s,rows:n,groupBy:r,mode:o,start:i,end:c}=e,l=it[r];let u,f;o==="compare"&&s?(u=[[l.item,"Current Cost","Previous Cost","Difference","Change %"].join(","),...n.map(h=>[`"${h.label.replace(/"/g,'""')}"`,h.current?.amount||0,h.previous?.amount||0,h.difference,h.change.toFixed(2)].join(","))].join(`
|
|
20
|
+
`),f=`comparison-report-${r}-${Date.now()}.csv`):(u=[[l.item,"Cost","Percentage","Accounts","Regions"].join(","),...t.summary.map(h=>[`"${h.label.replace(/"/g,'""')}"`,h.amount,h.percentage||0,h.accounts?.length||0,h.regions?.length||0].join(","))].join(`
|
|
21
|
+
`),f=`${r}-summary-report-${Date.now()}.csv`);const d=document.createElement("a");d.href=URL.createObjectURL(new Blob([u],{type:"text/csv"})),d.download=f,d.click(),URL.revokeObjectURL(d.href)}async function Lf(e){const{report:t,comparison:s,rows:n,groupBy:r,mode:o,start:i,end:c,granularity:l}=e,u=it[r],[{jsPDF:f},{default:d}]=await Promise.all([Promise.resolve().then(()=>require("./jspdf.es.min-C10id8ME.cjs")).then(g=>g.jspdf_es_min),Promise.resolve().then(()=>require("./jspdf.plugin.autotable-CvTok6mL.cjs"))]),h=new f({orientation:"landscape",unit:"pt",format:"a4"}),m=(g,b,x)=>{h.setFontSize(7),h.setTextColor(100),h.text(`Report generated · All costs in ${t.currency} · ${b} to ${x}`,40,h.internal.pageSize.height-18),h.text(`Page ${g.pageNumber}`,h.internal.pageSize.width-70,h.internal.pageSize.height-18)};if(o==="compare"&&s){h.setFontSize(18),h.setTextColor(25),h.text("Comparison Report",40,42),h.setFontSize(9),h.setTextColor(98,86,230),h.text("TOTAL COST",40,66),h.setTextColor(40),h.text(`Previous Cost: ${s.previous.totalCost}`,40,82),h.text(`Current Cost: ${s.current.totalCost}`,220,82),h.text(`Granularity: ${l}`,400,82),d(h,{startY:100,head:[[`${u.item} Name`,"Current Cost","Previous Cost","Current Period","Previous Period","Change %","Current Accounts","Previous Accounts","Current Regions","Previous Regions"]],body:n.map(g=>[g.label,g.current?.amount?.toFixed(2)||"0.00",g.previous?.amount?.toFixed(2)||"0.00",jt(s.currentStart,s.currentEnd,l),jt(s.previousStart,s.previousEnd,l),`${g.change.toFixed(4)}%`,Xe(g.current?.accounts),Xe(g.previous?.accounts),Xe(g.current?.regions),Xe(g.previous?.regions)]),styles:{fontSize:6,cellPadding:3,overflow:"linebreak"},headStyles:{fillColor:[242,237,255],textColor:[82,35,190]},didDrawPage:g=>m(g,s.previousStart,s.currentEnd),margin:{bottom:32}}),h.save(`comparison-report-${r}-${Date.now()}.pdf`);return}h.setFontSize(18),h.setTextColor(25),h.text(u.pdfTitle,40,42),h.setFontSize(9),h.setTextColor(98,86,230),h.text("REPORT METADATA",40,66),h.setTextColor(40),h.text(`Tenant ID: ${t.tenantId||"Current tenant"}`,40,82),h.text(`Date Range: ${i} to ${c}`,40,97),h.text(`Accrued Total Cost: ${K(t.totalCost,t.currency)}`,40,112),h.setTextColor(98,86,230),h.text("COST SUMMARY BREAKDOWN",40,136);const p=r==="account";d(h,{startY:146,head:[p?["Account ID","Account Name","Total Cost","Percentage","Regions"]:[`${u.item} Name`,"Total Cost","Percentage","Accounts","Regions"]],body:t.summary.map(g=>p?[g.accountId||g.key||"—",g.label,K(g.amount,t.currency),`${(g.percentage||0).toFixed(2)}%`,Xe(g.regions)]:[g.label,K(g.amount,t.currency),`${(g.percentage||0).toFixed(2)}%`,Xe(g.accounts),Xe(g.regions)]),styles:{fontSize:7,cellPadding:4,overflow:"linebreak"},headStyles:{fillColor:[242,237,255],textColor:[82,35,190]},didDrawPage:g=>m(g,i,c),margin:{bottom:32}}),h.save(`${r}-summary-report-${Date.now()}.pdf`)}function If(){const e=Tf(),{groupBy:t,mode:s,report:n,comparison:r,comparedRows:o,loading:i,error:c,dataStatus:l,granularity:u,start:f,end:d}=e,h=it[t],m=n?.summary[0],p=r?r.current.totalCost-r.previous.totalCost:0,g=r?.previous.totalCost?p/Math.abs(r.previous.totalCost)*100:0,b=n?{report:n,comparison:r,rows:o,groupBy:t,mode:s,start:f,end:d,granularity:u}:null,x=a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>b&&void Lf(b),disabled:!b||i,className:"flex items-center gap-2 rounded-md border bg-card px-3 py-1.5 text-sm disabled:opacity-50",children:[a.jsx(Qd,{className:"h-4 w-4"}),"PDF"]}),a.jsxs("button",{onClick:()=>b&&Of(b),disabled:!b||i,className:"flex items-center gap-2 rounded-md border bg-card px-3 py-1.5 text-sm disabled:opacity-50",children:[a.jsx(En,{className:"h-4 w-4"}),"CSV"]})]});return a.jsxs("div",{className:"flex w-full flex-col gap-5 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(ra,{className:"h-6 w-6 text-primary"}),"Cost reports"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Analyse live AWS cost by service, linked account, region, resource, or cost allocation tag"})]}),a.jsx(Is,{})]}),!i&&(l&&!l.ready||c&&!l)?a.jsx(ks,{status:l,error:c}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex gap-1 overflow-x-auto border-b",children:Object.keys(it).map(y=>a.jsx("button",{onClick:()=>e.changeGroup(y),className:`border-b-2 px-4 py-3 text-sm font-medium ${t===y?"border-primary text-primary":"border-transparent text-muted-foreground"}`,children:it[y].tab},y))}),a.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px]",children:[a.jsxs("div",{className:"space-y-5",children:[c&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(dt,{className:"h-4 w-4"}),c]}),i?a.jsx(Nf,{}):s==="compare"&&r?a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"rounded-xl bg-primary/5 p-4",children:[a.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold",children:"Comparison Cost Summary"}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Updated On: ",Vr(r.current.updatedAt)]})]}),x]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[a.jsx(Ie,{label:"Period accrued total",value:`${K(r.current.totalCost,r.current.currency)} vs ${K(r.previous.totalCost,r.previous.currency)}`,helper:`${g>=0?"+":""}${g.toFixed(1)}% from previous period`,trend:g}),a.jsx(Ie,{label:jt(r.currentStart,r.currentEnd,u),value:K(r.current.totalCost,r.current.currency),helper:"Current period spending"}),a.jsx(Ie,{label:jt(r.previousStart,r.previousEnd,u),value:K(r.previous.totalCost,r.previous.currency),helper:"Previous period spending"}),a.jsx(Ie,{label:u==="monthly"?"Monthly change":"Period change",value:`${p>=0?"+":""}${K(p,r.current.currency)}`,helper:`${g>=0?"+":""}${g.toFixed(1)}% from previous period`,trend:p})]})]}),a.jsx(Rf,{rows:o,currency:r.current.currency}),a.jsx(Pf,{rows:o,groupBy:t,comparison:r,granularity:u})]}):n?a.jsxs(a.Fragment,{children:[n.message&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border bg-muted/50 p-3 text-sm text-muted-foreground",children:[a.jsx(dt,{className:"h-4 w-4"}),n.message]}),a.jsxs("section",{className:"rounded-xl bg-primary/5 p-4",children:[a.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold",children:h.title}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Updated On: ",Vr(n.updatedAt)]})]}),x]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[a.jsx(Ie,{label:"Accrued cost",value:K(n.totalCost,n.currency)}),a.jsx(Ie,{label:h.top,value:m?K(m.amount,n.currency):"-",accent:!0}),a.jsx(Ie,{label:h.count,value:String(n.count||0),accent:!0})]})]}),a.jsxs(de,{children:[a.jsx(je,{children:a.jsx(Pe,{className:"text-sm",children:"Cost Trend"})}),a.jsx(ue,{children:a.jsx(jf,{timeline:n.timeline||[],currency:n.currency||"USD",daily:u==="daily"})})]}),a.jsx(Ef,{groupBy:t,report:n})]}):null]}),a.jsx(Af,{mode:s,groupBy:t,start:f,end:d,granularity:u,reportTagKey:e.reportTagKey,options:e.options,filters:e.draftFilters,loading:i,filtersLoading:e.filtersLoading,comparisonPeriods:e.selectedComparisonPeriods,onModeChange:e.changeMode,onStartChange:e.setStart,onEndChange:e.setEnd,onGranularityChange:e.setGranularity,onReportTagKeyChange:e.setReportTagKey,onFiltersChange:e.setDraftFilters,onLoadTagValues:y=>{e.loadOptions(y)},onRun:e.runReport,onApply:e.applyFilters,onReset:e.resetFilters})]})]})]})}const qr={READY:"bg-emerald-500/10 text-emerald-600 border-emerald-500/30",RUNNING:"bg-blue-500/10 text-blue-600 border-blue-500/30",WAITING_FOR_DATA:"bg-amber-500/10 text-amber-600 border-amber-500/30",WAITING_FOR_TABLE:"bg-amber-500/10 text-amber-600 border-amber-500/30",FAILED:"bg-destructive/10 text-destructive border-destructive/30",PENDING:"bg-muted text-muted-foreground border-border"},Mf={INFO:"text-muted-foreground",WARN:"text-amber-600",ERROR:"text-destructive"},cs=e=>e?new Date(e).toLocaleString():"—";function Df({status:e}){return a.jsx("span",{className:`rounded-full border px-2 py-0.5 text-xs font-medium ${qr[e]||qr.PENDING}`,children:e.replace(/_/g," ")})}function De({label:e,value:t,mono:s}){return a.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:e}),a.jsx("span",{className:`break-all text-sm ${s?"font-mono text-xs":""}`,children:t||"—"})]})}function Ff(){const{managementAccountId:e,loading:t}=_t(),[s,n]=E.useState([]),[r,o]=E.useState([]),[i,c]=E.useState(!0),[l,u]=E.useState(null),f=E.useCallback(async()=>{c(!0),u(null);try{const d=await se.get("/cur-discovery",{params:{logLimit:100,managementAccountId:e}});n(d.data?.jobs||[]),o(d.data?.logs||[])}catch(d){u(d?.response?.data?.error||d?.message||"Unable to load CUR discovery status")}finally{c(!1)}},[e]);return E.useEffect(()=>{t||f()},[f,t]),a.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(Pn,{className:"h-6 w-6 text-primary"}),"CUR Discovery"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Progress of the scheduled job that locates this tenant’s Cost and Usage Report table. Cost data becomes available after it reports Ready."})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(Is,{}),a.jsx("button",{onClick:()=>{f()},disabled:i||t,className:"rounded-lg border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh",children:a.jsx(St,{className:`h-4 w-4 ${i||t?"animate-spin":""}`})})]})]}),l&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(dt,{className:"h-4 w-4"}),l]}),!i&&!l&&!s.length&&a.jsx(de,{children:a.jsx(ue,{className:"py-10 text-center text-sm text-muted-foreground",children:"No discovery job exists for this tenant yet. One is created automatically once the AWS connection is verified and the Cost plugin is entitled."})}),s.map(d=>a.jsxs(de,{children:[a.jsxs(je,{className:"flex flex-row flex-wrap items-center gap-3",children:[a.jsx(ta,{className:"h-4 w-4 text-primary"}),a.jsxs(Pe,{className:"text-sm",children:["Management account ",d.managementAccountId]}),a.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["connection ",d.connectionId]}),a.jsx(Df,{status:d.status}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["attempt ",d.attemptCount]}),a.jsxs("span",{className:"ms-auto text-xs text-muted-foreground",children:["next check ",cs(d.nextRunAt)]})]}),a.jsxs(ue,{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[a.jsx(De,{label:"Source",value:d.curS3Uri||`s3://${d.bucket}/${d.prefix}`,mono:!0}),a.jsx(De,{label:"Tenant partition",value:d.tenantPartition,mono:!0}),a.jsx(De,{label:"Region",value:d.region}),a.jsx(De,{label:"Glue database",value:d.database,mono:!0}),a.jsx(De,{label:"Discovered table",value:d.table,mono:!0}),a.jsx(De,{label:"Table location",value:d.tableLocation,mono:!0}),a.jsx(De,{label:"Sample object",value:d.sampleObjectKey,mono:!0}),a.jsx(De,{label:"Last data",value:cs(d.lastDataAt)}),a.jsx(De,{label:"Last checked",value:cs(d.lastFinishedAt||d.lastStartedAt)}),d.lastError&&a.jsx("div",{className:"md:col-span-2 lg:col-span-3 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:d.lastError})]})]},d.id)),s.length>0&&a.jsxs("section",{children:[a.jsx("h2",{className:"mb-3 text-sm font-semibold",children:"Recent activity"}),a.jsx("div",{className:"space-y-2",children:s.map(d=>{const h=r.filter(m=>m.jobId===d.id);return a.jsxs("details",{open:!0,className:"rounded-md border bg-card",children:[a.jsxs("summary",{className:"cursor-pointer px-4 py-3 text-sm font-medium",children:["Management account ",a.jsx("span",{className:"font-mono",children:d.managementAccountId})]}),a.jsx("div",{className:"border-t px-4 py-2",children:h.length?a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b text-left text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"py-2 pe-4 font-medium",children:"Time"}),a.jsx("th",{className:"py-2 pe-4 font-medium",children:"Level"}),a.jsx("th",{className:"py-2 pe-4 font-medium",children:"Event"}),a.jsx("th",{className:"py-2 font-medium",children:"Message"})]})}),a.jsx("tbody",{children:h.map(m=>a.jsxs("tr",{className:"border-b last:border-0 align-top",children:[a.jsx("td",{className:"whitespace-nowrap py-2 pe-4 text-xs text-muted-foreground",children:cs(m.createdAt)}),a.jsx("td",{className:`py-2 pe-4 text-xs font-medium ${Mf[m.level]||""}`,children:m.level}),a.jsx("td",{className:"whitespace-nowrap py-2 pe-4 font-mono text-xs",children:m.event}),a.jsx("td",{className:"py-2",children:m.message})]},m.id))})]})}):a.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No log entries recorded yet."})})]},d.id)})})]})]})}const Uf=e=>e.launchUrl||`https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create?stackName=${encodeURIComponent(e.stackName||`MeyiConnect-${e.connectionId}-Management`)}`,$f=e=>e==="CONNECTED"?"border-emerald-500/30 bg-emerald-500/10 text-emerald-600":e==="FAILED"?"border-destructive/30 bg-destructive/10 text-destructive":"border-amber-500/30 bg-amber-500/10 text-amber-700",Dt=e=>{const t=e?.response?.data?.error||e?.response?.data?.message||e?.message||"Request failed",s=e?.response?.data?.details;return s?`${t} ${s}`:t};function Bf(){const{selectManagementAccount:e,refreshSources:t}=_t(),[s,n]=E.useState([]),[r,o]=E.useState(!0),[i,c]=E.useState(!1),[l,u]=E.useState(null),[f,d]=E.useState(!1),[h,m]=E.useState(""),[p,g]=E.useState(!1),[b,x]=E.useState(null),[y,S]=E.useState(null),[N,C]=E.useState(null),_=E.useCallback(async()=>{o(!0),C(null);try{n((await oe.getSources()).sources||[])}catch(k){C(Dt(k))}finally{o(!1)}},[]);E.useEffect(()=>{_()},[_]);const j=async k=>{if(k.preventDefault(),!/^\d{12}$/.test(h)){C("AWS account ID must contain exactly 12 digits");return}S("create"),C(null);try{const T=await oe.createSource({managementAccountId:h,regionMode:p?"ALL":"SINGLE"});T.managementAccountId&&e(T.managementAccountId),await t(),x(T.connectionId),c(!1),m(""),g(!1),await _()}catch(T){C(Dt(T))}finally{S(null)}},w=async k=>{S(`download-${k}`),C(null);try{const T=await oe.downloadSourceTemplate(k),Z=URL.createObjectURL(T),z=document.createElement("a");z.href=Z,z.download=`meyi-connect-cost-${k}.yaml`,z.click(),URL.revokeObjectURL(Z),x(k)}catch(T){C(Dt(T))}finally{S(null)}},P=async k=>{S(`verify-${k}`),C(null);try{const T=await oe.verifySource(k);T.status==="FAILED"&&C(T.message||"AWS connection verification failed"),await _()}catch(T){C(Dt(T))}finally{S(null)}},I=async()=>{if(l){S(`remove-${l.connectionId}`),C(null);try{await oe.removeSource(l.connectionId,f),u(null),d(!1),await _(),await t()}catch(k){C(Dt(k))}finally{S(null)}}};return a.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(Cs,{className:"h-6 w-6 text-primary"}),"Cost Sources"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"AWS accounts connected to this tenant for Cost and Usage Report data."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{_()},disabled:r,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh sources",title:"Refresh sources",children:a.jsx(St,{className:`h-4 w-4 ${r?"animate-spin":""}`})}),a.jsxs("button",{type:"button",onClick:()=>{C(null),c(!0)},className:"flex items-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:opacity-90",children:[a.jsx(iu,{className:"h-4 w-4"}),"Add AWS account"]})]})]}),N&&a.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(dt,{className:"mt-0.5 h-4 w-4 shrink-0"}),N]}),!r&&s.length===0&&a.jsxs("div",{className:"rounded-md border border-dashed py-14 text-center",children:[a.jsx(Cs,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground"}),a.jsx("p",{className:"font-medium",children:"No AWS Cost source"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Add an AWS account to begin collecting tenant cost data."})]}),s.length>0&&a.jsx("div",{className:"overflow-x-auto rounded-md border",children:a.jsxs("table",{className:"w-full min-w-[780px] text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-muted/50 text-left text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 font-medium",children:"AWS account"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Connection"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Scope"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:s.map(k=>a.jsxs("tr",{className:`border-b last:border-0 ${b===k.connectionId?"bg-muted/30":""}`,children:[a.jsx("td",{className:"px-4 py-3 font-mono",children:k.managementAccountId||"Pending"}),a.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:k.connectionId}),a.jsxs("td",{className:"px-4 py-3",children:[k.accountScope," / ",k.regionMode]}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:`rounded-full border px-2 py-1 text-xs font-medium ${$f(k.status)}`,children:k.status.replace(/_/g," ")}),k.stackSetStatus&&a.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:k.stackSetStatus.replace(/_/g," ")})]}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{w(k.connectionId)},disabled:!!y,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50",title:"Download CloudFormation template","aria-label":"Download CloudFormation template",children:y===`download-${k.connectionId}`?a.jsx(st,{className:"h-4 w-4 animate-spin"}):a.jsx(En,{className:"h-4 w-4"})}),a.jsx("a",{href:Uf(k),target:"_blank",rel:"noreferrer",className:"rounded-md border p-2 hover:bg-muted",title:`Open AWS CloudFormation as ${k.stackName||`MeyiConnect-${k.connectionId}-Management`}`,"aria-label":"Open AWS CloudFormation",children:a.jsx(na,{className:"h-4 w-4"})}),a.jsxs("button",{type:"button",onClick:()=>{P(k.connectionId)},disabled:!!y||k.status==="CONNECTED",className:"flex items-center gap-2 rounded-md border px-3 py-2 font-medium hover:bg-muted disabled:opacity-50",children:[y===`verify-${k.connectionId}`?a.jsx(st,{className:"h-4 w-4 animate-spin"}):k.status==="CONNECTED"?a.jsx(Wd,{className:"h-4 w-4 text-emerald-600"}):a.jsx(St,{className:"h-4 w-4"}),k.status==="CONNECTED"?"Connected":"Verify"]}),a.jsx("button",{type:"button",onClick:()=>{d(!1),u(k)},disabled:!!y,className:"rounded-md border p-2 text-destructive hover:bg-destructive/10 disabled:opacity-50",title:"Remove Cost source","aria-label":"Remove Cost source",children:a.jsx(ia,{className:"h-4 w-4"})})]})})]},k.connectionId))})]})}),i&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"add-source-title",children:a.jsxs("form",{onSubmit:k=>{j(k)},className:"w-full max-w-md rounded-md border bg-background p-5 shadow-xl",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsx("h2",{id:"add-source-title",className:"text-lg font-semibold",children:"Add AWS account"}),a.jsx("button",{type:"button",onClick:()=>c(!1),className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(Wt,{className:"h-4 w-4"})})]}),a.jsx("label",{className:"mt-5 block text-sm font-medium",htmlFor:"aws-account-id",children:"AWS account ID"}),a.jsx("input",{id:"aws-account-id",value:h,onChange:k=>m(k.target.value.replace(/\D/g,"").slice(0,12)),inputMode:"numeric",autoComplete:"off",placeholder:"123456789012",className:"mt-2 h-10 w-full rounded-md border bg-background px-3 font-mono outline-none focus:ring-2 focus:ring-ring"}),a.jsxs("label",{className:"mt-4 flex items-start gap-3 rounded-md border p-3",children:[a.jsx("input",{type:"checkbox",checked:p,onChange:k=>g(k.target.checked),className:"mt-1 h-4 w-4"}),a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm font-medium",children:"All enabled AWS regions"}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:"Use organization-wide StackSet deployment across enabled regions."})]})]}),a.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:()=>c(!1),className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsxs("button",{type:"submit",disabled:y==="create"||h.length!==12,className:"flex items-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:[y==="create"&&a.jsx(st,{className:"h-4 w-4 animate-spin"}),"Create source"]})]})]})}),l&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"remove-source-title",children:a.jsxs("div",{className:"w-full max-w-md rounded-md border bg-background p-5 shadow-xl",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsx("h2",{id:"remove-source-title",className:"text-lg font-semibold",children:"Remove Cost source"}),a.jsx("button",{type:"button",onClick:()=>u(null),disabled:!!y,className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(Wt,{className:"h-4 w-4"})})]}),a.jsxs("p",{className:"mt-4 text-sm",children:["Remove AWS account ",a.jsx("span",{className:"font-mono font-medium",children:l.managementAccountId})," from this tenant?"]}),a.jsxs("label",{className:"mt-4 flex items-start gap-3 rounded-md border border-destructive/30 p-3",children:[a.jsx("input",{type:"checkbox",checked:f,onChange:k=>d(k.target.checked),disabled:!!y,className:"mt-1 h-4 w-4"}),a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm font-medium",children:"Also delete generated AWS resources"}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:"Deletes MeyiConnect StackSet instances, the StackSet, and the management stack before removing this source. CUR data already delivered to the central bucket is retained."})]})]}),a.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"If AWS cleanup fails, the source is preserved so you can retry or clean up manually."}),a.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:()=>u(null),disabled:!!y,className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsxs("button",{type:"button",onClick:()=>{I()},disabled:!!y,className:"flex items-center gap-2 rounded-md bg-destructive px-4 py-2 text-sm font-medium text-destructive-foreground disabled:opacity-50",children:[y===`remove-${l.connectionId}`&&a.jsx(st,{className:"h-4 w-4 animate-spin"}),"Remove"]})]})]})})]})}const zf=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Vf=["UTC","Asia/Kolkata","America/New_York","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];function Wf({open:e,schedule:t,saving:s,onClose:n,onSave:r}){const[o,i]=E.useState(t);if(E.useEffect(()=>i(t),[t,e]),!e)return null;const c=l=>i(u=>({...u,frequency:l}));return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4",role:"presentation",onMouseDown:l=>{l.target===l.currentTarget&&n()},children:a.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"cost-ai-schedule-title",className:"w-full max-w-lg overflow-hidden rounded-lg border bg-background shadow-xl",children:[a.jsxs("div",{className:"flex items-start justify-between border-b px-5 py-4",children:[a.jsxs("div",{children:[a.jsxs("h2",{id:"cost-ai-schedule-title",className:"flex items-center gap-2 text-base font-semibold",children:[a.jsx(ea,{className:"h-4 w-4 text-primary"}),"AI report schedule"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Reports run automatically against completed AWS CUR periods."})]}),a.jsx("button",{type:"button",onClick:n,className:"rounded-md p-1.5 hover:bg-muted","aria-label":"Close",children:a.jsx(Wt,{className:"h-4 w-4"})})]}),a.jsxs("form",{className:"space-y-5 p-5",onSubmit:l=>{l.preventDefault(),r({enabled:o.enabled,frequency:o.frequency,time:o.time,timezone:o.timezone,dayOfWeek:o.dayOfWeek,dayOfMonth:o.dayOfMonth}).then(n)},children:[a.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border p-3",children:[a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm font-medium",children:"Scheduled reports"}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:"Generate reports without a manual action"})]}),a.jsx("input",{type:"checkbox",checked:o.enabled,onChange:l=>i(u=>({...u,enabled:l.target.checked})),className:"h-4 w-4 accent-primary"})]}),a.jsxs("fieldset",{disabled:!o.enabled||s,className:"space-y-5 disabled:opacity-60",children:[a.jsxs("div",{children:[a.jsx("span",{className:"mb-2 block text-sm font-medium",children:"Frequency"}),a.jsx("div",{className:"grid grid-cols-3 rounded-lg border p-1",children:["daily","weekly","monthly"].map(l=>a.jsx("button",{type:"button",onClick:()=>c(l),className:`rounded-md px-3 py-2 text-sm capitalize ${o.frequency===l?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:l},l))})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("label",{className:"text-sm font-medium",children:["Run time",a.jsx("input",{type:"time",required:!0,value:o.time,onChange:l=>i(u=>({...u,time:l.target.value})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal"})]}),a.jsxs("label",{className:"text-sm font-medium",children:["Timezone",a.jsx("select",{value:o.timezone,onChange:l=>i(u=>({...u,timezone:l.target.value})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:[...new Set([o.timezone,...Vf])].map(l=>a.jsx("option",{children:l},l))})]})]}),o.frequency==="weekly"&&a.jsxs("label",{className:"block text-sm font-medium",children:["Day of week",a.jsx("select",{value:o.dayOfWeek??1,onChange:l=>i(u=>({...u,dayOfWeek:Number(l.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:zf.map((l,u)=>a.jsx("option",{value:u,children:l},l))})]}),o.frequency==="monthly"&&a.jsxs("label",{className:"block text-sm font-medium",children:["Day of month",a.jsx("input",{type:"number",min:1,max:28,value:o.dayOfMonth??1,onChange:l=>i(u=>({...u,dayOfMonth:Number(l.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Daily reports cover the previous day, weekly reports the previous seven complete days, and monthly reports the previous calendar month."})]}),a.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[a.jsx("button",{type:"button",onClick:n,className:"rounded-lg border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsx("button",{type:"submit",disabled:s,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:s?"Saving":"Save schedule"})]})]})]})})}function Hf(){const{managementAccountId:e,loading:t}=_t(),[s,n]=E.useState(null),[r,o]=E.useState(null),[i,c]=E.useState(null),[l,u]=E.useState([]),[f,d]=E.useState(!0),[h,m]=E.useState(!1),[p,g]=E.useState(null),[b,x]=E.useState(null),y=E.useRef(!0),S=E.useCallback(async(j=!1)=>{j||d(!0);try{const[w,P,I,k]=await Promise.all([oe.getAnalysisStatus({managementAccountId:e}),oe.getDataStatus({managementAccountId:e}),oe.getAnalysisSchedule({managementAccountId:e}),oe.getAnalysisReports({managementAccountId:e})]);if(!y.current)return;n(w),o(P),c(I),u(k),x(null)}catch(w){y.current&&x(w?.response?.data?.error||w?.message||"Unable to load scheduled AI reports")}finally{y.current&&!j&&d(!1)}},[e]);return E.useEffect(()=>(y.current=!0,t||S(),()=>{y.current=!1}),[S,t]),E.useEffect(()=>{if(!l.some(w=>w.status==="PENDING"||w.status==="RUNNING"))return;const j=window.setInterval(()=>{S(!0)},15e3);return()=>window.clearInterval(j)},[S,l]),{status:s,dataStatus:r,schedule:i,reports:l,loading:f||t,saving:h,removingId:p,error:b,load:S,saveSchedule:async j=>{m(!0),x(null);try{const w=await oe.updateAnalysisSchedule(j,{managementAccountId:e});y.current&&c(w)}catch(w){throw x(w?.response?.data?.error||w?.message||"Unable to save the AI report schedule"),w}finally{y.current&&m(!1)}},download:async j=>{try{const w=await oe.downloadAnalysisPdf(j.id),P=URL.createObjectURL(w),I=document.createElement("a");I.href=P,I.download=`meyi-cost-analysis-${j.period.Start}.pdf`,I.click(),URL.revokeObjectURL(P)}catch(w){x(w?.response?.data?.error||w?.message||"Unable to download the PDF report")}},remove:async j=>{if(window.confirm(`Remove the AI cost report for ${j.period.Start} through ${j.period.End}?`)){g(j.id),x(null);try{await oe.removeAnalysisReport(j.id),y.current&&u(w=>w.filter(P=>P.id!==j.id))}catch(w){y.current&&x(w?.response?.data?.error||w?.message||"Unable to remove the AI report")}finally{y.current&&g(null)}}}}}const sn=e=>e?new Date(e).toLocaleString():"Not scheduled",qf=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString(),Gf=e=>{const t=new Date(`${e}T00:00:00Z`);return t.setUTCDate(t.getUTCDate()-1),t.toLocaleDateString()},Kf={COMPLETED:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700",RUNNING:"border-blue-500/30 bg-blue-500/10 text-blue-700",PENDING:"border-amber-500/30 bg-amber-500/10 text-amber-700",FAILED:"border-destructive/30 bg-destructive/10 text-destructive"};function Yf(){const e=Hf(),t=mf(),[s,n]=E.useState(!1),r=t.toLowerCase()==="admin";return a.jsxs("div",{className:"flex min-w-0 max-w-full flex-col gap-6 overflow-x-hidden p-2 md:p-6",children:[a.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(Lr,{className:"h-6 w-6 text-primary"}),"AI Cost Analysis"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Scheduled Cost reports generated from AWS CUR data"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(Is,{}),a.jsx("button",{type:"button",onClick:()=>{e.load()},disabled:e.loading,className:"rounded-lg border p-2.5 hover:bg-muted disabled:opacity-50",title:"Refresh reports","aria-label":"Refresh reports",children:a.jsx(St,{className:`h-4 w-4 ${e.loading?"animate-spin":""}`})}),r&&e.schedule&&a.jsxs("button",{type:"button",onClick:()=>n(!0),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground",children:[a.jsx(aa,{className:"h-4 w-4"}),"Report settings"]})]})]}),e.error&&a.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive",children:[a.jsx(dt,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.error]}),e.loading?a.jsx("div",{className:"h-72 animate-pulse rounded-lg bg-muted"}):e.dataStatus&&!e.dataStatus.ready?a.jsx(ks,{status:e.dataStatus}):e.status&&!e.status.enabled?a.jsx(de,{children:a.jsxs(ue,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(Lr,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("h2",{className:"mt-4 text-base font-semibold",children:e.status.reason==="AI_PROVIDER_REQUIRED"?"Configure an AI provider":"AI cost analysis is not enabled"}),a.jsx("p",{className:"mt-2 max-w-xl text-sm text-muted-foreground",children:e.status.reason==="AI_PROVIDER_REQUIRED"?"Configure and activate an AI provider in Meyi Connect before scheduled cost reports can run.":"An administrator must enable the Cost AI deployment setting before scheduled reports can run."})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border bg-card px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ea,{className:"h-5 w-5 text-primary"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold",children:e.schedule?.enabled?`${e.schedule.frequency[0].toUpperCase()}${e.schedule.frequency.slice(1)} reports enabled`:"Scheduled reports disabled"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e.schedule?.enabled?`Next run ${sn(e.schedule.nextRunAt)} (${e.schedule.timezone})`:r?"Open report settings to configure a schedule":"An administrator can configure the report schedule"})]})]}),e.schedule?.lastRunAt&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last run ",sn(e.schedule.lastRunAt)]})]}),e.reports.length?a.jsx("div",{className:"overflow-hidden rounded-lg border bg-card",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full min-w-[960px] text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-muted/40 text-left text-xs text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 font-medium",children:"Report period"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Schedule"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"AI provider"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Generated"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Total cost"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:e.reports.map(o=>a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsxs("td",{className:"px-4 py-3 font-medium",children:[qf(o.period.Start)," - ",Gf(o.period.End)]}),a.jsx("td",{className:"px-4 py-3 capitalize text-muted-foreground",children:o.frequency}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:"capitalize",children:o.provider||"-"}),o.modelId&&a.jsx("p",{className:"max-w-48 truncate text-xs text-muted-foreground",title:o.modelId,children:o.modelId})]}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:sn(o.completedAt||o.startedAt||o.createdAt)}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-xs font-medium ${Kf[o.status]}`,children:[(o.status==="RUNNING"||o.status==="PENDING")&&a.jsx(st,{className:"h-3 w-3 animate-spin"}),o.status.toLowerCase()]}),o.error&&a.jsx("p",{className:"mt-1 max-w-xs truncate text-xs text-destructive",title:o.error,children:o.error})]}),a.jsx("td",{className:"px-4 py-3",children:o.facts?new Intl.NumberFormat(void 0,{style:"currency",currency:o.facts.currency}).format(o.facts.currentTotal):"-"}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{e.download(o)},disabled:!o.pdfReady,className:"inline-flex h-9 items-center gap-2 rounded-lg border px-3 text-sm font-medium hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40",title:o.pdfReady?"Download PDF":"PDF not ready",children:[a.jsx(En,{className:"h-4 w-4"}),"Download"]}),r&&a.jsx("button",{type:"button",onClick:()=>{e.remove(o)},disabled:e.removingId===o.id||o.status==="RUNNING"||o.status==="PENDING",className:"inline-flex h-9 w-9 items-center justify-center rounded-lg border text-destructive hover:bg-destructive/10 disabled:cursor-not-allowed disabled:opacity-40",title:"Remove report","aria-label":"Remove report",children:e.removingId===o.id?a.jsx(st,{className:"h-4 w-4 animate-spin"}):a.jsx(ia,{className:"h-4 w-4"})})]})})]},o.id))})]})})}):a.jsx(de,{children:a.jsxs(ue,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(ra,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("h2",{className:"mt-4 text-base font-semibold",children:"No scheduled reports yet"}),a.jsx("p",{className:"mt-2 max-w-lg text-sm text-muted-foreground",children:"The first report will appear here after the configured schedule runs."})]})})]}),e.schedule&&a.jsx(Wf,{open:s,schedule:e.schedule,saving:e.saving,onClose:()=>n(!1),onSave:e.saveSchedule})]})}const kt=fc({component:Ro}),Jf=Ht({getParentRoute:()=>kt,path:"/",component:Sf}),Xf=Ht({getParentRoute:()=>kt,path:"/reports",component:If}),Zf=Ht({getParentRoute:()=>kt,path:"/cur-discovery",component:Ff}),Qf=Ht({getParentRoute:()=>kt,path:"/analysis",component:Yf}),eh=Ht({getParentRoute:()=>kt,path:"/sources",component:Bf});function On(){return kt.addChildren([Jf,Qf,Xf,eh,Zf])}function th(e="/cost"){return No({routeTree:On(),basepath:e})}function sh({apiBase:e,token:t,basePath:s="/cost",userRole:n="user",tenantId:r="default"}){Xo(e,t);const o=E.useMemo(()=>No({routeTree:On(),basepath:s}),[s]);return a.jsx(hf,{value:n,children:a.jsx(pf,{tenantId:r,children:a.jsx(_c,{router:o})})})}const nh=[{title:"Overview",url:"/",icon:"DollarSign",roles:["admin","user"]},{title:"AI Analysis",url:"/analysis",icon:"Sparkles",roles:["admin","user"]},{title:"Reports",url:"/reports",icon:"FileText",roles:["admin","user"]},{title:"Sources",url:"/sources",icon:"CloudCog",roles:["admin"]},{title:"CUR Discovery",url:"/cur-discovery",icon:"Search",roles:["admin"]}];exports.CostPage=sh;exports.api=se;exports.attachAuthInterceptors=Cd;exports.configureApi=Xo;exports.costNavItems=nh;exports.createCostRouter=th;exports.createRouteTree=On;
|