@meyicloud/meyi-cost-ui 1.7.4 → 1.7.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/index.js CHANGED
@@ -1,61 +1,59 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),Zo=require("react-dom");function Qo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const S=Qo(_),ea=Qo(Zo);var hn={exports:{}},zt={};var ws;function fc(){if(ws)return zt;ws=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var c in s)c!=="key"&&(o[c]=s[c])}else o=s;return s=o.ref,{$$typeof:e,type:r,key:i,ref:s!==void 0?s:null,props:o}}return zt.Fragment=t,zt.jsx=n,zt.jsxs=n,zt}var Wt={};var Ss;function hc(){return Ss||(Ss=1,process.env.NODE_ENV!=="production"&&(function(){function e(k){if(k==null)return null;if(typeof k=="function")return k.$$typeof===A?null:k.displayName||k.name||null;if(typeof k=="string")return k;switch(k){case b:return"Fragment";case y:return"Profiler";case x:return"StrictMode";case E:return"Suspense";case C:return"SuspenseList";case I:return"Activity"}if(typeof k=="object")switch(typeof k.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),k.$$typeof){case p:return"Portal";case N:return k.displayName||"Context";case v:return(k._context.displayName||"Context")+".Consumer";case j:var z=k.render;return k=k.displayName,k||(k=z.displayName||z.name||"",k=k!==""?"ForwardRef("+k+")":"ForwardRef"),k;case R:return z=k.displayName||null,z!==null?z:e(k.type)||"Memo";case P:z=k._payload,k=k._init;try{return e(k(z))}catch{}}return null}function t(k){return""+k}function n(k){try{t(k);var z=!1}catch{z=!0}if(z){z=console;var G=z.error,H=typeof Symbol=="function"&&Symbol.toStringTag&&k[Symbol.toStringTag]||k.constructor.name||"Object";return G.call(z,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",H),t(k)}}function r(k){if(k===b)return"<>";if(typeof k=="object"&&k!==null&&k.$$typeof===P)return"<...>";try{var z=e(k);return z?"<"+z+">":"<...>"}catch{return"<...>"}}function s(){var k=D.A;return k===null?null:k.getOwner()}function o(){return Error("react-stack-top-frame")}function i(k){if(O.call(k,"key")){var z=Object.getOwnPropertyDescriptor(k,"key").get;if(z&&z.isReactWarning)return!1}return k.key!==void 0}function c(k,z){function G(){Z||(Z=!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)",z))}G.isReactWarning=!0,Object.defineProperty(k,"key",{get:G,configurable:!0})}function u(){var k=e(this.type);return Q[k]||(Q[k]=!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.")),k=this.props.ref,k!==void 0?k:null}function f(k,z,G,H,V,$){var q=G.ref;return k={$$typeof:g,type:k,key:z,props:G,_owner:H},(q!==void 0?q:null)!==null?Object.defineProperty(k,"ref",{enumerable:!1,get:u}):Object.defineProperty(k,"ref",{enumerable:!1,value:null}),k._store={},Object.defineProperty(k._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(k,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(k,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(k,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:$}),Object.freeze&&(Object.freeze(k.props),Object.freeze(k)),k}function d(k,z,G,H,V,$){var q=z.children;if(q!==void 0)if(H)if(B(q)){for(H=0;H<q.length;H++)l(q[H]);Object.freeze&&Object.freeze(q)}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 l(q);if(O.call(z,"key")){q=e(k);var oe=Object.keys(z).filter(function(Pe){return Pe!=="key"});H=0<oe.length?"{key: someKey, "+oe.join(": ..., ")+": ...}":"{key: someKey}",L[q+H]||(oe=0<oe.length?"{"+oe.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react"),xa=require("react-dom");function ba(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const j=ba(P),ya=ba(xa);var bn={exports:{}},Ht={};var Tr;function Oc(){if(Tr)return Ht;Tr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,r,a){var i=null;if(a!==void 0&&(i=""+a),r.key!==void 0&&(i=""+r.key),"key"in r){a={};for(var c in r)c!=="key"&&(a[c]=r[c])}else a=r;return r=a.ref,{$$typeof:e,type:s,key:i,ref:r!==void 0?r:null,props:a}}return Ht.Fragment=t,Ht.jsx=n,Ht.jsxs=n,Ht}var qt={};var Or;function Lc(){return Or||(Or=1,process.env.NODE_ENV!=="production"&&(function(){function e(_){if(_==null)return null;if(typeof _=="function")return _.$$typeof===v?null:_.displayName||_.name||null;if(typeof _=="string")return _;switch(_){case b:return"Fragment";case y:return"Profiler";case x:return"StrictMode";case k:return"Suspense";case R:return"SuspenseList";case I:return"Activity"}if(typeof _=="object")switch(typeof _.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),_.$$typeof){case g:return"Portal";case C:return _.displayName||"Context";case w:return(_._context.displayName||"Context")+".Consumer";case E:var U=_.render;return _=_.displayName,_||(_=U.displayName||U.name||"",_=_!==""?"ForwardRef("+_+")":"ForwardRef"),_;case S:return U=_.displayName||null,U!==null?U:e(_.type)||"Memo";case A:U=_._payload,_=_._init;try{return e(_(U))}catch{}}return null}function t(_){return""+_}function n(_){try{t(_);var U=!1}catch{U=!0}if(U){U=console;var G=U.error,Y=typeof Symbol=="function"&&Symbol.toStringTag&&_[Symbol.toStringTag]||_.constructor.name||"Object";return G.call(U,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Y),t(_)}}function s(_){if(_===b)return"<>";if(typeof _=="object"&&_!==null&&_.$$typeof===A)return"<...>";try{var U=e(_);return U?"<"+U+">":"<...>"}catch{return"<...>"}}function r(){var _=O.A;return _===null?null:_.getOwner()}function a(){return Error("react-stack-top-frame")}function i(_){if(T.call(_,"key")){var U=Object.getOwnPropertyDescriptor(_,"key").get;if(U&&U.isReactWarning)return!1}return _.key!==void 0}function c(_,U){function G(){Z||(Z=!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)",U))}G.isReactWarning=!0,Object.defineProperty(_,"key",{get:G,configurable:!0})}function l(){var _=e(this.type);return W[_]||(W[_]=!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.")),_=this.props.ref,_!==void 0?_:null}function f(_,U,G,Y,K,z){var H=G.ref;return _={$$typeof:p,type:_,key:U,props:G,_owner:Y},(H!==void 0?H:null)!==null?Object.defineProperty(_,"ref",{enumerable:!1,get:l}):Object.defineProperty(_,"ref",{enumerable:!1,value:null}),_._store={},Object.defineProperty(_._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(_,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(_,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.defineProperty(_,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.freeze&&(Object.freeze(_.props),Object.freeze(_)),_}function u(_,U,G,Y,K,z){var H=U.children;if(H!==void 0)if(Y)if(L(H)){for(Y=0;Y<H.length;Y++)d(H[Y]);Object.freeze&&Object.freeze(H)}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(H);if(T.call(U,"key")){H=e(_);var ne=Object.keys(U).filter(function(Te){return Te!=="key"});Y=0<ne.length?"{key: someKey, "+ne.join(": ..., ")+": ...}":"{key: someKey}",D[H+Y]||(ne=0<ne.length?"{"+ne.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} />`,H,q,oe,q),L[q+H]=!0)}if(q=null,G!==void 0&&(n(G),q=""+G),i(z)&&(n(z.key),q=""+z.key),"key"in z){G={};for(var X in z)X!=="key"&&(G[X]=z[X])}else G=z;return q&&c(G,typeof k=="function"?k.displayName||k.name||"Unknown":k),f(k,q,G,s(),V,$)}function l(k){h(k)?k._store&&(k._store.validated=1):typeof k=="object"&&k!==null&&k.$$typeof===P&&(k._payload.status==="fulfilled"?h(k._payload.value)&&k._payload.value._store&&(k._payload.value._store.validated=1):k._store&&(k._store.validated=1))}function h(k){return typeof k=="object"&&k!==null&&k.$$typeof===g}var m=_,g=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),N=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),A=Symbol.for("react.client.reference"),D=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=Object.prototype.hasOwnProperty,B=Array.isArray,J=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(k){return k()}};var Z,Q={},ge=m.react_stack_bottom_frame.bind(m,o)(),ve=J(r(o)),L={};Wt.Fragment=b,Wt.jsx=function(k,z,G){var H=1e4>D.recentlyCreatedOwnerStacks++;return d(k,z,G,!1,H?Error("react-stack-top-frame"):ge,H?J(r(k)):ve)},Wt.jsxs=function(k,z,G){var H=1e4>D.recentlyCreatedOwnerStacks++;return d(k,z,G,!0,H?Error("react-stack-top-frame"):ge,H?J(r(k)):ve)}})()),Wt}var Rs;function mc(){return Rs||(Rs=1,process.env.NODE_ENV==="production"?hn.exports=fc():hn.exports=hc()),hn.exports}var a=mc(),Qt=typeof window<"u"?S.useLayoutEffect:S.useEffect;function dr(e){const t=S.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function pc(e,t,n={},r={}){S.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!="function")return;const s=new IntersectionObserver(([o])=>{t(o)},n);return s.observe(e.current),()=>{s.disconnect()}},[t,n,r.disabled,e])}function gc(e){const t=S.useRef(null);return S.useImperativeHandle(e,()=>t.current,[]),t}const ta=!1;function en(e){return e[e.length-1]}function xc(e){return typeof e=="function"}function rt(e,t){return xc(e)?e(t):e}const na=Object.prototype.hasOwnProperty,Ns=Object.prototype.propertyIsEnumerable;function ra(e){for(const t in e)if(na.call(e,t))return!0;return!1}const bc=()=>Object.create(null),et=(e,t)=>st(e,t,bc);function st(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;const s=t,o=Es(e)&&Es(s);if(!o&&!(Bn(e)&&Bn(s)))return s;const i=o?e:Cs(e);if(!i)return s;const c=o?s:Cs(s);if(!c)return s;const u=i.length,f=c.length,d=o?new Array(f):n();let l=0;for(let h=0;h<f;h++){const m=o?h:c[h],g=e[m],p=s[m];if(g===p){d[m]=g,(o?h<u:na.call(e,m))&&l++;continue}if(g===null||p===null||typeof g!="object"||typeof p!="object"){d[m]=p;continue}const b=st(g,p,n,r+1);d[m]=b,b===g&&l++}return u===f&&l===u?e:d}function Cs(e){const t=Object.getOwnPropertyNames(e);for(const s of t)if(!Ns.call(e,s))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const r=t;for(const s of n){if(!Ns.call(e,s))return!1;r.push(s)}return r}function Bn(e){if(!js(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!js(n)||!n.hasOwnProperty("isPrototypeOf"))}function js(e){return Object.prototype.toString.call(e)==="[object Object]"}function Es(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ct(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,s=e.length;r<s;r++)if(!ct(e[r],t[r],n))return!1;return!0}if(Bn(e)&&Bn(t)){const r=n?.ignoreUndefined??!0;if(n?.partial){for(const i in t)if((!r||t[i]!==void 0)&&!ct(e[i],t[i],n))return!1;return!0}let s=0;if(!r)s=Object.keys(e).length;else for(const i in e)e[i]!==void 0&&s++;let o=0;for(const i in t)if((!r||t[i]!==void 0)&&(o++,o>s||!ct(e[i],t[i],n)))return!1;return s===o}return!1}function Pt(e){let t,n;const r=new Promise((s,o)=>{t=s,n=o});return r.status="pending",r.resolve=s=>{r.status="resolved",r.value=s,t(s),e?.(s)},r.reject=s=>{r.status="rejected",n(s)},r}function tn(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function ks(e,t){for(let n=e.length-1;n>=0;n--){const r=e[n];if(t(r))return r}}const yc=/[\x00-\x1f\x7f"<>`{}]/g;function vc(e){return e.replace(yc,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function _s(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return vc(t)}const wc=["http:","https:","mailto:","tel:"];function zn(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Vt(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,r="",s;for(;(s=t.exec(e))!==null;)r+=_s(e.slice(n,s.index))+s[0],n=t.lastIndex;r=r+_s(n?e.slice(n):e);let o=!1;return r.startsWith("//")&&(o=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:o}}function Sc(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Rc(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Be(){throw new Error("Invariant failed")}function nn(e){const t=new Map;let n,r;const s=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,n=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 s(i),i.value},set(o,i){if(t.size>=e&&n){const u=n;t.delete(u.key),u.next&&(n=u.next,u.next.prev=void 0),u===r&&(r=void 0)}const c=t.get(o);if(c)c.value=i,s(c);else{const u={key:o,value:i,prev:r};r&&(r.next=u),r=u,n||(n=u),t.set(o,u)}},clear(){t.clear(),n=void 0,r=void 0}}}const Ge=4,sa=5;function Nc(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function oa(e,t,n=new Uint16Array(6)){const r=e.indexOf("/",t),s=r===-1?e.length:r,o=e.substring(t,s);if(!o||!o.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n;if(o==="$"){const c=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=c,n[4]=c,n[5]=c,n}if(o.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=s,n[4]=s,n[5]=s,n;const i=Nc(o);if(i){const[c,u]=i,f=o.charCodeAt(c+1);if(f===45){if(c+2<o.length&&o.charCodeAt(c+2)===36){const d=c+3,l=u;if(d<l)return n[0]=3,n[1]=t+c,n[2]=t+d,n[3]=t+l,n[4]=t+u+1,n[5]=s,n}}else if(f===36){const d=c+1,l=c+2;return l===u?(n[0]=2,n[1]=t+c,n[2]=t+d,n[3]=t+l,n[4]=t+u+1,n[5]=e.length,n):(n[0]=1,n[1]=t+c,n[2]=t+l,n[3]=t+u,n[4]=t+u+1,n[5]=s,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n}function tr(e,t,n,r,s,o,i){i?.(n);let c=r;{const u=n.fullPath??n.from,f=u.length,d=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;c<f;){const m=oa(u,c,t);let g;const p=c,b=m[5];switch(c=b+1,o++,m[0]){case 0:{const x=u.substring(m[2],m[3]);if(d){const y=s.static?.get(x);if(y)g=y;else{s.static??=new Map;const v=ot(n.fullPath??n.from);v.parent=s,v.depth=o,g=v,s.static.set(x,v)}}else{const y=x.toLowerCase(),v=s.staticInsensitive?.get(y);if(v)g=v;else{s.staticInsensitive??=new Map;const N=ot(n.fullPath??n.from);N.parent=s,N.depth=o,g=N,s.staticInsensitive.set(y,N)}}break}case 1:{const x=u.substring(p,m[1]),y=u.substring(m[4],b),v=d&&!!(x||y),N=x?v?x:x.toLowerCase():void 0,j=y?v?y:y.toLowerCase():void 0,E=!l&&s.dynamic?.find(C=>!C.parse&&C.caseSensitive===v&&C.prefix===N&&C.suffix===j);if(E)g=E;else{const C=hr(1,n.fullPath??n.from,v,N,j);g=C,C.depth=o,C.parent=s,s.dynamic??=[],s.dynamic.push(C)}break}case 3:{const x=u.substring(p,m[1]),y=u.substring(m[4],b),v=d&&!!(x||y),N=x?v?x:x.toLowerCase():void 0,j=y?v?y:y.toLowerCase():void 0,E=!l&&s.optional?.find(C=>!C.parse&&C.caseSensitive===v&&C.prefix===N&&C.suffix===j);if(E)g=E;else{const C=hr(3,n.fullPath??n.from,v,N,j);g=C,C.parent=s,C.depth=o,s.optional??=[],s.optional.push(C)}break}case 2:{const x=u.substring(p,m[1]),y=u.substring(m[4],b),v=d&&!!(x||y),N=x?v?x:x.toLowerCase():void 0,j=y?v?y:y.toLowerCase():void 0,E=hr(2,n.fullPath??n.from,v,N,j);g=E,E.parent=s,E.depth=o,s.wildcard??=[],s.wildcard.push(E)}}s=g}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const m=ot(n.fullPath??n.from);m.kind=sa,m.parent=s,o++,m.depth=o,s.pathless??=[],s.pathless.push(m),s=m}const h=(n.path||!n.children)&&!n.isRoot;if(h&&u.endsWith("/")){const m=ot(n.fullPath??n.from);m.kind=Ge,m.parent=s,o++,m.depth=o,s.index=m,s=m}s.parse=l??null,s.priority=n.options?.params?.priority??0,h&&!s.route&&(s.route=n,s.fullPath=n.fullPath??n.from)}if(n.children)for(const u of n.children)tr(e,t,u,c,s,o,i)}function fr(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 qe(e){if(e.pathless)for(const t of e.pathless)qe(t);if(e.static)for(const t of e.static.values())qe(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())qe(t);if(e.dynamic?.length){e.dynamic.sort(fr);for(const t of e.dynamic)qe(t)}if(e.optional?.length){e.optional.sort(fr);for(const t of e.optional)qe(t)}if(e.wildcard?.length){e.wildcard.sort(fr);for(const t of e.wildcard)qe(t)}}function ot(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 hr(e,t,n,r,s){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:s}}function Cc(e,t){const n=ot("/"),r=new Uint16Array(6);for(const s of e)tr(!1,r,s,1,n,0);qe(n),t.masksTree=n,t.flatCache=nn(1e3)}function jc(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const r=es(e,t.masksTree);return t.flatCache.set(e,r),r}function Ec(e,t,n,r,s){e||="/",r||="/";const o=t?`case\0${e}`:e;let i=s.singleCache.get(o);return i||(i=ot("/"),tr(t,new Uint16Array(6),{from:e},1,i,0),s.singleCache.set(o,i)),es(r,i,n)}function kc(e,t,n=!1){const r=n?e:`nofuzz\0${e}`,s=t.matchCache.get(r);if(s!==void 0)return s;e||="/";let o;try{o=es(e,t.segmentTree,n)}catch(i){if(i instanceof URIError)o=null;else throw i}return o&&(o.branch=ia(o.route)),t.matchCache.set(r,o),o}function _c(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Pc(e,t=!1,n){const r=ot(e.fullPath),s=new Uint16Array(6),o={},i={};let c=0;return tr(t,s,e,1,r,0,u=>{if(n?.(u,c),u.id in o){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Duplicate routes found with id: ${String(u.id)}`);Be()}if(o[u.id]=u,c!==0&&u.path){const f=_c(u.fullPath);(!i[f]||u.fullPath.endsWith("/"))&&(i[f]=u)}c++}),qe(r),{processedTree:{segmentTree:r,singleCache:nn(1e3),matchCache:nn(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:i}}function es(e,t,n=!1){const r=e.split("/"),s=Oc(e,r,t,n);if(!s)return null;const[o]=aa(e,r,s);return{route:s.node.route,rawParams:o}}function aa(e,t,n){const r=Ac(n.node);let s=null;const o=Object.create(null);let i=n.extract?.part??0,c=n.extract?.node??0,u=n.extract?.path??0,f=n.extract?.segment??0;for(;c<r.length;i++,c++,u++,f++){const d=r[c];if(d.kind===Ge)break;if(d.kind===sa){f--,i--,u--;continue}const l=t[i],h=u;if(l&&(u+=l.length),d.kind===1){s??=n.node.fullPath.split("/");const m=s[f],g=d.prefix?.length??0;if(m.charCodeAt(g)===123){const p=d.suffix?.length??0,b=m.substring(g+2,m.length-p-1),x=l.substring(g,l.length-p);o[b]=decodeURIComponent(x)}else{const p=m.substring(1);o[p]=decodeURIComponent(l)}}else if(d.kind===3){if(n.skipped&1<<c){i--,u=h-1;continue}s??=n.node.fullPath.split("/");const m=s[f],g=d.prefix?.length??0,p=d.suffix?.length??0,b=m.substring(g+3,m.length-p-1),x=d.suffix||d.prefix?l.substring(g,l.length-p):l;x&&(o[b]=decodeURIComponent(x))}else if(d.kind===2){const m=d,g=e.substring(h+(m.prefix?.length??0),e.length-(m.suffix?.length??0)),p=decodeURIComponent(g);o["*"]=p,o._splat=p;break}}return n.rawParams&&Object.assign(o,n.rawParams),[o,{part:i,node:c,path:u,segment:f}]}function ia(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Ac(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Oc(e,t,n,r){if(e==="/"&&n.index)return{node:n.index,skipped:0};const s=!en(t),o=s&&e!=="/",i=t.length-(s?1:0),c=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let u=null,f=null;for(;c.length;){const d=c.pop(),{node:l,index:h,skipped:m,depth:g,statics:p,dynamics:b,optionals:x}=d;let{extract:y,rawParams:v}=d;if(l.kind===2&&l.route&&!pn(f,d))continue;if(l.parse){if(!Ps(e,t,d))continue;v=d.rawParams,y=d.extract}r&&l.route&&l.kind!==Ge&&pn(u,d)&&(u=d);const N=h===i;if(N&&(l.route&&(!o||l.kind===Ge||l.kind===2)&&pn(f,d)&&(f=d),!l.optional&&!l.wildcard&&!l.index&&!l.pathless))continue;const j=N?void 0:t[h];let E;if(N&&l.index){const C={node:l.index,index:h,skipped:m,depth:g+1,statics:p,dynamics:b,optionals:x,extract:y,rawParams:v};let R=!0;if(l.index.parse&&(Ps(e,t,C)||(R=!1)),R){if(!b&&!x&&!m&&Tc(p,i))return C;pn(f,C)&&(f=C)}}if(l.wildcard)for(let C=l.wildcard.length-1;C>=0;C--){const R=l.wildcard[C],{prefix:P,suffix:I}=R;if(!(P&&(N||!(R.caseSensitive?j:E??=j.toLowerCase()).startsWith(P)))){if(I){if(N)continue;const A=t.slice(h).join("/").slice(-I.length);if((R.caseSensitive?A:A.toLowerCase())!==I)continue}c.push({node:R,index:i,skipped:m,depth:g+1,statics:p,dynamics:b,optionals:x,extract:y,rawParams:v})}}if(l.optional){const C=m|1<<g,R=g+1;for(let P=l.optional.length-1;P>=0;P--){const I=l.optional[P];c.push({node:I,index:h,skipped:C,depth:R,statics:p,dynamics:b,optionals:x,extract:y,rawParams:v})}if(!N)for(let P=l.optional.length-1;P>=0;P--){const I=l.optional[P],{prefix:A,suffix:D}=I;if(A||D){const O=I.caseSensitive?j:E??=j.toLowerCase();if(A&&!O.startsWith(A)||D&&!O.endsWith(D))continue}c.push({node:I,index:h+1,skipped:m,depth:R,statics:p,dynamics:b,optionals:x+mn(i,h),extract:y,rawParams:v})}}if(!N&&l.dynamic&&j)for(let C=l.dynamic.length-1;C>=0;C--){const R=l.dynamic[C],{prefix:P,suffix:I}=R;if(P||I){const A=R.caseSensitive?j:E??=j.toLowerCase();if(P&&!A.startsWith(P)||I&&!A.endsWith(I))continue}c.push({node:R,index:h+1,skipped:m,depth:g+1,statics:p,dynamics:b+mn(i,h),optionals:x,extract:y,rawParams:v})}if(!N&&l.staticInsensitive){const C=l.staticInsensitive.get(E??=j.toLowerCase());C&&c.push({node:C,index:h+1,skipped:m,depth:g+1,statics:p+mn(i,h),dynamics:b,optionals:x,extract:y,rawParams:v})}if(!N&&l.static){const C=l.static.get(j);C&&c.push({node:C,index:h+1,skipped:m,depth:g+1,statics:p+mn(i,h),dynamics:b,optionals:x,extract:y,rawParams:v})}if(l.pathless){const C=g+1;for(let R=l.pathless.length-1;R>=0;R--){const P=l.pathless[R];c.push({node:P,index:h,skipped:m,depth:C,statics:p,dynamics:b,optionals:x,extract:y,rawParams:v})}}}if(f)return f;if(r&&u){let d=u.index;for(let h=0;h<u.index;h++)d+=t[h].length;const l=d===e.length?"/":e.slice(d);return u.rawParams??=Object.create(null),u.rawParams["**"]=decodeURIComponent(l),u}return null}function mn(e,t){return 2**(e-t-1)}function Tc(e,t){return e===2**(t-1)-1}function Ps(e,t,n){let r,s;try{[r,s]=aa(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=s,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function pn(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===Ge)>(e.node.kind===Ge)||t.node.kind===Ge==(e.node.kind===Ge)&&t.depth>e.depth))):!0}function On(e){return ts(e.filter(t=>t!==void 0).join("/"))}function ts(e){return e.replace(/\/{2,}/g,"/")}function ca(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function $e(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function la(e){return $e(ca(e))}function Wn(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Lc(e,t,n){return Wn(e,n)===Wn(t,n)}function Ic({base:e,to:t,trailingSlash:n="never",cache:r}){const s=t.startsWith("/"),o=!s&&t===".";let i;if(r){i=s?t:o?e:e+"\0"+t;const f=r.get(i);if(f)return f}let c;if(o)c=e.split("/");else if(s)c=t.split("/");else{for(c=e.split("/");c.length>1&&en(c)==="";)c.pop();const f=t.split("/");for(let d=0,l=f.length;d<l;d++){const h=f[d];h===""?d?d===l-1&&c.push(h):c=[h]:h===".."?c.pop():h==="."||c.push(h)}}c.length>1&&(en(c)===""?n==="never"&&c.pop():n==="always"&&c.push(""));const u=ts(c.join("/"))||"/";return i&&r&&r.set(i,u),u}function Mc(e){const t=new Map(e.map(s=>[encodeURIComponent(s),s])),n=Array.from(t.keys()).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(n,"g");return s=>s.replace(r,o=>t.get(o)??o)}function mr(e,t,n){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(s=>Os(s,n)).join("/"):Os(r,n)}function As({path:e,params:t,decoder:n,...r}){let s=!1;const o=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:o,isMissingParams:s};if(!e.includes("$"))return{interpolatedPath:e,usedParams:o,isMissingParams:s};const i=e.length;let c=0,u,f="";for(;c<i;){const d=c;u=oa(e,d,u);const l=u[5];if(c=l+1,d===l)continue;const h=u[0];if(h===0){f+="/"+e.substring(d,l);continue}if(h===2){const m=t._splat;o._splat=m,o["*"]=m;const g=e.substring(d,u[1]),p=e.substring(u[4],l);if(!m){s=!0,(g||p)&&(f+="/"+g+p);continue}const b=mr("_splat",t,n);f+="/"+g+b+p;continue}if(h===1){const m=e.substring(u[2],u[3]);!s&&!(m in t)&&(s=!0),o[m]=t[m];const g=e.substring(d,u[1]),p=e.substring(u[4],l),b=mr(m,t,n)??"undefined";f+="/"+g+b+p;continue}if(h===3){const m=e.substring(u[2],u[3]),g=t[m];if(g==null)continue;o[m]=g;const p=e.substring(d,u[1]),b=e.substring(u[4],l),x=mr(m,t,n)??"";f+="/"+p+x+b;continue}}return e.endsWith("/")&&(f+="/"),{usedParams:o,interpolatedPath:f||"/",isMissingParams:s}}function Os(e,t){const n=encodeURIComponent(e);return t?.(n)??n}function be(e){return e?.isNotFound===!0}function Dc(e,t=String){const n=new URLSearchParams;for(const r in e){const s=e[r];s!==void 0&&n.set(r,t(s))}return n.toString()}function pr(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function Fc(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[r,s]of t.entries()){const o=n[r];o==null?n[r]=pr(s):Array.isArray(o)?o.push(pr(s)):n[r]=[o,pr(s)]}return n}const Uc=Bc(JSON.parse),$c=zc(JSON.stringify,JSON.parse);function Bc(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=Fc(t);for(const r in n){const s=n[r];if(typeof s=="string")try{n[r]=e(s)}catch{}}return n}}function zc(e,t){const n=typeof t=="function";function r(s){if(typeof s=="object"&&s!==null)try{return e(s)}catch{}else if(n&&typeof s=="string")try{return t(s),e(s)}catch{}return s}return s=>{const o=Dc(s,r);return o?`?${o}`:""}}const lt="__root__";function Wc(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Re(e){return e instanceof Response&&!!e.options}const Fr=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Vc=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),nr=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),ut=(e,t,n=!0)=>{const r={...e.router.options.context??{}},s=n?t:t-1;for(let o=0;o<=s;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},Ts=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,r=e.matches.findIndex(i=>i.routeId===e.router.routeTree.id),s=r>=0?r:0;let o=n?e.matches.findIndex(i=>i.routeId===n):e.firstBadMatchIndex??e.matches.length-1;o<0&&(o=s);for(let i=o;i>=0;i--){const c=e.matches[i];if(e.router.looseRoutesById[c.routeId].options.notFoundComponent)return i}return n?o:s},Ke=(e,t,n)=>{if(!(!Re(n)&&!be(n)))throw Re(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:Re(n)?"redirected":be(n)?"notFound":r.status==="pending"?"success":r.status,context:ut(e,t.index),isFetching:!1,error:n})),be(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Re(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},ua=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Ls=(e,t,n)=>{const r=ut(e,n);e.updateMatch(t,s=>({...s,context:r}))},Ht=(e,t,n)=>{const{id:r,routeId:s}=e.matches[t],o=e.router.looseRoutesById[s];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,Ke(e,e.router.getMatch(r),n);try{o.options.onError?.(n)}catch(i){n=i,Ke(e,e.router.getMatch(r),n)}e.updateMatch(r,i=>(i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,i._nonReactive.loadPromise?.resolve(),{...i,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Re(n)&&!be(n)&&(e.serialError??=n)},da=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;const s=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!nr(e,t)&&(n.options.loader||n.options.beforeLoad||ha(n))&&typeof s=="number"&&s!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){const o=setTimeout(()=>{Fr(e)},s);r._nonReactive.pendingTimeout=o}},Hc=(e,t,n)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;da(e,t,n,r);const s=()=>{const o=e.router.getMatch(t);o.preload&&(o.status==="redirected"||o.status==="notFound")&&Ke(e,o,o.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(s):s()},qc=(e,t,n,r)=>{const s=e.router.getMatch(t);let o=s._nonReactive.loadPromise;s._nonReactive.loadPromise=Pt(()=>{o?.resolve(),o=void 0});const{paramsError:i,searchError:c}=s;i&&Ht(e,n,i),c&&Ht(e,n,c),da(e,t,r,s);const u=new AbortController;let f=!1;const d=()=>{f||(f=!0,e.updateMatch(t,N=>({...N,isFetching:"beforeLoad",fetchCount:N.fetchCount+1,abortController:u})))},l=()=>{s._nonReactive.beforeLoadPromise?.resolve(),s._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,N=>({...N,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{d(),l()});return}s._nonReactive.beforeLoadPromise=Pt();const h={...ut(e,n,!1),...s.__routeContext},{search:m,params:g,cause:p}=s,b=nr(e,t),x={search:m,abortController:u,params:g,preload:b,context:h,location:e.location,navigate:N=>e.router.navigate({...N,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:b?"preload":p,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},y=N=>{if(N===void 0){e.router.batch(()=>{d(),l()});return}(Re(N)||be(N))&&(d(),Ht(e,n,N)),e.router.batch(()=>{d(),e.updateMatch(t,j=>({...j,__beforeLoadContext:N})),l()})};let v;try{if(v=r.options.beforeLoad(x),tn(v))return d(),v.catch(N=>{Ht(e,n,N)}).then(y)}catch(N){d(),Ht(e,n,N)}y(v)},Gc=(e,t)=>{const{id:n,routeId:r}=e.matches[t],s=e.router.looseRoutesById[r],o=()=>c(),i=()=>qc(e,n,t,s),c=()=>{if(ua(e,n))return;const u=Hc(e,n,s);return tn(u)?u.then(i):i()};return o()},Kc=(e,t,n)=>{const r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const s={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(s),n.options.scripts?.(s),n.options.headers?.(s)]).then(([o,i,c])=>({meta:o?.meta,links:o?.links,headScripts:o?.scripts,headers:c,scripts:i,styles:o?.styles}))},fa=(e,t,n,r,s)=>{const o=t[r-1],{params:i,loaderDeps:c,abortController:u,cause:f}=e.router.getMatch(n),d=ut(e,r),l=nr(e,n);return{params:i,deps:c,preload:!!l,parentMatchPromise:o,abortController:u,context:d,location:e.location,navigate:h=>e.router.navigate({...h,_fromLocation:e.location}),cause:l?"preload":f,route:s,...e.router.options.additionalContext}},Is=async(e,t,n,r,s)=>{try{const o=e.router.getMatch(n);try{(!(ta??e.router.isServer)||o.ssr===!0)&&rn(s);const i=s.options.loader,c=typeof i=="function"?i:i?.handler,u=c?.(fa(e,t,n,r,s)),f=!!c&&tn(u);if((f||s._lazyPromise||s._componentsPromise||s.options.head||s.options.scripts||s.options.headers||o._nonReactive.minPendingPromise)&&e.updateMatch(n,l=>({...l,isFetching:"loader"})),c){const l=f?await u:u;Ke(e,e.router.getMatch(n),l),l!==void 0&&e.updateMatch(n,h=>({...h,loaderData:l}))}s._lazyPromise&&await s._lazyPromise;const d=o._nonReactive.minPendingPromise;d&&await d,s._componentsPromise&&await s._componentsPromise,e.updateMatch(n,l=>({...l,error:void 0,context:ut(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(n,f=>({...f,status:f.status==="pending"?"success":f.status,isFetching:!1,context:ut(e,r)}));return}const u=o._nonReactive.minPendingPromise;u&&await u,be(i)&&await s.options.notFoundComponent?.preload?.(),Ke(e,e.router.getMatch(n),i);try{s.options.onError?.(i)}catch(f){c=f,Ke(e,e.router.getMatch(n),f)}!Re(c)&&!be(c)&&await rn(s,["errorComponent"]),e.updateMatch(n,f=>({...f,error:c,context:ut(e,r),status:"error",isFetching:!1}))}}catch(o){const i=e.router.getMatch(n);i&&(i._nonReactive.loaderPromise=void 0),Ke(e,i,o)}},Yc=async(e,t,n)=>{async function r(m,g,p,b,x){const y=Date.now()-g.updatedAt,v=m?x.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:x.options.staleTime??e.router.options.defaultStaleTime??0,N=x.options.shouldReload,j=typeof N=="function"?N(fa(e,t,s,n,x)):N,{status:E,invalid:C}=b,R=y>=v&&(!!e.forceStaleReload||b.cause==="enter"||p!==void 0&&p!==b.id);i=E==="success"&&(C||(j??R)),m&&x.options.preload===!1||(i&&!e.sync&&d?(c=!0,(async()=>{try{await Is(e,t,s,n,x);const P=e.router.getMatch(s);P._nonReactive.loaderPromise?.resolve(),P._nonReactive.loadPromise?.resolve(),P._nonReactive.loaderPromise=void 0,P._nonReactive.loadPromise=void 0}catch(P){Re(P)&&await e.router.navigate(P.options)}})()):E!=="success"||i?await Is(e,t,s,n,x):Ls(e,s,n))}const{id:s,routeId:o}=e.matches[n];let i=!1,c=!1;const u=e.router.looseRoutesById[o],f=u.options.loader,d=((typeof f=="function"?void 0:f?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(ua(e,s)){if(!e.router.getMatch(s))return e.matches[n];Ls(e,s,n)}else{const m=e.router.getMatch(s),g=e.router.stores.matchesId.get()[n],p=(g&&e.router.stores.matchStores.get(g)||null)?.routeId===o?g:e.router.stores.matches.get().find(x=>x.routeId===o)?.id,b=nr(e,s);if(m._nonReactive.loaderPromise){if(m.status==="success"&&!e.sync&&!m.preload&&d)return m;await m._nonReactive.loaderPromise;const x=e.router.getMatch(s),y=x._nonReactive.error||x.error;y&&Ke(e,x,y),x.status==="pending"&&await r(b,m,p,x,u)}else{const x=b&&!e.router.stores.matchStores.has(s),y=e.router.getMatch(s);y._nonReactive.loaderPromise=Pt(),x!==y.preload&&e.updateMatch(s,v=>({...v,preload:x})),await r(b,m,p,y,u)}}const l=e.router.getMatch(s);c||(l._nonReactive.loaderPromise?.resolve(),l._nonReactive.loadPromise?.resolve(),l._nonReactive.loadPromise=void 0),clearTimeout(l._nonReactive.pendingTimeout),l._nonReactive.pendingTimeout=void 0,c||(l._nonReactive.loaderPromise=void 0),l._nonReactive.dehydrated=void 0;const h=c?l.isFetching:!1;return h!==l.isFetching||l.invalid!==!1?(e.updateMatch(s,m=>({...m,isFetching:h,invalid:!1})),e.router.getMatch(s)):l};async function Ms(e){const t=e,n=[];Vc(t.router)&&Fr(t);let r;for(let h=0;h<t.matches.length;h++){try{const m=Gc(t,h);tn(m)&&await m}catch(m){if(Re(m))throw m;if(be(m))r=m;else if(!t.preload)throw m;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const s=t.firstBadMatchIndex??t.matches.length,o=r&&!t.preload?Ts(t,r):void 0,i=r&&t.preload?0:o!==void 0?Math.min(o+1,s):s;let c,u;for(let h=0;h<i;h++)n.push(Yc(t,n,h));try{await Promise.all(n)}catch{const h=await Promise.allSettled(n);for(const m of h){if(m.status!=="rejected")continue;const g=m.reason;if(Re(g))throw g;be(g)?c??=g:u??=g}if(u!==void 0)throw u}const f=c??(r&&!t.preload?r:void 0);let d=t.firstBadMatchIndex!==void 0?t.firstBadMatchIndex:t.matches.length-1;if(!f&&r&&t.preload)return t.matches;if(f){const h=Ts(t,f);if(h===void 0){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not find match for notFound boundary");Be()}const m=t.matches[h],g=t.router.looseRoutesById[m.routeId],p=t.router.options?.defaultNotFoundComponent;!g.options.notFoundComponent&&p&&(g.options.notFoundComponent=p),f.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:f},isFetching:!1})),d=h,await rn(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 rn(h,["errorComponent"])}for(let h=0;h<=d;h++){const{id:m,routeId:g}=t.matches[h],p=t.router.looseRoutesById[g];try{const b=Kc(t,m,p);if(b){const x=await b;t.updateMatch(m,y=>({...y,...x}))}}catch(b){console.error(`Error executing head for route ${g}:`,b)}}const l=Fr(t);if(tn(l)&&await l,f)throw f;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Ds(e,t){const n=t.map(r=>e.options[r]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function rn(e,t=Tn){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(r=>{const{id:s,...o}=r.options;Object.assign(e.options,o),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const n=()=>e._componentsLoaded?void 0:t===Tn?(()=>{if(e._componentsPromise===void 0){const r=Ds(e,Tn);r?e._componentsPromise=r.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Ds(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function ha(e){for(const t of Tn)if(e.options[t]?.preload)return!0;return!1}const Tn=["component","errorComponent","pendingComponent","notFoundComponent"];function Jc(e){return{input:({url:t})=>{for(const n of e)t=Ur(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=ma(e[n],t);return t}}}function Xc(e){const t=la(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),s=`${r}/`;return{input:({url:o})=>{const i=e.caseSensitive?o.pathname:o.pathname.toLowerCase();return i===r?o.pathname="/":i.startsWith(s)&&(o.pathname=o.pathname.slice(n.length)),o},output:({url:o})=>(o.pathname=On(["/",t,o.pathname]),o)}}function Ur(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function ma(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function Zc(e,t){const{createMutableStore:n,createReadonlyStore:r,batch:s,init:o}=t,i=new Map,c=new Map,u=new Map,f=n(e.status),d=n(e.loadedAt),l=n(e.isLoading),h=n(e.isTransitioning),m=n(e.location),g=n(e.resolvedLocation),p=n(e.statusCode),b=n(e.redirect),x=n([]),y=n([]),v=n([]),N=r(()=>gr(i,x.get())),j=r(()=>gr(c,y.get())),E=r(()=>gr(u,v.get())),C=r(()=>x.get()[0]),R=r(()=>x.get().some(Q=>i.get(Q)?.get().status==="pending")),P=r(()=>({locationHref:m.get().href,resolvedLocationHref:g.get()?.href,status:f.get()})),I=r(()=>({status:f.get(),loadedAt:d.get(),isLoading:l.get(),isTransitioning:h.get(),matches:N.get(),location:m.get(),resolvedLocation:g.get(),statusCode:p.get(),redirect:b.get()})),A=nn(64);function D(Q){let ge=A.get(Q);return ge||(ge=r(()=>{const ve=x.get();for(const L of ve){const k=i.get(L);if(k&&k.routeId===Q)return k.get()}}),A.set(Q,ge)),ge}const O={status:f,loadedAt:d,isLoading:l,isTransitioning:h,location:m,resolvedLocation:g,statusCode:p,redirect:b,matchesId:x,pendingIds:y,cachedIds:v,matches:N,pendingMatches:j,cachedMatches:E,firstId:C,hasPending:R,matchRouteDeps:P,matchStores:i,pendingMatchStores:c,cachedMatchStores:u,__store:I,getRouteMatchStore:D,setMatches:B,setPending:J,setCached:Z};B(e.matches),o?.(O);function B(Q){xr(Q,i,x,n,s)}function J(Q){xr(Q,c,y,n,s)}function Z(Q){xr(Q,u,v,n,s)}return O}function gr(e,t){const n=[];for(const r of t){const s=e.get(r);s&&n.push(s.get())}return n}function xr(e,t,n,r,s){const o=e.map(c=>c.id),i=new Set(o);s(()=>{for(const c of t.keys())i.has(c)||t.delete(c);for(const c of e){const u=t.get(c.id);if(!u){const f=r(c);f.routeId=c.routeId,t.set(c.id,f);continue}u.routeId=c.routeId,u.get()!==c&&u.set(c)}Rc(n.get(),o)||n.set(o)})}var Ye="__TSR_index",Fs="popstate",Us="beforeunload";function Qc(e){let t=e.getLocation();const n=new Set,r=i=>{t=e.getLocation(),n.forEach(c=>c({location:t,action:i}))},s=i=>{e.notifyOnIndexChange??!0?r(i):t=e.getLocation()},o=async({task:i,navigateOpts:c,...u})=>{if(c?.ignoreBlocker??!1){i();return}const f=e.getBlockers?.()??[],d=u.type==="PUSH"||u.type==="REPLACE";if(typeof document<"u"&&f.length&&d)for(const l of f){const h=Vn(u.path,u.state);if(await l.blockerFn({currentLocation:t,nextLocation:h,action:u.type})){e.onBlocked?.();return}}i()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:i=>(n.add(i),()=>{n.delete(i)}),push:(i,c,u)=>{const f=t.state[Ye];c=$s(f+1,c),o({task:()=>{e.pushState(i,c),r({type:"PUSH"})},navigateOpts:u,type:"PUSH",path:i,state:c})},replace:(i,c,u)=>{const f=t.state[Ye];c=$s(f,c),o({task:()=>{e.replaceState(i,c),r({type:"REPLACE"})},navigateOpts:u,type:"REPLACE",path:i,state:c})},go:(i,c)=>{o({task:()=>{e.go(i),s({type:"GO",index:i})},navigateOpts:c,type:"GO"})},back:i=>{o({task:()=>{e.back(i?.ignoreBlocker??!1),s({type:"BACK"})},navigateOpts:i,type:"BACK"})},forward:i=>{o({task:()=>{e.forward(i?.ignoreBlocker??!1),s({type:"FORWARD"})},navigateOpts:i,type:"FORWARD"})},canGoBack:()=>t.state[Ye]!==0,createHref:i=>e.createHref(i),block:i=>{if(!e.setBlockers)return()=>{};const c=e.getBlockers?.()??[];return e.setBlockers([...c,i]),()=>{const u=e.getBlockers?.()??[];e.setBlockers?.(u.filter(f=>f!==i))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function $s(e,t){t||(t={});const n=ns();return{...t,key:n,__TSR_key:n,[Ye]:e}}function el(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,r=t.history.replaceState;let s=[];const o=()=>s,i=R=>s=R,c=(R=>R),u=(()=>Vn(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const R=ns();t.history.replaceState({[Ye]:0,key:R,__TSR_key:R},"")}let f=u(),d,l=!1,h=!1,m=!1,g=!1;const p=()=>f;let b,x;const y=()=>{b&&(C._ignoreSubscribers=!0,(b.isPush?t.history.pushState:t.history.replaceState)(b.state,"",b.href),C._ignoreSubscribers=!1,b=void 0,x=void 0,d=void 0)},v=(R,P,I)=>{const A=c(P);x||(d=f),f=Vn(P,I),b={href:A,state:I,isPush:b?.isPush||R==="push"},x||(x=Promise.resolve().then(()=>y()))},N=R=>{f=u(),C.notify({type:R})},j=async()=>{if(h){h=!1;return}const R=u(),P=R.state[Ye]-f.state[Ye],I=P===1,A=P===-1,D=!I&&!A||l;l=!1;const O=D?"GO":A?"BACK":"FORWARD",B=D?{type:"GO",index:P}:{type:A?"BACK":"FORWARD"};if(m)m=!1;else{const J=o();if(typeof document<"u"&&J.length){for(const Z of J)if(await Z.blockerFn({currentLocation:f,nextLocation:R,action:O})){h=!0,t.history.go(1),C.notify(B);return}}}f=u(),C.notify(B)},E=R=>{if(g){g=!1;return}let P=!1;const I=o();if(typeof document<"u"&&I.length)for(const A of I){const D=A.enableBeforeUnload??!0;if(D===!0){P=!0;break}if(typeof D=="function"&&D()===!0){P=!0;break}}if(P)return R.preventDefault(),R.returnValue=""},C=Qc({getLocation:p,getLength:()=>t.history.length,pushState:(R,P)=>v("push",R,P),replaceState:(R,P)=>v("replace",R,P),back:R=>(R&&(m=!0),g=!0,t.history.back()),forward:R=>{R&&(m=!0),g=!0,t.history.forward()},go:R=>{l=!0,t.history.go(R)},createHref:R=>c(R),flush:y,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Us,E,{capture:!0}),t.removeEventListener(Fs,j)},onBlocked:()=>{d&&f!==d&&(f=d)},getBlockers:o,setBlockers:i,notifyOnIndexChange:!1});return t.addEventListener(Us,E,{capture:!0}),t.addEventListener(Fs,j),t.history.pushState=function(...R){const P=n.apply(t.history,R);return C._ignoreSubscribers||N("PUSH"),P},t.history.replaceState=function(...R){const P=r.apply(t.history,R);return C._ignoreSubscribers||N("REPLACE"),P},C}function tl(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Vn(e,t){const n=tl(e),r=n.indexOf("#"),s=n.indexOf("?"),o=ns();return{href:n,pathname:n.substring(0,r>0?s>0?Math.min(r,s):r:s>0?s:n.length),hash:r>-1?n.substring(r):"",search:s>-1?n.slice(s,r===-1?void 0:r):"",state:t||{[Ye]:0,key:o,__TSR_key:o}}}function ns(){return(Math.random()+1).toString(36).substring(7)}function kt(e,t){const n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}const $r=new WeakMap;var nl=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=n=>n(),this.update=n=>{process.env.NODE_ENV!=="production"&&n.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,s=this.basepath??r?.basepath??"/",o=this.basepath===void 0,i=r?.rewrite;if(this.options={...r,...n},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Mc(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=el()),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 d;this.resolvePathCache=nn(1e3),d=this.buildRouteTree(),this.setRoutes(d)}if(!this.stores&&this.latestLocation){const d=this.getStoreConfig(this);this.batch=d.batch,this.stores=Zc(sl(this.latestLocation),d),pl(this)}let c=!1;const u=this.options.basepath??"/",f=this.options.rewrite;if(o||s!==u||i!==f){this.basepath=u;const d=[],l=la(u);l&&l!=="/"&&d.push(Xc({basepath:u})),f&&d.push(f),this.rewrite=d.length===0?void 0:d.length===1?d[0]:Jc(d),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 n=Pc(this.routeTree,this.options.caseSensitive,(r,s)=>{r.init({originalIndex:s})});return this.options.routeMasks&&Cc(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,r)=>{const s={eventType:n,fn:r};return this.subscribers.add(s),()=>{this.subscribers.delete(s)}},this.emit=n=>{this.subscribers.forEach(r=>{r.eventType===n.type&&r.fn(n)})},this.parseLocation=(n,r)=>{const s=({pathname:u,search:f,hash:d,href:l,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(u)){const x=this.options.parseSearch(f),y=this.options.stringifySearch(x);return{href:u+y+d,publicHref:u+y+d,pathname:Vt(u).path,external:!1,searchStr:y,search:et(r?.search,x),hash:Vt(d.slice(1)).path,state:st(r?.state,h)}}const m=new URL(l,this.origin),g=Ur(this.rewrite,m),p=this.options.parseSearch(g.search),b=this.options.stringifySearch(p);return g.search=b,{href:g.href.replace(g.origin,""),publicHref:l,pathname:Vt(g.pathname).path,external:!!this.rewrite&&g.origin!==this.origin,searchStr:b,search:et(r?.search,p),hash:Vt(g.hash.slice(1)).path,state:st(r?.state,h)}},o=s(n),{__tempLocation:i,__tempKey:c}=o.state;if(i&&(!c||c===this.tempLocationKey)){const u=s(i);return u.state.key=o.state.key,u.state.__TSR_key=o.state.__TSR_key,delete u.state.__tempLocation,{...u,maskedLocation:o}}return o},this.resolvePathWithBase=(n,r)=>Ic({base:n,to:r.includes("//")?ts(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,r,s)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:r},s):this.matchRoutesInternal(n,r),this.getMatchedRoutes=n=>ol({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const r=this.getMatch(n);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(n=>{this.cancelMatch(n)}),this.stores.matchesId.get().forEach(n=>{if(this.stores.pendingMatchStores.has(n))return;const r=this.stores.matchStores.get(n)?.get();r&&(r.status==="pending"||r.isFetching==="loader")&&this.cancelMatch(n)})},this.buildLocation=n=>{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 A=this.getMatchedRoutes(o.from).matchedRoutes,D=ks(c.matchedRoutes,B=>zs(B.fullPath,o.from)),O=ks(A,B=>zs(B.fullPath,c.fullPath));!D&&!O&&console.warn(`Could not find match for from: ${o.from}`)}const u=o.unsafeRelative==="path"?i.pathname:o.from??c.fullPath,f=o.to?`${o.to}`:void 0,d=c.search,l=Object.assign(Object.create(null),c.params),h=f?.charCodeAt(0)===47?"/":this.resolvePathWithBase(u,"."),m=f?this.resolvePathWithBase(h,f):h,g=o.params===!1||o.params===null?Object.create(null):(o.params??!0)===!0?l:Object.assign(l,rt(o.params,l)),p=this.routesByPath[$e(m)];let b;if(p)b=this.getRouteBranch(p);else if(m.includes("$"))b=[];else{const A=this.getMatchedRoutes(m);b=A.matchedRoutes,this.options.notFoundRoute&&(!A.foundRoute||A.foundRoute.path!=="/"&&A.routeParams["**"])&&(b=[...b,this.options.notFoundRoute])}if(b.length&&ra(g))for(const A of b){const D=A.options.params?.stringify??A.options.stringifyParams;if(D)try{Object.assign(g,D(g))}catch{}}const x=n.leaveParams?m:Vt(As({path:m,params:g,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;if(process.env.NODE_ENV!=="production"&&p&&!n.leaveParams)try{const A=this.getMatchedRoutes(x);A.foundRoute?.id!==p.id&&console.warn(`Generated path "${x}" for route "${p.id}" matched route "${A.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=d;if(n._includeValidateSearch&&this.options.search?.strict){const A={};b.forEach(D=>{if(D.options.validateSearch)try{Object.assign(A,Ln(D.options.validateSearch,{...A,...y}))}catch{}}),y=A}y=al({search:y,dest:o,destRoutes:b,_includeValidateSearch:n._includeValidateSearch}),y=et(d,y);const v=this.options.stringifySearch(y),N=o.hash===!0?i.hash:o.hash?rt(o.hash,i.hash):void 0,j=N?`#${N}`:"";let E=o.state===!0?i.state:o.state?rt(o.state,i.state):{};E=st(i.state,E);const C=`${x}${v}${j}`;let R,P,I=!1;if(this.rewrite){const A=new URL(C,this.origin),D=ma(this.rewrite,A);R=A.href.replace(A.origin,""),D.origin!==this.origin?(P=D.href,I=!0):P=D.pathname+D.search+D.hash}else R=Sc(C),P=R;return{publicHref:P,href:R,pathname:x,search:y,searchStr:v,state:E,hash:N??"",external:I,unmaskOnReload:o.unmaskOnReload}},s=(o={},i)=>{const c=r(o);let u=i?r(i):void 0;if(!u){const f=Object.create(null);if(this.options.routeMasks){const d=jc(c.pathname,this.processedTree);if(d){Object.assign(f,d.rawParams);const{from:l,params:h,...m}=d.route,g=h===!1||h===null?Object.create(null):(h??!0)===!0?f:Object.assign(f,rt(h,f));i={from:n.from,...m,params:g},u=r(i)}}}return u&&(c.maskedLocation=u),c};return n.mask?s(n,{from:n.from,...n.mask}):s(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:r,...s})=>{let o;const i=()=>{const f=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];f.forEach(l=>{s.state[l]=this.latestLocation.state[l]});const d=ct(s.state,this.latestLocation.state);return f.forEach(l=>{delete s.state[l]}),d},c=$e(this.latestLocation.href)===$e(s.href);let u=this.commitLocationPromise;if(this.commitLocationPromise=Pt(()=>{u?.resolve(),u=void 0}),c&&i())this.load();else{let{maskedLocation:f,hashScrollIntoView:d,...l}=s;f&&(l={...f,state:{...f.state,__tempKey:void 0,__tempLocation:{...l,search:l.searchStr,state:{...l.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(l.unmaskOnReload??this.options.unmaskOnReload??!1)&&(l.state.__tempKey=this.tempLocationKey)),l.state.__hashScrollIntoViewOptions=d??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,o=s.replace?"REPLACE":"PUSH",this.history[o==="REPLACE"?"replace":"push"](l.publicHref,l.state,{ignoreBlocker:r})}return this._scroll.next=s.resetScroll??!0,this.history.subscribers.size||this.load(o?{action:{type:o}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,hashScrollIntoView:s,viewTransition:o,ignoreBlocker:i,href:c,...u}={})=>{if(c){const l=this.history.location.state.__TSR_index,h=Vn(c,{__TSR_index:n?l:l+1}),m=new URL(h.pathname,this.origin);u.to=Ur(this.rewrite,m).pathname,u.search=this.options.parseSearch(h.search),u.hash=h.hash.slice(1)}const f=this.buildLocation({...u,_includeValidateSearch:!0});this.pendingBuiltLocation=f;const d=this.commitLocation({...f,viewTransition:o,replace:n,resetScroll:r,hashScrollIntoView:s,ignoreBlocker:i});return queueMicrotask(()=>{this.pendingBuiltLocation===f&&(this.pendingBuiltLocation=void 0)}),d},this.navigate=async({to:n,reloadDocument:r,href:s,publicHref:o,...i})=>{let c=!1;if(s)try{new URL(`${s}`),c=!0}catch{}if(c&&!r&&(r=!0),r){if(n!==void 0||!s){const f=this.buildLocation({to:n,...i});s=s??f.publicHref,o=o??f.publicHref}const u=!c&&o?o:s;if(zn(u,this.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked navigation to dangerous protocol: ${u}`);return}if(!i.ignoreBlocker){const f=this.history.getBlockers?.()??[];for(const d of f)if(d?.blockerFn&&await d.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return}i.replace?window.location.replace(u):window.location.href=u;return}return this.buildAndCommitLocation({...i,href:s,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation),r=this.stores.cachedMatches.get().filter(s=>!n.some(o=>o.id===s.id));this.batch(()=>{this.stores.status.set("pending"),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(n),this.stores.setCached(r)})},this.load=async n=>{const r=n?.action?.type;let s,o,i;const c=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(f=>{this.startTransition(async()=>{try{this.beforeLoad(),r?$r.set(this.latestLocation,r):$r.delete(this.latestLocation);const d=this.latestLocation,l=kt(d,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...l}),this.emit({type:"onBeforeLoad",...l}),await Ms({router:this,sync:n?.sync,forceStaleReload:c.href===d.href,matches:this.stores.pendingMatches.get(),location:d,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let h=null,m=null,g=null,p=null;this.batch(()=>{const b=this.stores.pendingMatches.get(),x=b.length,y=this.stores.matches.get();h=x?y.filter(j=>!this.stores.pendingMatchStores.has(j.id)):null;const v=new Set;for(const j of this.stores.pendingMatchStores.values())j.routeId&&v.add(j.routeId);const N=new Set;for(const j of this.stores.matchStores.values())j.routeId&&N.add(j.routeId);m=x?y.filter(j=>!v.has(j.routeId)):null,g=x?b.filter(j=>!N.has(j.routeId)):null,p=x?b.filter(j=>N.has(j.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(j=>j.status!=="error"&&j.status!=="notFound"&&j.status!=="redirected")]),this.clearExpiredCache())});for(const[b,x]of[[m,"onLeave"],[g,"onEnter"],[p,"onStay"]])if(b)for(const y of b)this.looseRoutesById[y.routeId].options[x]?.(y)})})}})}catch(d){Re(d)?(s=d,this.navigate({...s.options,replace:!0,ignoreBlocker:!0})):be(d)&&(o=d);const l=s?s.status:o?404:this.stores.matches.get().some(h=>h.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(l),this.stores.redirect.set(s)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),f()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let u;this.hasNotFoundMatch()?u=404:this.stores.matches.get().some(f=>f.status==="error")&&(u=500),u!==void 0&&this.stores.statusCode.set(u)},this.startViewTransition=n=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let s;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,i=this.stores.resolvedLocation.get(),c=typeof r.types=="function"?r.types(kt(o,i)):r.types;if(c===!1){n();return}s={update:n,types:c}}else s=n;document.startViewTransition(s)}else n()},this.updateMatch=(n,r)=>{this.startTransition(()=>{const s=this.stores.pendingMatchStores.get(n);if(s){s.set(r);return}const o=this.stores.matchStores.get(n);if(o){o.set(r);return}const i=this.stores.cachedMatchStores.get(n);if(i){const c=r(i.get());c.status==="redirected"?this.stores.cachedMatchStores.delete(n)&&this.stores.cachedIds.set(u=>u.filter(f=>f!==n)):i.set(c)}})},this.getMatch=n=>this.stores.cachedMatchStores.get(n)?.get()??this.stores.pendingMatchStores.get(n)?.get()??this.stores.matchStores.get(n)?.get(),this.invalidate=n=>{const r=s=>n?.filter?.(s)??!0?{...s,invalid:!0,...n?.forcePending||s.status==="error"||s.status==="notFound"?{status:"pending",error:void 0}:void 0}:s;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:n?.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const r=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const s=n.options._builtLocation??this.buildLocation(n.options),o=this.getParsedLocationHref(s);n.options.href=o,n.headers.set("Location",o)}else if(r)try{const s=new URL(r);if(this.origin&&s.origin===this.origin){const o=s.pathname+s.search+s.hash;n.options.href=o,n.headers.set("Location",o)}}catch{}if(n.options.href&&!n.options._builtLocation&&zn(n.options.href,this.protocolAllowlist))throw new Error(process.env.NODE_ENV!=="production"?`Redirect blocked: unsafe protocol in href "${n.options.href}". Allowed protocols: ${Array.from(this.protocolAllowlist).join(", ")}.`:"Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const r=n?.filter;r!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(s=>!r(s))):this.stores.setCached([])},this.clearExpiredCache=()=>{const n=Date.now(),r=s=>{const o=this.looseRoutesById[s.routeId];if(!o.options.loader)return!0;const i=(s.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return s.status==="error"?!0:n-s.updatedAt>=i};this.clearCache({filter:r})},this.loadRouteChunk=rn,this.preloadRoute=async n=>{const r=n._builtLocation??this.buildLocation(n);let s=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:n});const o=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...o,...this.stores.cachedIds.get()]),c=s.filter(u=>!i.has(u.id));if(c.length){const u=this.stores.cachedMatches.get();this.stores.setCached([...u,...c])}try{return s=await Ms({router:this,matches:s,location:r,preload:!0,updateMatch:(u,f)=>{o.has(u)?s=s.map(d=>d.id===u?f(d):d):this.updateMatch(u,f)}}),s}catch(u){if(Re(u))return u.options.reloadDocument?void 0:await this.preloadRoute({...u.options,_fromLocation:r});be(u)||console.error(u);return}},this.matchRoute=(n,r)=>{const s={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},o=this.buildLocation(s);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=Ec(o.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,i.pathname,this.processedTree);return!c||n.params&&!ct(c.rawParams,n.params,{partial:!0})?!1:r?.includeSearch??!0?ct(i.search,o.search,{partial:!0})?c.rawParams:!1:c.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(n=>n.status==="notFound"||n.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??$c,parseSearch:e.parseSearch??Uc,protocolAllowlist:e.protocolAllowlist??wc}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const 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=ia(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 n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:s}=n;let{matchedRoutes:o}=n,i=!1;(r?r.path!=="/"&&s["**"]:$e(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:i=!0);const c=i?cl(this.options.notFoundMode,o):void 0,u=new Array(o.length),f=new Map;for(const d of this.stores.matchStores.values())d.routeId&&f.set(d.routeId,d.get());for(let d=0;d<o.length;d++){const l=o[d],h=u[d-1];let m,g,p;{const D=h?.search??e.search,O=h?._strictSearch??void 0;try{const B=Ln(l.options.validateSearch,{...D})??void 0;m={...D,...B},g={...O,...B},p=void 0}catch(B){let J=B;if(B instanceof Hn||(J=new Hn(B.message,{cause:B})),t?.throwOnError)throw J;m=D,g={},p=J}}const b=l.options.loaderDeps?.({search:m})??"",x=b?JSON.stringify(b):"",{interpolatedPath:y,usedParams:v}=As({path:l.fullPath,params:s,decoder:this.pathParamsDecoder,server:this.isServer}),N=l.id+y+x,j=this.getMatch(N),E=f.get(l.id),C=j?._strictParams??v;let R;if(!j)try{Ws(l,C)}catch(D){if(be(D)||Re(D)?R=D:R=new rl(D.message,{cause:D}),t?.throwOnError)throw R}Object.assign(s,C);const P=E?"stay":"enter";let I;if(j)I={...j,cause:P,params:E?.params??s,_strictParams:C,search:et(E?E.search:j.search,m),_strictSearch:g};else{const D=l.options.loader||l.options.beforeLoad||l.lazyFn||ha(l)?"pending":"success";I={id:N,ssr:l.options.ssr,index:d,routeId:l.id,params:E?.params??s,_strictParams:C,pathname:y,updatedAt:Date.now(),search:E?et(E.search,m):m,_strictSearch:g,searchError:void 0,status:D,isFetching:!1,error:void 0,paramsError:R,__routeContext:void 0,_nonReactive:{loadPromise:Pt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:P,loaderDeps:E?st(E.loaderDeps,b):b,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:l.options.staticData||{},fullPath:l.fullPath}}t?.preload||(I.globalNotFound=c===l.id),I.searchError=p;const A=this.getParentContext(h);I.context={...A,...I.__routeContext,...I.__beforeLoadContext},u[d]=I}for(let d=0;d<u.length;d++){const l=u[d],h=this.looseRoutesById[l.routeId],m=this.getMatch(l.id),g=f.get(l.routeId);if(l.params=g?et(g.params,s):s,!m){const p=u[d-1],b=this.getParentContext(p);if(h.options.context){const x={deps:l.loaderDeps,params:l.params,context:b??{},location:e,navigate:y=>this.navigate({...y,_fromLocation:e}),buildLocation:this.buildLocation,cause:l.cause,abortController:l.abortController,preload:!!l.preload,matches:u,routeId:h.id};l.__routeContext=h.options.context(x)??void 0}l.context={...b,...l.__routeContext,...l.__beforeLoadContext}}}return u}matchRoutesLightweight(e){const t=en(this.stores.matchesId.get()),n=this.lightweightCache.get(e);if(n&&n[0]===t)return n[1];const{matchedRoutes:r,routeParams:s}=this.getMatchedRoutes(e.pathname),o=en(r),i={...e.search};for(const l of r)try{Object.assign(i,Ln(l.options.validateSearch,i))}catch{}const c=t&&this.stores.matchStores.get(t)?.get(),u=c&&c.routeId===o.id&&c.pathname===e.pathname;let f;if(u)f=c.params;else{const l=Object.assign(Object.create(null),s);for(const h of r)try{Ws(h,l)}catch{}f=l}const d={matchedRoutes:r,fullPath:o.fullPath,search:i,params:f};return this.lightweightCache.set(e,[t,d]),d}},Hn=class extends Error{},rl=class extends Error{};const Bs=e=>e.endsWith("/")&&e.length>1?e.slice(0,-1):e;function zs(e,t){return Bs(e)===Bs(t)}function sl(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Ln(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new Hn("Async validation not supported");if(n.issues)throw new Hn(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function ol({pathname:e,routesById:t,processedTree:n}){const r=Object.create(null),s=$e(e);let o;const i=kc(s,n,!0);return i&&(o=i.route,Object.assign(r,i.rawParams)),{matchedRoutes:i?.branch||[t.__root__],routeParams:r,foundRoute:o}}function al({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return il(n)(e,t,r??!1)}function il(e){let t,n;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 u=({search:f,next:d})=>{const l=d(i.preSearchFilters?i.preSearchFilters.reduce((h,m)=>m(h),f):f);return i.postSearchFilters?i.postSearchFilters.reduce((h,m)=>m(h),l):l};r.push(u)}const c=i.validateSearch;if(c){const u=({search:f,next:d,meta:l})=>{const h=d(f);if(n)try{const m=Ln(c,h);if(l&&m)for(const g in m)g in h||(l.defaulted||=new Map).set(g,m[g]);return{...h,...m}}catch{}return h};r.push(u)}}const s=(o,i,c)=>{if(o>=r.length){if(!t.search)return{};if(t.search===!0)return i;const f=rt(t.search,i);return c&&(c.explicit=f),f}const u=(f,d)=>{if(d){const l=c||{};return{search:s(o+1,f,l),meta:l}}return s(o+1,f,c)};return r[o]({search:i,next:u,meta:c})};return function(i,c,u){return t=c,n=u,s(0,i)}}function cl(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.children)return r.id}return lt}function Ws(e,t){const n=e.options.params?.parse??e.options.parseParams;if(n){const r=n(t);if(r===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,r)}}function ll(){try{return sessionStorage}catch{return}}const ul="tsr-scroll-restoration-v1_3",pa=ll();function dl(){try{return JSON.parse(pa?.getItem("tsr-scroll-restoration-v1_3")||"{}")}catch{return{}}}function fl(){try{pa?.setItem(ul,JSON.stringify(Ct))}catch{process.env.NODE_ENV!=="production"&&console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}const Ct=dl(),Vs="data-scroll-restoration-id",hl=e=>e.state.__TSR_key||e.href;function ml(e){const t=e.getAttribute(Vs);if(t)return`[${Vs}="${t}"]`;let n="",r=e,s;for(;s=r.parentNode;){let o=1,i=r;for(;i=i.previousElementSibling;)o++;const c=`${r.localName}:nth-child(${o})`;n=n?`${c} > ${n}`:c,r=s}return n}let gn=!1;const jt="window";function Br(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function Hs(e){const t=[];for(const n of e){if(n===jt)continue;const r=Br(n);r&&t.push(r)}return t}function pl(e,t){const n=e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);const s=e.options.getScrollRestorationKey||hl,o=new Map,i=(f,d,l)=>{const h=o.get(f)||{};h.scrollX=d,h.scrollY=l,o.set(f,h)},c=f=>{if(!(gn||!r.restoring))if(f.target===document)i(jt,scrollX,scrollY);else{const d=f.target;i(d,d.scrollLeft,d.scrollTop)}},u=f=>{if(!r.restoring)return;const d=Ct[f]||={};for(const[l,h]of o)l===jt?d[jt]=h:l.isConnected&&(d[ml(l)]=h)};n&&!r.restoration&&(r.restoration=!0,gn=!1,history.scrollRestoration="manual",document.addEventListener("scroll",c,!0),e.subscribe("onBeforeLoad",f=>{f.fromLocation&&u(s(f.fromLocation)),o.clear()}),addEventListener("pagehide",()=>{u(s(e.stores.resolvedLocation.get()??e.stores.location.get())),fl()})),!r.reset&&(r.reset=!0,e.subscribe("onRendered",f=>{const d=e.options.scrollRestorationBehavior,l=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=s(f.toLocation),p=f.fromLocation&&s(f.fromLocation);if(r.restoring&&p&&p!==g){const b=Ct[p];if(b){let x=Ct[g];for(const y in b){if(y===jt){if(h)continue}else{const v=Br(y);if(!v||h&&l&&(m??=Hs(l),m.includes(v)))continue}x||(x=Ct[g]={}),x[y]??=b[y]}}}gn=!0;try{const b=f.toLocation.hash,x=f.toLocation.state.__hashScrollIntoViewOptions??!0;let y=!1;if(h){const v=$r.get(f.toLocation),N=b&&x&&(v==="PUSH"||v==="REPLACE"),j=r.restoring?Ct[g]:void 0;if(j)for(const E in j){const{scrollX:C,scrollY:R}=j[E];if(E===jt){if(N)continue;scrollTo({top:R,left:C,behavior:d}),y=!0}else{const P=Br(E);P&&(P.scrollLeft=C,P.scrollTop=R)}}if(!y&&!b){const E={top:0,left:0,behavior:d};if(scrollTo(E),l){m??=Hs(l);for(const C of m)C.scrollTo(E)}}}!y&&b&&x&&document.getElementById(b)?.scrollIntoView(x)}finally{gn=!1}}))}const gl="Error preloading route! ☝️";var ga=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 n=this.options,r=!n?.path&&!n?.id;if(this.parentRoute=this.options.getParentRoute?.(),r)this._path=lt;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.");Be()}let s=r?lt:n?.path;s&&s!=="/"&&(s=ca(s));const o=n?.id||s;let i=r?lt:On([this.parentRoute.id==="__root__"?"":this.parentRoute.id,o]);s==="__root__"&&(s="/"),i!=="__root__"&&(i=On(["/",i]));const c=i==="__root__"?"/":On([this.parentRoute.fullPath,s]);this._path=s,this._id=i,this._fullPath=c,this._to=$e(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=>Wc({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.")}},xl=class extends ga{constructor(e){super(e)}};function rs(e){const t=e.errorComponent??ss;return a.jsx(bl,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?S.createElement(t,{error:n,reset:r}):e.children})}var bl=class extends S.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function ss({error:e}){const[t,n]=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:()=>n(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 yl({children:e,fallback:t=null}){return xa()?a.jsx(_.Fragment,{children:e}):a.jsx(_.Fragment,{children:t})}function xa(){return _.useSyncExternalStore(vl,()=>!0,()=>!1)}function vl(){return()=>{}}var ba=S.createContext(null);function _e(e){const t=S.useContext(ba);return process.env.NODE_ENV!=="production"&&(t||console.warn("Warning: useRouter must be used inside a <RouterProvider> component!")),t}var rr=S.createContext(void 0),wl=S.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 Sl({update:e,notify:t,unwatched:n}){return{link:r,unlink:s,propagate:o,checkDirty:i,shallowPropagate:c};function r(f,d,l){const h=d.depsTail;if(h!==void 0&&h.dep===f)return;const m=h!==void 0?h.nextDep:d.deps;if(m!==void 0&&m.dep===f){m.version=l,d.depsTail=m;return}const g=f.subsTail;if(g!==void 0&&g.version===l&&g.sub===d)return;const p=d.depsTail=f.subsTail={version:l,dep:f,sub:d,prevDep:h,nextDep:m,prevSub:g,nextSub:void 0};m!==void 0&&(m.prevDep=p),h!==void 0?h.nextDep=p:d.deps=p,g!==void 0?g.nextSub=p:f.subs=p}function s(f,d=f.sub){const l=f.dep,h=f.prevDep,m=f.nextDep,g=f.nextSub,p=f.prevSub;return m!==void 0?m.prevDep=h:d.depsTail=h,h!==void 0?h.nextDep=m:d.deps=m,g!==void 0?g.prevSub=p:l.subsTail=p,p!==void 0?p.nextSub=g:(l.subs=g)===void 0&&n(l),m}function o(f){let d=f.nextSub,l;e:do{const h=f.sub;let m=h.flags;if(m&60?m&12?m&4?!(m&48)&&u(f,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=(f=g).nextSub;p!==void 0&&(l={value:d,prev:l},d=p);continue}}if((f=d)!==void 0){d=f.nextSub;continue}for(;l!==void 0;)if(f=l.value,l=l.prev,f!==void 0){d=f.nextSub;continue e}break}while(!0)}function i(f,d){let l,h=0,m=!1;e:do{const g=f.dep,p=g.flags;if(d.flags&16)m=!0;else if((p&17)===17){if(e(g)){const b=g.subs;b.nextSub!==void 0&&c(b),m=!0}}else if((p&33)===33){(f.nextSub!==void 0||f.prevSub!==void 0)&&(l={value:f,prev:l}),f=g.deps,d=g,++h;continue}if(!m){const b=f.nextDep;if(b!==void 0){f=b;continue}}for(;h--;){const b=d.subs,x=b.nextSub!==void 0;if(x?(f=l.value,l=l.prev):f=b,m){if(e(d)){x&&c(b),d=f.sub;continue}m=!1}else d.flags&=-33;d=f.sub;const y=f.nextDep;if(y!==void 0){f=y;continue e}}return m}while(!0)}function c(f){do{const d=f.sub,l=d.flags;(l&48)===32&&(d.flags=l|16,(l&6)===2&&t(d))}while((f=f.nextSub)!==void 0)}function u(f,d){let l=d.depsTail;for(;l!==void 0;){if(l===f)return!0;l=l.prevDep}return!1}}function Rl(e,t,n){const r=typeof e=="object",s=r?e:void 0;return{next:(r?e.next:e)?.bind(s),error:(r?e.error:t)?.bind(s),complete:(r?e.complete:n)?.bind(s)}}const zr=[];let In=0;const{link:qs,unlink:Nl,propagate:Cl,checkDirty:ya,shallowPropagate:Gs}=Sl({update(e){return e._update()},notify(e){zr[Wr++]=e,e.flags&=~se.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=se.Mutable|se.Dirty,qn(e))}});let xn=0,Wr=0,Ie,Vr=0;function va(e){try{++Vr,e()}finally{--Vr||wa()}}function qn(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Nl(n,e)}function wa(){if(!(Vr>0)){for(;xn<Wr;){const e=zr[xn];zr[xn++]=void 0,e.notify()}xn=0,Wr=0}}function Ks(e,t){const n=typeof e=="function",r=e,s={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?se.None:se.Mutable,get(){return Ie!==void 0&&qs(s,Ie,In),s._snapshot},subscribe(o){const i=Rl(o),c={current:!1},u=jl(()=>{s.get(),c.current?i.next?.(s._snapshot):c.current=!0});return{unsubscribe:()=>{u.stop()}}},_update(o){const i=Ie,c=t?.compare??Object.is;if(n)Ie=s,++In,s.depsTail=void 0;else if(o===void 0)return!1;n&&(s.flags=se.Mutable|se.RecursedCheck);try{const u=s._snapshot,f=typeof o=="function"?o(u):o===void 0&&n?r(u):o;return u===void 0||!c(u,f)?(s._snapshot=f,!0):!1}finally{Ie=i,n&&(s.flags&=~se.RecursedCheck),qn(s)}}};return n?(s.flags=se.Mutable|se.Dirty,s.get=function(){const o=s.flags;if(o&se.Dirty||o&se.Pending&&ya(s.deps,s)){if(s._update()){const i=s.subs;i!==void 0&&Gs(i)}}else o&se.Pending&&(s.flags=o&~se.Pending);return Ie!==void 0&&qs(s,Ie,In),s._snapshot}):s.set=function(o){if(s._update(o)){const i=s.subs;i!==void 0&&(Cl(i),Gs(i),wa())}},s}function jl(e){const t=()=>{const r=Ie;Ie=n,++In,n.depsTail=void 0,n.flags=se.Watching|se.RecursedCheck;try{return e()}finally{Ie=r,n.flags&=~se.RecursedCheck,qn(n)}},n={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&&ya(this.deps,this)?t():this.flags=se.Watching},stop(){this.flags=se.None,this.depsTail=void 0,qn(this)}};return t(),n}var bn={exports:{}},br={},yn={exports:{}},yr={};var Ys;function El(){if(Ys)return yr;Ys=1;var e=_;function t(l,h){return l===h&&(l!==0||1/l===1/h)||l!==l&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function c(l,h){var m=h(),g=r({inst:{value:m,getSnapshot:h}}),p=g[0].inst,b=g[1];return o(function(){p.value=m,p.getSnapshot=h,u(p)&&b({inst:p})},[l,m,h]),s(function(){return u(p)&&b({inst:p}),l(function(){u(p)&&b({inst:p})})},[l]),i(m),m}function u(l){var h=l.getSnapshot;l=l.value;try{var m=h();return!n(l,m)}catch{return!0}}function f(l,h){return h()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return yr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,yr}var vr={};var Js;function kl(){return Js||(Js=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){d||s.startTransition===void 0||(d=!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(!l){var b=g();o(p,b)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}b=i({inst:{value:p,getSnapshot:g}});var x=b[0].inst,y=b[1];return u(function(){x.value=p,x.getSnapshot=g,n(x)&&y({inst:x})},[m,p,g]),c(function(){return n(x)&&y({inst:x}),m(function(){n(x)&&y({inst:x})})},[m]),f(p),p}function n(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 s=_,o=typeof Object.is=="function"?Object.is:e,i=s.useState,c=s.useEffect,u=s.useLayoutEffect,f=s.useDebugValue,d=!1,l=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;vr.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),vr}var Xs;function Sa(){return Xs||(Xs=1,process.env.NODE_ENV==="production"?yn.exports=El():yn.exports=kl()),yn.exports}var Zs;function _l(){if(Zs)return br;Zs=1;var e=_,t=Sa();function n(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,c=e.useMemo,u=e.useDebugValue;return br.useSyncExternalStoreWithSelector=function(f,d,l,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 x(E){if(!y){if(y=!0,v=E,E=h(E),m!==void 0&&p.hasValue){var C=p.value;if(m(C,E))return N=C}return N=E}if(C=N,r(v,E))return C;var R=h(E);return m!==void 0&&m(C,R)?(v=E,C):(v=E,N=R)}var y=!1,v,N,j=l===void 0?null:l;return[function(){return x(d())},j===null?void 0:function(){return x(j())}]},[d,l,h,m]);var b=s(f,g[0],g[1]);return i(function(){p.hasValue=!0,p.value=b},[b]),u(b),b},br}var wr={};var Qs;function Pl(){return Qs||(Qs=1,process.env.NODE_ENV!=="production"&&(function(){function e(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=_,n=Sa(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,o=t.useRef,i=t.useEffect,c=t.useMemo,u=t.useDebugValue;wr.useSyncExternalStoreWithSelector=function(f,d,l,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 x(E){if(!y){if(y=!0,v=E,E=h(E),m!==void 0&&p.hasValue){var C=p.value;if(m(C,E))return N=C}return N=E}if(C=N,r(v,E))return C;var R=h(E);return m!==void 0&&m(C,R)?(v=E,C):(v=E,N=R)}var y=!1,v,N,j=l===void 0?null:l;return[function(){return x(d())},j===null?void 0:function(){return x(j())}]},[d,l,h,m]);var b=s(f,g[0],g[1]);return i(function(){p.hasValue=!0,p.value=b},[b]),u(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),wr}var eo;function Al(){return eo||(eo=1,process.env.NODE_ENV==="production"?bn.exports=_l():bn.exports=Pl()),bn.exports}var Ol=Al();function Tl(e,t){return e===t}function je(e,t,n=Tl){const r=_.useCallback(i=>{if(!e)return()=>{};const{unsubscribe:c}=e.subscribe(i);return c},[e]),s=_.useCallback(()=>e?.get(),[e]);return Ol.useSyncExternalStoreWithSelector(r,s,s,t,n)}var Sr={get(){},subscribe(){return{unsubscribe(){}}}};function Ll(e,t){const n=S.useRef();return r=>{const s=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=st(n.current,s):s}}function gt(e){const t=_e(),n=S.useContext(e.from?wl:rr),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),s=Ll(e,t),o=je(r??Sr,i=>i?s(i):Sr);if(o!==Sr)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!"}`);Be()}}function Ra(e){return gt({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Na(e){const{select:t,...n}=e;return gt({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function Ca(e){return gt({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function ja(e){return gt({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ea(e){const t=_e();return S.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function ka(e){return gt({...e,select:t=>e.select?e.select(t.context):t.context})}function Il(e,t){const n=_e(),r=gc(t),{activeProps:s,inactiveProps:o,activeOptions:i,to:c,preload:u,preloadDelay:f,preloadIntentProximity:d,hashScrollIntoView:l,replace:h,startTransition:m,resetScroll:g,viewTransition:p,children:b,target:x,disabled:y,style:v,className:N,onClick:j,onBlur:E,onFocus:C,onMouseEnter:R,onMouseLeave:P,onTouchStart:I,ignoreBlocker:A,params:D,search:O,hash:B,state:J,mask:Z,reloadDocument:Q,unsafeRelative:ge,from:ve,_fromLocation:L,...k}=e,z=xa(),G=S.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),H=je(n.stores.location,re=>re,(re,Se)=>re.href===Se.href),V=S.useMemo(()=>{const re={_fromLocation:H,...G};return n.buildLocation(re)},[n,H,G]),$=V.maskedLocation?V.maskedLocation.publicHref:V.publicHref,q=V.maskedLocation?V.maskedLocation.external:V.external,oe=S.useMemo(()=>Bl($,q,n.history,y),[y,q,$,n.history]),X=S.useMemo(()=>{if(oe?.external){if(zn(oe.href,n.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${oe.href}`);return}return oe.href}if(!zl(c)&&!(typeof c!="string"||c.indexOf(":")===-1))try{if(new URL(c),zn(c,n.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${c}`);return}return c}catch{}},[c,oe,n.protocolAllowlist]),Pe=S.useMemo(()=>{if(X)return!1;if(i?.exact){if(!Lc(H.pathname,V.pathname,n.basepath))return!1}else{const re=Wn(H.pathname,n.basepath),Se=Wn(V.pathname,n.basepath);if(!(re.startsWith(Se)&&(re.length===Se.length||re[Se.length]==="/")))return!1}return(i?.includeSearch??!0)&&!ct(H.search,V.search,{partial:!i?.exact,ignoreUndefined:!i?.explicitUndefined})?!1:i?.includeHash?z&&H.hash===V.hash:!0},[i?.exact,i?.explicitUndefined,i?.includeHash,i?.includeSearch,H,X,z,V.hash,V.pathname,V.search,n.basepath]),Ee=Pe?rt(s,{})??Ml:Rr,W=Pe?Rr:rt(o,{})??Rr,we=[N,Ee.className,W.className].filter(Boolean).join(" "),ae=(v||Ee.style||W.style)&&{...v,...Ee.style,...W.style},[te,U]=S.useState(!1),ue=S.useRef(!1),ce=e.reloadDocument||X?!1:u??n.options.defaultPreload,de=f??n.options.defaultPreloadDelay??0,ke=S.useCallback(()=>{n.preloadRoute({...G,_builtLocation:V}).catch(re=>{console.warn(re),console.warn(gl)})},[n,G,V]);pc(r,S.useCallback(re=>{re?.isIntersecting&&ke()},[ke]),$l,{disabled:!!y||ce!=="viewport"}),S.useEffect(()=>{ue.current||!y&&ce==="render"&&(ke(),ue.current=!0)},[y,ke,ce]);const Bt=re=>{const Se=re.currentTarget.getAttribute("target"),Qe=x!==void 0?x:Se;if(!y&&!Wl(re)&&!re.defaultPrevented&&(!Qe||Qe==="_self")&&re.button===0){re.preventDefault(),Zo.flushSync(()=>{U(!0)});const dc=n.subscribe("onResolved",()=>{dc(),U(!1)});n.navigate({...G,replace:h,resetScroll:g,hashScrollIntoView:l,startTransition:m,viewTransition:p,ignoreBlocker:A})}};if(X)return{...k,ref:r,href:X,...b&&{children:b},...x&&{target:x},...y&&{disabled:y},...v&&{style:v},...N&&{className:N},...j&&{onClick:j},...E&&{onBlur:E},...C&&{onFocus:C},...R&&{onMouseEnter:R},...P&&{onMouseLeave:P},...I&&{onTouchStart:I}};const We=re=>{if(y||ce!=="intent")return;if(!de){ke();return}const Se=re.currentTarget;if(qt.has(Se))return;const Qe=setTimeout(()=>{qt.delete(Se),ke()},de);qt.set(Se,Qe)},uc=re=>{y||ce!=="intent"||ke()},vs=re=>{if(y||!ce||!de)return;const Se=re.currentTarget,Qe=qt.get(Se);Qe&&(clearTimeout(Qe),qt.delete(Se))};return{...k,...Ee,...W,href:oe?.href,ref:r,onClick:yt([j,Bt]),onBlur:yt([E,vs]),onFocus:yt([C,We]),onMouseEnter:yt([R,We]),onMouseLeave:yt([P,vs]),onTouchStart:yt([I,uc]),disabled:!!y,target:x,...ae&&{style:ae},...we&&{className:we},...y&&Dl,...Pe&&Fl,...z&&te&&Ul}}var Rr={},Ml={className:"active"},Dl={role:"link","aria-disabled":!0},Fl={"data-status":"active","aria-current":"page"},Ul={"data-transitioning":"transitioning"},qt=new WeakMap,$l={rootMargin:"100px"},yt=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Bl(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function zl(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Gn=S.forwardRef((e,t)=>{const{_asChild:n,...r}=e,{type:s,...o}=Il(r,t),i=typeof r.children=="function"?r.children({isActive:o["data-status"]==="active"}):r.children;if(!n){const{disabled:c,...u}=o;return S.createElement("a",u,i)}return S.createElement(n,o,i)});function Wl(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var Vl=class extends ga{constructor(e){super(e),this.useMatch=t=>gt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>ka({...t,from:this.id}),this.useSearch=t=>ja({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Ca({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Na({...t,from:this.id}),this.useLoaderData=t=>Ra({...t,from:this.id}),this.useNavigate=()=>Ea({from:this.fullPath}),this.Link=_.forwardRef((t,n)=>a.jsx(Gn,{ref:n,from:this.fullPath,...t}))}};function cn(e){return new Vl(e)}var Hl=class extends xl{constructor(e){super(e),this.useMatch=t=>gt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>ka({...t,from:this.id}),this.useSearch=t=>ja({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Ca({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Na({...t,from:this.id}),this.useLoaderData=t=>Ra({...t,from:this.id}),this.useNavigate=()=>Ea({from:this.fullPath}),this.Link=_.forwardRef((t,n)=>a.jsx(Gn,{ref:n,from:this.fullPath,...t}))}};function ql(e){return new Hl(e)}function Gl(e){const t=_e(),n=`not-found-${je(t.stores.location,r=>r.pathname)}-${je(t.stores.status,r=>r)}`;return a.jsx(rs,{getResetKey:()=>n,onCatch:(r,s)=>{if(be(r))e.onCatch?.(r,s);else throw r},errorComponent:({error:r})=>{if(be(r))return e.fallback?.(r);throw r},children:e.children})}function Kl(){return a.jsx("p",{children:"Not Found"})}function Et(e){return a.jsx(a.Fragment,{children:e.children})}function _a(e,t,n){return t.options.notFoundComponent?a.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?a.jsx(e.options.defaultNotFoundComponent,{...n}):(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(Kl,{}))}function Yl(e){return null}function Jl(){return Yl(_e()),null}var Xl=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,Zl=(e,t)=>e[0]===t[0]&&e[1]===t[1],Pa=S.memo(function({matchId:t}){const n=_e(),r=n.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!`);Be()}const s=je(n.stores.loadedAt,i=>i),o=je(r,i=>i,Xl);return a.jsx(Ql,{router:n,matchId:t,resetKey:s,matchState:S.useMemo(()=>{const i=o.routeId,c=n.routesById[i].parentRoute?.id;return{routeId:i,ssr:o.ssr,_displayPending:o._displayPending,parentRouteId:c}},[o._displayPending,o.routeId,o.ssr,n.routesById])})});function Ql({router:e,matchId:t,resetKey:n,matchState:r}){const s=e.routesById[r.routeId],o=s.options.pendingComponent??e.options.defaultPendingComponent,i=o?a.jsx(o,{}):null,c=s.options.errorComponent??e.options.defaultErrorComponent,u=s.options.onCatch??e.options.defaultOnCatch,f=s.isRoot?s.options.notFoundComponent??e.options.notFoundRoute?.options.component:s.options.notFoundComponent,d=r.ssr===!1||r.ssr==="data-only",l=(!s.isRoot||s.options.wrapInSuspense||d)&&(s.options.wrapInSuspense??o??(s.options.errorComponent?.preload||d))?S.Suspense:Et,h=c?rs:Et,m=f?Gl:Et;return a.jsxs(s.isRoot?s.options.shellComponent??Et:Et,{children:[a.jsx(rr.Provider,{value:t,children:a.jsx(l,{fallback:i,children:a.jsx(h,{getResetKey:()=>n,errorComponent:c||ss,onCatch:(g,p)=>{if(be(g))throw g.routeId??=r.routeId,g;process.env.NODE_ENV!=="production"&&console.warn(`Warning: Error in route match: ${t}`),u?.(g,p)},children:a.jsx(m,{fallback:g=>{if(g.routeId??=r.routeId,!f||g.routeId&&g.routeId!==r.routeId||!g.routeId&&!s.isRoot)throw g;return S.createElement(f,g)},children:d||r._displayPending?a.jsx(yl,{fallback:i,children:a.jsx(to,{matchId:t})}):a.jsx(to,{matchId:t})})})})}),r.parentRouteId===lt?a.jsxs(a.Fragment,{children:[a.jsx(eu,{}),e.options.scrollRestoration&&ta?a.jsx(Jl,{}):null]}):null]})}function eu(){const e=_e(),t=S.useRef();return Qt(()=>{const n=e.stores.resolvedLocation.get(),r=t.current;n&&(!r||r.href!==n.href)&&e.emit({type:"onRendered",...kt(e.stores.location.get(),r??n)}),t.current=n},[je(e.stores.resolvedLocation,n=>n?.state.__TSR_key),e]),null}var to=S.memo(function({matchId:t}){const n=_e(),r=(d,l)=>n.getMatch(d.id)?._nonReactive[l]??d._nonReactive[l],s=n.stores.matchStores.get(t);if(!s){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find match for matchId "${t}". Please file an issue!`);Be()}const o=je(s,d=>d),i=o.routeId,c=n.routesById[i],u=S.useMemo(()=>{const d=(n.routesById[i].options.remountDeps??n.options.defaultRemountDeps)?.({routeId:i,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch});return d?JSON.stringify(d):void 0},[i,o.loaderDeps,o._strictParams,o._strictSearch,n.options.defaultRemountDeps,n.routesById]),f=S.useMemo(()=>{const d=c.options.component??n.options.defaultComponent;return d?a.jsx(d,{},u):a.jsx(Aa,{})},[u,c.options.component,n.options.defaultComponent]);if(o._displayPending)throw r(o,"displayPendingPromise");if(o._forcePending)throw r(o,"minPendingPromise");if(o.status==="pending"){const d=c.options.pendingMinMs??n.options.defaultPendingMinMs;if(d){const l=n.getMatch(o.id);if(l&&!l._nonReactive.minPendingPromise){const h=Pt();l._nonReactive.minPendingPromise=h,setTimeout(()=>{h.resolve(),l._nonReactive.minPendingPromise=void 0},d)}}throw r(o,"loadPromise")}if(o.status==="notFound"){if(!be(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a notFound error");Be()}return _a(n,c,o.error)}if(o.status==="redirected"){if(!Re(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a redirect error");Be()}throw r(o,"loadPromise")}if(o.status==="error")throw o.error;return f}),Aa=S.memo(function(){const t=_e(),n=S.useContext(rr);let r,s=!1,o;{const f=n?t.stores.matchStores.get(n):void 0;[r,s]=je(f,d=>[d?.routeId,d?.globalNotFound??!1],Zl),o=je(t.stores.matchesId,d=>d[d.findIndex(l=>l===n)+1])}const i=r?t.routesById[r]:void 0,c=t.options.defaultPendingComponent?a.jsx(t.options.defaultPendingComponent,{}):null;if(s){if(!i){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not resolve route for Outlet render");Be()}return _a(t,i,void 0)}if(!o)return null;const u=a.jsx(Pa,{matchId:o});return r===lt?a.jsx(S.Suspense,{fallback:c,children:u}):u});function tu(){const e=_e(),t=S.useRef({router:e,mounted:!1}),[n,r]=S.useState(!1),s=je(e.stores.isLoading,l=>l),o=je(e.stores.hasPending,l=>l),i=dr(s),c=s||n||o,u=dr(c),f=s||o,d=dr(f);return e.startTransition=l=>{r(!0),S.startTransition(()=>{l(),r(!1)})},S.useEffect(()=>{const l=e.history.subscribe(e.load),h=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return $e(e.latestLocation.publicHref)!==$e(h.publicHref)&&e.commitLocation({...h,replace:!0}),()=>{l()}},[e,e.history]),Qt(()=>{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]),Qt(()=>{i&&!s&&e.emit({type:"onLoad",...kt(e.stores.location.get(),e.stores.resolvedLocation.get())})},[i,e,s]),Qt(()=>{d&&!f&&e.emit({type:"onBeforeRouteMount",...kt(e.stores.location.get(),e.stores.resolvedLocation.get())})},[f,d,e]),Qt(()=>{if(u&&!c){const l=kt(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...l}),va(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())})}},[c,u,e]),null}function nu(){const e=_e(),t=e.routesById[lt].options.pendingComponent??e.options.defaultPendingComponent,n=t?a.jsx(t,{}):null,r=a.jsxs(typeof document<"u"&&e.ssr?Et:S.Suspense,{fallback:n,children:[a.jsx(tu,{}),a.jsx(ru,{})]});return e.options.InnerWrap?a.jsx(e.options.InnerWrap,{children:r}):r}function ru(){const e=_e(),t=je(e.stores.firstId,s=>s),n=je(e.stores.loadedAt,s=>s),r=t?a.jsx(Pa,{matchId:t}):null;return a.jsx(rr.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:a.jsx(rs,{getResetKey:()=>n,errorComponent:ss,onCatch:process.env.NODE_ENV!=="production"?s=>{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: ${s.message||s.toString()}`)}:void 0,children:r})})}var su=e=>({createMutableStore:Ks,createReadonlyStore:Ks,batch:va}),Oa=e=>new ou(e),ou=class extends nl{constructor(e){super(e,su)}};function au({router:e,children:t,...n}){ra(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=a.jsx(ba.Provider,{value:e,children:t});return e.options.Wrap?a.jsx(e.options.Wrap,{children:r}):r}function iu({router:e,...t}){return a.jsx(au,{router:e,...t,children:a.jsx(nu,{})})}function Ta(e,t){return function(){return e.apply(t,arguments)}}const{toString:cu}=Object.prototype,{getPrototypeOf:At}=Object,{iterator:ln,toStringTag:La}=Symbol,Kn=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),sn=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),Kn(n,t))return!0;n=At(n)}return!1},lu=(e,t)=>e!=null&&sn(e,t)?e[t]:void 0,os=(e=>t=>{const n=cu.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Oe=e=>(e=e.toLowerCase(),t=>os(t)===e),sr=e=>t=>typeof t===e,{isArray:mt}=Array,Ot=sr("undefined");function Mt(e){return e!==null&&!Ot(e)&&e.constructor!==null&&!Ot(e.constructor)&&Ne(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ia=Oe("ArrayBuffer");function uu(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ia(e.buffer),t}const du=sr("string"),Ne=sr("function"),Ma=sr("number"),Dt=e=>e!==null&&typeof e=="object",fu=e=>e===!0||e===!1,Mn=e=>{if(!Dt(e))return!1;const t=At(e);return(t===null||t===Object.prototype||At(t)===null)&&!sn(e,La)&&!sn(e,ln)},hu=e=>{if(!Dt(e)||Mt(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},mu=Oe("Date"),pu=Oe("File"),gu=e=>!!(e&&typeof e.uri<"u"),xu=e=>e&&typeof e.getParts<"u",bu=Oe("Blob"),yu=Oe("FileList"),vu=e=>Dt(e)&&Ne(e.pipe);function wu(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const no=wu(),ro=typeof no.FormData<"u"?no.FormData:void 0,Su=e=>{if(!e)return!1;if(ro&&e instanceof ro)return!0;const t=At(e);if(!t||t===Object.prototype||!Ne(e.append))return!1;const n=os(e);return n==="formdata"||n==="object"&&Ne(e.toString)&&e.toString()==="[object FormData]"},Ru=Oe("URLSearchParams"),[Nu,Cu,ju,Eu]=["ReadableStream","Request","Response","Headers"].map(Oe),ku=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function un(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),mt(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Mt(e))return;const o=n?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 Da(e,t){if(Mt(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const at=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Fa=e=>!Ot(e)&&e!==at;function Hr(...e){const{caseless:t,skipUndefined:n}=Fa(this)&&this||{},r={},s=(o,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const c=t&&typeof i=="string"&&Da(r,i)||i,u=Kn(r,c)?r[c]:void 0;Mn(u)&&Mn(o)?r[c]=Hr(u,o):Mn(o)?r[c]=Hr({},o):mt(o)?r[c]=o.slice():(!n||!Ot(o))&&(r[c]=o)};for(let o=0,i=e.length;o<i;o++){const c=e[o];if(!c||Mt(c)||(un(c,s),typeof c!="object"||mt(c)))continue;const u=Object.getOwnPropertySymbols(c);for(let f=0;f<u.length;f++){const d=u[f];$u.call(c,d)&&s(c[d],d)}}return r}const _u=(e,t,n,{allOwnKeys:r}={})=>(un(t,(s,o)=>{n&&Ne(s)?Object.defineProperty(e,o,{__proto__:null,value:Ta(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),Pu=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Au=(e,t,n,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}),n&&Object.assign(e.prototype,n)},Ou=(e,t,n,r)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&At(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Tu=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Lu=e=>{if(!e)return null;if(mt(e))return e;let t=e.length;if(!Ma(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Iu=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&At(Uint8Array)),Mu=(e,t)=>{const r=(e&&e[ln]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Du=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Fu=Oe("HTMLFormElement"),Uu=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:$u}=Object.prototype,Bu=Oe("RegExp"),Ua=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};un(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},zu=e=>{Ua(e,(t,n)=>{if(Ne(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Ne(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Wu=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return mt(e)?r(e):r(String(e).split(t)),n},Vu=()=>{},Hu=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function qu(e){return!!(e&&Ne(e.append)&&e[La]==="FormData"&&e[ln])}const Gu=e=>{const t=new WeakSet,n=r=>{if(Dt(r)){if(t.has(r))return;if(Mt(r))return r;if(!("toJSON"in r)){t.add(r);const s=mt(r)?[]:{};return un(r,(o,i)=>{const c=n(o);!Ot(c)&&(s[i]=c)}),t.delete(r),s}}return r};return n(e)},Ku=Oe("AsyncFunction"),Yu=e=>e&&(Dt(e)||Ne(e))&&Ne(e.then)&&Ne(e.catch),$a=((e,t)=>e?setImmediate:t?((n,r)=>(at.addEventListener("message",({source:s,data:o})=>{s===at&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),at.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ne(at.postMessage)),Ju=typeof queueMicrotask<"u"?queueMicrotask.bind(at):typeof process<"u"&&process.nextTick||$a,Ba=e=>e!=null&&Ne(e[ln]),Xu=e=>e!=null&&sn(e,ln)&&Ba(e),w={isArray:mt,isArrayBuffer:Ia,isBuffer:Mt,isFormData:Su,isArrayBufferView:uu,isString:du,isNumber:Ma,isBoolean:fu,isObject:Dt,isPlainObject:Mn,isEmptyObject:hu,isReadableStream:Nu,isRequest:Cu,isResponse:ju,isHeaders:Eu,isUndefined:Ot,isDate:mu,isFile:pu,isReactNativeBlob:gu,isReactNative:xu,isBlob:bu,isRegExp:Bu,isFunction:Ne,isStream:vu,isURLSearchParams:Ru,isTypedArray:Iu,isFileList:yu,forEach:un,merge:Hr,extend:_u,trim:ku,stripBOM:Pu,inherits:Au,toFlatObject:Ou,kindOf:os,kindOfTest:Oe,endsWith:Tu,toArray:Lu,forEachEntry:Mu,matchAll:Du,isHTMLForm:Fu,hasOwnProperty:Kn,hasOwnProp:Kn,hasOwnInPrototypeChain:sn,getSafeProp:lu,reduceDescriptors:Ua,freezeMethods:zu,toObjectSet:Wu,toCamelCase:Uu,noop:Vu,toFiniteNumber:Hu,findKey:Da,global:at,isContextDefined:Fa,isSpecCompliantForm:qu,toJSONObject:Gu,isAsyncFn:Ku,isThenable:Yu,setImmediate:$a,asap:Ju,isIterable:Ba,isSafeIterable:Xu},Zu=w.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"]),Qu=e=>{const t={};let n,r,s;return e&&e.split(`
7
- `).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&Zu[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function ed(e){let t=0,n=e.length;for(;t<n;){const r=e.charCodeAt(t);if(r!==9&&r!==32)break;t+=1}for(;n>t;){const r=e.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}const td=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),nd=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function as(e,t){return w.isArray(e)?e.map(n=>as(n,t)):ed(String(e).replace(t,""))}const rd=e=>as(e,td),sd=e=>as(e,nd);function za(e){const t=Object.create(null);return w.forEach(e.toJSON(),(n,r)=>{t[r]=sd(n)}),t}const so=Symbol("internals");function Gt(e){return e&&String(e).trim().toLowerCase()}function Dn(e){return e===!1||e==null?e:w.isArray(e)?e.map(Dn):rd(String(e))}function od(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const ad=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Nr(e,t,n,r,s){if(w.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!w.isString(t)){if(w.isString(r))return t.indexOf(r)!==-1;if(w.isRegExp(r))return r.test(t)}}function id(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function cd(e,t){const n=w.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let ye=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,u,f){const d=Gt(u);if(!d)return;const l=w.findKey(s,d);(!l||s[l]===void 0||f===!0||f===void 0&&s[l]!==!1)&&(s[l||u]=Dn(c))}const i=(c,u)=>w.forEach(c,(f,d)=>o(f,d,u));if(w.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(w.isString(t)&&(t=t.trim())&&!ad(t))i(Qu(t),n);else if(w.isObject(t)&&w.isSafeIterable(t)){let c=Object.create(null),u,f;for(const d of t){if(!w.isArray(d))throw new TypeError("Object iterator must return a key-value pair");f=d[0],w.hasOwnProp(c,f)?(u=c[f],c[f]=w.isArray(u)?[...u,d[1]]:[u,d[1]]):c[f]=d[1]}i(c,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=Gt(t),t){const r=w.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return od(s);if(w.isFunction(n))return n.call(this,s,r);if(w.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Gt(t),t){const r=w.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Nr(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=Gt(i),i){const c=w.findKey(r,i);c&&(!n||Nr(r,r[c],c,n))&&(delete r[c],s=!0)}}return w.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||Nr(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return w.forEach(this,(s,o)=>{const i=w.findKey(r,o);if(i){n[i]=Dn(s),delete n[o];return}const c=t?id(o):String(o).trim();c!==o&&delete n[o],n[c]=Dn(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return w.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&w.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).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,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[so]=this[so]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=Gt(i);r[c]||(cd(s,i),r[c]=!0)}return w.isArray(t)?t.forEach(o):o(t),this}};ye.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);w.reduceDescriptors(ye.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});w.freezeMethods(ye);const ld="[REDACTED ****]";function ud(e){if(w.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(w.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function dd(e,t){const n=new Set(t.map(o=>String(o).toLowerCase())),r=[],s=o=>{if(o===null||typeof o!="object"||w.isBuffer(o))return o;if(r.indexOf(o)!==-1)return;o instanceof ye&&(o=o.toJSON()),r.push(o);let i;if(w.isArray(o))i=[],o.forEach((c,u)=>{const f=s(c);w.isUndefined(f)||(i[u]=f)});else{if(!w.isPlainObject(o)&&ud(o))return r.pop(),o;i=Object.create(null);for(const[c,u]of Object.entries(o)){const f=n.has(c.toLowerCase())?ld:s(u);w.isUndefined(f)||(i[c]=f)}}return r.pop(),i};return s(e)}let T=class Wa extends Error{static from(t,n,r,s,o,i){const c=new Wa(t.message,n||t.code,r,s,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,n,r,s,o){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){const t=this.config,n=t&&w.hasOwnProp(t,"redact")?t.redact:void 0,r=w.isArray(n)&&n.length>0?dd(t,n):w.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}}};T.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";T.ERR_BAD_OPTION="ERR_BAD_OPTION";T.ECONNABORTED="ECONNABORTED";T.ETIMEDOUT="ETIMEDOUT";T.ECONNREFUSED="ECONNREFUSED";T.ERR_NETWORK="ERR_NETWORK";T.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";T.ERR_DEPRECATED="ERR_DEPRECATED";T.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";T.ERR_BAD_REQUEST="ERR_BAD_REQUEST";T.ERR_CANCELED="ERR_CANCELED";T.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";T.ERR_INVALID_URL="ERR_INVALID_URL";T.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const fd=null,Va=100;function qr(e){return w.isPlainObject(e)||w.isArray(e)}function Ha(e){return w.endsWith(e,"[]")?e.slice(0,-2):e}function Cr(e,t,n){return e?e.concat(t).map(function(s,o){return s=Ha(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function hd(e){return w.isArray(e)&&!e.some(qr)}const md=w.toFlatObject(w,{},null,function(t){return/^is[A-Z]/.test(t)});function or(e,t,n){if(!w.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=w.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,v){return!w.isUndefined(v[y])});const r=n.metaTokens,s=n.visitor||g,o=n.dots,i=n.indexes,c=n.Blob||typeof Blob<"u"&&Blob,u=n.maxDepth===void 0?Va:n.maxDepth,f=c&&w.isSpecCompliantForm(t),d=[];if(!w.isFunction(s))throw new TypeError("visitor must be a function");function l(x){if(x===null)return"";if(w.isDate(x))return x.toISOString();if(w.isBoolean(x))return x.toString();if(!f&&w.isBlob(x))throw new T("Blob is not supported. Use a Buffer instead.");if(w.isArrayBuffer(x)||w.isTypedArray(x)){if(f&&typeof c=="function")return new c([x]);if(typeof Buffer<"u")return Buffer.from(x);throw new T("Blob is not supported. Use a Buffer instead.",T.ERR_NOT_SUPPORT)}return x}function h(x){if(x>u)throw new T("Object is too deeply nested ("+x+" levels). Max depth: "+u,T.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(x,y){if(u===1/0)return JSON.stringify(x);const v=[];return JSON.stringify(x,function(j,E){if(!w.isObject(E))return E;for(;v.length&&v[v.length-1]!==this;)v.pop();return v.push(E),h(y+v.length-1),E})}function g(x,y,v){let N=x;if(w.isReactNative(t)&&w.isReactNativeBlob(x))return t.append(Cr(v,y,o),l(x)),!1;if(x&&!v&&typeof x=="object"){if(w.endsWith(y,"{}"))y=r?y:y.slice(0,-2),x=m(x,1);else if(w.isArray(x)&&hd(x)||(w.isFileList(x)||w.endsWith(y,"[]"))&&(N=w.toArray(x)))return y=Ha(y),N.forEach(function(E,C){!(w.isUndefined(E)||E===null)&&t.append(i===!0?Cr([y],C,o):i===null?y:y+"[]",l(E))}),!1}return qr(x)?!0:(t.append(Cr(v,y,o),l(x)),!1)}const p=Object.assign(md,{defaultVisitor:g,convertValue:l,isVisitable:qr});function b(x,y,v=0){if(!w.isUndefined(x)){if(h(v),d.indexOf(x)!==-1)throw new Error("Circular reference detected in "+y.join("."));d.push(x),w.forEach(x,function(j,E){(!(w.isUndefined(j)||j===null)&&s.call(t,j,w.isString(E)?E.trim():E,y,p))===!0&&b(j,y?y.concat(E):[E],v+1)}),d.pop()}}if(!w.isObject(e))throw new TypeError("data must be an object");return b(e),t}function oo(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function is(e,t){this._pairs=[],e&&or(e,this,t)}const qa=is.prototype;qa.append=function(t,n){this._pairs.push([t,n])};qa.toString=function(t){const n=t?r=>t.call(this,r,oo):oo;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function pd(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ga(e,t,n){if(!t)return e;e=e||"";const r=w.isFunction(n)?{serialize:n}:n,s=w.getSafeProp(r,"encode")||pd,o=w.getSafeProp(r,"serialize");let i;if(o?i=o(t,r):i=w.isURLSearchParams(t)?t.toString():new is(t,r).toString(s),i){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class ao{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,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){w.forEach(this.handlers,function(r){r!==null&&t(r)})}}const cs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},gd=typeof URLSearchParams<"u"?URLSearchParams:is,xd=typeof FormData<"u"?FormData:null,bd=typeof Blob<"u"?Blob:null,yd={isBrowser:!0,classes:{URLSearchParams:gd,FormData:xd,Blob:bd},protocols:["http","https","file","blob","url","data"]},ls=typeof window<"u"&&typeof document<"u",Gr=typeof navigator=="object"&&navigator||void 0,vd=ls&&(!Gr||["ReactNative","NativeScript","NS"].indexOf(Gr.product)<0),wd=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Sd=ls&&window.location.href||"http://localhost",Rd=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ls,hasStandardBrowserEnv:vd,hasStandardBrowserWebWorkerEnv:wd,navigator:Gr,origin:Sd},Symbol.toStringTag,{value:"Module"})),pe={...Rd,...yd};function Nd(e,t){return or(e,new pe.classes.URLSearchParams,{visitor:function(n,r,s,o){return pe.isNode&&w.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}const io=Va;function Ka(e){if(e>io)throw new T("FormData field is too deeply nested ("+e+" levels). Max depth: "+io,T.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Cd(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)Ka(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function jd(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function Ya(e){function t(n,r,s,o){Ka(o);let i=n[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),u=o>=n.length;return i=!i&&w.isArray(s)?s.length:i,u?(w.hasOwnProp(s,i)?s[i]=w.isArray(s[i])?s[i].concat(r):[s[i],r]:s[i]=r,!c):((!w.hasOwnProp(s,i)||!w.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&w.isArray(s[i])&&(s[i]=jd(s[i])),!c)}if(w.isFormData(e)&&w.isFunction(e.entries)){const n={};return w.forEachEntry(e,(r,s)=>{t(Cd(r),s,n,0)}),n}return null}const vt=(e,t)=>e!=null&&w.hasOwnProp(e,t)?e[t]:void 0;function Ed(e,t,n){if(w.isString(e))try{return(t||JSON.parse)(e),w.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const dn={transitional:cs,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=w.isObject(t);if(o&&w.isHTMLForm(t)&&(t=new FormData(t)),w.isFormData(t))return s?JSON.stringify(Ya(t)):t;if(w.isArrayBuffer(t)||w.isBuffer(t)||w.isStream(t)||w.isFile(t)||w.isBlob(t)||w.isReadableStream(t))return t;if(w.isArrayBufferView(t))return t.buffer;if(w.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){const u=vt(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Nd(t,u).toString();if((c=w.isFileList(t))||r.indexOf("multipart/form-data")>-1){const f=vt(this,"env"),d=f&&f.FormData;return or(c?{"files[]":t}:t,d&&new d,u)}}return o||s?(n.setContentType("application/json",!1),Ed(t)):t}],transformResponse:[function(t){const n=vt(this,"transitional")||dn.transitional,r=n&&n.forcedJSONParsing,s=vt(this,"responseType"),o=s==="json";if(w.isResponse(t)||w.isReadableStream(t))return t;if(t&&w.isString(t)&&(r&&!s||o)){const c=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t,vt(this,"parseReviver"))}catch(u){if(c)throw u.name==="SyntaxError"?T.from(u,T.ERR_BAD_RESPONSE,this,null,vt(this,"response")):u}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pe.classes.FormData,Blob:pe.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};w.forEach(["delete","get","head","post","put","patch","query"],e=>{dn.headers[e]={}});function jr(e,t){const n=this||dn,r=t||n,s=ye.from(r.headers);let o=r.data;return w.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Ja(e){return!!(e&&e.__CANCEL__)}let fn=class extends T{constructor(t,n,r){super(t??"canceled",T.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function Xa(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new T("Request failed with status code "+n.status,n.status>=400&&n.status<500?T.ERR_BAD_REQUEST:T.ERR_BAD_RESPONSE,n.config,n.request,n))}function kd(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function _d(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(u){const f=Date.now(),d=r[o];i||(i=f),n[s]=u,r[s]=f;let l=o,h=0;for(;l!==s;)h+=n[l++],l=l%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),f-i<t)return;const m=d&&f-d;return m?Math.round(h*1e3/m):void 0}}function Pd(e,t){let n=0,r=1e3/t,s,o;const i=(f,d=Date.now())=>{n=d,s=null,o&&(clearTimeout(o),o=null),e(...f)};return[(...f)=>{const d=Date.now(),l=d-n;l>=r?i(f,d):(s=f,o||(o=setTimeout(()=>{o=null,i(s)},r-l)))},()=>s&&i(s)]}const Yn=(e,t,n=3)=>{let r=0;const s=_d(50,250);return Pd(o=>{if(!o||typeof o.loaded!="number")return;const i=o.loaded,c=o.lengthComputable?o.total:void 0,u=c!=null?Math.min(i,c):i,f=Math.max(0,u-r),d=s(f);r=Math.max(r,u);const l={loaded:u,total:c,progress:c?u/c:void 0,bytes:f,rate:d||void 0,estimated:d&&c?(c-u)/d:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},n)},co=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},lo=e=>(...t)=>w.asap(()=>e(...t)),Ad=pe.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,pe.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(pe.origin),pe.navigator&&/(msie|trident)/i.test(pe.navigator.userAgent)):()=>!0,Od=pe.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];w.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),w.isString(r)&&c.push(`path=${r}`),w.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),w.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 n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),s=r.indexOf("=");if(s!==-1&&r.slice(0,s)===e)try{return decodeURIComponent(r.slice(s+1))}catch{return r.slice(s+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Td(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Ld(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Id=/^https?:(?!\/\/)/i,Md=/[\t\n\r]/g;function Dd(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Fd(e){return Dd(e).replace(Md,"")}function uo(e,t){if(typeof e=="string"&&Id.test(Fd(e)))throw new T('Invalid URL: missing "//" after protocol',T.ERR_INVALID_URL,t)}function Za(e,t,n,r){uo(t,r);let s=!Td(t);return e&&(s||n===!1)?(uo(e,r),Ld(e,t)):t}const fo=e=>e instanceof ye?{...e}:e;function pt(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(d,l,h,m){return w.isPlainObject(d)&&w.isPlainObject(l)?w.merge.call({caseless:m},d,l):w.isPlainObject(l)?w.merge({},l):w.isArray(l)?l.slice():l}function s(d,l,h,m){if(w.isUndefined(l)){if(!w.isUndefined(d))return r(void 0,d,h,m)}else return r(d,l,h,m)}function o(d,l){if(!w.isUndefined(l))return r(void 0,l)}function i(d,l){if(w.isUndefined(l)){if(!w.isUndefined(d))return r(void 0,d)}else return r(void 0,l)}function c(d){const l=w.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!w.isUndefined(l))if(w.isPlainObject(l)){if(w.hasOwnProp(l,d))return l[d]}else return;const h=w.hasOwnProp(e,"transitional")?e.transitional:void 0;if(w.isPlainObject(h)&&w.hasOwnProp(h,d))return h[d]}function u(d,l,h){if(w.hasOwnProp(t,h))return r(d,l);if(w.hasOwnProp(e,h))return r(void 0,d)}const f={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:u,headers:(d,l,h)=>s(fo(d),fo(l),h,!0)};return w.forEach(Object.keys({...e,...t}),function(l){if(l==="__proto__"||l==="constructor"||l==="prototype")return;const h=w.hasOwnProp(f,l)?f[l]:s,m=w.hasOwnProp(e,l)?e[l]:void 0,g=w.hasOwnProp(t,l)?t[l]:void 0,p=h(m,g,l);w.isUndefined(p)&&h!==u||(n[l]=p)}),w.hasOwnProp(t,"validateStatus")&&w.isUndefined(t.validateStatus)&&c("validateStatusUndefinedResolves")===!1&&(w.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const Ud=["content-type","content-length"];function $d(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([r,s])=>{Ud.includes(r.toLowerCase())&&e.set(r,s)})}const Bd=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function Qa(e){const t=pt({},e),n=h=>w.hasOwnProp(t,h)?t[h]:void 0,r=n("data");let s=n("withXSRFToken");const o=n("xsrfHeaderName"),i=n("xsrfCookieName");let c=n("headers");const u=n("auth"),f=n("baseURL"),d=n("allowAbsoluteUrls"),l=n("url");if(t.headers=c=ye.from(c),t.url=Ga(Za(f,l,d,t),n("params"),n("paramsSerializer")),u){const h=w.getSafeProp(u,"username")||"",m=w.getSafeProp(u,"password")||"";try{c.set("Authorization","Basic "+btoa(h+":"+(m?Bd(m):"")))}catch(g){throw T.from(g,T.ERR_BAD_OPTION_VALUE,e)}}if(w.isFormData(r)&&(pe.hasStandardBrowserEnv||pe.hasStandardBrowserWebWorkerEnv||w.isReactNative(r)?c.setContentType(void 0):w.isFunction(r.getHeaders)&&$d(c,r.getHeaders(),n("formDataHeaderPolicy"))),pe.hasStandardBrowserEnv&&(w.isFunction(s)&&(s=s(t)),s===!0||s==null&&Ad(t.url))){const m=o&&i&&Od.read(i);m&&c.set(o,m)}return t}const zd=typeof XMLHttpRequest<"u",Wd=zd&&function(e){return new Promise(function(n,r){const s=Qa(e);let o=s.data;const i=ye.from(s.headers).normalize();let{responseType:c,onUploadProgress:u,onDownloadProgress:f}=s,d,l,h,m,g;function p(){m&&m(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let b=new XMLHttpRequest;b.open(s.method.toUpperCase(),s.url,!0),b.timeout=s.timeout;function x(){if(!b)return;const v=ye.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),j={data:!c||c==="text"||c==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:v,config:e,request:b};Xa(function(C){n(C),p()},function(C){r(C),p()},j),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&&(r(new T("Request aborted",T.ECONNABORTED,e,b)),p(),b=null)},b.onerror=function(N){const j=N&&N.message?N.message:"Network Error",E=new T(j,T.ERR_NETWORK,e,b);E.event=N||null,r(E),p(),b=null},b.ontimeout=function(){let N=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const j=s.transitional||cs;s.timeoutErrorMessage&&(N=s.timeoutErrorMessage),r(new T(N,j.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,e,b)),p(),b=null},o===void 0&&i.setContentType(null),"setRequestHeader"in b&&w.forEach(za(i),function(N,j){b.setRequestHeader(j,N)}),w.isUndefined(s.withCredentials)||(b.withCredentials=!!s.withCredentials),c&&c!=="json"&&(b.responseType=s.responseType),f&&([h,g]=Yn(f,!0),b.addEventListener("progress",h)),u&&b.upload&&([l,m]=Yn(u),b.upload.addEventListener("progress",l),b.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(d=v=>{b&&(r(!v||v.type?new fn(null,e,b):v),b.abort(),p(),b=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const y=kd(s.url);if(y&&!pe.protocols.includes(y)){r(new T("Unsupported protocol "+y+":",T.ERR_BAD_REQUEST,e)),p();return}b.send(o||null)})},Vd=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const s=function(u){if(!r){r=!0,i();const f=u instanceof Error?u:this.reason;n.abort(f instanceof T?f:new fn(f instanceof Error?f.message:f))}};let o=t&&setTimeout(()=>{o=null,s(new T(`timeout of ${t}ms exceeded`,T.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s,{once:!0}));const{signal:c}=n;return c.unsubscribe=()=>w.asap(i),c},Hd=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},qd=async function*(e,t){for await(const n of Gd(e))yield*Hd(n,t)},Gd=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},ho=(e,t,n,r)=>{const s=qd(e,t);let o=0,i,c=u=>{i||(i=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:f,value:d}=await s.next();if(f){c(),u.close();return}let l=d.byteLength;if(n){let h=o+=l;n(h)}u.enqueue(new Uint8Array(d))}catch(f){throw c(f),f}},cancel(u){return c(u),s.return()}},{highWaterMark:2})},Jn=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Kd=(e,t,n)=>t+2<n&&Jn(e.charCodeAt(t+1))&&Jn(e.charCodeAt(t+2));function Yd(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){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);Jn(g)&&Jn(p)&&(i-=2,m+=2)}let u=0,f=c-1;const d=m=>m>=2&&r.charCodeAt(m-2)===37&&r.charCodeAt(m-1)===51&&(r.charCodeAt(m)===68||r.charCodeAt(m)===100);f>=0&&(r.charCodeAt(f)===61?(u++,f--):d(f)&&(u++,f-=3)),u===1&&f>=0&&(r.charCodeAt(f)===61||d(f))&&u++;const h=Math.floor(i/4)*3-(u||0);return h>0?h:0}let o=0;for(let i=0,c=r.length;i<c;i++){const u=r.charCodeAt(i);if(u===37&&Kd(r,i,c))o+=1,i+=2;else if(u<128)o+=1;else if(u<2048)o+=2;else if(u>=55296&&u<=56319&&i+1<c){const f=r.charCodeAt(i+1);f>=56320&&f<=57343?(o+=4,i++):o+=3}else o+=3}return o}const us="1.18.1",mo=64*1024,{isFunction:vn}=w,Jd=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),po=e=>{if(!w.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},go=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Xd=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},Zd=e=>{const t=w.global!==void 0&&w.global!==null?w.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=w.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:o,Response:i}=e,c=s?vn(s):typeof fetch=="function",u=vn(o),f=vn(i);if(!c)return!1;const d=c&&vn(n),l=c&&(typeof r=="function"?(x=>y=>x.encode(y))(new r):async x=>new Uint8Array(await new o(x).arrayBuffer())),h=u&&d&&go(()=>{let x=!1;const y=new o(pe.origin,{body:new n,method:"POST",get duplex(){return x=!0,"half"}}),v=y.headers.has("Content-Type");return y.body!=null&&y.body.cancel(),x&&!v}),m=f&&d&&go(()=>w.isReadableStream(new i("").body)),g={stream:m&&(x=>x.body)};c&&["text","arrayBuffer","blob","formData","stream"].forEach(x=>{!g[x]&&(g[x]=(y,v)=>{let N=y&&y[x];if(N)return N.call(y);throw new T(`Response type '${x}' is not supported`,T.ERR_NOT_SUPPORT,v)})});const p=async x=>{if(x==null)return 0;if(w.isBlob(x))return x.size;if(w.isSpecCompliantForm(x))return(await new o(pe.origin,{method:"POST",body:x}).arrayBuffer()).byteLength;if(w.isArrayBufferView(x)||w.isArrayBuffer(x))return x.byteLength;if(w.isURLSearchParams(x)&&(x=x+""),w.isString(x))return(await l(x)).byteLength},b=async(x,y)=>{const v=w.toFiniteNumber(x.getContentLength());return v??p(y)};return async x=>{let{url:y,method:v,data:N,signal:j,cancelToken:E,timeout:C,onDownloadProgress:R,onUploadProgress:P,responseType:I,headers:A,withCredentials:D="same-origin",fetchOptions:O,maxContentLength:B,maxBodyLength:J}=Qa(x);const Z=w.isNumber(B)&&B>-1,Q=w.isNumber(J)&&J>-1,ge=$=>w.hasOwnProp(x,$)?x[$]:void 0;let ve=s||fetch;I=I?(I+"").toLowerCase():"text";let L=Vd([j,E&&E.toAbortSignal()],C),k=null;const z=L&&L.unsubscribe&&(()=>{L.unsubscribe()});let G,H=null;const V=()=>new T("Request body larger than maxBodyLength limit",T.ERR_BAD_REQUEST,x,k);try{let $;const q=ge("auth");if(q){const U=w.getSafeProp(q,"username")||"",ue=w.getSafeProp(q,"password")||"";$={username:U,password:ue}}if(Xd(y)){const U=new URL(y,pe.origin);if(!$&&(U.username||U.password)){const ue=po(U.username),ce=po(U.password);$={username:ue,password:ce}}(U.username||U.password)&&(U.username="",U.password="",y=U.href)}if($&&(A.delete("authorization"),A.set("Authorization","Basic "+btoa(Jd(($.username||"")+":"+($.password||""))))),Z&&typeof y=="string"&&y.startsWith("data:")&&Yd(y)>B)throw new T("maxContentLength size of "+B+" exceeded",T.ERR_BAD_RESPONSE,x,k);if(Q&&v!=="get"&&v!=="head"){const U=await p(N);if(typeof U=="number"&&isFinite(U)&&(G=U,U>J))throw V()}const oe=Q&&(w.isReadableStream(N)||w.isStream(N)),X=(U,ue,ce)=>ho(U,mo,de=>{if(Q&&de>J)throw H=V();ue&&ue(de)},ce);if(h&&v!=="get"&&v!=="head"&&(P||oe)){if(G=G??await b(A,N),G!==0||oe){let U=new o(y,{method:"POST",body:N,duplex:"half"}),ue;if(w.isFormData(N)&&(ue=U.headers.get("content-type"))&&A.setContentType(ue),U.body){const[ce,de]=P&&co(G,Yn(lo(P)))||[];N=X(U.body,ce,de)}}}else if(oe&&!u&&d&&v!=="get"&&v!=="head")N=X(N);else if(oe&&u&&!h&&v!=="get"&&v!=="head")throw new T("Stream request bodies are not supported by the current fetch implementation",T.ERR_NOT_SUPPORT,x,k);w.isString(D)||(D=D?"include":"omit");const Pe=u&&"credentials"in o.prototype;if(w.isFormData(N)){const U=A.getContentType();U&&/^multipart\/form-data/i.test(U)&&!/boundary=/i.test(U)&&A.delete("content-type")}A.set("User-Agent","axios/"+us,!1);const Ee={...O,signal:L,method:v.toUpperCase(),headers:za(A.normalize()),body:N,duplex:"half",credentials:Pe?D:void 0};k=u&&new o(y,Ee);let W=await(u?ve(k,O):ve(y,Ee));const we=ye.from(W.headers);if(Z){const U=w.toFiniteNumber(we.getContentLength());if(U!=null&&U>B)throw new T("maxContentLength size of "+B+" exceeded",T.ERR_BAD_RESPONSE,x,k)}const ae=m&&(I==="stream"||I==="response");if(m&&W.body&&(R||Z||ae&&z)){const U={};["status","statusText","headers"].forEach(We=>{U[We]=W[We]});const ue=w.toFiniteNumber(we.getContentLength()),[ce,de]=R&&co(ue,Yn(lo(R),!0))||[];let ke=0;const Bt=We=>{if(Z&&(ke=We,ke>B))throw new T("maxContentLength size of "+B+" exceeded",T.ERR_BAD_RESPONSE,x,k);ce&&ce(We)};W=new i(ho(W.body,mo,Bt,()=>{de&&de(),z&&z()}),U)}I=I||"text";let te=await g[w.findKey(g,I)||"text"](W,x);if(Z&&!m&&!ae){let U;if(te!=null&&(typeof te.byteLength=="number"?U=te.byteLength:typeof te.size=="number"?U=te.size:typeof te=="string"&&(U=typeof r=="function"?new r().encode(te).byteLength:te.length)),typeof U=="number"&&U>B)throw new T("maxContentLength size of "+B+" exceeded",T.ERR_BAD_RESPONSE,x,k)}return!ae&&z&&z(),await new Promise((U,ue)=>{Xa(U,ue,{data:te,headers:ye.from(W.headers),status:W.status,statusText:W.statusText,config:x,request:k})})}catch($){if(z&&z(),L&&L.aborted&&L.reason instanceof T){const q=L.reason;throw q.config=x,k&&(q.request=k),$!==q&&Object.defineProperty(q,"cause",{__proto__:null,value:$,writable:!0,enumerable:!1,configurable:!0}),q}if(H)throw k&&!H.request&&(H.request=k),H;if($ instanceof T)throw k&&!$.request&&($.request=k),$;if($&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)){const q=new T("Network Error",T.ERR_NETWORK,x,k,$&&$.response);throw Object.defineProperty(q,"cause",{__proto__:null,value:$.cause||$,writable:!0,enumerable:!1,configurable:!0}),q}throw T.from($,$&&$.code,x,k,$&&$.response)}}},Qd=new Map,ei=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,c=i,u,f,d=Qd;for(;c--;)u=o[c],f=d.get(u),f===void 0&&d.set(u,f=c?new Map:Zd(t)),d=f;return f};ei();const ds={http:fd,xhr:Wd,fetch:{get:ei}};w.forEach(ds,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const xo=e=>`- ${e}`,ef=e=>w.isFunction(e)||e===null||e===!1;function tf(e,t){e=w.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){r=e[i];let c;if(s=r,!ef(r)&&(s=ds[(c=String(r)).toLowerCase()],s===void 0))throw new T(`Unknown adapter '${c}'`);if(s&&(w.isFunction(s)||(s=s.get(t))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([u,f])=>`adapter ${u} `+(f===!1?"is not supported by the environment":"is not available in the build"));let c=n?i.length>1?`since :
9
- `+i.map(xo).join(`
10
- `):" "+xo(i[0]):"as no adapter specified";throw new T("There is no suitable adapter to dispatch the request "+c,T.ERR_NOT_SUPPORT)}return s}const ti={getAdapter:tf,adapters:ds};function Er(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new fn(null,e)}function bo(e){return Er(e),e.headers=ye.from(e.headers),e.data=jr.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ti.getAdapter(e.adapter||dn.adapter,e)(e).then(function(r){Er(e),e.response=r;try{r.data=jr.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=ye.from(r.headers),r},function(r){if(!Ja(r)&&(Er(e),r&&r.response)){e.response=r.response;try{r.response.data=jr.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=ye.from(r.response.headers)}return Promise.reject(r)})}const ar={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ar[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const yo={};ar.transitional=function(t,n,r){function s(o,i){return"[Axios v"+us+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new T(s(i," has been removed"+(n?" in "+n:"")),T.ERR_DEPRECATED);return n&&!yo[i]&&(yo[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,c):!0}};ar.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function nf(e,t,n){if(typeof e!="object"||e===null)throw new T("options must be an object",T.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(i){const c=e[o],u=c===void 0||i(c,o,e);if(u!==!0)throw new T("option "+o+" must be "+u,T.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new T("Unknown option "+o,T.ERR_BAD_OPTION)}}const Fn={assertOptions:nf,validators:ar},xe=Fn.validators;let dt=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ao,response:new ao}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=(()=>{if(!s.stack)return"";const i=s.stack.indexOf(`
11
- `);return i===-1?"":s.stack.slice(i+1)})();try{if(!r.stack)r.stack=o;else if(o){const i=o.indexOf(`
12
- `),c=i===-1?-1:o.indexOf(`
13
- `,i+1),u=c===-1?"":o.slice(c+1);String(r.stack).endsWith(u)||(r.stack+=`
14
- `+o)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=pt(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Fn.assertOptions(r,{silentJSONParsing:xe.transitional(xe.boolean),forcedJSONParsing:xe.transitional(xe.boolean),clarifyTimeoutError:xe.transitional(xe.boolean),legacyInterceptorReqResOrdering:xe.transitional(xe.boolean),advertiseZstdAcceptEncoding:xe.transitional(xe.boolean),validateStatusUndefinedResolves:xe.transitional(xe.boolean)},!1),s!=null&&(w.isFunction(s)?n.paramsSerializer={serialize:s}:Fn.assertOptions(s,{encode:xe.function,serialize:xe.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Fn.assertOptions(n,{baseUrl:xe.spelling("baseURL"),withXsrfToken:xe.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&w.merge(o.common,o[n.method]);o&&w.forEach(["delete","get","head","post","put","patch","query","common"],g=>{delete o[g]}),n.headers=ye.concat(i,o);const c=[];let u=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(n)===!1)return;u=u&&p.synchronous;const b=n.transitional||cs;b&&b.legacyInterceptorReqResOrdering?c.unshift(p.fulfilled,p.rejected):c.push(p.fulfilled,p.rejected)});const f=[];this.interceptors.response.forEach(function(p){f.push(p.fulfilled,p.rejected)});let d,l=0,h;if(!u){const g=[bo.bind(this),void 0];for(g.unshift(...c),g.push(...f),h=g.length,d=Promise.resolve(n);l<h;)d=d.then(g[l++],g[l++]);return d}h=c.length;let m=n;for(;l<h;){const g=c[l++],p=c[l++];try{m=g(m)}catch(b){p.call(this,b);break}}try{d=bo.call(this,m)}catch(g){return Promise.reject(g)}for(l=0,h=f.length;l<h;)d=d.then(f[l++],f[l++]);return d}getUri(t){t=pt(this.defaults,t);const n=Za(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Ga(n,t.params,t.paramsSerializer)}};w.forEach(["delete","get","head","options"],function(t){dt.prototype[t]=function(n,r){return this.request(pt(r||{},{method:t,url:n,data:r&&w.hasOwnProp(r,"data")?r.data:void 0}))}});w.forEach(["post","put","patch","query"],function(t){function n(r){return function(o,i,c){return this.request(pt(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}dt.prototype[t]=n(),t!=="query"&&(dt.prototype[t+"Form"]=n(!0))});let rf=class ni{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new fn(o,i,c),n(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 n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new ni(function(s){t=s}),cancel:t}}};function sf(e){return function(n){return e.apply(null,n)}}function of(e){return w.isObject(e)&&e.isAxiosError===!0}const Kr={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(Kr).forEach(([e,t])=>{Kr[t]=e});function ri(e){const t=new dt(e),n=Ta(dt.prototype.request,t);return w.extend(n,dt.prototype,t,{allOwnKeys:!0}),w.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return ri(pt(e,s))},n}const le=ri(dn);le.Axios=dt;le.CanceledError=fn;le.CancelToken=rf;le.isCancel=Ja;le.VERSION=us;le.toFormData=or;le.AxiosError=T;le.Cancel=le.CanceledError;le.all=function(t){return Promise.all(t)};le.spread=sf;le.isAxiosError=of;le.mergeConfig=pt;le.AxiosHeaders=ye;le.formToJSON=e=>Ya(w.isHTMLForm(e)?new FormData(e):e);le.getAdapter=ti.getAdapter;le.HttpStatusCode=Kr;le.default=le;const{Axios:jg,AxiosError:Eg,CanceledError:kg,isCancel:_g,CancelToken:Pg,VERSION:Ag,all:Og,Cancel:Tg,isAxiosError:Lg,spread:Ig,toFormData:Mg,AxiosHeaders:Dg,HttpStatusCode:Fg,formToJSON:Ug,getAdapter:$g,mergeConfig:Bg,create:zg}=le,ne=le.create({baseURL:"/api/v1/cost"});function si(e,t){ne.defaults.baseURL=`${e.replace(/\/$/,"")}/cost`,t?ne.defaults.headers.common.Authorization=`Bearer ${t}`:delete ne.defaults.headers.common.Authorization}function af(e){e.interceptors.request.use(t=>{if(typeof window<"u"){const n=window.localStorage.getItem("access_token");n?(t.headers=t.headers||{},t.headers.Authorization=`Bearer ${n}`):t.headers&&delete t.headers.Authorization}return t})}const cf=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lf=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),vo=e=>{const t=lf(e);return t.charAt(0).toUpperCase()+t.slice(1)},oi=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),uf=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var df={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 ff=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...c},u)=>_.createElement("svg",{ref:u,...df,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:oi("lucide",s),...!o&&!uf(c)&&{"aria-hidden":"true"},...c},[...i.map(([f,d])=>_.createElement(f,d)),...Array.isArray(o)?o:[o]]));const ee=(e,t)=>{const n=_.forwardRef(({className:r,...s},o)=>_.createElement(ff,{ref:o,iconNode:t,className:oi(`lucide-${cf(vo(e))}`,`lucide-${e}`,r),...s}));return n.displayName=vo(e),n};const hf=[["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"}]],ai=ee("building-2",hf);const mf=[["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"}]],ii=ee("calendar-clock",mf);const pf=[["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"}]],gf=ee("chart-column",pf);const xf=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],bf=ee("chevron-down",xf);const yf=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],vf=ee("chevron-left",yf);const wf=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Sf=ee("chevron-right",wf);const Rf=[["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"}]],Fe=ee("circle-alert",Rf);const Nf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Cf=ee("circle-check",Nf);const jf=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],Xn=ee("cloud",jf);const Ef=[["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"}]],ci=ee("database",Ef);const kf=[["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"}]],li=ee("dollar-sign",kf);const _f=[["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"}]],fs=ee("download",_f);const Pf=[["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"}]],ui=ee("external-link",Pf);const Af=[["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"}]],Of=ee("eye",Af);const Tf=[["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"}]],Lf=ee("file-down",Tf);const If=[["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"}]],di=ee("file-text",If);const Mf=[["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"}]],Df=ee("list",Mf);const Ff=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],it=ee("loader-circle",Ff);const Uf=[["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"}]],$f=ee("map-pin",Uf);const Bf=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],zf=ee("plus",Bf);const Wf=[["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"}]],Tt=ee("refresh-cw",Wf);const Vf=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],hs=ee("search",Vf);const Hf=[["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"}]],fi=ee("server",Hf);const qf=[["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"}]],hi=ee("settings-2",qf);const Gf=[["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"}]],wo=ee("sparkles",Gf);const Kf=[["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"}]],mi=ee("trash-2",Kf);const Yf=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],Jf=ee("trending-down",Yf);const Xf=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],pi=ee("trending-up",Xf);const Zf=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ft=ee("x",Zf);function gi(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=gi(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Qf(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=gi(e))&&(r&&(r+=" "),r+=t);return r}const eh=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},th=(e,t)=>({classGroupId:e,validator:t}),xi=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Zn="-",So=[],nh="arbitrary..",rh=e=>{const t=oh(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return sh(i);const c=i.split(Zn),u=c[0]===""&&c.length>1?1:0;return bi(c,u,t)},getConflictingClassGroupIds:(i,c)=>{if(c){const u=r[i],f=n[i];return u?f?eh(f,u):u:f||So}return n[i]||So}}},bi=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const f=bi(e,t+1,o);if(f)return f}const i=n.validators;if(i===null)return;const c=t===0?e.join(Zn):e.slice(t).join(Zn),u=i.length;for(let f=0;f<u;f++){const d=i[f];if(d.validator(c))return d.classGroupId}},sh=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?nh+r:void 0})(),oh=e=>{const{theme:t,classGroups:n}=e;return ah(n,t)},ah=(e,t)=>{const n=xi();for(const r in e){const s=e[r];ms(s,n,r,t)}return n},ms=(e,t,n,r)=>{const s=e.length;for(let o=0;o<s;o++){const i=e[o];ih(i,t,n,r)}},ih=(e,t,n,r)=>{if(typeof e=="string"){ch(e,t,n);return}if(typeof e=="function"){lh(e,t,n,r);return}uh(e,t,n,r)},ch=(e,t,n)=>{const r=e===""?t:yi(t,e);r.classGroupId=n},lh=(e,t,n,r)=>{if(dh(e)){ms(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(th(n,e))},uh=(e,t,n,r)=>{const s=Object.entries(e),o=s.length;for(let i=0;i<o;i++){const[c,u]=s[i];ms(u,yi(t,c),n,r)}},yi=(e,t)=>{let n=e;const r=t.split(Zn),s=r.length;for(let o=0;o<s;o++){const i=r[o];let c=n.nextPart.get(i);c||(c=xi(),n.nextPart.set(i,c)),n=c}return n},dh=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,fh=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let i=n[o];if(i!==void 0)return i;if((i=r[o])!==void 0)return s(o,i),i},set(o,i){o in n?n[o]=i:s(o,i)}}},Yr="!",Ro=":",hh=[],No=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),mh=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const o=[];let i=0,c=0,u=0,f;const d=s.length;for(let p=0;p<d;p++){const b=s[p];if(i===0&&c===0){if(b===Ro){o.push(s.slice(u,p)),u=p+1;continue}if(b==="/"){f=p;continue}}b==="["?i++:b==="]"?i--:b==="("?c++:b===")"&&c--}const l=o.length===0?s:s.slice(u);let h=l,m=!1;l.endsWith(Yr)?(h=l.slice(0,-1),m=!0):l.startsWith(Yr)&&(h=l.slice(1),m=!0);const g=f&&f>u?f-u:void 0;return No(o,m,h,g)};if(t){const s=t+Ro,o=r;r=i=>i.startsWith(s)?o(i.slice(s.length)):No(hh,!1,i,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},ph=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let o=0;o<n.length;o++){const i=n[o],c=i[0]==="[",u=t.has(i);c||u?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(i)):s.push(i)}return s.length>0&&(s.sort(),r.push(...s)),r}},gh=e=>({cache:fh(e.cacheSize),parseClassName:mh(e),sortModifiers:ph(e),postfixLookupClassGroupIds:xh(e),...rh(e)}),xh=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},bh=/\s+/,yh=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o,postfixLookupClassGroupIds:i}=t,c=[],u=e.trim().split(bh);let f="";for(let d=u.length-1;d>=0;d-=1){const l=u[d],{isExternal:h,modifiers:m,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:b}=n(l);if(h){f=l+(f.length>0?" "+f:f);continue}let x=!!b,y;if(x){const C=p.substring(0,b);y=r(C);const R=y&&i[y]?r(p):void 0;R&&R!==y&&(y=R,x=!1)}else y=r(p);if(!y){if(!x){f=l+(f.length>0?" "+f:f);continue}if(y=r(p),!y){f=l+(f.length>0?" "+f:f);continue}x=!1}const v=m.length===0?"":m.length===1?m[0]:o(m).join(":"),N=g?v+Yr:v,j=N+y;if(c.indexOf(j)>-1)continue;c.push(j);const E=s(y,x);for(let C=0;C<E.length;++C){const R=E[C];c.push(N+R)}f=l+(f.length>0?" "+f:f)}return f},vh=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=vi(n))&&(s&&(s+=" "),s+=r);return s},vi=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=vi(e[r]))&&(n&&(n+=" "),n+=t);return n},wh=(e,...t)=>{let n,r,s,o;const i=u=>{const f=t.reduce((d,l)=>l(d),e());return n=gh(f),r=n.cache.get,s=n.cache.set,o=c,c(u)},c=u=>{const f=r(u);if(f)return f;const d=yh(u,n);return s(u,d),d};return o=i,(...u)=>o(vh(...u))},Sh=[],fe=e=>{const t=n=>n[e]||Sh;return t.isThemeGetter=!0,t},wi=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Si=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Rh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Nh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ch=/\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$/,jh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Eh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ve=e=>Rh.test(e),K=e=>!!e&&!Number.isNaN(Number(e)),Le=e=>!!e&&Number.isInteger(Number(e)),kr=e=>e.endsWith("%")&&K(e.slice(0,-1)),Ue=e=>Nh.test(e),Ri=()=>!0,_h=e=>Ch.test(e)&&!jh.test(e),ps=()=>!1,Ph=e=>Eh.test(e),Ah=e=>kh.test(e),Oh=e=>!M(e)&&!F(e),Th=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)),Lh=e=>Ze(e,ji,ps),M=e=>wi.test(e),tt=e=>Ze(e,Ei,_h),Co=e=>Ze(e,zh,K),Ih=e=>Ze(e,_i,Ri),Mh=e=>Ze(e,ki,ps),jo=e=>Ze(e,Ni,ps),Dh=e=>Ze(e,Ci,Ah),wn=e=>Ze(e,Pi,Ph),F=e=>Si.test(e),Kt=e=>xt(e,Ei),Fh=e=>xt(e,ki),Eo=e=>xt(e,Ni),Uh=e=>xt(e,ji),$h=e=>xt(e,Ci),Sn=e=>xt(e,Pi,!0),Bh=e=>xt(e,_i,!0),Ze=(e,t,n)=>{const r=wi.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},xt=(e,t,n=!1)=>{const r=Si.exec(e);return r?r[1]?t(r[1]):n:!1},Ni=e=>e==="position"||e==="percentage",Ci=e=>e==="image"||e==="url",ji=e=>e==="length"||e==="size"||e==="bg-size",Ei=e=>e==="length",zh=e=>e==="number",ki=e=>e==="family-name",_i=e=>e==="number"||e==="weight",Pi=e=>e==="shadow",Wh=()=>{const e=fe("color"),t=fe("font"),n=fe("text"),r=fe("font-weight"),s=fe("tracking"),o=fe("leading"),i=fe("breakpoint"),c=fe("container"),u=fe("spacing"),f=fe("radius"),d=fe("shadow"),l=fe("inset-shadow"),h=fe("text-shadow"),m=fe("drop-shadow"),g=fe("blur"),p=fe("perspective"),b=fe("aspect"),x=fe("ease"),y=fe("animate"),v=()=>["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"],j=()=>[...N(),F,M],E=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],R=()=>[F,M,u],P=()=>[Ve,"full","auto",...R()],I=()=>[Le,"none","subgrid",F,M],A=()=>["auto",{span:["full",Le,F,M]},Le,F,M],D=()=>[Le,"auto",F,M],O=()=>["auto","min","max","fr",F,M],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...R()],Q=()=>[Ve,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],ge=()=>[Ve,"screen","full","dvw","lvw","svw","min","max","fit",...R()],ve=()=>[Ve,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],L=()=>[e,F,M],k=()=>[...N(),Eo,jo,{position:[F,M]}],z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",Uh,Lh,{size:[F,M]}],H=()=>[kr,Kt,tt],V=()=>["","none","full",f,F,M],$=()=>["",K,Kt,tt],q=()=>["solid","dashed","dotted","double"],oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[K,kr,Eo,jo],Pe=()=>["","none",g,F,M],Ee=()=>["none",K,F,M],W=()=>["none",K,F,M],we=()=>[K,F,M],ae=()=>[Ve,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ue],breakpoint:[Ue],color:[Ri],container:[Ue],"drop-shadow":[Ue],ease:["in","out","in-out"],font:[Oh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ue],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ue],shadow:[Ue],spacing:["px",K],text:[Ue],"text-shadow":[Ue],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ve,M,F,b]}],container:["container"],"container-type":[{"@container":["","normal","size",F,M]}],"container-named":[Th],columns:[{columns:[K,M,F,c]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"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:j()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],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:[Le,"auto",F,M]}],basis:[{basis:[Ve,"full","auto",c,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[K,Ve,"auto","initial","none",M]}],grow:[{grow:["",K,F,M]}],shrink:[{shrink:["",K,F,M]}],order:[{order:[Le,"first","last","none",F,M]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],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":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...ge()]}],"min-inline-size":[{"min-inline":["auto",...ge()]}],"max-inline-size":[{"max-inline":["none",...ge()]}],"block-size":[{block:["auto",...ve()]}],"min-block-size":[{"min-block":["auto",...ve()]}],"max-block-size":[{"max-block":["none",...ve()]}],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",n,Kt,tt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Bh,Ih]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",kr,M]}],"font-family":[{font:[Fh,Mh,t]}],"font-features":[{"font-features":[M]}],"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:[s,F,M]}],"line-clamp":[{"line-clamp":[K,"none",F,Co]}],leading:[{leading:[o,...R()]}],"list-image":[{"list-image":["none",F,M]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",F,M]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[K,"from-font","auto",F,tt]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[K,"auto",F,M]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"tab-size":[{tab:[Le,F,M]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",F,M]}],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",F,M]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:k()}],"bg-repeat":[{bg:z()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Le,F,M],radial:["",F,M],conic:[Le,F,M]},$h,Dh]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-bs":[{"border-bs":$()}],"border-w-be":[{"border-be":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[K,F,M]}],"outline-w":[{outline:["",K,Kt,tt]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",d,Sn,wn]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",l,Sn,wn]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[K,tt]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",h,Sn,wn]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[K,F,M]}],"mix-blend":[{"mix-blend":[...oe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":oe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[K]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[F,M]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"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":[K]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:k()}],"mask-repeat":[{mask:z()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",F,M]}],filter:[{filter:["","none",F,M]}],blur:[{blur:Pe()}],brightness:[{brightness:[K,F,M]}],contrast:[{contrast:[K,F,M]}],"drop-shadow":[{"drop-shadow":["","none",m,Sn,wn]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",K,F,M]}],"hue-rotate":[{"hue-rotate":[K,F,M]}],invert:[{invert:["",K,F,M]}],saturate:[{saturate:[K,F,M]}],sepia:[{sepia:["",K,F,M]}],"backdrop-filter":[{"backdrop-filter":["","none",F,M]}],"backdrop-blur":[{"backdrop-blur":Pe()}],"backdrop-brightness":[{"backdrop-brightness":[K,F,M]}],"backdrop-contrast":[{"backdrop-contrast":[K,F,M]}],"backdrop-grayscale":[{"backdrop-grayscale":["",K,F,M]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[K,F,M]}],"backdrop-invert":[{"backdrop-invert":["",K,F,M]}],"backdrop-opacity":[{"backdrop-opacity":[K,F,M]}],"backdrop-saturate":[{"backdrop-saturate":[K,F,M]}],"backdrop-sepia":[{"backdrop-sepia":["",K,F,M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",F,M]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[K,"initial",F,M]}],ease:[{ease:["linear","initial",x,F,M]}],delay:[{delay:[K,F,M]}],animate:[{animate:["none",y,F,M]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,F,M]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[F,M,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":["translate-none"],zoom:[{zoom:[Le,F,M]}],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"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",F,M]}],"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":L()}],"scrollbar-track-color":[{"scrollbar-track":L()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",F,M]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[K,Kt,tt,Co]}],stroke:[{stroke:["none",...L()]}],"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"]}},Vh=wh(Wh);function Ft(...e){return Vh(Qf(e))}function Y(e,t="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:2}).format(e)}const he=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ft("rounded-xl border bg-card text-card-foreground shadow",e),...t}));he.displayName="Card";const Ce=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ft("flex flex-col space-y-1.5 p-6",e),...t}));Ce.displayName="CardHeader";const Ae=S.forwardRef(({className:e,...t},n)=>a.jsx("h3",{ref:n,className:Ft("font-semibold leading-none tracking-tight",e),...t}));Ae.displayName="CardTitle";const Hh=S.forwardRef(({className:e,...t},n)=>a.jsx("p",{ref:n,className:Ft("text-sm text-muted-foreground",e),...t}));Hh.displayName="CardDescription";const me=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ft("p-6 pt-0",e),...t}));me.displayName="CardContent";const qh=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ft("flex items-center p-6 pt-0",e),...t}));qh.displayName="CardFooter";function Qn({status:e,error:t}){const n=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(Fe,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}):a.jsx(ci,{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:n?"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(Gn,{to:n?"/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(ui,{className:"h-4 w-4"}),n?"Connect AWS source":"Review CUR discovery"]}),!n&&a.jsx(Gn,{to:"/sources",className:"rounded-md border px-3 py-2 text-sm font-medium hover:bg-muted",children:"Cost sources"})]})]})]})})}const ie={getOverview:e=>ne.get("/overview",{params:e}).then(t=>t.data),getAccounts:e=>ne.get("/accounts",{params:e}).then(t=>t.data),getReports:e=>ne.get("/reports",{params:e}).then(t=>t.data),getFilterOptions:e=>ne.get("/filter-options",{params:{start:e?.start,end:e?.end,tagKey:e?.filterTagKey,managementAccountId:e?.managementAccountId}}).then(t=>t.data),getTags:e=>ne.get("/tags",{params:e}).then(t=>t.data),getDataStatus:e=>ne.get("/data-status",{params:e}).then(t=>t.data),getAnalysisStatus:e=>ne.get("/analysis/status",{params:e}).then(t=>t.data),getLatestAnalysis:e=>ne.get("/analysis/latest",{params:e}).then(t=>t.data.analysis),getAnalysisSchedule:e=>ne.get("/analysis/schedule",{params:e}).then(t=>t.data),updateAnalysisSchedule:(e,t)=>ne.put("/analysis/schedule",e,{params:t}).then(n=>n.data),getAnalysisReports:e=>ne.get("/analysis/reports",{params:e}).then(t=>t.data.reports),removeAnalysisReport:e=>ne.delete(`/analysis/reports/${e}`).then(t=>t.data),downloadAnalysisHtml:e=>ne.get(`/analysis/reports/${e}/html`,{responseType:"blob"}).then(t=>t.data),downloadAnalysisPdf:e=>ne.get(`/analysis/reports/${e}/pdf`,{responseType:"blob"}).then(t=>t.data),getSources:()=>ne.get("/sources").then(e=>e.data),createSource:e=>ne.post("/sources",e).then(t=>t.data),getSourceStatus:e=>ne.get(`/sources/${e}/status`).then(t=>t.data),verifySource:e=>ne.post(`/sources/${e}/verify`).then(t=>t.data),removeSource:e=>ne.delete(`/sources/${e}`).then(t=>t.data),downloadSourceTemplate:e=>ne.get(`/sources/${e}/template`,{responseType:"blob"}).then(t=>t.data),getCurDiscovery:e=>ne.get("/cur-discovery",{params:e}).then(t=>t.data)},Ai=_.createContext("user"),Gh=Ai.Provider,Kh=()=>_.useContext(Ai),Oi=_.createContext(null);function Yh({tenantId:e="default",children:t}){const n=`meyi-cost:selected-management-account:${e||"default"}`,[r,s]=_.useState([]),[o,i]=_.useState(""),[c,u]=_.useState(!0),f=_.useCallback(async()=>{u(!0);try{const m=((await ie.getSources()).sources||[]).filter(g=>!!g.managementAccountId);s(m),i(g=>{const b=window.localStorage.getItem(n)||""||g,x=m.find(v=>v.status==="CONNECTED")||m[0],y=m.some(v=>v.managementAccountId===b)?b:x?.managementAccountId||"";return y?window.localStorage.setItem(n,y):window.localStorage.removeItem(n),y})}catch{s([]),i("")}finally{u(!1)}},[n]);_.useEffect(()=>{f()},[f]);const d=_.useCallback(h=>{/^\d{12}$/.test(h)&&(window.localStorage.setItem(n,h),i(h))},[n]),l=_.useMemo(()=>({sources:r,managementAccountId:o,loading:c,selectManagementAccount:d,refreshSources:f}),[r,o,c,d,f]);return a.jsx(Oi.Provider,{value:l,children:t})}function Ut(){const e=_.useContext(Oi);if(!e)throw new Error("useCostAccount must be used inside CostAccountProvider");return e}function ir(){const{sources:e,managementAccountId:t,loading:n,selectManagementAccount:r}=Ut();return e.length<=1?null:a.jsxs("label",{className:"flex items-center gap-2",children:[a.jsx(ai,{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:s=>r(s.target.value),disabled:n,className:"max-w-72 rounded-md border bg-background px-3 py-2 text-sm shadow-sm disabled:opacity-50",children:e.map(s=>a.jsxs("option",{value:s.managementAccountId||"",children:["Management account ",s.managementAccountId]},s.connectionId))})]})}function Jh({points:e,currency:t="USD"}){const[n,r]=_.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 s=900,o=260,i=70,c=24,u=22,f=48,d=s-i-c,l=o-u-f,h=Math.max(...e.map(x=>x.value),1),m=e.map((x,y)=>({...x,x:i+(e.length===1?d/2:y*d/(e.length-1)),y:u+l-x.value/h*l})),g=n==null?null:m[n],p=Math.max(1,Math.ceil(e.length/12)),b=x=>{const y=x.currentTarget.getBoundingClientRect(),v=(x.clientX-y.left)/y.width*s;let N=0;for(let j=1;j<m.length;j+=1)Math.abs(m[j].x-v)<Math.abs(m[N].x-v)&&(N=j);r(N)};return a.jsxs("div",{className:"relative w-full",children:[a.jsxs("svg",{viewBox:`0 0 ${s} ${o}`,className:"h-72 w-full",onMouseMove:b,onMouseLeave:()=>r(null),role:"img","aria-label":"Cost trend line chart",children:[[0,.25,.5,.75,1].map(x=>{const y=u+l*x;return a.jsxs("g",{children:[a.jsx("line",{x1:i,y1:y,x2:s-c,y2:y,stroke:"#d8e0e7",strokeDasharray:"4 4"}),a.jsx("text",{x:i-10,y:y+4,textAnchor:"end",fill:"currentColor",className:"text-[10px] text-muted-foreground",children:Y(h*(1-x),t)})]},x)}),a.jsx("line",{x1:i,y1:u+l,x2:s-c,y2:u+l,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:u,x2:g.x,y2:u+l,stroke:"#1f5f85",strokeDasharray:"3 4",opacity:"0.45"}),m.map((x,y)=>a.jsxs("g",{children:[a.jsx("circle",{cx:x.x,cy:x.y,r:n===y?7:e.length>31?3:5,fill:"#1f5f85",stroke:"white",strokeWidth:"2"}),(y%p===0||y===m.length-1)&&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/s*100}%`,top:`${Math.max(g.y/o*100-4,2)}%`,transform:g.x>s*.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:Y(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:Y(x.value,t)})]},x.label))]})]})}const ko=e=>e.length>16?`${e.slice(0,14)}...`:e,Xh=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t||"USD",notation:"compact",maximumFractionDigits:1}).format(e);function Zh({title:e,items:t,currency:n}){const o={top:38,right:18,bottom:72,left:76},i=720-o.left-o.right,c=320-o.top-o.bottom,u=Math.max(...t.map(l=>l.amount),1),f=i/t.length,d=Math.min(56,f*.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(l=>{const h=o.top+c-l*c;return a.jsxs("g",{children:[a.jsx("line",{x1:o.left,y1:h,x2:720-o.right,y2:h,stroke:"currentColor",opacity:l===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:Xh(u*l,n)})]},l)}),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((l,h)=>{const m=o.left+f*h+f/2,g=Math.max(l.amount/u*c,3),p=o.top+c-g;return a.jsxs("g",{tabIndex:0,"aria-label":`${l.label}: ${Y(l.amount,n)}`,className:"outline-none focus-visible:opacity-75",children:[a.jsxs("title",{children:[l.label,": ",Y(l.amount,n)]}),a.jsx("rect",{x:m-d/2,y:p,width:d,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:Y(l.amount,n)}),a.jsx("text",{x:m,y:278,textAnchor:"middle",fill:"currentColor",opacity:"0.72",fontSize:"11",children:ko(l.label)}),l.accountId&&a.jsx("text",{x:m,y:295,textAnchor:"middle",fill:"currentColor",opacity:"0.55",fontSize:"9",children:ko(l.accountId)})]},l.key||l.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 (",n,")"]})]})}const Ti="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 _r({title:e,icon:t,items:n,currency:r}){const[s,o]=_.useState("chart"),i=n.slice(0,6),c=Math.max(...i.map(u=>u.amount),1);return a.jsxs(he,{className:"min-w-0",children:[a.jsxs(Ce,{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(Ae,{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":s==="chart",title:"Bar chart",className:`rounded p-1.5 ${s==="chart"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(gf,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:()=>o("list"),"aria-label":`Show ${e} as list`,"aria-pressed":s==="list",title:"List",className:`rounded p-1.5 ${s==="list"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(Df,{className:"h-4 w-4"})})]})]}),a.jsx(me,{children:i.length?s==="chart"?a.jsx(Zh,{title:e,items:i,currency:r}):a.jsx("div",{className:"space-y-3",children:i.map(u=>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:u.label,children:[u.label,u.accountId?a.jsxs("span",{className:"ml-1 text-xs",children:["(",u.accountId,")"]}):null]}),a.jsx("span",{className:"shrink-0 font-medium",children:Y(u.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:`${u.amount/c*100}%`}})})]},u.key||u.label))}):a.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No cost data for this period."})})]})}function Qh(){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(he,{className:Ti,children:[a.jsx(Ce,{className:"pb-2",children:a.jsx("div",{className:"h-3 w-24 animate-pulse rounded bg-muted"})}),a.jsxs(me,{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(he,{children:[a.jsx(Ce,{children:a.jsx("div",{className:"h-4 w-36 animate-pulse rounded bg-muted"})}),a.jsx(me,{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(he,{children:[a.jsx(Ce,{children:a.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted"})}),a.jsx(me,{className:"space-y-4",children:Array.from({length:5},(n,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 em({data:e,period:t,selectedMonth:n}){const r=e.topServices[0],s=e.topAccounts[0],o=new Date,[i,c]=n.split("-").map(Number),u=t==="monthly"?new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(i,c-1,1)):String(o.getFullYear()),f=[{label:"Total cost",value:a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"block",children:Y(e.totalCost,e.currency)}),a.jsxs("span",{className:"mt-1 block text-sm font-medium text-muted-foreground",children:["Accounts: ",e.activeAccounts]})]}),helper:u,icon:a.jsx(li,{})},{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:`${u} across all accounts`,icon:a.jsx(Xn,{})},{label:"Highest cost service",value:r?a.jsx("span",{className:"whitespace-pre-line text-sm",children:`Service - ${r.label}
15
- Cost - ${Y(r.amount,e.currency)}`}):"-",helper:u,icon:a.jsx(fi,{})},{label:"Highest cost account",value:s?a.jsx("span",{className:"whitespace-pre-line text-sm",children:`Account Name - ${s.label}
16
- Account Id - ${s.accountId||s.key||"Unknown"}
17
- Cost - ${Y(s.amount,e.currency)}`}):"-",helper:u,icon:a.jsx(Xn,{})}];return a.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:f.map(d=>a.jsxs(he,{className:Ti,children:[a.jsxs(Ce,{className:"flex flex-row items-center justify-between pb-2",children:[a.jsx(Ae,{className:"text-xs font-medium text-muted-foreground",children:d.label}),a.jsx("span",{className:"text-muted-foreground [&>svg]:h-4 [&>svg]:w-4",children:d.icon})]}),a.jsxs(me,{children:[a.jsx("div",{className:"break-words text-base font-semibold leading-snug xl:text-lg",children:d.value}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:d.helper})]})]},d.label))})}function tm(){const e=new Date,t=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`,[n,r]=_.useState(null),[s,o]=_.useState(!0),[i,c]=_.useState(null),[u,f]=_.useState(null),[d,l]=_.useState("monthly"),[h,m]=_.useState(t),{managementAccountId:g,loading:p}=Ut(),b=_.useRef(0),x=Array.from({length:e.getMonth()+1},(j,E)=>({value:`${e.getFullYear()}-${String(E+1).padStart(2,"0")}`,label:new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(e.getFullYear(),E,1))})),y=async(j=d,E=h,C=g)=>{const R=++b.current;o(!0),r(null),c(null);try{let P;if(j==="yearly")P={period:j,start:`${e.getFullYear()}-01-01`};else{const[O,B]=E.split("-").map(Number),J=E===t?e.getDate():new Date(O,B,0).getDate();P={period:j,start:`${E}-01`,end:`${E}-${String(J).padStart(2,"0")}`}}const I=C?{managementAccountId:C}:void 0,A=await ie.getDataStatus(I);if(R===b.current&&f(A),!A.ready)return;const D=await ie.getOverview({...P,...I});R===b.current&&r(D)}catch(P){R===b.current&&c(P?.response?.data?.error||P.message||"Failed to load AWS costs")}finally{R===b.current&&o(!1)}};return _.useEffect(()=>{p||y(d,h,g)},[d,h,g,p]),{data:n,dataStatus:u,loading:s||p,error:i,period:d,selectedMonth:h,monthOptions:x,changePeriod:j=>{j!==d&&(o(!0),r(null),l(j))},changeMonth:j=>{j===h||!x.some(E=>E.value===j)||(o(!0),r(null),m(j))},refresh:()=>y(d,h,g)}}function nm(e){return e==="daily"?"Daily (last 60 days)":e==="yearly"?"Yearly":"Monthly"}function rm(e,t){if(t==="yearly")return e.slice(0,4);const n=new Date(`${e}T00:00:00Z`);return t==="daily"?n.toLocaleDateString(void 0,{day:"numeric",month:"short",timeZone:"UTC"}):n.toLocaleDateString(void 0,{month:"short",year:"2-digit",timeZone:"UTC"})}function sm(){const{data:e,dataStatus:t,loading:n,error:r,period:s,selectedMonth:o,monthOptions:i,changePeriod:c,changeMonth:u,refresh:f}=tm();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(li,{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(ir,{}),s==="monthly"&&a.jsx("select",{"aria-label":"Cost month",value:o,onChange:d=>u(d.target.value),disabled:n,className:"rounded-lg border bg-background px-3 py-2 text-sm shadow-sm disabled:opacity-50",children:i.map(d=>a.jsx("option",{value:d.value,children:d.label},d.value))}),a.jsx("div",{className:"flex rounded-lg border p-1",children:["monthly","yearly"].map(d=>a.jsx("button",{onClick:()=>c(d),className:`rounded-md px-3 py-1.5 text-sm capitalize transition-colors ${s===d?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:d},d))}),a.jsx("button",{onClick:()=>{f()},disabled:n,className:"rounded-lg border p-2 hover:bg-muted",children:a.jsx(Tt,{className:`h-4 w-4 ${n?"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(Fe,{className:"h-4 w-4"}),r]}),n?a.jsx(Qh,{}):t&&!t.ready?a.jsx(Qn,{status:t}):r&&!e?a.jsx(Qn,{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(em,{data:e,period:s,selectedMonth:o}),e.message&&!/historical data beyond 14 months/i.test(e.message)&&a.jsx(he,{children:a.jsx(me,{className:"py-8 text-center text-sm text-muted-foreground",children:e.message})}),a.jsxs(he,{children:[a.jsxs(Ce,{className:"flex flex-row items-center gap-2",children:[a.jsx(pi,{className:"h-4 w-4 text-primary"}),a.jsxs(Ae,{className:"text-sm",children:["Cost Trend - ",nm(e.trendGranularity??s)]})]}),a.jsx(me,{children:a.jsx(Jh,{points:e.trends.map(d=>({key:d.month,label:rm(d.month,e.trendGranularity??s),value:d.amount})),currency:e.currency})})]}),a.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[a.jsx(_r,{title:"Top services",icon:a.jsx(fi,{className:"h-4 w-4"}),items:e.topServices,currency:e.currency}),a.jsx(_r,{title:"AWS accounts",icon:a.jsx(ai,{className:"h-4 w-4"}),items:e.topAccounts,currency:e.currency}),a.jsx(_r,{title:"Regional distribution",icon:a.jsx($f,{className:"h-4 w-4"}),items:e.topRegions,currency:e.currency})]})]}):null]})}const Rn=["#6264e9","#eb67ad","#31c39a","#f29a05","#579bea","#9078ed","#f7842c","#24b9ad","#8ac926","#ffca3a","#6a4c93","#1982c4"];function _o(e,t){const n=new Date(e.length===10?`${e}T00:00:00Z`:e);return Number.isFinite(n.getTime())?n.toLocaleDateString(void 0,t?{month:"short",day:"numeric"}:{month:"short",year:"numeric"}):e}function om({timeline:e,currency:t="USD",daily:n=!1}){const[r,s]=_.useState(null),[o,i]=_.useState(null),c=_.useMemo(()=>{const g=new Map;for(const p of e)for(const b of p.groups)g.set(b.label,(g.get(b.label)||0)+b.amount);return[...g.entries()].sort((p,b)=>b[1]-p[1]).map(([p],b)=>({label:p,color:Rn[b%Rn.length]}))},[e]),u=new Map(c.map(g=>[g.label,g.color])),f=Math.max(...e.map(g=>g.total),1),d=r??o,l=d==null?null:e[d],h=n?52:80,m=Math.max(520,e.length*h);return e.length?a.jsxs("div",{className:"grid min-w-0 gap-4 lg:grid-cols-[minmax(0,1fr)_288px]",onMouseLeave:()=>s(null),children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"grid min-h-80 min-w-0 grid-cols-[72px_minmax(0,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(g=>a.jsx("span",{children:Y(f*g,t)},g))}),a.jsx("div",{className:"min-w-0 overflow-x-auto pb-2",children:a.jsxs("div",{style:{width:m},children:[a.jsxs("div",{className:"relative flex h-64 items-end border-b px-4",children:[[0,25,50,75].map(g=>a.jsx("span",{className:"pointer-events-none absolute left-0 right-0 border-t border-dashed border-slate-200",style:{top:`${g}%`}},g)),e.map((g,p)=>a.jsx("button",{type:"button",onMouseEnter:()=>s(p),onMouseLeave:()=>s(null),onPointerDown:b=>b.preventDefault(),onFocus:()=>i(p),onBlur:()=>i(null),className:"group z-10 flex h-full shrink-0 items-end justify-center px-2 outline-none focus-visible:ring-2 focus-visible:ring-primary",style:{width:h},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(g.total/f*100,1)}%`},children:g.groups.map(b=>a.jsx("span",{style:{backgroundColor:u.get(b.label)||Rn[0],height:`${g.total?b.amount/g.total*100:0}%`}},b.key||b.label))})},`${g.start}-${p}`))]}),a.jsx("div",{className:"flex px-4 pt-2",children:e.map((g,p)=>a.jsx("span",{className:"shrink-0 whitespace-nowrap text-center text-[11px] text-muted-foreground",style:{width:h},children:_o(g.start,n)},`${g.start}-label-${p}`))})]})})]}),a.jsxs("div",{className:"mt-5 flex min-w-0 flex-wrap gap-x-4 gap-y-2",children:[c.slice(0,8).map(g=>a.jsxs("span",{className:"flex max-w-full min-w-0 items-center gap-1.5 text-xs",children:[a.jsx("span",{className:"h-2.5 w-2.5 shrink-0 rounded-full",style:{backgroundColor:g.color}}),a.jsx("span",{className:"min-w-0 truncate",title:g.label,children:g.label})]},g.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:l?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:_o(l.start,n)}),a.jsxs("div",{className:"mt-3 space-y-2",children:[[...l.groups].sort((g,p)=>p.amount-g.amount).slice(0,5).map(g=>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:u.get(g.label)||Rn[0]}}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:g.label}),a.jsx("strong",{children:Y(g.amount,t)})]},g.key||g.label)),l.groups.length>5&&a.jsxs("p",{className:"text-xs italic text-muted-foreground",children:["+ ",l.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:Y(l.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 am({rows:e,currency:t}){const n=e.slice(0,8),r=Math.max(1,...n.flatMap(s=>[s.current?.amount||0,s.previous?.amount||0]));return a.jsxs(he,{className:"bg-primary/5",children:[a.jsx(Ce,{children:a.jsx(Ae,{className:"text-sm",children:"Comparison Overview"})}),a.jsx(me,{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:n.map(s=>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: ${Y(s.current?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-indigo-500",style:{height:`${Math.max((s.current?.amount||0)/r*100,s.current?.amount?1:0)}%`}}),a.jsx("div",{title:`Previous: ${Y(s.previous?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-pink-400",style:{height:`${Math.max((s.previous?.amount||0)/r*100,s.previous?.amount?1:0)}%`}})]}),a.jsx("span",{title:s.label,className:"mt-2 w-full truncate text-center text-[10px] text-muted-foreground",children:s.label})]},s.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 Me({label:e,value:t,helper:n,accent:r=!1,trend:s}){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:[s!=null&&(s<0?a.jsx(Jf,{className:"h-4 w-4 text-red-500"}):a.jsx(pi,{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":s!=null&&s<0?"text-red-500":""}`,children:t}),n&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n})]})}function Nn({label:e,options:t,selected:n,onChange:r}){const s=n.length?`${n.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:s}),a.jsx(bf,{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:n.includes(o.value),onChange:i=>r(i.target.checked?[...n,o.value]:n.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 im(){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(it,{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 Je=10,Jr=new Date,Li=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,cm=Li(new Date(Jr.getFullYear(),Jr.getMonth()-2,1)),lm=Li(Jr),Yt={services:[],regions:[],accountIds:[],tagKey:"",tagValues:[]},ht={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 Po(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 Ao(e,t){const n=new Date(`${e}T00:00:00Z`);if(t==="monthly"){const s=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),1)),o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)),i=new Date(s);i.setUTCDate(i.getUTCDate()-1);const c=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1));return{currentStart:s.toISOString().slice(0,10),currentEnd:o.toISOString().slice(0,10),previousStart:c.toISOString().slice(0,10),previousEnd:i.toISOString().slice(0,10)}}const r=new Date(n);return r.setUTCDate(r.getUTCDate()-1),{currentStart:e,currentEnd:e,previousStart:r.toISOString().slice(0,10),previousEnd:r.toISOString().slice(0,10)}}function Lt(e,t,n){const r=new Date(`${e}T00:00:00Z`),s=new Date(`${t}T00:00:00Z`);if(n==="monthly"&&r.getUTCFullYear()===s.getUTCFullYear()&&r.getUTCMonth()===s.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(s)}`}function um(e){const t=new Map;return e.current.summary.forEach(n=>t.set(n.key||n.label,{current:n})),e.previous.summary.forEach(n=>{const r=n.key||n.label;t.set(r,{...t.get(r),previous:n})}),[...t.entries()].map(([n,r])=>{const s=r.current?.amount||0,o=r.previous?.amount||0,i=s-o;return{key:n,label:r.current?.label||r.previous?.label||n,...r,difference:i,change:o?i/Math.abs(o)*100:0}}).sort((n,r)=>Math.max(r.current?.amount||0,r.previous?.amount||0)-Math.max(n.current?.amount||0,n.previous?.amount||0))}function nt(e){return e?.length?e.map(t=>`${t.label}
18
- ${Y(t.amount,"USD")}`).join(`
19
- `):"—"}function Oo({values:e}){const[t,n]=_.useState(!1);return a.jsxs("div",{className:"relative",children:[a.jsxs("button",{type:"button",onClick:()=>n(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:()=>n(!1),children:a.jsx(ft,{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:Y(r.amount,"USD")})]},r.key)):a.jsx("p",{className:"text-xs text-muted-foreground",children:"No related values."})]})]})}function Ii({page:e,pages:t,total:n,onChange:r}){const s=n?(e-1)*Je+1:0,o=Math.min(e*Je,n);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 ",s,"–",o," of ",n]}),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(vf,{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(Sf,{className:"h-4 w-4"})})]})]})}function dm({groupBy:e,report:t}){const[n,r]=_.useState(""),[s,o]=_.useState(1),[i,c]=_.useState(null),[u,f]=_.useState({percentage:!0,accounts:!0,regions:!0}),d=ht[e],l=_.useMemo(()=>{const p=n.trim().toLowerCase();return p?t.summary.filter(b=>`${b.label} ${b.accountId||""}`.toLowerCase().includes(p)):t.summary},[t,n]),h=Math.max(1,Math.ceil(l.length/Je)),m=l.slice((s-1)*Je,s*Je),g=3+Number(u.percentage)+Number(u.accounts)+Number(u.regions);return _.useEffect(()=>{o(1)},[t,n,e]),a.jsxs(he,{children:[a.jsxs(Ce,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Ae,{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(hs,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search breakdown",value:n,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(hi,{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(u).map(([p,b])=>a.jsxs("label",{className:"flex gap-2 py-1 text-xs capitalize",children:[a.jsx("input",{type:"checkbox",checked:b,onChange:x=>f(y=>({...y,[p]:x.target.checked}))}),p]},p))})]})]})]}),a.jsx(me,{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:d.item}),a.jsx("th",{className:"px-4",children:"Cost"}),u.percentage&&a.jsx("th",{className:"px-4",children:"Percentage"}),u.accounts&&a.jsx("th",{className:"px-4",children:"Accounts"}),u.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:Y(p.amount,t.currency)}),u.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),"%"]})]}),u.accounts&&a.jsx("td",{className:"px-4",children:a.jsx(Oo,{values:p.accounts||[]})}),u.regions&&a.jsx("td",{className:"px-4",children:a.jsx(Oo,{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(Of,{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:d.empty})})})]})}),a.jsx(Ii,{page:s,pages:h,total:l.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:d.item}),a.jsx("h3",{className:"mt-1 text-lg font-semibold",children:i.label})]}),a.jsx("button",{onClick:()=>c(null),children:a.jsx(ft,{})})]}),a.jsxs("div",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[a.jsx(Me,{label:"Cost",value:Y(i.amount,t.currency)}),a.jsx(Me,{label:"Accounts",value:String(i.accounts?.length||0)}),a.jsx(Me,{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:Y(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:Y(p.amount,t.currency)})]},p.key))]})]})]})})]})}function fm({rows:e,groupBy:t,comparison:n,granularity:r}){const[s,o]=_.useState(""),[i,c]=_.useState(1),u=_.useMemo(()=>{const m=s.trim().toLowerCase();return m?e.filter(g=>g.label.toLowerCase().includes(m)):e},[e,s]),f=Math.max(1,Math.ceil(u.length/Je)),d=u.slice((i-1)*Je,i*Je),l=Lt(n.currentStart,n.currentEnd,r),h=Lt(n.previousStart,n.previousEnd,r);return _.useEffect(()=>{c(1)},[s,t,n]),a.jsxs(he,{children:[a.jsxs(Ce,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Ae,{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(hs,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search comparison",value:s,onChange:m=>o(m.target.value),placeholder:"Search...",className:"w-48 bg-transparent outline-none"})]})]}),a.jsx(me,{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:[ht[t].item," name"]}),a.jsxs("th",{className:"px-4",children:[l,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:d.length?d.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:Y(m.current?.amount||0,n.current.currency)}),a.jsx("td",{className:"px-4",children:Y(m.previous?.amount||0,n.previous.currency)}),a.jsxs("td",{className:`px-4 font-medium ${m.difference<0?"text-red-500":"text-emerald-600"}`,children:[m.difference>=0?"+":"",Y(m.difference,n.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(Ii,{page:i,pages:f,total:u.length,onChange:c})]})}function hm(e){const{mode:t,groupBy:n,start:r,end:s,granularity:o,reportTagKey:i,options:c,filters:u,loading:f,filtersLoading:d,comparisonPeriods:l}=e;return a.jsxs("aside",{className:"space-y-4",children:[a.jsxs(he,{className:"bg-primary/5",children:[a.jsx(Ce,{children:a.jsx(Ae,{className:"text-sm uppercase text-primary",children:"Report parameters"})}),a.jsxs(me,{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:s,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: ",l.currentStart," to ",l.currentEnd,a.jsx("br",{}),"Previous: ",l.previousStart," to ",l.previousEnd]}),n==="tag"&&a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Group by tag key",a.jsxs("select",{value:c.tagKeys.includes(i)?i:"",onChange:h=>e.onReportTagKeyChange(h.target.value),disabled:!c.tagKeys.length,className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground disabled:opacity-60",children:[a.jsx("option",{value:"",children:d?"Loading tag keys...":"Select a tag key"}),c.tagKeys.map(h=>a.jsx("option",{children:h},h))]}),!d&&!c.tagKeys.length&&a.jsx("span",{className:"mt-2 block text-xs text-muted-foreground",children:"No activated AWS cost allocation tags are present in this CUR data."})]}),a.jsxs("button",{onClick:e.onRun,disabled:f||n==="tag"&&!c.tagKeys.length,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(Tt,{className:`h-4 w-4 ${f?"animate-spin":""}`}),"Run report"]})]})]}),a.jsxs(he,{className:"bg-primary/5",children:[a.jsx(Ce,{children:a.jsx(Ae,{className:"text-sm uppercase text-primary",children:"Filter by"})}),a.jsxs(me,{className:"space-y-3",children:[a.jsx(Nn,{label:"Services",options:c.services,selected:u.services,onChange:h=>e.onFiltersChange(m=>({...m,services:h}))}),a.jsx(Nn,{label:"Region",options:c.regions,selected:u.regions,onChange:h=>e.onFiltersChange(m=>({...m,regions:h}))}),a.jsx(Nn,{label:"Linked Account",options:c.accounts,selected:u.accountIds,onChange:h=>e.onFiltersChange(m=>({...m,accountIds:h}))}),a.jsxs("select",{value:u.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))]}),u.tagKey&&a.jsx(Nn,{label:"Tag values",options:c.tagValues.map(h=>({value:h,label:h})),selected:u.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:d||f,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:f,className:"rounded-md border bg-background px-3 py-2 text-sm text-primary disabled:opacity-50",children:"Reset"})]})]})]})]})}function mm(){const{managementAccountId:e,loading:t}=Ut(),[n,r]=_.useState("service"),[s,o]=_.useState("standard"),[i,c]=_.useState(cm),[u,f]=_.useState(lm),[d,l]=_.useState("monthly"),[h,m]=_.useState("Name"),[g,p]=_.useState({services:[],regions:[],accounts:[],tagKeys:[],tagValues:[]}),[b,x]=_.useState(Yt),[y,v]=_.useState(Yt),[N,j]=_.useState(null),[E,C]=_.useState(null),[R,P]=_.useState(!0),[I,A]=_.useState(!1),[D,O]=_.useState(null),[B,J]=_.useState(null),[Z,Q]=_.useState(null),[ge,ve]=_.useState("monthly"),L=_.useRef(0),k=_.useRef(0),z=_.useMemo(()=>E?um(E):[],[E]),G=Ao(u,d),H=(W,we,ae,te,U=h)=>({start:we,end:ae,groupBy:te,granularity:d,tagKey:U,services:W.services.join(","),regions:W.regions.join(","),accountIds:W.accountIds.join(","),filterTagKey:W.tagKey||void 0,tagValues:W.tagValues.join(","),managementAccountId:e}),V=async(W="")=>{const we=++k.current,ae=()=>we===k.current;A(!0),J(null);try{if(!W){const U=await ie.getDataStatus({managementAccountId:e});if(!ae()||(Q(U),!U.ready))return}const te=await ie.getFilterOptions({start:i,end:u,filterTagKey:W||void 0,managementAccountId:e});if(!ae())return;if(p(U=>W?{...U,tagValues:te.tagValues}:te),!W&&te.tagKeys.length&&!te.tagKeys.includes(h)){const U=te.tagKeys[0];m(U),n==="tag"&&$(y,s,n,U)}}catch(te){ae()&&J(te?.response?.data?.error||te.message||"Failed to load filter values")}finally{ae()&&A(!1)}},$=async(W=y,we=s,ae=n,te=h)=>{const U=++L.current,ue=d;P(!0),O(null);try{const ce=await ie.getDataStatus({managementAccountId:e});if(U===L.current&&Q(ce),!ce.ready)return;if(we==="compare"){const de=Ao(u,d),[ke,Bt]=await Promise.all([ie.getReports(H(W,de.currentStart,de.currentEnd,ae,te)),ie.getReports(H(W,de.previousStart,de.previousEnd,ae,te))]);U===L.current&&(j(ke),C({current:ke,previous:Bt,...de}),ve(ue))}else{const de=await ie.getReports(H(W,i,u,ae,te));U===L.current&&(j(de),C(null),ve(ue))}}catch(ce){U===L.current&&O(ce?.response?.data?.error||ce.message||"Failed to generate cost report")}finally{U===L.current&&P(!1)}};return _.useEffect(()=>{t||(j(null),C(null),Q(null),p({services:[],regions:[],accounts:[],tagKeys:[],tagValues:[]}),$(y,s,n),V())},[e,t]),{groupBy:n,mode:s,start:i,end:u,granularity:d,loadedGranularity:ge,reportTagKey:h,options:g,draftFilters:b,report:N,comparison:E,loading:R||t,filtersLoading:I,error:D,optionsError:B,dataStatus:Z,comparedRows:z,selectedComparisonPeriods:G,setStart:c,setEnd:f,setGranularity:l,setReportTagKey:m,setDraftFilters:x,changeGroup:W=>{W!==n&&(P(!0),j(null),C(null),r(W),$(y,s,W))},changeMode:W=>{W!==s&&(P(!0),j(null),C(null),o(W),$(y,W,n))},applyFilters:()=>{const W={...b,services:[...b.services],regions:[...b.regions],accountIds:[...b.accountIds],tagValues:[...b.tagValues]};v(W),$(W)},resetFilters:()=>{x(Yt),v(Yt),$(Yt)},runReport:()=>{V(),$()},loadOptions:V}}function pm(e){const{report:t,comparison:n,rows:r,groupBy:s,mode:o,start:i,end:c}=e,u=ht[s];let f,d;o==="compare"&&n?(f=[[u.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
- `),d=`comparison-report-${s}-${Date.now()}.csv`):(f=[[u.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
- `),d=`${s}-summary-report-${Date.now()}.csv`);const l=document.createElement("a");l.href=URL.createObjectURL(new Blob([f],{type:"text/csv"})),l.download=d,l.click(),URL.revokeObjectURL(l.href)}async function gm(e){const{report:t,comparison:n,rows:r,groupBy:s,mode:o,start:i,end:c,granularity:u}=e,f=ht[s],[{jsPDF:d},{default:l}]=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 d({orientation:"landscape",unit:"pt",format:"a4"}),m=(p,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 ${p.pageNumber}`,h.internal.pageSize.width-70,h.internal.pageSize.height-18)};if(o==="compare"&&n){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: ${n.previous.totalCost}`,40,82),h.text(`Current Cost: ${n.current.totalCost}`,220,82),h.text(`Granularity: ${u}`,400,82),l(h,{startY:100,head:[[`${f.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",Lt(n.currentStart,n.currentEnd,u),Lt(n.previousStart,n.previousEnd,u),`${p.change.toFixed(4)}%`,nt(p.current?.accounts),nt(p.previous?.accounts),nt(p.current?.regions),nt(p.previous?.regions)]),styles:{fontSize:6,cellPadding:3,overflow:"linebreak"},headStyles:{fillColor:[242,237,255],textColor:[82,35,190]},didDrawPage:p=>m(p,n.previousStart,n.currentEnd),margin:{bottom:32}}),h.save(`comparison-report-${s}-${Date.now()}.pdf`);return}h.setFontSize(18),h.setTextColor(25),h.text(f.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: ${Y(t.totalCost,t.currency)}`,40,112),h.setTextColor(98,86,230),h.text("COST SUMMARY BREAKDOWN",40,136);const g=s==="account";l(h,{startY:146,head:[g?["Account ID","Account Name","Total Cost","Percentage","Regions"]:[`${f.item} Name`,"Total Cost","Percentage","Accounts","Regions"]],body:t.summary.map(p=>g?[p.accountId||p.key||"—",p.label,Y(p.amount,t.currency),`${(p.percentage||0).toFixed(2)}%`,nt(p.regions)]:[p.label,Y(p.amount,t.currency),`${(p.percentage||0).toFixed(2)}%`,nt(p.accounts),nt(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(`${s}-summary-report-${Date.now()}.pdf`)}function xm(){const e=mm(),{groupBy:t,mode:n,report:r,comparison:s,comparedRows:o,loading:i,error:c,dataStatus:u,loadedGranularity:f,start:d,end:l}=e,h=ht[t],m=r?.summary[0],g=s?s.current.totalCost-s.previous.totalCost:0,p=s?.previous.totalCost?g/Math.abs(s.previous.totalCost)*100:0,b=r?{report:r,comparison:s,rows:o,groupBy:t,mode:n,start:d,end:l,granularity:f}:null,x=a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>b&&void gm(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(Lf,{className:"h-4 w-4"}),"PDF"]}),a.jsxs("button",{onClick:()=>b&&pm(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(fs,{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(di,{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(ir,{})]}),!i&&(u&&!u.ready||c&&!u)?a.jsx(Qn,{status:u,error:c}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex gap-1 overflow-x-auto border-b",children:Object.keys(ht).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:ht[y].tab},y))}),a.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)] gap-5 xl:grid-cols-[minmax(0,1fr)_320px]",children:[a.jsxs("div",{className:`min-w-0 space-y-5 transition-opacity ${i&&(r||s)?"pointer-events-none opacity-60":""}`,"aria-busy":i,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(Fe,{className:"h-4 w-4"}),c]}),e.optionsError&&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(Fe,{className:"h-4 w-4"}),e.optionsError]}),i&&!r&&!s?a.jsx(im,{}):n==="compare"&&s?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: ",Po(s.current.updatedAt)]})]}),x]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[a.jsx(Me,{label:"Period accrued total",value:`${Y(s.current.totalCost,s.current.currency)} vs ${Y(s.previous.totalCost,s.previous.currency)}`,helper:`${p>=0?"+":""}${p.toFixed(1)}% from previous period`,trend:p}),a.jsx(Me,{label:Lt(s.currentStart,s.currentEnd,f),value:Y(s.current.totalCost,s.current.currency),helper:"Current period spending"}),a.jsx(Me,{label:Lt(s.previousStart,s.previousEnd,f),value:Y(s.previous.totalCost,s.previous.currency),helper:"Previous period spending"}),a.jsx(Me,{label:f==="monthly"?"Monthly change":"Period change",value:`${g>=0?"+":""}${Y(g,s.current.currency)}`,helper:`${p>=0?"+":""}${p.toFixed(1)}% from previous period`,trend:g})]})]}),a.jsx(am,{rows:o,currency:s.current.currency}),a.jsx(fm,{rows:o,groupBy:t,comparison:s,granularity:f})]}):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(Fe,{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: ",Po(r.updatedAt)]})]}),x]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[a.jsx(Me,{label:"Accrued cost",value:Y(r.totalCost,r.currency)}),a.jsx(Me,{label:h.top,value:m?Y(m.amount,r.currency):"-",accent:!0}),a.jsx(Me,{label:h.count,value:String(r.count||0),accent:!0})]})]}),a.jsxs(he,{children:[a.jsx(Ce,{children:a.jsx(Ae,{className:"text-sm",children:"Cost Trend"})}),a.jsx(me,{children:a.jsx(om,{timeline:r.timeline||[],currency:r.currency||"USD",daily:f==="daily"})})]}),a.jsx(dm,{groupBy:t,report:r})]}):null]}),a.jsx(hm,{mode:n,groupBy:t,start:d,end:l,granularity:e.granularity,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 To={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"},bm={INFO:"text-muted-foreground",WARN:"text-amber-600",ERROR:"text-destructive"},Cn=e=>e?new Date(e).toLocaleString():"—";function ym({status:e}){return a.jsx("span",{className:`rounded-full border px-2 py-0.5 text-xs font-medium ${To[e]||To.PENDING}`,children:e.replace(/_/g," ")})}function Jt({label:e,value:t,mono:n}){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 ${n?"font-mono text-xs":""}`,children:t||"—"})]})}function vm(){const{managementAccountId:e,loading:t}=Ut(),[n,r]=_.useState([]),[s,o]=_.useState([]),[i,c]=_.useState(!0),[u,f]=_.useState(null),d=_.useCallback(async()=>{c(!0),f(null);try{const l=await ne.get("/cur-discovery",{params:{logLimit:100,managementAccountId:e}});r(l.data?.jobs||[]),o(l.data?.logs||[])}catch(l){f(l?.response?.data?.error||l?.message||"Unable to load CUR discovery status")}finally{c(!1)}},[e]);return _.useEffect(()=>{t||d()},[d,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(hs,{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(ir,{}),a.jsx("button",{onClick:()=>{d()},disabled:i||t,className:"rounded-lg border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh",children:a.jsx(Tt,{className:`h-4 w-4 ${i||t?"animate-spin":""}`})})]})]}),u&&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(Fe,{className:"h-4 w-4"}),u]}),!i&&!u&&!n.length&&a.jsx(he,{children:a.jsx(me,{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."})}),n.map(l=>a.jsxs(he,{children:[a.jsxs(Ce,{className:"flex flex-row flex-wrap items-center gap-3",children:[a.jsx(ci,{className:"h-4 w-4 text-primary"}),a.jsxs(Ae,{className:"text-sm",children:["Management account ",l.managementAccountId]}),a.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["connection ",l.connectionId]}),a.jsx(ym,{status:l.status}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["attempt ",l.attemptCount]}),a.jsxs("span",{className:"ms-auto text-xs text-muted-foreground",children:["next check ",Cn(l.nextRunAt)]})]}),a.jsxs(me,{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[a.jsx(Jt,{label:"Region",value:l.region}),a.jsx(Jt,{label:"Glue database",value:l.database,mono:!0}),a.jsx(Jt,{label:"Discovered table",value:l.table,mono:!0}),a.jsx(Jt,{label:"Last data",value:Cn(l.lastDataAt)}),a.jsx(Jt,{label:"Last checked",value:Cn(l.lastFinishedAt||l.lastStartedAt)}),l.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:l.lastError})]})]},l.id)),n.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:n.map(l=>{const h=s.filter(m=>m.jobId===l.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:l.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:Cn(m.createdAt)}),a.jsx("td",{className:`py-2 pe-4 text-xs font-medium ${bm[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."})})]},l.id)})})]})]})}const wm=e=>e.launchUrl||`https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create?stackName=${encodeURIComponent(e.stackName||`MeyiConnect-${e.connectionId}-Management`)}`,Sm=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",Xt=e=>{const t=e?.response?.data?.error||e?.response?.data?.message||e?.message||"Request failed",n=e?.response?.data?.details;return n?`${t} ${n}`:t};function Rm(){const{selectManagementAccount:e,refreshSources:t}=Ut(),[n,r]=_.useState([]),[s,o]=_.useState(!1),[i,c]=_.useState(!0),[u,f]=_.useState(!1),[d,l]=_.useState(null),[h,m]=_.useState(null),[g,p]=_.useState(""),[b,x]=_.useState(!1),[y,v]=_.useState(null),[N,j]=_.useState(null),[E,C]=_.useState(null),R=_.useCallback(async()=>{c(!0),C(null);try{const O=await ie.getSources();r(O.sources||[]),o(O.allowMultipleSources===!0)}catch(O){C(Xt(O))}finally{c(!1)}},[]);_.useEffect(()=>{R()},[R]);const P=async O=>{if(O.preventDefault(),!/^\d{12}$/.test(g)){C("AWS account ID must contain exactly 12 digits");return}j("create"),C(null);try{const B=await ie.createSource({managementAccountId:g,regionMode:b?"ALL":"SINGLE"});B.managementAccountId&&e(B.managementAccountId),await t(),v(B.connectionId),f(!1),p(""),x(!1),await R()}catch(B){C(Xt(B))}finally{j(null)}},I=async O=>{j(`download-${O}`),C(null);try{const B=await ie.downloadSourceTemplate(O),J=URL.createObjectURL(B),Z=document.createElement("a");Z.href=J,Z.download=`meyi-connect-cost-${O}.yaml`,Z.click(),URL.revokeObjectURL(J),v(O)}catch(B){C(Xt(B))}finally{j(null)}},A=async O=>{j(`verify-${O}`),C(null);try{const B=await ie.verifySource(O);B.status==="FAILED"&&C(B.message||"AWS connection verification failed"),await R()}catch(B){C(Xt(B))}finally{j(null)}},D=async()=>{if(d){j(`remove-${d.connectionId}`),C(null);try{const O=await ie.removeSource(d.connectionId);l(null),m(O.awsCleanup??null),await R(),await t()}catch(O){C(Xt(O))}finally{j(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(Xn,{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:()=>{R()},disabled:i,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh sources",title:"Refresh sources",children:a.jsx(Tt,{className:`h-4 w-4 ${i?"animate-spin":""}`})}),(s||n.length===0)&&a.jsxs("button",{type:"button",onClick:()=>{C(null),f(!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(zf,{className:"h-4 w-4"}),"Add AWS account"]})]})]}),E&&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(Fe,{className:"mt-0.5 h-4 w-4 shrink-0"}),E]}),!i&&n.length===0&&a.jsxs("div",{className:"rounded-md border border-dashed py-14 text-center",children:[a.jsx(Xn,{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."})]}),n.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:n.map(O=>a.jsxs("tr",{className:`border-b last:border-0 ${y===O.connectionId?"bg-muted/30":""}`,children:[a.jsx("td",{className:"px-4 py-3 font-mono",children:O.managementAccountId||"Pending"}),a.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:O.connectionId}),a.jsxs("td",{className:"px-4 py-3",children:[O.accountScope," / ",O.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 ${Sm(O.status)}`,children:O.status.replace(/_/g," ")}),O.stackSetStatus&&a.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:O.stackSetStatus.replace(/_/g," ")}),O.status==="FAILED"&&O.failureReason&&a.jsx("div",{className:"mt-1 max-w-md text-xs text-destructive",children:O.failureReason})]}),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:()=>{I(O.connectionId)},disabled:!!N,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50",title:"Download CloudFormation template","aria-label":"Download CloudFormation template",children:N===`download-${O.connectionId}`?a.jsx(it,{className:"h-4 w-4 animate-spin"}):a.jsx(fs,{className:"h-4 w-4"})}),a.jsx("a",{href:wm(O),target:"_blank",rel:"noreferrer",className:"rounded-md border p-2 hover:bg-muted",title:`Open AWS CloudFormation as ${O.stackName||`MeyiConnect-${O.connectionId}-Management`}`,"aria-label":"Open AWS CloudFormation",children:a.jsx(ui,{className:"h-4 w-4"})}),a.jsxs("button",{type:"button",onClick:()=>{A(O.connectionId)},disabled:!!N||O.status==="CONNECTED",className:"flex items-center gap-2 rounded-md border px-3 py-2 font-medium hover:bg-muted disabled:opacity-50",children:[N===`verify-${O.connectionId}`?a.jsx(it,{className:"h-4 w-4 animate-spin"}):O.status==="CONNECTED"?a.jsx(Cf,{className:"h-4 w-4 text-emerald-600"}):a.jsx(Tt,{className:"h-4 w-4"}),O.status==="CONNECTED"?"Connected":"Verify"]}),a.jsx("button",{type:"button",onClick:()=>l(O),disabled:!!N,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(mi,{className:"h-4 w-4"})})]})})]},O.connectionId))})]})}),u&&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:O=>{P(O)},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:()=>f(!1),className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(ft,{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:g,onChange:O=>p(O.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:b,onChange:O=>x(O.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:()=>f(!1),className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsxs("button",{type:"submit",disabled:N==="create"||g.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:[N==="create"&&a.jsx(it,{className:"h-4 w-4 animate-spin"}),"Create source"]})]})]})}),d&&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:()=>l(null),disabled:!!N,className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(ft,{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:d.managementAccountId})," from this tenant?"]}),a.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Meyi Connect has no permission to change your AWS account, so the CloudFormation stacks stay until you delete them. You will see their names after removal. CUR data already delivered to Meyi Connect is retained."}),a.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:()=>l(null),disabled:!!N,className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsxs("button",{type:"button",onClick:()=>{D()},disabled:!!N,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:[N===`remove-${d.connectionId}`&&a.jsx(it,{className:"h-4 w-4 animate-spin"}),"Remove"]})]})]})}),h&&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":"cleanup-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:"cleanup-title",className:"text-lg font-semibold",children:"Delete the AWS resources"}),a.jsx("button",{type:"button",onClick:()=>m(null),className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(ft,{className:"h-4 w-4"})})]}),a.jsxs("p",{className:"mt-4 text-sm",children:["The source is removed. In your AWS management account, CloudFormation console, region ",a.jsx("span",{className:"font-mono",children:h.region}),":"]}),a.jsxs("ol",{className:"mt-3 list-decimal space-y-2 pl-5 text-sm",children:[h.membersStackName?a.jsxs("li",{children:["Stacks: delete ",a.jsx("span",{className:"font-mono",children:h.membersStackName}),". This removes the member StackSet and its stack instances."]}):h.stackSetName&&a.jsxs("li",{children:["StackSets: open ",a.jsx("span",{className:"font-mono",children:h.stackSetName}),", delete its stack instances, then delete the StackSet."]}),a.jsxs("li",{children:["Stacks: delete ",a.jsx("span",{className:"font-mono",children:h.managementStackName}),"."]})]}),a.jsx("div",{className:"mt-5 flex justify-end",children:a.jsx("button",{type:"button",onClick:()=>m(null),className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Done"})})]})})]})}const Nm=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Cm=[10,20,50],jm=["UTC","Asia/Kolkata","America/New_York","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];function Em({open:e,schedule:t,saving:n,onClose:r,onSave:s}){const[o,i]=_.useState(t);if(_.useEffect(()=>i(t),[t,e]),!e)return null;const c=u=>i(f=>({...f,frequency:u}));return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4",role:"presentation",onMouseDown:u=>{u.target===u.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(ii,{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(ft,{className:"h-4 w-4"})})]}),a.jsxs("form",{className:"space-y-5 p-5",onSubmit:u=>{u.preventDefault(),s({enabled:o.enabled,frequency:o.frequency,time:o.time,timezone:o.timezone,dayOfWeek:o.dayOfWeek,dayOfMonth:o.dayOfMonth,ticketLimit:o.ticketLimit??10}).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:u=>i(f=>({...f,enabled:u.target.checked})),className:"h-4 w-4 accent-primary"})]}),a.jsxs("fieldset",{disabled:!o.enabled||n,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(u=>a.jsx("button",{type:"button",onClick:()=>c(u),className:`rounded-md px-3 py-2 text-sm capitalize ${o.frequency===u?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:u},u))})]}),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:u=>i(f=>({...f,time:u.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:u=>i(f=>({...f,timezone:u.target.value})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:[...new Set([o.timezone,...jm])].map(u=>a.jsx("option",{children:u},u))})]})]}),o.frequency==="weekly"&&a.jsxs("label",{className:"block text-sm font-medium",children:["Day of week",a.jsx("select",{value:o.dayOfWeek??1,onChange:u=>i(f=>({...f,dayOfWeek:Number(u.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:Nm.map((u,f)=>a.jsx("option",{value:f,children:u},u))})]}),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:u=>i(f=>({...f,dayOfMonth:Number(u.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal"})]}),a.jsxs("div",{role:"radiogroup","aria-labelledby":"cost-ai-ticket-limit-label",children:[a.jsx("span",{id:"cost-ai-ticket-limit-label",className:"mb-2 block text-sm font-medium",children:"Tasks per report"}),a.jsx("div",{className:"grid grid-cols-3 rounded-lg border p-1",children:Cm.map(u=>a.jsxs("button",{type:"button",role:"radio","aria-checked":(o.ticketLimit??10)===u,onClick:()=>i(f=>({...f,ticketLimit:u})),className:`rounded-md px-3 py-2 text-sm ${(o.ticketLimit??10)===u?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:["Top ",u]},u))}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Each report creates at most this many tasks, highest priority and savings first."})]}),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:n,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:n?"Saving":"Save schedule"})]})]})]})})}function Xe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s||!s.defaultPrevented)return t?.(s)}}function Lo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function km(...e){return t=>{let n=!1;const r=e.map(s=>{const o=Lo(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():Lo(e[s],null)}}}}function bt(...e){return S.useCallback(km(...e),e)}function _m(e,t=[]){let n=[];function r(o,i){const c=S.createContext(i);c.displayName=o+"Context";const u=n.length;n=[...n,i];const f=l=>{const{scope:h,children:m,...g}=l,p=h?.[e]?.[u]||c,b=S.useMemo(()=>g,Object.values(g));return a.jsx(p.Provider,{value:b,children:m})};f.displayName=o+"Provider";function d(l,h,m={}){const{optional:g=!1}=m,p=h?.[e]?.[u]||c,b=S.useContext(p);if(b)return b;if(i!==void 0)return i;if(!g)throw new Error(`\`${l}\` must be used within \`${o}\``)}return[f,d]}const s=()=>{const o=n.map(i=>S.createContext(i));return function(c){const u=c?.[e]||o;return S.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return s.scopeName=e,[r,Pm(s,...t)]}function Pm(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((c,{useScope:u,scopeName:f})=>{const l=u(o)[`__scope${f}`];return{...c,...l}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var on=globalThis?.document?S.useLayoutEffect:()=>{},Am=S[" useId ".trim().toString()]||(()=>{}),Om=0;function Pr(e){const[t,n]=S.useState(Am());return on(()=>{n(r=>r??String(Om++))},[e]),e||(t?`radix-${t}`:"")}var Tm=S[" useInsertionEffect ".trim().toString()]||on;function Lm({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=Im({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:s;{const d=S.useRef(e!==void 0);S.useEffect(()=>{const l=d.current;l!==c&&console.warn(`${r} is changing from ${l?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=c},[c,r])}const f=S.useCallback(d=>{if(c){const l=Mm(d)?d(e):d;l!==e&&i.current?.(l)}else o(d)},[c,e,o,i]);return[u,f]}function Im({defaultProp:e,onChange:t}){const[n,r]=S.useState(e),s=S.useRef(n),o=S.useRef(t);return Tm(()=>{o.current=t},[t]),S.useEffect(()=>{s.current!==n&&(o.current?.(n),s.current=n)},[n,s]),[n,r,o]}function Mm(e){return typeof e=="function"}function Mi(e){const t=S.forwardRef((n,r)=>{let{children:s,...o}=n,i=null,c=!1;const u=[];Io(s)&&typeof jn=="function"&&(s=jn(s._payload)),S.Children.forEach(s,h=>{if(Bm(h)){c=!0;const m=h;let g="child"in m.props?m.props.child:m.props.children;Io(g)&&typeof jn=="function"&&(g=jn(g._payload)),i=Fm(m,g),u.push(i?.props?.children)}else u.push(h)}),i?i=S.cloneElement(i,void 0,u):!c&&S.Children.count(s)===1&&S.isValidElement(s)&&(i=s);const f=i?$m(i):void 0,d=bt(r,f);if(!i){if(s||s===0)throw new Error(c?Hm(e):Vm(e));return s}const l=Um(o,i.props??{});return i.type!==S.Fragment&&(l.ref=r?d:f),S.cloneElement(i,l)});return t.displayName=`${e}.Slot`,t}var Dm=Symbol.for("radix.slottable"),Fm=(e,t)=>{if("child"in e.props){const n=e.props.child;return S.isValidElement(n)?S.cloneElement(n,void 0,e.props.children(n.props.children)):null}return S.isValidElement(t)?t:null};function Um(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const u=o(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function $m(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Bm(e){return S.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Dm}var zm=Symbol.for("react.lazy");function Io(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===zm&&"_payload"in e&&Wm(e._payload)}function Wm(e){return typeof e=="object"&&e!==null&&"then"in e}var Vm=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Hm=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,jn=S[" use ".trim().toString()],qm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=qm.reduce((e,t)=>{const n=Mi(`Primitive.${t}`),r=S.forwardRef((s,o)=>{const{asChild:i,...c}=s,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(u,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Gm(e,t){e&&ea.flushSync(()=>e.dispatchEvent(t))}function an(e){const t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>((...n)=>t.current?.(...n)),[])}var Km="DismissableLayer",Xr="dismissableLayer.update",Ym="dismissableLayer.pointerDownOutside",Jm="dismissableLayer.focusOutside",Mo,gs=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Di=S.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:c,onDismiss:u,...f}=e,d=S.useContext(gs),[l,h]=S.useState(null),m=l?.ownerDocument??globalThis?.document,[,g]=S.useState({}),p=bt(t,h),b=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=x?b.indexOf(x):-1,v=l?b.indexOf(l):-1,N=d.layersWithOutsidePointerEventsDisabled.size>0,j=v>=y,E=S.useRef(!1),C=tp(A=>{o?.(A),c?.(A),A.defaultPrevented||u?.()},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:E,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:S.useCallback(A=>{if(!(A instanceof Node))return!1;const D=[...d.branches].some(O=>O.contains(A));return j&&!D},[d.branches,j])}),R=np(A=>{if(r&&E.current)return;const D=A.target;[...d.branches].some(B=>B.contains(D))||(i?.(A),c?.(A),A.defaultPrevented||u?.())},m),P=l?v===b.length-1:!1,I=an(A=>{A.key==="Escape"&&(s?.(A),!A.defaultPrevented&&u&&(A.preventDefault(),u()))});return S.useEffect(()=>{if(P)return m.addEventListener("keydown",I,{capture:!0}),()=>m.removeEventListener("keydown",I,{capture:!0})},[m,P,I]),S.useEffect(()=>{if(l)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Mo=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(l)),d.layers.add(l),Do(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(l),d.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Mo))}},[l,m,n,d]),S.useEffect(()=>()=>{l&&(d.layers.delete(l),d.layersWithOutsidePointerEventsDisabled.delete(l),Do())},[l,d]),S.useEffect(()=>{const A=()=>g({});return document.addEventListener(Xr,A),()=>document.removeEventListener(Xr,A)},[]),a.jsx(ze.div,{...f,ref:p,style:{pointerEvents:N?j?"auto":"none":void 0,...e.style},onFocusCapture:Xe(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Xe(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Xe(e.onPointerDownCapture,C.onPointerDownCapture)})});Di.displayName=Km;var Xm="DismissableLayerBranch",Zm=S.forwardRef((e,t)=>{const n=S.useContext(gs),r=S.useRef(null),s=bt(t,r);return S.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(ze.div,{...e,ref:s})});Zm.displayName=Xm;function Qm(){const e=S.useContext(gs),[t,n]=S.useState(null);return S.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var ep=()=>!0;function tp(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:o,shouldHandlePointerDownOutside:i=ep}=t,c=an(e),u=S.useRef(!1),f=S.useRef(!1),d=S.useRef(new Map),l=S.useRef(()=>{});return S.useEffect(()=>{function h(){f.current=!1,s.current=!1,d.current.clear()}function m(){return Array.from(d.current.values()).some(Boolean)}function g(v){if(!f.current)return;const N=v.target;N instanceof Node&&[...o].some(E=>E.contains(N))||d.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{f.current&&l.current()},0)}function p(v){f.current&&d.current.set(v.type,!1)}const b=v=>{if(v.target&&!u.current){let N=function(){n.removeEventListener("click",l.current);const E=m();h(),E||Fi(Ym,c,j,{discrete:!0})};if(!i(v.target)){n.removeEventListener("click",l.current),h(),u.current=!1;return}const j={originalEvent:v};f.current=!0,s.current=r&&v.button===0,d.current.clear(),!r||v.button!==0?N():(n.removeEventListener("click",l.current),l.current=N,n.addEventListener("click",l.current,{once:!0}))}else n.removeEventListener("click",l.current),h();u.current=!1},x=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of x)n.addEventListener(v,g,!0),n.addEventListener(v,p);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",b)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",b),n.removeEventListener("click",l.current);for(const v of x)n.removeEventListener(v,g,!0),n.removeEventListener(v,p)}},[n,c,r,s,o,i]),{onPointerDownCapture:()=>u.current=!0}}function np(e,t=globalThis?.document){const n=an(e),r=S.useRef(!1);return S.useEffect(()=>{const s=o=>{o.target&&!r.current&&Fi(Jm,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Do(){const e=new CustomEvent(Xr);document.dispatchEvent(e)}function Fi(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Gm(s,o):s.dispatchEvent(o)}var Ar="focusScope.autoFocusOnMount",Or="focusScope.autoFocusOnUnmount",Fo={bubbles:!1,cancelable:!0},rp="FocusScope",Ui=S.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[c,u]=S.useState(null),f=an(s),d=an(o),l=S.useRef(null),h=bt(t,u),m=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(r){let p=function(v){if(m.paused||!c)return;const N=v.target;c.contains(N)?l.current=N:He(l.current,{select:!0})},b=function(v){if(m.paused||!c)return;const N=v.relatedTarget;N!==null&&(c.contains(N)||He(l.current,{select:!0}))},x=function(v){if(document.activeElement===document.body)for(const j of v)j.removedNodes.length>0&&He(c)};document.addEventListener("focusin",p),document.addEventListener("focusout",b);const y=new MutationObserver(x);return c&&y.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",b),y.disconnect()}}},[r,c,m.paused]),S.useEffect(()=>{if(c){$o.add(m);const p=document.activeElement;if(!c.contains(p)){const x=new CustomEvent(Ar,Fo);c.addEventListener(Ar,f),c.dispatchEvent(x),x.defaultPrevented||(sp(lp($i(c)),{select:!0}),document.activeElement===p&&He(c))}return()=>{c.removeEventListener(Ar,f),setTimeout(()=>{const x=new CustomEvent(Or,Fo);c.addEventListener(Or,d),c.dispatchEvent(x),x.defaultPrevented||He(p??document.body,{select:!0}),c.removeEventListener(Or,d),$o.remove(m)},0)}}},[c,f,d,m]);const g=S.useCallback(p=>{if(!n&&!r||m.paused)return;const b=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,x=document.activeElement;if(b&&x){const y=p.currentTarget,[v,N]=op(y);v&&N?!p.shiftKey&&x===N?(p.preventDefault(),n&&He(v,{select:!0})):p.shiftKey&&x===v&&(p.preventDefault(),n&&He(N,{select:!0})):x===y&&p.preventDefault()}},[n,r,m.paused]);return a.jsx(ze.div,{tabIndex:-1,...i,ref:h,onKeyDown:g})});Ui.displayName=rp;function sp(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(He(r,{select:t}),document.activeElement!==n)return}function op(e){const t=$i(e),n=Uo(t,e),r=Uo(t.reverse(),e);return[n,r]}function $i(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Uo(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ap(r,{upTo:t})))return r}function ap(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ip(e){return e instanceof HTMLInputElement&&"select"in e}function He(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ip(e)&&t&&e.select()}}var $o=cp();function cp(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Bo(e,t),e.unshift(t)},remove(t){e=Bo(e,t),e[0]?.resume()}}}function Bo(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function lp(e){return e.filter(t=>t.tagName!=="A")}var up="Portal",Bi=S.forwardRef((e,t)=>{const{container:n,...r}=e,[s,o]=S.useState(!1);on(()=>o(!0),[]);const i=n||s&&globalThis?.document?.body;return i?ea.createPortal(a.jsx(ze.div,{...r,ref:t}),i):null});Bi.displayName=up;function dp(e,t){return S.useReducer((n,r)=>t[n][r]??n,e)}var cr=e=>{const{present:t,children:n}=e,r=fp(t),s=typeof n=="function"?n({present:r.isPresent}):S.Children.only(n),o=hp(r.ref,mp(s));return typeof n=="function"||r.isPresent?S.cloneElement(s,{ref:o}):null};cr.displayName="Presence";function fp(e){const[t,n]=S.useState(),r=S.useRef(null),s=S.useRef(e),o=S.useRef("none"),i=S.useRef(void 0),c=e?"mounted":"unmounted",[u,f]=dp(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{u==="mounted"?(o.current=i.current??Zt(r.current),i.current=void 0):o.current="none"},[u]),on(()=>{const d=r.current,l=s.current;if(l!==e){const m=o.current,g=Zt(d);e?(i.current=g,f("MOUNT")):g==="none"||d?.display==="none"?f("UNMOUNT"):f(l&&m!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,f]),on(()=>{if(t){let d;const l=t.ownerDocument.defaultView??window,h=g=>{const b=Zt(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&b&&(f("ANIMATION_END"),!s.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",d=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},m=g=>{g.target===t&&(o.current=Zt(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{l.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:S.useCallback(d=>{if(d){const l=getComputedStyle(d);r.current=l,i.current=Zt(l)}else r.current=null;n(d)},[])}}function zo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function hp(...e){const t=S.useRef(e);return t.current=e,S.useCallback(n=>{const r=t.current;let s=!1;const o=r.map(i=>{const c=zo(i,n);return!s&&typeof c=="function"&&(s=!0),c});if(s)return()=>{for(let i=0;i<o.length;i++){const c=o[i];typeof c=="function"?c():zo(r[i],null)}}},[])}function Zt(e){return e?.animationName||"none"}function mp(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var En=0,wt=null;function pp(){S.useEffect(()=>{wt||(wt={start:Wo(),end:Wo()});const{start:e,end:t}=wt;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),En++,()=>{En===1&&(wt?.start.remove(),wt?.end.remove(),wt=null),En=Math.max(0,En-1)}},[])}function Wo(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var De=function(){return De=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},De.apply(this,arguments)};function zi(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function gp(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Un="right-scroll-bar-position",$n="width-before-scroll-bar",xp="with-scroll-bars-hidden",bp="--removed-body-scroll-bar-size";function Tr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function yp(e,t){var n=_.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var vp=typeof window<"u"?S.useLayoutEffect:S.useEffect,Vo=new WeakMap;function wp(e,t){var n=yp(null,function(r){return e.forEach(function(s){return Tr(s,r)})});return vp(function(){var r=Vo.get(n);if(r){var s=new Set(r),o=new Set(e),i=n.current;s.forEach(function(c){o.has(c)||Tr(c,null)}),o.forEach(function(c){s.has(c)||Tr(c,i)})}Vo.set(n,e)},[e]),n}function Sp(e){return e}function Rp(e,t){t===void 0&&(t=Sp);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(c){return o(c)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(o),i=n}var u=function(){var d=i;i=[],d.forEach(o)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(d){i.push(d),f()},filter:function(d){return i=i.filter(d),n}}}};return s}function Np(e){e===void 0&&(e={});var t=Rp(null);return t.options=De({async:!0,ssr:!1},e),t}var Wi=function(e){var t=e.sideCar,n=zi(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return S.createElement(r,De({},n))};Wi.isSideCarExport=!0;function Cp(e,t){return e.useMedium(t),Wi}var Vi=Np(),Lr=function(){},lr=S.forwardRef(function(e,t){var n=S.useRef(null),r=S.useState({onScrollCapture:Lr,onWheelCapture:Lr,onTouchMoveCapture:Lr}),s=r[0],o=r[1],i=e.forwardProps,c=e.children,u=e.className,f=e.removeScrollBar,d=e.enabled,l=e.shards,h=e.sideCar,m=e.noRelative,g=e.noIsolation,p=e.inert,b=e.allowPinchZoom,x=e.as,y=x===void 0?"div":x,v=e.gapMode,N=zi(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=h,E=wp([n,t]),C=De(De({},N),s);return S.createElement(S.Fragment,null,d&&S.createElement(j,{sideCar:Vi,removeScrollBar:f,shards:l,noRelative:m,noIsolation:g,inert:p,setCallbacks:o,allowPinchZoom:!!b,lockRef:n,gapMode:v}),i?S.cloneElement(S.Children.only(c),De(De({},C),{ref:E})):S.createElement(y,De({},C,{className:u,ref:E}),c))});lr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};lr.classNames={fullWidth:$n,zeroRight:Un};var jp=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ep(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=jp();return t&&e.setAttribute("nonce",t),e}function kp(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function _p(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Pp=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ep())&&(kp(t,n),_p(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ap=function(){var e=Pp();return function(t,n){S.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Hi=function(){var e=Ap(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Op={left:0,top:0,right:0,gap:0},Ir=function(e){return parseInt(e||"",10)||0},Tp=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Ir(n),Ir(r),Ir(s)]},Lp=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Op;var t=Tp(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Ip=Hi(),_t="data-scroll-locked",Mp=function(e,t,n,r){var s=e.left,o=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
22
- .`.concat(xp,` {
23
- overflow: hidden `).concat(r,`;
24
- padding-right: `).concat(c,"px ").concat(r,`;
6
+ <%s key={someKey} {...props} />`,Y,H,ne,H),D[H+Y]=!0)}if(H=null,G!==void 0&&(n(G),H=""+G),i(U)&&(n(U.key),H=""+U.key),"key"in U){G={};for(var Q in U)Q!=="key"&&(G[Q]=U[Q])}else G=U;return H&&c(G,typeof _=="function"?_.displayName||_.name||"Unknown":_),f(_,H,G,r(),K,z)}function d(_){m(_)?_._store&&(_._store.validated=1):typeof _=="object"&&_!==null&&_.$$typeof===A&&(_._payload.status==="fulfilled"?m(_._payload.value)&&_._payload.value._store&&(_._payload.value._store.validated=1):_._store&&(_._store.validated=1))}function m(_){return typeof _=="object"&&_!==null&&_.$$typeof===p}var h=P,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"),w=Symbol.for("react.consumer"),C=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),v=Symbol.for("react.client.reference"),O=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=Object.prototype.hasOwnProperty,L=Array.isArray,X=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(_){return _()}};var Z,W={},le=h.react_stack_bottom_frame.bind(h,a)(),we=X(s(a)),D={};qt.Fragment=b,qt.jsx=function(_,U,G){var Y=1e4>O.recentlyCreatedOwnerStacks++;return u(_,U,G,!1,Y?Error("react-stack-top-frame"):le,Y?X(s(_)):we)},qt.jsxs=function(_,U,G){var Y=1e4>O.recentlyCreatedOwnerStacks++;return u(_,U,G,!0,Y?Error("react-stack-top-frame"):le,Y?X(s(_)):we)}})()),qt}var Lr;function Ic(){return Lr||(Lr=1,process.env.NODE_ENV==="production"?bn.exports=Oc():bn.exports=Lc()),bn.exports}var o=Ic(),nn=typeof window<"u"?j.useLayoutEffect:j.useEffect;function bs(e){const t=j.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function Mc(e,t,n={},s={}){j.useEffect(()=>{if(!e.current||s.disabled||typeof IntersectionObserver!="function")return;const r=new IntersectionObserver(([a])=>{t(a)},n);return r.observe(e.current),()=>{r.disconnect()}},[t,n,s.disabled,e])}function Dc(e){const t=j.useRef(null);return j.useImperativeHandle(e,()=>t.current,[]),t}const va=!1;function sn(e){return e[e.length-1]}function Fc(e){return typeof e=="function"}function lt(e,t){return Fc(e)?e(t):e}const wa=Object.prototype.hasOwnProperty,Ir=Object.prototype.propertyIsEnumerable;function Sa(e){for(const t in e)if(wa.call(e,t))return!0;return!1}const $c=()=>Object.create(null),it=(e,t)=>dt(e,t,$c);function dt(e,t,n=()=>({}),s=0){if(e===t)return e;if(s>500)return t;const r=t,a=Fr(e)&&Fr(r);if(!a&&!(qn(e)&&qn(r)))return r;const i=a?e:Mr(e);if(!i)return r;const c=a?r:Mr(r);if(!c)return r;const l=i.length,f=c.length,u=a?new Array(f):n();let d=0;for(let m=0;m<f;m++){const h=a?m:c[m],p=e[h],g=r[h];if(p===g){u[h]=p,(a?m<l:wa.call(e,h))&&d++;continue}if(p===null||g===null||typeof p!="object"||typeof g!="object"){u[h]=g;continue}const b=dt(p,g,n,s+1);u[h]=b,b===p&&d++}return l===f&&d===l?e:u}function Mr(e){const t=Object.getOwnPropertyNames(e);for(const r of t)if(!Ir.call(e,r))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const s=t;for(const r of n){if(!Ir.call(e,r))return!1;s.push(r)}return s}function qn(e){if(!Dr(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!Dr(n)||!n.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 ht(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let s=0,r=e.length;s<r;s++)if(!ht(e[s],t[s],n))return!1;return!0}if(qn(e)&&qn(t)){const s=n?.ignoreUndefined??!0;if(n?.partial){for(const i in t)if((!s||t[i]!==void 0)&&!ht(e[i],t[i],n))return!1;return!0}let r=0;if(!s)r=Object.keys(e).length;else for(const i in e)e[i]!==void 0&&r++;let a=0;for(const i in t)if((!s||t[i]!==void 0)&&(a++,a>r||!ht(e[i],t[i],n)))return!1;return r===a}return!1}function It(e){let t,n;const s=new Promise((r,a)=>{t=r,n=a});return s.status="pending",s.resolve=r=>{s.status="resolved",s.value=r,t(r),e?.(r)},s.reject=r=>{s.status="rejected",n(r)},s}function rn(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function $r(e,t){for(let n=e.length-1;n>=0;n--){const s=e[n];if(t(s))return s}}const Uc=/[\x00-\x1f\x7f"<>`{}]/g;function Bc(e){return e.replace(Uc,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function Ur(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return Bc(t)}const zc=["http:","https:","mailto:","tel:"];function Gn(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Gt(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,s="",r;for(;(r=t.exec(e))!==null;)s+=Ur(e.slice(n,r.index))+r[0],n=t.lastIndex;s=s+Ur(n?e.slice(n):e);let a=!1;return s.startsWith("//")&&(a=!0,s="/"+s.replace(/^\/+/,"")),{path:s,handledProtocolRelativeURL:a}}function Wc(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Vc(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ke(){throw new Error("Invariant failed")}function on(e){const t=new Map;let n,s;const r=a=>{a.next&&(a.prev?(a.prev.next=a.next,a.next.prev=a.prev,a.next=void 0,s&&(s.next=a,a.prev=s)):(a.next.prev=void 0,n=a.next,a.next=void 0,s&&(a.prev=s,s.next=a)),s=a)};return{get(a){const i=t.get(a);if(i)return r(i),i.value},set(a,i){if(t.size>=e&&n){const l=n;t.delete(l.key),l.next&&(n=l.next,l.next.prev=void 0),l===s&&(s=void 0)}const c=t.get(a);if(c)c.value=i,r(c);else{const l={key:a,value:i,prev:s};s&&(s.next=l),s=l,n||(n=l),t.set(a,l)}},clear(){t.clear(),n=void 0,s=void 0}}}const et=4,Na=5;function Hc(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function ja(e,t,n=new Uint16Array(6)){const s=e.indexOf("/",t),r=s===-1?e.length:s,a=e.substring(t,r);if(!a||!a.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n;if(a==="$"){const c=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=c,n[4]=c,n[5]=c,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=r,n[4]=r,n[5]=r,n;const i=Hc(a);if(i){const[c,l]=i,f=a.charCodeAt(c+1);if(f===45){if(c+2<a.length&&a.charCodeAt(c+2)===36){const u=c+3,d=l;if(u<d)return n[0]=3,n[1]=t+c,n[2]=t+u,n[3]=t+d,n[4]=t+l+1,n[5]=r,n}}else if(f===36){const u=c+1,d=c+2;return d===l?(n[0]=2,n[1]=t+c,n[2]=t+u,n[3]=t+d,n[4]=t+l+1,n[5]=e.length,n):(n[0]=1,n[1]=t+c,n[2]=t+d,n[3]=t+l,n[4]=t+l+1,n[5]=r,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}function as(e,t,n,s,r,a,i){i?.(n);let c=s;{const l=n.fullPath??n.from,f=l.length,u=n.options?.caseSensitive??e,d=n.options?.params?.parse??n.options?.parseParams;for(;c<f;){const h=ja(l,c,t);let p;const g=c,b=h[5];switch(c=b+1,a++,h[0]){case 0:{const x=l.substring(h[2],h[3]);if(u){const y=r.static?.get(x);if(y)p=y;else{r.static??=new Map;const w=ut(n.fullPath??n.from);w.parent=r,w.depth=a,p=w,r.static.set(x,w)}}else{const y=x.toLowerCase(),w=r.staticInsensitive?.get(y);if(w)p=w;else{r.staticInsensitive??=new Map;const C=ut(n.fullPath??n.from);C.parent=r,C.depth=a,p=C,r.staticInsensitive.set(y,C)}}break}case 1:{const x=l.substring(g,h[1]),y=l.substring(h[4],b),w=u&&!!(x||y),C=x?w?x:x.toLowerCase():void 0,E=y?w?y:y.toLowerCase():void 0,k=!d&&r.dynamic?.find(R=>!R.parse&&R.caseSensitive===w&&R.prefix===C&&R.suffix===E);if(k)p=k;else{const R=vs(1,n.fullPath??n.from,w,C,E);p=R,R.depth=a,R.parent=r,r.dynamic??=[],r.dynamic.push(R)}break}case 3:{const x=l.substring(g,h[1]),y=l.substring(h[4],b),w=u&&!!(x||y),C=x?w?x:x.toLowerCase():void 0,E=y?w?y:y.toLowerCase():void 0,k=!d&&r.optional?.find(R=>!R.parse&&R.caseSensitive===w&&R.prefix===C&&R.suffix===E);if(k)p=k;else{const R=vs(3,n.fullPath??n.from,w,C,E);p=R,R.parent=r,R.depth=a,r.optional??=[],r.optional.push(R)}break}case 2:{const x=l.substring(g,h[1]),y=l.substring(h[4],b),w=u&&!!(x||y),C=x?w?x:x.toLowerCase():void 0,E=y?w?y:y.toLowerCase():void 0,k=vs(2,n.fullPath??n.from,w,C,E);p=k,k.parent=r,k.depth=a,r.wildcard??=[],r.wildcard.push(k)}}r=p}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const h=ut(n.fullPath??n.from);h.kind=Na,h.parent=r,a++,h.depth=a,r.pathless??=[],r.pathless.push(h),r=h}const m=(n.path||!n.children)&&!n.isRoot;if(m&&l.endsWith("/")){const h=ut(n.fullPath??n.from);h.kind=et,h.parent=r,a++,h.depth=a,r.index=h,r=h}r.parse=d??null,r.priority=n.options?.params?.priority??0,m&&!r.route&&(r.route=n,r.fullPath=n.fullPath??n.from)}if(n.children)for(const l of n.children)as(e,t,l,c,r,a,i)}function ys(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 Qe(e){if(e.pathless)for(const t of e.pathless)Qe(t);if(e.static)for(const t of e.static.values())Qe(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())Qe(t);if(e.dynamic?.length){e.dynamic.sort(ys);for(const t of e.dynamic)Qe(t)}if(e.optional?.length){e.optional.sort(ys);for(const t of e.optional)Qe(t)}if(e.wildcard?.length){e.wildcard.sort(ys);for(const t of e.wildcard)Qe(t)}}function ut(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 vs(e,t,n,s,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:n,prefix:s,suffix:r}}function qc(e,t){const n=ut("/"),s=new Uint16Array(6);for(const r of e)as(!1,s,r,1,n,0);Qe(n),t.masksTree=n,t.flatCache=on(1e3)}function Gc(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const s=fr(e,t.masksTree);return t.flatCache.set(e,s),s}function Kc(e,t,n,s,r){e||="/",s||="/";const a=t?`case\0${e}`:e;let i=r.singleCache.get(a);return i||(i=ut("/"),as(t,new Uint16Array(6),{from:e},1,i,0),r.singleCache.set(a,i)),fr(s,i,n)}function Yc(e,t,n=!1){const s=n?e:`nofuzz\0${e}`,r=t.matchCache.get(s);if(r!==void 0)return r;e||="/";let a;try{a=fr(e,t.segmentTree,n)}catch(i){if(i instanceof URIError)a=null;else throw i}return a&&(a.branch=Ra(a.route)),t.matchCache.set(s,a),a}function Jc(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Xc(e,t=!1,n){const s=ut(e.fullPath),r=new Uint16Array(6),a={},i={};let c=0;return as(t,r,e,1,s,0,l=>{if(n?.(l,c),l.id in a){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Duplicate routes found with id: ${String(l.id)}`);Ke()}if(a[l.id]=l,c!==0&&l.path){const f=Jc(l.fullPath);(!i[f]||l.fullPath.endsWith("/"))&&(i[f]=l)}c++}),Qe(s),{processedTree:{segmentTree:s,singleCache:on(1e3),matchCache:on(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:i}}function fr(e,t,n=!1){const s=e.split("/"),r=Qc(e,s,t,n);if(!r)return null;const[a]=Ca(e,s,r);return{route:r.node.route,rawParams:a}}function Ca(e,t,n){const s=Zc(n.node);let r=null;const a=Object.create(null);let i=n.extract?.part??0,c=n.extract?.node??0,l=n.extract?.path??0,f=n.extract?.segment??0;for(;c<s.length;i++,c++,l++,f++){const u=s[c];if(u.kind===et)break;if(u.kind===Na){f--,i--,l--;continue}const d=t[i],m=l;if(d&&(l+=d.length),u.kind===1){r??=n.node.fullPath.split("/");const h=r[f],p=u.prefix?.length??0;if(h.charCodeAt(p)===123){const g=u.suffix?.length??0,b=h.substring(p+2,h.length-g-1),x=d.substring(p,d.length-g);a[b]=decodeURIComponent(x)}else{const g=h.substring(1);a[g]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<c){i--,l=m-1;continue}r??=n.node.fullPath.split("/");const h=r[f],p=u.prefix?.length??0,g=u.suffix?.length??0,b=h.substring(p+3,h.length-g-1),x=u.suffix||u.prefix?d.substring(p,d.length-g):d;x&&(a[b]=decodeURIComponent(x))}else if(u.kind===2){const h=u,p=e.substring(m+(h.prefix?.length??0),e.length-(h.suffix?.length??0)),g=decodeURIComponent(p);a["*"]=g,a._splat=g;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:i,node:c,path:l,segment:f}]}function Ra(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Zc(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Qc(e,t,n,s){if(e==="/"&&n.index)return{node:n.index,skipped:0};const r=!sn(t),a=r&&e!=="/",i=t.length-(r?1:0),c=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let l=null,f=null;for(;c.length;){const u=c.pop(),{node:d,index:m,skipped:h,depth:p,statics:g,dynamics:b,optionals:x}=u;let{extract:y,rawParams:w}=u;if(d.kind===2&&d.route&&!vn(f,u))continue;if(d.parse){if(!Br(e,t,u))continue;w=u.rawParams,y=u.extract}s&&d.route&&d.kind!==et&&vn(l,u)&&(l=u);const C=m===i;if(C&&(d.route&&(!a||d.kind===et||d.kind===2)&&vn(f,u)&&(f=u),!d.optional&&!d.wildcard&&!d.index&&!d.pathless))continue;const E=C?void 0:t[m];let k;if(C&&d.index){const R={node:d.index,index:m,skipped:h,depth:p+1,statics:g,dynamics:b,optionals:x,extract:y,rawParams:w};let S=!0;if(d.index.parse&&(Br(e,t,R)||(S=!1)),S){if(!b&&!x&&!h&&el(g,i))return R;vn(f,R)&&(f=R)}}if(d.wildcard)for(let R=d.wildcard.length-1;R>=0;R--){const S=d.wildcard[R],{prefix:A,suffix:I}=S;if(!(A&&(C||!(S.caseSensitive?E:k??=E.toLowerCase()).startsWith(A)))){if(I){if(C)continue;const v=t.slice(m).join("/").slice(-I.length);if((S.caseSensitive?v:v.toLowerCase())!==I)continue}c.push({node:S,index:i,skipped:h,depth:p+1,statics:g,dynamics:b,optionals:x,extract:y,rawParams:w})}}if(d.optional){const R=h|1<<p,S=p+1;for(let A=d.optional.length-1;A>=0;A--){const I=d.optional[A];c.push({node:I,index:m,skipped:R,depth:S,statics:g,dynamics:b,optionals:x,extract:y,rawParams:w})}if(!C)for(let A=d.optional.length-1;A>=0;A--){const I=d.optional[A],{prefix:v,suffix:O}=I;if(v||O){const T=I.caseSensitive?E:k??=E.toLowerCase();if(v&&!T.startsWith(v)||O&&!T.endsWith(O))continue}c.push({node:I,index:m+1,skipped:h,depth:S,statics:g,dynamics:b,optionals:x+yn(i,m),extract:y,rawParams:w})}}if(!C&&d.dynamic&&E)for(let R=d.dynamic.length-1;R>=0;R--){const S=d.dynamic[R],{prefix:A,suffix:I}=S;if(A||I){const v=S.caseSensitive?E:k??=E.toLowerCase();if(A&&!v.startsWith(A)||I&&!v.endsWith(I))continue}c.push({node:S,index:m+1,skipped:h,depth:p+1,statics:g,dynamics:b+yn(i,m),optionals:x,extract:y,rawParams:w})}if(!C&&d.staticInsensitive){const R=d.staticInsensitive.get(k??=E.toLowerCase());R&&c.push({node:R,index:m+1,skipped:h,depth:p+1,statics:g+yn(i,m),dynamics:b,optionals:x,extract:y,rawParams:w})}if(!C&&d.static){const R=d.static.get(E);R&&c.push({node:R,index:m+1,skipped:h,depth:p+1,statics:g+yn(i,m),dynamics:b,optionals:x,extract:y,rawParams:w})}if(d.pathless){const R=p+1;for(let S=d.pathless.length-1;S>=0;S--){const A=d.pathless[S];c.push({node:A,index:m,skipped:h,depth:R,statics:g,dynamics:b,optionals:x,extract:y,rawParams:w})}}}if(f)return f;if(s&&l){let u=l.index;for(let m=0;m<l.index;m++)u+=t[m].length;const d=u===e.length?"/":e.slice(u);return l.rawParams??=Object.create(null),l.rawParams["**"]=decodeURIComponent(d),l}return null}function yn(e,t){return 2**(e-t-1)}function el(e,t){return e===2**(t-1)-1}function Br(e,t,n){let s,r;try{[s,r]=Ca(e,t,n)}catch{return null}if(n.rawParams=s,n.extract=r,!n.node.parse)return!0;try{if(n.node.parse(s)===!1)return null}catch{}return!0}function vn(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===et)>(e.node.kind===et)||t.node.kind===et==(e.node.kind===et)&&t.depth>e.depth))):!0}function Dn(e){return hr(e.filter(t=>t!==void 0).join("/"))}function hr(e){return e.replace(/\/{2,}/g,"/")}function Ea(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function qe(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function ka(e){return qe(Ea(e))}function Kn(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function tl(e,t,n){return Kn(e,n)===Kn(t,n)}function nl({base:e,to:t,trailingSlash:n="never",cache:s}){const r=t.startsWith("/"),a=!r&&t===".";let i;if(s){i=r?t:a?e:e+"\0"+t;const f=s.get(i);if(f)return f}let c;if(a)c=e.split("/");else if(r)c=t.split("/");else{for(c=e.split("/");c.length>1&&sn(c)==="";)c.pop();const f=t.split("/");for(let u=0,d=f.length;u<d;u++){const m=f[u];m===""?u?u===d-1&&c.push(m):c=[m]:m===".."?c.pop():m==="."||c.push(m)}}c.length>1&&(sn(c)===""?n==="never"&&c.pop():n==="always"&&c.push(""));const l=hr(c.join("/"))||"/";return i&&s&&s.set(i,l),l}function sl(e){const t=new Map(e.map(r=>[encodeURIComponent(r),r])),n=Array.from(t.keys()).map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),s=new RegExp(n,"g");return r=>r.replace(s,a=>t.get(a)??a)}function ws(e,t,n){const s=t[e];return typeof s!="string"?s:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(s)?s:s.split("/").map(r=>Wr(r,n)).join("/"):Wr(s,n)}function zr({path:e,params:t,decoder:n,...s}){let r=!1;const a=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:a,isMissingParams:r};if(!e.includes("$"))return{interpolatedPath:e,usedParams:a,isMissingParams:r};const i=e.length;let c=0,l,f="";for(;c<i;){const u=c;l=ja(e,u,l);const d=l[5];if(c=d+1,u===d)continue;const m=l[0];if(m===0){f+="/"+e.substring(u,d);continue}if(m===2){const h=t._splat;a._splat=h,a["*"]=h;const p=e.substring(u,l[1]),g=e.substring(l[4],d);if(!h){r=!0,(p||g)&&(f+="/"+p+g);continue}const b=ws("_splat",t,n);f+="/"+p+b+g;continue}if(m===1){const h=e.substring(l[2],l[3]);!r&&!(h in t)&&(r=!0),a[h]=t[h];const p=e.substring(u,l[1]),g=e.substring(l[4],d),b=ws(h,t,n)??"undefined";f+="/"+p+b+g;continue}if(m===3){const h=e.substring(l[2],l[3]),p=t[h];if(p==null)continue;a[h]=p;const g=e.substring(u,l[1]),b=e.substring(l[4],d),x=ws(h,t,n)??"";f+="/"+g+x+b;continue}}return e.endsWith("/")&&(f+="/"),{usedParams:a,interpolatedPath:f||"/",isMissingParams:r}}function Wr(e,t){const n=encodeURIComponent(e);return t?.(n)??n}function ye(e){return e?.isNotFound===!0}function rl(e,t=String){const n=new URLSearchParams;for(const s in e){const r=e[s];r!==void 0&&n.set(s,t(r))}return n.toString()}function Ss(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function ol(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[s,r]of t.entries()){const a=n[s];a==null?n[s]=Ss(r):Array.isArray(a)?a.push(Ss(r)):n[s]=[a,Ss(r)]}return n}const al=cl(JSON.parse),il=ll(JSON.stringify,JSON.parse);function cl(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=ol(t);for(const s in n){const r=n[s];if(typeof r=="string")try{n[s]=e(r)}catch{}}return n}}function ll(e,t){const n=typeof t=="function";function s(r){if(typeof r=="object"&&r!==null)try{return e(r)}catch{}else if(n&&typeof r=="string")try{return t(r),e(r)}catch{}return r}return r=>{const a=rl(r,s);return a?`?${a}`:""}}const mt="__root__";function dl(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function je(e){return e instanceof Response&&!!e.options}const Ks=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},ul=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),is=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),pt=(e,t,n=!0)=>{const s={...e.router.options.context??{}},r=n?t:t-1;for(let a=0;a<=r;a++){const i=e.matches[a];if(!i)continue;const c=e.router.getMatch(i.id);c&&Object.assign(s,c.__routeContext,c.__beforeLoadContext)}return s},Vr=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,s=e.matches.findIndex(i=>i.routeId===e.router.routeTree.id),r=s>=0?s:0;let a=n?e.matches.findIndex(i=>i.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=r);for(let i=a;i>=0;i--){const c=e.matches[i];if(e.router.looseRoutesById[c.routeId].options.notFoundComponent)return i}return n?a:r},tt=(e,t,n)=>{if(!(!je(n)&&!ye(n)))throw je(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,s=>({...s,status:je(n)?"redirected":ye(n)?"notFound":s.status==="pending"?"success":s.status,context:pt(e,t.index),isFetching:!1,error:n})),ye(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),je(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},_a=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Hr=(e,t,n)=>{const s=pt(e,n);e.updateMatch(t,r=>({...r,context:s}))},Kt=(e,t,n)=>{const{id:s,routeId:r}=e.matches[t],a=e.router.looseRoutesById[r];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,tt(e,e.router.getMatch(s),n);try{a.options.onError?.(n)}catch(i){n=i,tt(e,e.router.getMatch(s),n)}e.updateMatch(s,i=>(i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,i._nonReactive.loadPromise?.resolve(),{...i,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!je(n)&&!ye(n)&&(e.serialError??=n)},Pa=(e,t,n,s)=>{if(s._nonReactive.pendingTimeout!==void 0)return;const r=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!is(e,t)&&(n.options.loader||n.options.beforeLoad||Ta(n))&&typeof r=="number"&&r!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){const a=setTimeout(()=>{Ks(e)},r);s._nonReactive.pendingTimeout=a}},fl=(e,t,n)=>{const s=e.router.getMatch(t);if(!s._nonReactive.beforeLoadPromise&&!s._nonReactive.loaderPromise)return;Pa(e,t,n,s);const r=()=>{const a=e.router.getMatch(t);a.preload&&(a.status==="redirected"||a.status==="notFound")&&tt(e,a,a.error)};return s._nonReactive.beforeLoadPromise?s._nonReactive.beforeLoadPromise.then(r):r()},hl=(e,t,n,s)=>{const r=e.router.getMatch(t);let a=r._nonReactive.loadPromise;r._nonReactive.loadPromise=It(()=>{a?.resolve(),a=void 0});const{paramsError:i,searchError:c}=r;i&&Kt(e,n,i),c&&Kt(e,n,c),Pa(e,t,s,r);const l=new AbortController;let f=!1;const u=()=>{f||(f=!0,e.updateMatch(t,C=>({...C,isFetching:"beforeLoad",fetchCount:C.fetchCount+1,abortController:l})))},d=()=>{r._nonReactive.beforeLoadPromise?.resolve(),r._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,C=>({...C,isFetching:!1}))};if(!s.options.beforeLoad){e.router.batch(()=>{u(),d()});return}r._nonReactive.beforeLoadPromise=It();const m={...pt(e,n,!1),...r.__routeContext},{search:h,params:p,cause:g}=r,b=is(e,t),x={search:h,abortController:l,params:p,preload:b,context:m,location:e.location,navigate:C=>e.router.navigate({...C,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:b?"preload":g,matches:e.matches,routeId:s.id,...e.router.options.additionalContext},y=C=>{if(C===void 0){e.router.batch(()=>{u(),d()});return}(je(C)||ye(C))&&(u(),Kt(e,n,C)),e.router.batch(()=>{u(),e.updateMatch(t,E=>({...E,__beforeLoadContext:C})),d()})};let w;try{if(w=s.options.beforeLoad(x),rn(w))return u(),w.catch(C=>{Kt(e,n,C)}).then(y)}catch(C){u(),Kt(e,n,C)}y(w)},ml=(e,t)=>{const{id:n,routeId:s}=e.matches[t],r=e.router.looseRoutesById[s],a=()=>c(),i=()=>hl(e,n,t,r),c=()=>{if(_a(e,n))return;const l=fl(e,n,r);return rn(l)?l.then(i):i()};return a()},pl=(e,t,n)=>{const s=e.router.getMatch(t);if(!s||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const r={ssr:e.router.options.ssr,matches:e.matches,match:s,params:s.params,loaderData:s.loaderData};return Promise.all([n.options.head?.(r),n.options.scripts?.(r),n.options.headers?.(r)]).then(([a,i,c])=>({meta:a?.meta,links:a?.links,headScripts:a?.scripts,headers:c,scripts:i,styles:a?.styles}))},Aa=(e,t,n,s,r)=>{const a=t[s-1],{params:i,loaderDeps:c,abortController:l,cause:f}=e.router.getMatch(n),u=pt(e,s),d=is(e,n);return{params:i,deps:c,preload:!!d,parentMatchPromise:a,abortController:l,context:u,location:e.location,navigate:m=>e.router.navigate({...m,_fromLocation:e.location}),cause:d?"preload":f,route:r,...e.router.options.additionalContext}},qr=async(e,t,n,s,r)=>{try{const a=e.router.getMatch(n);try{(!(va??e.router.isServer)||a.ssr===!0)&&an(r);const i=r.options.loader,c=typeof i=="function"?i:i?.handler,l=c?.(Aa(e,t,n,s,r)),f=!!c&&rn(l);if((f||r._lazyPromise||r._componentsPromise||r.options.head||r.options.scripts||r.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,d=>({...d,isFetching:"loader"})),c){const d=f?await l:l;tt(e,e.router.getMatch(n),d),d!==void 0&&e.updateMatch(n,m=>({...m,loaderData:d}))}r._lazyPromise&&await r._lazyPromise;const u=a._nonReactive.minPendingPromise;u&&await u,r._componentsPromise&&await r._componentsPromise,e.updateMatch(n,d=>({...d,error:void 0,context:pt(e,s),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(i){let c=i;if(c?.name==="AbortError"){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,f=>({...f,status:f.status==="pending"?"success":f.status,isFetching:!1,context:pt(e,s)}));return}const l=a._nonReactive.minPendingPromise;l&&await l,ye(i)&&await r.options.notFoundComponent?.preload?.(),tt(e,e.router.getMatch(n),i);try{r.options.onError?.(i)}catch(f){c=f,tt(e,e.router.getMatch(n),f)}!je(c)&&!ye(c)&&await an(r,["errorComponent"]),e.updateMatch(n,f=>({...f,error:c,context:pt(e,s),status:"error",isFetching:!1}))}}catch(a){const i=e.router.getMatch(n);i&&(i._nonReactive.loaderPromise=void 0),tt(e,i,a)}},gl=async(e,t,n)=>{async function s(h,p,g,b,x){const y=Date.now()-p.updatedAt,w=h?x.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:x.options.staleTime??e.router.options.defaultStaleTime??0,C=x.options.shouldReload,E=typeof C=="function"?C(Aa(e,t,r,n,x)):C,{status:k,invalid:R}=b,S=y>=w&&(!!e.forceStaleReload||b.cause==="enter"||g!==void 0&&g!==b.id);i=k==="success"&&(R||(E??S)),h&&x.options.preload===!1||(i&&!e.sync&&u?(c=!0,(async()=>{try{await qr(e,t,r,n,x);const A=e.router.getMatch(r);A._nonReactive.loaderPromise?.resolve(),A._nonReactive.loadPromise?.resolve(),A._nonReactive.loaderPromise=void 0,A._nonReactive.loadPromise=void 0}catch(A){je(A)&&await e.router.navigate(A.options)}})()):k!=="success"||i?await qr(e,t,r,n,x):Hr(e,r,n))}const{id:r,routeId:a}=e.matches[n];let i=!1,c=!1;const l=e.router.looseRoutesById[a],f=l.options.loader,u=((typeof f=="function"?void 0:f?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(_a(e,r)){if(!e.router.getMatch(r))return e.matches[n];Hr(e,r,n)}else{const h=e.router.getMatch(r),p=e.router.stores.matchesId.get()[n],g=(p&&e.router.stores.matchStores.get(p)||null)?.routeId===a?p:e.router.stores.matches.get().find(x=>x.routeId===a)?.id,b=is(e,r);if(h._nonReactive.loaderPromise){if(h.status==="success"&&!e.sync&&!h.preload&&u)return h;await h._nonReactive.loaderPromise;const x=e.router.getMatch(r),y=x._nonReactive.error||x.error;y&&tt(e,x,y),x.status==="pending"&&await s(b,h,g,x,l)}else{const x=b&&!e.router.stores.matchStores.has(r),y=e.router.getMatch(r);y._nonReactive.loaderPromise=It(),x!==y.preload&&e.updateMatch(r,w=>({...w,preload:x})),await s(b,h,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 m=c?d.isFetching:!1;return m!==d.isFetching||d.invalid!==!1?(e.updateMatch(r,h=>({...h,isFetching:m,invalid:!1})),e.router.getMatch(r)):d};async function Gr(e){const t=e,n=[];ul(t.router)&&Ks(t);let s;for(let m=0;m<t.matches.length;m++){try{const h=ml(t,m);rn(h)&&await h}catch(h){if(je(h))throw h;if(ye(h))s=h;else if(!t.preload)throw h;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const r=t.firstBadMatchIndex??t.matches.length,a=s&&!t.preload?Vr(t,s):void 0,i=s&&t.preload?0:a!==void 0?Math.min(a+1,r):r;let c,l;for(let m=0;m<i;m++)n.push(gl(t,n,m));try{await Promise.all(n)}catch{const m=await Promise.allSettled(n);for(const h of m){if(h.status!=="rejected")continue;const p=h.reason;if(je(p))throw p;ye(p)?c??=p:l??=p}if(l!==void 0)throw l}const f=c??(s&&!t.preload?s:void 0);let u=t.firstBadMatchIndex!==void 0?t.firstBadMatchIndex:t.matches.length-1;if(!f&&s&&t.preload)return t.matches;if(f){const m=Vr(t,f);if(m===void 0){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not find match for notFound boundary");Ke()}const h=t.matches[m],p=t.router.looseRoutesById[h.routeId],g=t.router.options?.defaultNotFoundComponent;!p.options.notFoundComponent&&g&&(p.options.notFoundComponent=g),f.routeId=h.routeId;const b=h.routeId===t.router.routeTree.id;t.updateMatch(h.id,x=>({...x,...b?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:f},isFetching:!1})),u=m,await an(p,["notFoundComponent"])}else if(!t.preload){const m=t.matches[0];m.globalNotFound||t.router.getMatch(m.id)?.globalNotFound&&t.updateMatch(m.id,h=>({...h,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const m=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await an(m,["errorComponent"])}for(let m=0;m<=u;m++){const{id:h,routeId:p}=t.matches[m],g=t.router.looseRoutesById[p];try{const b=pl(t,h,g);if(b){const x=await b;t.updateMatch(h,y=>({...y,...x}))}}catch(b){console.error(`Error executing head for route ${p}:`,b)}}const d=Ks(t);if(rn(d)&&await d,f)throw f;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Kr(e,t){const n=t.map(s=>e.options[s]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function an(e,t=Fn){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(s=>{const{id:r,...a}=s.options;Object.assign(e.options,a),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const n=()=>e._componentsLoaded?void 0:t===Fn?(()=>{if(e._componentsPromise===void 0){const s=Kr(e,Fn);s?e._componentsPromise=s.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Kr(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function Ta(e){for(const t of Fn)if(e.options[t]?.preload)return!0;return!1}const Fn=["component","errorComponent","pendingComponent","notFoundComponent"];function xl(e){return{input:({url:t})=>{for(const n of e)t=Ys(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Oa(e[n],t);return t}}}function bl(e){const t=ka(e.basepath),n=`/${t}`,s=e.caseSensitive?n:n.toLowerCase(),r=`${s}/`;return{input:({url:a})=>{const i=e.caseSensitive?a.pathname:a.pathname.toLowerCase();return i===s?a.pathname="/":i.startsWith(r)&&(a.pathname=a.pathname.slice(n.length)),a},output:({url:a})=>(a.pathname=Dn(["/",t,a.pathname]),a)}}function Ys(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function Oa(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function yl(e,t){const{createMutableStore:n,createReadonlyStore:s,batch:r,init:a}=t,i=new Map,c=new Map,l=new Map,f=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),m=n(e.isTransitioning),h=n(e.location),p=n(e.resolvedLocation),g=n(e.statusCode),b=n(e.redirect),x=n([]),y=n([]),w=n([]),C=s(()=>Ns(i,x.get())),E=s(()=>Ns(c,y.get())),k=s(()=>Ns(l,w.get())),R=s(()=>x.get()[0]),S=s(()=>x.get().some(W=>i.get(W)?.get().status==="pending")),A=s(()=>({locationHref:h.get().href,resolvedLocationHref:p.get()?.href,status:f.get()})),I=s(()=>({status:f.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:m.get(),matches:C.get(),location:h.get(),resolvedLocation:p.get(),statusCode:g.get(),redirect:b.get()})),v=on(64);function O(W){let le=v.get(W);return le||(le=s(()=>{const we=x.get();for(const D of we){const _=i.get(D);if(_&&_.routeId===W)return _.get()}}),v.set(W,le)),le}const T={status:f,loadedAt:u,isLoading:d,isTransitioning:m,location:h,resolvedLocation:p,statusCode:g,redirect:b,matchesId:x,pendingIds:y,cachedIds:w,matches:C,pendingMatches:E,cachedMatches:k,firstId:R,hasPending:S,matchRouteDeps:A,matchStores:i,pendingMatchStores:c,cachedMatchStores:l,__store:I,getRouteMatchStore:O,setMatches:L,setPending:X,setCached:Z};L(e.matches),a?.(T);function L(W){js(W,i,x,n,r)}function X(W){js(W,c,y,n,r)}function Z(W){js(W,l,w,n,r)}return T}function Ns(e,t){const n=[];for(const s of t){const r=e.get(s);r&&n.push(r.get())}return n}function js(e,t,n,s,r){const a=e.map(c=>c.id),i=new Set(a);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 f=s(c);f.routeId=c.routeId,t.set(c.id,f);continue}l.routeId=c.routeId,l.get()!==c&&l.set(c)}Vc(n.get(),a)||n.set(a)})}var nt="__TSR_index",Yr="popstate",Jr="beforeunload";function vl(e){let t=e.getLocation();const n=new Set,s=i=>{t=e.getLocation(),n.forEach(c=>c({location:t,action:i}))},r=i=>{e.notifyOnIndexChange??!0?s(i):t=e.getLocation()},a=async({task:i,navigateOpts:c,...l})=>{if(c?.ignoreBlocker??!1){i();return}const f=e.getBlockers?.()??[],u=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&f.length&&u)for(const d of f){const m=Yn(l.path,l.state);if(await d.blockerFn({currentLocation:t,nextLocation:m,action:l.type})){e.onBlocked?.();return}}i()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:i=>(n.add(i),()=>{n.delete(i)}),push:(i,c,l)=>{const f=t.state[nt];c=Xr(f+1,c),a({task:()=>{e.pushState(i,c),s({type:"PUSH"})},navigateOpts:l,type:"PUSH",path:i,state:c})},replace:(i,c,l)=>{const f=t.state[nt];c=Xr(f,c),a({task:()=>{e.replaceState(i,c),s({type:"REPLACE"})},navigateOpts:l,type:"REPLACE",path:i,state:c})},go:(i,c)=>{a({task:()=>{e.go(i),r({type:"GO",index:i})},navigateOpts:c,type:"GO"})},back:i=>{a({task:()=>{e.back(i?.ignoreBlocker??!1),r({type:"BACK"})},navigateOpts:i,type:"BACK"})},forward:i=>{a({task:()=>{e.forward(i?.ignoreBlocker??!1),r({type:"FORWARD"})},navigateOpts:i,type:"FORWARD"})},canGoBack:()=>t.state[nt]!==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(f=>f!==i))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:s}}function Xr(e,t){t||(t={});const n=mr();return{...t,key:n,__TSR_key:n,[nt]:e}}function wl(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,s=t.history.replaceState;let r=[];const a=()=>r,i=S=>r=S,c=(S=>S),l=(()=>Yn(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const S=mr();t.history.replaceState({[nt]:0,key:S,__TSR_key:S},"")}let f=l(),u,d=!1,m=!1,h=!1,p=!1;const g=()=>f;let b,x;const y=()=>{b&&(R._ignoreSubscribers=!0,(b.isPush?t.history.pushState:t.history.replaceState)(b.state,"",b.href),R._ignoreSubscribers=!1,b=void 0,x=void 0,u=void 0)},w=(S,A,I)=>{const v=c(A);x||(u=f),f=Yn(A,I),b={href:v,state:I,isPush:b?.isPush||S==="push"},x||(x=Promise.resolve().then(()=>y()))},C=S=>{f=l(),R.notify({type:S})},E=async()=>{if(m){m=!1;return}const S=l(),A=S.state[nt]-f.state[nt],I=A===1,v=A===-1,O=!I&&!v||d;d=!1;const T=O?"GO":v?"BACK":"FORWARD",L=O?{type:"GO",index:A}:{type:v?"BACK":"FORWARD"};if(h)h=!1;else{const X=a();if(typeof document<"u"&&X.length){for(const Z of X)if(await Z.blockerFn({currentLocation:f,nextLocation:S,action:T})){m=!0,t.history.go(1),R.notify(L);return}}}f=l(),R.notify(L)},k=S=>{if(p){p=!1;return}let A=!1;const I=a();if(typeof document<"u"&&I.length)for(const v of I){const O=v.enableBeforeUnload??!0;if(O===!0){A=!0;break}if(typeof O=="function"&&O()===!0){A=!0;break}}if(A)return S.preventDefault(),S.returnValue=""},R=vl({getLocation:g,getLength:()=>t.history.length,pushState:(S,A)=>w("push",S,A),replaceState:(S,A)=>w("replace",S,A),back:S=>(S&&(h=!0),p=!0,t.history.back()),forward:S=>{S&&(h=!0),p=!0,t.history.forward()},go:S=>{d=!0,t.history.go(S)},createHref:S=>c(S),flush:y,destroy:()=>{t.history.pushState=n,t.history.replaceState=s,t.removeEventListener(Jr,k,{capture:!0}),t.removeEventListener(Yr,E)},onBlocked:()=>{u&&f!==u&&(f=u)},getBlockers:a,setBlockers:i,notifyOnIndexChange:!1});return t.addEventListener(Jr,k,{capture:!0}),t.addEventListener(Yr,E),t.history.pushState=function(...S){const A=n.apply(t.history,S);return R._ignoreSubscribers||C("PUSH"),A},t.history.replaceState=function(...S){const A=s.apply(t.history,S);return R._ignoreSubscribers||C("REPLACE"),A},R}function Sl(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Yn(e,t){const n=Sl(e),s=n.indexOf("#"),r=n.indexOf("?"),a=mr();return{href:n,pathname:n.substring(0,s>0?r>0?Math.min(s,r):s:r>0?r:n.length),hash:s>-1?n.substring(s):"",search:r>-1?n.slice(r,s===-1?void 0:s):"",state:t||{[nt]:0,key:a,__TSR_key:a}}}function mr(){return(Math.random()+1).toString(36).substring(7)}function Ot(e,t){const n=t,s=e;return{fromLocation:n,toLocation:s,pathChanged:n?.pathname!==s.pathname,hrefChanged:n?.href!==s.href,hashChanged:n?.hash!==s.hash}}const Js=new WeakMap;var Nl=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=n=>n(),this.update=n=>{process.env.NODE_ENV!=="production"&&n.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 s=this.options,r=this.basepath??s?.basepath??"/",a=this.basepath===void 0,i=s?.rewrite;if(this.options={...s,...n},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=sl(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=wl()),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 u;this.resolvePathCache=on(1e3),u=this.buildRouteTree(),this.setRoutes(u)}if(!this.stores&&this.latestLocation){const u=this.getStoreConfig(this);this.batch=u.batch,this.stores=yl(Cl(this.latestLocation),u),Ml(this)}let c=!1;const l=this.options.basepath??"/",f=this.options.rewrite;if(a||r!==l||i!==f){this.basepath=l;const u=[],d=ka(l);d&&d!=="/"&&u.push(bl({basepath:l})),f&&u.push(f),this.rewrite=u.length===0?void 0:u.length===1?u[0]:xl(u),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 n=Xc(this.routeTree,this.options.caseSensitive,(s,r)=>{s.init({originalIndex:r})});return this.options.routeMasks&&qc(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,s)=>{const r={eventType:n,fn:s};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}},this.emit=n=>{this.subscribers.forEach(s=>{s.eventType===n.type&&s.fn(n)})},this.parseLocation=(n,s)=>{const r=({pathname:l,search:f,hash:u,href:d,state:m})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){const x=this.options.parseSearch(f),y=this.options.stringifySearch(x);return{href:l+y+u,publicHref:l+y+u,pathname:Gt(l).path,external:!1,searchStr:y,search:it(s?.search,x),hash:Gt(u.slice(1)).path,state:dt(s?.state,m)}}const h=new URL(d,this.origin),p=Ys(this.rewrite,h),g=this.options.parseSearch(p.search),b=this.options.stringifySearch(g);return p.search=b,{href:p.href.replace(p.origin,""),publicHref:d,pathname:Gt(p.pathname).path,external:!!this.rewrite&&p.origin!==this.origin,searchStr:b,search:it(s?.search,g),hash:Gt(p.hash.slice(1)).path,state:dt(s?.state,m)}},a=r(n),{__tempLocation:i,__tempKey:c}=a.state;if(i&&(!c||c===this.tempLocationKey)){const l=r(i);return l.state.key=a.state.key,l.state.__TSR_key=a.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:a}}return a},this.resolvePathWithBase=(n,s)=>nl({base:n,to:s.includes("//")?hr(s):s,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,s,r)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:s},r):this.matchRoutesInternal(n,s),this.getMatchedRoutes=n=>Rl({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const s=this.getMatch(n);s&&(s.abortController.abort(),clearTimeout(s._nonReactive.pendingTimeout),s._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(n=>{this.cancelMatch(n)}),this.stores.matchesId.get().forEach(n=>{if(this.stores.pendingMatchStores.has(n))return;const s=this.stores.matchStores.get(n)?.get();s&&(s.status==="pending"||s.isFetching==="loader")&&this.cancelMatch(n)})},this.buildLocation=n=>{const s=(a={})=>{const i=a._fromLocation||this.pendingBuiltLocation||this.latestLocation,c=this.matchRoutesLightweight(i);if(a.from&&process.env.NODE_ENV!=="production"&&a._isNavigate){const v=this.getMatchedRoutes(a.from).matchedRoutes,O=$r(c.matchedRoutes,L=>Qr(L.fullPath,a.from)),T=$r(v,L=>Qr(L.fullPath,c.fullPath));!O&&!T&&console.warn(`Could not find match for from: ${a.from}`)}const l=a.unsafeRelative==="path"?i.pathname:a.from??c.fullPath,f=a.to?`${a.to}`:void 0,u=c.search,d=Object.assign(Object.create(null),c.params),m=f?.charCodeAt(0)===47?"/":this.resolvePathWithBase(l,"."),h=f?this.resolvePathWithBase(m,f):m,p=a.params===!1||a.params===null?Object.create(null):(a.params??!0)===!0?d:Object.assign(d,lt(a.params,d)),g=this.routesByPath[qe(h)];let b;if(g)b=this.getRouteBranch(g);else if(h.includes("$"))b=[];else{const v=this.getMatchedRoutes(h);b=v.matchedRoutes,this.options.notFoundRoute&&(!v.foundRoute||v.foundRoute.path!=="/"&&v.routeParams["**"])&&(b=[...b,this.options.notFoundRoute])}if(b.length&&Sa(p))for(const v of b){const O=v.options.params?.stringify??v.options.stringifyParams;if(O)try{Object.assign(p,O(p))}catch{}}const x=n.leaveParams?h:Gt(zr({path:h,params:p,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;if(process.env.NODE_ENV!=="production"&&g&&!n.leaveParams)try{const v=this.getMatchedRoutes(x);v.foundRoute?.id!==g.id&&console.warn(`Generated path "${x}" for route "${g.id}" matched route "${v.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=u;if(n._includeValidateSearch&&this.options.search?.strict){const v={};b.forEach(O=>{if(O.options.validateSearch)try{Object.assign(v,$n(O.options.validateSearch,{...v,...y}))}catch{}}),y=v}y=El({search:y,dest:a,destRoutes:b,_includeValidateSearch:n._includeValidateSearch}),y=it(u,y);const w=this.options.stringifySearch(y),C=a.hash===!0?i.hash:a.hash?lt(a.hash,i.hash):void 0,E=C?`#${C}`:"";let k=a.state===!0?i.state:a.state?lt(a.state,i.state):{};k=dt(i.state,k);const R=`${x}${w}${E}`;let S,A,I=!1;if(this.rewrite){const v=new URL(R,this.origin),O=Oa(this.rewrite,v);S=v.href.replace(v.origin,""),O.origin!==this.origin?(A=O.href,I=!0):A=O.pathname+O.search+O.hash}else S=Wc(R),A=S;return{publicHref:A,href:S,pathname:x,search:y,searchStr:w,state:k,hash:C??"",external:I,unmaskOnReload:a.unmaskOnReload}},r=(a={},i)=>{const c=s(a);let l=i?s(i):void 0;if(!l){const f=Object.create(null);if(this.options.routeMasks){const u=Gc(c.pathname,this.processedTree);if(u){Object.assign(f,u.rawParams);const{from:d,params:m,...h}=u.route,p=m===!1||m===null?Object.create(null):(m??!0)===!0?f:Object.assign(f,lt(m,f));i={from:n.from,...h,params:p},l=s(i)}}}return l&&(c.maskedLocation=l),c};return n.mask?r(n,{from:n.from,...n.mask}):r(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:s,...r})=>{let a;const i=()=>{const f=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];f.forEach(d=>{r.state[d]=this.latestLocation.state[d]});const u=ht(r.state,this.latestLocation.state);return f.forEach(d=>{delete r.state[d]}),u},c=qe(this.latestLocation.href)===qe(r.href);let l=this.commitLocationPromise;if(this.commitLocationPromise=It(()=>{l?.resolve(),l=void 0}),c&&i())this.load();else{let{maskedLocation:f,hashScrollIntoView:u,...d}=r;f&&(d={...f,state:{...f.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=u??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,a=r.replace?"REPLACE":"PUSH",this.history[a==="REPLACE"?"replace":"push"](d.publicHref,d.state,{ignoreBlocker:s})}return this._scroll.next=r.resetScroll??!0,this.history.subscribers.size||this.load(a?{action:{type:a}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:s,hashScrollIntoView:r,viewTransition:a,ignoreBlocker:i,href:c,...l}={})=>{if(c){const d=this.history.location.state.__TSR_index,m=Yn(c,{__TSR_index:n?d:d+1}),h=new URL(m.pathname,this.origin);l.to=Ys(this.rewrite,h).pathname,l.search=this.options.parseSearch(m.search),l.hash=m.hash.slice(1)}const f=this.buildLocation({...l,_includeValidateSearch:!0});this.pendingBuiltLocation=f;const u=this.commitLocation({...f,viewTransition:a,replace:n,resetScroll:s,hashScrollIntoView:r,ignoreBlocker:i});return queueMicrotask(()=>{this.pendingBuiltLocation===f&&(this.pendingBuiltLocation=void 0)}),u},this.navigate=async({to:n,reloadDocument:s,href:r,publicHref:a,...i})=>{let c=!1;if(r)try{new URL(`${r}`),c=!0}catch{}if(c&&!s&&(s=!0),s){if(n!==void 0||!r){const f=this.buildLocation({to:n,...i});r=r??f.publicHref,a=a??f.publicHref}const l=!c&&a?a:r;if(Gn(l,this.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked navigation to dangerous protocol: ${l}`);return}if(!i.ignoreBlocker){const f=this.history.getBlockers?.()??[];for(const u of f)if(u?.blockerFn&&await u.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:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation),s=this.stores.cachedMatches.get().filter(r=>!n.some(a=>a.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(n),this.stores.setCached(s)})},this.load=async n=>{const s=n?.action?.type;let r,a,i;const c=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(f=>{this.startTransition(async()=>{try{this.beforeLoad(),s?Js.set(this.latestLocation,s):Js.delete(this.latestLocation);const u=this.latestLocation,d=Ot(u,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...d}),this.emit({type:"onBeforeLoad",...d}),await Gr({router:this,sync:n?.sync,forceStaleReload:c.href===u.href,matches:this.stores.pendingMatches.get(),location:u,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let m=null,h=null,p=null,g=null;this.batch(()=>{const b=this.stores.pendingMatches.get(),x=b.length,y=this.stores.matches.get();m=x?y.filter(E=>!this.stores.pendingMatchStores.has(E.id)):null;const w=new Set;for(const E of this.stores.pendingMatchStores.values())E.routeId&&w.add(E.routeId);const C=new Set;for(const E of this.stores.matchStores.values())E.routeId&&C.add(E.routeId);h=x?y.filter(E=>!w.has(E.routeId)):null,p=x?b.filter(E=>!C.has(E.routeId)):null,g=x?b.filter(E=>C.has(E.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(),...m.filter(E=>E.status!=="error"&&E.status!=="notFound"&&E.status!=="redirected")]),this.clearExpiredCache())});for(const[b,x]of[[h,"onLeave"],[p,"onEnter"],[g,"onStay"]])if(b)for(const y of b)this.looseRoutesById[y.routeId].options[x]?.(y)})})}})}catch(u){je(u)?(r=u,this.navigate({...r.options,replace:!0,ignoreBlocker:!0})):ye(u)&&(a=u);const d=r?r.status:a?404:this.stores.matches.get().some(m=>m.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),f()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let l;this.hasNotFoundMatch()?l=404:this.stores.matches.get().some(f=>f.status==="error")&&(l=500),l!==void 0&&this.stores.statusCode.set(l)},this.startViewTransition=n=>{const s=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,s&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let r;if(typeof s=="object"&&this.isViewTransitionTypesSupported){const a=this.latestLocation,i=this.stores.resolvedLocation.get(),c=typeof s.types=="function"?s.types(Ot(a,i)):s.types;if(c===!1){n();return}r={update:n,types:c}}else r=n;document.startViewTransition(r)}else n()},this.updateMatch=(n,s)=>{this.startTransition(()=>{const r=this.stores.pendingMatchStores.get(n);if(r){r.set(s);return}const a=this.stores.matchStores.get(n);if(a){a.set(s);return}const i=this.stores.cachedMatchStores.get(n);if(i){const c=s(i.get());c.status==="redirected"?this.stores.cachedMatchStores.delete(n)&&this.stores.cachedIds.set(l=>l.filter(f=>f!==n)):i.set(c)}})},this.getMatch=n=>this.stores.cachedMatchStores.get(n)?.get()??this.stores.pendingMatchStores.get(n)?.get()??this.stores.matchStores.get(n)?.get(),this.invalidate=n=>{const s=r=>n?.filter?.(r)??!0?{...r,invalid:!0,...n?.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(s)),this.stores.setCached(this.stores.cachedMatches.get().map(s)),this.stores.setPending(this.stores.pendingMatches.get().map(s))}),this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const s=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const r=n.options._builtLocation??this.buildLocation(n.options),a=this.getParsedLocationHref(r);n.options.href=a,n.headers.set("Location",a)}else if(s)try{const r=new URL(s);if(this.origin&&r.origin===this.origin){const a=r.pathname+r.search+r.hash;n.options.href=a,n.headers.set("Location",a)}}catch{}if(n.options.href&&!n.options._builtLocation&&Gn(n.options.href,this.protocolAllowlist))throw new Error(process.env.NODE_ENV!=="production"?`Redirect blocked: unsafe protocol in href "${n.options.href}". Allowed protocols: ${Array.from(this.protocolAllowlist).join(", ")}.`:"Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const s=n?.filter;s!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(r=>!s(r))):this.stores.setCached([])},this.clearExpiredCache=()=>{const n=Date.now(),s=r=>{const a=this.looseRoutesById[r.routeId];if(!a.options.loader)return!0;const i=(r.preload?a.options.preloadGcTime??this.options.defaultPreloadGcTime:a.options.gcTime??this.options.defaultGcTime)??300*1e3;return r.status==="error"?!0:n-r.updatedAt>=i};this.clearCache({filter:s})},this.loadRouteChunk=an,this.preloadRoute=async n=>{const s=n._builtLocation??this.buildLocation(n);let r=this.matchRoutes(s,{throwOnError:!0,preload:!0,dest:n});const a=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...a,...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 Gr({router:this,matches:r,location:s,preload:!0,updateMatch:(l,f)=>{a.has(l)?r=r.map(u=>u.id===l?f(u):u):this.updateMatch(l,f)}}),r}catch(l){if(je(l))return l.options.reloadDocument?void 0:await this.preloadRoute({...l.options,_fromLocation:s});ye(l)||console.error(l);return}},this.matchRoute=(n,s)=>{const r={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},a=this.buildLocation(r);if(s?.pending&&this.stores.status.get()!=="pending")return!1;const i=(s?.pending===void 0?!this.stores.isLoading.get():s.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),c=Kc(a.pathname,s?.caseSensitive??!1,s?.fuzzy??!1,i.pathname,this.processedTree);return!c||n.params&&!ht(c.rawParams,n.params,{partial:!0})?!1:s?.includeSearch??!0?ht(i.search,a.search,{partial:!0})?c.rawParams:!1:c.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(n=>n.status==="notFound"||n.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??il,parseSearch:e.parseSearch??al,protocolAllowlist:e.protocolAllowlist??zc}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const s=this.options.notFoundRoute;s&&(s.init({originalIndex:99999999999}),this.routesById[s.id]=s)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=Ra(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 n=this.getMatchedRoutes(e.pathname),{foundRoute:s,routeParams:r}=n;let{matchedRoutes:a}=n,i=!1;(s?s.path!=="/"&&r["**"]:qe(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:i=!0);const c=i?_l(this.options.notFoundMode,a):void 0,l=new Array(a.length),f=new Map;for(const u of this.stores.matchStores.values())u.routeId&&f.set(u.routeId,u.get());for(let u=0;u<a.length;u++){const d=a[u],m=l[u-1];let h,p,g;{const O=m?.search??e.search,T=m?._strictSearch??void 0;try{const L=$n(d.options.validateSearch,{...O})??void 0;h={...O,...L},p={...T,...L},g=void 0}catch(L){let X=L;if(L instanceof Jn||(X=new Jn(L.message,{cause:L})),t?.throwOnError)throw X;h=O,p={},g=X}}const b=d.options.loaderDeps?.({search:h})??"",x=b?JSON.stringify(b):"",{interpolatedPath:y,usedParams:w}=zr({path:d.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),C=d.id+y+x,E=this.getMatch(C),k=f.get(d.id),R=E?._strictParams??w;let S;if(!E)try{eo(d,R)}catch(O){if(ye(O)||je(O)?S=O:S=new jl(O.message,{cause:O}),t?.throwOnError)throw S}Object.assign(r,R);const A=k?"stay":"enter";let I;if(E)I={...E,cause:A,params:k?.params??r,_strictParams:R,search:it(k?k.search:E.search,h),_strictSearch:p};else{const O=d.options.loader||d.options.beforeLoad||d.lazyFn||Ta(d)?"pending":"success";I={id:C,ssr:d.options.ssr,index:u,routeId:d.id,params:k?.params??r,_strictParams:R,pathname:y,updatedAt:Date.now(),search:k?it(k.search,h):h,_strictSearch:p,searchError:void 0,status:O,isFetching:!1,error:void 0,paramsError:S,__routeContext:void 0,_nonReactive:{loadPromise:It()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:A,loaderDeps:k?dt(k.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 v=this.getParentContext(m);I.context={...v,...I.__routeContext,...I.__beforeLoadContext},l[u]=I}for(let u=0;u<l.length;u++){const d=l[u],m=this.looseRoutesById[d.routeId],h=this.getMatch(d.id),p=f.get(d.routeId);if(d.params=p?it(p.params,r):r,!h){const g=l[u-1],b=this.getParentContext(g);if(m.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:m.id};d.__routeContext=m.options.context(x)??void 0}d.context={...b,...d.__routeContext,...d.__beforeLoadContext}}}return l}matchRoutesLightweight(e){const t=sn(this.stores.matchesId.get()),n=this.lightweightCache.get(e);if(n&&n[0]===t)return n[1];const{matchedRoutes:s,routeParams:r}=this.getMatchedRoutes(e.pathname),a=sn(s),i={...e.search};for(const d of s)try{Object.assign(i,$n(d.options.validateSearch,i))}catch{}const c=t&&this.stores.matchStores.get(t)?.get(),l=c&&c.routeId===a.id&&c.pathname===e.pathname;let f;if(l)f=c.params;else{const d=Object.assign(Object.create(null),r);for(const m of s)try{eo(m,d)}catch{}f=d}const u={matchedRoutes:s,fullPath:a.fullPath,search:i,params:f};return this.lightweightCache.set(e,[t,u]),u}},Jn=class extends Error{},jl=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 Cl(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function $n(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new Jn("Async validation not supported");if(n.issues)throw new Jn(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function Rl({pathname:e,routesById:t,processedTree:n}){const s=Object.create(null),r=qe(e);let a;const i=Yc(r,n,!0);return i&&(a=i.route,Object.assign(s,i.rawParams)),{matchedRoutes:i?.branch||[t.__root__],routeParams:s,foundRoute:a}}function El({search:e,dest:t,destRoutes:n,_includeValidateSearch:s}){return kl(n)(e,t,s??!1)}function kl(e){let t,n;const s=[];for(const a of e){const i=a.options;if("search"in i)i.search?.middlewares&&s.push(...i.search.middlewares);else if(i.preSearchFilters||i.postSearchFilters){const l=({search:f,next:u})=>{const d=u(i.preSearchFilters?i.preSearchFilters.reduce((m,h)=>h(m),f):f);return i.postSearchFilters?i.postSearchFilters.reduce((m,h)=>h(m),d):d};s.push(l)}const c=i.validateSearch;if(c){const l=({search:f,next:u,meta:d})=>{const m=u(f);if(n)try{const h=$n(c,m);if(d&&h)for(const p in h)p in m||(d.defaulted||=new Map).set(p,h[p]);return{...m,...h}}catch{}return m};s.push(l)}}const r=(a,i,c)=>{if(a>=s.length){if(!t.search)return{};if(t.search===!0)return i;const f=lt(t.search,i);return c&&(c.explicit=f),f}const l=(f,u)=>{if(u){const d=c||{};return{search:r(a+1,f,d),meta:d}}return r(a+1,f,c)};return s[a]({search:i,next:l,meta:c})};return function(i,c,l){return t=c,n=l,r(0,i)}}function _l(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const s=t[n];if(s.children)return s.id}return mt}function eo(e,t){const n=e.options.params?.parse??e.options.parseParams;if(n){const s=n(t);if(s===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,s)}}function Pl(){try{return sessionStorage}catch{return}}const Al="tsr-scroll-restoration-v1_3",La=Pl();function Tl(){try{return JSON.parse(La?.getItem("tsr-scroll-restoration-v1_3")||"{}")}catch{return{}}}function Ol(){try{La?.setItem(Al,JSON.stringify(Pt))}catch{process.env.NODE_ENV!=="production"&&console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}const Pt=Tl(),to="data-scroll-restoration-id",Ll=e=>e.state.__TSR_key||e.href;function Il(e){const t=e.getAttribute(to);if(t)return`[${to}="${t}"]`;let n="",s=e,r;for(;r=s.parentNode;){let a=1,i=s;for(;i=i.previousElementSibling;)a++;const c=`${s.localName}:nth-child(${a})`;n=n?`${c} > ${n}`:c,s=r}return n}let wn=!1;const At="window";function Xs(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function no(e){const t=[];for(const n of e){if(n===At)continue;const s=Xs(n);s&&t.push(s)}return t}function Ml(e,t){const n=e.options.scrollRestoration,s=e._scroll;n&&(s.restoring=!0);const r=e.options.getScrollRestorationKey||Ll,a=new Map,i=(f,u,d)=>{const m=a.get(f)||{};m.scrollX=u,m.scrollY=d,a.set(f,m)},c=f=>{if(!(wn||!s.restoring))if(f.target===document)i(At,scrollX,scrollY);else{const u=f.target;i(u,u.scrollLeft,u.scrollTop)}},l=f=>{if(!s.restoring)return;const u=Pt[f]||={};for(const[d,m]of a)d===At?u[At]=m:d.isConnected&&(u[Il(d)]=m)};n&&!s.restoration&&(s.restoration=!0,wn=!1,history.scrollRestoration="manual",document.addEventListener("scroll",c,!0),e.subscribe("onBeforeLoad",f=>{f.fromLocation&&l(r(f.fromLocation)),a.clear()}),addEventListener("pagehide",()=>{l(r(e.stores.resolvedLocation.get()??e.stores.location.get())),Ol()})),!s.reset&&(s.reset=!0,e.subscribe("onRendered",f=>{const u=e.options.scrollRestorationBehavior,d=e.options.scrollToTopSelectors,m=s.next;let h;if(a.clear(),m||(s.next=!0),typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const p=r(f.toLocation),g=f.fromLocation&&r(f.fromLocation);if(s.restoring&&g&&g!==p){const b=Pt[g];if(b){let x=Pt[p];for(const y in b){if(y===At){if(m)continue}else{const w=Xs(y);if(!w||m&&d&&(h??=no(d),h.includes(w)))continue}x||(x=Pt[p]={}),x[y]??=b[y]}}}wn=!0;try{const b=f.toLocation.hash,x=f.toLocation.state.__hashScrollIntoViewOptions??!0;let y=!1;if(m){const w=Js.get(f.toLocation),C=b&&x&&(w==="PUSH"||w==="REPLACE"),E=s.restoring?Pt[p]:void 0;if(E)for(const k in E){const{scrollX:R,scrollY:S}=E[k];if(k===At){if(C)continue;scrollTo({top:S,left:R,behavior:u}),y=!0}else{const A=Xs(k);A&&(A.scrollLeft=R,A.scrollTop=S)}}if(!y&&!b){const k={top:0,left:0,behavior:u};if(scrollTo(k),d){h??=no(d);for(const R of h)R.scrollTo(k)}}}!y&&b&&x&&document.getElementById(b)?.scrollIntoView(x)}finally{wn=!1}}))}const Dl="Error preloading route! ☝️";var Ia=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 n=this.options,s=!n?.path&&!n?.id;if(this.parentRoute=this.options.getParentRoute?.(),s)this._path=mt;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.");Ke()}let r=s?mt:n?.path;r&&r!=="/"&&(r=Ea(r));const a=n?.id||r;let i=s?mt:Dn([this.parentRoute.id==="__root__"?"":this.parentRoute.id,a]);r==="__root__"&&(r="/"),i!=="__root__"&&(i=Dn(["/",i]));const c=i==="__root__"?"/":Dn([this.parentRoute.fullPath,r]);this._path=r,this._id=i,this._fullPath=c,this._to=qe(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=>dl({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.")}},Fl=class extends Ia{constructor(e){super(e)}};function pr(e){const t=e.errorComponent??gr;return o.jsx($l,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:s})=>n?j.createElement(t,{error:n,reset:s}):e.children})}var $l=class extends j.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function gr({error:e}){const[t,n]=j.useState(process.env.NODE_ENV!=="production");return o.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[o.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),o.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(s=>!s),children:t?"Hide Error":"Show Error"})]}),o.jsx("div",{style:{height:".25rem"}}),t?o.jsx("div",{children:o.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?o.jsx("code",{children:e.message}):null})}):null]})}function Ul({children:e,fallback:t=null}){return Ma()?o.jsx(P.Fragment,{children:e}):o.jsx(P.Fragment,{children:t})}function Ma(){return P.useSyncExternalStore(Bl,()=>!0,()=>!1)}function Bl(){return()=>{}}var Da=j.createContext(null);function Ae(e){const t=j.useContext(Da);return process.env.NODE_ENV!=="production"&&(t||console.warn("Warning: useRouter must be used inside a <RouterProvider> component!")),t}var cs=j.createContext(void 0),zl=j.createContext(void 0),ie=(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))(ie||{});function Wl({update:e,notify:t,unwatched:n}){return{link:s,unlink:r,propagate:a,checkDirty:i,shallowPropagate:c};function s(f,u,d){const m=u.depsTail;if(m!==void 0&&m.dep===f)return;const h=m!==void 0?m.nextDep:u.deps;if(h!==void 0&&h.dep===f){h.version=d,u.depsTail=h;return}const p=f.subsTail;if(p!==void 0&&p.version===d&&p.sub===u)return;const g=u.depsTail=f.subsTail={version:d,dep:f,sub:u,prevDep:m,nextDep:h,prevSub:p,nextSub:void 0};h!==void 0&&(h.prevDep=g),m!==void 0?m.nextDep=g:u.deps=g,p!==void 0?p.nextSub=g:f.subs=g}function r(f,u=f.sub){const d=f.dep,m=f.prevDep,h=f.nextDep,p=f.nextSub,g=f.prevSub;return h!==void 0?h.prevDep=m:u.depsTail=m,m!==void 0?m.nextDep=h:u.deps=h,p!==void 0?p.prevSub=g:d.subsTail=g,g!==void 0?g.nextSub=p:(d.subs=p)===void 0&&n(d),h}function a(f){let u=f.nextSub,d;e:do{const m=f.sub;let h=m.flags;if(h&60?h&12?h&4?!(h&48)&&l(f,m)?(m.flags=h|40,h&=1):h=0:m.flags=h&-9|32:h=0:m.flags=h|32,h&2&&t(m),h&1){const p=m.subs;if(p!==void 0){const g=(f=p).nextSub;g!==void 0&&(d={value:u,prev:d},u=g);continue}}if((f=u)!==void 0){u=f.nextSub;continue}for(;d!==void 0;)if(f=d.value,d=d.prev,f!==void 0){u=f.nextSub;continue e}break}while(!0)}function i(f,u){let d,m=0,h=!1;e:do{const p=f.dep,g=p.flags;if(u.flags&16)h=!0;else if((g&17)===17){if(e(p)){const b=p.subs;b.nextSub!==void 0&&c(b),h=!0}}else if((g&33)===33){(f.nextSub!==void 0||f.prevSub!==void 0)&&(d={value:f,prev:d}),f=p.deps,u=p,++m;continue}if(!h){const b=f.nextDep;if(b!==void 0){f=b;continue}}for(;m--;){const b=u.subs,x=b.nextSub!==void 0;if(x?(f=d.value,d=d.prev):f=b,h){if(e(u)){x&&c(b),u=f.sub;continue}h=!1}else u.flags&=-33;u=f.sub;const y=f.nextDep;if(y!==void 0){f=y;continue e}}return h}while(!0)}function c(f){do{const u=f.sub,d=u.flags;(d&48)===32&&(u.flags=d|16,(d&6)===2&&t(u))}while((f=f.nextSub)!==void 0)}function l(f,u){let d=u.depsTail;for(;d!==void 0;){if(d===f)return!0;d=d.prevDep}return!1}}function Vl(e,t,n){const s=typeof e=="object",r=s?e:void 0;return{next:(s?e.next:e)?.bind(r),error:(s?e.error:t)?.bind(r),complete:(s?e.complete:n)?.bind(r)}}const Zs=[];let Un=0;const{link:so,unlink:Hl,propagate:ql,checkDirty:Fa,shallowPropagate:ro}=Wl({update(e){return e._update()},notify(e){Zs[Qs++]=e,e.flags&=~ie.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=ie.Mutable|ie.Dirty,Xn(e))}});let Sn=0,Qs=0,De,er=0;function $a(e){try{++er,e()}finally{--er||Ua()}}function Xn(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Hl(n,e)}function Ua(){if(!(er>0)){for(;Sn<Qs;){const e=Zs[Sn];Zs[Sn++]=void 0,e.notify()}Sn=0,Qs=0}}function oo(e,t){const n=typeof e=="function",s=e,r={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?ie.None:ie.Mutable,get(){return De!==void 0&&so(r,De,Un),r._snapshot},subscribe(a){const i=Vl(a),c={current:!1},l=Gl(()=>{r.get(),c.current?i.next?.(r._snapshot):c.current=!0});return{unsubscribe:()=>{l.stop()}}},_update(a){const i=De,c=t?.compare??Object.is;if(n)De=r,++Un,r.depsTail=void 0;else if(a===void 0)return!1;n&&(r.flags=ie.Mutable|ie.RecursedCheck);try{const l=r._snapshot,f=typeof a=="function"?a(l):a===void 0&&n?s(l):a;return l===void 0||!c(l,f)?(r._snapshot=f,!0):!1}finally{De=i,n&&(r.flags&=~ie.RecursedCheck),Xn(r)}}};return n?(r.flags=ie.Mutable|ie.Dirty,r.get=function(){const a=r.flags;if(a&ie.Dirty||a&ie.Pending&&Fa(r.deps,r)){if(r._update()){const i=r.subs;i!==void 0&&ro(i)}}else a&ie.Pending&&(r.flags=a&~ie.Pending);return De!==void 0&&so(r,De,Un),r._snapshot}):r.set=function(a){if(r._update(a)){const i=r.subs;i!==void 0&&(ql(i),ro(i),Ua())}},r}function Gl(e){const t=()=>{const s=De;De=n,++Un,n.depsTail=void 0,n.flags=ie.Watching|ie.RecursedCheck;try{return e()}finally{De=s,n.flags&=~ie.RecursedCheck,Xn(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:ie.Watching|ie.RecursedCheck,notify(){const s=this.flags;s&ie.Dirty||s&ie.Pending&&Fa(this.deps,this)?t():this.flags=ie.Watching},stop(){this.flags=ie.None,this.depsTail=void 0,Xn(this)}};return t(),n}var Nn={exports:{}},Cs={},jn={exports:{}},Rs={};var ao;function Kl(){if(ao)return Rs;ao=1;var e=P;function t(d,m){return d===m&&(d!==0||1/d===1/m)||d!==d&&m!==m}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,r=e.useEffect,a=e.useLayoutEffect,i=e.useDebugValue;function c(d,m){var h=m(),p=s({inst:{value:h,getSnapshot:m}}),g=p[0].inst,b=p[1];return a(function(){g.value=h,g.getSnapshot=m,l(g)&&b({inst:g})},[d,h,m]),r(function(){return l(g)&&b({inst:g}),d(function(){l(g)&&b({inst:g})})},[d]),i(h),h}function l(d){var m=d.getSnapshot;d=d.value;try{var h=m();return!n(d,h)}catch{return!0}}function f(d,m){return m()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return Rs.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Rs}var Es={};var io;function Yl(){return io||(io=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}function t(h,p){u||r.startTransition===void 0||(u=!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();a(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,n(x)&&y({inst:x})},[h,g,p]),c(function(){return n(x)&&y({inst:x}),h(function(){n(x)&&y({inst:x})})},[h]),f(g),g}function n(h){var p=h.getSnapshot;h=h.value;try{var g=p();return!a(h,g)}catch{return!0}}function s(h,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=P,a=typeof Object.is=="function"?Object.is:e,i=r.useState,c=r.useEffect,l=r.useLayoutEffect,f=r.useDebugValue,u=!1,d=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?s:t;Es.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Es}var co;function Ba(){return co||(co=1,process.env.NODE_ENV==="production"?jn.exports=Kl():jn.exports=Yl()),jn.exports}var lo;function Jl(){if(lo)return Cs;lo=1;var e=P,t=Ba();function n(f,u){return f===u&&(f!==0||1/f===1/u)||f!==f&&u!==u}var s=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,a=e.useRef,i=e.useEffect,c=e.useMemo,l=e.useDebugValue;return Cs.useSyncExternalStoreWithSelector=function(f,u,d,m,h){var p=a(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=c(function(){function x(k){if(!y){if(y=!0,w=k,k=m(k),h!==void 0&&g.hasValue){var R=g.value;if(h(R,k))return C=R}return C=k}if(R=C,s(w,k))return R;var S=m(k);return h!==void 0&&h(R,S)?(w=k,R):(w=k,C=S)}var y=!1,w,C,E=d===void 0?null:d;return[function(){return x(u())},E===null?void 0:function(){return x(E())}]},[u,d,m,h]);var b=r(f,p[0],p[1]);return i(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},Cs}var ks={};var uo;function Xl(){return uo||(uo=1,process.env.NODE_ENV!=="production"&&(function(){function e(f,u){return f===u&&(f!==0||1/f===1/u)||f!==f&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=P,n=Ba(),s=typeof Object.is=="function"?Object.is:e,r=n.useSyncExternalStore,a=t.useRef,i=t.useEffect,c=t.useMemo,l=t.useDebugValue;ks.useSyncExternalStoreWithSelector=function(f,u,d,m,h){var p=a(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=c(function(){function x(k){if(!y){if(y=!0,w=k,k=m(k),h!==void 0&&g.hasValue){var R=g.value;if(h(R,k))return C=R}return C=k}if(R=C,s(w,k))return R;var S=m(k);return h!==void 0&&h(R,S)?(w=k,R):(w=k,C=S)}var y=!1,w,C,E=d===void 0?null:d;return[function(){return x(u())},E===null?void 0:function(){return x(E())}]},[u,d,m,h]);var b=r(f,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())})()),ks}var fo;function Zl(){return fo||(fo=1,process.env.NODE_ENV==="production"?Nn.exports=Jl():Nn.exports=Xl()),Nn.exports}var Ql=Zl();function ed(e,t){return e===t}function Re(e,t,n=ed){const s=P.useCallback(i=>{if(!e)return()=>{};const{unsubscribe:c}=e.subscribe(i);return c},[e]),r=P.useCallback(()=>e?.get(),[e]);return Ql.useSyncExternalStoreWithSelector(s,r,r,t,n)}var _s={get(){},subscribe(){return{unsubscribe(){}}}};function td(e,t){const n=j.useRef();return s=>{const r=e?.select?e.select(s):s;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=dt(n.current,r):r}}function vt(e){const t=Ae(),n=j.useContext(e.from?zl:cs),s=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),r=td(e,t),a=Re(s??_s,i=>i?r(i):_s);if(a!==_s)return a;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!"}`);Ke()}}function za(e){return vt({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Wa(e){const{select:t,...n}=e;return vt({...n,select:s=>t?t(s.loaderDeps):s.loaderDeps})}function Va(e){return vt({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Ha(e){return vt({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function qa(e){const t=Ae();return j.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Ga(e){return vt({...e,select:t=>e.select?e.select(t.context):t.context})}function nd(e,t){const n=Ae(),s=Dc(t),{activeProps:r,inactiveProps:a,activeOptions:i,to:c,preload:l,preloadDelay:f,preloadIntentProximity:u,hashScrollIntoView:d,replace:m,startTransition:h,resetScroll:p,viewTransition:g,children:b,target:x,disabled:y,style:w,className:C,onClick:E,onBlur:k,onFocus:R,onMouseEnter:S,onMouseLeave:A,onTouchStart:I,ignoreBlocker:v,params:O,search:T,hash:L,state:X,mask:Z,reloadDocument:W,unsafeRelative:le,from:we,_fromLocation:D,..._}=e,U=Ma(),G=j.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),Y=Re(n.stores.location,ae=>ae,(ae,Ne)=>ae.href===Ne.href),K=j.useMemo(()=>{const ae={_fromLocation:Y,...G};return n.buildLocation(ae)},[n,Y,G]),z=K.maskedLocation?K.maskedLocation.publicHref:K.publicHref,H=K.maskedLocation?K.maskedLocation.external:K.external,ne=j.useMemo(()=>cd(z,H,n.history,y),[y,H,z,n.history]),Q=j.useMemo(()=>{if(ne?.external){if(Gn(ne.href,n.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${ne.href}`);return}return ne.href}if(!ld(c)&&!(typeof c!="string"||c.indexOf(":")===-1))try{if(new URL(c),Gn(c,n.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${c}`);return}return c}catch{}},[c,ne,n.protocolAllowlist]),Te=j.useMemo(()=>{if(Q)return!1;if(i?.exact){if(!tl(Y.pathname,K.pathname,n.basepath))return!1}else{const ae=Kn(Y.pathname,n.basepath),Ne=Kn(K.pathname,n.basepath);if(!(ae.startsWith(Ne)&&(ae.length===Ne.length||ae[Ne.length]==="/")))return!1}return(i?.includeSearch??!0)&&!ht(Y.search,K.search,{partial:!i?.exact,ignoreUndefined:!i?.explicitUndefined})?!1:i?.includeHash?U&&Y.hash===K.hash:!0},[i?.exact,i?.explicitUndefined,i?.includeHash,i?.includeSearch,Y,Q,U,K.hash,K.pathname,K.search,n.basepath]),Ee=Te?lt(r,{})??sd:Ps,ue=Te?Ps:lt(a,{})??Ps,Ie=[C,Ee.className,ue.className].filter(Boolean).join(" "),_e=(w||Ee.style||ue.style)&&{...w,...Ee.style,...ue.style},[q,B]=j.useState(!1),se=j.useRef(!1),ee=e.reloadDocument||Q?!1:l??n.options.defaultPreload,oe=f??n.options.defaultPreloadDelay??0,ke=j.useCallback(()=>{n.preloadRoute({...G,_builtLocation:K}).catch(ae=>{console.warn(ae),console.warn(Dl)})},[n,G,K]);Mc(s,j.useCallback(ae=>{ae?.isIntersecting&&ke()},[ke]),id,{disabled:!!y||ee!=="viewport"}),j.useEffect(()=>{se.current||!y&&ee==="render"&&(ke(),se.current=!0)},[y,ke,ee]);const We=ae=>{const Ne=ae.currentTarget.getAttribute("target"),at=x!==void 0?x:Ne;if(!y&&!dd(ae)&&!ae.defaultPrevented&&(!at||at==="_self")&&ae.button===0){ae.preventDefault(),xa.flushSync(()=>{B(!0)});const Tc=n.subscribe("onResolved",()=>{Tc(),B(!1)});n.navigate({...G,replace:m,resetScroll:p,hashScrollIntoView:d,startTransition:h,viewTransition:g,ignoreBlocker:v})}};if(Q)return{..._,ref:s,href:Q,...b&&{children:b},...x&&{target:x},...y&&{disabled:y},...w&&{style:w},...C&&{className:C},...E&&{onClick:E},...k&&{onBlur:k},...R&&{onFocus:R},...S&&{onMouseEnter:S},...A&&{onMouseLeave:A},...I&&{onTouchStart:I}};const ge=ae=>{if(y||ee!=="intent")return;if(!oe){ke();return}const Ne=ae.currentTarget;if(Yt.has(Ne))return;const at=setTimeout(()=>{Yt.delete(Ne),ke()},oe);Yt.set(Ne,at)},gn=ae=>{y||ee!=="intent"||ke()},xn=ae=>{if(y||!ee||!oe)return;const Ne=ae.currentTarget,at=Yt.get(Ne);at&&(clearTimeout(at),Yt.delete(Ne))};return{..._,...Ee,...ue,href:ne?.href,ref:s,onClick:jt([E,We]),onBlur:jt([k,xn]),onFocus:jt([R,ge]),onMouseEnter:jt([S,ge]),onMouseLeave:jt([A,xn]),onTouchStart:jt([I,gn]),disabled:!!y,target:x,..._e&&{style:_e},...Ie&&{className:Ie},...y&&rd,...Te&&od,...U&&q&&ad}}var Ps={},sd={className:"active"},rd={role:"link","aria-disabled":!0},od={"data-status":"active","aria-current":"page"},ad={"data-transitioning":"transitioning"},Yt=new WeakMap,id={rootMargin:"100px"},jt=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function cd(e,t,n,s){if(!s)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function ld(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Zn=j.forwardRef((e,t)=>{const{_asChild:n,...s}=e,{type:r,...a}=nd(s,t),i=typeof s.children=="function"?s.children({isActive:a["data-status"]==="active"}):s.children;if(!n){const{disabled:c,...l}=a;return j.createElement("a",l,i)}return j.createElement(n,a,i)});function dd(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var ud=class extends Ia{constructor(e){super(e),this.useMatch=t=>vt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Ga({...t,from:this.id}),this.useSearch=t=>Ha({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Va({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Wa({...t,from:this.id}),this.useLoaderData=t=>za({...t,from:this.id}),this.useNavigate=()=>qa({from:this.fullPath}),this.Link=P.forwardRef((t,n)=>o.jsx(Zn,{ref:n,from:this.fullPath,...t}))}};function un(e){return new ud(e)}var fd=class extends Fl{constructor(e){super(e),this.useMatch=t=>vt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Ga({...t,from:this.id}),this.useSearch=t=>Ha({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Va({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Wa({...t,from:this.id}),this.useLoaderData=t=>za({...t,from:this.id}),this.useNavigate=()=>qa({from:this.fullPath}),this.Link=P.forwardRef((t,n)=>o.jsx(Zn,{ref:n,from:this.fullPath,...t}))}};function hd(e){return new fd(e)}function md(e){const t=Ae(),n=`not-found-${Re(t.stores.location,s=>s.pathname)}-${Re(t.stores.status,s=>s)}`;return o.jsx(pr,{getResetKey:()=>n,onCatch:(s,r)=>{if(ye(s))e.onCatch?.(s,r);else throw s},errorComponent:({error:s})=>{if(ye(s))return e.fallback?.(s);throw s},children:e.children})}function pd(){return o.jsx("p",{children:"Not Found"})}function Tt(e){return o.jsx(o.Fragment,{children:e.children})}function Ka(e,t,n){return t.options.notFoundComponent?o.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?o.jsx(e.options.defaultNotFoundComponent,{...n}):(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>)`)),o.jsx(pd,{}))}function gd(e){return null}function xd(){return gd(Ae()),null}var bd=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,yd=(e,t)=>e[0]===t[0]&&e[1]===t[1],Ya=j.memo(function({matchId:t}){const n=Ae(),s=n.stores.matchStores.get(t);if(!s){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find match for matchId "${t}". Please file an issue!`);Ke()}const r=Re(n.stores.loadedAt,i=>i),a=Re(s,i=>i,bd);return o.jsx(vd,{router:n,matchId:t,resetKey:r,matchState:j.useMemo(()=>{const i=a.routeId,c=n.routesById[i].parentRoute?.id;return{routeId:i,ssr:a.ssr,_displayPending:a._displayPending,parentRouteId:c}},[a._displayPending,a.routeId,a.ssr,n.routesById])})});function vd({router:e,matchId:t,resetKey:n,matchState:s}){const r=e.routesById[s.routeId],a=r.options.pendingComponent??e.options.defaultPendingComponent,i=a?o.jsx(a,{}):null,c=r.options.errorComponent??e.options.defaultErrorComponent,l=r.options.onCatch??e.options.defaultOnCatch,f=r.isRoot?r.options.notFoundComponent??e.options.notFoundRoute?.options.component:r.options.notFoundComponent,u=s.ssr===!1||s.ssr==="data-only",d=(!r.isRoot||r.options.wrapInSuspense||u)&&(r.options.wrapInSuspense??a??(r.options.errorComponent?.preload||u))?j.Suspense:Tt,m=c?pr:Tt,h=f?md:Tt;return o.jsxs(r.isRoot?r.options.shellComponent??Tt:Tt,{children:[o.jsx(cs.Provider,{value:t,children:o.jsx(d,{fallback:i,children:o.jsx(m,{getResetKey:()=>n,errorComponent:c||gr,onCatch:(p,g)=>{if(ye(p))throw p.routeId??=s.routeId,p;process.env.NODE_ENV!=="production"&&console.warn(`Warning: Error in route match: ${t}`),l?.(p,g)},children:o.jsx(h,{fallback:p=>{if(p.routeId??=s.routeId,!f||p.routeId&&p.routeId!==s.routeId||!p.routeId&&!r.isRoot)throw p;return j.createElement(f,p)},children:u||s._displayPending?o.jsx(Ul,{fallback:i,children:o.jsx(ho,{matchId:t})}):o.jsx(ho,{matchId:t})})})})}),s.parentRouteId===mt?o.jsxs(o.Fragment,{children:[o.jsx(wd,{}),e.options.scrollRestoration&&va?o.jsx(xd,{}):null]}):null]})}function wd(){const e=Ae(),t=j.useRef();return nn(()=>{const n=e.stores.resolvedLocation.get(),s=t.current;n&&(!s||s.href!==n.href)&&e.emit({type:"onRendered",...Ot(e.stores.location.get(),s??n)}),t.current=n},[Re(e.stores.resolvedLocation,n=>n?.state.__TSR_key),e]),null}var ho=j.memo(function({matchId:t}){const n=Ae(),s=(u,d)=>n.getMatch(u.id)?._nonReactive[d]??u._nonReactive[d],r=n.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!`);Ke()}const a=Re(r,u=>u),i=a.routeId,c=n.routesById[i],l=j.useMemo(()=>{const u=(n.routesById[i].options.remountDeps??n.options.defaultRemountDeps)?.({routeId:i,loaderDeps:a.loaderDeps,params:a._strictParams,search:a._strictSearch});return u?JSON.stringify(u):void 0},[i,a.loaderDeps,a._strictParams,a._strictSearch,n.options.defaultRemountDeps,n.routesById]),f=j.useMemo(()=>{const u=c.options.component??n.options.defaultComponent;return u?o.jsx(u,{},l):o.jsx(Ja,{})},[l,c.options.component,n.options.defaultComponent]);if(a._displayPending)throw s(a,"displayPendingPromise");if(a._forcePending)throw s(a,"minPendingPromise");if(a.status==="pending"){const u=c.options.pendingMinMs??n.options.defaultPendingMinMs;if(u){const d=n.getMatch(a.id);if(d&&!d._nonReactive.minPendingPromise){const m=It();d._nonReactive.minPendingPromise=m,setTimeout(()=>{m.resolve(),d._nonReactive.minPendingPromise=void 0},u)}}throw s(a,"loadPromise")}if(a.status==="notFound"){if(!ye(a.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a notFound error");Ke()}return Ka(n,c,a.error)}if(a.status==="redirected"){if(!je(a.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a redirect error");Ke()}throw s(a,"loadPromise")}if(a.status==="error")throw a.error;return f}),Ja=j.memo(function(){const t=Ae(),n=j.useContext(cs);let s,r=!1,a;{const f=n?t.stores.matchStores.get(n):void 0;[s,r]=Re(f,u=>[u?.routeId,u?.globalNotFound??!1],yd),a=Re(t.stores.matchesId,u=>u[u.findIndex(d=>d===n)+1])}const i=s?t.routesById[s]:void 0,c=t.options.defaultPendingComponent?o.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");Ke()}return Ka(t,i,void 0)}if(!a)return null;const l=o.jsx(Ya,{matchId:a});return s===mt?o.jsx(j.Suspense,{fallback:c,children:l}):l});function Sd(){const e=Ae(),t=j.useRef({router:e,mounted:!1}),[n,s]=j.useState(!1),r=Re(e.stores.isLoading,d=>d),a=Re(e.stores.hasPending,d=>d),i=bs(r),c=r||n||a,l=bs(c),f=r||a,u=bs(f);return e.startTransition=d=>{s(!0),j.startTransition(()=>{d(),s(!1)})},j.useEffect(()=>{const d=e.history.subscribe(e.load),m=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return qe(e.latestLocation.publicHref)!==qe(m.publicHref)&&e.commitLocation({...m,replace:!0}),()=>{d()}},[e,e.history]),nn(()=>{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(m){console.error(m)}})()},[e]),nn(()=>{i&&!r&&e.emit({type:"onLoad",...Ot(e.stores.location.get(),e.stores.resolvedLocation.get())})},[i,e,r]),nn(()=>{u&&!f&&e.emit({type:"onBeforeRouteMount",...Ot(e.stores.location.get(),e.stores.resolvedLocation.get())})},[f,u,e]),nn(()=>{if(l&&!c){const d=Ot(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...d}),$a(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())})}},[c,l,e]),null}function Nd(){const e=Ae(),t=e.routesById[mt].options.pendingComponent??e.options.defaultPendingComponent,n=t?o.jsx(t,{}):null,s=o.jsxs(typeof document<"u"&&e.ssr?Tt:j.Suspense,{fallback:n,children:[o.jsx(Sd,{}),o.jsx(jd,{})]});return e.options.InnerWrap?o.jsx(e.options.InnerWrap,{children:s}):s}function jd(){const e=Ae(),t=Re(e.stores.firstId,r=>r),n=Re(e.stores.loadedAt,r=>r),s=t?o.jsx(Ya,{matchId:t}):null;return o.jsx(cs.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?s:o.jsx(pr,{getResetKey:()=>n,errorComponent:gr,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:s})})}var Cd=e=>({createMutableStore:oo,createReadonlyStore:oo,batch:$a}),Xa=e=>new Rd(e),Rd=class extends Nl{constructor(e){super(e,Cd)}};function Ed({router:e,children:t,...n}){Sa(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const s=o.jsx(Da.Provider,{value:e,children:t});return e.options.Wrap?o.jsx(e.options.Wrap,{children:s}):s}function kd({router:e,...t}){return o.jsx(Ed,{router:e,...t,children:o.jsx(Nd,{})})}function Za(e,t){return function(){return e.apply(t,arguments)}}const{toString:_d}=Object.prototype,{getPrototypeOf:Mt}=Object,{iterator:fn,toStringTag:Qa}=Symbol,Qn=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),cn=(e,t)=>{let n=e;const s=[];for(;n!=null&&n!==Object.prototype;){if(s.indexOf(n)!==-1)return!1;if(s.push(n),Qn(n,t))return!0;n=Mt(n)}return!1},Pd=(e,t)=>e!=null&&cn(e,t)?e[t]:void 0,xr=(e=>t=>{const n=_d.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Oe=e=>(e=e.toLowerCase(),t=>xr(t)===e),ls=e=>t=>typeof t===e,{isArray:xt}=Array,Dt=ls("undefined");function Bt(e){return e!==null&&!Dt(e)&&e.constructor!==null&&!Dt(e.constructor)&&Ce(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ei=Oe("ArrayBuffer");function Ad(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ei(e.buffer),t}const Td=ls("string"),Ce=ls("function"),ti=ls("number"),zt=e=>e!==null&&typeof e=="object",Od=e=>e===!0||e===!1,Bn=e=>{if(!zt(e))return!1;const t=Mt(e);return(t===null||t===Object.prototype||Mt(t)===null)&&!cn(e,Qa)&&!cn(e,fn)},Ld=e=>{if(!zt(e)||Bt(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Id=Oe("Date"),Md=Oe("File"),Dd=e=>!!(e&&typeof e.uri<"u"),Fd=e=>e&&typeof e.getParts<"u",$d=Oe("Blob"),Ud=Oe("FileList"),Bd=e=>zt(e)&&Ce(e.pipe);function zd(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const mo=zd(),po=typeof mo.FormData<"u"?mo.FormData:void 0,Wd=e=>{if(!e)return!1;if(po&&e instanceof po)return!0;const t=Mt(e);if(!t||t===Object.prototype||!Ce(e.append))return!1;const n=xr(e);return n==="formdata"||n==="object"&&Ce(e.toString)&&e.toString()==="[object FormData]"},Vd=Oe("URLSearchParams"),[Hd,qd,Gd,Kd]=["ReadableStream","Request","Response","Headers"].map(Oe),Yd=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function hn(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,r;if(typeof e!="object"&&(e=[e]),xt(e))for(s=0,r=e.length;s<r;s++)t.call(null,e[s],s,e);else{if(Bt(e))return;const a=n?Object.getOwnPropertyNames(e):Object.keys(e),i=a.length;let c;for(s=0;s<i;s++)c=a[s],t.call(null,e[c],c,e)}}function ni(e,t){if(Bt(e))return null;t=t.toLowerCase();const n=Object.keys(e);let s=n.length,r;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const ft=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,si=e=>!Dt(e)&&e!==ft;function tr(...e){const{caseless:t,skipUndefined:n}=si(this)&&this||{},s={},r=(a,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const c=t&&typeof i=="string"&&ni(s,i)||i,l=Qn(s,c)?s[c]:void 0;Bn(l)&&Bn(a)?s[c]=tr(l,a):Bn(a)?s[c]=tr({},a):xt(a)?s[c]=a.slice():(!n||!Dt(a))&&(s[c]=a)};for(let a=0,i=e.length;a<i;a++){const c=e[a];if(!c||Bt(c)||(hn(c,r),typeof c!="object"||xt(c)))continue;const l=Object.getOwnPropertySymbols(c);for(let f=0;f<l.length;f++){const u=l[f];iu.call(c,u)&&r(c[u],u)}}return s}const Jd=(e,t,n,{allOwnKeys:s}={})=>(hn(t,(r,a)=>{n&&Ce(r)?Object.defineProperty(e,a,{__proto__:null,value:Za(r,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,a,{__proto__:null,value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),e),Xd=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Zd=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},Qd=(e,t,n,s)=>{let r,a,i;const c={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),a=r.length;a-- >0;)i=r[a],(!s||s(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&Mt(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},eu=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},tu=e=>{if(!e)return null;if(xt(e))return e;let t=e.length;if(!ti(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},nu=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Mt(Uint8Array)),su=(e,t)=>{const s=(e&&e[fn]).call(e);let r;for(;(r=s.next())&&!r.done;){const a=r.value;t.call(e,a[0],a[1])}},ru=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},ou=Oe("HTMLFormElement"),au=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,r){return s.toUpperCase()+r}),{propertyIsEnumerable:iu}=Object.prototype,cu=Oe("RegExp"),ri=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};hn(n,(r,a)=>{let i;(i=t(r,a,e))!==!1&&(s[a]=i||r)}),Object.defineProperties(e,s)},lu=e=>{ri(e,(t,n)=>{if(Ce(e)&&["arguments","caller","callee"].includes(n))return!1;const s=e[n];if(Ce(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},du=(e,t)=>{const n={},s=r=>{r.forEach(a=>{n[a]=!0})};return xt(e)?s(e):s(String(e).split(t)),n},uu=()=>{},fu=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function hu(e){return!!(e&&Ce(e.append)&&e[Qa]==="FormData"&&e[fn])}const mu=e=>{const t=new WeakSet,n=s=>{if(zt(s)){if(t.has(s))return;if(Bt(s))return s;if(!("toJSON"in s)){t.add(s);const r=xt(s)?[]:{};return hn(s,(a,i)=>{const c=n(a);!Dt(c)&&(r[i]=c)}),t.delete(s),r}}return s};return n(e)},pu=Oe("AsyncFunction"),gu=e=>e&&(zt(e)||Ce(e))&&Ce(e.then)&&Ce(e.catch),oi=((e,t)=>e?setImmediate:t?((n,s)=>(ft.addEventListener("message",({source:r,data:a})=>{r===ft&&a===n&&s.length&&s.shift()()},!1),r=>{s.push(r),ft.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ce(ft.postMessage)),xu=typeof queueMicrotask<"u"?queueMicrotask.bind(ft):typeof process<"u"&&process.nextTick||oi,ai=e=>e!=null&&Ce(e[fn]),bu=e=>e!=null&&cn(e,fn)&&ai(e),N={isArray:xt,isArrayBuffer:ei,isBuffer:Bt,isFormData:Wd,isArrayBufferView:Ad,isString:Td,isNumber:ti,isBoolean:Od,isObject:zt,isPlainObject:Bn,isEmptyObject:Ld,isReadableStream:Hd,isRequest:qd,isResponse:Gd,isHeaders:Kd,isUndefined:Dt,isDate:Id,isFile:Md,isReactNativeBlob:Dd,isReactNative:Fd,isBlob:$d,isRegExp:cu,isFunction:Ce,isStream:Bd,isURLSearchParams:Vd,isTypedArray:nu,isFileList:Ud,forEach:hn,merge:tr,extend:Jd,trim:Yd,stripBOM:Xd,inherits:Zd,toFlatObject:Qd,kindOf:xr,kindOfTest:Oe,endsWith:eu,toArray:tu,forEachEntry:su,matchAll:ru,isHTMLForm:ou,hasOwnProperty:Qn,hasOwnProp:Qn,hasOwnInPrototypeChain:cn,getSafeProp:Pd,reduceDescriptors:ri,freezeMethods:lu,toObjectSet:du,toCamelCase:au,noop:uu,toFiniteNumber:fu,findKey:ni,global:ft,isContextDefined:si,isSpecCompliantForm:hu,toJSONObject:mu,isAsyncFn:pu,isThenable:gu,setImmediate:oi,asap:xu,isIterable:ai,isSafeIterable:bu},yu=N.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"]),vu=e=>{const t={};let n,s,r;return e&&e.split(`
7
+ `).forEach(function(i){r=i.indexOf(":"),n=i.substring(0,r).trim().toLowerCase(),s=i.substring(r+1).trim(),!(!n||t[n]&&yu[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t};function wu(e){let t=0,n=e.length;for(;t<n;){const s=e.charCodeAt(t);if(s!==9&&s!==32)break;t+=1}for(;n>t;){const s=e.charCodeAt(n-1);if(s!==9&&s!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}const Su=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Nu=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function br(e,t){return N.isArray(e)?e.map(n=>br(n,t)):wu(String(e).replace(t,""))}const ju=e=>br(e,Su),Cu=e=>br(e,Nu);function ii(e){const t=Object.create(null);return N.forEach(e.toJSON(),(n,s)=>{t[s]=Cu(n)}),t}const go=Symbol("internals");function Jt(e){return e&&String(e).trim().toLowerCase()}function zn(e){return e===!1||e==null?e:N.isArray(e)?e.map(zn):ju(String(e))}function Ru(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(e);)t[s[1]]=s[2];return t}const Eu=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function As(e,t,n,s,r){if(N.isFunction(s))return s.call(this,t,n);if(r&&(t=n),!!N.isString(t)){if(N.isString(s))return t.indexOf(s)!==-1;if(N.isRegExp(s))return s.test(t)}}function ku(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function _u(e,t){const n=N.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+n,{__proto__:null,value:function(r,a,i){return this[s].call(this,t,r,a,i)},configurable:!0})})}let ve=class{constructor(t){t&&this.set(t)}set(t,n,s){const r=this;function a(c,l,f){const u=Jt(l);if(!u)return;const d=N.findKey(r,u);(!d||r[d]===void 0||f===!0||f===void 0&&r[d]!==!1)&&(r[d||l]=zn(c))}const i=(c,l)=>N.forEach(c,(f,u)=>a(f,u,l));if(N.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(N.isString(t)&&(t=t.trim())&&!Eu(t))i(vu(t),n);else if(N.isObject(t)&&N.isSafeIterable(t)){let c=Object.create(null),l,f;for(const u of t){if(!N.isArray(u))throw new TypeError("Object iterator must return a key-value pair");f=u[0],N.hasOwnProp(c,f)?(l=c[f],c[f]=N.isArray(l)?[...l,u[1]]:[l,u[1]]):c[f]=u[1]}i(c,n)}else t!=null&&a(n,t,s);return this}get(t,n){if(t=Jt(t),t){const s=N.findKey(this,t);if(s){const r=this[s];if(!n)return r;if(n===!0)return Ru(r);if(N.isFunction(n))return n.call(this,r,s);if(N.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Jt(t),t){const s=N.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||As(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let r=!1;function a(i){if(i=Jt(i),i){const c=N.findKey(s,i);c&&(!n||As(s,s[c],c,n))&&(delete s[c],r=!0)}}return N.isArray(t)?t.forEach(a):a(t),r}clear(t){const n=Object.keys(this);let s=n.length,r=!1;for(;s--;){const a=n[s];(!t||As(this,this[a],a,t,!0))&&(delete this[a],r=!0)}return r}normalize(t){const n=this,s={};return N.forEach(this,(r,a)=>{const i=N.findKey(s,a);if(i){n[i]=zn(r),delete n[a];return}const c=t?ku(a):String(a).trim();c!==a&&delete n[a],n[c]=zn(r),s[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return N.forEach(this,(s,r)=>{s!=null&&s!==!1&&(n[r]=t&&N.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).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,...n){const s=new this(t);return n.forEach(r=>s.set(r)),s}static accessor(t){const s=(this[go]=this[go]={accessors:{}}).accessors,r=this.prototype;function a(i){const c=Jt(i);s[c]||(_u(r,i),s[c]=!0)}return N.isArray(t)?t.forEach(a):a(t),this}};ve.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);N.reduceDescriptors(ve.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}});N.freezeMethods(ve);const Pu="[REDACTED ****]";function Au(e){if(N.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(N.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Tu(e,t){const n=new Set(t.map(a=>String(a).toLowerCase())),s=[],r=a=>{if(a===null||typeof a!="object"||N.isBuffer(a))return a;if(s.indexOf(a)!==-1)return;a instanceof ve&&(a=a.toJSON()),s.push(a);let i;if(N.isArray(a))i=[],a.forEach((c,l)=>{const f=r(c);N.isUndefined(f)||(i[l]=f)});else{if(!N.isPlainObject(a)&&Au(a))return s.pop(),a;i=Object.create(null);for(const[c,l]of Object.entries(a)){const f=n.has(c.toLowerCase())?Pu:r(l);N.isUndefined(f)||(i[c]=f)}}return s.pop(),i};return r(e)}let M=class ci extends Error{static from(t,n,s,r,a,i){const c=new ci(t.message,n||t.code,s,r,a);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,n,s,r,a){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),s&&(this.config=s),r&&(this.request=r),a&&(this.response=a,this.status=a.status)}toJSON(){const t=this.config,n=t&&N.hasOwnProp(t,"redact")?t.redact:void 0,s=N.isArray(n)&&n.length>0?Tu(t,n):N.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:s,code:this.code,status:this.status}}};M.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";M.ERR_BAD_OPTION="ERR_BAD_OPTION";M.ECONNABORTED="ECONNABORTED";M.ETIMEDOUT="ETIMEDOUT";M.ECONNREFUSED="ECONNREFUSED";M.ERR_NETWORK="ERR_NETWORK";M.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";M.ERR_DEPRECATED="ERR_DEPRECATED";M.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";M.ERR_BAD_REQUEST="ERR_BAD_REQUEST";M.ERR_CANCELED="ERR_CANCELED";M.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";M.ERR_INVALID_URL="ERR_INVALID_URL";M.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Ou=null,li=100;function nr(e){return N.isPlainObject(e)||N.isArray(e)}function di(e){return N.endsWith(e,"[]")?e.slice(0,-2):e}function Ts(e,t,n){return e?e.concat(t).map(function(r,a){return r=di(r),!n&&a?"["+r+"]":r}).join(n?".":""):t}function Lu(e){return N.isArray(e)&&!e.some(nr)}const Iu=N.toFlatObject(N,{},null,function(t){return/^is[A-Z]/.test(t)});function ds(e,t,n){if(!N.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=N.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,w){return!N.isUndefined(w[y])});const s=n.metaTokens,r=n.visitor||p,a=n.dots,i=n.indexes,c=n.Blob||typeof Blob<"u"&&Blob,l=n.maxDepth===void 0?li:n.maxDepth,f=c&&N.isSpecCompliantForm(t),u=[];if(!N.isFunction(r))throw new TypeError("visitor must be a function");function d(x){if(x===null)return"";if(N.isDate(x))return x.toISOString();if(N.isBoolean(x))return x.toString();if(!f&&N.isBlob(x))throw new M("Blob is not supported. Use a Buffer instead.");if(N.isArrayBuffer(x)||N.isTypedArray(x)){if(f&&typeof c=="function")return new c([x]);if(typeof Buffer<"u")return Buffer.from(x);throw new M("Blob is not supported. Use a Buffer instead.",M.ERR_NOT_SUPPORT)}return x}function m(x){if(x>l)throw new M("Object is too deeply nested ("+x+" levels). Max depth: "+l,M.ERR_FORM_DATA_DEPTH_EXCEEDED)}function h(x,y){if(l===1/0)return JSON.stringify(x);const w=[];return JSON.stringify(x,function(E,k){if(!N.isObject(k))return k;for(;w.length&&w[w.length-1]!==this;)w.pop();return w.push(k),m(y+w.length-1),k})}function p(x,y,w){let C=x;if(N.isReactNative(t)&&N.isReactNativeBlob(x))return t.append(Ts(w,y,a),d(x)),!1;if(x&&!w&&typeof x=="object"){if(N.endsWith(y,"{}"))y=s?y:y.slice(0,-2),x=h(x,1);else if(N.isArray(x)&&Lu(x)||(N.isFileList(x)||N.endsWith(y,"[]"))&&(C=N.toArray(x)))return y=di(y),C.forEach(function(k,R){!(N.isUndefined(k)||k===null)&&t.append(i===!0?Ts([y],R,a):i===null?y:y+"[]",d(k))}),!1}return nr(x)?!0:(t.append(Ts(w,y,a),d(x)),!1)}const g=Object.assign(Iu,{defaultVisitor:p,convertValue:d,isVisitable:nr});function b(x,y,w=0){if(!N.isUndefined(x)){if(m(w),u.indexOf(x)!==-1)throw new Error("Circular reference detected in "+y.join("."));u.push(x),N.forEach(x,function(E,k){(!(N.isUndefined(E)||E===null)&&r.call(t,E,N.isString(k)?k.trim():k,y,g))===!0&&b(E,y?y.concat(k):[k],w+1)}),u.pop()}}if(!N.isObject(e))throw new TypeError("data must be an object");return b(e),t}function xo(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(s){return t[s]})}function yr(e,t){this._pairs=[],e&&ds(e,this,t)}const ui=yr.prototype;ui.append=function(t,n){this._pairs.push([t,n])};ui.toString=function(t){const n=t?s=>t.call(this,s,xo):xo;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function Mu(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function fi(e,t,n){if(!t)return e;e=e||"";const s=N.isFunction(n)?{serialize:n}:n,r=N.getSafeProp(s,"encode")||Mu,a=N.getSafeProp(s,"serialize");let i;if(a?i=a(t,s):i=N.isURLSearchParams(t)?t.toString():new yr(t,s).toString(r),i){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class bo{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){N.forEach(this.handlers,function(s){s!==null&&t(s)})}}const vr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Du=typeof URLSearchParams<"u"?URLSearchParams:yr,Fu=typeof FormData<"u"?FormData:null,$u=typeof Blob<"u"?Blob:null,Uu={isBrowser:!0,classes:{URLSearchParams:Du,FormData:Fu,Blob:$u},protocols:["http","https","file","blob","url","data"]},wr=typeof window<"u"&&typeof document<"u",sr=typeof navigator=="object"&&navigator||void 0,Bu=wr&&(!sr||["ReactNative","NativeScript","NS"].indexOf(sr.product)<0),zu=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Wu=wr&&window.location.href||"http://localhost",Vu=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:wr,hasStandardBrowserEnv:Bu,hasStandardBrowserWebWorkerEnv:zu,navigator:sr,origin:Wu},Symbol.toStringTag,{value:"Module"})),pe={...Vu,...Uu};function Hu(e,t){return ds(e,new pe.classes.URLSearchParams,{visitor:function(n,s,r,a){return pe.isNode&&N.isBuffer(n)?(this.append(s,n.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}const yo=li;function hi(e){if(e>yo)throw new M("FormData field is too deeply nested ("+e+" levels). Max depth: "+yo,M.ERR_FORM_DATA_DEPTH_EXCEEDED)}function qu(e){const t=[],n=/\w+|\[(\w*)]/g;let s;for(;(s=n.exec(e))!==null;)hi(t.length),t.push(s[0]==="[]"?"":s[1]||s[0]);return t}function Gu(e){const t={},n=Object.keys(e);let s;const r=n.length;let a;for(s=0;s<r;s++)a=n[s],t[a]=e[a];return t}function mi(e){function t(n,s,r,a){hi(a);let i=n[a++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),l=a>=n.length;return i=!i&&N.isArray(r)?r.length:i,l?(N.hasOwnProp(r,i)?r[i]=N.isArray(r[i])?r[i].concat(s):[r[i],s]:r[i]=s,!c):((!N.hasOwnProp(r,i)||!N.isObject(r[i]))&&(r[i]=[]),t(n,s,r[i],a)&&N.isArray(r[i])&&(r[i]=Gu(r[i])),!c)}if(N.isFormData(e)&&N.isFunction(e.entries)){const n={};return N.forEachEntry(e,(s,r)=>{t(qu(s),r,n,0)}),n}return null}const Ct=(e,t)=>e!=null&&N.hasOwnProp(e,t)?e[t]:void 0;function Ku(e,t,n){if(N.isString(e))try{return(t||JSON.parse)(e),N.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const mn={transitional:vr,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",r=s.indexOf("application/json")>-1,a=N.isObject(t);if(a&&N.isHTMLForm(t)&&(t=new FormData(t)),N.isFormData(t))return r?JSON.stringify(mi(t)):t;if(N.isArrayBuffer(t)||N.isBuffer(t)||N.isStream(t)||N.isFile(t)||N.isBlob(t)||N.isReadableStream(t))return t;if(N.isArrayBufferView(t))return t.buffer;if(N.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){const l=Ct(this,"formSerializer");if(s.indexOf("application/x-www-form-urlencoded")>-1)return Hu(t,l).toString();if((c=N.isFileList(t))||s.indexOf("multipart/form-data")>-1){const f=Ct(this,"env"),u=f&&f.FormData;return ds(c?{"files[]":t}:t,u&&new u,l)}}return a||r?(n.setContentType("application/json",!1),Ku(t)):t}],transformResponse:[function(t){const n=Ct(this,"transitional")||mn.transitional,s=n&&n.forcedJSONParsing,r=Ct(this,"responseType"),a=r==="json";if(N.isResponse(t)||N.isReadableStream(t))return t;if(t&&N.isString(t)&&(s&&!r||a)){const c=!(n&&n.silentJSONParsing)&&a;try{return JSON.parse(t,Ct(this,"parseReviver"))}catch(l){if(c)throw l.name==="SyntaxError"?M.from(l,M.ERR_BAD_RESPONSE,this,null,Ct(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pe.classes.FormData,Blob:pe.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};N.forEach(["delete","get","head","post","put","patch","query"],e=>{mn.headers[e]={}});function Os(e,t){const n=this||mn,s=t||n,r=ve.from(s.headers);let a=s.data;return N.forEach(e,function(c){a=c.call(n,a,r.normalize(),t?t.status:void 0)}),r.normalize(),a}function pi(e){return!!(e&&e.__CANCEL__)}let pn=class extends M{constructor(t,n,s){super(t??"canceled",M.ERR_CANCELED,n,s),this.name="CanceledError",this.__CANCEL__=!0}};function gi(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new M("Request failed with status code "+n.status,n.status>=400&&n.status<500?M.ERR_BAD_REQUEST:M.ERR_BAD_RESPONSE,n.config,n.request,n))}function Yu(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Ju(e,t){e=e||10;const n=new Array(e),s=new Array(e);let r=0,a=0,i;return t=t!==void 0?t:1e3,function(l){const f=Date.now(),u=s[a];i||(i=f),n[r]=l,s[r]=f;let d=a,m=0;for(;d!==r;)m+=n[d++],d=d%e;if(r=(r+1)%e,r===a&&(a=(a+1)%e),f-i<t)return;const h=u&&f-u;return h?Math.round(m*1e3/h):void 0}}function Xu(e,t){let n=0,s=1e3/t,r,a;const i=(f,u=Date.now())=>{n=u,r=null,a&&(clearTimeout(a),a=null),e(...f)};return[(...f)=>{const u=Date.now(),d=u-n;d>=s?i(f,u):(r=f,a||(a=setTimeout(()=>{a=null,i(r)},s-d)))},()=>r&&i(r)]}const es=(e,t,n=3)=>{let s=0;const r=Ju(50,250);return Xu(a=>{if(!a||typeof a.loaded!="number")return;const i=a.loaded,c=a.lengthComputable?a.total:void 0,l=c!=null?Math.min(i,c):i,f=Math.max(0,l-s),u=r(f);s=Math.max(s,l);const d={loaded:l,total:c,progress:c?l/c:void 0,bytes:f,rate:u||void 0,estimated:u&&c?(c-l)/u:void 0,event:a,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(d)},n)},vo=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},wo=e=>(...t)=>N.asap(()=>e(...t)),Zu=pe.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,pe.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(pe.origin),pe.navigator&&/(msie|trident)/i.test(pe.navigator.userAgent)):()=>!0,Qu=pe.hasStandardBrowserEnv?{write(e,t,n,s,r,a,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];N.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),N.isString(s)&&c.push(`path=${s}`),N.isString(r)&&c.push(`domain=${r}`),a===!0&&c.push("secure"),N.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 n=0;n<t.length;n++){const s=t[n].replace(/^\s+/,""),r=s.indexOf("=");if(r!==-1&&s.slice(0,r)===e)try{return decodeURIComponent(s.slice(r+1))}catch{return s.slice(r+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function ef(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function tf(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const nf=/^https?:(?!\/\/)/i,sf=/[\t\n\r]/g;function rf(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function of(e){return rf(e).replace(sf,"")}function So(e,t){if(typeof e=="string"&&nf.test(of(e)))throw new M('Invalid URL: missing "//" after protocol',M.ERR_INVALID_URL,t)}function xi(e,t,n,s){So(t,s);let r=!ef(t);return e&&(r||n===!1)?(So(e,s),tf(e,t)):t}const No=e=>e instanceof ve?{...e}:e;function bt(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function s(u,d,m,h){return N.isPlainObject(u)&&N.isPlainObject(d)?N.merge.call({caseless:h},u,d):N.isPlainObject(d)?N.merge({},d):N.isArray(d)?d.slice():d}function r(u,d,m,h){if(N.isUndefined(d)){if(!N.isUndefined(u))return s(void 0,u,m,h)}else return s(u,d,m,h)}function a(u,d){if(!N.isUndefined(d))return s(void 0,d)}function i(u,d){if(N.isUndefined(d)){if(!N.isUndefined(u))return s(void 0,u)}else return s(void 0,d)}function c(u){const d=N.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!N.isUndefined(d))if(N.isPlainObject(d)){if(N.hasOwnProp(d,u))return d[u]}else return;const m=N.hasOwnProp(e,"transitional")?e.transitional:void 0;if(N.isPlainObject(m)&&N.hasOwnProp(m,u))return m[u]}function l(u,d,m){if(N.hasOwnProp(t,m))return s(u,d);if(N.hasOwnProp(e,m))return s(void 0,u)}const f={url:a,method:a,data:a,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:(u,d,m)=>r(No(u),No(d),m,!0)};return N.forEach(Object.keys({...e,...t}),function(d){if(d==="__proto__"||d==="constructor"||d==="prototype")return;const m=N.hasOwnProp(f,d)?f[d]:r,h=N.hasOwnProp(e,d)?e[d]:void 0,p=N.hasOwnProp(t,d)?t[d]:void 0,g=m(h,p,d);N.isUndefined(g)&&m!==l||(n[d]=g)}),N.hasOwnProp(t,"validateStatus")&&N.isUndefined(t.validateStatus)&&c("validateStatusUndefinedResolves")===!1&&(N.hasOwnProp(e,"validateStatus")?n.validateStatus=s(void 0,e.validateStatus):delete n.validateStatus),n}const af=["content-type","content-length"];function cf(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([s,r])=>{af.includes(s.toLowerCase())&&e.set(s,r)})}const lf=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function bi(e){const t=bt({},e),n=m=>N.hasOwnProp(t,m)?t[m]:void 0,s=n("data");let r=n("withXSRFToken");const a=n("xsrfHeaderName"),i=n("xsrfCookieName");let c=n("headers");const l=n("auth"),f=n("baseURL"),u=n("allowAbsoluteUrls"),d=n("url");if(t.headers=c=ve.from(c),t.url=fi(xi(f,d,u,t),n("params"),n("paramsSerializer")),l){const m=N.getSafeProp(l,"username")||"",h=N.getSafeProp(l,"password")||"";try{c.set("Authorization","Basic "+btoa(m+":"+(h?lf(h):"")))}catch(p){throw M.from(p,M.ERR_BAD_OPTION_VALUE,e)}}if(N.isFormData(s)&&(pe.hasStandardBrowserEnv||pe.hasStandardBrowserWebWorkerEnv||N.isReactNative(s)?c.setContentType(void 0):N.isFunction(s.getHeaders)&&cf(c,s.getHeaders(),n("formDataHeaderPolicy"))),pe.hasStandardBrowserEnv&&(N.isFunction(r)&&(r=r(t)),r===!0||r==null&&Zu(t.url))){const h=a&&i&&Qu.read(i);h&&c.set(a,h)}return t}const df=typeof XMLHttpRequest<"u",uf=df&&function(e){return new Promise(function(n,s){const r=bi(e);let a=r.data;const i=ve.from(r.headers).normalize();let{responseType:c,onUploadProgress:l,onDownloadProgress:f}=r,u,d,m,h,p;function g(){h&&h(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(r.method.toUpperCase(),r.url,!0),b.timeout=r.timeout;function x(){if(!b)return;const w=ve.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),E={data:!c||c==="text"||c==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:w,config:e,request:b};gi(function(R){n(R),g()},function(R){s(R),g()},E),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&&(s(new M("Request aborted",M.ECONNABORTED,e,b)),g(),b=null)},b.onerror=function(C){const E=C&&C.message?C.message:"Network Error",k=new M(E,M.ERR_NETWORK,e,b);k.event=C||null,s(k),g(),b=null},b.ontimeout=function(){let C=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const E=r.transitional||vr;r.timeoutErrorMessage&&(C=r.timeoutErrorMessage),s(new M(C,E.clarifyTimeoutError?M.ETIMEDOUT:M.ECONNABORTED,e,b)),g(),b=null},a===void 0&&i.setContentType(null),"setRequestHeader"in b&&N.forEach(ii(i),function(C,E){b.setRequestHeader(E,C)}),N.isUndefined(r.withCredentials)||(b.withCredentials=!!r.withCredentials),c&&c!=="json"&&(b.responseType=r.responseType),f&&([m,p]=es(f,!0),b.addEventListener("progress",m)),l&&b.upload&&([d,h]=es(l),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",h)),(r.cancelToken||r.signal)&&(u=w=>{b&&(s(!w||w.type?new pn(null,e,b):w),b.abort(),g(),b=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const y=Yu(r.url);if(y&&!pe.protocols.includes(y)){s(new M("Unsupported protocol "+y+":",M.ERR_BAD_REQUEST,e)),g();return}b.send(a||null)})},ff=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let s=!1;const r=function(l){if(!s){s=!0,i();const f=l instanceof Error?l:this.reason;n.abort(f instanceof M?f:new pn(f instanceof Error?f.message:f))}};let a=t&&setTimeout(()=>{a=null,r(new M(`timeout of ${t}ms exceeded`,M.ETIMEDOUT))},t);const i=()=>{e&&(a&&clearTimeout(a),a=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}=n;return c.unsubscribe=()=>N.asap(i),c},hf=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let s=0,r;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},mf=async function*(e,t){for await(const n of pf(e))yield*hf(n,t)},pf=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:s}=await t.read();if(n)break;yield s}}finally{await t.cancel()}},jo=(e,t,n,s)=>{const r=mf(e,t);let a=0,i,c=l=>{i||(i=!0,s&&s(l))};return new ReadableStream({async pull(l){try{const{done:f,value:u}=await r.next();if(f){c(),l.close();return}let d=u.byteLength;if(n){let m=a+=d;n(m)}l.enqueue(new Uint8Array(u))}catch(f){throw c(f),f}},cancel(l){return c(l),r.return()}},{highWaterMark:2})},ts=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,gf=(e,t,n)=>t+2<n&&ts(e.charCodeAt(t+1))&&ts(e.charCodeAt(t+2));function xf(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),s=e.slice(t+1);if(/;base64/i.test(n)){let i=s.length;const c=s.length;for(let h=0;h<c;h++)if(s.charCodeAt(h)===37&&h+2<c){const p=s.charCodeAt(h+1),g=s.charCodeAt(h+2);ts(p)&&ts(g)&&(i-=2,h+=2)}let l=0,f=c-1;const u=h=>h>=2&&s.charCodeAt(h-2)===37&&s.charCodeAt(h-1)===51&&(s.charCodeAt(h)===68||s.charCodeAt(h)===100);f>=0&&(s.charCodeAt(f)===61?(l++,f--):u(f)&&(l++,f-=3)),l===1&&f>=0&&(s.charCodeAt(f)===61||u(f))&&l++;const m=Math.floor(i/4)*3-(l||0);return m>0?m:0}let a=0;for(let i=0,c=s.length;i<c;i++){const l=s.charCodeAt(i);if(l===37&&gf(s,i,c))a+=1,i+=2;else if(l<128)a+=1;else if(l<2048)a+=2;else if(l>=55296&&l<=56319&&i+1<c){const f=s.charCodeAt(i+1);f>=56320&&f<=57343?(a+=4,i++):a+=3}else a+=3}return a}const Sr="1.18.1",Co=64*1024,{isFunction:Cn}=N,bf=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),Ro=e=>{if(!N.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Eo=(e,...t)=>{try{return!!e(...t)}catch{return!1}},yf=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},vf=e=>{const t=N.global!==void 0&&N.global!==null?N.global:globalThis,{ReadableStream:n,TextEncoder:s}=t;e=N.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:r,Request:a,Response:i}=e,c=r?Cn(r):typeof fetch=="function",l=Cn(a),f=Cn(i);if(!c)return!1;const u=c&&Cn(n),d=c&&(typeof s=="function"?(x=>y=>x.encode(y))(new s):async x=>new Uint8Array(await new a(x).arrayBuffer())),m=l&&u&&Eo(()=>{let x=!1;const y=new a(pe.origin,{body:new n,method:"POST",get duplex(){return x=!0,"half"}}),w=y.headers.has("Content-Type");return y.body!=null&&y.body.cancel(),x&&!w}),h=f&&u&&Eo(()=>N.isReadableStream(new i("").body)),p={stream:h&&(x=>x.body)};c&&["text","arrayBuffer","blob","formData","stream"].forEach(x=>{!p[x]&&(p[x]=(y,w)=>{let C=y&&y[x];if(C)return C.call(y);throw new M(`Response type '${x}' is not supported`,M.ERR_NOT_SUPPORT,w)})});const g=async x=>{if(x==null)return 0;if(N.isBlob(x))return x.size;if(N.isSpecCompliantForm(x))return(await new a(pe.origin,{method:"POST",body:x}).arrayBuffer()).byteLength;if(N.isArrayBufferView(x)||N.isArrayBuffer(x))return x.byteLength;if(N.isURLSearchParams(x)&&(x=x+""),N.isString(x))return(await d(x)).byteLength},b=async(x,y)=>{const w=N.toFiniteNumber(x.getContentLength());return w??g(y)};return async x=>{let{url:y,method:w,data:C,signal:E,cancelToken:k,timeout:R,onDownloadProgress:S,onUploadProgress:A,responseType:I,headers:v,withCredentials:O="same-origin",fetchOptions:T,maxContentLength:L,maxBodyLength:X}=bi(x);const Z=N.isNumber(L)&&L>-1,W=N.isNumber(X)&&X>-1,le=z=>N.hasOwnProp(x,z)?x[z]:void 0;let we=r||fetch;I=I?(I+"").toLowerCase():"text";let D=ff([E,k&&k.toAbortSignal()],R),_=null;const U=D&&D.unsubscribe&&(()=>{D.unsubscribe()});let G,Y=null;const K=()=>new M("Request body larger than maxBodyLength limit",M.ERR_BAD_REQUEST,x,_);try{let z;const H=le("auth");if(H){const B=N.getSafeProp(H,"username")||"",se=N.getSafeProp(H,"password")||"";z={username:B,password:se}}if(yf(y)){const B=new URL(y,pe.origin);if(!z&&(B.username||B.password)){const se=Ro(B.username),ee=Ro(B.password);z={username:se,password:ee}}(B.username||B.password)&&(B.username="",B.password="",y=B.href)}if(z&&(v.delete("authorization"),v.set("Authorization","Basic "+btoa(bf((z.username||"")+":"+(z.password||""))))),Z&&typeof y=="string"&&y.startsWith("data:")&&xf(y)>L)throw new M("maxContentLength size of "+L+" exceeded",M.ERR_BAD_RESPONSE,x,_);if(W&&w!=="get"&&w!=="head"){const B=await g(C);if(typeof B=="number"&&isFinite(B)&&(G=B,B>X))throw K()}const ne=W&&(N.isReadableStream(C)||N.isStream(C)),Q=(B,se,ee)=>jo(B,Co,oe=>{if(W&&oe>X)throw Y=K();se&&se(oe)},ee);if(m&&w!=="get"&&w!=="head"&&(A||ne)){if(G=G??await b(v,C),G!==0||ne){let B=new a(y,{method:"POST",body:C,duplex:"half"}),se;if(N.isFormData(C)&&(se=B.headers.get("content-type"))&&v.setContentType(se),B.body){const[ee,oe]=A&&vo(G,es(wo(A)))||[];C=Q(B.body,ee,oe)}}}else if(ne&&!l&&u&&w!=="get"&&w!=="head")C=Q(C);else if(ne&&l&&!m&&w!=="get"&&w!=="head")throw new M("Stream request bodies are not supported by the current fetch implementation",M.ERR_NOT_SUPPORT,x,_);N.isString(O)||(O=O?"include":"omit");const Te=l&&"credentials"in a.prototype;if(N.isFormData(C)){const B=v.getContentType();B&&/^multipart\/form-data/i.test(B)&&!/boundary=/i.test(B)&&v.delete("content-type")}v.set("User-Agent","axios/"+Sr,!1);const Ee={...T,signal:D,method:w.toUpperCase(),headers:ii(v.normalize()),body:C,duplex:"half",credentials:Te?O:void 0};_=l&&new a(y,Ee);let ue=await(l?we(_,T):we(y,Ee));const Ie=ve.from(ue.headers);if(Z){const B=N.toFiniteNumber(Ie.getContentLength());if(B!=null&&B>L)throw new M("maxContentLength size of "+L+" exceeded",M.ERR_BAD_RESPONSE,x,_)}const _e=h&&(I==="stream"||I==="response");if(h&&ue.body&&(S||Z||_e&&U)){const B={};["status","statusText","headers"].forEach(ge=>{B[ge]=ue[ge]});const se=N.toFiniteNumber(Ie.getContentLength()),[ee,oe]=S&&vo(se,es(wo(S),!0))||[];let ke=0;const We=ge=>{if(Z&&(ke=ge,ke>L))throw new M("maxContentLength size of "+L+" exceeded",M.ERR_BAD_RESPONSE,x,_);ee&&ee(ge)};ue=new i(jo(ue.body,Co,We,()=>{oe&&oe(),U&&U()}),B)}I=I||"text";let q=await p[N.findKey(p,I)||"text"](ue,x);if(Z&&!h&&!_e){let B;if(q!=null&&(typeof q.byteLength=="number"?B=q.byteLength:typeof q.size=="number"?B=q.size:typeof q=="string"&&(B=typeof s=="function"?new s().encode(q).byteLength:q.length)),typeof B=="number"&&B>L)throw new M("maxContentLength size of "+L+" exceeded",M.ERR_BAD_RESPONSE,x,_)}return!_e&&U&&U(),await new Promise((B,se)=>{gi(B,se,{data:q,headers:ve.from(ue.headers),status:ue.status,statusText:ue.statusText,config:x,request:_})})}catch(z){if(U&&U(),D&&D.aborted&&D.reason instanceof M){const H=D.reason;throw H.config=x,_&&(H.request=_),z!==H&&Object.defineProperty(H,"cause",{__proto__:null,value:z,writable:!0,enumerable:!1,configurable:!0}),H}if(Y)throw _&&!Y.request&&(Y.request=_),Y;if(z instanceof M)throw _&&!z.request&&(z.request=_),z;if(z&&z.name==="TypeError"&&/Load failed|fetch/i.test(z.message)){const H=new M("Network Error",M.ERR_NETWORK,x,_,z&&z.response);throw Object.defineProperty(H,"cause",{__proto__:null,value:z.cause||z,writable:!0,enumerable:!1,configurable:!0}),H}throw M.from(z,z&&z.code,x,_,z&&z.response)}}},wf=new Map,yi=e=>{let t=e&&e.env||{};const{fetch:n,Request:s,Response:r}=t,a=[s,r,n];let i=a.length,c=i,l,f,u=wf;for(;c--;)l=a[c],f=u.get(l),f===void 0&&u.set(l,f=c?new Map:vf(t)),u=f;return f};yi();const Nr={http:Ou,xhr:uf,fetch:{get:yi}};N.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 ko=e=>`- ${e}`,Sf=e=>N.isFunction(e)||e===null||e===!1;function Nf(e,t){e=N.isArray(e)?e:[e];const{length:n}=e;let s,r;const a={};for(let i=0;i<n;i++){s=e[i];let c;if(r=s,!Sf(s)&&(r=Nr[(c=String(s)).toLowerCase()],r===void 0))throw new M(`Unknown adapter '${c}'`);if(r&&(N.isFunction(r)||(r=r.get(t))))break;a[c||"#"+i]=r}if(!r){const i=Object.entries(a).map(([l,f])=>`adapter ${l} `+(f===!1?"is not supported by the environment":"is not available in the build"));let c=n?i.length>1?`since :
9
+ `+i.map(ko).join(`
10
+ `):" "+ko(i[0]):"as no adapter specified";throw new M("There is no suitable adapter to dispatch the request "+c,M.ERR_NOT_SUPPORT)}return r}const vi={getAdapter:Nf,adapters:Nr};function Ls(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new pn(null,e)}function _o(e){return Ls(e),e.headers=ve.from(e.headers),e.data=Os.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),vi.getAdapter(e.adapter||mn.adapter,e)(e).then(function(s){Ls(e),e.response=s;try{s.data=Os.call(e,e.transformResponse,s)}finally{delete e.response}return s.headers=ve.from(s.headers),s},function(s){if(!pi(s)&&(Ls(e),s&&s.response)){e.response=s.response;try{s.response.data=Os.call(e,e.transformResponse,s.response)}finally{delete e.response}s.response.headers=ve.from(s.response.headers)}return Promise.reject(s)})}const us={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{us[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const Po={};us.transitional=function(t,n,s){function r(a,i){return"[Axios v"+Sr+"] Transitional option '"+a+"'"+i+(s?". "+s:"")}return(a,i,c)=>{if(t===!1)throw new M(r(i," has been removed"+(n?" in "+n:"")),M.ERR_DEPRECATED);return n&&!Po[i]&&(Po[i]=!0,console.warn(r(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(a,i,c):!0}};us.spelling=function(t){return(n,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function jf(e,t,n){if(typeof e!="object"||e===null)throw new M("options must be an object",M.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let r=s.length;for(;r-- >0;){const a=s[r],i=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;if(i){const c=e[a],l=c===void 0||i(c,a,e);if(l!==!0)throw new M("option "+a+" must be "+l,M.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new M("Unknown option "+a,M.ERR_BAD_OPTION)}}const Wn={assertOptions:jf,validators:us},xe=Wn.validators;let gt=class{constructor(t){this.defaults=t||{},this.interceptors={request:new bo,response:new bo}}async request(t,n){try{return await this._request(t,n)}catch(s){if(s instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const a=(()=>{if(!r.stack)return"";const i=r.stack.indexOf(`
11
+ `);return i===-1?"":r.stack.slice(i+1)})();try{if(!s.stack)s.stack=a;else if(a){const i=a.indexOf(`
12
+ `),c=i===-1?-1:a.indexOf(`
13
+ `,i+1),l=c===-1?"":a.slice(c+1);String(s.stack).endsWith(l)||(s.stack+=`
14
+ `+a)}}catch{}}throw s}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=bt(this.defaults,n);const{transitional:s,paramsSerializer:r,headers:a}=n;s!==void 0&&Wn.assertOptions(s,{silentJSONParsing:xe.transitional(xe.boolean),forcedJSONParsing:xe.transitional(xe.boolean),clarifyTimeoutError:xe.transitional(xe.boolean),legacyInterceptorReqResOrdering:xe.transitional(xe.boolean),advertiseZstdAcceptEncoding:xe.transitional(xe.boolean),validateStatusUndefinedResolves:xe.transitional(xe.boolean)},!1),r!=null&&(N.isFunction(r)?n.paramsSerializer={serialize:r}:Wn.assertOptions(r,{encode:xe.function,serialize:xe.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Wn.assertOptions(n,{baseUrl:xe.spelling("baseURL"),withXsrfToken:xe.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=a&&N.merge(a.common,a[n.method]);a&&N.forEach(["delete","get","head","post","put","patch","query","common"],p=>{delete a[p]}),n.headers=ve.concat(i,a);const c=[];let l=!0;this.interceptors.request.forEach(function(g){if(typeof g.runWhen=="function"&&g.runWhen(n)===!1)return;l=l&&g.synchronous;const b=n.transitional||vr;b&&b.legacyInterceptorReqResOrdering?c.unshift(g.fulfilled,g.rejected):c.push(g.fulfilled,g.rejected)});const f=[];this.interceptors.response.forEach(function(g){f.push(g.fulfilled,g.rejected)});let u,d=0,m;if(!l){const p=[_o.bind(this),void 0];for(p.unshift(...c),p.push(...f),m=p.length,u=Promise.resolve(n);d<m;)u=u.then(p[d++],p[d++]);return u}m=c.length;let h=n;for(;d<m;){const p=c[d++],g=c[d++];try{h=p(h)}catch(b){g.call(this,b);break}}try{u=_o.call(this,h)}catch(p){return Promise.reject(p)}for(d=0,m=f.length;d<m;)u=u.then(f[d++],f[d++]);return u}getUri(t){t=bt(this.defaults,t);const n=xi(t.baseURL,t.url,t.allowAbsoluteUrls,t);return fi(n,t.params,t.paramsSerializer)}};N.forEach(["delete","get","head","options"],function(t){gt.prototype[t]=function(n,s){return this.request(bt(s||{},{method:t,url:n,data:s&&N.hasOwnProp(s,"data")?s.data:void 0}))}});N.forEach(["post","put","patch","query"],function(t){function n(s){return function(a,i,c){return this.request(bt(c||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}gt.prototype[t]=n(),t!=="query"&&(gt.prototype[t+"Form"]=n(!0))});let Cf=class wi{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const s=this;this.promise.then(r=>{if(!s._listeners)return;let a=s._listeners.length;for(;a-- >0;)s._listeners[a](r);s._listeners=null}),this.promise.then=r=>{let a;const i=new Promise(c=>{s.subscribe(c),a=c}).then(r);return i.cancel=function(){s.unsubscribe(a)},i},t(function(a,i,c){s.reason||(s.reason=new pn(a,i,c),n(s.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 n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=s=>{t.abort(s)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new wi(function(r){t=r}),cancel:t}}};function Rf(e){return function(n){return e.apply(null,n)}}function Ef(e){return N.isObject(e)&&e.isAxiosError===!0}const rr={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(rr).forEach(([e,t])=>{rr[t]=e});function Si(e){const t=new gt(e),n=Za(gt.prototype.request,t);return N.extend(n,gt.prototype,t,{allOwnKeys:!0}),N.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return Si(bt(e,r))},n}const de=Si(mn);de.Axios=gt;de.CanceledError=pn;de.CancelToken=Cf;de.isCancel=pi;de.VERSION=Sr;de.toFormData=ds;de.AxiosError=M;de.Cancel=de.CanceledError;de.all=function(t){return Promise.all(t)};de.spread=Rf;de.isAxiosError=Ef;de.mergeConfig=bt;de.AxiosHeaders=ve;de.formToJSON=e=>mi(N.isHTMLForm(e)?new FormData(e):e);de.getAdapter=vi.getAdapter;de.HttpStatusCode=rr;de.default=de;const{Axios:ux,AxiosError:fx,CanceledError:hx,isCancel:mx,CancelToken:px,VERSION:gx,all:xx,Cancel:bx,isAxiosError:yx,spread:vx,toFormData:wx,AxiosHeaders:Sx,HttpStatusCode:Nx,formToJSON:jx,getAdapter:Cx,mergeConfig:Rx,create:Ex}=de,re=de.create({baseURL:"/api/v1/cost"});function Ni(e,t){re.defaults.baseURL=`${e.replace(/\/$/,"")}/cost`,t?re.defaults.headers.common.Authorization=`Bearer ${t}`:delete re.defaults.headers.common.Authorization}function kf(e){e.interceptors.request.use(t=>{if(typeof window<"u"){const n=window.localStorage.getItem("access_token");n?(t.headers=t.headers||{},t.headers.Authorization=`Bearer ${n}`):t.headers&&delete t.headers.Authorization}return t})}const _f=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Pf=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase()),Ao=e=>{const t=Pf(e);return t.charAt(0).toUpperCase()+t.slice(1)},ji=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim(),Af=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Tf={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 Of=P.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:a,iconNode:i,...c},l)=>P.createElement("svg",{ref:l,...Tf,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:ji("lucide",r),...!a&&!Af(c)&&{"aria-hidden":"true"},...c},[...i.map(([f,u])=>P.createElement(f,u)),...Array.isArray(a)?a:[a]]));const te=(e,t)=>{const n=P.forwardRef(({className:s,...r},a)=>P.createElement(Of,{ref:a,iconNode:t,className:ji(`lucide-${_f(Ao(e))}`,`lucide-${e}`,s),...r}));return n.displayName=Ao(e),n};const Lf=[["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"}]],Ci=te("building-2",Lf);const If=[["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"}]],Ri=te("calendar-clock",If);const Mf=[["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"}]],Df=te("chart-column",Mf);const Ff=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ei=te("chevron-down",Ff);const $f=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Uf=te("chevron-left",$f);const Bf=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ki=te("chevron-right",Bf);const zf=[["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"}]],Be=te("circle-alert",zf);const Wf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Vf=te("circle-check",Wf);const Hf=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],ns=te("cloud",Hf);const qf=[["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"}]],_i=te("database",qf);const Gf=[["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"}]],Pi=te("dollar-sign",Gf);const Kf=[["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"}]],fs=te("download",Kf);const Yf=[["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"}]],Ai=te("external-link",Yf);const Jf=[["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"}]],Xf=te("eye",Jf);const Zf=[["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"}]],Qf=te("file-down",Zf);const eh=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],th=te("file-spreadsheet",eh);const nh=[["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"}]],Ti=te("file-text",nh);const sh=[["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"}]],rh=te("list",sh);const oh=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ge=te("loader-circle",oh);const ah=[["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"}]],ih=te("map-pin",ah);const ch=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],lh=te("plus",ch);const dh=[["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"}]],Ft=te("refresh-cw",dh);const uh=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],hs=te("search",uh);const fh=[["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"}]],Oi=te("server",fh);const hh=[["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"}]],Li=te("settings-2",hh);const mh=[["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"}]],To=te("sparkles",mh);const ph=[["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"}]],Ii=te("trash-2",ph);const gh=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],xh=te("trending-down",gh);const bh=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Mi=te("trending-up",bh);const yh=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ye=te("x",yh);function Di(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Di(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function vh(){for(var e,t,n=0,s="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Di(e))&&(s&&(s+=" "),s+=t);return s}const wh=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},Sh=(e,t)=>({classGroupId:e,validator:t}),Fi=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ss="-",Oo=[],Nh="arbitrary..",jh=e=>{const t=Rh(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Ch(i);const c=i.split(ss),l=c[0]===""&&c.length>1?1:0;return $i(c,l,t)},getConflictingClassGroupIds:(i,c)=>{if(c){const l=s[i],f=n[i];return l?f?wh(f,l):l:f||Oo}return n[i]||Oo}}},$i=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],a=n.nextPart.get(r);if(a){const f=$i(e,t+1,a);if(f)return f}const i=n.validators;if(i===null)return;const c=t===0?e.join(ss):e.slice(t).join(ss),l=i.length;for(let f=0;f<l;f++){const u=i[f];if(u.validator(c))return u.classGroupId}},Ch=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?Nh+s:void 0})(),Rh=e=>{const{theme:t,classGroups:n}=e;return Eh(n,t)},Eh=(e,t)=>{const n=Fi();for(const s in e){const r=e[s];jr(r,n,s,t)}return n},jr=(e,t,n,s)=>{const r=e.length;for(let a=0;a<r;a++){const i=e[a];kh(i,t,n,s)}},kh=(e,t,n,s)=>{if(typeof e=="string"){_h(e,t,n);return}if(typeof e=="function"){Ph(e,t,n,s);return}Ah(e,t,n,s)},_h=(e,t,n)=>{const s=e===""?t:Ui(t,e);s.classGroupId=n},Ph=(e,t,n,s)=>{if(Th(e)){jr(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(Sh(n,e))},Ah=(e,t,n,s)=>{const r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){const[c,l]=r[i];jr(l,Ui(t,c),n,s)}},Ui=(e,t)=>{let n=e;const s=t.split(ss),r=s.length;for(let a=0;a<r;a++){const i=s[a];let c=n.nextPart.get(i);c||(c=Fi(),n.nextPart.set(i,c)),n=c}return n},Th=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Oh=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const r=(a,i)=>{n[a]=i,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(a){let i=n[a];if(i!==void 0)return i;if((i=s[a])!==void 0)return r(a,i),i},set(a,i){a in n?n[a]=i:r(a,i)}}},or="!",Lo=":",Lh=[],Io=(e,t,n,s,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:r}),Ih=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const a=[];let i=0,c=0,l=0,f;const u=r.length;for(let g=0;g<u;g++){const b=r[g];if(i===0&&c===0){if(b===Lo){a.push(r.slice(l,g)),l=g+1;continue}if(b==="/"){f=g;continue}}b==="["?i++:b==="]"?i--:b==="("?c++:b===")"&&c--}const d=a.length===0?r:r.slice(l);let m=d,h=!1;d.endsWith(or)?(m=d.slice(0,-1),h=!0):d.startsWith(or)&&(m=d.slice(1),h=!0);const p=f&&f>l?f-l:void 0;return Io(a,h,m,p)};if(t){const r=t+Lo,a=s;s=i=>i.startsWith(r)?a(i.slice(r.length)):Io(Lh,!1,i,void 0,!0)}if(n){const r=s;s=a=>n({className:a,parseClassName:r})}return s},Mh=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let r=[];for(let a=0;a<n.length;a++){const i=n[a],c=i[0]==="[",l=t.has(i);c||l?(r.length>0&&(r.sort(),s.push(...r),r=[]),s.push(i)):r.push(i)}return r.length>0&&(r.sort(),s.push(...r)),s}},Dh=e=>({cache:Oh(e.cacheSize),parseClassName:Ih(e),sortModifiers:Mh(e),postfixLookupClassGroupIds:Fh(e),...jh(e)}),Fh=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let s=0;s<n.length;s++)t[n[s]]=!0;return t},$h=/\s+/,Uh=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,c=[],l=e.trim().split($h);let f="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:m,modifiers:h,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:b}=n(d);if(m){f=d+(f.length>0?" "+f:f);continue}let x=!!b,y;if(x){const R=g.substring(0,b);y=s(R);const S=y&&i[y]?s(g):void 0;S&&S!==y&&(y=S,x=!1)}else y=s(g);if(!y){if(!x){f=d+(f.length>0?" "+f:f);continue}if(y=s(g),!y){f=d+(f.length>0?" "+f:f);continue}x=!1}const w=h.length===0?"":h.length===1?h[0]:a(h).join(":"),C=p?w+or:w,E=C+y;if(c.indexOf(E)>-1)continue;c.push(E);const k=r(y,x);for(let R=0;R<k.length;++R){const S=k[R];c.push(C+S)}f=d+(f.length>0?" "+f:f)}return f},Bh=(...e)=>{let t=0,n,s,r="";for(;t<e.length;)(n=e[t++])&&(s=Bi(n))&&(r&&(r+=" "),r+=s);return r},Bi=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Bi(e[s]))&&(n&&(n+=" "),n+=t);return n},zh=(e,...t)=>{let n,s,r,a;const i=l=>{const f=t.reduce((u,d)=>d(u),e());return n=Dh(f),s=n.cache.get,r=n.cache.set,a=c,c(l)},c=l=>{const f=s(l);if(f)return f;const u=Uh(l,n);return r(l,u),u};return a=i,(...l)=>a(Bh(...l))},Wh=[],fe=e=>{const t=n=>n[e]||Wh;return t.isThemeGetter=!0,t},zi=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Wi=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Vh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Hh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qh=/\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$/,Gh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Kh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Yh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xe=e=>Vh.test(e),J=e=>!!e&&!Number.isNaN(Number(e)),Me=e=>!!e&&Number.isInteger(Number(e)),Is=e=>e.endsWith("%")&&J(e.slice(0,-1)),Ve=e=>Hh.test(e),Vi=()=>!0,Jh=e=>qh.test(e)&&!Gh.test(e),Cr=()=>!1,Xh=e=>Kh.test(e),Zh=e=>Yh.test(e),Qh=e=>!F(e)&&!$(e),em=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)),tm=e=>ot(e,Gi,Cr),F=e=>zi.test(e),ct=e=>ot(e,Ki,Jh),Mo=e=>ot(e,lm,J),nm=e=>ot(e,Ji,Vi),sm=e=>ot(e,Yi,Cr),Do=e=>ot(e,Hi,Cr),rm=e=>ot(e,qi,Zh),Rn=e=>ot(e,Xi,Xh),$=e=>Wi.test(e),Xt=e=>wt(e,Ki),om=e=>wt(e,Yi),Fo=e=>wt(e,Hi),am=e=>wt(e,Gi),im=e=>wt(e,qi),En=e=>wt(e,Xi,!0),cm=e=>wt(e,Ji,!0),ot=(e,t,n)=>{const s=zi.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},wt=(e,t,n=!1)=>{const s=Wi.exec(e);return s?s[1]?t(s[1]):n:!1},Hi=e=>e==="position"||e==="percentage",qi=e=>e==="image"||e==="url",Gi=e=>e==="length"||e==="size"||e==="bg-size",Ki=e=>e==="length",lm=e=>e==="number",Yi=e=>e==="family-name",Ji=e=>e==="number"||e==="weight",Xi=e=>e==="shadow",dm=()=>{const e=fe("color"),t=fe("font"),n=fe("text"),s=fe("font-weight"),r=fe("tracking"),a=fe("leading"),i=fe("breakpoint"),c=fe("container"),l=fe("spacing"),f=fe("radius"),u=fe("shadow"),d=fe("inset-shadow"),m=fe("text-shadow"),h=fe("drop-shadow"),p=fe("blur"),g=fe("perspective"),b=fe("aspect"),x=fe("ease"),y=fe("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...C(),$,F],k=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],S=()=>[$,F,l],A=()=>[Xe,"full","auto",...S()],I=()=>[Me,"none","subgrid",$,F],v=()=>["auto",{span:["full",Me,$,F]},Me,$,F],O=()=>[Me,"auto",$,F],T=()=>["auto","min","max","fr",$,F],L=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...S()],W=()=>[Xe,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],le=()=>[Xe,"screen","full","dvw","lvw","svw","min","max","fit",...S()],we=()=>[Xe,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],D=()=>[e,$,F],_=()=>[...C(),Fo,Do,{position:[$,F]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",am,tm,{size:[$,F]}],Y=()=>[Is,Xt,ct],K=()=>["","none","full",f,$,F],z=()=>["",J,Xt,ct],H=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>[J,Is,Fo,Do],Te=()=>["","none",p,$,F],Ee=()=>["none",J,$,F],ue=()=>["none",J,$,F],Ie=()=>[J,$,F],_e=()=>[Xe,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ve],breakpoint:[Ve],color:[Vi],container:[Ve],"drop-shadow":[Ve],ease:["in","out","in-out"],font:[Qh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ve],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ve],shadow:[Ve],spacing:["px",J],text:[Ve],"text-shadow":[Ve],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Xe,F,$,b]}],container:["container"],"container-type":[{"@container":["","normal","size",$,F]}],"container-named":[em],columns:[{columns:[J,F,$,c]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"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:E()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{"inset-s":A(),start:A()}],end:[{"inset-e":A(),end:A()}],"inset-bs":[{"inset-bs":A()}],"inset-be":[{"inset-be":A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Me,"auto",$,F]}],basis:[{basis:[Xe,"full","auto",c,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[J,Xe,"auto","initial","none",F]}],grow:[{grow:["",J,$,F]}],shrink:[{shrink:["",J,$,F]}],order:[{order:[Me,"first","last","none",$,F]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:v()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:v()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":T()}],"auto-rows":[{"auto-rows":T()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...L(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"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:W()}],"inline-size":[{inline:["auto",...le()]}],"min-inline-size":[{"min-inline":["auto",...le()]}],"max-inline-size":[{"max-inline":["none",...le()]}],"block-size":[{block:["auto",...we()]}],"min-block-size":[{"min-block":["auto",...we()]}],"max-block-size":[{"max-block":["none",...we()]}],w:[{w:[c,"screen",...W()]}],"min-w":[{"min-w":[c,"screen","none",...W()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[i]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,Xt,ct]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,cm,nm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Is,F]}],"font-family":[{font:[om,sm,t]}],"font-features":[{"font-features":[F]}],"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,$,F]}],"line-clamp":[{"line-clamp":[J,"none",$,Mo]}],leading:[{leading:[a,...S()]}],"list-image":[{"list-image":["none",$,F]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",$,F]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:[J,"from-font","auto",$,ct]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[J,"auto",$,F]}],"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:[Me,$,F]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$,F]}],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",$,F]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Me,$,F],radial:["",$,F],conic:[Me,$,F]},im,rm]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-bs":[{"border-bs":z()}],"border-w-be":[{"border-be":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...H(),"hidden","none"]}],"divide-style":[{divide:[...H(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...H(),"none","hidden"]}],"outline-offset":[{"outline-offset":[J,$,F]}],"outline-w":[{outline:["",J,Xt,ct]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",u,En,Rn]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",d,En,Rn]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[J,ct]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",m,En,Rn]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[J,$,F]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[J]}],"mask-image-linear-from-pos":[{"mask-linear-from":Q()}],"mask-image-linear-to-pos":[{"mask-linear-to":Q()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":Q()}],"mask-image-t-to-pos":[{"mask-t-to":Q()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":Q()}],"mask-image-r-to-pos":[{"mask-r-to":Q()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":Q()}],"mask-image-b-to-pos":[{"mask-b-to":Q()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":Q()}],"mask-image-l-to-pos":[{"mask-l-to":Q()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":Q()}],"mask-image-x-to-pos":[{"mask-x-to":Q()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":Q()}],"mask-image-y-to-pos":[{"mask-y-to":Q()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[$,F]}],"mask-image-radial-from-pos":[{"mask-radial-from":Q()}],"mask-image-radial-to-pos":[{"mask-radial-to":Q()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"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":C()}],"mask-image-conic-pos":[{"mask-conic":[J]}],"mask-image-conic-from-pos":[{"mask-conic-from":Q()}],"mask-image-conic-to-pos":[{"mask-conic-to":Q()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",$,F]}],filter:[{filter:["","none",$,F]}],blur:[{blur:Te()}],brightness:[{brightness:[J,$,F]}],contrast:[{contrast:[J,$,F]}],"drop-shadow":[{"drop-shadow":["","none",h,En,Rn]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",J,$,F]}],"hue-rotate":[{"hue-rotate":[J,$,F]}],invert:[{invert:["",J,$,F]}],saturate:[{saturate:[J,$,F]}],sepia:[{sepia:["",J,$,F]}],"backdrop-filter":[{"backdrop-filter":["","none",$,F]}],"backdrop-blur":[{"backdrop-blur":Te()}],"backdrop-brightness":[{"backdrop-brightness":[J,$,F]}],"backdrop-contrast":[{"backdrop-contrast":[J,$,F]}],"backdrop-grayscale":[{"backdrop-grayscale":["",J,$,F]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[J,$,F]}],"backdrop-invert":[{"backdrop-invert":["",J,$,F]}],"backdrop-opacity":[{"backdrop-opacity":[J,$,F]}],"backdrop-saturate":[{"backdrop-saturate":[J,$,F]}],"backdrop-sepia":[{"backdrop-sepia":["",J,$,F]}],"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",$,F]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[J,"initial",$,F]}],ease:[{ease:["linear","initial",x,$,F]}],delay:[{delay:[J,$,F]}],animate:[{animate:["none",y,$,F]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,$,F]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":["scale-3d"],skew:[{skew:Ie()}],"skew-x":[{"skew-x":Ie()}],"skew-y":[{"skew-y":Ie()}],transform:[{transform:[$,F,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"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:[Me,$,F]}],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"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",$,F]}],"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":D()}],"scrollbar-track-color":[{"scrollbar-track":D()}],"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",$,F]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[J,Xt,ct,Mo]}],stroke:[{stroke:["none",...D()]}],"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"]}},um=zh(dm);function Wt(...e){return um(vh(e))}function V(e,t="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:2}).format(e)}const he=j.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Wt("rounded-xl border bg-card text-card-foreground shadow",e),...t}));he.displayName="Card";const Se=j.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Wt("flex flex-col space-y-1.5 p-6",e),...t}));Se.displayName="CardHeader";const Pe=j.forwardRef(({className:e,...t},n)=>o.jsx("h3",{ref:n,className:Wt("font-semibold leading-none tracking-tight",e),...t}));Pe.displayName="CardTitle";const fm=j.forwardRef(({className:e,...t},n)=>o.jsx("p",{ref:n,className:Wt("text-sm text-muted-foreground",e),...t}));fm.displayName="CardDescription";const me=j.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Wt("p-6 pt-0",e),...t}));me.displayName="CardContent";const hm=j.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:Wt("flex items-center p-6 pt-0",e),...t}));hm.displayName="CardFooter";function rs({status:e,error:t}){const n=e?.action==="connect_source"||e?.state==="not_configured",s=e?.message||t||"CUR status could not be loaded. Verify the cost source, discovery job, and Athena configuration.";return o.jsx("section",{className:"rounded-md border bg-card p-6","aria-live":"polite",children:o.jsxs("div",{className:"flex items-start gap-3",children:[e?.state==="unavailable"||t?o.jsx(Be,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}):o.jsx(_i,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"font-semibold",children:n?"Enable AWS Cost and Usage Reports":"CUR data is not ready"}),o.jsx("p",{className:"mt-1 max-w-3xl text-sm text-muted-foreground",children:s}),o.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[o.jsxs(Zn,{to:n?"/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:[o.jsx(Ai,{className:"h-4 w-4"}),n?"Connect AWS source":"Review CUR discovery"]}),!n&&o.jsx(Zn,{to:"/sources",className:"rounded-md border px-3 py-2 text-sm font-medium hover:bg-muted",children:"Cost sources"})]})]})]})})}const ce={getOverview:e=>re.get("/overview",{params:e}).then(t=>t.data),getAccounts:e=>re.get("/accounts",{params:e}).then(t=>t.data),getReports:e=>re.get("/reports",{params:e}).then(t=>t.data),downloadReportExcel:e=>re.get("/reports/excel",{params:e,responseType:"blob"}).then(t=>t.data),getFilterOptions:e=>re.get("/filter-options",{params:{start:e?.start,end:e?.end,tagKey:e?.filterTagKey,managementAccountId:e?.managementAccountId}}).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:e=>re.get("/analysis/status",{params:e}).then(t=>t.data),getLatestAnalysis:e=>re.get("/analysis/latest",{params:e}).then(t=>t.data.analysis),getAnalysisSchedule:e=>re.get("/analysis/schedule",{params:e}).then(t=>t.data),updateAnalysisSchedule:(e,t)=>re.put("/analysis/schedule",e,{params:t}).then(n=>n.data),getAnalysisReports:e=>re.get("/analysis/reports",{params:e}).then(t=>t.data.reports),removeAnalysisReport:e=>re.delete(`/analysis/reports/${e}`).then(t=>t.data),downloadAnalysisHtml:e=>re.get(`/analysis/reports/${e}/html`,{responseType:"blob"}).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),removeSource:e=>re.delete(`/sources/${e}`).then(t=>t.data),downloadSourceTemplate:e=>re.get(`/sources/${e}/template`,{responseType:"blob"}).then(t=>t.data),getCurDiscovery:e=>re.get("/cur-discovery",{params:e}).then(t=>t.data)},Zi=P.createContext("user"),mm=Zi.Provider,pm=()=>P.useContext(Zi),Qi=P.createContext(null);function gm({tenantId:e="default",children:t}){const n=`meyi-cost:selected-management-account:${e||"default"}`,[s,r]=P.useState([]),[a,i]=P.useState(""),[c,l]=P.useState(!0),f=P.useCallback(async()=>{l(!0);try{const h=((await ce.getSources()).sources||[]).filter(p=>!!p.managementAccountId);r(h),i(p=>{const b=window.localStorage.getItem(n)||""||p,x=h.find(w=>w.status==="CONNECTED")||h[0],y=h.some(w=>w.managementAccountId===b)?b:x?.managementAccountId||"";return y?window.localStorage.setItem(n,y):window.localStorage.removeItem(n),y})}catch{r([]),i("")}finally{l(!1)}},[n]);P.useEffect(()=>{f()},[f]);const u=P.useCallback(m=>{/^\d{12}$/.test(m)&&(window.localStorage.setItem(n,m),i(m))},[n]),d=P.useMemo(()=>({sources:s,managementAccountId:a,loading:c,selectManagementAccount:u,refreshSources:f}),[s,a,c,u,f]);return o.jsx(Qi.Provider,{value:d,children:t})}function St(){const e=P.useContext(Qi);if(!e)throw new Error("useCostAccount must be used inside CostAccountProvider");return e}function ms(){const{sources:e,managementAccountId:t,loading:n,selectManagementAccount:s}=St();return e.length<=1?null:o.jsxs("label",{className:"flex items-center gap-2",children:[o.jsx(Ci,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("span",{className:"sr-only",children:"Management account"}),o.jsx("select",{"aria-label":"Management account",value:t,onChange:r=>s(r.target.value),disabled:n,className:"max-w-72 rounded-md border bg-background px-3 py-2 text-sm shadow-sm disabled:opacity-50",children:e.map(r=>o.jsxs("option",{value:r.managementAccountId||"",children:["Management account ",r.managementAccountId]},r.connectionId))})]})}function xm({points:e,currency:t="USD"}){const[n,s]=P.useState(null);if(!e.length)return o.jsx("p",{className:"py-20 text-center text-sm text-muted-foreground",children:"No trend data for this period."});const r=900,a=260,i=70,c=24,l=22,f=48,u=r-i-c,d=a-l-f,m=Math.max(...e.map(x=>x.value),1),h=e.map((x,y)=>({...x,x:i+(e.length===1?u/2:y*u/(e.length-1)),y:l+d-x.value/m*d})),p=n==null?null:h[n],g=Math.max(1,Math.ceil(e.length/12)),b=x=>{const y=x.currentTarget.getBoundingClientRect(),w=(x.clientX-y.left)/y.width*r;let C=0;for(let E=1;E<h.length;E+=1)Math.abs(h[E].x-w)<Math.abs(h[C].x-w)&&(C=E);s(C)};return o.jsxs("div",{className:"relative w-full",children:[o.jsxs("svg",{viewBox:`0 0 ${r} ${a}`,className:"h-72 w-full",onMouseMove:b,onMouseLeave:()=>s(null),role:"img","aria-label":"Cost trend line chart",children:[[0,.25,.5,.75,1].map(x=>{const y=l+d*x;return o.jsxs("g",{children:[o.jsx("line",{x1:i,y1:y,x2:r-c,y2:y,stroke:"#d8e0e7",strokeDasharray:"4 4"}),o.jsx("text",{x:i-10,y:y+4,textAnchor:"end",fill:"currentColor",className:"text-[10px] text-muted-foreground",children:V(m*(1-x),t)})]},x)}),o.jsx("line",{x1:i,y1:l+d,x2:r-c,y2:l+d,stroke:"#aebbc5"}),o.jsx("polyline",{points:h.map(x=>`${x.x},${x.y}`).join(" "),fill:"none",stroke:"#1f5f85",strokeWidth:"4",strokeLinejoin:"round",strokeLinecap:"round"}),p&&o.jsx("line",{x1:p.x,y1:l,x2:p.x,y2:l+d,stroke:"#1f5f85",strokeDasharray:"3 4",opacity:"0.45"}),h.map((x,y)=>o.jsxs("g",{children:[o.jsx("circle",{cx:x.x,cy:x.y,r:n===y?7:e.length>31?3:5,fill:"#1f5f85",stroke:"white",strokeWidth:"2"}),(y%g===0||y===h.length-1)&&o.jsx("text",{x:x.x,y:a-17,textAnchor:"middle",fill:"currentColor",className:"text-[11px] text-muted-foreground",children:x.label})]},x.key))]}),p&&o.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/a*100-4,2)}%`,transform:p.x>r*.75?"translate(-100%, -100%)":"translate(-50%, -100%)"},children:[o.jsx("p",{className:"text-xs font-semibold",children:p.label}),o.jsx("p",{className:"mt-1 text-sm font-bold text-primary",children:V(p.value,t)}),p.details?.slice(0,5).map(x=>o.jsxs("div",{className:"mt-1 flex justify-between gap-4 text-xs",children:[o.jsx("span",{className:"max-w-40 truncate text-muted-foreground",children:x.label}),o.jsx("span",{children:V(x.value,t)})]},x.label))]})]})}const $o=e=>e.length>16?`${e.slice(0,14)}...`:e,bm=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t||"USD",notation:"compact",maximumFractionDigits:1}).format(e);function ym({title:e,items:t,currency:n}){const a={top:38,right:18,bottom:72,left:76},i=720-a.left-a.right,c=320-a.top-a.bottom,l=Math.max(...t.map(d=>d.amount),1),f=i/t.length,u=Math.min(56,f*.58);return o.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 m=a.top+c-d*c;return o.jsxs("g",{children:[o.jsx("line",{x1:a.left,y1:m,x2:720-a.right,y2:m,stroke:"currentColor",opacity:d===0?.3:.12,vectorEffect:"non-scaling-stroke"}),o.jsx("text",{x:a.left-12,y:m+4,textAnchor:"end",fill:"currentColor",opacity:"0.7",fontSize:"11",children:bm(l*d,n)})]},d)}),o.jsx("line",{x1:a.left,y1:a.top,x2:a.left,y2:a.top+c,stroke:"currentColor",opacity:"0.3",vectorEffect:"non-scaling-stroke"}),t.map((d,m)=>{const h=a.left+f*m+f/2,p=Math.max(d.amount/l*c,3),g=a.top+c-p;return o.jsxs("g",{tabIndex:0,"aria-label":`${d.label}: ${V(d.amount,n)}`,className:"outline-none focus-visible:opacity-75",children:[o.jsxs("title",{children:[d.label,": ",V(d.amount,n)]}),o.jsx("rect",{x:h-u/2,y:g,width:u,height:p,rx:"4",className:"fill-primary opacity-80 transition-opacity hover:opacity-100"}),o.jsx("text",{x:h,y:Math.max(g-8,16),textAnchor:"middle",fill:"currentColor",fontSize:"11",fontWeight:"600",children:V(d.amount,n)}),o.jsx("text",{x:h,y:278,textAnchor:"middle",fill:"currentColor",opacity:"0.72",fontSize:"11",children:$o(d.label)}),d.accountId&&o.jsx("text",{x:h,y:295,textAnchor:"middle",fill:"currentColor",opacity:"0.55",fontSize:"9",children:$o(d.accountId)})]},d.key||d.label)}),o.jsxs("text",{x:"18",y:a.top+c/2,transform:`rotate(-90 18 ${a.top+c/2})`,textAnchor:"middle",fill:"currentColor",opacity:"0.65",fontSize:"11",children:["Cost (",n,")"]})]})}const ec="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 Ms({title:e,icon:t,items:n,currency:s}){const[r,a]=P.useState("chart"),i=n.slice(0,6),c=Math.max(...i.map(l=>l.amount),1);return o.jsxs(he,{className:"min-w-0",children:[o.jsxs(Se,{className:"flex flex-row items-center justify-between gap-3 pb-3",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("span",{className:"text-primary",children:t}),o.jsx(Pe,{className:"truncate text-sm",children:e})]}),o.jsxs("div",{className:"flex rounded-md border p-0.5","aria-label":`${e} view`,children:[o.jsx("button",{type:"button",onClick:()=>a("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:o.jsx(Df,{className:"h-4 w-4"})}),o.jsx("button",{type:"button",onClick:()=>a("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:o.jsx(rh,{className:"h-4 w-4"})})]})]}),o.jsx(me,{children:i.length?r==="chart"?o.jsx(ym,{title:e,items:i,currency:s}):o.jsx("div",{className:"space-y-3",children:i.map(l=>o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[o.jsxs("span",{className:"truncate text-muted-foreground",title:l.label,children:[l.label,l.accountId?o.jsxs("span",{className:"ml-1 text-xs",children:["(",l.accountId,")"]}):null]}),o.jsx("span",{className:"shrink-0 font-medium",children:V(l.amount,s)})]}),o.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:"h-full rounded-full bg-primary/75",style:{width:`${l.amount/c*100}%`}})})]},l.key||l.label))}):o.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No cost data for this period."})})]})}function vm(){return o.jsxs("div",{"aria-live":"polite","aria-busy":"true",className:"contents",children:[o.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:Array.from({length:4},(e,t)=>o.jsxs(he,{className:ec,children:[o.jsx(Se,{className:"pb-2",children:o.jsx("div",{className:"h-3 w-24 animate-pulse rounded bg-muted"})}),o.jsxs(me,{children:[o.jsx("div",{className:"h-6 w-3/4 animate-pulse rounded bg-muted"}),o.jsx("div",{className:"mt-3 h-3 w-1/2 animate-pulse rounded bg-muted/80"})]})]},t))}),o.jsxs(he,{children:[o.jsx(Se,{children:o.jsx("div",{className:"h-4 w-36 animate-pulse rounded bg-muted"})}),o.jsx(me,{children:o.jsx("div",{className:"h-72 animate-pulse rounded-lg bg-muted/70"})})]}),o.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:Array.from({length:3},(e,t)=>o.jsxs(he,{children:[o.jsx(Se,{children:o.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted"})}),o.jsx(me,{className:"space-y-4",children:Array.from({length:5},(n,s)=>o.jsxs("div",{children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsx("div",{className:"h-3 w-2/5 animate-pulse rounded bg-muted"}),o.jsx("div",{className:"h-3 w-20 animate-pulse rounded bg-muted"})]}),o.jsx("div",{className:"mt-2 h-1.5 animate-pulse rounded bg-muted/80"})]},s))})]},t))})]})}function wm({data:e,period:t,selectedMonth:n}){const s=e.topServices[0],r=e.topAccounts[0],a=new Date,[i,c]=n.split("-").map(Number),l=t==="monthly"?new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(i,c-1,1)):String(a.getFullYear()),f=[{label:"Total cost",value:o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"block",children:V(e.totalCost,e.currency)}),o.jsxs("span",{className:"mt-1 block text-sm font-medium text-muted-foreground",children:["Accounts: ",e.activeAccounts]})]}),helper:l,icon:o.jsx(Pi,{})},{label:"Active resources",value:e.activeResources==null?o.jsx("span",{className:"text-sm",title:e.activeResourcesMessage,children:"CUR access required"}):Number(e.activeResources).toLocaleString(),helper:`${l} across all accounts`,icon:o.jsx(ns,{})},{label:"Highest cost service",value:s?o.jsx("span",{className:"whitespace-pre-line text-sm",children:`Service - ${s.label}
15
+ Cost - ${V(s.amount,e.currency)}`}):"-",helper:l,icon:o.jsx(Oi,{})},{label:"Highest cost account",value:r?o.jsx("span",{className:"whitespace-pre-line text-sm",children:`Account Name - ${r.label}
16
+ Account Id - ${r.accountId||r.key||"Unknown"}
17
+ Cost - ${V(r.amount,e.currency)}`}):"-",helper:l,icon:o.jsx(ns,{})}];return o.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:f.map(u=>o.jsxs(he,{className:ec,children:[o.jsxs(Se,{className:"flex flex-row items-center justify-between pb-2",children:[o.jsx(Pe,{className:"text-xs font-medium text-muted-foreground",children:u.label}),o.jsx("span",{className:"text-muted-foreground [&>svg]:h-4 [&>svg]:w-4",children:u.icon})]}),o.jsxs(me,{children:[o.jsx("div",{className:"break-words text-base font-semibold leading-snug xl:text-lg",children:u.value}),o.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:u.helper})]})]},u.label))})}function Sm(){const e=new Date,t=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`,[n,s]=P.useState(null),[r,a]=P.useState(!0),[i,c]=P.useState(null),[l,f]=P.useState(null),[u,d]=P.useState("monthly"),[m,h]=P.useState(t),{managementAccountId:p,loading:g}=St(),b=P.useRef(0),x=Array.from({length:e.getMonth()+1},(E,k)=>({value:`${e.getFullYear()}-${String(k+1).padStart(2,"0")}`,label:new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(e.getFullYear(),k,1))})),y=async(E=u,k=m,R=p)=>{const S=++b.current;a(!0),s(null),c(null);try{let A;if(E==="yearly")A={period:E,start:`${e.getFullYear()}-01-01`};else{const[T,L]=k.split("-").map(Number),X=k===t?e.getDate():new Date(T,L,0).getDate();A={period:E,start:`${k}-01`,end:`${k}-${String(X).padStart(2,"0")}`}}const I=R?{managementAccountId:R}:void 0,v=await ce.getDataStatus(I);if(S===b.current&&f(v),!v.ready)return;const O=await ce.getOverview({...A,...I});S===b.current&&s(O)}catch(A){S===b.current&&c(A?.response?.data?.error||A.message||"Failed to load AWS costs")}finally{S===b.current&&a(!1)}};return P.useEffect(()=>{g||y(u,m,p)},[u,m,p,g]),{data:n,dataStatus:l,loading:r||g,error:i,period:u,selectedMonth:m,monthOptions:x,changePeriod:E=>{E!==u&&(a(!0),s(null),d(E))},changeMonth:E=>{E===m||!x.some(k=>k.value===E)||(a(!0),s(null),h(E))},refresh:()=>y(u,m,p)}}function Nm(e){return e==="daily"?"Daily (last 60 days)":e==="yearly"?"Yearly":"Monthly"}function jm(e,t){if(t==="yearly")return e.slice(0,4);const n=new Date(`${e}T00:00:00Z`);return t==="daily"?n.toLocaleDateString(void 0,{day:"numeric",month:"short",timeZone:"UTC"}):n.toLocaleDateString(void 0,{month:"short",year:"2-digit",timeZone:"UTC"})}function Cm(){const{data:e,dataStatus:t,loading:n,error:s,period:r,selectedMonth:a,monthOptions:i,changePeriod:c,changeMonth:l,refresh:f}=Sm();return o.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[o.jsx(Pi,{className:"h-6 w-6 text-primary"}),"Cloud Cost Management"]}),o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Costs for the selected AWS management account and its member accounts"})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(ms,{}),r==="monthly"&&o.jsx("select",{"aria-label":"Cost month",value:a,onChange:u=>l(u.target.value),disabled:n,className:"rounded-lg border bg-background px-3 py-2 text-sm shadow-sm disabled:opacity-50",children:i.map(u=>o.jsx("option",{value:u.value,children:u.label},u.value))}),o.jsx("div",{className:"flex rounded-lg border p-1",children:["monthly","yearly"].map(u=>o.jsx("button",{onClick:()=>c(u),className:`rounded-md px-3 py-1.5 text-sm capitalize transition-colors ${r===u?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:u},u))}),o.jsx("button",{onClick:()=>{f()},disabled:n,className:"rounded-lg border p-2 hover:bg-muted",children:o.jsx(Ft,{className:`h-4 w-4 ${n?"animate-spin":""}`})})]})]}),s&&e&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[o.jsx(Be,{className:"h-4 w-4"}),s]}),n?o.jsx(vm,{}):t&&!t.ready?o.jsx(rs,{status:t}):s&&!e?o.jsx(rs,{status:t,error:s}):e?o.jsxs(o.Fragment,{children:[e.dataSource&&o.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[o.jsx("span",{children:"Source: AWS CUR via SaaS Athena - gross positive unblended charges"}),o.jsxs("span",{children:["CUR: Ready",t?.lastDataAt?`, updated ${new Date(t.lastDataAt).toLocaleString()}`:""]})]}),o.jsx(wm,{data:e,period:r,selectedMonth:a}),e.message&&!/historical data beyond 14 months/i.test(e.message)&&o.jsx(he,{children:o.jsx(me,{className:"py-8 text-center text-sm text-muted-foreground",children:e.message})}),o.jsxs(he,{children:[o.jsxs(Se,{className:"flex flex-row items-center gap-2",children:[o.jsx(Mi,{className:"h-4 w-4 text-primary"}),o.jsxs(Pe,{className:"text-sm",children:["Cost Trend - ",Nm(e.trendGranularity??r)]})]}),o.jsx(me,{children:o.jsx(xm,{points:e.trends.map(u=>({key:u.month,label:jm(u.month,e.trendGranularity??r),value:u.amount})),currency:e.currency})})]}),o.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[o.jsx(Ms,{title:"Top services",icon:o.jsx(Oi,{className:"h-4 w-4"}),items:e.topServices,currency:e.currency}),o.jsx(Ms,{title:"AWS accounts",icon:o.jsx(Ci,{className:"h-4 w-4"}),items:e.topAccounts,currency:e.currency}),o.jsx(Ms,{title:"Regional distribution",icon:o.jsx(ih,{className:"h-4 w-4"}),items:e.topRegions,currency:e.currency})]})]}):null]})}const kn=["#6264e9","#eb67ad","#31c39a","#f29a05","#579bea","#9078ed","#f7842c","#24b9ad","#8ac926","#ffca3a","#6a4c93","#1982c4"];function Uo(e,t){const n=new Date(e.length===10?`${e}T00:00:00Z`:e);return Number.isFinite(n.getTime())?n.toLocaleDateString(void 0,t?{month:"short",day:"numeric"}:{month:"short",year:"numeric"}):e}function Rm({timeline:e,currency:t="USD",daily:n=!1}){const[s,r]=P.useState(null),[a,i]=P.useState(null),c=P.useMemo(()=>{const p=new Map;for(const g of e)for(const b of g.groups)p.set(b.label,(p.get(b.label)||0)+b.amount);return[...p.entries()].sort((g,b)=>b[1]-g[1]).map(([g],b)=>({label:g,color:kn[b%kn.length]}))},[e]),l=new Map(c.map(p=>[p.label,p.color])),f=Math.max(...e.map(p=>p.total),1),u=s??a,d=u==null?null:e[u],m=n?52:80,h=Math.max(520,e.length*m);return e.length?o.jsxs("div",{className:"grid min-w-0 gap-4 lg:grid-cols-[minmax(0,1fr)_288px]",onMouseLeave:()=>r(null),children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"grid min-h-80 min-w-0 grid-cols-[72px_minmax(0,1fr)] gap-3",children:[o.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(p=>o.jsx("span",{children:V(f*p,t)},p))}),o.jsx("div",{className:"min-w-0 overflow-x-auto pb-2",children:o.jsxs("div",{style:{width:h},children:[o.jsxs("div",{className:"relative flex h-64 items-end border-b px-4",children:[[0,25,50,75].map(p=>o.jsx("span",{className:"pointer-events-none absolute left-0 right-0 border-t border-dashed border-slate-200",style:{top:`${p}%`}},p)),e.map((p,g)=>o.jsx("button",{type:"button",onMouseEnter:()=>r(g),onMouseLeave:()=>r(null),onPointerDown:b=>b.preventDefault(),onFocus:()=>i(g),onBlur:()=>i(null),className:"group z-10 flex h-full shrink-0 items-end justify-center px-2 outline-none focus-visible:ring-2 focus-visible:ring-primary",style:{width:m},children:o.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(p.total/f*100,1)}%`},children:p.groups.map(b=>o.jsx("span",{style:{backgroundColor:l.get(b.label)||kn[0],height:`${p.total?b.amount/p.total*100:0}%`}},b.key||b.label))})},`${p.start}-${g}`))]}),o.jsx("div",{className:"flex px-4 pt-2",children:e.map((p,g)=>o.jsx("span",{className:"shrink-0 whitespace-nowrap text-center text-[11px] text-muted-foreground",style:{width:m},children:Uo(p.start,n)},`${p.start}-label-${g}`))})]})})]}),o.jsxs("div",{className:"mt-5 flex min-w-0 flex-wrap gap-x-4 gap-y-2",children:[c.slice(0,8).map(p=>o.jsxs("span",{className:"flex max-w-full min-w-0 items-center gap-1.5 text-xs",children:[o.jsx("span",{className:"h-2.5 w-2.5 shrink-0 rounded-full",style:{backgroundColor:p.color}}),o.jsx("span",{className:"min-w-0 truncate",title:p.label,children:p.label})]},p.label)),c.length>8&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",c.length-8," more"]})]})]}),o.jsx("aside",{"aria-live":"polite",className:"min-h-44",children:d?o.jsxs("div",{role:"tooltip",className:"rounded-2xl border bg-popover p-4 text-popover-foreground shadow-lg",children:[o.jsx("p",{className:"font-semibold",children:Uo(d.start,n)}),o.jsxs("div",{className:"mt-3 space-y-2",children:[[...d.groups].sort((p,g)=>g.amount-p.amount).slice(0,5).map(p=>o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:l.get(p.label)||kn[0]}}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:p.label}),o.jsx("strong",{children:V(p.amount,t)})]},p.key||p.label)),d.groups.length>5&&o.jsxs("p",{className:"text-xs italic text-muted-foreground",children:["+ ",d.groups.length-5," others"]})]}),o.jsxs("div",{className:"mt-3 flex justify-between border-t pt-3 text-sm",children:[o.jsx("strong",{children:"Total"}),o.jsx("strong",{className:"text-primary",children:V(d.total,t)})]})]}):o.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."})})]}):o.jsx("p",{className:"py-24 text-center text-sm text-muted-foreground",children:"No trend data for this period."})}function Em({rows:e,currency:t}){const n=e.slice(0,8),s=Math.max(1,...n.flatMap(r=>[r.current?.amount||0,r.previous?.amount||0]));return o.jsxs(he,{className:"bg-primary/5",children:[o.jsx(Se,{children:o.jsx(Pe,{className:"text-sm",children:"Comparison Overview"})}),o.jsx(me,{children:o.jsxs("div",{className:"rounded-xl border bg-card p-5",children:[o.jsx("div",{className:"flex h-72 items-end gap-4 border-b border-l px-4 pt-4",children:n.map(r=>o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-center",children:[o.jsxs("div",{className:"flex h-56 w-full items-end justify-center gap-1",children:[o.jsx("div",{title:`Current: ${V(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)/s*100,r.current?.amount?1:0)}%`}}),o.jsx("div",{title:`Previous: ${V(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)/s*100,r.previous?.amount?1:0)}%`}})]}),o.jsx("span",{title:r.label,className:"mt-2 w-full truncate text-center text-[10px] text-muted-foreground",children:r.label})]},r.key))}),o.jsxs("div",{className:"mt-4 flex gap-5 text-xs",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("i",{className:"h-2.5 w-2.5 rounded-full bg-indigo-500"}),"Current Period"]}),o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("i",{className:"h-2.5 w-2.5 rounded-full bg-pink-400"}),"Previous Period"]})]})]})})]})}function Fe({label:e,value:t,helper:n,accent:s=!1,trend:r}){return o.jsxs("div",{className:"rounded-xl border bg-card p-5 shadow-sm",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[r!=null&&(r<0?o.jsx(xh,{className:"h-4 w-4 text-red-500"}):o.jsx(Mi,{className:"h-4 w-4 text-emerald-500"})),o.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:e})]}),o.jsx("p",{className:`mt-2 text-2xl font-bold ${s?"text-primary":r!=null&&r<0?"text-red-500":""}`,children:t}),n&&o.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n})]})}function _n({label:e,options:t,selected:n,onChange:s}){const r=n.length?`${n.length} selected`:e;return o.jsxs("details",{className:"group relative",children:[o.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:[o.jsx("span",{children:r}),o.jsx(Ei,{className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),o.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(a=>o.jsxs("label",{className:"flex cursor-pointer items-start gap-2 rounded px-2 py-2 text-xs hover:bg-muted",children:[o.jsx("input",{type:"checkbox",checked:n.includes(a.value),onChange:i=>s(i.target.checked?[...n,a.value]:n.filter(c=>c!==a.value))}),o.jsx("span",{className:"min-w-0 break-words",children:a.label})]},a.value)):o.jsx("p",{className:"p-2 text-xs text-muted-foreground",children:"No values available."})})]})}function km(){return o.jsxs("div",{"aria-live":"polite","aria-busy":"true",className:"space-y-5",children:[o.jsxs("section",{className:"rounded-xl bg-primary/5 p-5",children:[o.jsxs("div",{className:"flex items-center gap-3 text-sm font-medium text-primary",children:[o.jsx(Ge,{className:"h-5 w-5 animate-spin"}),"Loading live AWS cost report..."]}),o.jsx("div",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[1,2,3].map(e=>o.jsx("div",{className:"h-28 animate-pulse rounded-xl border bg-card/70"},e))})]}),o.jsx("div",{className:"h-80 animate-pulse rounded-xl border bg-muted/40"}),o.jsx("div",{className:"h-64 animate-pulse rounded-xl border bg-muted/40"})]})}const st=10,ar=new Date,tc=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,_m=tc(new Date(ar.getFullYear(),ar.getMonth()-2,1)),Pm=tc(ar),Zt={services:[],regions:[],accountIds:[],tagKey:"",tagValues:[]},ze={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 Bo(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 zo(e,t){const n=new Date(`${e}T00:00:00Z`);if(t==="monthly"){const r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),1)),a=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)),i=new Date(r);i.setUTCDate(i.getUTCDate()-1);const c=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1));return{currentStart:r.toISOString().slice(0,10),currentEnd:a.toISOString().slice(0,10),previousStart:c.toISOString().slice(0,10),previousEnd:i.toISOString().slice(0,10)}}const s=new Date(n);return s.setUTCDate(s.getUTCDate()-1),{currentStart:e,currentEnd:e,previousStart:s.toISOString().slice(0,10),previousEnd:s.toISOString().slice(0,10)}}function yt(e,t,n){const s=new Date(`${e}T00:00:00Z`),r=new Date(`${t}T00:00:00Z`);if(n==="monthly"&&s.getUTCFullYear()===r.getUTCFullYear()&&s.getUTCMonth()===r.getUTCMonth())return new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"}).format(s);const a=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"});return`${a.format(s)} – ${a.format(r)}`}function Am(e){const t=new Map;return e.current.summary.forEach(n=>t.set(n.key||n.label,{current:n})),e.previous.summary.forEach(n=>{const s=n.key||n.label;t.set(s,{...t.get(s),previous:n})}),[...t.entries()].map(([n,s])=>{const r=s.current?.amount||0,a=s.previous?.amount||0,i=r-a;return{key:n,label:s.current?.label||s.previous?.label||n,...s,difference:i,change:a?i/Math.abs(a)*100:0}}).sort((n,s)=>Math.max(s.current?.amount||0,s.previous?.amount||0)-Math.max(n.current?.amount||0,n.previous?.amount||0))}function $e(e){return(e||[]).filter(t=>Math.abs(t.amount)>=.005)}function Tm(e,t=3){const n=$e(e);if(!n.length)return"—";const s=n.slice(0,t).map(r=>`${r.label} ${V(r.amount,"USD")}`);return n.length>t?`${s.join(" · ")} · +${n.length-t} more`:s.join(" · ")}function Wo({values:e}){const[t,n]=P.useState(!1);return o.jsxs("div",{className:"relative",children:[o.jsxs("button",{type:"button",onClick:()=>n(s=>!s),className:"inline-flex items-center gap-2 text-primary",children:[o.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-1 text-xs font-semibold",children:e.length}),o.jsx("span",{children:"›"})]}),t&&o.jsxs("div",{className:"absolute right-0 top-8 z-20 w-72 rounded-lg border bg-popover p-3 shadow-xl",children:[o.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[o.jsx("strong",{className:"text-xs",children:"Cost distribution"}),o.jsx("button",{onClick:()=>n(!1),children:o.jsx(Ye,{className:"h-3.5 w-3.5"})})]}),e.length?e.map(s=>o.jsxs("div",{className:"flex justify-between gap-3 border-t py-2 text-xs",children:[o.jsx("span",{className:"min-w-0 truncate",title:s.label,children:s.label}),o.jsx("strong",{children:V(s.amount,"USD")})]},s.key)):o.jsx("p",{className:"text-xs text-muted-foreground",children:"No related values."})]})]})}function nc({page:e,pages:t,total:n,onChange:s}){const r=n?(e-1)*st+1:0,a=Math.min(e*st,n);return o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t px-4 py-4 text-xs text-muted-foreground",children:[o.jsxs("span",{children:["Showing ",r,"–",a," of ",n]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{"aria-label":"Previous page",disabled:e<=1,onClick:()=>s(e-1),className:"rounded-md border p-1.5 disabled:opacity-40",children:o.jsx(Uf,{className:"h-4 w-4"})}),o.jsxs("span",{children:["Page ",e," of ",t]}),o.jsx("button",{"aria-label":"Next page",disabled:e>=t,onClick:()=>s(e+1),className:"rounded-md border p-1.5 disabled:opacity-40",children:o.jsx(ki,{className:"h-4 w-4"})})]})]})}function Om({groupBy:e,report:t}){const[n,s]=P.useState(""),[r,a]=P.useState(1),[i,c]=P.useState(null),[l,f]=P.useState({percentage:!0,accounts:!0,regions:!0}),u=ze[e],d=P.useMemo(()=>{const g=n.trim().toLowerCase();return g?t.summary.filter(b=>`${b.label} ${b.accountId||""}`.toLowerCase().includes(g)):t.summary},[t,n]),m=Math.max(1,Math.ceil(d.length/st)),h=d.slice((r-1)*st,r*st),p=3+Number(l.percentage)+Number(l.accounts)+Number(l.regions);return P.useEffect(()=>{a(1)},[t,n,e]),o.jsxs(he,{children:[o.jsxs(Se,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[o.jsx(Pe,{className:"text-sm text-primary",children:"Cost and usage breakdown"}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsxs("label",{className:"flex items-center gap-2 rounded-full border bg-background px-4 py-2 text-sm",children:[o.jsx(hs,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("input",{"aria-label":"Search breakdown",value:n,onChange:g=>s(g.target.value),placeholder:"Search...",className:"w-48 bg-transparent outline-none"})]}),o.jsxs("details",{className:"relative",children:[o.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 rounded-md border px-3 py-2 text-sm text-primary",children:[o.jsx(Li,{className:"h-4 w-4"}),"Column visibility"]}),o.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])=>o.jsxs("label",{className:"flex gap-2 py-1 text-xs capitalize",children:[o.jsx("input",{type:"checkbox",checked:b,onChange:x=>f(y=>({...y,[g]:x.target.checked}))}),g]},g))})]})]})]}),o.jsx(me,{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b bg-primary/5 text-left text-xs uppercase text-primary",children:[o.jsx("th",{className:"px-4 py-4",children:u.item}),o.jsx("th",{className:"px-4",children:"Cost"}),l.percentage&&o.jsx("th",{className:"px-4",children:"Percentage"}),l.accounts&&o.jsx("th",{className:"px-4",children:"Accounts"}),l.regions&&o.jsx("th",{className:"px-4",children:"Regions"}),o.jsx("th",{className:"px-4 text-center",children:"Actions"})]})}),o.jsx("tbody",{children:h.length?h.map(g=>o.jsxs("tr",{className:"border-b last:border-0",children:[o.jsxs("td",{className:"max-w-72 px-4 py-4 font-medium",children:[o.jsx("div",{className:"truncate",title:g.label,children:g.label}),e==="account"&&o.jsx("div",{className:"font-mono text-xs text-muted-foreground",children:g.accountId||g.key})]}),o.jsx("td",{className:"px-4 font-semibold",children:V(g.amount,t.currency)}),l.percentage&&o.jsxs("td",{className:"px-4",children:[o.jsx("span",{className:"mr-2 inline-block h-1.5 w-12 overflow-hidden rounded-full bg-primary/15 align-middle",children:o.jsx("span",{className:"block h-full bg-primary",style:{width:`${Math.min(g.percentage||0,100)}%`}})}),o.jsxs("strong",{className:"text-primary",children:[g.percentage?.toFixed(2),"%"]})]}),l.accounts&&o.jsx("td",{className:"px-4",children:o.jsx(Wo,{values:$e(g.accounts)})}),l.regions&&o.jsx("td",{className:"px-4",children:o.jsx(Wo,{values:$e(g.regions)})}),o.jsx("td",{className:"px-4 text-center",children:o.jsx("button",{type:"button",onClick:()=>c(g),title:"View cost details",className:"text-primary hover:opacity-70",children:o.jsx(Xf,{className:"h-4 w-4"})})})]},g.key||g.label)):o.jsx("tr",{children:o.jsx("td",{colSpan:p,className:"py-12 text-center text-muted-foreground",children:u.empty})})})]})}),o.jsx(nc,{page:r,pages:m,total:d.length,onChange:a}),i&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",onClick:()=>c(null),children:o.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:[o.jsxs("div",{className:"flex justify-between",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs uppercase text-muted-foreground",children:u.item}),o.jsx("h3",{className:"mt-1 text-lg font-semibold",children:i.label})]}),o.jsx("button",{onClick:()=>c(null),children:o.jsx(Ye,{})})]}),o.jsxs("div",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[o.jsx(Fe,{label:"Cost",value:V(i.amount,t.currency)}),o.jsx(Fe,{label:"Accounts",value:String($e(i.accounts).length)}),o.jsx(Fe,{label:"Regions",value:String($e(i.regions).length)})]}),o.jsxs("div",{className:"mt-5 grid gap-5 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"mb-2 text-sm font-semibold",children:"Accounts"}),$e(i.accounts).map(g=>o.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[o.jsx("span",{children:g.label}),o.jsx("strong",{children:V(g.amount,t.currency)})]},g.key))]}),o.jsxs("div",{children:[o.jsx("h4",{className:"mb-2 text-sm font-semibold",children:"Regions"}),$e(i.regions).map(g=>o.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[o.jsx("span",{children:g.label}),o.jsx("strong",{children:V(g.amount,t.currency)})]},g.key))]})]})]})})]})}function Lm({rows:e,groupBy:t,comparison:n,granularity:s}){const[r,a]=P.useState(""),[i,c]=P.useState(1),l=P.useMemo(()=>{const h=r.trim().toLowerCase();return h?e.filter(p=>p.label.toLowerCase().includes(h)):e},[e,r]),f=Math.max(1,Math.ceil(l.length/st)),u=l.slice((i-1)*st,i*st),d=yt(n.currentStart,n.currentEnd,s),m=yt(n.previousStart,n.previousEnd,s);return P.useEffect(()=>{c(1)},[r,t,n]),o.jsxs(he,{children:[o.jsxs(Se,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[o.jsx(Pe,{className:"text-sm text-primary",children:"Comparison Details"}),o.jsxs("label",{className:"flex items-center gap-2 rounded-full border bg-background px-4 py-2 text-sm",children:[o.jsx(hs,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("input",{"aria-label":"Search comparison",value:r,onChange:h=>a(h.target.value),placeholder:"Search...",className:"w-48 bg-transparent outline-none"})]})]}),o.jsx(me,{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b bg-primary/5 text-left text-xs uppercase text-primary",children:[o.jsxs("th",{className:"px-4 py-4",children:[ze[t].item," name"]}),o.jsxs("th",{className:"px-4",children:[d,o.jsx("small",{className:"block font-normal",children:"Cost"})]}),o.jsxs("th",{className:"px-4",children:[m,o.jsx("small",{className:"block font-normal",children:"Cost"})]}),o.jsx("th",{className:"px-4",children:"Difference"}),o.jsx("th",{className:"px-4",children:"Change %"})]})}),o.jsx("tbody",{children:u.length?u.map(h=>o.jsxs("tr",{className:"border-b",children:[o.jsx("td",{className:"max-w-80 px-4 py-4 font-medium",children:o.jsx("div",{className:"truncate",title:h.label,children:h.label})}),o.jsx("td",{className:"px-4",children:V(h.current?.amount||0,n.current.currency)}),o.jsx("td",{className:"px-4",children:V(h.previous?.amount||0,n.previous.currency)}),o.jsxs("td",{className:`px-4 font-medium ${h.difference<0?"text-red-500":"text-emerald-600"}`,children:[h.difference>=0?"+":"",V(h.difference,n.current.currency)]}),o.jsxs("td",{className:`px-4 font-medium ${h.change<0?"text-red-500":h.change>0?"text-emerald-600":"text-muted-foreground"}`,children:[h.change>0?"+":"",h.change.toFixed(1),"%"]})]},h.key)):o.jsx("tr",{children:o.jsx("td",{colSpan:5,className:"py-12 text-center text-muted-foreground",children:"No comparison data found."})})})]})}),o.jsx(nc,{page:i,pages:f,total:l.length,onChange:c})]})}function Im({report:e,groupBy:t,granularity:n}){const[s,r]=P.useState(""),a=P.useMemo(()=>[...e.timeline||[]].sort((f,u)=>f.start.localeCompare(u.start)),[e.timeline]),i=P.useMemo(()=>{const f=s.trim().toLowerCase();return e.summary.filter(u=>`${u.label} ${u.accountId||""}`.toLowerCase().includes(f))},[e.summary,s]),c=e.currency||"USD",l=f=>{const u=new Date(`${f.slice(0,10)}T00:00:00Z`);return Number.isNaN(u.getTime())?f:new Intl.DateTimeFormat(void 0,{timeZone:"UTC",month:"short",year:"numeric",...n==="daily"?{day:"numeric"}:{}}).format(u)};return o.jsxs(he,{children:[o.jsxs(Se,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx(Pe,{className:"text-sm",children:"Expense and consumption report"}),o.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Costs by ",ze[t].item.toLowerCase()," and ",n==="daily"?"day":"month","."]})]}),o.jsxs("label",{className:"flex items-center gap-2 rounded-md border bg-background px-3 py-2 text-sm",children:[o.jsx(hs,{className:"h-4 w-4 text-muted-foreground"}),o.jsx("input",{"aria-label":"Search expense report",value:s,onChange:f=>r(f.target.value),placeholder:`Search ${ze[t].tab.toLowerCase()}`,className:"w-48 bg-transparent outline-none"})]})]}),o.jsxs(me,{children:[o.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:[i.length," ",i.length===1?"result":"results"," · Total row reflects all results, including those hidden by search."]}),o.jsx("div",{className:"max-h-[32rem] overflow-auto rounded-md border",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{className:"sticky top-0 z-10 bg-muted text-left text-xs uppercase text-muted-foreground",children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",className:"sticky left-0 z-20 min-w-48 bg-muted px-4 py-3",children:ze[t].item}),o.jsx("th",{scope:"col",className:"whitespace-nowrap px-4 py-3 text-right",children:"Total cost"}),a.map(f=>o.jsx("th",{scope:"col",className:"whitespace-nowrap px-4 py-3 text-right",children:l(f.start)},f.start))]})}),o.jsxs("tbody",{children:[o.jsxs("tr",{className:"border-t bg-muted/30 font-semibold",children:[o.jsx("th",{scope:"row",className:"sticky left-0 bg-muted px-4 py-3 text-left",children:"Total"}),o.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-right tabular-nums",children:V(e.totalCost,c)}),a.map(f=>o.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-right tabular-nums",children:V(f.total,c)},f.start))]}),i.map(f=>o.jsxs("tr",{className:"border-t hover:bg-muted/30",children:[o.jsx("th",{scope:"row",className:"sticky left-0 bg-card px-4 py-3 text-left font-medium",children:f.label}),o.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-right tabular-nums",children:V(f.amount,c)}),a.map(u=>{const d=u.groups.find(m=>(m.key||m.label)===(f.key||f.label));return o.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-right tabular-nums",children:V(d?.amount??0,c)},u.start)})]},f.key||f.label)),!i.length&&o.jsx("tr",{children:o.jsx("td",{colSpan:a.length+2,className:"px-4 py-10 text-center text-muted-foreground",children:"No matching results."})})]})]})})]})]})}const sc=e=>["conditional-rightsize","review"].includes(e.recommendation?.kind||""),Mm=e=>e.memoryMiB==null?"Unavailable":`${(e.memoryMiB/1024).toFixed(e.memoryMiB%1024?1:0)} GiB`,ir=e=>e==null?"Unavailable":new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e);function Dm({onClose:e}){const{managementAccountId:t}=St(),[n,s]=P.useState([]),[r,a]=P.useState(t),[i,c]=P.useState(""),[l,f]=P.useState(7),[u,d]=P.useState("all"),[m,h]=P.useState(null),[p,g]=P.useState(null),[b,x]=P.useState({}),[y,w]=P.useState(!1),[C,E]=P.useState("");P.useEffect(()=>{ce.getAccounts({managementAccountId:t}).then(v=>s(v.accounts||[])).catch(()=>E("Unable to load linked accounts."))},[t]);const k=async()=>{w(!0),E(""),h(null);try{const v=await re.get("/optimization/ec2",{params:{managementAccountId:t,accountId:r,region:i.trim(),days:l}});h(v.data)}catch(v){E(v?.response?.data?.error||v.message||"Could not load EC2 instances")}finally{w(!1)}},R=P.useMemo(()=>(m?.instances||[]).filter(v=>u==="all"||v.purchase===u),[m,u]),S=P.useMemo(()=>{const v=new Map;return R.forEach(O=>v.set(O.type,[...v.get(O.type)||[],O])),[...v.entries()]},[R]),A=R.length&&R.every(v=>v.monthlyCost!=null)?R.reduce((v,O)=>v+(O.monthlyCost||0),0):null,I=async()=>{if(!m)return;const[{jsPDF:v},{default:O}]=await Promise.all([Promise.resolve().then(()=>require("./jspdf.es.min-C10id8ME.cjs")).then(L=>L.jspdf_es_min),Promise.resolve().then(()=>require("./jspdf.plugin.autotable-CvTok6mL.cjs"))]),T=new v({orientation:"landscape",unit:"pt",format:"a4"});T.setFontSize(18),T.text("EC2 cost optimization",40,44),T.setFontSize(10),T.text(`${m.accountId} · ${m.region} · ${m.days} days`,40,64),O(T,{startY:82,head:[["Instance","Type","Monthly cost","Max CPU","Purchase","Recommendation"]],body:R.map(L=>[L.name,L.type,ir(L.monthlyCost),L.maxCpu==null?"No data":`${L.maxCpu.toFixed(1)}%`,L.purchase,L.recommendation?.title||"Unavailable"]),styles:{fontSize:8}}),T.save(`ec2-optimization-${m.accountId}-${m.region}.pdf`)};return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-3",onClick:e,children:o.jsxs("section",{role:"dialog","aria-modal":"true",className:"flex max-h-[94vh] w-full max-w-7xl flex-col overflow-hidden rounded-xl bg-background shadow-xl",onClick:v=>v.stopPropagation(),children:[o.jsxs("header",{className:"flex items-start justify-between border-b p-5",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-xl font-bold",children:"EC2 cost optimization"}),o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Analyze utilization and identify sizing actions to validate."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{type:"button",disabled:!m,onClick:()=>{I()},className:"inline-flex h-9 items-center gap-2 rounded-md border px-3 text-sm font-medium hover:bg-muted disabled:opacity-50",children:[o.jsx(fs,{className:"h-4 w-4"}),"Download PDF"]}),o.jsx("button",{"aria-label":"Close",onClick:e,className:"rounded-md p-2 hover:bg-muted",children:o.jsx(Ye,{})})]})]}),o.jsxs("div",{className:"space-y-5 overflow-auto p-5",children:[o.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[o.jsxs("label",{className:"text-xs font-medium",children:["AWS account",o.jsxs("select",{value:r,onChange:v=>a(v.target.value),className:"mt-1 block h-10 rounded-md border bg-background px-3 text-sm",children:[o.jsxs("option",{value:t,children:[t," (management)"]}),n.filter(v=>v.id!==t).map(v=>o.jsxs("option",{value:v.id,children:[v.name," (",v.id,")"]},v.id))]})]}),o.jsxs("label",{className:"text-xs font-medium",children:["AWS region",o.jsx("input",{value:i,onChange:v=>c(v.target.value),placeholder:"e.g. ap-south-1",className:"mt-1 block h-10 rounded-md border bg-background px-3 text-sm"})]}),o.jsxs("label",{className:"text-xs font-medium",children:["CPU history",o.jsxs("select",{value:l,onChange:v=>f(Number(v.target.value)),className:"mt-1 block h-10 rounded-md border bg-background px-3 text-sm",children:[o.jsx("option",{value:7,children:"Last 7 days"}),o.jsx("option",{value:14,children:"Last 14 days"}),o.jsx("option",{value:30,children:"Last 30 days"})]})]}),o.jsxs("button",{type:"button",onClick:()=>{k()},disabled:y||!i.trim(),className:"inline-flex h-10 items-center gap-2 rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground disabled:opacity-50",children:[y&&o.jsx(Ge,{className:"h-4 w-4 animate-spin"}),"Load instances"]})]}),C&&o.jsx("p",{role:"alert",className:"rounded-md border border-destructive/40 p-3 text-sm text-destructive",children:C}),!m&&!y&&o.jsx("p",{className:"rounded-md border p-5 text-sm text-muted-foreground",children:"Select an account and region to load its running instances."}),m&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[["Running instances",String(R.length),"In the selected account and region"],["Under-utilized",String(R.filter(sc).length),`Complete ${l}-day CPU history and peak below 20%`],["Est. monthly cost",ir(A),A==null?"Unavailable when any instance price is missing":"Linux shared-tenancy On-Demand list price"],["Resize candidates",String(R.filter(v=>v.recommendation?.target).length),"Specific targets requiring validation"]].map(([v,O,T])=>o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:v}),o.jsx("p",{className:"mt-2 text-2xl font-semibold",children:O}),o.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:T})]},v))}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Recommendations use daily maximum CPU. Validate memory, CPU credits, network capacity and workload peaks before resizing."}),o.jsxs("section",{className:"rounded-lg border",children:[o.jsxs("div",{className:"flex items-center justify-between border-b p-4",children:[o.jsx("h3",{className:"font-semibold",children:"Running EC2 instances"}),o.jsxs("select",{value:u,onChange:v=>d(v.target.value),className:"rounded-md border bg-background p-2 text-sm",children:[o.jsx("option",{value:"all",children:"On-Demand & Spot"}),o.jsx("option",{value:"On-Demand",children:"On-Demand"}),o.jsx("option",{value:"Spot",children:"Spot"})]})]}),o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full min-w-[800px] text-sm",children:[o.jsx("thead",{className:"bg-muted text-left text-xs uppercase text-muted-foreground",children:o.jsxs("tr",{children:[o.jsx("th",{className:"p-3",children:"Instance type / name"}),o.jsx("th",{className:"p-3",children:"Recommended action"}),o.jsxs("th",{className:"p-3",children:["Max CPU (",l," days)"]}),o.jsx("th",{className:"p-3",children:"Purchase"}),o.jsx("th",{className:"p-3",children:"Status"})]})}),o.jsx("tbody",{children:S.map(([v,O])=>o.jsx(Fm,{type:v,rows:O,open:!!b[v],toggle:()=>x(T=>({...T,[v]:!T[v]})),select:g},v))})]})})]})]})]}),p&&o.jsx($m,{item:p,days:l,close:()=>g(null)})]})})}function Fm({type:e,rows:t,open:n,toggle:s,select:r}){const a=t.filter(sc).length;return o.jsxs(o.Fragment,{children:[o.jsxs("tr",{className:"border-t bg-muted/30",children:[o.jsx("th",{className:"p-3 text-left",children:o.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-2",children:[n?o.jsx(Ei,{className:"h-4 w-4"}):o.jsx(ki,{className:"h-4 w-4"}),e," (",t.length,")"]})}),o.jsx("td",{className:"p-3",children:a?`${a} to review`:"No resize candidate"}),o.jsx("td",{className:"p-3",children:a?`${a} under-utilized`:"Observed"}),o.jsxs("td",{className:"p-3",children:[t.filter(i=>i.purchase==="On-Demand").length," On-Demand, ",t.filter(i=>i.purchase==="Spot").length," Spot"]}),o.jsx("td",{className:"p-3",children:a?"Review needed":"Observed"})]}),n&&t.map(i=>o.jsxs("tr",{className:"border-t",children:[o.jsx("th",{className:"p-3 pl-9 text-left",children:o.jsxs("button",{type:"button",onClick:()=>r(i),className:"text-primary hover:underline",children:[i.name,o.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:[ir(i.monthlyCost),"/mo"]})]})}),o.jsx("td",{className:"p-3",children:i.recommendation?.target?`Evaluate ${i.recommendation.target}`:i.recommendation?.title||"Unavailable"}),o.jsx("td",{className:"p-3",children:i.maxCpu==null?"No data":`${i.maxCpu.toFixed(1)}%`}),o.jsx("td",{className:"p-3",children:i.purchase}),o.jsx("td",{className:"p-3",children:i.recommendation?.status||"Unavailable"})]},i.id))]})}function $m({item:e,days:t,close:n}){return o.jsx("div",{className:"absolute inset-0 z-10 flex justify-end bg-black/40",onClick:n,children:o.jsxs("aside",{className:"h-full w-full max-w-lg overflow-auto bg-background p-6 shadow-xl",onClick:s=>s.stopPropagation(),children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-bold",children:e.name}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e.id})]}),o.jsx("button",{"aria-label":"Close details",onClick:n,children:o.jsx(Ye,{})})]}),o.jsxs("div",{className:"mt-6 rounded-lg border p-4",children:[o.jsx("h4",{className:"font-semibold",children:"Instance overview"}),o.jsxs("dl",{className:"mt-4 grid grid-cols-2 gap-4 text-sm",children:[o.jsxs("div",{children:[o.jsx("dt",{className:"text-muted-foreground",children:"Type"}),o.jsx("dd",{children:e.type})]}),o.jsxs("div",{children:[o.jsx("dt",{className:"text-muted-foreground",children:"Architecture"}),o.jsx("dd",{children:e.architecture||"Unavailable"})]}),o.jsxs("div",{children:[o.jsx("dt",{className:"text-muted-foreground",children:"vCPU / memory"}),o.jsx("dd",{children:e.vcpus==null?"Unavailable":`${e.vcpus} / ${Mm(e)}`})]}),o.jsxs("div",{children:[o.jsx("dt",{className:"text-muted-foreground",children:"Max CPU"}),o.jsx("dd",{children:e.maxCpu==null?"No data":`${e.maxCpu.toFixed(1)}%`})]})]})]}),o.jsxs("div",{className:"mt-4 rounded-lg border p-4",children:[o.jsxs("h4",{className:"font-semibold",children:["Daily maximum CPU (",t," days)"]}),e.cpu.map(s=>o.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs",children:[o.jsx("time",{className:"w-24",children:s.time.slice(0,10)}),o.jsx("div",{className:"h-2 flex-1 rounded bg-muted",children:o.jsx("div",{className:"h-2 rounded bg-primary",style:{width:`${Math.min(100,s.value)}%`}})}),o.jsxs("span",{children:[s.value.toFixed(1),"%"]})]},s.time))]}),o.jsxs("div",{className:"mt-4 rounded-lg border p-4",children:[o.jsx("h4",{className:"font-semibold",children:"Recommended action"}),o.jsx("p",{className:"mt-2 text-sm font-medium",children:e.recommendation?.title||"Recommendation unavailable"}),o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:e.recommendation?.action}),o.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["CPU data covers ",e.recommendation?.observedDays??0," of ",e.recommendation?.requiredDays??t," required days."]})]})]})})}function Um(e){const{mode:t,groupBy:n,start:s,end:r,granularity:a,reportTagKey:i,options:c,filters:l,loading:f,filtersLoading:u,comparisonPeriods:d}=e;return o.jsxs("aside",{className:"space-y-4",children:[o.jsxs(he,{className:"bg-primary/5",children:[o.jsx(Se,{children:o.jsx(Pe,{className:"text-sm uppercase text-primary",children:"Report parameters"})}),o.jsxs(me,{className:"space-y-4",children:[o.jsxs("div",{className:"flex gap-2",children:[o.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"}),o.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"&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Start date",o.jsx("input",{type:"date",value:s,onChange:m=>e.onStartChange(m.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground"})]}),o.jsxs("label",{className:"block text-xs text-muted-foreground",children:["End date",o.jsx("input",{type:"date",value:r,onChange:m=>e.onEndChange(m.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground"})]})]}),o.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Granularity",o.jsxs("select",{value:a,onChange:m=>e.onGranularityChange(m.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground",children:[o.jsx("option",{value:"monthly",children:"Monthly"}),o.jsx("option",{value:"daily",children:"Daily"})]})]}),t==="compare"&&o.jsxs("p",{className:"rounded-md bg-background p-2 text-xs text-muted-foreground",children:["Current: ",d.currentStart," to ",d.currentEnd,o.jsx("br",{}),"Previous: ",d.previousStart," to ",d.previousEnd]}),n==="tag"&&o.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Group by tag key",o.jsxs("select",{value:c.tagKeys.includes(i)?i:"",onChange:m=>e.onReportTagKeyChange(m.target.value),disabled:!c.tagKeys.length,className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground disabled:opacity-60",children:[o.jsx("option",{value:"",children:u?"Loading tag keys...":"Select a tag key"}),c.tagKeys.map(m=>o.jsx("option",{children:m},m))]}),!u&&!c.tagKeys.length&&o.jsx("span",{className:"mt-2 block text-xs text-muted-foreground",children:"No activated AWS cost allocation tags are present in this CUR data."})]}),o.jsxs("button",{onClick:e.onRun,disabled:f||n==="tag"&&!c.tagKeys.length,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:[o.jsx(Ft,{className:`h-4 w-4 ${f?"animate-spin":""}`}),"Run report"]})]})]}),o.jsxs(he,{className:"bg-primary/5",children:[o.jsx(Se,{children:o.jsx(Pe,{className:"text-sm uppercase text-primary",children:"Filter by"})}),o.jsxs(me,{className:"space-y-3",children:[o.jsx(_n,{label:"Services",options:c.services,selected:l.services,onChange:m=>e.onFiltersChange(h=>({...h,services:m}))}),o.jsx(_n,{label:"Region",options:c.regions,selected:l.regions,onChange:m=>e.onFiltersChange(h=>({...h,regions:m}))}),o.jsx(_n,{label:"Linked Account",options:c.accounts,selected:l.accountIds,onChange:m=>e.onFiltersChange(h=>({...h,accountIds:m}))}),o.jsxs("select",{value:l.tagKey,onChange:m=>{const h=m.target.value;e.onFiltersChange(p=>({...p,tagKey:h,tagValues:[]})),h&&e.onLoadTagValues(h)},className:"w-full rounded-lg border bg-background px-3 py-3 text-sm text-primary",children:[o.jsx("option",{value:"",children:"Tag key"}),c.tagKeys.map(m=>o.jsx("option",{children:m},m))]}),l.tagKey&&o.jsx(_n,{label:"Tag values",options:c.tagValues.map(m=>({value:m,label:m})),selected:l.tagValues,onChange:m=>e.onFiltersChange(h=>({...h,tagValues:m}))}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[o.jsx("button",{onClick:e.onApply,disabled:u||f,className:"rounded-md bg-primary px-3 py-2 text-sm font-semibold text-primary-foreground disabled:opacity-50",children:"Apply Filters"}),o.jsx("button",{onClick:e.onReset,disabled:f,className:"rounded-md border bg-background px-3 py-2 text-sm text-primary disabled:opacity-50",children:"Reset"})]})]})]})]})}function Bm(){const{managementAccountId:e,loading:t}=St(),[n,s]=P.useState("service"),[r,a]=P.useState("standard"),[i,c]=P.useState(_m),[l,f]=P.useState(Pm),[u,d]=P.useState("monthly"),[m,h]=P.useState("Name"),[p,g]=P.useState({services:[],regions:[],accounts:[],tagKeys:[],tagValues:[]}),[b,x]=P.useState(Zt),[y,w]=P.useState(Zt),[C,E]=P.useState(null),[k,R]=P.useState(null),[S,A]=P.useState(!0),[I,v]=P.useState(!1),[O,T]=P.useState(null),[L,X]=P.useState(null),[Z,W]=P.useState(null),[le,we]=P.useState("monthly"),[D,_]=P.useState(!1),U=P.useRef(0),G=P.useRef(0),Y=P.useMemo(()=>k?Am(k):[],[k]),K=zo(l,u),z=(q,B,se,ee,oe=m)=>({start:B,end:se,groupBy:ee,granularity:u,tagKey:oe,services:q.services.join(","),regions:q.regions.join(","),accountIds:q.accountIds.join(","),filterTagKey:q.tagKey||void 0,tagValues:q.tagValues.join(","),managementAccountId:e}),H=async(q="")=>{const B=++G.current,se=()=>B===G.current;v(!0),X(null);try{if(!q){const oe=await ce.getDataStatus({managementAccountId:e});if(!se()||(W(oe),!oe.ready))return}const ee=await ce.getFilterOptions({start:i,end:l,filterTagKey:q||void 0,managementAccountId:e});if(!se())return;if(g(oe=>q?{...oe,tagValues:ee.tagValues}:ee),!q&&ee.tagKeys.length&&!ee.tagKeys.includes(m)){const oe=ee.tagKeys[0];h(oe),n==="tag"&&ne(y,r,n,oe)}}catch(ee){se()&&X(ee?.response?.data?.error||ee.message||"Failed to load filter values")}finally{se()&&v(!1)}},ne=async(q=y,B=r,se=n,ee=m)=>{const oe=++U.current,ke=u;A(!0),T(null);try{const We=await ce.getDataStatus({managementAccountId:e});if(oe===U.current&&W(We),!We.ready)return;if(B==="compare"){const ge=zo(l,u),[gn,xn]=await Promise.all([ce.getReports(z(q,ge.currentStart,ge.currentEnd,se,ee)),ce.getReports(z(q,ge.previousStart,ge.previousEnd,se,ee))]);oe===U.current&&(E(gn),R({current:gn,previous:xn,...ge}),we(ke))}else{const ge=await ce.getReports(z(q,i,l,se,ee));oe===U.current&&(E(ge),R(null),we(ke))}}catch(We){oe===U.current&&T(We?.response?.data?.error||We.message||"Failed to generate cost report")}finally{oe===U.current&&A(!1)}};return P.useEffect(()=>{t||(E(null),R(null),W(null),g({services:[],regions:[],accounts:[],tagKeys:[],tagValues:[]}),ne(y,r,n),H())},[e,t]),{groupBy:n,mode:r,start:i,end:l,granularity:u,loadedGranularity:le,reportTagKey:m,options:p,draftFilters:b,report:C,comparison:k,loading:S||t,filtersLoading:I,error:O,optionsError:L,dataStatus:Z,comparedRows:Y,exporting:D,exportExcel:async()=>{_(!0),T(null);try{const q=await ce.downloadReportExcel(z(y,i,l,n)),B=document.createElement("a");B.href=URL.createObjectURL(q),B.download=`cost-report-${n}-${i}-to-${l}.xlsx`,B.click(),URL.revokeObjectURL(B.href)}catch(q){const B=q?.response?.data,se=B instanceof Blob?await B.text().then(ee=>{try{return JSON.parse(ee).error}catch{return null}}):B?.error;T(se||q.message||"Failed to export the Excel report")}finally{_(!1)}},selectedComparisonPeriods:K,setStart:c,setEnd:f,setGranularity:d,setReportTagKey:h,setDraftFilters:x,changeGroup:q=>{q!==n&&(A(!0),E(null),R(null),s(q),ne(y,r,q))},changeMode:q=>{q!==r&&(A(!0),E(null),R(null),a(q),ne(y,q,n))},applyFilters:()=>{const q={...b,services:[...b.services],regions:[...b.regions],accountIds:[...b.accountIds],tagValues:[...b.tagValues]};w(q),ne(q)},resetFilters:()=>{x(Zt),w(Zt),ne(Zt)},runReport:()=>{H(),ne()},loadOptions:H}}const zm=244.5,Wm=176.25,Vm=["M 19.859375 58.675781 L 39.632812 51.285156 C 44.828125 49.34375 50.582031 49.546875 55.628906 51.847656 C 60.671875 54.148438 64.597656 58.359375 66.539062 63.554688 L 92.679688 133.496094 C 94.621094 138.691406 94.417969 144.445312 92.121094 149.492188 C 89.820312 154.539062 85.609375 158.464844 80.414062 160.40625 L 60.640625 167.796875 C 55.445312 169.738281 49.691406 169.535156 44.644531 167.234375 C 39.597656 164.933594 35.671875 160.722656 33.730469 155.527344 L 7.589844 85.585938 C 5.648438 80.390625 5.851562 74.636719 8.152344 69.589844 C 10.453125 64.542969 14.664062 60.617188 19.859375 58.675781 Z","M 153.785156 34.167969 L 179.054688 24.722656 C 184.25 22.78125 190.003906 22.984375 195.050781 25.285156 C 200.09375 27.585938 204.019531 31.796875 205.960938 36.992188 L 235.671875 116.488281 C 237.613281 121.683594 237.414062 127.4375 235.113281 132.480469 C 232.8125 137.527344 228.601562 141.453125 223.40625 143.394531 L 198.136719 152.839844 C 192.941406 154.78125 187.1875 154.578125 182.144531 152.277344 C 177.097656 149.976562 173.171875 145.765625 171.230469 140.570312 L 141.519531 61.074219 C 139.578125 55.878906 139.78125 50.128906 142.078125 45.082031 C 144.378906 40.035156 148.589844 36.109375 153.785156 34.167969 Z","M 74.496094 19.945312 L 101.289062 9.933594 C 108.339844 7.296875 116.148438 7.570312 122.996094 10.695312 C 129.84375 13.816406 135.171875 19.53125 137.804688 26.582031 L 170.621094 114.390625 C 173.257812 121.441406 172.984375 129.25 169.863281 136.097656 C 166.738281 142.945312 161.023438 148.273438 153.972656 150.910156 L 127.183594 160.921875 C 120.132812 163.554688 112.324219 163.28125 105.476562 160.160156 C 98.628906 157.039062 93.300781 151.324219 90.664062 144.273438 L 57.847656 56.464844 C 55.214844 49.414062 55.488281 41.605469 58.609375 34.757812 C 61.730469 27.90625 67.445312 22.582031 74.496094 19.945312 Z"];function Hm(e,t,n,s){const r=e.split(/\s+/),a=[],i=c=>[t+Number(r[c])*s,n+Number(r[c+1])*s];for(let c=0;c<r.length;){const l=r[c];l==="M"||l==="L"?(a.push({op:l.toLowerCase()==="m"?"m":"l",c:i(c+1)}),c+=3):l==="C"?(a.push({op:"c",c:[...i(c+1),...i(c+3),...i(c+5)]}),c+=7):(a.push({op:"h",c:[]}),c+=1)}return a}function qm(e,t,n,s,r){const a=s/Wm;e.setFillColor(...r);for(const c of Vm)e.path(Hm(c,t,n,a)).fill();const i=t+zm*a+s*.3;return e.setFont("helvetica","bold"),e.setFontSize(s*.82),e.setTextColor(...r),e.text("Meyicloud",i,n+s*.8),i-t+e.getTextWidth("Meyicloud")}function Gm(e){const{report:t,comparison:n,rows:s,groupBy:r,mode:a}=e,i=ze[r];let c,l;a==="compare"&&n?(c=[[i.item,"Current Cost","Previous Cost","Difference","Change %"].join(","),...s.map(u=>[`"${u.label.replace(/"/g,'""')}"`,u.current?.amount||0,u.previous?.amount||0,u.difference,u.change.toFixed(2)].join(","))].join(`
18
+ `),l=`comparison-report-${r}-${Date.now()}.csv`):(c=[[i.item,"Cost","Percentage","Accounts","Regions"].join(","),...t.summary.map(u=>[`"${u.label.replace(/"/g,'""')}"`,u.amount,u.percentage||0,$e(u.accounts).length,$e(u.regions).length].join(","))].join(`
19
+ `),l=`${r}-summary-report-${Date.now()}.csv`);const f=document.createElement("a");f.href=URL.createObjectURL(new Blob([c],{type:"text/csv"})),f.download=l,f.click(),URL.revokeObjectURL(f.href)}const Rr=[10,36,99],Km=[255,107,53],$t=[20,20,19],He=[107,114,128],Er=[226,232,240],cr=[245,247,250],Ym=[219,226,239],Vo=[185,28,28],Ho=[21,128,61],be=40,qo="Gross unblended cost from the AWS Cost and Usage Report; credits and refunds are excluded.",Jm=e=>e.startsWith("arn:")&&e.split(":").slice(5).join(":")||e,Xm=e=>{const t=$e(e);return t.length?`${t[0].label}${t.length>1?` +${t.length-1}`:""}`:"—"},Zm=(e,t)=>yt(e,t,"daily"),Ds=(e,t)=>{const n=Math.round(e*100)/100;return`${n>0?"+":n<0?"-":""}${V(Math.abs(n),t)}`};function Qm(e,t,n,s,r){let a=s;for(e.setFontSize(a);e.getTextWidth(t)>n&&a>r;)e.setFontSize(a-=.5);if(e.getTextWidth(t)<=n)return t;let i=t;for(;i.length>1&&e.getTextWidth(`${i}…`)>n;)i=i.slice(0,-1);return`${i.trimEnd()}…`}function Go(e,t){let n=e.lastAutoTable.finalY+18;e.setFont("helvetica","normal"),e.setFontSize(7.5),e.setTextColor(...He);for(const s of t)n>e.internal.pageSize.getHeight()-50&&(e.addPage(),n=48),e.text(s,be,n),n+=12}const Fs=e=>`${e>0?"+":""}${e.toFixed(1)}%`;function Ko(e,t,n){const s=e.internal.pageSize.getWidth(),r=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date);e.setFillColor(...Rr),e.rect(0,0,s,104,"F"),e.setFillColor(...Km),e.rect(0,104,s,3,"F"),qm(e,be,20,18,[255,255,255]),e.setTextColor(255,255,255),e.setFont("helvetica","bold"),e.setFontSize(18),e.text(t,be,70),e.setFont("helvetica","normal"),e.setFontSize(9.5),e.text(n,be,88),e.setFontSize(8),e.text("AWS cost report",s-be,33,{align:"right"}),e.text(`Generated ${r}`,s-be,88,{align:"right"})}function Yo(e,t,n){const r=(e.internal.pageSize.getWidth()-be*2-10*(n.length-1))/n.length,a=64;return n.forEach((i,c)=>{const l=be+c*(r+10);e.setFillColor(...cr),e.setDrawColor(...Er),e.setLineWidth(.6),e.roundedRect(l,t,r,a,5,5,"FD"),e.setFont("helvetica","bold"),e.setFontSize(7),e.setTextColor(...He),e.text(i.label.toUpperCase(),l+12,t+18),e.setTextColor(...i.tone||$t),e.text(Qm(e,i.value,r-24,14,10),l+12,t+38),i.helper&&(e.setFont("helvetica","normal"),e.setFontSize(7.5),e.setTextColor(...He),e.text(e.splitTextToSize(i.helper,r-24)[0],l+12,t+54))}),t+a}function Jo(e,t,n){e.setFont("helvetica","bold"),e.setFontSize(11),e.setTextColor(...$t),e.text(t,be,n)}function Xo(e,t){const n=e.getNumberOfPages(),s=e.internal.pageSize.getWidth(),r=e.internal.pageSize.getHeight();for(let a=1;a<=n;a+=1)e.setPage(a),e.setDrawColor(...Er),e.setLineWidth(.6),e.line(be,r-34,s-be,r-34),e.setFont("helvetica","normal"),e.setFontSize(7),e.setTextColor(...He),e.text(`Meyi Connect · ${t} · All amounts in USD`,be,r-20),e.text(`Page ${a} of ${n}`,s-be,r-20,{align:"right"})}function $s(e){return{theme:"plain",margin:{left:be,right:be,top:40,bottom:50},styles:{font:"helvetica",fontSize:8,textColor:$t,cellPadding:{top:6,right:6,bottom:6,left:6},valign:"middle",overflow:"linebreak",lineColor:Er},headStyles:{fillColor:cr,textColor:Rr,fontStyle:"bold",fontSize:7.5},footStyles:{fillColor:cr,textColor:$t,fontStyle:"bold"},alternateRowStyles:{fillColor:[250,250,252]},showFoot:"lastPage",didParseCell:t=>{t.cell.styles.lineWidth={bottom:.5},e.includes(t.column.index)&&(t.cell.styles.halign="right")}}}async function ep(e){const{report:t,comparison:n,rows:s,groupBy:r,mode:a,start:i,end:c,granularity:l}=e,f=ze[r],u=t.currency||"USD",[{jsPDF:d},{default:m}]=await Promise.all([Promise.resolve().then(()=>require("./jspdf.es.min-C10id8ME.cjs")).then(v=>v.jspdf_es_min),Promise.resolve().then(()=>require("./jspdf.plugin.autotable-CvTok6mL.cjs"))]),h=new d({orientation:"portrait",unit:"pt",format:"a4"});if(a==="compare"&&n){const v=yt(n.currentStart,n.currentEnd,l),O=yt(n.previousStart,n.previousEnd,l),T=n.current.totalCost-n.previous.totalCost,L=n.previous.totalCost?T/Math.abs(n.previous.totalCost)*100:0;Ko(h,`${f.pdfTitle.replace(/ Report$/,"")} Comparison`,`${v} vs ${O}`);const X=Yo(h,128,[{label:v,value:V(n.current.totalCost,u),helper:"Current period"},{label:O,value:V(n.previous.totalCost,u),helper:"Previous period"},{label:"Change",value:Ds(T,u),helper:n.previous.totalCost?`${Fs(L)} vs previous period`:"No spend in the previous period",tone:T>0?Vo:T<0?Ho:$t}]);Jo(h,`Cost by ${f.item.toLowerCase()}`,X+28);const Z=s.filter(W=>Math.abs(W.current?.amount||0)>=.005||Math.abs(W.previous?.amount||0)>=.005);return m(h,{...$s([2,3,4,5]),startY:X+38,head:[["#",f.item,v,O,"Difference","Change"]],body:Z.map((W,le)=>[String(le+1),W.label,V(W.current?.amount||0,u),V(W.previous?.amount||0,u),Ds(W.difference,u),W.previous?.amount?Fs(W.change):"New"]),foot:[["","Total",V(n.current.totalCost,u),V(n.previous.totalCost,u),Ds(T,u),n.previous.totalCost?Fs(L):"—"]],columnStyles:{0:{cellWidth:24,textColor:He},1:{minCellWidth:120},2:{cellWidth:78},3:{cellWidth:78},4:{cellWidth:72},5:{cellWidth:52}},didParseCell:W=>{if($s([2,3,4,5]).didParseCell(W),W.section!=="head"&&(W.column.index===4||W.column.index===5)){const le=Math.round((W.section==="foot"?T:Z[W.row.index]?.difference||0)*100);W.cell.styles.textColor=le>0?Vo:le<0?Ho:$t}}}),Go(h,[qo]),Xo(h,`${O} vs ${v}`),{pdf:h,filename:`comparison-report-${r}-${Date.now()}.pdf`}}const p=t.summary.filter(v=>Math.abs(v.amount)>=.005),g=p[0],b=Zm(i,c);Ko(h,f.pdfTitle,b);const x=Yo(h,128,[{label:"Total cost",value:V(t.totalCost,u),helper:b},{label:f.top.replace(/ cost$/,""),value:g?r==="resource"?Jm(g.label):g.label:"—",helper:g?`${V(g.amount,u)} · ${(g.percentage||0).toFixed(1)}% of total`:void 0},{label:f.count,value:String(p.length),helper:"With spend in this period"}]);Jo(h,`Cost by ${f.item.toLowerCase()}`,x+28);const y=(v,O,T,L=3)=>({header:O,width:v,value:X=>Tm(T(X),L),style:{textColor:He,fontSize:7}}),w=(v,O,T)=>({header:O,width:v,value:L=>Xm(T(L)),style:{textColor:He}}),C=r==="account"?[y(150,"Top regions",v=>v.regions)]:r==="resource"?[w(88,"Account",v=>v.accounts),w(66,"Region",v=>v.regions)]:r==="region"?[y(170,"Top accounts",v=>v.accounts,2)]:[y(120,"Top accounts",v=>v.accounts,2),y(120,"Top regions",v=>v.regions)],E=[{header:"#",width:24,value:(v,O)=>String(O+1),style:{textColor:He}},{header:f.item,value:v=>v.label,style:r==="resource"?{fontSize:7.5}:{}},...r==="account"?[{header:"Account ID",width:78,value:v=>v.accountId||v.key||"—",style:{textColor:He}}]:[],...r==="resource"?C:[],{header:"Cost",width:66,value:v=>V(v.amount,u),style:{fontStyle:"bold"},numeric:!0},{header:"Share",width:70,value:v=>`${(v.percentage||0).toFixed(1)}%`,numeric:!0},...r==="resource"?[]:C],k=E.reduce((v,O)=>v+(O.width||0),0),R=h.internal.pageSize.getWidth()-be*2-k,S=E.findIndex(v=>v.header==="Cost"),A=S+1,I=$s(E.flatMap((v,O)=>v.numeric?[O]:[]));return m(h,{...I,startY:x+38,head:[E.map(v=>v.header)],body:p.map((v,O)=>E.map(T=>T.value(v,O))),foot:[E.map((v,O)=>O===1?"Total":O===S?V(t.totalCost,u):O===A?"100%":"")],columnStyles:Object.fromEntries(E.map((v,O)=>[O,{cellWidth:v.width??R,...v.style}])),didDrawCell:v=>{if(v.section!=="body"||v.column.index!==A)return;const O=Math.min(Math.max(p[v.row.index]?.percentage||0,0),100),T=v.cell.x+6,L=v.cell.y+v.cell.height/2-1.5;h.setFillColor(...Ym),h.roundedRect(T,L,28,3,1.5,1.5,"F"),O>0&&(h.setFillColor(...Rr),h.roundedRect(T,L,Math.max(28*O/100,1.5),3,1.5,1.5,"F"))}}),Go(h,[qo,...t.message?[t.message]:[]]),Xo(h,b),{pdf:h,filename:`${r}-summary-report-${Date.now()}.pdf`}}async function tp(e){const{pdf:t,filename:n}=await ep(e);t.save(n)}function np(){const[e,t]=P.useState(!1),n=Bm(),{groupBy:s,mode:r,report:a,comparison:i,comparedRows:c,loading:l,error:f,dataStatus:u,loadedGranularity:d,start:m,end:h}=n,p=ze[s],g=a?.summary[0],b=i?i.current.totalCost-i.previous.totalCost:0,x=i?.previous.totalCost?b/Math.abs(i.previous.totalCost)*100:0,y=a?{report:a,comparison:i,rows:c,groupBy:s,mode:r,start:m,end:h,granularity:d}:null,w=o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("button",{onClick:()=>y&&void tp(y),disabled:!y||l,className:"flex items-center gap-2 rounded-md border bg-card px-3 py-1.5 text-sm disabled:opacity-50",children:[o.jsx(Qf,{className:"h-4 w-4"}),"PDF"]}),o.jsxs("button",{onClick:()=>y&&Gm(y),disabled:!y||l,className:"flex items-center gap-2 rounded-md border bg-card px-3 py-1.5 text-sm disabled:opacity-50",children:[o.jsx(fs,{className:"h-4 w-4"}),"CSV"]}),o.jsxs("button",{onClick:()=>{n.exportExcel()},disabled:!a||l||n.exporting||r==="compare",title:r==="compare"?"Excel export covers a single period; switch to the standard report":"Resource-level cost workbook with a sheet per group",className:"flex items-center gap-2 rounded-md border bg-card px-3 py-1.5 text-sm disabled:opacity-50",children:[n.exporting?o.jsx(Ge,{className:"h-4 w-4 animate-spin"}):o.jsx(th,{className:"h-4 w-4"}),n.exporting?"Exporting…":"Excel"]})]});return o.jsxs("div",{className:"flex w-full flex-col gap-5 p-2 md:p-6",children:[o.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[o.jsx(Ti,{className:"h-6 w-6 text-primary"}),"Cost reports"]}),o.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"})]}),o.jsx(ms,{})]}),!l&&(u&&!u.ready||f&&!u)?o.jsx(rs,{status:u,error:f}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex gap-1 overflow-x-auto border-b",children:Object.keys(ze).map(C=>o.jsx("button",{onClick:()=>n.changeGroup(C),className:`border-b-2 px-4 py-3 text-sm font-medium ${s===C?"border-primary text-primary":"border-transparent text-muted-foreground"}`,children:ze[C].tab},C))}),o.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)] gap-5 xl:grid-cols-[minmax(0,1fr)_320px]",children:[o.jsxs("div",{className:`min-w-0 space-y-5 transition-opacity ${l&&(a||i)?"pointer-events-none opacity-60":""}`,"aria-busy":l,children:[f&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[o.jsx(Be,{className:"h-4 w-4"}),f]}),n.optionsError&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border bg-muted/50 p-3 text-sm text-muted-foreground",children:[o.jsx(Be,{className:"h-4 w-4"}),n.optionsError]}),l&&!a&&!i?o.jsx(km,{}):r==="compare"&&i?o.jsxs(o.Fragment,{children:[o.jsxs("section",{className:"rounded-xl bg-primary/5 p-4",children:[o.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-sm font-semibold",children:"Comparison Cost Summary"}),o.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Updated On: ",Bo(i.current.updatedAt)]})]}),w]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[o.jsx(Fe,{label:"Period accrued total",value:`${V(i.current.totalCost,i.current.currency)} vs ${V(i.previous.totalCost,i.previous.currency)}`,helper:`${x>=0?"+":""}${x.toFixed(1)}% from previous period`,trend:x}),o.jsx(Fe,{label:yt(i.currentStart,i.currentEnd,d),value:V(i.current.totalCost,i.current.currency),helper:"Current period spending"}),o.jsx(Fe,{label:yt(i.previousStart,i.previousEnd,d),value:V(i.previous.totalCost,i.previous.currency),helper:"Previous period spending"}),o.jsx(Fe,{label:d==="monthly"?"Monthly change":"Period change",value:`${b>=0?"+":""}${V(b,i.current.currency)}`,helper:`${x>=0?"+":""}${x.toFixed(1)}% from previous period`,trend:b})]})]}),o.jsx(Em,{rows:c,currency:i.current.currency}),o.jsx(Lm,{rows:c,groupBy:s,comparison:i,granularity:d})]}):a?o.jsxs(o.Fragment,{children:[a.message&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border bg-muted/50 p-3 text-sm text-muted-foreground",children:[o.jsx(Be,{className:"h-4 w-4"}),a.message]}),o.jsxs("section",{className:"rounded-xl bg-primary/5 p-4",children:[o.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-sm font-semibold",children:p.title}),o.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Updated On: ",Bo(a.updatedAt)]})]}),w]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[o.jsx(Fe,{label:"Accrued cost",value:V(a.totalCost,a.currency)}),o.jsx(Fe,{label:p.top,value:g?V(g.amount,a.currency):"-",accent:!0}),o.jsx(Fe,{label:p.count,value:String(a.count||0),accent:!0})]})]}),o.jsxs(he,{children:[o.jsx(Se,{children:o.jsx(Pe,{className:"text-sm",children:"Cost Trend"})}),o.jsx(me,{children:o.jsx(Rm,{timeline:a.timeline||[],currency:a.currency||"USD",daily:d==="daily"})})]}),s==="service"&&o.jsx("button",{type:"button",onClick:()=>t(!0),className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Open EC2 optimization"}),o.jsx(Im,{report:a,groupBy:s,granularity:d}),o.jsx(Om,{groupBy:s,report:a})]}):null]}),o.jsx(Um,{mode:r,groupBy:s,start:m,end:h,granularity:n.granularity,reportTagKey:n.reportTagKey,options:n.options,filters:n.draftFilters,loading:l,filtersLoading:n.filtersLoading,comparisonPeriods:n.selectedComparisonPeriods,onModeChange:n.changeMode,onStartChange:n.setStart,onEndChange:n.setEnd,onGranularityChange:n.setGranularity,onReportTagKeyChange:n.setReportTagKey,onFiltersChange:n.setDraftFilters,onLoadTagValues:C=>{n.loadOptions(C)},onRun:n.runReport,onApply:n.applyFilters,onReset:n.resetFilters})]})]}),e&&o.jsx(Dm,{onClose:()=>t(!1)})]})}const Zo={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"},sp={INFO:"text-muted-foreground",WARN:"text-amber-600",ERROR:"text-destructive"},Pn=e=>e?new Date(e).toLocaleString():"—";function rp({status:e}){return o.jsx("span",{className:`rounded-full border px-2 py-0.5 text-xs font-medium ${Zo[e]||Zo.PENDING}`,children:e.replace(/_/g," ")})}function Qt({label:e,value:t,mono:n}){return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:e}),o.jsx("span",{className:`break-all text-sm ${n?"font-mono text-xs":""}`,children:t||"—"})]})}function op(){const{managementAccountId:e,loading:t}=St(),[n,s]=P.useState([]),[r,a]=P.useState([]),[i,c]=P.useState(!0),[l,f]=P.useState(null),u=P.useCallback(async()=>{c(!0),f(null);try{const d=await re.get("/cur-discovery",{params:{logLimit:100,managementAccountId:e}});s(d.data?.jobs||[]),a(d.data?.logs||[])}catch(d){f(d?.response?.data?.error||d?.message||"Unable to load CUR discovery status")}finally{c(!1)}},[e]);return P.useEffect(()=>{t||u()},[u,t]),o.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[o.jsx(hs,{className:"h-6 w-6 text-primary"}),"CUR Discovery"]}),o.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."})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(ms,{}),o.jsx("button",{onClick:()=>{u()},disabled:i||t,className:"rounded-lg border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh",children:o.jsx(Ft,{className:`h-4 w-4 ${i||t?"animate-spin":""}`})})]})]}),l&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[o.jsx(Be,{className:"h-4 w-4"}),l]}),!i&&!l&&!n.length&&o.jsx(he,{children:o.jsx(me,{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."})}),n.map(d=>o.jsxs(he,{children:[o.jsxs(Se,{className:"flex flex-row flex-wrap items-center gap-3",children:[o.jsx(_i,{className:"h-4 w-4 text-primary"}),o.jsxs(Pe,{className:"text-sm",children:["Management account ",d.managementAccountId]}),o.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["connection ",d.connectionId]}),o.jsx(rp,{status:d.status}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["attempt ",d.attemptCount]}),o.jsxs("span",{className:"ms-auto text-xs text-muted-foreground",children:["next check ",Pn(d.nextRunAt)]})]}),o.jsxs(me,{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[o.jsx(Qt,{label:"Region",value:d.region}),o.jsx(Qt,{label:"Glue database",value:d.database,mono:!0}),o.jsx(Qt,{label:"Discovered table",value:d.table,mono:!0}),o.jsx(Qt,{label:"Last data",value:Pn(d.lastDataAt)}),o.jsx(Qt,{label:"Last checked",value:Pn(d.lastFinishedAt||d.lastStartedAt)}),d.lastError&&o.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)),n.length>0&&o.jsxs("section",{children:[o.jsx("h2",{className:"mb-3 text-sm font-semibold",children:"Recent activity"}),o.jsx("div",{className:"space-y-2",children:n.map(d=>{const m=r.filter(h=>h.jobId===d.id);return o.jsxs("details",{open:!0,className:"rounded-md border bg-card",children:[o.jsxs("summary",{className:"cursor-pointer px-4 py-3 text-sm font-medium",children:["Management account ",o.jsx("span",{className:"font-mono",children:d.managementAccountId})]}),o.jsx("div",{className:"border-t px-4 py-2",children:m.length?o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b text-left text-xs uppercase text-muted-foreground",children:[o.jsx("th",{className:"py-2 pe-4 font-medium",children:"Time"}),o.jsx("th",{className:"py-2 pe-4 font-medium",children:"Level"}),o.jsx("th",{className:"py-2 pe-4 font-medium",children:"Event"}),o.jsx("th",{className:"py-2 font-medium",children:"Message"})]})}),o.jsx("tbody",{children:m.map(h=>o.jsxs("tr",{className:"border-b last:border-0 align-top",children:[o.jsx("td",{className:"whitespace-nowrap py-2 pe-4 text-xs text-muted-foreground",children:Pn(h.createdAt)}),o.jsx("td",{className:`py-2 pe-4 text-xs font-medium ${sp[h.level]||""}`,children:h.level}),o.jsx("td",{className:"whitespace-nowrap py-2 pe-4 font-mono text-xs",children:h.event}),o.jsx("td",{className:"py-2",children:h.message})]},h.id))})]})}):o.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No log entries recorded yet."})})]},d.id)})})]})]})}const ap=e=>e.launchUrl||`https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create?stackName=${encodeURIComponent(e.stackName||`MeyiConnect-${e.connectionId}-Management`)}`,ip=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",en=e=>{const t=e?.response?.data?.error||e?.response?.data?.message||e?.message||"Request failed",n=e?.response?.data?.details;return n?`${t} ${n}`:t};function cp(){const{selectManagementAccount:e,refreshSources:t}=St(),[n,s]=P.useState([]),[r,a]=P.useState(!1),[i,c]=P.useState(!0),[l,f]=P.useState(!1),[u,d]=P.useState(null),[m,h]=P.useState(null),[p,g]=P.useState(""),[b,x]=P.useState(!1),[y,w]=P.useState(null),[C,E]=P.useState(null),[k,R]=P.useState(null),S=P.useCallback(async()=>{c(!0),R(null);try{const T=await ce.getSources();s(T.sources||[]),a(T.allowMultipleSources===!0)}catch(T){R(en(T))}finally{c(!1)}},[]);P.useEffect(()=>{S()},[S]);const A=async T=>{if(T.preventDefault(),!/^\d{12}$/.test(p)){R("AWS account ID must contain exactly 12 digits");return}E("create"),R(null);try{const L=await ce.createSource({managementAccountId:p,regionMode:b?"ALL":"SINGLE"});L.managementAccountId&&e(L.managementAccountId),await t(),w(L.connectionId),f(!1),g(""),x(!1),await S()}catch(L){R(en(L))}finally{E(null)}},I=async T=>{E(`download-${T}`),R(null);try{const L=await ce.downloadSourceTemplate(T),X=URL.createObjectURL(L),Z=document.createElement("a");Z.href=X,Z.download=`meyi-connect-cost-${T}.yaml`,Z.click(),URL.revokeObjectURL(X),w(T)}catch(L){R(en(L))}finally{E(null)}},v=async T=>{E(`verify-${T}`),R(null);try{const L=await ce.verifySource(T);L.status==="FAILED"&&R(L.message||"AWS connection verification failed"),await S()}catch(L){R(en(L))}finally{E(null)}},O=async()=>{if(u){E(`remove-${u.connectionId}`),R(null);try{const T=await ce.removeSource(u.connectionId);d(null),h(T.awsCleanup??null),await S(),await t()}catch(T){R(en(T))}finally{E(null)}}};return o.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[o.jsx(ns,{className:"h-6 w-6 text-primary"}),"Cost Sources"]}),o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"AWS accounts connected to this tenant for Cost and Usage Report data."})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{type:"button",onClick:()=>{S()},disabled:i,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh sources",title:"Refresh sources",children:o.jsx(Ft,{className:`h-4 w-4 ${i?"animate-spin":""}`})}),(r||n.length===0)&&o.jsxs("button",{type:"button",onClick:()=>{R(null),f(!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:[o.jsx(lh,{className:"h-4 w-4"}),"Add AWS account"]})]})]}),k&&o.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[o.jsx(Be,{className:"mt-0.5 h-4 w-4 shrink-0"}),k]}),!i&&n.length===0&&o.jsxs("div",{className:"rounded-md border border-dashed py-14 text-center",children:[o.jsx(ns,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground"}),o.jsx("p",{className:"font-medium",children:"No AWS Cost source"}),o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Add an AWS account to begin collecting tenant cost data."})]}),n.length>0&&o.jsx("div",{className:"overflow-x-auto rounded-md border",children:o.jsxs("table",{className:"w-full min-w-[780px] text-sm",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b bg-muted/50 text-left text-xs uppercase text-muted-foreground",children:[o.jsx("th",{className:"px-4 py-3 font-medium",children:"AWS account"}),o.jsx("th",{className:"px-4 py-3 font-medium",children:"Connection"}),o.jsx("th",{className:"px-4 py-3 font-medium",children:"Scope"}),o.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),o.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),o.jsx("tbody",{children:n.map(T=>o.jsxs("tr",{className:`border-b last:border-0 ${y===T.connectionId?"bg-muted/30":""}`,children:[o.jsx("td",{className:"px-4 py-3 font-mono",children:T.managementAccountId||"Pending"}),o.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:T.connectionId}),o.jsxs("td",{className:"px-4 py-3",children:[T.accountScope," / ",T.regionMode]}),o.jsxs("td",{className:"px-4 py-3",children:[o.jsx("span",{className:`rounded-full border px-2 py-1 text-xs font-medium ${ip(T.status)}`,children:T.status.replace(/_/g," ")}),T.stackSetStatus&&o.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:T.stackSetStatus.replace(/_/g," ")}),T.status==="FAILED"&&T.failureReason&&o.jsx("div",{className:"mt-1 max-w-md text-xs text-destructive",children:T.failureReason})]}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx("button",{type:"button",onClick:()=>{I(T.connectionId)},disabled:!!C,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50",title:"Download CloudFormation template","aria-label":"Download CloudFormation template",children:C===`download-${T.connectionId}`?o.jsx(Ge,{className:"h-4 w-4 animate-spin"}):o.jsx(fs,{className:"h-4 w-4"})}),o.jsx("a",{href:ap(T),target:"_blank",rel:"noreferrer",className:"rounded-md border p-2 hover:bg-muted",title:`Open AWS CloudFormation as ${T.stackName||`MeyiConnect-${T.connectionId}-Management`}`,"aria-label":"Open AWS CloudFormation",children:o.jsx(Ai,{className:"h-4 w-4"})}),o.jsxs("button",{type:"button",onClick:()=>{v(T.connectionId)},disabled:!!C||T.status==="CONNECTED",className:"flex items-center gap-2 rounded-md border px-3 py-2 font-medium hover:bg-muted disabled:opacity-50",children:[C===`verify-${T.connectionId}`?o.jsx(Ge,{className:"h-4 w-4 animate-spin"}):T.status==="CONNECTED"?o.jsx(Vf,{className:"h-4 w-4 text-emerald-600"}):o.jsx(Ft,{className:"h-4 w-4"}),T.status==="CONNECTED"?"Connected":"Verify"]}),o.jsx("button",{type:"button",onClick:()=>d(T),disabled:!!C,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:o.jsx(Ii,{className:"h-4 w-4"})})]})})]},T.connectionId))})]})}),l&&o.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:o.jsxs("form",{onSubmit:T=>{A(T)},className:"w-full max-w-md rounded-md border bg-background p-5 shadow-xl",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx("h2",{id:"add-source-title",className:"text-lg font-semibold",children:"Add AWS account"}),o.jsx("button",{type:"button",onClick:()=>f(!1),className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:o.jsx(Ye,{className:"h-4 w-4"})})]}),o.jsx("label",{className:"mt-5 block text-sm font-medium",htmlFor:"aws-account-id",children:"AWS account ID"}),o.jsx("input",{id:"aws-account-id",value:p,onChange:T=>g(T.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"}),o.jsxs("label",{className:"mt-4 flex items-start gap-3 rounded-md border p-3",children:[o.jsx("input",{type:"checkbox",checked:b,onChange:T=>x(T.target.checked),className:"mt-1 h-4 w-4"}),o.jsxs("span",{children:[o.jsx("span",{className:"block text-sm font-medium",children:"All enabled AWS regions"}),o.jsx("span",{className:"block text-xs text-muted-foreground",children:"Use organization-wide StackSet deployment across enabled regions."})]})]}),o.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[o.jsx("button",{type:"button",onClick:()=>f(!1),className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),o.jsxs("button",{type:"submit",disabled:C==="create"||p.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:[C==="create"&&o.jsx(Ge,{className:"h-4 w-4 animate-spin"}),"Create source"]})]})]})}),u&&o.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:o.jsxs("div",{className:"w-full max-w-md rounded-md border bg-background p-5 shadow-xl",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx("h2",{id:"remove-source-title",className:"text-lg font-semibold",children:"Remove Cost source"}),o.jsx("button",{type:"button",onClick:()=>d(null),disabled:!!C,className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:o.jsx(Ye,{className:"h-4 w-4"})})]}),o.jsxs("p",{className:"mt-4 text-sm",children:["Remove AWS account ",o.jsx("span",{className:"font-mono font-medium",children:u.managementAccountId})," from this tenant?"]}),o.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Meyi Connect has no permission to change your AWS account, so the CloudFormation stacks stay until you delete them. You will see their names after removal. CUR data already delivered to Meyi Connect is retained."}),o.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[o.jsx("button",{type:"button",onClick:()=>d(null),disabled:!!C,className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),o.jsxs("button",{type:"button",onClick:()=>{O()},disabled:!!C,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:[C===`remove-${u.connectionId}`&&o.jsx(Ge,{className:"h-4 w-4 animate-spin"}),"Remove"]})]})]})}),m&&o.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":"cleanup-title",children:o.jsxs("div",{className:"w-full max-w-md rounded-md border bg-background p-5 shadow-xl",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx("h2",{id:"cleanup-title",className:"text-lg font-semibold",children:"Delete the AWS resources"}),o.jsx("button",{type:"button",onClick:()=>h(null),className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:o.jsx(Ye,{className:"h-4 w-4"})})]}),o.jsxs("p",{className:"mt-4 text-sm",children:["The source is removed. In your AWS management account, CloudFormation console, region ",o.jsx("span",{className:"font-mono",children:m.region}),":"]}),o.jsxs("ol",{className:"mt-3 list-decimal space-y-2 pl-5 text-sm",children:[m.membersStackName?o.jsxs("li",{children:["Stacks: delete ",o.jsx("span",{className:"font-mono",children:m.membersStackName}),". This removes the member StackSet and its stack instances."]}):m.stackSetName&&o.jsxs("li",{children:["StackSets: open ",o.jsx("span",{className:"font-mono",children:m.stackSetName}),", delete its stack instances, then delete the StackSet."]}),o.jsxs("li",{children:["Stacks: delete ",o.jsx("span",{className:"font-mono",children:m.managementStackName}),"."]})]}),o.jsx("div",{className:"mt-5 flex justify-end",children:o.jsx("button",{type:"button",onClick:()=>h(null),className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Done"})})]})})]})}const lp=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dp=[10,20,50],up=["UTC","Asia/Kolkata","America/New_York","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];function fp({open:e,schedule:t,saving:n,onClose:s,onSave:r}){const[a,i]=P.useState(t);if(P.useEffect(()=>i(t),[t,e]),!e)return null;const c=l=>i(f=>({...f,frequency:l}));return o.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&&s()},children:o.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:[o.jsxs("div",{className:"flex items-start justify-between border-b px-5 py-4",children:[o.jsxs("div",{children:[o.jsxs("h2",{id:"cost-ai-schedule-title",className:"flex items-center gap-2 text-base font-semibold",children:[o.jsx(Ri,{className:"h-4 w-4 text-primary"}),"AI report schedule"]}),o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Reports run automatically against completed AWS CUR periods."})]}),o.jsx("button",{type:"button",onClick:s,className:"rounded-md p-1.5 hover:bg-muted","aria-label":"Close",children:o.jsx(Ye,{className:"h-4 w-4"})})]}),o.jsxs("form",{className:"space-y-5 p-5",onSubmit:l=>{l.preventDefault(),r({enabled:a.enabled,frequency:a.frequency,time:a.time,timezone:a.timezone,dayOfWeek:a.dayOfWeek,dayOfMonth:a.dayOfMonth,ticketLimit:a.ticketLimit??10}).then(s)},children:[o.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border p-3",children:[o.jsxs("span",{children:[o.jsx("span",{className:"block text-sm font-medium",children:"Scheduled reports"}),o.jsx("span",{className:"block text-xs text-muted-foreground",children:"Generate reports without a manual action"})]}),o.jsx("input",{type:"checkbox",checked:a.enabled,onChange:l=>i(f=>({...f,enabled:l.target.checked})),className:"h-4 w-4 accent-primary"})]}),o.jsxs("fieldset",{disabled:!a.enabled||n,className:"space-y-5 disabled:opacity-60",children:[o.jsxs("div",{children:[o.jsx("span",{className:"mb-2 block text-sm font-medium",children:"Frequency"}),o.jsx("div",{className:"grid grid-cols-3 rounded-lg border p-1",children:["daily","weekly","monthly"].map(l=>o.jsx("button",{type:"button",onClick:()=>c(l),className:`rounded-md px-3 py-2 text-sm capitalize ${a.frequency===l?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:l},l))})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("label",{className:"text-sm font-medium",children:["Run time",o.jsx("input",{type:"time",required:!0,value:a.time,onChange:l=>i(f=>({...f,time:l.target.value})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal"})]}),o.jsxs("label",{className:"text-sm font-medium",children:["Timezone",o.jsx("select",{value:a.timezone,onChange:l=>i(f=>({...f,timezone:l.target.value})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:[...new Set([a.timezone,...up])].map(l=>o.jsx("option",{children:l},l))})]})]}),a.frequency==="weekly"&&o.jsxs("label",{className:"block text-sm font-medium",children:["Day of week",o.jsx("select",{value:a.dayOfWeek??1,onChange:l=>i(f=>({...f,dayOfWeek:Number(l.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:lp.map((l,f)=>o.jsx("option",{value:f,children:l},l))})]}),a.frequency==="monthly"&&o.jsxs("label",{className:"block text-sm font-medium",children:["Day of month",o.jsx("input",{type:"number",min:1,max:28,value:a.dayOfMonth??1,onChange:l=>i(f=>({...f,dayOfMonth:Number(l.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal"})]}),o.jsxs("div",{role:"radiogroup","aria-labelledby":"cost-ai-ticket-limit-label",children:[o.jsx("span",{id:"cost-ai-ticket-limit-label",className:"mb-2 block text-sm font-medium",children:"Tasks per report"}),o.jsx("div",{className:"grid grid-cols-3 rounded-lg border p-1",children:dp.map(l=>o.jsxs("button",{type:"button",role:"radio","aria-checked":(a.ticketLimit??10)===l,onClick:()=>i(f=>({...f,ticketLimit:l})),className:`rounded-md px-3 py-2 text-sm ${(a.ticketLimit??10)===l?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:["Top ",l]},l))}),o.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Each report creates at most this many tasks, highest priority and savings first."})]}),o.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."})]}),o.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[o.jsx("button",{type:"button",onClick:s,className:"rounded-lg border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),o.jsx("button",{type:"submit",disabled:n,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:n?"Saving":"Save schedule"})]})]})]})})}function rt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}function Qo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function hp(...e){return t=>{let n=!1;const s=e.map(r=>{const a=Qo(r,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let r=0;r<s.length;r++){const a=s[r];typeof a=="function"?a():Qo(e[r],null)}}}}function Nt(...e){return j.useCallback(hp(...e),e)}function mp(e,t=[]){let n=[];function s(a,i){const c=j.createContext(i);c.displayName=a+"Context";const l=n.length;n=[...n,i];const f=d=>{const{scope:m,children:h,...p}=d,g=m?.[e]?.[l]||c,b=j.useMemo(()=>p,Object.values(p));return o.jsx(g.Provider,{value:b,children:h})};f.displayName=a+"Provider";function u(d,m,h={}){const{optional:p=!1}=h,g=m?.[e]?.[l]||c,b=j.useContext(g);if(b)return b;if(i!==void 0)return i;if(!p)throw new Error(`\`${d}\` must be used within \`${a}\``)}return[f,u]}const r=()=>{const a=n.map(i=>j.createContext(i));return function(c){const l=c?.[e]||a;return j.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return r.scopeName=e,[s,pp(r,...t)]}function pp(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(a){const i=s.reduce((c,{useScope:l,scopeName:f})=>{const d=l(a)[`__scope${f}`];return{...c,...d}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var ln=globalThis?.document?j.useLayoutEffect:()=>{},gp=j[" useId ".trim().toString()]||(()=>{}),xp=0;function Us(e){const[t,n]=j.useState(gp());return ln(()=>{n(s=>s??String(xp++))},[e]),e||(t?`radix-${t}`:"")}var bp=j[" useInsertionEffect ".trim().toString()]||ln;function yp({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,a,i]=vp({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:r;{const u=j.useRef(e!==void 0);j.useEffect(()=>{const d=u.current;d!==c&&console.warn(`${s} is changing from ${d?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=c},[c,s])}const f=j.useCallback(u=>{if(c){const d=wp(u)?u(e):u;d!==e&&i.current?.(d)}else a(u)},[c,e,a,i]);return[l,f]}function vp({defaultProp:e,onChange:t}){const[n,s]=j.useState(e),r=j.useRef(n),a=j.useRef(t);return bp(()=>{a.current=t},[t]),j.useEffect(()=>{r.current!==n&&(a.current?.(n),r.current=n)},[n,r]),[n,s,a]}function wp(e){return typeof e=="function"}function rc(e){const t=j.forwardRef((n,s)=>{let{children:r,...a}=n,i=null,c=!1;const l=[];ea(r)&&typeof An=="function"&&(r=An(r._payload)),j.Children.forEach(r,m=>{if(Rp(m)){c=!0;const h=m;let p="child"in h.props?h.props.child:h.props.children;ea(p)&&typeof An=="function"&&(p=An(p._payload)),i=Np(h,p),l.push(i?.props?.children)}else l.push(m)}),i?i=j.cloneElement(i,void 0,l):!c&&j.Children.count(r)===1&&j.isValidElement(r)&&(i=r);const f=i?Cp(i):void 0,u=Nt(s,f);if(!i){if(r||r===0)throw new Error(c?Pp(e):_p(e));return r}const d=jp(a,i.props??{});return i.type!==j.Fragment&&(d.ref=s?u:f),j.cloneElement(i,d)});return t.displayName=`${e}.Slot`,t}var Sp=Symbol.for("radix.slottable"),Np=(e,t)=>{if("child"in e.props){const n=e.props.child;return j.isValidElement(n)?j.cloneElement(n,void 0,e.props.children(n.props.children)):null}return j.isValidElement(t)?t:null};function jp(e,t){const n={...t};for(const s in t){const r=e[s],a=t[s];/^on[A-Z]/.test(s)?r&&a?n[s]=(...c)=>{const l=a(...c);return r(...c),l}:r&&(n[s]=r):s==="style"?n[s]={...r,...a}:s==="className"&&(n[s]=[r,a].filter(Boolean).join(" "))}return{...e,...n}}function Cp(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Rp(e){return j.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Sp}var Ep=Symbol.for("react.lazy");function ea(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Ep&&"_payload"in e&&kp(e._payload)}function kp(e){return typeof e=="object"&&e!==null&&"then"in e}var _p=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Pp=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,An=j[" use ".trim().toString()],Ap=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Je=Ap.reduce((e,t)=>{const n=rc(`Primitive.${t}`),s=j.forwardRef((r,a)=>{const{asChild:i,...c}=r,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(l,{...c,ref:a})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function Tp(e,t){e&&ya.flushSync(()=>e.dispatchEvent(t))}function dn(e){const t=j.useRef(e);return j.useEffect(()=>{t.current=e}),j.useMemo(()=>((...n)=>t.current?.(...n)),[])}var Op="DismissableLayer",lr="dismissableLayer.update",Lp="dismissableLayer.pointerDownOutside",Ip="dismissableLayer.focusOutside",ta,kr=j.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),oc=j.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:c,onDismiss:l,...f}=e,u=j.useContext(kr),[d,m]=j.useState(null),h=d?.ownerDocument??globalThis?.document,[,p]=j.useState({}),g=Nt(t,m),b=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=x?b.indexOf(x):-1,w=d?b.indexOf(d):-1,C=u.layersWithOutsidePointerEventsDisabled.size>0,E=w>=y,k=j.useRef(!1),R=Up(v=>{a?.(v),c?.(v),v.defaultPrevented||l?.()},{ownerDocument:h,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:j.useCallback(v=>{if(!(v instanceof Node))return!1;const O=[...u.branches].some(T=>T.contains(v));return E&&!O},[u.branches,E])}),S=Bp(v=>{if(s&&k.current)return;const O=v.target;[...u.branches].some(L=>L.contains(O))||(i?.(v),c?.(v),v.defaultPrevented||l?.())},h),A=d?w===b.length-1:!1,I=dn(v=>{v.key==="Escape"&&(r?.(v),!v.defaultPrevented&&l&&(v.preventDefault(),l()))});return j.useEffect(()=>{if(A)return h.addEventListener("keydown",I,{capture:!0}),()=>h.removeEventListener("keydown",I,{capture:!0})},[h,A,I]),j.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ta=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),na(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(h.body.style.pointerEvents=ta))}},[d,h,n,u]),j.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),na())},[d,u]),j.useEffect(()=>{const v=()=>p({});return document.addEventListener(lr,v),()=>document.removeEventListener(lr,v)},[]),o.jsx(Je.div,{...f,ref:g,style:{pointerEvents:C?E?"auto":"none":void 0,...e.style},onFocusCapture:rt(e.onFocusCapture,S.onFocusCapture),onBlurCapture:rt(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:rt(e.onPointerDownCapture,R.onPointerDownCapture)})});oc.displayName=Op;var Mp="DismissableLayerBranch",Dp=j.forwardRef((e,t)=>{const n=j.useContext(kr),s=j.useRef(null),r=Nt(t,s);return j.useEffect(()=>{const a=s.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),o.jsx(Je.div,{...e,ref:r})});Dp.displayName=Mp;function Fp(){const e=j.useContext(kr),[t,n]=j.useState(null);return j.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var $p=()=>!0;function Up(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:a,shouldHandlePointerDownOutside:i=$p}=t,c=dn(e),l=j.useRef(!1),f=j.useRef(!1),u=j.useRef(new Map),d=j.useRef(()=>{});return j.useEffect(()=>{function m(){f.current=!1,r.current=!1,u.current.clear()}function h(){return Array.from(u.current.values()).some(Boolean)}function p(w){if(!f.current)return;const C=w.target;C instanceof Node&&[...a].some(k=>k.contains(C))||u.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{f.current&&d.current()},0)}function g(w){f.current&&u.current.set(w.type,!1)}const b=w=>{if(w.target&&!l.current){let C=function(){n.removeEventListener("click",d.current);const k=h();m(),k||ac(Lp,c,E,{discrete:!0})};if(!i(w.target)){n.removeEventListener("click",d.current),m(),l.current=!1;return}const E={originalEvent:w};f.current=!0,r.current=s&&w.button===0,u.current.clear(),!s||w.button!==0?C():(n.removeEventListener("click",d.current),d.current=C,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),m();l.current=!1},x=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of x)n.addEventListener(w,p,!0),n.addEventListener(w,g);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",b)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",b),n.removeEventListener("click",d.current);for(const w of x)n.removeEventListener(w,p,!0),n.removeEventListener(w,g)}},[n,c,s,r,a,i]),{onPointerDownCapture:()=>l.current=!0}}function Bp(e,t=globalThis?.document){const n=dn(e),s=j.useRef(!1);return j.useEffect(()=>{const r=a=>{a.target&&!s.current&&ac(Ip,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function na(){const e=new CustomEvent(lr);document.dispatchEvent(e)}function ac(e,t,n,{discrete:s}){const r=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),s?Tp(r,a):r.dispatchEvent(a)}var Bs="focusScope.autoFocusOnMount",zs="focusScope.autoFocusOnUnmount",sa={bubbles:!1,cancelable:!0},zp="FocusScope",ic=j.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:a,...i}=e,[c,l]=j.useState(null),f=dn(r),u=dn(a),d=j.useRef(null),m=Nt(t,l),h=j.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;j.useEffect(()=>{if(s){let g=function(w){if(h.paused||!c)return;const C=w.target;c.contains(C)?d.current=C:Ze(d.current,{select:!0})},b=function(w){if(h.paused||!c)return;const C=w.relatedTarget;C!==null&&(c.contains(C)||Ze(d.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const E of w)E.removedNodes.length>0&&Ze(c)};document.addEventListener("focusin",g),document.addEventListener("focusout",b);const y=new MutationObserver(x);return c&&y.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",b),y.disconnect()}}},[s,c,h.paused]),j.useEffect(()=>{if(c){oa.add(h);const g=document.activeElement;if(!c.contains(g)){const x=new CustomEvent(Bs,sa);c.addEventListener(Bs,f),c.dispatchEvent(x),x.defaultPrevented||(Wp(Kp(cc(c)),{select:!0}),document.activeElement===g&&Ze(c))}return()=>{c.removeEventListener(Bs,f),setTimeout(()=>{const x=new CustomEvent(zs,sa);c.addEventListener(zs,u),c.dispatchEvent(x),x.defaultPrevented||Ze(g??document.body,{select:!0}),c.removeEventListener(zs,u),oa.remove(h)},0)}}},[c,f,u,h]);const p=j.useCallback(g=>{if(!n&&!s||h.paused)return;const b=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,x=document.activeElement;if(b&&x){const y=g.currentTarget,[w,C]=Vp(y);w&&C?!g.shiftKey&&x===C?(g.preventDefault(),n&&Ze(w,{select:!0})):g.shiftKey&&x===w&&(g.preventDefault(),n&&Ze(C,{select:!0})):x===y&&g.preventDefault()}},[n,s,h.paused]);return o.jsx(Je.div,{tabIndex:-1,...i,ref:m,onKeyDown:p})});ic.displayName=zp;function Wp(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Ze(s,{select:t}),document.activeElement!==n)return}function Vp(e){const t=cc(e),n=ra(t,e),s=ra(t.reverse(),e);return[n,s]}function cc(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ra(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const s of e)if(!(n?!s.checkVisibility({checkVisibilityCSS:!0}):Hp(s,{upTo:t})))return s}function Hp(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function qp(e){return e instanceof HTMLInputElement&&"select"in e}function Ze(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&qp(e)&&t&&e.select()}}var oa=Gp();function Gp(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=aa(e,t),e.unshift(t)},remove(t){e=aa(e,t),e[0]?.resume()}}}function aa(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function Kp(e){return e.filter(t=>t.tagName!=="A")}var Yp="Portal",lc=j.forwardRef((e,t)=>{const{container:n,...s}=e,[r,a]=j.useState(!1);ln(()=>a(!0),[]);const i=n||r&&globalThis?.document?.body;return i?ya.createPortal(o.jsx(Je.div,{...s,ref:t}),i):null});lc.displayName=Yp;function Jp(e,t){return j.useReducer((n,s)=>t[n][s]??n,e)}var ps=e=>{const{present:t,children:n}=e,s=Xp(t),r=typeof n=="function"?n({present:s.isPresent}):j.Children.only(n),a=Zp(s.ref,Qp(r));return typeof n=="function"||s.isPresent?j.cloneElement(r,{ref:a}):null};ps.displayName="Presence";function Xp(e){const[t,n]=j.useState(),s=j.useRef(null),r=j.useRef(e),a=j.useRef("none"),i=j.useRef(void 0),c=e?"mounted":"unmounted",[l,f]=Jp(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return j.useEffect(()=>{l==="mounted"?(a.current=i.current??tn(s.current),i.current=void 0):a.current="none"},[l]),ln(()=>{const u=s.current,d=r.current;if(d!==e){const h=a.current,p=tn(u);e?(i.current=p,f("MOUNT")):p==="none"||u?.display==="none"?f("UNMOUNT"):f(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,f]),ln(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,m=p=>{const b=tn(s.current).includes(CSS.escape(p.animationName));if(p.target===t&&b&&(f("ANIMATION_END"),!r.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=p=>{p.target===t&&(a.current=tn(s.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:j.useCallback(u=>{if(u){const d=getComputedStyle(u);s.current=d,i.current=tn(d)}else s.current=null;n(u)},[])}}function ia(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Zp(...e){const t=j.useRef(e);return t.current=e,j.useCallback(n=>{const s=t.current;let r=!1;const a=s.map(i=>{const c=ia(i,n);return!r&&typeof c=="function"&&(r=!0),c});if(r)return()=>{for(let i=0;i<a.length;i++){const c=a[i];typeof c=="function"?c():ia(s[i],null)}}},[])}function tn(e){return e?.animationName||"none"}function Qp(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Tn=0,Rt=null;function eg(){j.useEffect(()=>{Rt||(Rt={start:ca(),end:ca()});const{start:e,end:t}=Rt;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Tn++,()=>{Tn===1&&(Rt?.start.remove(),Rt?.end.remove(),Rt=null),Tn=Math.max(0,Tn-1)}},[])}function ca(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ue=function(){return Ue=Object.assign||function(t){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},Ue.apply(this,arguments)};function dc(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}function tg(e,t,n){if(n||arguments.length===2)for(var s=0,r=t.length,a;s<r;s++)(a||!(s in t))&&(a||(a=Array.prototype.slice.call(t,0,s)),a[s]=t[s]);return e.concat(a||Array.prototype.slice.call(t))}var Vn="right-scroll-bar-position",Hn="width-before-scroll-bar",ng="with-scroll-bars-hidden",sg="--removed-body-scroll-bar-size";function Ws(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function rg(e,t){var n=P.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var r=n.value;r!==s&&(n.value=s,n.callback(s,r))}}}})[0];return n.callback=t,n.facade}var og=typeof window<"u"?j.useLayoutEffect:j.useEffect,la=new WeakMap;function ag(e,t){var n=rg(null,function(s){return e.forEach(function(r){return Ws(r,s)})});return og(function(){var s=la.get(n);if(s){var r=new Set(s),a=new Set(e),i=n.current;r.forEach(function(c){a.has(c)||Ws(c,null)}),a.forEach(function(c){r.has(c)||Ws(c,i)})}la.set(n,e)},[e]),n}function ig(e){return e}function cg(e,t){t===void 0&&(t=ig);var n=[],s=!1,r={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var i=t(a,s);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(a){for(s=!0;n.length;){var i=n;n=[],i.forEach(a)}n={push:function(c){return a(c)},filter:function(){return n}}},assignMedium:function(a){s=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(a),i=n}var l=function(){var u=i;i=[],u.forEach(a)},f=function(){return Promise.resolve().then(l)};f(),n={push:function(u){i.push(u),f()},filter:function(u){return i=i.filter(u),n}}}};return r}function lg(e){e===void 0&&(e={});var t=cg(null);return t.options=Ue({async:!0,ssr:!1},e),t}var uc=function(e){var t=e.sideCar,n=dc(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return j.createElement(s,Ue({},n))};uc.isSideCarExport=!0;function dg(e,t){return e.useMedium(t),uc}var fc=lg(),Vs=function(){},gs=j.forwardRef(function(e,t){var n=j.useRef(null),s=j.useState({onScrollCapture:Vs,onWheelCapture:Vs,onTouchMoveCapture:Vs}),r=s[0],a=s[1],i=e.forwardProps,c=e.children,l=e.className,f=e.removeScrollBar,u=e.enabled,d=e.shards,m=e.sideCar,h=e.noRelative,p=e.noIsolation,g=e.inert,b=e.allowPinchZoom,x=e.as,y=x===void 0?"div":x,w=e.gapMode,C=dc(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=m,k=ag([n,t]),R=Ue(Ue({},C),r);return j.createElement(j.Fragment,null,u&&j.createElement(E,{sideCar:fc,removeScrollBar:f,shards:d,noRelative:h,noIsolation:p,inert:g,setCallbacks:a,allowPinchZoom:!!b,lockRef:n,gapMode:w}),i?j.cloneElement(j.Children.only(c),Ue(Ue({},R),{ref:k})):j.createElement(y,Ue({},R,{className:l,ref:k}),c))});gs.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gs.classNames={fullWidth:Hn,zeroRight:Vn};var ug=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function fg(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ug();return t&&e.setAttribute("nonce",t),e}function hg(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function mg(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var pg=function(){var e=0,t=null;return{add:function(n){e==0&&(t=fg())&&(hg(t,n),mg(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},gg=function(){var e=pg();return function(t,n){j.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},hc=function(){var e=gg(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},xg={left:0,top:0,right:0,gap:0},Hs=function(e){return parseInt(e||"",10)||0},bg=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[Hs(n),Hs(s),Hs(r)]},yg=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return xg;var t=bg(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},vg=hc(),Lt="data-scroll-locked",wg=function(e,t,n,s){var r=e.left,a=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
20
+ .`.concat(ng,` {
21
+ overflow: hidden `).concat(s,`;
22
+ padding-right: `).concat(c,"px ").concat(s,`;
25
23
  }
26
- body[`).concat(_t,`] {
27
- overflow: hidden `).concat(r,`;
24
+ body[`).concat(Lt,`] {
25
+ overflow: hidden `).concat(s,`;
28
26
  overscroll-behavior: contain;
29
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
30
- padding-left: `.concat(s,`px;
31
- padding-top: `).concat(o,`px;
27
+ `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
28
+ padding-left: `.concat(r,`px;
29
+ padding-top: `).concat(a,`px;
32
30
  padding-right: `).concat(i,`px;
33
31
  margin-left:0;
34
32
  margin-top:0;
35
- margin-right: `).concat(c,"px ").concat(r,`;
36
- `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
33
+ margin-right: `).concat(c,"px ").concat(s,`;
34
+ `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(s,";")].filter(Boolean).join(""),`
37
35
  }
38
36
 
39
- .`).concat(Un,` {
40
- right: `).concat(c,"px ").concat(r,`;
37
+ .`).concat(Vn,` {
38
+ right: `).concat(c,"px ").concat(s,`;
41
39
  }
42
40
 
43
- .`).concat($n,` {
44
- margin-right: `).concat(c,"px ").concat(r,`;
41
+ .`).concat(Hn,` {
42
+ margin-right: `).concat(c,"px ").concat(s,`;
45
43
  }
46
44
 
47
- .`).concat(Un," .").concat(Un,` {
48
- right: 0 `).concat(r,`;
45
+ .`).concat(Vn," .").concat(Vn,` {
46
+ right: 0 `).concat(s,`;
49
47
  }
50
48
 
51
- .`).concat($n," .").concat($n,` {
52
- margin-right: 0 `).concat(r,`;
49
+ .`).concat(Hn," .").concat(Hn,` {
50
+ margin-right: 0 `).concat(s,`;
53
51
  }
54
52
 
55
- body[`).concat(_t,`] {
56
- `).concat(bp,": ").concat(c,`px;
53
+ body[`).concat(Lt,`] {
54
+ `).concat(sg,": ").concat(c,`px;
57
55
  }
58
- `)},Ho=function(){var e=parseInt(document.body.getAttribute(_t)||"0",10);return isFinite(e)?e:0},Dp=function(){S.useEffect(function(){return document.body.setAttribute(_t,(Ho()+1).toString()),function(){var e=Ho()-1;e<=0?document.body.removeAttribute(_t):document.body.setAttribute(_t,e.toString())}},[])},Fp=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;Dp();var o=S.useMemo(function(){return Lp(s)},[s]);return S.createElement(Ip,{styles:Mp(o,!t,s,n?"":"!important")})},Zr=!1;if(typeof window<"u")try{var kn=Object.defineProperty({},"passive",{get:function(){return Zr=!0,!0}});window.addEventListener("test",kn,kn),window.removeEventListener("test",kn,kn)}catch{Zr=!1}var St=Zr?{passive:!1}:!1,Up=function(e){return e.tagName==="TEXTAREA"},qi=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Up(e)&&n[t]==="visible")},$p=function(e){return qi(e,"overflowY")},Bp=function(e){return qi(e,"overflowX")},qo=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Gi(e,r);if(s){var o=Ki(e,r),i=o[1],c=o[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},zp=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Wp=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Gi=function(e,t){return e==="v"?$p(t):Bp(t)},Ki=function(e,t){return e==="v"?zp(t):Wp(t)},Vp=function(e,t){return e==="h"&&t==="rtl"?-1:1},Hp=function(e,t,n,r,s){var o=Vp(e,window.getComputedStyle(t).direction),i=o*r,c=n.target,u=t.contains(c),f=!1,d=i>0,l=0,h=0;do{if(!c)break;var m=Ki(e,c),g=m[0],p=m[1],b=m[2],x=p-b-o*g;(g||x)&&Gi(e,c)&&(l+=x,h+=g);var y=c.parentNode;c=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(d&&Math.abs(l)<1||!d&&Math.abs(h)<1)&&(f=!0),f},_n=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Go=function(e){return[e.deltaX,e.deltaY]},Ko=function(e){return e&&"current"in e?e.current:e},qp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Gp=function(e){return`
56
+ `)},da=function(){var e=parseInt(document.body.getAttribute(Lt)||"0",10);return isFinite(e)?e:0},Sg=function(){j.useEffect(function(){return document.body.setAttribute(Lt,(da()+1).toString()),function(){var e=da()-1;e<=0?document.body.removeAttribute(Lt):document.body.setAttribute(Lt,e.toString())}},[])},Ng=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;Sg();var a=j.useMemo(function(){return yg(r)},[r]);return j.createElement(vg,{styles:wg(a,!t,r,n?"":"!important")})},dr=!1;if(typeof window<"u")try{var On=Object.defineProperty({},"passive",{get:function(){return dr=!0,!0}});window.addEventListener("test",On,On),window.removeEventListener("test",On,On)}catch{dr=!1}var Et=dr?{passive:!1}:!1,jg=function(e){return e.tagName==="TEXTAREA"},mc=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!jg(e)&&n[t]==="visible")},Cg=function(e){return mc(e,"overflowY")},Rg=function(e){return mc(e,"overflowX")},ua=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=pc(e,s);if(r){var a=gc(e,s),i=a[1],c=a[2];if(i>c)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},Eg=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},kg=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},pc=function(e,t){return e==="v"?Cg(t):Rg(t)},gc=function(e,t){return e==="v"?Eg(t):kg(t)},_g=function(e,t){return e==="h"&&t==="rtl"?-1:1},Pg=function(e,t,n,s,r){var a=_g(e,window.getComputedStyle(t).direction),i=a*s,c=n.target,l=t.contains(c),f=!1,u=i>0,d=0,m=0;do{if(!c)break;var h=gc(e,c),p=h[0],g=h[1],b=h[2],x=g-b-a*p;(p||x)&&pc(e,c)&&(d+=x,m+=p);var y=c.parentNode;c=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!l&&c!==document.body||l&&(t.contains(c)||t===c));return(u&&Math.abs(d)<1||!u&&Math.abs(m)<1)&&(f=!0),f},Ln=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},fa=function(e){return[e.deltaX,e.deltaY]},ha=function(e){return e&&"current"in e?e.current:e},Ag=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Tg=function(e){return`
59
57
  .block-interactivity-`.concat(e,` {pointer-events: none;}
60
58
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
61
- `)},Kp=0,Rt=[];function Yp(e){var t=S.useRef([]),n=S.useRef([0,0]),r=S.useRef(),s=S.useState(Kp++)[0],o=S.useState(Hi)[0],i=S.useRef(e);S.useEffect(function(){i.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var p=gp([e.lockRef.current],(e.shards||[]).map(Ko),!0).filter(Boolean);return p.forEach(function(b){return b.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var c=S.useCallback(function(p,b){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var x=_n(p),y=n.current,v="deltaX"in p?p.deltaX:y[0]-x[0],N="deltaY"in p?p.deltaY:y[1]-x[1],j,E=p.target,C=Math.abs(v)>Math.abs(N)?"h":"v";if("touches"in p&&C==="h"&&E.type==="range")return!1;var R=window.getSelection(),P=R&&R.anchorNode,I=P?P===E||P.contains(E):!1;if(I)return!1;var A=qo(C,E);if(!A)return!0;if(A?j=C:(j=C==="v"?"h":"v",A=qo(C,E)),!A)return!1;if(!r.current&&"changedTouches"in p&&(v||N)&&(r.current=j),!j)return!0;var D=r.current||j;return Hp(D,b,p,D==="h"?v:N)},[]),u=S.useCallback(function(p){var b=p;if(!(!Rt.length||Rt[Rt.length-1]!==o)){var x="deltaY"in b?Go(b):_n(b),y=t.current.filter(function(j){return j.name===b.type&&(j.target===b.target||b.target===j.shadowParent)&&qp(j.delta,x)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var v=(i.current.shards||[]).map(Ko).filter(Boolean).filter(function(j){return j.contains(b.target)}),N=v.length>0?c(b,v[0]):!i.current.noIsolation;N&&b.cancelable&&b.preventDefault()}}},[]),f=S.useCallback(function(p,b,x,y){var v={name:p,delta:b,target:x,should:y,shadowParent:Jp(x)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(N){return N!==v})},1)},[]),d=S.useCallback(function(p){n.current=_n(p),r.current=void 0},[]),l=S.useCallback(function(p){f(p.type,Go(p),p.target,c(p,e.lockRef.current))},[]),h=S.useCallback(function(p){f(p.type,_n(p),p.target,c(p,e.lockRef.current))},[]);S.useEffect(function(){return Rt.push(o),e.setCallbacks({onScrollCapture:l,onWheelCapture:l,onTouchMoveCapture:h}),document.addEventListener("wheel",u,St),document.addEventListener("touchmove",u,St),document.addEventListener("touchstart",d,St),function(){Rt=Rt.filter(function(p){return p!==o}),document.removeEventListener("wheel",u,St),document.removeEventListener("touchmove",u,St),document.removeEventListener("touchstart",d,St)}},[]);var m=e.removeScrollBar,g=e.inert;return S.createElement(S.Fragment,null,g?S.createElement(o,{styles:Gp(s)}):null,m?S.createElement(Fp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Jp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Xp=Cp(Vi,Yp);var Yi=S.forwardRef(function(e,t){return S.createElement(lr,De({},e,{ref:t,sideCar:Xp}))});Yi.classNames=lr.classNames;var Zp=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Nt=new WeakMap,Pn=new WeakMap,An={},Mr=0,Ji=function(e){return e&&(e.host||Ji(e.parentNode))},Qp=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Ji(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},eg=function(e,t,n,r){var s=Qp(t,Array.isArray(e)?e:[e]);An[n]||(An[n]=new WeakMap);var o=An[n],i=[],c=new Set,u=new Set(s),f=function(l){!l||c.has(l)||(c.add(l),f(l.parentNode))};s.forEach(f);var d=function(l){!l||u.has(l)||Array.prototype.forEach.call(l.children,function(h){if(c.has(h))d(h);else try{var m=h.getAttribute(r),g=m!==null&&m!=="false",p=(Nt.get(h)||0)+1,b=(o.get(h)||0)+1;Nt.set(h,p),o.set(h,b),i.push(h),p===1&&g&&Pn.set(h,!0),b===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",h,x)}})};return d(t),c.clear(),Mr++,function(){i.forEach(function(l){var h=Nt.get(l)-1,m=o.get(l)-1;Nt.set(l,h),o.set(l,m),h||(Pn.has(l)||l.removeAttribute(r),Pn.delete(l)),m||l.removeAttribute(n)}),Mr--,Mr||(Nt=new WeakMap,Nt=new WeakMap,Pn=new WeakMap,An={})}},tg=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Zp(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),eg(r,s,n,"aria-hidden")):function(){return null}},ur="Dialog",[Xi]=_m(ur),[ng,Te]=Xi(ur),Zi=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,c=S.useRef(null),u=S.useRef(null),[f,d]=Lm({prop:r,defaultProp:s??!1,onChange:o,caller:ur});return a.jsx(ng,{scope:t,triggerRef:c,contentRef:u,contentId:Pr(),titleId:Pr(),descriptionId:Pr(),open:f,onOpenChange:d,onOpenToggle:S.useCallback(()=>d(l=>!l),[d]),modal:i,children:n})};Zi.displayName=ur;var Qi="DialogTrigger",rg=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Te(Qi,n),o=bt(t,s.triggerRef);return a.jsx(ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":bs(s.open),...r,ref:o,onClick:Xe(e.onClick,s.onOpenToggle)})});rg.displayName=Qi;var xs="DialogPortal",[sg,ec]=Xi(xs,{forceMount:void 0}),tc=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=Te(xs,t);return a.jsx(sg,{scope:t,forceMount:n,children:S.Children.map(r,i=>a.jsx(cr,{present:n||o.open,children:a.jsx(Bi,{asChild:!0,container:s,children:i})}))})};tc.displayName=xs;var er="DialogOverlay",nc=S.forwardRef((e,t)=>{const n=ec(er,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Te(er,e.__scopeDialog);return o.modal?a.jsx(cr,{present:r||o.open,children:a.jsx(ag,{...s,ref:t})}):null});nc.displayName=er;var og=Mi("DialogOverlay.RemoveScroll"),ag=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Te(er,n),o=Qm(),i=bt(t,o);return a.jsx(Yi,{as:og,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(ze.div,{"data-state":bs(s.open),...r,ref:i,style:{pointerEvents:"auto",...r.style}})})}),It="DialogContent",rc=S.forwardRef((e,t)=>{const n=ec(It,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Te(It,e.__scopeDialog);return a.jsx(cr,{present:r||o.open,children:o.modal?a.jsx(ig,{...s,ref:t}):a.jsx(cg,{...s,ref:t})})});rc.displayName=It;var ig=S.forwardRef((e,t)=>{const n=Te(It,e.__scopeDialog),r=S.useRef(null),s=bt(t,n.contentRef,r);return S.useEffect(()=>{const o=r.current;if(o)return tg(o)},[]),a.jsx(sc,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Xe(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Xe(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&o.preventDefault()}),onFocusOutside:Xe(e.onFocusOutside,o=>o.preventDefault())})}),cg=S.forwardRef((e,t)=>{const n=Te(It,e.__scopeDialog),r=S.useRef(!1),s=S.useRef(!1);return a.jsx(sc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;n.triggerRef.current?.contains(i)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),sc=S.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,c=Te(It,n);return pp(),a.jsx(a.Fragment,{children:a.jsx(Ui,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:a.jsx(Di,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":bs(c.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),oc="DialogTitle",ac=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Te(oc,n);return a.jsx(ze.h2,{id:s.titleId,...r,ref:t})});ac.displayName=oc;var ic="DialogDescription",cc=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Te(ic,n);return a.jsx(ze.p,{id:s.descriptionId,...r,ref:t})});cc.displayName=ic;var lc="DialogClose",Qr=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Te(lc,n);return a.jsx(ze.button,{type:"button",...r,ref:t,onClick:Xe(e.onClick,()=>s.onOpenChange(!1))})});Qr.displayName=lc;function bs(e){return e?"open":"closed"}const lg=e=>{const t=String(e||"").trim();return t==="1"?"The analyser exited with code 1 without recording the underlying error. Run the report again to capture the detailed failure reason.":t||"The analyser did not provide a failure reason."};function ug({report:e,onClose:t}){return a.jsx(Zi,{open:!!e,onOpenChange:n=>{n||t()},children:a.jsxs(tc,{children:[a.jsx(nc,{className:"fixed inset-0 z-50 bg-black/55"}),a.jsxs(rc,{className:"fixed left-1/2 top-1/2 z-50 max-h-[80vh] w-[calc(100%-2rem)] max-w-2xl -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-md border bg-background p-5 shadow-xl",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx(Fe,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}),a.jsxs("div",{children:[a.jsx(ac,{className:"text-lg font-semibold",children:"AI cost analysis failed"}),a.jsx(cc,{className:"mt-1 text-sm text-muted-foreground",children:"Failure details for the scheduled report."})]})]}),a.jsx(Qr,{className:"rounded-md p-1 hover:bg-muted","aria-label":"Close failure details",children:a.jsx(ft,{className:"h-4 w-4"})})]}),e&&a.jsxs(a.Fragment,{children:[a.jsxs("dl",{className:"mt-5 grid gap-x-6 gap-y-3 border-y py-4 text-sm sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("dt",{className:"text-xs text-muted-foreground",children:"Report period"}),a.jsxs("dd",{className:"mt-1 font-medium",children:[e.period.Start," to ",e.period.End]})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-xs text-muted-foreground",children:"Attempt"}),a.jsx("dd",{className:"mt-1 font-medium",children:e.attempts})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-xs text-muted-foreground",children:"AI provider"}),a.jsx("dd",{className:"mt-1 font-medium capitalize",children:e.provider||"Not resolved"})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-xs text-muted-foreground",children:"Model"}),a.jsx("dd",{className:"mt-1 break-all font-medium",children:e.modelId||"Not resolved"})]})]}),a.jsxs("div",{className:"mt-4",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Failure reason"}),a.jsx("pre",{className:"mt-2 whitespace-pre-wrap break-words rounded-md border border-destructive/30 bg-destructive/5 p-4 font-mono text-xs leading-5 text-destructive",children:lg(e.error)})]})]}),a.jsx("div",{className:"mt-5 flex justify-end",children:a.jsx(Qr,{className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Close"})})]})]})})}function dg(){const{managementAccountId:e,loading:t}=Ut(),[n,r]=_.useState(null),[s,o]=_.useState(null),[i,c]=_.useState(null),[u,f]=_.useState([]),[d,l]=_.useState(!0),[h,m]=_.useState(!1),[g,p]=_.useState(null),[b,x]=_.useState(null),y=_.useRef(!0),v=_.useCallback(async(C=!1)=>{C||l(!0);try{const R=await ie.getDataStatus({managementAccountId:e});if(!y.current)return;if(o(R),!R.ready){r(null),c(null),f([]),x(null);return}const[P,I,A]=await Promise.all([ie.getAnalysisStatus({managementAccountId:e}),ie.getAnalysisSchedule({managementAccountId:e}),ie.getAnalysisReports({managementAccountId:e})]);if(!y.current)return;r(P),c(I),f(A),x(null)}catch(R){y.current&&x(R?.response?.data?.error||R?.message||"Unable to load scheduled AI reports")}finally{y.current&&!C&&l(!1)}},[e]);return _.useEffect(()=>(y.current=!0,t||v(),()=>{y.current=!1}),[v,t]),_.useEffect(()=>{if(!u.some(R=>R.status==="PENDING"||R.status==="RUNNING"))return;const C=window.setInterval(()=>{v(!0)},15e3);return()=>window.clearInterval(C)},[v,u]),{status:n,dataStatus:s,schedule:i,reports:u,loading:d||t,saving:h,removingId:g,error:b,load:v,saveSchedule:async C=>{m(!0),x(null);try{const R=await ie.updateAnalysisSchedule(C,{managementAccountId:e});y.current&&c(R)}catch(R){throw x(R?.response?.data?.error||R?.message||"Unable to save the AI report schedule"),R}finally{y.current&&m(!1)}},download:async C=>{try{const R=C.htmlReady?"html":"pdf",P=await(C.htmlReady?ie.downloadAnalysisHtml(C.id):ie.downloadAnalysisPdf(C.id)),I=URL.createObjectURL(P),A=document.createElement("a");A.href=I,A.download=`meyi-cost-analysis-${C.period.Start}.${R}`,A.click(),URL.revokeObjectURL(I)}catch(R){x(R?.response?.data?.error||R?.message||"Unable to download the report")}},remove:async C=>{if(window.confirm(`Remove the AI cost report for ${C.period.Start} through ${C.period.End}?`)){p(C.id),x(null);try{await ie.removeAnalysisReport(C.id),y.current&&f(R=>R.filter(P=>P.id!==C.id))}catch(R){y.current&&x(R?.response?.data?.error||R?.message||"Unable to remove the AI report")}finally{y.current&&p(null)}}}}}const Dr=e=>e?new Date(e).toLocaleString():"Not scheduled",fg=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString(),hg=e=>{const t=new Date(`${e}T00:00:00Z`);return t.setUTCDate(t.getUTCDate()-1),t.toLocaleDateString()},Yo={COST_AI_DISABLED:["AI cost analysis is not enabled","An administrator must enable the Cost AI deployment setting before scheduled reports can run."],ANALYSER_NOT_CONFIGURED:["AI cost analysis is not fully configured","Cost AI is enabled, but the analyser task settings are incomplete. Redeploy the services stack; the backend log lists the missing settings."],AI_PROVIDER_REQUIRED:["Configure an AI provider","Configure and activate an AI provider in Meyi Connect before scheduled cost reports can run."]},Jo=e=>e.status!=="COMPLETED"||typeof e.ticketCount!="number"?null:typeof e.ticketLimit=="number"?`Created ${e.ticketCount} of top ${e.ticketLimit} tasks`:`Created ${e.ticketCount} ${e.ticketCount===1?"task":"tasks"}`,Xo={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 mg(){const e=dg(),t=Kh(),[n,r]=_.useState(!1),[s,o]=_.useState(null),i=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(wo,{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(ir,{}),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(Tt,{className:`h-4 w-4 ${e.loading?"animate-spin":""}`})}),i&&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(hi,{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(Fe,{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(Qn,{status:e.dataStatus}):e.status&&!e.status.enabled?a.jsx(he,{children:a.jsxs(me,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(wo,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("h2",{className:"mt-4 text-base font-semibold",children:Yo[e.status.reason??"COST_AI_DISABLED"][0]}),a.jsx("p",{className:"mt-2 max-w-xl text-sm text-muted-foreground",children:Yo[e.status.reason??"COST_AI_DISABLED"][1]})]})}):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(ii,{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 ${Dr(e.schedule.nextRunAt)} (${e.schedule.timezone})`:i?"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 ",Dr(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",title:"Gross AWS spend (CUR) for the report period",children:"AWS spend (period)"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:e.reports.map(c=>a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsxs("td",{className:"px-4 py-3 font-medium",children:[fg(c.period.Start)," - ",hg(c.period.End)]}),a.jsx("td",{className:"px-4 py-3 capitalize text-muted-foreground",children:c.frequency}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:"capitalize",children:c.provider||"-"}),c.modelId&&a.jsx("p",{className:"max-w-48 truncate text-xs text-muted-foreground",title:c.modelId,children:c.modelId})]}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:Dr(c.completedAt||c.startedAt||c.createdAt)}),a.jsxs("td",{className:"px-4 py-3",children:[c.status==="FAILED"?a.jsxs("button",{type:"button",onClick:()=>o(c),className:`inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-xs font-medium hover:opacity-80 ${Xo.FAILED}`,title:"View failure reason",children:[a.jsx(Fe,{className:"h-3 w-3"}),"failed"]}):a.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-xs font-medium ${Xo[c.status]}`,children:[(c.status==="RUNNING"||c.status==="PENDING")&&a.jsx(it,{className:"h-3 w-3 animate-spin"}),c.status.toLowerCase()]}),c.error&&a.jsx("button",{type:"button",onClick:()=>o(c),className:"mt-1 block max-w-xs truncate text-left text-xs text-destructive underline-offset-2 hover:underline",title:"View complete failure reason",children:c.error==="1"?"View failure reason":c.error}),Jo(c)&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:Jo(c)})]}),a.jsx("td",{className:"px-4 py-3",children:c.facts?new Intl.NumberFormat(void 0,{style:"currency",currency:c.facts.currency}).format(c.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(c)},disabled:!(c.htmlReady||c.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:c.htmlReady?"Download HTML report":c.pdfReady?"Download PDF report":"Report not ready",children:[a.jsx(fs,{className:"h-4 w-4"}),"Download"]}),i&&a.jsx("button",{type:"button",onClick:()=>{e.remove(c)},disabled:e.removingId===c.id||c.status==="RUNNING"||c.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===c.id?a.jsx(it,{className:"h-4 w-4 animate-spin"}):a.jsx(mi,{className:"h-4 w-4"})})]})})]},c.id))})]})})}):a.jsx(he,{children:a.jsxs(me,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(di,{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(Em,{open:n,schedule:e.schedule,saving:e.saving,onClose:()=>r(!1),onSave:e.saveSchedule}),a.jsx(ug,{report:s,onClose:()=>o(null)})]})}const $t=ql({component:Aa}),pg=cn({getParentRoute:()=>$t,path:"/",component:sm}),gg=cn({getParentRoute:()=>$t,path:"/reports",component:xm}),xg=cn({getParentRoute:()=>$t,path:"/cur-discovery",component:vm}),bg=cn({getParentRoute:()=>$t,path:"/analysis",component:mg}),yg=cn({getParentRoute:()=>$t,path:"/sources",component:Rm});function ys(){return $t.addChildren([pg,bg,gg,yg,xg])}function vg(e="/cost"){return Oa({routeTree:ys(),basepath:e})}function wg({apiBase:e,token:t,basePath:n="/cost",userRole:r="user",tenantId:s="default"}){si(e,t);const o=_.useMemo(()=>Oa({routeTree:ys(),basepath:n}),[n]);return a.jsx(Gh,{value:r,children:a.jsx(Yh,{tenantId:s,children:a.jsx(iu,{router:o})})})}const Sg=[{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=wg;exports.api=ne;exports.attachAuthInterceptors=af;exports.configureApi=si;exports.costNavItems=Sg;exports.createCostRouter=vg;exports.createRouteTree=ys;
59
+ `)},Og=0,kt=[];function Lg(e){var t=j.useRef([]),n=j.useRef([0,0]),s=j.useRef(),r=j.useState(Og++)[0],a=j.useState(hc)[0],i=j.useRef(e);j.useEffect(function(){i.current=e},[e]),j.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var g=tg([e.lockRef.current],(e.shards||[]).map(ha),!0).filter(Boolean);return g.forEach(function(b){return b.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),g.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var c=j.useCallback(function(g,b){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!i.current.allowPinchZoom;var x=Ln(g),y=n.current,w="deltaX"in g?g.deltaX:y[0]-x[0],C="deltaY"in g?g.deltaY:y[1]-x[1],E,k=g.target,R=Math.abs(w)>Math.abs(C)?"h":"v";if("touches"in g&&R==="h"&&k.type==="range")return!1;var S=window.getSelection(),A=S&&S.anchorNode,I=A?A===k||A.contains(k):!1;if(I)return!1;var v=ua(R,k);if(!v)return!0;if(v?E=R:(E=R==="v"?"h":"v",v=ua(R,k)),!v)return!1;if(!s.current&&"changedTouches"in g&&(w||C)&&(s.current=E),!E)return!0;var O=s.current||E;return Pg(O,b,g,O==="h"?w:C)},[]),l=j.useCallback(function(g){var b=g;if(!(!kt.length||kt[kt.length-1]!==a)){var x="deltaY"in b?fa(b):Ln(b),y=t.current.filter(function(E){return E.name===b.type&&(E.target===b.target||b.target===E.shadowParent)&&Ag(E.delta,x)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var w=(i.current.shards||[]).map(ha).filter(Boolean).filter(function(E){return E.contains(b.target)}),C=w.length>0?c(b,w[0]):!i.current.noIsolation;C&&b.cancelable&&b.preventDefault()}}},[]),f=j.useCallback(function(g,b,x,y){var w={name:g,delta:b,target:x,should:y,shadowParent:Ig(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(C){return C!==w})},1)},[]),u=j.useCallback(function(g){n.current=Ln(g),s.current=void 0},[]),d=j.useCallback(function(g){f(g.type,fa(g),g.target,c(g,e.lockRef.current))},[]),m=j.useCallback(function(g){f(g.type,Ln(g),g.target,c(g,e.lockRef.current))},[]);j.useEffect(function(){return kt.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:m}),document.addEventListener("wheel",l,Et),document.addEventListener("touchmove",l,Et),document.addEventListener("touchstart",u,Et),function(){kt=kt.filter(function(g){return g!==a}),document.removeEventListener("wheel",l,Et),document.removeEventListener("touchmove",l,Et),document.removeEventListener("touchstart",u,Et)}},[]);var h=e.removeScrollBar,p=e.inert;return j.createElement(j.Fragment,null,p?j.createElement(a,{styles:Tg(r)}):null,h?j.createElement(Ng,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ig(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Mg=dg(fc,Lg);var xc=j.forwardRef(function(e,t){return j.createElement(gs,Ue({},e,{ref:t,sideCar:Mg}))});xc.classNames=gs.classNames;var Dg=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},_t=new WeakMap,In=new WeakMap,Mn={},qs=0,bc=function(e){return e&&(e.host||bc(e.parentNode))},Fg=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=bc(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},$g=function(e,t,n,s){var r=Fg(t,Array.isArray(e)?e:[e]);Mn[n]||(Mn[n]=new WeakMap);var a=Mn[n],i=[],c=new Set,l=new Set(r),f=function(d){!d||c.has(d)||(c.add(d),f(d.parentNode))};r.forEach(f);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(m){if(c.has(m))u(m);else try{var h=m.getAttribute(s),p=h!==null&&h!=="false",g=(_t.get(m)||0)+1,b=(a.get(m)||0)+1;_t.set(m,g),a.set(m,b),i.push(m),g===1&&p&&In.set(m,!0),b===1&&m.setAttribute(n,"true"),p||m.setAttribute(s,"true")}catch(x){console.error("aria-hidden: cannot operate on ",m,x)}})};return u(t),c.clear(),qs++,function(){i.forEach(function(d){var m=_t.get(d)-1,h=a.get(d)-1;_t.set(d,m),a.set(d,h),m||(In.has(d)||d.removeAttribute(s),In.delete(d)),h||d.removeAttribute(n)}),qs--,qs||(_t=new WeakMap,_t=new WeakMap,In=new WeakMap,Mn={})}},Ug=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=Dg(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),$g(s,r,n,"aria-hidden")):function(){return null}},xs="Dialog",[yc]=mp(xs),[Bg,Le]=yc(xs),vc=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:r,onOpenChange:a,modal:i=!0}=e,c=j.useRef(null),l=j.useRef(null),[f,u]=yp({prop:s,defaultProp:r??!1,onChange:a,caller:xs});return o.jsx(Bg,{scope:t,triggerRef:c,contentRef:l,contentId:Us(),titleId:Us(),descriptionId:Us(),open:f,onOpenChange:u,onOpenToggle:j.useCallback(()=>u(d=>!d),[u]),modal:i,children:n})};vc.displayName=xs;var wc="DialogTrigger",zg=j.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Le(wc,n),a=Nt(t,r.triggerRef);return o.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":Pr(r.open),...s,ref:a,onClick:rt(e.onClick,r.onOpenToggle)})});zg.displayName=wc;var _r="DialogPortal",[Wg,Sc]=yc(_r,{forceMount:void 0}),Nc=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:r}=e,a=Le(_r,t);return o.jsx(Wg,{scope:t,forceMount:n,children:j.Children.map(s,i=>o.jsx(ps,{present:n||a.open,children:o.jsx(lc,{asChild:!0,container:r,children:i})}))})};Nc.displayName=_r;var os="DialogOverlay",jc=j.forwardRef((e,t)=>{const n=Sc(os,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,a=Le(os,e.__scopeDialog);return a.modal?o.jsx(ps,{present:s||a.open,children:o.jsx(Hg,{...r,ref:t})}):null});jc.displayName=os;var Vg=rc("DialogOverlay.RemoveScroll"),Hg=j.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Le(os,n),a=Fp(),i=Nt(t,a);return o.jsx(xc,{as:Vg,allowPinchZoom:!0,shards:[r.contentRef],children:o.jsx(Je.div,{"data-state":Pr(r.open),...s,ref:i,style:{pointerEvents:"auto",...s.style}})})}),Ut="DialogContent",Cc=j.forwardRef((e,t)=>{const n=Sc(Ut,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,a=Le(Ut,e.__scopeDialog);return o.jsx(ps,{present:s||a.open,children:a.modal?o.jsx(qg,{...r,ref:t}):o.jsx(Gg,{...r,ref:t})})});Cc.displayName=Ut;var qg=j.forwardRef((e,t)=>{const n=Le(Ut,e.__scopeDialog),s=j.useRef(null),r=Nt(t,n.contentRef,s);return j.useEffect(()=>{const a=s.current;if(a)return Ug(a)},[]),o.jsx(Rc,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:rt(e.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:rt(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&a.preventDefault()}),onFocusOutside:rt(e.onFocusOutside,a=>a.preventDefault())})}),Gg=j.forwardRef((e,t)=>{const n=Le(Ut,e.__scopeDialog),s=j.useRef(!1),r=j.useRef(!1);return o.jsx(Rc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(s.current||n.triggerRef.current?.focus(),a.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const i=a.target;n.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&r.current&&a.preventDefault()}})}),Rc=j.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:a,...i}=e,c=Le(Ut,n);return eg(),o.jsx(o.Fragment,{children:o.jsx(ic,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:a,children:o.jsx(oc,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Pr(c.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),Ec="DialogTitle",kc=j.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Le(Ec,n);return o.jsx(Je.h2,{id:r.titleId,...s,ref:t})});kc.displayName=Ec;var _c="DialogDescription",Pc=j.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Le(_c,n);return o.jsx(Je.p,{id:r.descriptionId,...s,ref:t})});Pc.displayName=_c;var Ac="DialogClose",ur=j.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Le(Ac,n);return o.jsx(Je.button,{type:"button",...s,ref:t,onClick:rt(e.onClick,()=>r.onOpenChange(!1))})});ur.displayName=Ac;function Pr(e){return e?"open":"closed"}const Kg=e=>{const t=String(e||"").trim();return t==="1"?"The analyser exited with code 1 without recording the underlying error. Run the report again to capture the detailed failure reason.":t||"The analyser did not provide a failure reason."};function Yg({report:e,onClose:t}){return o.jsx(vc,{open:!!e,onOpenChange:n=>{n||t()},children:o.jsxs(Nc,{children:[o.jsx(jc,{className:"fixed inset-0 z-50 bg-black/55"}),o.jsxs(Cc,{className:"fixed left-1/2 top-1/2 z-50 max-h-[80vh] w-[calc(100%-2rem)] max-w-2xl -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-md border bg-background p-5 shadow-xl",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[o.jsx(Be,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}),o.jsxs("div",{children:[o.jsx(kc,{className:"text-lg font-semibold",children:"AI cost analysis failed"}),o.jsx(Pc,{className:"mt-1 text-sm text-muted-foreground",children:"Failure details for the scheduled report."})]})]}),o.jsx(ur,{className:"rounded-md p-1 hover:bg-muted","aria-label":"Close failure details",children:o.jsx(Ye,{className:"h-4 w-4"})})]}),e&&o.jsxs(o.Fragment,{children:[o.jsxs("dl",{className:"mt-5 grid gap-x-6 gap-y-3 border-y py-4 text-sm sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx("dt",{className:"text-xs text-muted-foreground",children:"Report period"}),o.jsxs("dd",{className:"mt-1 font-medium",children:[e.period.Start," to ",e.period.End]})]}),o.jsxs("div",{children:[o.jsx("dt",{className:"text-xs text-muted-foreground",children:"Attempt"}),o.jsx("dd",{className:"mt-1 font-medium",children:e.attempts})]}),o.jsxs("div",{children:[o.jsx("dt",{className:"text-xs text-muted-foreground",children:"AI provider"}),o.jsx("dd",{className:"mt-1 font-medium capitalize",children:e.provider||"Not resolved"})]}),o.jsxs("div",{children:[o.jsx("dt",{className:"text-xs text-muted-foreground",children:"Model"}),o.jsx("dd",{className:"mt-1 break-all font-medium",children:e.modelId||"Not resolved"})]})]}),o.jsxs("div",{className:"mt-4",children:[o.jsx("h3",{className:"text-sm font-semibold",children:"Failure reason"}),o.jsx("pre",{className:"mt-2 whitespace-pre-wrap break-words rounded-md border border-destructive/30 bg-destructive/5 p-4 font-mono text-xs leading-5 text-destructive",children:Kg(e.error)})]})]}),o.jsx("div",{className:"mt-5 flex justify-end",children:o.jsx(ur,{className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Close"})})]})]})})}function Jg(){const{managementAccountId:e,loading:t}=St(),[n,s]=P.useState(null),[r,a]=P.useState(null),[i,c]=P.useState(null),[l,f]=P.useState([]),[u,d]=P.useState(!0),[m,h]=P.useState(!1),[p,g]=P.useState(null),[b,x]=P.useState(null),y=P.useRef(!0),w=P.useCallback(async(R=!1)=>{R||d(!0);try{const S=await ce.getDataStatus({managementAccountId:e});if(!y.current)return;if(a(S),!S.ready){s(null),c(null),f([]),x(null);return}const[A,I,v]=await Promise.all([ce.getAnalysisStatus({managementAccountId:e}),ce.getAnalysisSchedule({managementAccountId:e}),ce.getAnalysisReports({managementAccountId:e})]);if(!y.current)return;s(A),c(I),f(v),x(null)}catch(S){y.current&&x(S?.response?.data?.error||S?.message||"Unable to load scheduled AI reports")}finally{y.current&&!R&&d(!1)}},[e]);return P.useEffect(()=>(y.current=!0,t||w(),()=>{y.current=!1}),[w,t]),P.useEffect(()=>{if(!l.some(S=>S.status==="PENDING"||S.status==="RUNNING"))return;const R=window.setInterval(()=>{w(!0)},15e3);return()=>window.clearInterval(R)},[w,l]),{status:n,dataStatus:r,schedule:i,reports:l,loading:u||t,saving:m,removingId:p,error:b,load:w,saveSchedule:async R=>{h(!0),x(null);try{const S=await ce.updateAnalysisSchedule(R,{managementAccountId:e});y.current&&c(S)}catch(S){throw x(S?.response?.data?.error||S?.message||"Unable to save the AI report schedule"),S}finally{y.current&&h(!1)}},download:async R=>{try{const S=R.htmlReady?"html":"pdf",A=await(R.htmlReady?ce.downloadAnalysisHtml(R.id):ce.downloadAnalysisPdf(R.id)),I=URL.createObjectURL(A),v=document.createElement("a");v.href=I,v.download=`meyi-cost-analysis-${R.period.Start}.${S}`,v.click(),URL.revokeObjectURL(I)}catch(S){x(S?.response?.data?.error||S?.message||"Unable to download the report")}},remove:async R=>{if(window.confirm(`Remove the AI cost report for ${R.period.Start} through ${R.period.End}?`)){g(R.id),x(null);try{await ce.removeAnalysisReport(R.id),y.current&&f(S=>S.filter(A=>A.id!==R.id))}catch(S){y.current&&x(S?.response?.data?.error||S?.message||"Unable to remove the AI report")}finally{y.current&&g(null)}}}}}const Gs=e=>e?new Date(e).toLocaleString():"Not scheduled",Xg=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString(),Zg=e=>{const t=new Date(`${e}T00:00:00Z`);return t.setUTCDate(t.getUTCDate()-1),t.toLocaleDateString()},ma={COST_AI_DISABLED:["AI cost analysis is not enabled","An administrator must enable the Cost AI deployment setting before scheduled reports can run."],ANALYSER_NOT_CONFIGURED:["AI cost analysis is not fully configured","Cost AI is enabled, but the analyser task settings are incomplete. Redeploy the services stack; the backend log lists the missing settings."],AI_PROVIDER_REQUIRED:["Configure an AI provider","Configure and activate an AI provider in Meyi Connect before scheduled cost reports can run."]},pa=e=>e.status!=="COMPLETED"||typeof e.ticketCount!="number"?null:typeof e.ticketLimit=="number"?`Created ${e.ticketCount} of top ${e.ticketLimit} tasks`:`Created ${e.ticketCount} ${e.ticketCount===1?"task":"tasks"}`,ga={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 Qg(){const e=Jg(),t=pm(),[n,s]=P.useState(!1),[r,a]=P.useState(null),i=t.toLowerCase()==="admin";return o.jsxs("div",{className:"flex min-w-0 max-w-full flex-col gap-6 overflow-x-hidden p-2 md:p-6",children:[o.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[o.jsx(To,{className:"h-6 w-6 text-primary"}),"AI Cost Analysis"]}),o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Scheduled Cost reports generated from AWS CUR data"})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(ms,{}),o.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:o.jsx(Ft,{className:`h-4 w-4 ${e.loading?"animate-spin":""}`})}),i&&e.schedule&&o.jsxs("button",{type:"button",onClick:()=>s(!0),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground",children:[o.jsx(Li,{className:"h-4 w-4"}),"Report settings"]})]})]}),e.error&&o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive",children:[o.jsx(Be,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.error]}),e.loading?o.jsx("div",{className:"h-72 animate-pulse rounded-lg bg-muted"}):e.dataStatus&&!e.dataStatus.ready?o.jsx(rs,{status:e.dataStatus}):e.status&&!e.status.enabled?o.jsx(he,{children:o.jsxs(me,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[o.jsx(To,{className:"h-8 w-8 text-muted-foreground"}),o.jsx("h2",{className:"mt-4 text-base font-semibold",children:ma[e.status.reason??"COST_AI_DISABLED"][0]}),o.jsx("p",{className:"mt-2 max-w-xl text-sm text-muted-foreground",children:ma[e.status.reason??"COST_AI_DISABLED"][1]})]})}):o.jsxs(o.Fragment,{children:[o.jsxs("section",{className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border bg-card px-4 py-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Ri,{className:"h-5 w-5 text-primary"}),o.jsxs("div",{children:[o.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"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:e.schedule?.enabled?`Next run ${Gs(e.schedule.nextRunAt)} (${e.schedule.timezone})`:i?"Open report settings to configure a schedule":"An administrator can configure the report schedule"})]})]}),e.schedule?.lastRunAt&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last run ",Gs(e.schedule.lastRunAt)]})]}),e.reports.length?o.jsx("div",{className:"overflow-hidden rounded-lg border bg-card",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full min-w-[960px] text-sm",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b bg-muted/40 text-left text-xs text-muted-foreground",children:[o.jsx("th",{className:"px-4 py-3 font-medium",children:"Report period"}),o.jsx("th",{className:"px-4 py-3 font-medium",children:"Schedule"}),o.jsx("th",{className:"px-4 py-3 font-medium",children:"AI provider"}),o.jsx("th",{className:"px-4 py-3 font-medium",children:"Generated"}),o.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),o.jsx("th",{className:"px-4 py-3 font-medium",title:"Gross AWS spend (CUR) for the report period",children:"AWS spend (period)"}),o.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),o.jsx("tbody",{children:e.reports.map(c=>o.jsxs("tr",{className:"border-b last:border-0",children:[o.jsxs("td",{className:"px-4 py-3 font-medium",children:[Xg(c.period.Start)," - ",Zg(c.period.End)]}),o.jsx("td",{className:"px-4 py-3 capitalize text-muted-foreground",children:c.frequency}),o.jsxs("td",{className:"px-4 py-3",children:[o.jsx("span",{className:"capitalize",children:c.provider||"-"}),c.modelId&&o.jsx("p",{className:"max-w-48 truncate text-xs text-muted-foreground",title:c.modelId,children:c.modelId})]}),o.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:Gs(c.completedAt||c.startedAt||c.createdAt)}),o.jsxs("td",{className:"px-4 py-3",children:[c.status==="FAILED"?o.jsxs("button",{type:"button",onClick:()=>a(c),className:`inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-xs font-medium hover:opacity-80 ${ga.FAILED}`,title:"View failure reason",children:[o.jsx(Be,{className:"h-3 w-3"}),"failed"]}):o.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-xs font-medium ${ga[c.status]}`,children:[(c.status==="RUNNING"||c.status==="PENDING")&&o.jsx(Ge,{className:"h-3 w-3 animate-spin"}),c.status.toLowerCase()]}),c.error&&o.jsx("button",{type:"button",onClick:()=>a(c),className:"mt-1 block max-w-xs truncate text-left text-xs text-destructive underline-offset-2 hover:underline",title:"View complete failure reason",children:c.error==="1"?"View failure reason":c.error}),pa(c)&&o.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:pa(c)})]}),o.jsx("td",{className:"px-4 py-3",children:c.facts?new Intl.NumberFormat(void 0,{style:"currency",currency:c.facts.currency}).format(c.facts.currentTotal):"-"}),o.jsx("td",{className:"px-4 py-3",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs("button",{type:"button",onClick:()=>{e.download(c)},disabled:!(c.htmlReady||c.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:c.htmlReady?"Download HTML report":c.pdfReady?"Download PDF report":"Report not ready",children:[o.jsx(fs,{className:"h-4 w-4"}),"Download"]}),i&&o.jsx("button",{type:"button",onClick:()=>{e.remove(c)},disabled:e.removingId===c.id||c.status==="RUNNING"||c.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===c.id?o.jsx(Ge,{className:"h-4 w-4 animate-spin"}):o.jsx(Ii,{className:"h-4 w-4"})})]})})]},c.id))})]})})}):o.jsx(he,{children:o.jsxs(me,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[o.jsx(Ti,{className:"h-8 w-8 text-muted-foreground"}),o.jsx("h2",{className:"mt-4 text-base font-semibold",children:"No scheduled reports yet"}),o.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&&o.jsx(fp,{open:n,schedule:e.schedule,saving:e.saving,onClose:()=>s(!1),onSave:e.saveSchedule}),o.jsx(Yg,{report:r,onClose:()=>a(null)})]})}const Vt=hd({component:Ja}),ex=un({getParentRoute:()=>Vt,path:"/",component:Cm}),tx=un({getParentRoute:()=>Vt,path:"/reports",component:np}),nx=un({getParentRoute:()=>Vt,path:"/cur-discovery",component:op}),sx=un({getParentRoute:()=>Vt,path:"/analysis",component:Qg}),rx=un({getParentRoute:()=>Vt,path:"/sources",component:cp});function Ar(){return Vt.addChildren([ex,sx,tx,rx,nx])}function ox(e="/cost"){return Xa({routeTree:Ar(),basepath:e})}function ax({apiBase:e,token:t,basePath:n="/cost",userRole:s="user",tenantId:r="default"}){Ni(e,t);const a=P.useMemo(()=>Xa({routeTree:Ar(),basepath:n}),[n]);return o.jsx(mm,{value:s,children:o.jsx(gm,{tenantId:r,children:o.jsx(kd,{router:a})})})}const ix=[{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=ax;exports.api=re;exports.attachAuthInterceptors=kf;exports.configureApi=Ni;exports.costNavItems=ix;exports.createCostRouter=ox;exports.createRouteTree=Ar;