@meyicloud/meyi-cost-ui 1.7.1 → 1.7.2
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 +2 -2
- package/dist/index.mjs +1005 -1004
- package/dist/services/cost.d.ts +1 -0
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
11
11
|
`);return i===-1?"":s.stack.slice(i+1)})();try{if(!r.stack)r.stack=o;else if(o){const i=o.indexOf(`
|
|
12
12
|
`),c=i===-1?-1:o.indexOf(`
|
|
13
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=gt(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Dn.assertOptions(r,{silentJSONParsing:ge.transitional(ge.boolean),forcedJSONParsing:ge.transitional(ge.boolean),clarifyTimeoutError:ge.transitional(ge.boolean),legacyInterceptorReqResOrdering:ge.transitional(ge.boolean),advertiseZstdAcceptEncoding:ge.transitional(ge.boolean),validateStatusUndefinedResolves:ge.transitional(ge.boolean)},!1),s!=null&&(w.isFunction(s)?n.paramsSerializer={serialize:s}:Dn.assertOptions(s,{encode:ge.function,serialize:ge.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Dn.assertOptions(n,{baseUrl:ge.spelling("baseURL"),withXsrfToken:ge.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=be.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 x=n.transitional||cs;x&&x.legacyInterceptorReqResOrdering?c.unshift(p.fulfilled,p.rejected):c.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let f,l=0,h;if(!u){const g=[bo.bind(this),void 0];for(g.unshift(...c),g.push(...d),h=g.length,f=Promise.resolve(n);l<h;)f=f.then(g[l++],g[l++]);return f}h=c.length;let m=n;for(;l<h;){const g=c[l++],p=c[l++];try{m=g(m)}catch(x){p.call(this,x);break}}try{f=bo.call(this,m)}catch(g){return Promise.reject(g)}for(l=0,h=d.length;l<h;)f=f.then(d[l++],d[l++]);return f}getUri(t){t=gt(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){ft.prototype[t]=function(n,r){return this.request(gt(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(gt(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}ft.prototype[t]=n(),t!=="query"&&(ft.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 dn(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 ft(e),n=Ta(ft.prototype.request,t);return w.extend(n,ft.prototype,t,{allOwnKeys:!0}),w.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return ri(gt(e,s))},n}const ae=ri(un);ae.Axios=ft;ae.CanceledError=dn;ae.CancelToken=rf;ae.isCancel=Ja;ae.VERSION=us;ae.toFormData=sr;ae.AxiosError=T;ae.Cancel=ae.CanceledError;ae.all=function(t){return Promise.all(t)};ae.spread=sf;ae.isAxiosError=of;ae.mergeConfig=gt;ae.AxiosHeaders=be;ae.formToJSON=e=>Ya(w.isHTMLForm(e)?new FormData(e):e);ae.getAdapter=ti.getAdapter;ae.HttpStatusCode=Kr;ae.default=ae;const{Axios:Ng,AxiosError:Cg,CanceledError:jg,isCancel:Eg,CancelToken:kg,VERSION:_g,all:Pg,Cancel:Ag,isAxiosError:Og,spread:Tg,toFormData:Lg,AxiosHeaders:Ig,HttpStatusCode:Mg,formToJSON:Dg,getAdapter:Fg,mergeConfig:Ug,create:$g}=ae,ne=ae.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=P.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...c},u)=>P.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(([d,f])=>P.createElement(d,f)),...Array.isArray(o)?o:[o]]));const ee=(e,t)=>{const n=P.forwardRef(({className:r,...s},o)=>P.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"}]],ze=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"}]],Jn=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"}]],ct=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"}]],Lt=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"}]],ht=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}),Xn="-",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(Xn),u=c[0]===""&&c.length>1?1:0;return bi(c,u,t)},getConflictingClassGroupIds:(i,c)=>{if(c){const u=r[i],d=n[i];return u?d?eh(d,u):u:d||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 d=bi(e,t+1,o);if(d)return d}const i=n.validators;if(i===null)return;const c=t===0?e.join(Xn):e.slice(t).join(Xn),u=i.length;for(let d=0;d<u;d++){const f=i[d];if(f.validator(c))return f.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(Xn),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,d;const f=s.length;for(let p=0;p<f;p++){const x=s[p];if(i===0&&c===0){if(x===Ro){o.push(s.slice(u,p)),u=p+1;continue}if(x==="/"){d=p;continue}}x==="["?i++:x==="]"?i--:x==="("?c++:x===")"&&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=d&&d>u?d-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 d="";for(let f=u.length-1;f>=0;f-=1){const l=u[f],{isExternal:h,modifiers:m,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:x}=n(l);if(h){d=l+(d.length>0?" "+d:d);continue}let b=!!x,y;if(b){const C=p.substring(0,x);y=r(C);const R=y&&i[y]?r(p):void 0;R&&R!==y&&(y=R,b=!1)}else y=r(p);if(!y){if(!b){d=l+(d.length>0?" "+d:d);continue}if(y=r(p),!y){d=l+(d.length>0?" "+d:d);continue}b=!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 k=s(y,b);for(let C=0;C<k.length;++C){const R=k[C];c.push(N+R)}d=l+(d.length>0?" "+d:d)}return d},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 d=t.reduce((f,l)=>l(f),e());return n=gh(d),r=n.cache.get,s=n.cache.set,o=c,c(u)},c=u=>{const d=r(u);if(d)return d;const f=yh(u,n);return s(u,f),f};return o=i,(...u)=>o(vh(...u))},Sh=[],ce=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)\(.+\)$/,He=e=>Rh.test(e),G=e=>!!e&&!Number.isNaN(Number(e)),Le=e=>!!e&&Number.isInteger(Number(e)),kr=e=>e.endsWith("%")&&G(e.slice(0,-1)),Fe=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=>Qe(e,ji,ps),M=e=>wi.test(e),nt=e=>Qe(e,Ei,_h),Co=e=>Qe(e,zh,G),Ih=e=>Qe(e,_i,Ri),Mh=e=>Qe(e,ki,ps),jo=e=>Qe(e,Ni,ps),Dh=e=>Qe(e,Ci,Ah),vn=e=>Qe(e,Pi,Ph),F=e=>Si.test(e),Kt=e=>bt(e,Ei),Fh=e=>bt(e,ki),Eo=e=>bt(e,Ni),Uh=e=>bt(e,ji),$h=e=>bt(e,Ci),wn=e=>bt(e,Pi,!0),Bh=e=>bt(e,_i,!0),Qe=(e,t,n)=>{const r=wi.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},bt=(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=ce("color"),t=ce("font"),n=ce("text"),r=ce("font-weight"),s=ce("tracking"),o=ce("leading"),i=ce("breakpoint"),c=ce("container"),u=ce("spacing"),d=ce("radius"),f=ce("shadow"),l=ce("inset-shadow"),h=ce("text-shadow"),m=ce("drop-shadow"),g=ce("blur"),p=ce("perspective"),x=ce("aspect"),b=ce("ease"),y=ce("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],k=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],R=()=>[F,M,u],_=()=>[He,"full","auto",...R()],L=()=>[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],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...R()],Q=()=>[He,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],he=()=>[He,"screen","full","dvw","lvw","svw","min","max","fit",...R()],me=()=>[He,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],I=()=>[e,F,M],E=()=>[...N(),Eo,jo,{position:[F,M]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],q=()=>["auto","cover","contain",Uh,Lh,{size:[F,M]}],K=()=>[kr,Kt,nt],H=()=>["","none","full",d,F,M],z=()=>["",G,Kt,nt],U=()=>["solid","dashed","dotted","double"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>[G,kr,Eo,jo],ie=()=>["","none",g,F,M],le=()=>["none",G,F,M],te=()=>["none",G,F,M],je=()=>[G,F,M],Ce=()=>[He,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fe],breakpoint:[Fe],color:[Ri],container:[Fe],"drop-shadow":[Fe],ease:["in","out","in-out"],font:[Oh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fe],shadow:[Fe],spacing:["px",G],text:[Fe],"text-shadow":[Fe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",He,M,F,x]}],container:["container"],"container-type":[{"@container":["","normal","size",F,M]}],"container-named":[Th],columns:[{columns:[G,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:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{"inset-s":_(),start:_()}],end:[{"inset-e":_(),end:_()}],"inset-bs":[{"inset-bs":_()}],"inset-be":[{"inset-be":_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[Le,"auto",F,M]}],basis:[{basis:[He,"full","auto",c,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[G,He,"auto","initial","none",M]}],grow:[{grow:["",G,F,M]}],shrink:[{shrink:["",G,F,M]}],order:[{order:[Le,"first","last","none",F,M]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":L()}],"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:[...$(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"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:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mbs:[{mbs:Y()}],mbe:[{mbe:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":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",...he()]}],"min-inline-size":[{"min-inline":["auto",...he()]}],"max-inline-size":[{"max-inline":["none",...he()]}],"block-size":[{block:["auto",...me()]}],"min-block-size":[{"min-block":["auto",...me()]}],"max-block-size":[{"max-block":["none",...me()]}],w:[{w:[c,"screen",...Q()]}],"min-w":[{"min-w":[c,"screen","none",...Q()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[i]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,Kt,nt]}],"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":[G,"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:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:[G,"from-font","auto",F,nt]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[G,"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:E()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:q()}],"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:I()}],"gradient-from-pos":[{from:K()}],"gradient-via-pos":[{via:K()}],"gradient-to-pos":[{to:K()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"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:[...U(),"hidden","none"]}],"divide-style":[{divide:[...U(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...U(),"none","hidden"]}],"outline-offset":[{"outline-offset":[G,F,M]}],"outline-w":[{outline:["",G,Kt,nt]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",f,wn,vn]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",l,wn,vn]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[G,nt]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",h,wn,vn]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[G,F,M]}],"mix-blend":[{"mix-blend":[...Z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Z()}],"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":[G]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[F,M]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":[G]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:E()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",F,M]}],filter:[{filter:["","none",F,M]}],blur:[{blur:ie()}],brightness:[{brightness:[G,F,M]}],contrast:[{contrast:[G,F,M]}],"drop-shadow":[{"drop-shadow":["","none",m,wn,vn]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",G,F,M]}],"hue-rotate":[{"hue-rotate":[G,F,M]}],invert:[{invert:["",G,F,M]}],saturate:[{saturate:[G,F,M]}],sepia:[{sepia:["",G,F,M]}],"backdrop-filter":[{"backdrop-filter":["","none",F,M]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[G,F,M]}],"backdrop-contrast":[{"backdrop-contrast":[G,F,M]}],"backdrop-grayscale":[{"backdrop-grayscale":["",G,F,M]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[G,F,M]}],"backdrop-invert":[{"backdrop-invert":["",G,F,M]}],"backdrop-opacity":[{"backdrop-opacity":[G,F,M]}],"backdrop-saturate":[{"backdrop-saturate":[G,F,M]}],"backdrop-sepia":[{"backdrop-sepia":["",G,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:[G,"initial",F,M]}],ease:[{ease:["linear","initial",b,F,M]}],delay:[{delay:[G,F,M]}],animate:[{animate:["none",y,F,M]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,F,M]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:je()}],"skew-x":[{"skew-x":je()}],"skew-y":[{"skew-y":je()}],transform:[{transform:[F,M,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ce()}],"translate-x":[{"translate-x":Ce()}],"translate-y":[{"translate-y":Ce()}],"translate-z":[{"translate-z":Ce()}],"translate-none":["translate-none"],zoom:[{zoom:[Le,F,M]}],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"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",...I()]}],"stroke-w":[{stroke:[G,Kt,nt,Co]}],stroke:[{stroke:["none",...I()]}],"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 Ut(...e){return Vh(Qf(e))}function X(e,t="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:2}).format(e)}const ue=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ut("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ue.displayName="Card";const Re=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ut("flex flex-col space-y-1.5 p-6",e),...t}));Re.displayName="CardHeader";const Pe=S.forwardRef(({className:e,...t},n)=>a.jsx("h3",{ref:n,className:Ut("font-semibold leading-none tracking-tight",e),...t}));Pe.displayName="CardTitle";const Hh=S.forwardRef(({className:e,...t},n)=>a.jsx("p",{ref:n,className:Ut("text-sm text-muted-foreground",e),...t}));Hh.displayName="CardDescription";const de=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ut("p-6 pt-0",e),...t}));de.displayName="CardContent";const qh=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ut("flex items-center p-6 pt-0",e),...t}));qh.displayName="CardFooter";function Zn({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(ze,{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(qn,{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(qn,{to:"/sources",className:"rounded-md border px-3 py-2 text-sm font-medium hover:bg-muted",children:"Cost sources"})]})]})]})})}const oe={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),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=P.createContext("user"),Gh=Ai.Provider,Kh=()=>P.useContext(Ai),Oi=P.createContext(null);function Yh({tenantId:e="default",children:t}){const n=`meyi-cost:selected-management-account:${e||"default"}`,[r,s]=P.useState([]),[o,i]=P.useState(""),[c,u]=P.useState(!0),d=P.useCallback(async()=>{u(!0);try{const m=((await oe.getSources()).sources||[]).filter(g=>!!g.managementAccountId);s(m),i(g=>{const x=window.localStorage.getItem(n)||""||g,b=m.find(v=>v.status==="CONNECTED")||m[0],y=m.some(v=>v.managementAccountId===x)?x:b?.managementAccountId||"";return y?window.localStorage.setItem(n,y):window.localStorage.removeItem(n),y})}catch{s([]),i("")}finally{u(!1)}},[n]);P.useEffect(()=>{d()},[d]);const f=P.useCallback(h=>{/^\d{12}$/.test(h)&&(window.localStorage.setItem(n,h),i(h))},[n]),l=P.useMemo(()=>({sources:r,managementAccountId:o,loading:c,selectManagementAccount:f,refreshSources:d}),[r,o,c,f,d]);return a.jsx(Oi.Provider,{value:l,children:t})}function $t(){const e=P.useContext(Oi);if(!e)throw new Error("useCostAccount must be used inside CostAccountProvider");return e}function ar(){const{sources:e,managementAccountId:t,loading:n,selectManagementAccount:r}=$t();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]=P.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,d=48,f=s-i-c,l=o-u-d,h=Math.max(...e.map(x=>x.value),1),m=e.map((x,b)=>({...x,x:i+(e.length===1?f/2:b*f/(e.length-1)),y:u+l-x.value/h*l})),g=n==null?null:m[n],p=x=>{const b=x.currentTarget.getBoundingClientRect(),y=(x.clientX-b.left)/b.width*s;let v=0;for(let N=1;N<m.length;N+=1)Math.abs(m[N].x-y)<Math.abs(m[v].x-y)&&(v=N);r(v)};return a.jsxs("div",{className:"relative w-full",children:[a.jsxs("svg",{viewBox:`0 0 ${s} ${o}`,className:"h-72 w-full",onMouseMove:p,onMouseLeave:()=>r(null),role:"img","aria-label":"Cost trend line chart",children:[[0,.25,.5,.75,1].map(x=>{const b=u+l*x;return a.jsxs("g",{children:[a.jsx("line",{x1:i,y1:b,x2:s-c,y2:b,stroke:"#d8e0e7",strokeDasharray:"4 4"}),a.jsx("text",{x:i-10,y:b+4,textAnchor:"end",fill:"currentColor",className:"text-[10px] text-muted-foreground",children:X(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,b)=>a.jsxs("g",{children:[a.jsx("circle",{cx:x.x,cy:x.y,r:n===b?7:5,fill:"#1f5f85",stroke:"white",strokeWidth:"2"}),a.jsx("text",{x:x.x,y:o-17,textAnchor:"middle",fill:"currentColor",className:"text-[11px] text-muted-foreground",children:x.label})]},x.key))]}),g&&a.jsxs("div",{className:"pointer-events-none absolute z-20 min-w-44 rounded-lg border bg-popover p-3 text-popover-foreground shadow-xl",style:{left:`${g.x/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:X(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:X(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),d=i/t.length,f=Math.min(56,d*.58);return a.jsxs("svg",{viewBox:"0 0 720 320",className:"h-80 w-full",role:"img","aria-label":`${e} cost bar chart`,children:[[0,.25,.5,.75,1].map(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+d*h+d/2,g=Math.max(l.amount/u*c,3),p=o.top+c-g;return a.jsxs("g",{tabIndex:0,"aria-label":`${l.label}: ${X(l.amount,n)}`,className:"outline-none focus-visible:opacity-75",children:[a.jsxs("title",{children:[l.label,": ",X(l.amount,n)]}),a.jsx("rect",{x:m-f/2,y:p,width:f,height:g,rx:"4",className:"fill-primary opacity-80 transition-opacity hover:opacity-100"}),a.jsx("text",{x:m,y:Math.max(p-8,16),textAnchor:"middle",fill:"currentColor",fontSize:"11",fontWeight:"600",children:X(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]=P.useState("chart"),i=n.slice(0,6),c=Math.max(...i.map(u=>u.amount),1);return a.jsxs(ue,{className:"min-w-0",children:[a.jsxs(Re,{className:"flex flex-row items-center justify-between gap-3 pb-3",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"text-primary",children:t}),a.jsx(Pe,{className:"truncate text-sm",children:e})]}),a.jsxs("div",{className:"flex rounded-md border p-0.5","aria-label":`${e} view`,children:[a.jsx("button",{type:"button",onClick:()=>o("chart"),"aria-label":`Show ${e} as bar chart`,"aria-pressed":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(de,{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:X(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(ue,{className:Ti,children:[a.jsx(Re,{className:"pb-2",children:a.jsx("div",{className:"h-3 w-24 animate-pulse rounded bg-muted"})}),a.jsxs(de,{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(ue,{children:[a.jsx(Re,{children:a.jsx("div",{className:"h-4 w-36 animate-pulse rounded bg-muted"})}),a.jsx(de,{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(ue,{children:[a.jsx(Re,{children:a.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted"})}),a.jsx(de,{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()),d=[{label:"Total cost",value:a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"block",children:X(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(Jn,{})},{label:"Highest cost service",value:r?a.jsx("span",{className:"whitespace-pre-line text-sm",children:`Service - ${r.label}
|
|
14
|
+
`+o)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=gt(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Dn.assertOptions(r,{silentJSONParsing:ge.transitional(ge.boolean),forcedJSONParsing:ge.transitional(ge.boolean),clarifyTimeoutError:ge.transitional(ge.boolean),legacyInterceptorReqResOrdering:ge.transitional(ge.boolean),advertiseZstdAcceptEncoding:ge.transitional(ge.boolean),validateStatusUndefinedResolves:ge.transitional(ge.boolean)},!1),s!=null&&(w.isFunction(s)?n.paramsSerializer={serialize:s}:Dn.assertOptions(s,{encode:ge.function,serialize:ge.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Dn.assertOptions(n,{baseUrl:ge.spelling("baseURL"),withXsrfToken:ge.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=be.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 x=n.transitional||cs;x&&x.legacyInterceptorReqResOrdering?c.unshift(p.fulfilled,p.rejected):c.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let f,l=0,h;if(!u){const g=[bo.bind(this),void 0];for(g.unshift(...c),g.push(...d),h=g.length,f=Promise.resolve(n);l<h;)f=f.then(g[l++],g[l++]);return f}h=c.length;let m=n;for(;l<h;){const g=c[l++],p=c[l++];try{m=g(m)}catch(x){p.call(this,x);break}}try{f=bo.call(this,m)}catch(g){return Promise.reject(g)}for(l=0,h=d.length;l<h;)f=f.then(d[l++],d[l++]);return f}getUri(t){t=gt(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){ft.prototype[t]=function(n,r){return this.request(gt(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(gt(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}ft.prototype[t]=n(),t!=="query"&&(ft.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 dn(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 ft(e),n=Ta(ft.prototype.request,t);return w.extend(n,ft.prototype,t,{allOwnKeys:!0}),w.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return ri(gt(e,s))},n}const ae=ri(un);ae.Axios=ft;ae.CanceledError=dn;ae.CancelToken=rf;ae.isCancel=Ja;ae.VERSION=us;ae.toFormData=sr;ae.AxiosError=T;ae.Cancel=ae.CanceledError;ae.all=function(t){return Promise.all(t)};ae.spread=sf;ae.isAxiosError=of;ae.mergeConfig=gt;ae.AxiosHeaders=be;ae.formToJSON=e=>Ya(w.isHTMLForm(e)?new FormData(e):e);ae.getAdapter=ti.getAdapter;ae.HttpStatusCode=Kr;ae.default=ae;const{Axios:Ng,AxiosError:Cg,CanceledError:jg,isCancel:Eg,CancelToken:kg,VERSION:_g,all:Pg,Cancel:Ag,isAxiosError:Og,spread:Tg,toFormData:Lg,AxiosHeaders:Ig,HttpStatusCode:Mg,formToJSON:Dg,getAdapter:Fg,mergeConfig:Ug,create:$g}=ae,ne=ae.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=P.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...c},u)=>P.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(([d,f])=>P.createElement(d,f)),...Array.isArray(o)?o:[o]]));const ee=(e,t)=>{const n=P.forwardRef(({className:r,...s},o)=>P.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"}]],ze=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"}]],Jn=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"}]],ct=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"}]],Lt=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"}]],ht=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}),Xn="-",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(Xn),u=c[0]===""&&c.length>1?1:0;return bi(c,u,t)},getConflictingClassGroupIds:(i,c)=>{if(c){const u=r[i],d=n[i];return u?d?eh(d,u):u:d||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 d=bi(e,t+1,o);if(d)return d}const i=n.validators;if(i===null)return;const c=t===0?e.join(Xn):e.slice(t).join(Xn),u=i.length;for(let d=0;d<u;d++){const f=i[d];if(f.validator(c))return f.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(Xn),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,d;const f=s.length;for(let p=0;p<f;p++){const x=s[p];if(i===0&&c===0){if(x===Ro){o.push(s.slice(u,p)),u=p+1;continue}if(x==="/"){d=p;continue}}x==="["?i++:x==="]"?i--:x==="("?c++:x===")"&&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=d&&d>u?d-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 d="";for(let f=u.length-1;f>=0;f-=1){const l=u[f],{isExternal:h,modifiers:m,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:x}=n(l);if(h){d=l+(d.length>0?" "+d:d);continue}let b=!!x,y;if(b){const C=p.substring(0,x);y=r(C);const R=y&&i[y]?r(p):void 0;R&&R!==y&&(y=R,b=!1)}else y=r(p);if(!y){if(!b){d=l+(d.length>0?" "+d:d);continue}if(y=r(p),!y){d=l+(d.length>0?" "+d:d);continue}b=!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 k=s(y,b);for(let C=0;C<k.length;++C){const R=k[C];c.push(N+R)}d=l+(d.length>0?" "+d:d)}return d},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 d=t.reduce((f,l)=>l(f),e());return n=gh(d),r=n.cache.get,s=n.cache.set,o=c,c(u)},c=u=>{const d=r(u);if(d)return d;const f=yh(u,n);return s(u,f),f};return o=i,(...u)=>o(vh(...u))},Sh=[],ce=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)\(.+\)$/,He=e=>Rh.test(e),G=e=>!!e&&!Number.isNaN(Number(e)),Le=e=>!!e&&Number.isInteger(Number(e)),kr=e=>e.endsWith("%")&&G(e.slice(0,-1)),Fe=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=>Qe(e,ji,ps),M=e=>wi.test(e),nt=e=>Qe(e,Ei,_h),Co=e=>Qe(e,zh,G),Ih=e=>Qe(e,_i,Ri),Mh=e=>Qe(e,ki,ps),jo=e=>Qe(e,Ni,ps),Dh=e=>Qe(e,Ci,Ah),vn=e=>Qe(e,Pi,Ph),F=e=>Si.test(e),Kt=e=>bt(e,Ei),Fh=e=>bt(e,ki),Eo=e=>bt(e,Ni),Uh=e=>bt(e,ji),$h=e=>bt(e,Ci),wn=e=>bt(e,Pi,!0),Bh=e=>bt(e,_i,!0),Qe=(e,t,n)=>{const r=wi.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},bt=(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=ce("color"),t=ce("font"),n=ce("text"),r=ce("font-weight"),s=ce("tracking"),o=ce("leading"),i=ce("breakpoint"),c=ce("container"),u=ce("spacing"),d=ce("radius"),f=ce("shadow"),l=ce("inset-shadow"),h=ce("text-shadow"),m=ce("drop-shadow"),g=ce("blur"),p=ce("perspective"),x=ce("aspect"),b=ce("ease"),y=ce("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],k=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],R=()=>[F,M,u],_=()=>[He,"full","auto",...R()],L=()=>[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],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...R()],Q=()=>[He,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],he=()=>[He,"screen","full","dvw","lvw","svw","min","max","fit",...R()],me=()=>[He,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],I=()=>[e,F,M],E=()=>[...N(),Eo,jo,{position:[F,M]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],q=()=>["auto","cover","contain",Uh,Lh,{size:[F,M]}],K=()=>[kr,Kt,nt],H=()=>["","none","full",d,F,M],z=()=>["",G,Kt,nt],U=()=>["solid","dashed","dotted","double"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>[G,kr,Eo,jo],ie=()=>["","none",g,F,M],le=()=>["none",G,F,M],te=()=>["none",G,F,M],je=()=>[G,F,M],Ce=()=>[He,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fe],breakpoint:[Fe],color:[Ri],container:[Fe],"drop-shadow":[Fe],ease:["in","out","in-out"],font:[Oh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fe],shadow:[Fe],spacing:["px",G],text:[Fe],"text-shadow":[Fe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",He,M,F,x]}],container:["container"],"container-type":[{"@container":["","normal","size",F,M]}],"container-named":[Th],columns:[{columns:[G,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:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{"inset-s":_(),start:_()}],end:[{"inset-e":_(),end:_()}],"inset-bs":[{"inset-bs":_()}],"inset-be":[{"inset-be":_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[Le,"auto",F,M]}],basis:[{basis:[He,"full","auto",c,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[G,He,"auto","initial","none",M]}],grow:[{grow:["",G,F,M]}],shrink:[{shrink:["",G,F,M]}],order:[{order:[Le,"first","last","none",F,M]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":L()}],"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:[...$(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"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:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mbs:[{mbs:Y()}],mbe:[{mbe:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":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",...he()]}],"min-inline-size":[{"min-inline":["auto",...he()]}],"max-inline-size":[{"max-inline":["none",...he()]}],"block-size":[{block:["auto",...me()]}],"min-block-size":[{"min-block":["auto",...me()]}],"max-block-size":[{"max-block":["none",...me()]}],w:[{w:[c,"screen",...Q()]}],"min-w":[{"min-w":[c,"screen","none",...Q()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[i]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,Kt,nt]}],"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":[G,"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:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:[G,"from-font","auto",F,nt]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[G,"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:E()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:q()}],"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:I()}],"gradient-from-pos":[{from:K()}],"gradient-via-pos":[{via:K()}],"gradient-to-pos":[{to:K()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"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:[...U(),"hidden","none"]}],"divide-style":[{divide:[...U(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...U(),"none","hidden"]}],"outline-offset":[{"outline-offset":[G,F,M]}],"outline-w":[{outline:["",G,Kt,nt]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",f,wn,vn]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",l,wn,vn]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[G,nt]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",h,wn,vn]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[G,F,M]}],"mix-blend":[{"mix-blend":[...Z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Z()}],"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":[G]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[F,M]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":[G]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:E()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",F,M]}],filter:[{filter:["","none",F,M]}],blur:[{blur:ie()}],brightness:[{brightness:[G,F,M]}],contrast:[{contrast:[G,F,M]}],"drop-shadow":[{"drop-shadow":["","none",m,wn,vn]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",G,F,M]}],"hue-rotate":[{"hue-rotate":[G,F,M]}],invert:[{invert:["",G,F,M]}],saturate:[{saturate:[G,F,M]}],sepia:[{sepia:["",G,F,M]}],"backdrop-filter":[{"backdrop-filter":["","none",F,M]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[G,F,M]}],"backdrop-contrast":[{"backdrop-contrast":[G,F,M]}],"backdrop-grayscale":[{"backdrop-grayscale":["",G,F,M]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[G,F,M]}],"backdrop-invert":[{"backdrop-invert":["",G,F,M]}],"backdrop-opacity":[{"backdrop-opacity":[G,F,M]}],"backdrop-saturate":[{"backdrop-saturate":[G,F,M]}],"backdrop-sepia":[{"backdrop-sepia":["",G,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:[G,"initial",F,M]}],ease:[{ease:["linear","initial",b,F,M]}],delay:[{delay:[G,F,M]}],animate:[{animate:["none",y,F,M]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,F,M]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:je()}],"skew-x":[{"skew-x":je()}],"skew-y":[{"skew-y":je()}],transform:[{transform:[F,M,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ce()}],"translate-x":[{"translate-x":Ce()}],"translate-y":[{"translate-y":Ce()}],"translate-z":[{"translate-z":Ce()}],"translate-none":["translate-none"],zoom:[{zoom:[Le,F,M]}],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"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",...I()]}],"stroke-w":[{stroke:[G,Kt,nt,Co]}],stroke:[{stroke:["none",...I()]}],"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 Ut(...e){return Vh(Qf(e))}function X(e,t="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:2}).format(e)}const ue=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ut("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ue.displayName="Card";const Re=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ut("flex flex-col space-y-1.5 p-6",e),...t}));Re.displayName="CardHeader";const Pe=S.forwardRef(({className:e,...t},n)=>a.jsx("h3",{ref:n,className:Ut("font-semibold leading-none tracking-tight",e),...t}));Pe.displayName="CardTitle";const Hh=S.forwardRef(({className:e,...t},n)=>a.jsx("p",{ref:n,className:Ut("text-sm text-muted-foreground",e),...t}));Hh.displayName="CardDescription";const de=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ut("p-6 pt-0",e),...t}));de.displayName="CardContent";const qh=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ut("flex items-center p-6 pt-0",e),...t}));qh.displayName="CardFooter";function Zn({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(ze,{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(qn,{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(qn,{to:"/sources",className:"rounded-md border px-3 py-2 text-sm font-medium hover:bg-muted",children:"Cost sources"})]})]})]})})}const oe={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=P.createContext("user"),Gh=Ai.Provider,Kh=()=>P.useContext(Ai),Oi=P.createContext(null);function Yh({tenantId:e="default",children:t}){const n=`meyi-cost:selected-management-account:${e||"default"}`,[r,s]=P.useState([]),[o,i]=P.useState(""),[c,u]=P.useState(!0),d=P.useCallback(async()=>{u(!0);try{const m=((await oe.getSources()).sources||[]).filter(g=>!!g.managementAccountId);s(m),i(g=>{const x=window.localStorage.getItem(n)||""||g,b=m.find(v=>v.status==="CONNECTED")||m[0],y=m.some(v=>v.managementAccountId===x)?x:b?.managementAccountId||"";return y?window.localStorage.setItem(n,y):window.localStorage.removeItem(n),y})}catch{s([]),i("")}finally{u(!1)}},[n]);P.useEffect(()=>{d()},[d]);const f=P.useCallback(h=>{/^\d{12}$/.test(h)&&(window.localStorage.setItem(n,h),i(h))},[n]),l=P.useMemo(()=>({sources:r,managementAccountId:o,loading:c,selectManagementAccount:f,refreshSources:d}),[r,o,c,f,d]);return a.jsx(Oi.Provider,{value:l,children:t})}function $t(){const e=P.useContext(Oi);if(!e)throw new Error("useCostAccount must be used inside CostAccountProvider");return e}function ar(){const{sources:e,managementAccountId:t,loading:n,selectManagementAccount:r}=$t();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]=P.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,d=48,f=s-i-c,l=o-u-d,h=Math.max(...e.map(x=>x.value),1),m=e.map((x,b)=>({...x,x:i+(e.length===1?f/2:b*f/(e.length-1)),y:u+l-x.value/h*l})),g=n==null?null:m[n],p=x=>{const b=x.currentTarget.getBoundingClientRect(),y=(x.clientX-b.left)/b.width*s;let v=0;for(let N=1;N<m.length;N+=1)Math.abs(m[N].x-y)<Math.abs(m[v].x-y)&&(v=N);r(v)};return a.jsxs("div",{className:"relative w-full",children:[a.jsxs("svg",{viewBox:`0 0 ${s} ${o}`,className:"h-72 w-full",onMouseMove:p,onMouseLeave:()=>r(null),role:"img","aria-label":"Cost trend line chart",children:[[0,.25,.5,.75,1].map(x=>{const b=u+l*x;return a.jsxs("g",{children:[a.jsx("line",{x1:i,y1:b,x2:s-c,y2:b,stroke:"#d8e0e7",strokeDasharray:"4 4"}),a.jsx("text",{x:i-10,y:b+4,textAnchor:"end",fill:"currentColor",className:"text-[10px] text-muted-foreground",children:X(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,b)=>a.jsxs("g",{children:[a.jsx("circle",{cx:x.x,cy:x.y,r:n===b?7:5,fill:"#1f5f85",stroke:"white",strokeWidth:"2"}),a.jsx("text",{x:x.x,y:o-17,textAnchor:"middle",fill:"currentColor",className:"text-[11px] text-muted-foreground",children:x.label})]},x.key))]}),g&&a.jsxs("div",{className:"pointer-events-none absolute z-20 min-w-44 rounded-lg border bg-popover p-3 text-popover-foreground shadow-xl",style:{left:`${g.x/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:X(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:X(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),d=i/t.length,f=Math.min(56,d*.58);return a.jsxs("svg",{viewBox:"0 0 720 320",className:"h-80 w-full",role:"img","aria-label":`${e} cost bar chart`,children:[[0,.25,.5,.75,1].map(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+d*h+d/2,g=Math.max(l.amount/u*c,3),p=o.top+c-g;return a.jsxs("g",{tabIndex:0,"aria-label":`${l.label}: ${X(l.amount,n)}`,className:"outline-none focus-visible:opacity-75",children:[a.jsxs("title",{children:[l.label,": ",X(l.amount,n)]}),a.jsx("rect",{x:m-f/2,y:p,width:f,height:g,rx:"4",className:"fill-primary opacity-80 transition-opacity hover:opacity-100"}),a.jsx("text",{x:m,y:Math.max(p-8,16),textAnchor:"middle",fill:"currentColor",fontSize:"11",fontWeight:"600",children:X(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]=P.useState("chart"),i=n.slice(0,6),c=Math.max(...i.map(u=>u.amount),1);return a.jsxs(ue,{className:"min-w-0",children:[a.jsxs(Re,{className:"flex flex-row items-center justify-between gap-3 pb-3",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"text-primary",children:t}),a.jsx(Pe,{className:"truncate text-sm",children:e})]}),a.jsxs("div",{className:"flex rounded-md border p-0.5","aria-label":`${e} view`,children:[a.jsx("button",{type:"button",onClick:()=>o("chart"),"aria-label":`Show ${e} as bar chart`,"aria-pressed":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(de,{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:X(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(ue,{className:Ti,children:[a.jsx(Re,{className:"pb-2",children:a.jsx("div",{className:"h-3 w-24 animate-pulse rounded bg-muted"})}),a.jsxs(de,{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(ue,{children:[a.jsx(Re,{children:a.jsx("div",{className:"h-4 w-36 animate-pulse rounded bg-muted"})}),a.jsx(de,{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(ue,{children:[a.jsx(Re,{children:a.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted"})}),a.jsx(de,{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()),d=[{label:"Total cost",value:a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"block",children:X(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(Jn,{})},{label:"Highest cost service",value:r?a.jsx("span",{className:"whitespace-pre-line text-sm",children:`Service - ${r.label}
|
|
15
15
|
Cost - ${X(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
16
|
Account Id - ${s.accountId||s.key||"Unknown"}
|
|
17
17
|
Cost - ${X(s.amount,e.currency)}`}):"-",helper:u,icon:a.jsx(Jn,{})}];return a.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:d.map(f=>a.jsxs(ue,{className:Ti,children:[a.jsxs(Re,{className:"flex flex-row items-center justify-between pb-2",children:[a.jsx(Pe,{className:"text-xs font-medium text-muted-foreground",children:f.label}),a.jsx("span",{className:"text-muted-foreground [&>svg]:h-4 [&>svg]:w-4",children:f.icon})]}),a.jsxs(de,{children:[a.jsx("div",{className:"break-words text-base font-semibold leading-snug xl:text-lg",children:f.value}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:f.helper})]})]},f.label))})}function tm(){const e=new Date,t=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`,[n,r]=P.useState(null),[s,o]=P.useState(!0),[i,c]=P.useState(null),[u,d]=P.useState(null),[f,l]=P.useState("monthly"),[h,m]=P.useState(t),{managementAccountId:g,loading:p}=$t(),x=P.useRef(0),b=Array.from({length:e.getMonth()+1},(j,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(j=f,k=h,C=g)=>{const R=++x.current;o(!0),r(null),c(null);try{let _;if(j==="yearly")_={period:j,start:`${e.getFullYear()}-01-01`};else{const[O,$]=k.split("-").map(Number),J=k===t?e.getDate():new Date(O,$,0).getDate();_={period:j,start:`${k}-01`,end:`${k}-${String(J).padStart(2,"0")}`}}const L=C?{managementAccountId:C}:void 0,A=await oe.getDataStatus(L);if(R===x.current&&d(A),!A.ready)return;const D=await oe.getOverview({..._,...L});R===x.current&&r(D)}catch(_){R===x.current&&c(_?.response?.data?.error||_.message||"Failed to load AWS costs")}finally{R===x.current&&o(!1)}};return P.useEffect(()=>{p||y(f,h,g)},[f,h,g,p]),{data:n,dataStatus:u,loading:s||p,error:i,period:f,selectedMonth:h,monthOptions:b,changePeriod:j=>{j!==f&&(o(!0),r(null),l(j))},changeMonth:j=>{j===h||!b.some(k=>k.value===j)||(o(!0),r(null),m(j))},refresh:()=>y(f,h,g)}}function nm(){const{data:e,dataStatus:t,loading:n,error:r,period:s,selectedMonth:o,monthOptions:i,changePeriod:c,changeMonth:u,refresh:d}=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(ar,{}),s==="monthly"&&a.jsx("select",{"aria-label":"Cost month",value:o,onChange:f=>u(f.target.value),disabled:n,className:"rounded-lg border bg-background px-3 py-2 text-sm shadow-sm disabled:opacity-50",children:i.map(f=>a.jsx("option",{value:f.value,children:f.label},f.value))}),a.jsx("div",{className:"flex rounded-lg border p-1",children:["monthly","yearly"].map(f=>a.jsx("button",{onClick:()=>c(f),className:`rounded-md px-3 py-1.5 text-sm capitalize transition-colors ${s===f?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:f},f))}),a.jsx("button",{onClick:()=>{d()},disabled:n,className:"rounded-lg border p-2 hover:bg-muted",children:a.jsx(Lt,{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(ze,{className:"h-4 w-4"}),r]}),n?a.jsx(Qh,{}):t&&!t.ready?a.jsx(Zn,{status:t}):r&&!e?a.jsx(Zn,{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(ue,{children:a.jsx(de,{className:"py-8 text-center text-sm text-muted-foreground",children:e.message})}),a.jsxs(ue,{children:[a.jsxs(Re,{className:"flex flex-row items-center gap-2",children:[a.jsx(pi,{className:"h-4 w-4 text-primary"}),a.jsxs(Pe,{className:"text-sm",children:["Cost Trend - ",s==="monthly"?"Monthly":"Yearly"]})]}),a.jsx(de,{children:a.jsx(Jh,{points:e.trends.map(f=>({key:f.month,label:s==="yearly"?f.month.slice(0,4):new Date(`${f.month}T00:00:00Z`).toLocaleDateString(void 0,{month:"short",year:"2-digit"}),value:f.amount})),currency:e.currency})})]}),a.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[a.jsx(_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 Sn=["#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 rm({timeline:e,currency:t="USD",daily:n=!1}){const[r,s]=P.useState(null),[o,i]=P.useState(null),c=P.useMemo(()=>{const g=new Map;for(const p of e)for(const x of p.groups)g.set(x.label,(g.get(x.label)||0)+x.amount);return[...g.entries()].sort((p,x)=>x[1]-p[1]).map(([p],x)=>({label:p,color:Sn[x%Sn.length]}))},[e]),u=new Map(c.map(g=>[g.label,g.color])),d=Math.max(...e.map(g=>g.total),1),f=r??o,l=f==null?null:e[f],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:X(d*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:x=>x.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/d*100,1)}%`},children:g.groups.map(x=>a.jsx("span",{style:{backgroundColor:u.get(x.label)||Sn[0],height:`${g.total?x.amount/g.total*100:0}%`}},x.key||x.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)||Sn[0]}}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:g.label}),a.jsx("strong",{children:X(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:X(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 sm({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(ue,{className:"bg-primary/5",children:[a.jsx(Re,{children:a.jsx(Pe,{className:"text-sm",children:"Comparison Overview"})}),a.jsx(de,{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: ${X(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: ${X(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 Rn({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 om(){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(ct,{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 Xe=10,Jr=new Date,Li=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,am=Li(new Date(Jr.getFullYear(),Jr.getMonth()-2,1)),im=Li(Jr),Yt={services:[],regions:[],accountIds:[],tagKey:"",tagValues:[]},mt={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 It(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 cm(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 rt(e){return e?.length?e.map(t=>`${t.label}
|
|
@@ -58,4 +58,4 @@ ${X(t.amount,"USD")}`).join(`
|
|
|
58
58
|
`)},Ho=function(){var e=parseInt(document.body.getAttribute(Pt)||"0",10);return isFinite(e)?e:0},Ip=function(){S.useEffect(function(){return document.body.setAttribute(Pt,(Ho()+1).toString()),function(){var e=Ho()-1;e<=0?document.body.removeAttribute(Pt):document.body.setAttribute(Pt,e.toString())}},[])},Mp=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;Ip();var o=S.useMemo(function(){return Op(s)},[s]);return S.createElement(Tp,{styles:Lp(o,!t,s,n?"":"!important")})},Zr=!1;if(typeof window<"u")try{var En=Object.defineProperty({},"passive",{get:function(){return Zr=!0,!0}});window.addEventListener("test",En,En),window.removeEventListener("test",En,En)}catch{Zr=!1}var Rt=Zr?{passive:!1}:!1,Dp=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&&!Dp(e)&&n[t]==="visible")},Fp=function(e){return qi(e,"overflowY")},Up=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},$p=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Bp=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Gi=function(e,t){return e==="v"?Fp(t):Up(t)},Ki=function(e,t){return e==="v"?$p(t):Bp(t)},zp=function(e,t){return e==="h"&&t==="rtl"?-1:1},Wp=function(e,t,n,r,s){var o=zp(e,window.getComputedStyle(t).direction),i=o*r,c=n.target,u=t.contains(c),d=!1,f=i>0,l=0,h=0;do{if(!c)break;var m=Ki(e,c),g=m[0],p=m[1],x=m[2],b=p-x-o*g;(g||b)&&Gi(e,c)&&(l+=b,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(f&&Math.abs(l)<1||!f&&Math.abs(h)<1)&&(d=!0),d},kn=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},Vp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Hp=function(e){return`
|
|
59
59
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
60
60
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
61
|
-
`)},qp=0,Nt=[];function Gp(e){var t=S.useRef([]),n=S.useRef([0,0]),r=S.useRef(),s=S.useState(qp++)[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=mp([e.lockRef.current],(e.shards||[]).map(Ko),!0).filter(Boolean);return p.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var c=S.useCallback(function(p,x){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var b=kn(p),y=n.current,v="deltaX"in p?p.deltaX:y[0]-b[0],N="deltaY"in p?p.deltaY:y[1]-b[1],j,k=p.target,C=Math.abs(v)>Math.abs(N)?"h":"v";if("touches"in p&&C==="h"&&k.type==="range")return!1;var R=window.getSelection(),_=R&&R.anchorNode,L=_?_===k||_.contains(k):!1;if(L)return!1;var A=qo(C,k);if(!A)return!0;if(A?j=C:(j=C==="v"?"h":"v",A=qo(C,k)),!A)return!1;if(!r.current&&"changedTouches"in p&&(v||N)&&(r.current=j),!j)return!0;var D=r.current||j;return Wp(D,x,p,D==="h"?v:N)},[]),u=S.useCallback(function(p){var x=p;if(!(!Nt.length||Nt[Nt.length-1]!==o)){var b="deltaY"in x?Go(x):kn(x),y=t.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&Vp(j.delta,b)})[0];if(y&&y.should){x.cancelable&&x.preventDefault();return}if(!y){var v=(i.current.shards||[]).map(Ko).filter(Boolean).filter(function(j){return j.contains(x.target)}),N=v.length>0?c(x,v[0]):!i.current.noIsolation;N&&x.cancelable&&x.preventDefault()}}},[]),d=S.useCallback(function(p,x,b,y){var v={name:p,delta:x,target:b,should:y,shadowParent:Kp(b)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(N){return N!==v})},1)},[]),f=S.useCallback(function(p){n.current=kn(p),r.current=void 0},[]),l=S.useCallback(function(p){d(p.type,Go(p),p.target,c(p,e.lockRef.current))},[]),h=S.useCallback(function(p){d(p.type,kn(p),p.target,c(p,e.lockRef.current))},[]);S.useEffect(function(){return Nt.push(o),e.setCallbacks({onScrollCapture:l,onWheelCapture:l,onTouchMoveCapture:h}),document.addEventListener("wheel",u,Rt),document.addEventListener("touchmove",u,Rt),document.addEventListener("touchstart",f,Rt),function(){Nt=Nt.filter(function(p){return p!==o}),document.removeEventListener("wheel",u,Rt),document.removeEventListener("touchmove",u,Rt),document.removeEventListener("touchstart",f,Rt)}},[]);var m=e.removeScrollBar,g=e.inert;return S.createElement(S.Fragment,null,g?S.createElement(o,{styles:Hp(s)}):null,m?S.createElement(Mp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Kp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Yp=Rp(Vi,Gp);var Yi=S.forwardRef(function(e,t){return S.createElement(cr,De({},e,{ref:t,sideCar:Yp}))});Yi.classNames=cr.classNames;var Jp=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ct=new WeakMap,_n=new WeakMap,Pn={},Mr=0,Ji=function(e){return e&&(e.host||Ji(e.parentNode))},Xp=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})},Zp=function(e,t,n,r){var s=Xp(t,Array.isArray(e)?e:[e]);Pn[n]||(Pn[n]=new WeakMap);var o=Pn[n],i=[],c=new Set,u=new Set(s),d=function(l){!l||c.has(l)||(c.add(l),d(l.parentNode))};s.forEach(d);var f=function(l){!l||u.has(l)||Array.prototype.forEach.call(l.children,function(h){if(c.has(h))f(h);else try{var m=h.getAttribute(r),g=m!==null&&m!=="false",p=(Ct.get(h)||0)+1,x=(o.get(h)||0)+1;Ct.set(h,p),o.set(h,x),i.push(h),p===1&&g&&_n.set(h,!0),x===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return f(t),c.clear(),Mr++,function(){i.forEach(function(l){var h=Ct.get(l)-1,m=o.get(l)-1;Ct.set(l,h),o.set(l,m),h||(_n.has(l)||l.removeAttribute(r),_n.delete(l)),m||l.removeAttribute(n)}),Mr--,Mr||(Ct=new WeakMap,Ct=new WeakMap,_n=new WeakMap,Pn={})}},Qp=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Jp(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Zp(r,s,n,"aria-hidden")):function(){return null}},lr="Dialog",[Xi]=Em(lr),[eg,Oe]=Xi(lr),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),[d,f]=Om({prop:r,defaultProp:s??!1,onChange:o,caller:lr});return a.jsx(eg,{scope:t,triggerRef:c,contentRef:u,contentId:Pr(),titleId:Pr(),descriptionId:Pr(),open:d,onOpenChange:f,onOpenToggle:S.useCallback(()=>f(l=>!l),[f]),modal:i,children:n})};Zi.displayName=lr;var Qi="DialogTrigger",tg=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(Qi,n),o=yt(t,s.triggerRef);return a.jsx(We.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:Ze(e.onClick,s.onOpenToggle)})});tg.displayName=Qi;var xs="DialogPortal",[ng,ec]=Xi(xs,{forceMount:void 0}),tc=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=Oe(xs,t);return a.jsx(ng,{scope:t,forceMount:n,children:S.Children.map(r,i=>a.jsx(ir,{present:n||o.open,children:a.jsx(Bi,{asChild:!0,container:s,children:i})}))})};tc.displayName=xs;var Qn="DialogOverlay",nc=S.forwardRef((e,t)=>{const n=ec(Qn,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Oe(Qn,e.__scopeDialog);return o.modal?a.jsx(ir,{present:r||o.open,children:a.jsx(sg,{...s,ref:t})}):null});nc.displayName=Qn;var rg=Mi("DialogOverlay.RemoveScroll"),sg=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(Qn,n),o=Xm(),i=yt(t,o);return a.jsx(Yi,{as:rg,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(We.div,{"data-state":bs(s.open),...r,ref:i,style:{pointerEvents:"auto",...r.style}})})}),Mt="DialogContent",rc=S.forwardRef((e,t)=>{const n=ec(Mt,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Oe(Mt,e.__scopeDialog);return a.jsx(ir,{present:r||o.open,children:o.modal?a.jsx(og,{...s,ref:t}):a.jsx(ag,{...s,ref:t})})});rc.displayName=Mt;var og=S.forwardRef((e,t)=>{const n=Oe(Mt,e.__scopeDialog),r=S.useRef(null),s=yt(t,n.contentRef,r);return S.useEffect(()=>{const o=r.current;if(o)return Qp(o)},[]),a.jsx(sc,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Ze(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ze(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&o.preventDefault()}),onFocusOutside:Ze(e.onFocusOutside,o=>o.preventDefault())})}),ag=S.forwardRef((e,t)=>{const n=Oe(Mt,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=Oe(Mt,n);return hp(),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=Oe(oc,n);return a.jsx(We.h2,{id:s.titleId,...r,ref:t})});ac.displayName=oc;var ic="DialogDescription",cc=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(ic,n);return a.jsx(We.p,{id:s.descriptionId,...r,ref:t})});cc.displayName=ic;var lc="DialogClose",Qr=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(lc,n);return a.jsx(We.button,{type:"button",...r,ref:t,onClick:Ze(e.onClick,()=>s.onOpenChange(!1))})});Qr.displayName=lc;function bs(e){return e?"open":"closed"}const ig=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 cg({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(ze,{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(ht,{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:ig(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 lg(){const{managementAccountId:e,loading:t}=$t(),[n,r]=P.useState(null),[s,o]=P.useState(null),[i,c]=P.useState(null),[u,d]=P.useState([]),[f,l]=P.useState(!0),[h,m]=P.useState(!1),[g,p]=P.useState(null),[x,b]=P.useState(null),y=P.useRef(!0),v=P.useCallback(async(C=!1)=>{C||l(!0);try{const R=await oe.getDataStatus({managementAccountId:e});if(!y.current)return;if(o(R),!R.ready){r(null),c(null),d([]),b(null);return}const[_,L,A]=await Promise.all([oe.getAnalysisStatus({managementAccountId:e}),oe.getAnalysisSchedule({managementAccountId:e}),oe.getAnalysisReports({managementAccountId:e})]);if(!y.current)return;r(_),c(L),d(A),b(null)}catch(R){y.current&&b(R?.response?.data?.error||R?.message||"Unable to load scheduled AI reports")}finally{y.current&&!C&&l(!1)}},[e]);return P.useEffect(()=>(y.current=!0,t||v(),()=>{y.current=!1}),[v,t]),P.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:f||t,saving:h,removingId:g,error:x,load:v,saveSchedule:async C=>{m(!0),b(null);try{const R=await oe.updateAnalysisSchedule(C,{managementAccountId:e});y.current&&c(R)}catch(R){throw b(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=await oe.downloadAnalysisPdf(C.id),_=URL.createObjectURL(R),L=document.createElement("a");L.href=_,L.download=`meyi-cost-analysis-${C.period.Start}.pdf`,L.click(),URL.revokeObjectURL(_)}catch(R){b(R?.response?.data?.error||R?.message||"Unable to download the PDF report")}},remove:async C=>{if(window.confirm(`Remove the AI cost report for ${C.period.Start} through ${C.period.End}?`)){p(C.id),b(null);try{await oe.removeAnalysisReport(C.id),y.current&&d(R=>R.filter(_=>_.id!==C.id))}catch(R){y.current&&b(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",ug=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString(),dg=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 fg(){const e=lg(),t=Kh(),[n,r]=P.useState(!1),[s,o]=P.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(ar,{}),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(Lt,{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(ze,{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(Zn,{status:e.dataStatus}):e.status&&!e.status.enabled?a.jsx(ue,{children:a.jsxs(de,{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",children:"Total cost"}),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:[ug(c.period.Start)," - ",dg(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(ze,{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(ct,{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.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.pdfReady?"Download PDF":"PDF 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(ct,{className:"h-4 w-4 animate-spin"}):a.jsx(mi,{className:"h-4 w-4"})})]})})]},c.id))})]})})}):a.jsx(ue,{children:a.jsxs(de,{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(Cm,{open:n,schedule:e.schedule,saving:e.saving,onClose:()=>r(!1),onSave:e.saveSchedule}),a.jsx(cg,{report:s,onClose:()=>o(null)})]})}const Bt=ql({component:Aa}),hg=an({getParentRoute:()=>Bt,path:"/",component:nm}),mg=an({getParentRoute:()=>Bt,path:"/reports",component:pm}),pg=an({getParentRoute:()=>Bt,path:"/cur-discovery",component:bm}),gg=an({getParentRoute:()=>Bt,path:"/analysis",component:fg}),xg=an({getParentRoute:()=>Bt,path:"/sources",component:wm});function ys(){return Bt.addChildren([hg,gg,mg,xg,pg])}function bg(e="/cost"){return Oa({routeTree:ys(),basepath:e})}function yg({apiBase:e,token:t,basePath:n="/cost",userRole:r="user",tenantId:s="default"}){si(e,t);const o=P.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 vg=[{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=yg;exports.api=ne;exports.attachAuthInterceptors=af;exports.configureApi=si;exports.costNavItems=vg;exports.createCostRouter=bg;exports.createRouteTree=ys;
|
|
61
|
+
`)},qp=0,Nt=[];function Gp(e){var t=S.useRef([]),n=S.useRef([0,0]),r=S.useRef(),s=S.useState(qp++)[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=mp([e.lockRef.current],(e.shards||[]).map(Ko),!0).filter(Boolean);return p.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var c=S.useCallback(function(p,x){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var b=kn(p),y=n.current,v="deltaX"in p?p.deltaX:y[0]-b[0],N="deltaY"in p?p.deltaY:y[1]-b[1],j,k=p.target,C=Math.abs(v)>Math.abs(N)?"h":"v";if("touches"in p&&C==="h"&&k.type==="range")return!1;var R=window.getSelection(),_=R&&R.anchorNode,L=_?_===k||_.contains(k):!1;if(L)return!1;var A=qo(C,k);if(!A)return!0;if(A?j=C:(j=C==="v"?"h":"v",A=qo(C,k)),!A)return!1;if(!r.current&&"changedTouches"in p&&(v||N)&&(r.current=j),!j)return!0;var D=r.current||j;return Wp(D,x,p,D==="h"?v:N)},[]),u=S.useCallback(function(p){var x=p;if(!(!Nt.length||Nt[Nt.length-1]!==o)){var b="deltaY"in x?Go(x):kn(x),y=t.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&Vp(j.delta,b)})[0];if(y&&y.should){x.cancelable&&x.preventDefault();return}if(!y){var v=(i.current.shards||[]).map(Ko).filter(Boolean).filter(function(j){return j.contains(x.target)}),N=v.length>0?c(x,v[0]):!i.current.noIsolation;N&&x.cancelable&&x.preventDefault()}}},[]),d=S.useCallback(function(p,x,b,y){var v={name:p,delta:x,target:b,should:y,shadowParent:Kp(b)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(N){return N!==v})},1)},[]),f=S.useCallback(function(p){n.current=kn(p),r.current=void 0},[]),l=S.useCallback(function(p){d(p.type,Go(p),p.target,c(p,e.lockRef.current))},[]),h=S.useCallback(function(p){d(p.type,kn(p),p.target,c(p,e.lockRef.current))},[]);S.useEffect(function(){return Nt.push(o),e.setCallbacks({onScrollCapture:l,onWheelCapture:l,onTouchMoveCapture:h}),document.addEventListener("wheel",u,Rt),document.addEventListener("touchmove",u,Rt),document.addEventListener("touchstart",f,Rt),function(){Nt=Nt.filter(function(p){return p!==o}),document.removeEventListener("wheel",u,Rt),document.removeEventListener("touchmove",u,Rt),document.removeEventListener("touchstart",f,Rt)}},[]);var m=e.removeScrollBar,g=e.inert;return S.createElement(S.Fragment,null,g?S.createElement(o,{styles:Hp(s)}):null,m?S.createElement(Mp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Kp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Yp=Rp(Vi,Gp);var Yi=S.forwardRef(function(e,t){return S.createElement(cr,De({},e,{ref:t,sideCar:Yp}))});Yi.classNames=cr.classNames;var Jp=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ct=new WeakMap,_n=new WeakMap,Pn={},Mr=0,Ji=function(e){return e&&(e.host||Ji(e.parentNode))},Xp=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})},Zp=function(e,t,n,r){var s=Xp(t,Array.isArray(e)?e:[e]);Pn[n]||(Pn[n]=new WeakMap);var o=Pn[n],i=[],c=new Set,u=new Set(s),d=function(l){!l||c.has(l)||(c.add(l),d(l.parentNode))};s.forEach(d);var f=function(l){!l||u.has(l)||Array.prototype.forEach.call(l.children,function(h){if(c.has(h))f(h);else try{var m=h.getAttribute(r),g=m!==null&&m!=="false",p=(Ct.get(h)||0)+1,x=(o.get(h)||0)+1;Ct.set(h,p),o.set(h,x),i.push(h),p===1&&g&&_n.set(h,!0),x===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return f(t),c.clear(),Mr++,function(){i.forEach(function(l){var h=Ct.get(l)-1,m=o.get(l)-1;Ct.set(l,h),o.set(l,m),h||(_n.has(l)||l.removeAttribute(r),_n.delete(l)),m||l.removeAttribute(n)}),Mr--,Mr||(Ct=new WeakMap,Ct=new WeakMap,_n=new WeakMap,Pn={})}},Qp=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Jp(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Zp(r,s,n,"aria-hidden")):function(){return null}},lr="Dialog",[Xi]=Em(lr),[eg,Oe]=Xi(lr),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),[d,f]=Om({prop:r,defaultProp:s??!1,onChange:o,caller:lr});return a.jsx(eg,{scope:t,triggerRef:c,contentRef:u,contentId:Pr(),titleId:Pr(),descriptionId:Pr(),open:d,onOpenChange:f,onOpenToggle:S.useCallback(()=>f(l=>!l),[f]),modal:i,children:n})};Zi.displayName=lr;var Qi="DialogTrigger",tg=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(Qi,n),o=yt(t,s.triggerRef);return a.jsx(We.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:Ze(e.onClick,s.onOpenToggle)})});tg.displayName=Qi;var xs="DialogPortal",[ng,ec]=Xi(xs,{forceMount:void 0}),tc=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=Oe(xs,t);return a.jsx(ng,{scope:t,forceMount:n,children:S.Children.map(r,i=>a.jsx(ir,{present:n||o.open,children:a.jsx(Bi,{asChild:!0,container:s,children:i})}))})};tc.displayName=xs;var Qn="DialogOverlay",nc=S.forwardRef((e,t)=>{const n=ec(Qn,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Oe(Qn,e.__scopeDialog);return o.modal?a.jsx(ir,{present:r||o.open,children:a.jsx(sg,{...s,ref:t})}):null});nc.displayName=Qn;var rg=Mi("DialogOverlay.RemoveScroll"),sg=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(Qn,n),o=Xm(),i=yt(t,o);return a.jsx(Yi,{as:rg,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(We.div,{"data-state":bs(s.open),...r,ref:i,style:{pointerEvents:"auto",...r.style}})})}),Mt="DialogContent",rc=S.forwardRef((e,t)=>{const n=ec(Mt,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Oe(Mt,e.__scopeDialog);return a.jsx(ir,{present:r||o.open,children:o.modal?a.jsx(og,{...s,ref:t}):a.jsx(ag,{...s,ref:t})})});rc.displayName=Mt;var og=S.forwardRef((e,t)=>{const n=Oe(Mt,e.__scopeDialog),r=S.useRef(null),s=yt(t,n.contentRef,r);return S.useEffect(()=>{const o=r.current;if(o)return Qp(o)},[]),a.jsx(sc,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Ze(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ze(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&o.preventDefault()}),onFocusOutside:Ze(e.onFocusOutside,o=>o.preventDefault())})}),ag=S.forwardRef((e,t)=>{const n=Oe(Mt,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=Oe(Mt,n);return hp(),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=Oe(oc,n);return a.jsx(We.h2,{id:s.titleId,...r,ref:t})});ac.displayName=oc;var ic="DialogDescription",cc=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(ic,n);return a.jsx(We.p,{id:s.descriptionId,...r,ref:t})});cc.displayName=ic;var lc="DialogClose",Qr=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(lc,n);return a.jsx(We.button,{type:"button",...r,ref:t,onClick:Ze(e.onClick,()=>s.onOpenChange(!1))})});Qr.displayName=lc;function bs(e){return e?"open":"closed"}const ig=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 cg({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(ze,{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(ht,{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:ig(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 lg(){const{managementAccountId:e,loading:t}=$t(),[n,r]=P.useState(null),[s,o]=P.useState(null),[i,c]=P.useState(null),[u,d]=P.useState([]),[f,l]=P.useState(!0),[h,m]=P.useState(!1),[g,p]=P.useState(null),[x,b]=P.useState(null),y=P.useRef(!0),v=P.useCallback(async(C=!1)=>{C||l(!0);try{const R=await oe.getDataStatus({managementAccountId:e});if(!y.current)return;if(o(R),!R.ready){r(null),c(null),d([]),b(null);return}const[_,L,A]=await Promise.all([oe.getAnalysisStatus({managementAccountId:e}),oe.getAnalysisSchedule({managementAccountId:e}),oe.getAnalysisReports({managementAccountId:e})]);if(!y.current)return;r(_),c(L),d(A),b(null)}catch(R){y.current&&b(R?.response?.data?.error||R?.message||"Unable to load scheduled AI reports")}finally{y.current&&!C&&l(!1)}},[e]);return P.useEffect(()=>(y.current=!0,t||v(),()=>{y.current=!1}),[v,t]),P.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:f||t,saving:h,removingId:g,error:x,load:v,saveSchedule:async C=>{m(!0),b(null);try{const R=await oe.updateAnalysisSchedule(C,{managementAccountId:e});y.current&&c(R)}catch(R){throw b(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",_=await(C.htmlReady?oe.downloadAnalysisHtml(C.id):oe.downloadAnalysisPdf(C.id)),L=URL.createObjectURL(_),A=document.createElement("a");A.href=L,A.download=`meyi-cost-analysis-${C.period.Start}.${R}`,A.click(),URL.revokeObjectURL(L)}catch(R){b(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),b(null);try{await oe.removeAnalysisReport(C.id),y.current&&d(R=>R.filter(_=>_.id!==C.id))}catch(R){y.current&&b(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",ug=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString(),dg=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 fg(){const e=lg(),t=Kh(),[n,r]=P.useState(!1),[s,o]=P.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(ar,{}),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(Lt,{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(ze,{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(Zn,{status:e.dataStatus}):e.status&&!e.status.enabled?a.jsx(ue,{children:a.jsxs(de,{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",children:"Total cost"}),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:[ug(c.period.Start)," - ",dg(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(ze,{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(ct,{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(ct,{className:"h-4 w-4 animate-spin"}):a.jsx(mi,{className:"h-4 w-4"})})]})})]},c.id))})]})})}):a.jsx(ue,{children:a.jsxs(de,{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(Cm,{open:n,schedule:e.schedule,saving:e.saving,onClose:()=>r(!1),onSave:e.saveSchedule}),a.jsx(cg,{report:s,onClose:()=>o(null)})]})}const Bt=ql({component:Aa}),hg=an({getParentRoute:()=>Bt,path:"/",component:nm}),mg=an({getParentRoute:()=>Bt,path:"/reports",component:pm}),pg=an({getParentRoute:()=>Bt,path:"/cur-discovery",component:bm}),gg=an({getParentRoute:()=>Bt,path:"/analysis",component:fg}),xg=an({getParentRoute:()=>Bt,path:"/sources",component:wm});function ys(){return Bt.addChildren([hg,gg,mg,xg,pg])}function bg(e="/cost"){return Oa({routeTree:ys(),basepath:e})}function yg({apiBase:e,token:t,basePath:n="/cost",userRole:r="user",tenantId:s="default"}){si(e,t);const o=P.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 vg=[{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=yg;exports.api=ne;exports.attachAuthInterceptors=af;exports.configureApi=si;exports.costNavItems=vg;exports.createCostRouter=bg;exports.createRouteTree=ys;
|