tokentracker-cli 0.4.1 → 0.5.0

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.
@@ -0,0 +1,20 @@
1
+ import{r as h,u as Cn,i as yy,a as rt,b as Je,c as Ot,d as ao,m as Js,g as by,e as xy,f as vy,h as wy,j as ky,k as Sy,l as Ty,n as Nd,o as Cy,p as My,q as Ey,s as Ms,t as zi,v as Ir,w as Po,x as Ea,y as ys,z as vt,A as V,T as Dy,B as y,C as Me,D as zn,E as jd,F as Id,G as he,N as Fd,H as ur,I as dr,J as kn,K as _e,L as Qs,M as _n,O as Py,P as hn,Q as ic,R as ft,S as Ld,U as wt,V as Lt,W as wn,X as fs,Y as Oe,Z as mn,_ as ac,$ as Da,a0 as Pa,a1 as bs,a2 as Vn,a3 as Ry,a4 as _d,a5 as Ay,a6 as fr,a7 as Ro,a8 as Vd,a9 as Oy,aa as Wd,ab as Ny,ac as Bd,ad as $d,ae as q,af as Ra,ag as Yd,ah as jy,ai as Iy,aj as Fy,ak as Ly,al as _y,am as Vy,an as Wy,ao as By,ap as an,aq as $y,ar as Yy,as as Jo}from"./main-BbLvM6ng.js";const Hy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Uy=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase()),lc=e=>{const t=Uy(e);return t.charAt(0).toUpperCase()+t.slice(1)},Hd=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim(),zy=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Gy={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 Ky=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:o,iconNode:i,...a},l)=>h.createElement("svg",{ref:l,...Gy,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:Hd("lucide",r),...!o&&!zy(a)&&{"aria-hidden":"true"},...a},[...i.map(([c,u])=>h.createElement(c,u)),...Array.isArray(o)?o:[o]]));const qy=(e,t)=>{const n=h.forwardRef(({className:s,...r},o)=>h.createElement(Ky,{ref:o,iconNode:t,className:Hd(`lucide-${Hy(lc(e))}`,`lucide-${e}`,s),...r}));return n.displayName=lc(e),n};const Xy=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Zy=qy("info",Xy),Jy=500,Qy={style:{transition:"none"}},Ud="data-base-ui-click-trigger",eb={fallbackAxisSide:"end"},tb={clipPath:"inset(50%)",position:"fixed",top:0,left:0},nb=[];function Aa(e){h.useEffect(e,nb)}const Ls=0;class Sn{static create(){return new Sn}currentId=Ls;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ls,n()},t)}isStarted(){return this.currentId!==Ls}clear=()=>{this.currentId!==Ls&&(clearTimeout(this.currentId),this.currentId=Ls)};disposeEffect=()=>this.clear}function Yn(){const e=Cn(Sn.create).current;return Aa(e.disposeEffect),e}function Gn(e){return e?.ownerDocument||document}const Es=typeof navigator<"u",Qo=ib(),zd=lb(),Gd=ab(),sb=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),Kd=Qo.platform==="MacIntel"&&Qo.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Qo.platform),rb=Es&&/apple/i.test(navigator.vendor),Gi=Es&&/android/i.test(zd)||/android/i.test(Gd);Es&&zd.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const ob=Gd.includes("jsdom/");function ib(){if(!Es)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function ab(){if(!Es)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function lb(){if(!Es)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const Ki="data-base-ui-focusable",qd="active",Xd="selected",Zd="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function is(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Se(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&yy(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function ht(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Dt(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function cb(e){return e.matches("html,body")}function qe(e){return e?.ownerDocument||document}function Jd(e){return rt(e)&&e.matches(Zd)}function cc(e){return e?e.getAttribute("role")==="combobox"&&Jd(e):!1}function qi(e){return e?e.hasAttribute(Ki)?e:e.querySelector(`[${Ki}]`)||e:null}function Wn(e,t,n=!0){return e.filter(r=>r.parentId===t&&(!n||r.context?.open)).flatMap(r=>[r,...Wn(e,r.id,n)])}function uc(e,t){let n=[],s=e.find(r=>r.id===t)?.parentId;for(;s;){const r=e.find(o=>o.id===s);s=r?.parentId,r&&(n=n.concat(r))}return n}function ub(e){e.preventDefault(),e.stopPropagation()}function db(e){return"nativeEvent"in e}function fb(e){return e.mozInputSource===0&&e.isTrusted?!0:Gi&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function hb(e){return ob?!1:!Gi&&e.width===0&&e.height===0||Gi&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function xs(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Qd(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const mb=["top","right","bottom","left"],vs=Math.min,mt=Math.max,lo=Math.round,Fr=Math.floor,Gt=e=>({x:e,y:e}),pb={left:"right",right:"left",bottom:"top",top:"bottom"};function Xi(e,t,n){return mt(e,vs(t,n))}function dn(e,t){return typeof e=="function"?e(t):e}function at(e){return e.split("-")[0]}function Mn(e){return e.split("-")[1]}function Oa(e){return e==="x"?"y":"x"}function Na(e){return e==="y"?"height":"width"}function bt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ja(e){return Oa(bt(e))}function gb(e,t,n){n===void 0&&(n=!1);const s=Mn(e),r=ja(e),o=Na(r);let i=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=co(i)),[i,co(i)]}function yb(e){const t=co(e);return[Zi(e),t,Zi(t)]}function Zi(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const dc=["left","right"],fc=["right","left"],bb=["top","bottom"],xb=["bottom","top"];function vb(e,t,n){switch(e){case"top":case"bottom":return n?t?fc:dc:t?dc:fc;case"left":case"right":return t?bb:xb;default:return[]}}function wb(e,t,n,s){const r=Mn(e);let o=vb(at(e),n==="start",s);return r&&(o=o.map(i=>i+"-"+r),t&&(o=o.concat(o.map(Zi)))),o}function co(e){const t=at(e);return pb[t]+e.slice(t.length)}function kb(e){return{top:0,right:0,bottom:0,left:0,...e}}function ef(e){return typeof e!="number"?kb(e):{top:e,right:e,bottom:e,left:e}}function uo(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}var Sb=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],fo=Sb.join(","),tf=typeof Element>"u",ws=tf?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ho=!tf&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},mo=function(t,n){var s;n===void 0&&(n=!0);var r=t==null||(s=t.getAttribute)===null||s===void 0?void 0:s.call(t,"inert"),o=r===""||r==="true",i=o||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):mo(t.parentNode));return i},Tb=function(t){var n,s=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return s===""||s==="true"},nf=function(t,n,s){if(mo(t))return[];var r=Array.prototype.slice.apply(t.querySelectorAll(fo));return n&&ws.call(t,fo)&&r.unshift(t),r=r.filter(s),r},po=function(t,n,s){for(var r=[],o=Array.from(t);o.length;){var i=o.shift();if(!mo(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=po(l,!0,s);s.flatten?r.push.apply(r,c):r.push({scopeParent:i,candidates:c})}else{var u=ws.call(i,fo);u&&s.filter(i)&&(n||!t.includes(i))&&r.push(i);var d=i.shadowRoot||typeof s.getShadowRoot=="function"&&s.getShadowRoot(i),f=!mo(d,!1)&&(!s.shadowRootFilter||s.shadowRootFilter(i));if(d&&f){var m=po(d===!0?i.children:d.children,!0,s);s.flatten?r.push.apply(r,m):r.push({scopeParent:i,candidates:m})}else o.unshift.apply(o,i.children)}}return r},sf=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},rf=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Tb(t))&&!sf(t)?0:t.tabIndex},Cb=function(t,n){var s=rf(t);return s<0&&n&&!sf(t)?0:s},Mb=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},of=function(t){return t.tagName==="INPUT"},Eb=function(t){return of(t)&&t.type==="hidden"},Db=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(s){return s.tagName==="SUMMARY"});return n},Pb=function(t,n){for(var s=0;s<t.length;s++)if(t[s].checked&&t[s].form===n)return t[s]},Rb=function(t){if(!t.name)return!0;var n=t.form||ho(t),s=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=s(window.CSS.escape(t.name));else try{r=s(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var o=Pb(r,t.form);return!o||o===t},Ab=function(t){return of(t)&&t.type==="radio"},Ob=function(t){return Ab(t)&&!Rb(t)},Nb=function(t){var n,s=t&&ho(t),r=(n=s)===null||n===void 0?void 0:n.host,o=!1;if(s&&s!==t){var i,a,l;for(o=!!((i=r)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(r)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!o&&r;){var c,u,d;s=ho(r),r=(c=s)===null||c===void 0?void 0:c.host,o=!!((u=r)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(r))}}return o},hc=function(t){var n=t.getBoundingClientRect(),s=n.width,r=n.height;return s===0&&r===0},jb=function(t,n){var s=n.displayCheck,r=n.getShadowRoot;if(s==="full-native"&&"checkVisibility"in t){var o=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!o}if(getComputedStyle(t).visibility==="hidden")return!0;var i=ws.call(t,"details>summary:first-of-type"),a=i?t.parentElement:t;if(ws.call(a,"details:not([open]) *"))return!0;if(!s||s==="full"||s==="full-native"||s==="legacy-full"){if(typeof r=="function"){for(var l=t;t;){var c=t.parentElement,u=ho(t);if(c&&!c.shadowRoot&&r(c)===!0)return hc(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=l}if(Nb(t))return!t.getClientRects().length;if(s!=="legacy-full")return!0}else if(s==="non-zero-area")return hc(t);return!1},Ib=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var s=0;s<n.children.length;s++){var r=n.children.item(s);if(r.tagName==="LEGEND")return ws.call(n,"fieldset[disabled] *")?!0:!r.contains(t)}return!0}n=n.parentElement}return!1},Ji=function(t,n){return!(n.disabled||Eb(n)||jb(n,t)||Db(n)||Ib(n))},Qi=function(t,n){return!(Ob(n)||rf(n)<0||!Ji(t,n))},Fb=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},af=function(t){var n=[],s=[];return t.forEach(function(r,o){var i=!!r.scopeParent,a=i?r.scopeParent:r,l=Cb(a,i),c=i?af(r.candidates):a;l===0?i?n.push.apply(n,c):n.push(a):s.push({documentOrder:o,tabIndex:l,item:r,isScope:i,content:c})}),s.sort(Mb).reduce(function(r,o){return o.isScope?r.push.apply(r,o.content):r.push(o.content),r},[]).concat(n)},hr=function(t,n){n=n||{};var s;return n.getShadowRoot?s=po([t],n.includeContainer,{filter:Qi.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Fb}):s=nf(t,n.includeContainer,Qi.bind(null,n)),af(s)},Lb=function(t,n){n=n||{};var s;return n.getShadowRoot?s=po([t],n.includeContainer,{filter:Ji.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):s=nf(t,n.includeContainer,Ji.bind(null,n)),s},lf=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return ws.call(t,fo)===!1?!1:Qi(n,t)};const Ds=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function cf(e,t){const n=hr(e,Ds()),s=n.length;if(s===0)return;const r=is(qe(e)),o=n.indexOf(r),i=o===-1?t===1?0:s-1:o+t;return n[i]}function Ia(e){return cf(qe(e).body,1)||e}function uf(e){return cf(qe(e).body,-1)||e}function df(e,t){if(!e)return null;const n=hr(qe(e).body,Ds()),s=n.length;if(s===0)return null;const r=n.indexOf(e);if(r===-1)return null;const o=(r+t+s)%s;return n[o]}function _b(e){return df(e,1)}function Vb(e){return df(e,-1)}function hs(e,t){const n=t||e.currentTarget,s=e.relatedTarget;return!s||!Se(n,s)}function Wb(e){hr(e,Ds()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function mc(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const s=n.dataset.tabindex;delete n.dataset.tabindex,s?n.setAttribute("tabindex",s):n.removeAttribute("tabindex")})}const Bb="Backend runtime unavailable (InsForge). Please retry later.",St={usageSummary:"vibeusage-usage-summary",usageDaily:"vibeusage-usage-daily",usageHourly:"vibeusage-usage-hourly",usageMonthly:"vibeusage-usage-monthly",usageHeatmap:"vibeusage-usage-heatmap",usageModelBreakdown:"vibeusage-usage-model-breakdown",projectUsageSummary:"vibeusage-project-usage-summary",userStatus:"vibeusage-user-status",linkCodeInit:"vibeusage-link-code-init",publicViewProfile:"vibeusage-public-view-profile",publicVisibility:"vibeusage-public-visibility"},ff="/functions",$b="/api/functions",Nt={business:"business",probe:"probe"};let _s=null;async function lt(e){return await Ot(e)}async function ei({baseUrl:e,accessToken:t,from:n,to:s,source:r,model:o,timeZone:i,tzOffsetMinutes:a,rolling:l=!1}={}){const c=await lt(t);if(Je())return xy({from:n,to:s,seed:c,rolling:l});const u=Kn({timeZone:i,tzOffsetMinutes:a}),d=qn({source:r,model:o}),f=l?{rolling:"1"}:{};return Xt({baseUrl:e,accessToken:c,slug:St.usageSummary,params:{from:n,to:s,...d,...u,...f}})}async function Yb({baseUrl:e,accessToken:t,from:n,to:s,source:r,limit:o,timeZone:i,tzOffsetMinutes:a}={}){const l=await lt(t);if(Je())return wy({seed:l,limit:o});const c=Kn({timeZone:i,tzOffsetMinutes:a}),d={...qn({source:r}),...c};return n&&(d.from=n),s&&(d.to=s),o!=null&&(d.limit=String(o)),Xt({baseUrl:e,accessToken:l,slug:St.projectUsageSummary,params:d})}async function pc({baseUrl:e,accessToken:t}={}){const n=await lt(t);return Je()?{enabled:!1,updated_at:null,share_token:null}:Xt({baseUrl:e,accessToken:n,slug:St.publicVisibility})}async function Hb({baseUrl:e,accessToken:t,enabled:n}={}){const s=await lt(t);return Je()?{enabled:!!n,updated_at:new Date().toISOString(),share_token:n?"pv1-mock-token":null}:hf({baseUrl:e,accessToken:s,slug:St.publicVisibility,body:{enabled:!!n}})}async function Ub({baseUrl:e,accessToken:t}={}){const n=await lt(t);if(Je()){const s=new Date().toISOString();return{user_id:"mock-user",created_at:s,pro:{active:!0,sources:["mock"],expires_at:null,partial:!1,as_of:s},subscriptions:{partial:!1,as_of:s,items:[{tool:"codex",provider:"openai",product:"chatgpt",plan_type:"pro",updated_at:s},{tool:"claude",provider:"anthropic",product:"subscription",plan_type:"max",rate_limit_tier:"default_claude_max_5x",updated_at:s}]},install:{partial:!1,as_of:s,has_active_device_token:!1,has_active_device:!1,active_device_tokens:0,active_devices:0,latest_token_activity_at:null,latest_device_seen_at:null}}}return Xt({baseUrl:e,accessToken:n,slug:St.userStatus})}async function zb({signal:e}={}){const t=await fetch("/functions/vibeusage-local-sync",{method:"POST",headers:{Accept:"application/json"},cache:"no-store",signal:e}),n=await t.json().catch(()=>({ok:!1,error:`Local sync request failed with HTTP ${t.status}`}));if(!t.ok||n?.ok===!1){const s=n?.error||n?.message||`Local sync request failed with HTTP ${t.status}`,r=new Error(s);throw r.status=t.status,r.statusCode=t.status,r.payload=n,r}return n}async function Gb({baseUrl:e,accessToken:t,from:n,to:s,source:r,timeZone:o,tzOffsetMinutes:i}={}){const a=await lt(t);if(Je())return vy({from:n,to:s,seed:a});const l=Kn({timeZone:o,tzOffsetMinutes:i}),c=qn({source:r});return Xt({baseUrl:e,accessToken:a,slug:St.usageModelBreakdown,params:{from:n,to:s,...c,...l}})}async function Fa({baseUrl:e,accessToken:t,from:n,to:s,source:r,model:o,timeZone:i,tzOffsetMinutes:a}={}){const l=await lt(t);if(Je())return by({from:n,to:s,seed:l});const c=Kn({timeZone:i,tzOffsetMinutes:a}),u=qn({source:r,model:o});return Xt({baseUrl:e,accessToken:l,slug:St.usageDaily,params:{from:n,to:s,...u,...c}})}async function Kb({baseUrl:e,accessToken:t,day:n,source:s,model:r,timeZone:o,tzOffsetMinutes:i}={}){const a=await lt(t);if(Je())return ky({day:n,seed:a});const l=Kn({timeZone:o,tzOffsetMinutes:i}),c=qn({source:s,model:r});return Xt({baseUrl:e,accessToken:a,slug:St.usageHourly,params:n?{day:n,...c,...l}:{...c,...l}})}async function qb({baseUrl:e,accessToken:t,months:n,to:s,source:r,model:o,timeZone:i,tzOffsetMinutes:a}={}){const l=await lt(t);if(Je())return Sy({months:n,to:s,seed:l});const c=Kn({timeZone:i,tzOffsetMinutes:a}),u=qn({source:r,model:o});return Xt({baseUrl:e,accessToken:l,slug:St.usageMonthly,params:{...n?{months:String(n)}:{},...s?{to:s}:{},...u,...c}})}async function Xb({baseUrl:e,accessToken:t,weeks:n,to:s,weekStartsOn:r,source:o,model:i,timeZone:a,tzOffsetMinutes:l}={}){const c=await lt(t);if(Je())return Ty({weeks:n,to:s,weekStartsOn:r,seed:c});const u=Kn({timeZone:a,tzOffsetMinutes:l}),d=qn({source:o,model:i});return Xt({baseUrl:e,accessToken:c,slug:St.usageHeatmap,params:{weeks:String(n),to:s,week_starts_on:r,...d,...u}})}async function Zb({baseUrl:e,accessToken:t}={}){const n=await lt(t);return Je()?{link_code:"mock_link_code",expires_at:new Date(Date.now()+10*6e4).toISOString()}:hf({baseUrl:e,accessToken:n,slug:St.linkCodeInit,body:{}})}async function Jb({baseUrl:e,accessToken:t}={}){const n=await lt(t);return Xt({baseUrl:e,accessToken:n,slug:St.publicViewProfile})}function Kn({timeZone:e,tzOffsetMinutes:t}={}){const n={},s=typeof e=="string"?e.trim():"";return s&&(n.tz=s),Number.isFinite(t)&&(n.tz_offset_minutes=String(Math.trunc(t))),n}function qn({source:e,model:t}={}){const n={},s=typeof e=="string"?e.trim().toLowerCase():"";s&&(n.source=s);const r=typeof t=="string"?t.trim():"";return r&&(n.model=r),n}async function Xt({baseUrl:e,accessToken:t,slug:n,params:s,fetchOptions:r,errorPrefix:o,retry:i,requestKind:a=Nt.business,skipSessionExpiry:l=!1,allowRefresh:c=!0}={}){let u=await lt(t),d=ks(u),f=ao({baseUrl:e,accessToken:u??void 0}).getHttpClient();const m=xf(i,"GET"),p=l?Nt.probe:a;let g=0;const{primaryPath:b,fallbackPath:w}=mf(n);for(;;)try{const x=await gc({http:f,primaryPath:b,fallbackPath:w,params:s,fetchOptions:r});return go({hadAccessToken:d,accessToken:u}),x}catch(x){const v=x;if(v?.name==="AbortError")throw x;let k=null;const S=v?.statusCode??v?.status;if(c&&yf({status:S,requestKind:p,hadAccessToken:d,accessToken:u})){const M=(await bf())?.accessToken??null;if(ks(M)){const T=ao({baseUrl:e,accessToken:M}).getHttpClient();u=M,d=!0,f=T;try{const R=await gc({http:T,primaryPath:b,fallbackPath:w,params:s,fetchOptions:r});return go({hadAccessToken:!0,accessToken:M}),R}catch(R){const O=R?.statusCode??R?.status;La({status:O,hadAccessToken:!0,accessToken:M,skipSessionExpiry:p===Nt.probe})&&Js(),k=ms(R,{errorPrefix:o,hadAccessToken:!0,accessToken:M,skipSessionExpiry:!0})}}else mr({hadAccessToken:d,accessToken:u,skipSessionExpiry:p===Nt.probe})&&Js();k??=ms(v,{errorPrefix:o,hadAccessToken:d,accessToken:u,skipSessionExpiry:!0})}if(k??=ms(v,{errorPrefix:o,hadAccessToken:d,accessToken:u,skipSessionExpiry:p===Nt.probe}),!vf({err:k,attempt:g,retryOptions:m}))throw k;const C=wf({retryOptions:m,attempt:g});await kf(C),g+=1}}async function hf({baseUrl:e,accessToken:t,slug:n,body:s,fetchOptions:r,errorPrefix:o,retry:i,requestKind:a=Nt.business,skipSessionExpiry:l=!1,allowRefresh:c=!0}={}){let u=await lt(t),d=ks(u),f=ao({baseUrl:e,accessToken:u??void 0}).getHttpClient();const m=xf(i,"POST"),p=l?Nt.probe:a;let g=0;const{primaryPath:b,fallbackPath:w}=mf(n);for(;;)try{const x=await yc({http:f,primaryPath:b,fallbackPath:w,body:s,fetchOptions:r});return go({hadAccessToken:d,accessToken:u}),x}catch(x){const v=x;if(v?.name==="AbortError")throw x;let k=null;const S=v?.statusCode??v?.status;if(c&&yf({status:S,requestKind:p,hadAccessToken:d,accessToken:u})){const M=(await bf())?.accessToken??null;if(ks(M)){const T=ao({baseUrl:e,accessToken:M}).getHttpClient();u=M,d=!0,f=T;try{const R=await yc({http:T,primaryPath:b,fallbackPath:w,body:s,fetchOptions:r});return go({hadAccessToken:!0,accessToken:M}),R}catch(R){const O=R?.statusCode??R?.status;La({status:O,hadAccessToken:!0,accessToken:M,skipSessionExpiry:p===Nt.probe})&&Js(),k=ms(R,{errorPrefix:o,hadAccessToken:!0,accessToken:M,skipSessionExpiry:!0})}}else mr({hadAccessToken:d,accessToken:u,skipSessionExpiry:p===Nt.probe})&&Js();k??=ms(v,{errorPrefix:o,hadAccessToken:d,accessToken:u,skipSessionExpiry:!0})}if(k??=ms(v,{errorPrefix:o,hadAccessToken:d,accessToken:u,skipSessionExpiry:p===Nt.probe}),!vf({err:k,attempt:g,retryOptions:m}))throw k;const C=wf({retryOptions:m,attempt:g});await kf(C),g+=1}}function mf(e){const t=Qb(e),n=`${ea(ff)}/${t}`,s=`${ea($b)}/${t}`;return{primaryPath:n,fallbackPath:s}}function Qb(e){return(typeof e=="string"?e.trim():"").replace(/^\/+/,"")}function ea(e){const t=typeof e=="string"?e.trim():"";return t.endsWith("/")?t.slice(0,-1):t}async function gc({http:e,primaryPath:t,fallbackPath:n,params:s,fetchOptions:r}={}){try{return await e.get(t,{params:s,...r||{}})}catch(o){if(!pf(o,t))throw o;return await e.get(n,{params:s,...r||{}})}}async function yc({http:e,primaryPath:t,fallbackPath:n,body:s,fetchOptions:r}={}){try{return await bc({http:e,path:t,body:s,fetchOptions:r})}catch(o){if(!pf(o,t))throw o;return await bc({http:e,path:n,body:s,fetchOptions:r})}}async function bc({http:e,path:t,body:n,fetchOptions:s}={}){return await e.post(t,n,{...s||{}})}function pf(e,t){return!t||!t.startsWith(`${ea(ff)}/`)?!1:(e?.statusCode??e?.status)===404}function ms(e,{errorPrefix:t,hadAccessToken:n,accessToken:s,skipSessionExpiry:r}={}){const o=typeof e?.message=="string"?e.message.trim():"",i=typeof e?.error=="string"?e.error.trim():"",a=o||i||String(e||"Unknown error"),l=t0(a),c=new Error(t?`${t}: ${l}`:l);c.cause=e;const u=e?.statusCode??e?.status;return La({status:u,hadAccessToken:n,accessToken:s,skipSessionExpiry:r})&&Js(),typeof u=="number"&&(c.status=u,c.statusCode=u),c.retryable=n0(u)||s0(a),l!==a&&(c.originalMessage=a),e?.nextActions&&(c.nextActions=e.nextActions),e?.error&&(c.error=e.error),c}function mr({hadAccessToken:e,accessToken:t,skipSessionExpiry:n}={}){return n||!e||!ks(t)?!1:r0(t)}function La({status:e,hadAccessToken:t,accessToken:n,skipSessionExpiry:s}={}){return e!==401?!1:mr({hadAccessToken:t,accessToken:n,skipSessionExpiry:s})}function e0({hadAccessToken:e,accessToken:t}={}){return mr({hadAccessToken:e,accessToken:t})}function go({hadAccessToken:e,accessToken:t}={}){e0({hadAccessToken:e,accessToken:t})&&Cy()}function t0(e){return gf(e)?Bb:String(e||"Unknown error")}function gf(e){const t=String(e||"").toLowerCase();return t?!!(t.includes("deno:")||t.includes("deno")||t.includes("econnreset")||t.includes("econnrefused")||t.includes("etimedout")||t.includes("timeout")&&t.includes("request")||t.includes("upstream")&&(t.includes("deno")||t.includes("connect"))):!1}function yf({status:e,requestKind:t,hadAccessToken:n,accessToken:s}={}){return e!==401||t!==Nt.business?!1:mr({hadAccessToken:n,accessToken:s})}async function bf(){return _s||(_s=My.auth.getCurrentSession().then(({data:e})=>e?.session??null).catch(()=>null).finally(()=>{_s=null}),_s)}function n0(e){return e===502||e===503||e===504}function s0(e){const t=String(e||"").toLowerCase();return t?!!(gf(t)||t.includes("econnreset")||t.includes("econnrefused")||t.includes("etimedout")||t.includes("timeout")||t.includes("networkerror")||t.includes("failed to fetch")||t.includes("socket hang up")||t.includes("connection reset")):!1}function xf(e,t){const s=(t||"GET").toUpperCase()==="GET"?{maxRetries:2,baseDelayMs:300,maxDelayMs:1500,jitterRatio:.2}:{maxRetries:0,baseDelayMs:0,maxDelayMs:0,jitterRatio:0};if(e==null)return s;if(e===!1)return{maxRetries:0,baseDelayMs:0,maxDelayMs:0,jitterRatio:0};const r=ti(e.maxRetries??s.maxRetries,0,10),o=ti(e.baseDelayMs??s.baseDelayMs,50,6e4),i=ti(e.maxDelayMs??s.maxDelayMs,o,12e4),a=typeof e.jitterRatio=="number"?Math.max(0,Math.min(.5,e.jitterRatio)):s.jitterRatio;return{maxRetries:r,baseDelayMs:o,maxDelayMs:i,jitterRatio:a}}function ks(e){return!!Nd(e)}function r0(e){if(!ks(e))return!1;const t=e.split(".");return t.length!==3?!1:t.every(n=>/^[A-Za-z0-9_-]+$/.test(n))}function vf({err:e,attempt:t,retryOptions:n}={}){return!n||n.maxRetries<=0||t>=n.maxRetries?!1:!!(e&&e.retryable)}function wf({retryOptions:e,attempt:t}={}){if(!e||e.maxRetries<=0)return 0;const n=e.baseDelayMs*Math.pow(2,t),s=Math.min(e.maxDelayMs,n),r=s*e.jitterRatio*Math.random();return Math.round(s+r)}function ti(e,t,n){const s=Number(e);return Number.isFinite(s)?Math.min(n,Math.max(t,Math.floor(s))):t}function kf(e){return!e||e<=0?Promise.resolve():new Promise(t=>setTimeout(t,e))}function o0({baseUrl:e,accessToken:t,guestAllowed:n=!1,weeks:s=52,weekStartsOn:r="sun",cacheKey:o,timeZone:i,tzOffsetMinutes:a,now:l}={}){const c=h.useMemo(()=>Ey({weeks:s,weekStartsOn:r,now:l}),[l,s,r]),[u,d]=h.useState([]),[f,m]=h.useState(null),[p,g]=h.useState("edge"),[b,w]=h.useState(!1),[x,v]=h.useState(null),k=Je(),S=Ms(t),C=!n,E=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),M=h.useMemo(()=>{if(!o)return null;const F=Po({timeZone:i,offsetMinutes:a});return`vibeusage.heatmap.${o}.${s}.${r}.${F}`},[o,i,a,s,r]),A=h.useCallback(()=>{if(!M||typeof window>"u")return null;try{const F=window.localStorage.getItem(M);if(!F)return null;const N=JSON.parse(F);return!N||!N.heatmap?null:N}catch{return null}},[M]),T=h.useCallback(F=>{if(!(!M||typeof window>"u"))try{window.localStorage.setItem(M,JSON.stringify(F))}catch{}},[M]),R=h.useCallback(()=>{if(!(!M||typeof window>"u"))try{window.localStorage.removeItem(M)}catch{}},[M]),O=h.useCallback(async()=>{const F=await Ot(t);if(!(!F&&!k&&!E)){w(!0),v(null);try{try{const P=await Xb({baseUrl:e,accessToken:F,weeks:s,to:c.to,weekStartsOn:r,timeZone:i,tzOffsetMinutes:a}),I=Array.isArray(P?.weeks)?P.weeks:[];if(!I.length&&C){const W=A();if(W?.heatmap){m(W.heatmap),d(W.daily||[]),g("cache");return}}if(!I.some(W=>(Array.isArray(W)?W:[]).some(J=>J&&Number.isFinite(Number(J.level))))&&I.length){const W=[];for(const Y of I)for(const $ of Array.isArray(Y)?Y:[])$?.day&&W.push({day:$.day,total_tokens:$.total_tokens??$.value??0,billable_total_tokens:$.billable_total_tokens??$.value??$.total_tokens??0});const J=zi({dailyRows:W,weeks:s,to:P?.to||c.to,weekStartsOn:r});d(W),m({...J,week_starts_on:r,active_days:W.filter(Y=>Number(Y?.billable_total_tokens??Y?.total_tokens)>0).length,streak_days:Ir({dailyRows:W,to:P?.to||c.to})}),g("client"),C?T({heatmap:{...J,week_starts_on:r,active_days:W.filter(Y=>Number(Y?.billable_total_tokens??Y?.total_tokens)>0).length,streak_days:Ir({dailyRows:W,to:P?.to||c.to})},daily:W,fetchedAt:new Date().toISOString()}):R();return}m(P||null),d([]),g("edge"),P&&C?T({heatmap:P,daily:[],fetchedAt:new Date().toISOString()}):C||R();return}catch(P){const I=P,B=I?.status??I?.statusCode;if(B===401||B===403)throw P}const N=await Fa({baseUrl:e,accessToken:F,from:c.from,to:c.to,timeZone:i,tzOffsetMinutes:a}),_=Array.isArray(N?.data)?N.data:[];d(_);const z=zi({dailyRows:_,weeks:s,to:c.to,weekStartsOn:r});m({...z,week_starts_on:r,active_days:_.filter(P=>Number(P?.billable_total_tokens??P?.total_tokens)>0).length,streak_days:Ir({dailyRows:_,to:c.to})}),g("client"),C?T({heatmap:{...z,week_starts_on:r,active_days:_.filter(P=>Number(P?.billable_total_tokens??P?.total_tokens)>0).length,streak_days:Ir({dailyRows:_,to:c.to})},daily:_,fetchedAt:new Date().toISOString()}):R()}catch(N){if(C){const _=A();if(_?.heatmap)m(_.heatmap),d(_.daily||[]),g("cache"),v(null);else{const z=N;v(z?.message||String(z)),d([]),m(null),g("edge")}}else{const _=N;v(_?.message||String(_)),d([]),m(null),g("edge")}}finally{w(!1)}}},[t,e,k,n,C,c.from,c.to,A,S,i,a,r,s,R,T,E]);return h.useEffect(()=>{if(!S&&!n&&!k&&!E){d([]),w(!1),v(null),m(null),g("edge");return}if(!C)R(),d([]),v(null),m(null),g("edge");else{const F=A();F?.heatmap&&(m(F.heatmap),d(F.daily||[]),g("cache"))}O()},[t,k,A,O,S,n,C,R,E]),{range:c,daily:u,heatmap:f,source:k?"mock":p==="client"?"edge":p,loading:b,error:x,refresh:O}}function i0({baseUrl:e,accessToken:t,limit:n=3,from:s,to:r,source:o,timeZone:i,tzOffsetMinutes:a}={}){const[l,c]=h.useState([]),[u,d]=h.useState(!1),[f,m]=h.useState(null),p=Je(),g=Ms(t),b=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),w=h.useCallback(async()=>{const x=await Ot(t);if(!x&&!p&&!b){c([]),m(null),d(!1);return}d(!0),m(null);try{const v=await Yb({baseUrl:e,accessToken:x,limit:n,from:s,to:r,source:o,timeZone:i,tzOffsetMinutes:a});c(Array.isArray(v?.entries)?v.entries:[])}catch(v){const k=v?.message||String(v);m(k),c([])}finally{d(!1)}},[t,e,s,n,p,o,i,r,a,b]);return h.useEffect(()=>{if(!g&&!p&&!b){c([]),m(null),d(!1);return}w()},[p,w,g,b]),{entries:l,loading:u,error:f,refresh:w}}const a0=24;function l0({baseUrl:e,accessToken:t,guestAllowed:n=!1,period:s,from:r,to:o,months:i=a0,cacheKey:a,timeZone:l,tzOffsetMinutes:c,now:u,sharedRows:d,sharedRange:f}={}){const[m,p]=h.useState([]),[g,b]=h.useState(()=>({from:r,to:o})),[w,x]=h.useState("edge"),[v,k]=h.useState(null),[S,C]=h.useState(!1),[E,M]=h.useState(null),A=Je(),T=Ms(t),R=!n,O=Array.isArray(d),D=f?.from||r,F=f?.to||o,N=h.useMemo(()=>s==="day"?"hourly":s==="total"?"monthly":"daily",[s]),_=(()=>{if(!a)return null;const Y=c0(e)||"default",$=Po({timeZone:l,offsetMinutes:c});if(N==="hourly")return`vibeusage.trend.${a}.${Y}.hourly.${o||r||"day"}.${$}`;if(N==="monthly")return`vibeusage.trend.${a}.${Y}.monthly.${i}.${o||"today"}.${$}`;const K=`${r||""}.${o||""}`;return`vibeusage.trend.${a}.${Y}.daily.${K}.${$}`})(),z=h.useCallback(()=>{if(!_||typeof window>"u")return null;try{const Y=window.localStorage.getItem(_);if(!Y)return null;const $=JSON.parse(Y);return!$||!Array.isArray($.rows)?null:$}catch{return null}},[_]),P=h.useCallback(Y=>{if(!(!_||typeof window>"u"))try{window.localStorage.setItem(_,JSON.stringify(Y))}catch{}},[_]),I=h.useCallback(()=>{if(!(!_||typeof window>"u"))try{window.localStorage.removeItem(_)}catch{}},[_]),B=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),W=h.useCallback(async()=>{if(O){p(Array.isArray(d)?d:[]),b({from:D,to:F}),x("shared"),k(null),C(!1),M(null);return}const Y=await Ot(t);if(!(!Y&&!A&&!B)){C(!0),M(null);try{let $;N==="hourly"?$=await Kb({baseUrl:e,accessToken:Y,day:o||r,timeZone:l,tzOffsetMinutes:c}):N==="monthly"?$=await qb({baseUrl:e,accessToken:Y,months:i,to:o,timeZone:l,tzOffsetMinutes:c}):$=await Fa({baseUrl:e,accessToken:Y,from:r,to:o,timeZone:l,tzOffsetMinutes:c});const K=$?.from||r||$?.day||null,Z=$?.to||o||$?.day||null;let le=Array.isArray($?.data)?$.data:[];N==="daily"?le=si(le,K||r,Z||o,{timeZone:l,offsetMinutes:c,now:u}):N==="hourly"?le=ri(le,{timeZone:l,offsetMinutes:c,now:u}):N==="monthly"&&(le=oi(le,{timeZone:l,offsetMinutes:c,now:u}));const Ce=new Date().toISOString();p(le),b({from:K,to:Z}),x("edge"),k(Ce),R?P({rows:le,from:K,to:Z,mode:N,fetchedAt:Ce}):I()}catch($){if(R){const K=z();if(K?.rows){let Z=N==="daily"?si(K.rows||[],K.from||r,K.to||o,{timeZone:l,offsetMinutes:c,now:u}):Array.isArray(K.rows)?K.rows:[];N==="hourly"?Z=ri(Z,{timeZone:l,offsetMinutes:c,now:u}):N==="monthly"&&(Z=oi(Z,{timeZone:l,offsetMinutes:c,now:u})),p(Z),b({from:K.from||r,to:K.to||o}),x("cache"),k(K.fetchedAt||null),M(null)}else{p([]),b({from:r,to:o}),x("edge"),k(null);const Z=$;M(Z?.message||String(Z))}}else{p([]),b({from:r,to:o}),x("edge"),k(null);const K=$;M(K?.message||String(K))}}finally{C(!1)}}},[t,e,r,A,n,R,N,i,z,T,O,D,d,F,l,o,c,u,I,P,B]);h.useEffect(()=>{if(O){p(Array.isArray(d)?d:[]),b({from:D,to:F}),x("shared"),k(null),C(!1),M(null);return}if(!T&&!n&&!A&&!B){p([]),b({from:r,to:o}),M(null),C(!1),x("edge"),k(null);return}if(!R)I(),p([]),b({from:r,to:o}),M(null),x("edge"),k(null);else{const Y=z();if(Y?.rows){let $=N==="daily"?si(Y.rows||[],Y.from||r,Y.to||o,{timeZone:l,offsetMinutes:c,now:u}):Array.isArray(Y.rows)?Y.rows:[];N==="hourly"?$=ri($,{timeZone:l,offsetMinutes:c,now:u}):N==="monthly"&&($=oi($,{timeZone:l,offsetMinutes:c,now:u})),p($),b({from:Y.from||r,to:Y.to||o}),x("cache"),k(Y.fetchedAt||null)}}W()},[t,A,z,W,O,D,d,F,T,n,R,I,B]);const J=A?"mock":w;return{rows:m,from:g.from||r,to:g.to||o,source:J,fetchedAt:v,loading:S,error:E,refresh:W}}function c0(e){try{return new URL(e).host}catch{return null}}function ni(e){if(!e)return null;const t=String(e).trim(),n=t.split("-");if(n.length!==3)return null;const s=Number(n[0]),r=Number(n[1])-1,o=Number(n[2]);if(!Number.isFinite(s)||!Number.isFinite(r)||!Number.isFinite(o))return null;const i=new Date(Date.UTC(s,r,o));return Number.isFinite(i.getTime())&&ys(i)===t?i:null}function u0(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function si(e,t,n,{timeZone:s,offsetMinutes:r,now:o}={}){const i=ni(t),a=ni(n);if(!i||!a||a<i)return Array.isArray(e)?e:[];const l=o instanceof Date&&Number.isFinite(o.getTime())?o:new Date,c=Ea({timeZone:s,offsetMinutes:r,date:l}),u=ni(c),d=u?u.getTime():l.getTime(),f=new Map;for(const p of e||[])p?.day&&f.set(p.day,p);const m=[];for(let p=i;p<=a;p=u0(p,1)){const g=ys(p),b=f.get(g),w=p.getTime()>d;if(b){m.push({...b,missing:!1,future:w});continue}m.push({day:g,total_tokens:null,billable_total_tokens:null,input_tokens:null,cached_input_tokens:null,output_tokens:null,reasoning_output_tokens:null,missing:!w,future:w})}return m}function ri(e,{timeZone:t,offsetMinutes:n,now:s}={}){if(!Array.isArray(e))return[];const r=Sf({timeZone:t,offsetMinutes:n,now:s});return r?e.map(o=>{const i=o?.hour||o?.label||"",a=d0(i);if(!a)return{...o,future:!1};const l=a.dayNum>r.dayNum||a.dayNum===r.dayNum&&a.slot>r.slot;return{...o,future:l}}):e}function oi(e,{timeZone:t,offsetMinutes:n,now:s}={}){if(!Array.isArray(e))return[];const r=Sf({timeZone:t,offsetMinutes:n,now:s});return r?e.map(o=>{const i=o?.month||o?.label||"",a=f0(i);if(!a)return{...o,future:!1};const l=a.year>r.year||a.year===r.year&&a.month>r.month;return{...o,future:l}}):e}function Sf({timeZone:e,offsetMinutes:t,now:n}={}){const s=n instanceof Date&&Number.isFinite(n.getTime())?n:new Date;if(e&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const f=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(s).reduce((x,v)=>(v.type&&v.value&&(x[v.type]=v.value),x),{}),m=Number(f.year),p=Number(f.month),g=Number(f.day),b=Number(f.hour),w=Number(f.minute);if(Number.isFinite(m)&&Number.isFinite(p)&&Number.isFinite(g)&&Number.isFinite(b)&&Number.isFinite(w)){const x=b*2+(w>=30?1:0);return{year:m,month:p,day:g,hour:b,minute:w,dayNum:m*1e4+p*100+g,slot:x}}}catch{}if(Number.isFinite(t)){const u=new Date(s.getTime()+t*60*1e3),d=u.getUTCFullYear(),f=u.getUTCMonth()+1,m=u.getUTCDate(),p=u.getUTCHours(),g=u.getUTCMinutes(),b=p*2+(g>=30?1:0);return{year:d,month:f,day:m,hour:p,minute:g,dayNum:d*1e4+f*100+m,slot:b}}const r=s.getFullYear(),o=s.getMonth()+1,i=s.getDate(),a=s.getHours(),l=s.getMinutes(),c=a*2+(l>=30?1:0);return{year:r,month:o,day:i,hour:a,minute:l,dayNum:r*1e4+o*100+i,slot:c}}function d0(e){if(!e)return null;const t=String(e).trim(),[n,s]=t.split("T");if(!n||!s)return null;const r=n.split("-");if(r.length!==3)return null;const o=Number(r[0]),i=Number(r[1]),a=Number(r[2]);if(!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(a))return null;const l=s.split(":"),c=Number(l[0]),u=Number(l[1]);if(!Number.isFinite(c)||c<0||c>23||!Number.isFinite(u)||u<0||u>59)return null;const d=c*2+(u>=30?1:0);return{dayNum:o*1e4+i*100+a,slot:d}}function f0(e){if(!e)return null;const n=String(e).trim().split("-");if(n.length!==2)return null;const s=Number(n[0]),r=Number(n[1]);return!Number.isFinite(s)||!Number.isFinite(r)||r<1||r>12?null:{year:s,month:r}}function xc({baseUrl:e,accessToken:t,guestAllowed:n=!1,from:s,to:r,includeDaily:o=!0,cacheKey:i,timeZone:a,tzOffsetMinutes:l,now:c}={}){const[u,d]=h.useState([]),[f,m]=h.useState(null),[p,g]=h.useState(null),[b,w]=h.useState("edge"),[x,v]=h.useState(null),[k,S]=h.useState(!1),[C,E]=h.useState(null),M=Je(),A=Ms(t),T=!n,R=(()=>{if(!i)return null;const P=h0(e)||"default",I=o?"daily":"summary",B=Po({timeZone:a,offsetMinutes:l});return`vibeusage.usage.${i}.${P}.${s}.${r}.${I}.${B}`})(),O=h.useCallback(()=>{if(!R||typeof window>"u")return null;try{const P=window.localStorage.getItem(R);if(!P)return null;const I=JSON.parse(P);return!I||!I.summary?null:I}catch{return null}},[R]),D=h.useCallback(P=>{if(!(!R||typeof window>"u"))try{window.localStorage.setItem(R,JSON.stringify(P))}catch{}},[R]),F=h.useCallback(()=>{if(!(!R||typeof window>"u"))try{window.localStorage.removeItem(R)}catch{}},[R]),N=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),_=h.useCallback(async()=>{const P=await Ot(t);if(!(!P&&!M&&!N)){S(!0),E(null);try{let I=null,B=null;if(o){const[K,Z]=await Promise.allSettled([Fa({baseUrl:e,accessToken:P,from:s,to:r,timeZone:a,tzOffsetMinutes:l}),ei({baseUrl:e,accessToken:P,from:s,to:r,timeZone:a,tzOffsetMinutes:l,rolling:!0})]);if(K.status==="rejected")throw K.reason;I=K.value,B=Z.status==="fulfilled"?Z.value:null}else B=await ei({baseUrl:e,accessToken:P,from:s,to:r,timeZone:a,tzOffsetMinutes:l,rolling:!0});let W=o&&Array.isArray(I?.data)?I.data:[];o&&(W=ai(W,s,r,{timeZone:a,offsetMinutes:l,now:c}));let J=B?.totals||I?.summary?.totals||null,Y=B?.rolling||I?.summary?.rolling||null;if(o&&!J&&!B)try{const K=await ei({baseUrl:e,accessToken:P,from:s,to:r,timeZone:a,tzOffsetMinutes:l,rolling:!0});J=K?.totals||null,Y=K?.rolling||Y}catch{}const $=new Date().toISOString();d(W),m(J),g(Y),w("edge"),v($),J&&T?D({summary:J,rolling:Y,daily:W,from:s,to:r,includeDaily:o,fetchedAt:$}):T||F()}catch(I){if(T){const B=O();if(B?.summary){m(B.summary),g(B.rolling||null);const W=Array.isArray(B.daily)?B.daily:[],J=o?ai(W,B.from||s,B.to||r,{timeZone:a,offsetMinutes:l,now:c}):W;d(J),w("cache"),v(B.fetchedAt||null),E(null)}else{const W=I;E(W?.message||String(W)),d([]),m(null),g(null),w("edge"),v(null)}}else{const B=I;E(B?.message||String(B)),d([]),m(null),g(null),w("edge"),v(null)}}finally{S(!1)}}},[t,e,s,o,M,n,T,c,O,A,a,r,l,F,D,N]);return h.useEffect(()=>{const P=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");if(!A&&!n&&!M&&!P){d([]),m(null),g(null),E(null),S(!1),w("edge"),v(null);return}if(!T)F(),d([]),m(null),g(null),E(null),w("edge"),v(null);else{const I=O();if(I?.summary){m(I.summary),g(I.rolling||null);const B=Array.isArray(I.daily)?I.daily:[],W=o?ai(B,I.from||s,I.to||r,{timeZone:a,offsetMinutes:l,now:c}):B;d(W),w("cache"),v(I.fetchedAt||null)}}_()},[t,M,O,_,A,n,T,F,N]),{daily:u,summary:f,rolling:p,source:M?"mock":b,fetchedAt:x,loading:k,error:C,refresh:_}}function h0(e){try{return new URL(e).host}catch{return null}}function ii(e){if(!e)return null;const t=String(e).trim(),n=t.split("-");if(n.length!==3)return null;const s=Number(n[0]),r=Number(n[1])-1,o=Number(n[2]);if(!Number.isFinite(s)||!Number.isFinite(r)||!Number.isFinite(o))return null;const i=new Date(Date.UTC(s,r,o));return Number.isFinite(i.getTime())&&ys(i)===t?i:null}function m0(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function ai(e,t,n,{timeZone:s,offsetMinutes:r,now:o}={}){const i=ii(t),a=ii(n);if(!i||!a||a<i)return Array.isArray(e)?e:[];const l=o instanceof Date&&Number.isFinite(o.getTime())?o:new Date,c=Ea({timeZone:s,offsetMinutes:r,date:l}),u=ii(c),d=u?u.getTime():l.getTime(),f=new Map;for(const p of e||[])p?.day&&f.set(p.day,p);const m=[];for(let p=i;p<=a;p=m0(p,1)){const g=ys(p),b=f.get(g),w=p.getTime()>d;if(b){m.push({...b,missing:!1,future:w});continue}m.push({day:g,total_tokens:null,billable_total_tokens:null,input_tokens:null,cached_input_tokens:null,output_tokens:null,reasoning_output_tokens:null,missing:!w,future:w})}return m}function p0({baseUrl:e,accessToken:t,guestAllowed:n=!1,from:s,to:r,cacheKey:o,timeZone:i,tzOffsetMinutes:a}={}){const[l,c]=h.useState(null),[u,d]=h.useState("edge"),[f,m]=h.useState(!1),[p,g]=h.useState(null),b=Je(),w=Ms(t),x=!n,v=h.useMemo(()=>{if(!o)return null;const T=g0(e)||"default",R=Po({timeZone:i,offsetMinutes:a});return`vibeusage.modelBreakdown.${o}.${T}.${s}.${r}.${R}`},[e,o,s,i,r,a]),k=h.useCallback(()=>{if(!v||typeof window>"u")return null;try{const T=window.localStorage.getItem(v);if(!T)return null;const R=JSON.parse(T);return!R||!R.breakdown?null:R}catch{return null}},[v]),S=h.useCallback(T=>{if(!(!v||typeof window>"u"))try{window.localStorage.setItem(v,JSON.stringify(T))}catch{}},[v]),C=h.useCallback(()=>{if(!(!v||typeof window>"u"))try{window.localStorage.removeItem(v)}catch{}},[v]),E=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),M=h.useCallback(async()=>{const T=await Ot(t);if(!(!T&&!b&&!E)){m(!0),g(null);try{const R=await Gb({baseUrl:e,accessToken:T,from:s,to:r,timeZone:i,tzOffsetMinutes:a});c(R||null),d("edge"),R&&x?S({breakdown:R,fetchedAt:new Date().toISOString()}):x||C()}catch(R){if(x){const O=k();if(O?.breakdown)c(O.breakdown),d("cache"),g(null);else{c(null),d("edge");const D=R;g(D?.message||String(D))}}else{c(null),d("edge");const O=R;g(O?.message||String(O))}}finally{m(!1)}}},[t,e,s,b,n,x,k,i,r,w,a,C,S,E]);return h.useEffect(()=>{if(!w&&!n&&!b&&!E){c(null),d("edge"),g(null),m(!1);return}if(!x)C(),c(null),d("edge"),g(null);else{const T=k();T?.breakdown&&(c(T.breakdown),d("cache"))}M()},[t,b,k,M,w,n,x,C,E]),{breakdown:l,source:b?"mock":u,loading:f,error:p,refresh:M}}function g0(e){try{return new URL(e).host}catch{return null}}const Tf=new Set(["day","hour","month"]);function y0(e){return Tf.has(e)}function vc(e){if(e==null)return null;const t=String(e).trim();if(!/^[0-9]+$/.test(t))return null;const n=t.replace(/^0+/,"");return n.length===0?"0":n}function b0(e,t){const n=vc(e),s=vc(t);if(n&&s)return n.length!==s.length?n.length<s.length?-1:1:n===s?0:n<s?-1:1;const r=vt(e),o=vt(t);return r==null&&o==null?0:r==null?1:o==null?-1:r===o?0:r<o?-1:1}function x0(e,t){const n=typeof e=="string"?e:String(e||""),s=typeof t=="string"?t:String(t||"");return n===s?0:n<s?-1:1}function v0(e){if(!e)return null;const n=String(e).trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!n)return null;const s=Number(n[1]),r=Number(n[2]),o=Number(n[3]);if(!Number.isFinite(s)||!Number.isFinite(r)||!Number.isFinite(o))return null;const i=new Date(Date.UTC(s,r-1,o));return!Number.isFinite(i.getTime())||i.getUTCFullYear()!==s||i.getUTCMonth()+1!==r||i.getUTCDate()!==o?null:i.getTime()}function w0(e){if(!e)return null;const n=String(e).trim().match(/^(\d{4})-(\d{2})$/);if(!n)return null;const s=Number(n[1]),r=Number(n[2]);if(!Number.isFinite(s)||!Number.isFinite(r)||r<1||r>12)return null;const o=new Date(Date.UTC(s,r-1,1));return Number.isFinite(o.getTime())?o.getTime():null}function k0(e){if(!e)return null;const n=String(e).trim().match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?Z?$/);if(!n)return null;const s=Number(n[1]),r=Number(n[2]),o=Number(n[3]),i=Number(n[4]),a=Number(n[5]),l=Number(n[6]||0);if(!Number.isFinite(s)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(l)||r<1||r>12||o<1||o>31||i<0||i>23||a<0||a>59||l<0||l>59)return null;const c=new Date(Date.UTC(s,r-1,o,i,a,l));return Number.isFinite(c.getTime())?c.getTime():null}function S0(e,t,n){const s=n==="hour"?k0:n==="month"?w0:v0,r=s(e),o=s(t);return r!=null&&o!=null?r===o?0:r<o?-1:1:x0(e,t)}function Cf(e,{key:t,dir:n}){const s=n==="asc"?1:-1,r=Array.isArray(e)?e:[],o=Tf.has(t)?(a,l)=>S0(a,l,t):b0,i=a=>t==="total_tokens"&&a?.billable_total_tokens!=null?a.billable_total_tokens:a?.[t];return r.map((a,l)=>({row:a,index:l})).sort((a,l)=>{const c=i(a.row),u=i(l.row),d=c==null,f=u==null;if(d&&f)return a.index-l.index;if(d)return 1;if(f)return-1;const m=o(c,u);return m!==0?m*s:a.index-l.index}).map(a=>a.row)}const T0=[{key:"day",label:V("daily.sort.date.label"),title:V("daily.sort.date.title")},{key:"total_tokens",label:V("daily.sort.total.label"),title:V("daily.sort.total.title")},{key:"input_tokens",label:V("daily.sort.input.label"),title:V("daily.sort.input.title")},{key:"output_tokens",label:V("daily.sort.output.label"),title:V("daily.sort.output.title")},{key:"cached_input_tokens",label:V("daily.sort.cached.label"),title:V("daily.sort.cached.title")},{key:"reasoning_output_tokens",label:V("daily.sort.reasoning.label"),title:V("daily.sort.reasoning.title")},{key:"conversation_count",label:V("daily.sort.conversations.label"),title:V("daily.sort.conversations.title")}];function wc(e){const t=y0(e)?e:"day";return T0.map((n,s)=>s===0?{...n,key:t}:n)}function kc(e,{key:t,dir:n}){return Cf(e,{key:t,dir:n})}const yo=12,C0=["total_tokens","billable_total_tokens","input_tokens","cached_input_tokens","cache_creation_input_tokens","output_tokens","reasoning_output_tokens"];function M0(e){if(typeof e=="bigint")return e!==0n;if(typeof e=="number")return Number.isFinite(e)&&e!==0;if(e==null)return!1;const t=String(e).trim();if(!t||!/^-?\d+$/.test(t))return!1;const n=t.startsWith("-")?t.slice(1):t;return/[1-9]/.test(n)}function E0(e){return C0.some(t=>M0(e?.[t]))}function D0(e){const t=Array.isArray(e)?e:[];if(!t.length)return[];const n=Cf(t,{key:"month",dir:"asc"}),s=n.findIndex(r=>r?.month&&E0(r));return s===-1?t:n.slice(s)}function P0(e,t,n=yo){const s=Array.isArray(e)?e:[],r=Number.isFinite(n)&&n>0?n:yo,i=(Number.isFinite(t)&&t>=0?Math.floor(t):0)*r;return s.slice(i,i+r)}function R0({publicMode:e,screenshotMode:t,forceInstall:n,accessEnabled:s,heatmapLoading:r,activeDays:o,hasActiveDeviceToken:i}={}){return e||t?!1:n?!0:s&&!r&&o===0&&!i}function Mf(e){if(typeof e!="string")return null;const t=e.trim();return t?t.toLowerCase():null}function A0(e){const t=Mf(e?.model_id);return t||null}function Ef(e,t){return e?.model?String(e.model):t}function O0(e,{copyFn:t}={}){const n=typeof t=="function"?t:i=>i,r=(Array.isArray(e?.sources)?e.sources:[]).map(i=>{const a=vt(i?.totals?.billable_total_tokens??i?.totals?.total_tokens)??0,l=vt(i?.totals?.total_cost_usd)??0;return{source:i?.source,totalTokens:Number.isFinite(a)?a:0,totalCost:Number.isFinite(l)?l:0,models:Array.isArray(i?.models)?i.models:[]}}).filter(i=>i.totalTokens>0);if(!r.length)return[];const o=r.reduce((i,a)=>i+a.totalTokens,0);return typeof e?.pricing?.pricing_mode=="string"&&e.pricing.pricing_mode.toUpperCase(),r.slice().sort((i,a)=>a.totalTokens-i.totalTokens).map(i=>{const a=i.source?String(i.source).toUpperCase():n("shared.placeholder.short"),l=o>0?i.totalTokens/o*100:0,c=Number.isFinite(l)?l.toFixed(1):"0.0",u=i.models.map(d=>{const f=vt(d?.totals?.billable_total_tokens??d?.totals?.total_tokens)??0;if(!Number.isFinite(f)||f<=0)return null;const m=i.totalTokens>0?Math.round(f/i.totalTokens*1e3)/10:0,p=Ef(d,n("shared.placeholder.short")),g=A0(d),b=i.totalCost>0&&i.totalTokens>0?f/i.totalTokens*i.totalCost:null;return{id:g,name:p,share:m,usage:f,cost:b}}).filter(Boolean);return{label:a,totalPercent:String(c),usd:i.totalCost,usage:i.totalTokens,models:u}})}function N0(e,{limit:t=3,copyFn:n}={}){const s=typeof n=="function"?n:f=>f,r=Array.isArray(e?.sources)?e.sources:[];if(!r.length)return[];const o=new Map,i=new Map,a=new Map;let l=0;for(const f of r){const m=Array.isArray(f?.models)?f.models:[];for(const p of m){const g=vt(p?.totals?.billable_total_tokens)??0;if(!Number.isFinite(g)||g<=0)continue;l+=g;const b=Ef(p,s("shared.placeholder.short")),w=Mf(b);if(!w)continue;o.set(w,(o.get(w)||0)+g);const x=a.get(w)||0;g>=x&&(a.set(w,g),i.set(w,b))}}if(!o.size)return[];const c=Array.from(o.values()).reduce((f,m)=>f+m,0),u=l>0?l:c,d=Number.isFinite(t)?Math.max(0,Math.floor(t)):3;return Array.from(o.entries()).map(([f,m])=>{const p=u>0?(m/u*100).toFixed(1):"0.0";return{id:f,name:i.get(f)||s("shared.placeholder.short"),tokens:m,percent:String(p)}}).sort((f,m)=>m.tokens!==f.tokens?m.tokens-f.tokens:String(f.name).localeCompare(String(m.name))).slice(0,d)}function _a(){const e=h.useContext(Dy);if(e===null)throw new Error("useTheme must be used within a ThemeProvider");return e}const An=12,Vs=3,li=26,j0=["#ecfdf5","#a7f3d0","#6ee7b7","#34d399","#10b981"],I0=["#064e3b","#065f46","#059669","#10b981","#34d399"],F0=[V("heatmap.month.jan"),V("heatmap.month.feb"),V("heatmap.month.mar"),V("heatmap.month.apr"),V("heatmap.month.may"),V("heatmap.month.jun"),V("heatmap.month.jul"),V("heatmap.month.aug"),V("heatmap.month.sep"),V("heatmap.month.oct"),V("heatmap.month.nov"),V("heatmap.month.dec")];function L0(e){if(typeof e=="bigint")return e.toLocaleString();if(typeof e=="number")return Number.isFinite(e)?Math.round(e).toLocaleString():"0";if(typeof e=="string"){const t=Number(e);return Number.isFinite(t)?Math.round(t).toLocaleString():e}return"0"}function _0(e){if(typeof e!="string")return null;const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(!t)return null;const n=new Date(Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3])));return Number.isFinite(n.getTime())?n:null}function Df(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function V0(e,t){return Math.floor((Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())-Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))/864e5)}function W0(e,t){const n=t==="mon"?1:0,s=e.getUTCDay();return Df(e,-((s-n+7)%7))}function B0(e,t,n){if(!e)return[];const s=_0(t)||new Date,r=[];for(let c=11;c>=0;c-=1)r.push(new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth()-c,1)));const o=W0(s,n),i=Df(o,-(e-1)*7),a=[],l=new Set;for(const c of r){const u=Math.floor(V0(i,c)/7);u<0||u>=e||l.has(u)||(l.add(u),a.push({label:F0[c.getUTCMonth()],index:u}))}return a}function $0({heatmap:e,timeZoneLabel:t,timeZoneShortLabel:n,hideLegend:s=!1}){const{resolvedTheme:r}=_a(),i=r==="dark"?I0:j0,a=h.useRef(null);h.useEffect(()=>{const p=a.current;p&&(p.scrollLeft=p.scrollWidth)},[e?.weeks]);const l=e?.week_starts_on==="mon"?"mon":"sun",c=h.useMemo(()=>{const p=Array.isArray(e?.weeks)?e.weeks:[];if(!p.length)return{weeks:[]};const g=[];for(const b of p)for(const w of Array.isArray(b)?b:[])w?.day&&g.push({day:w.day,total_tokens:w.total_tokens??w.value??0,billable_total_tokens:w.billable_total_tokens??w.value??w.total_tokens??0});return zi({dailyRows:g,weeks:Math.max(52,p.length),to:e?.to,weekStartsOn:l})},[e?.to,e?.weeks,l]),u=c?.weeks||[],d=l==="mon"?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(p=>V(`heatmap.day.${p.toLowerCase()}`)):["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(p=>V(`heatmap.day.${p.toLowerCase()}`)),f=h.useMemo(()=>B0(u.length,c?.to,l),[c?.to,u.length,l]);if(!u.length)return y.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:V("heatmap.empty")});const m=li+u.length*An+Math.max(0,u.length-1)*Vs;return y.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5",children:[y.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[y.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:V("heatmap.title")}),y.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400",children:n||V("heatmap.legend.utc")})]}),y.jsx("div",{ref:a,className:"overflow-x-auto overflow-y-hidden heatmap-scroll-thin",children:y.jsxs("div",{style:{minWidth:m},children:[y.jsxs("div",{className:"grid text-[10px] uppercase text-oai-gray-400 dark:text-oai-gray-400 mb-1",style:{gridTemplateColumns:`${li}px repeat(${u.length}, ${An}px)`,columnGap:Vs},children:[y.jsx("span",{}),f.map(p=>y.jsx("span",{style:{gridColumnStart:p.index+2},className:"whitespace-nowrap",children:p.label},`${p.label}-${p.index}`))]}),y.jsxs("div",{className:"grid",style:{gridTemplateColumns:`${li}px repeat(${u.length}, ${An}px)`,columnGap:Vs},children:[y.jsx("div",{className:"grid text-[10px] text-oai-gray-400 dark:text-oai-gray-400 sticky left-0 bg-white dark:bg-oai-gray-900 pr-2",style:{gridTemplateRows:`repeat(7, ${An}px)`,rowGap:Vs},children:d.map(p=>y.jsx("span",{className:"leading-none",children:p},p))}),y.jsx("div",{className:"grid",style:{gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${An}px)`,gap:Vs},children:u.map((p,g)=>(Array.isArray(p)?p:[]).map((b,w)=>{if(!b)return null;const x=b.day||`e-${g}-${w}`,v=Number(b.level)||0,k=i[v]||i[0],S=t||n||V("heatmap.legend.utc");return y.jsx("span",{title:V("heatmap.tooltip",{day:b.day,value:L0(b.value),unit:V("heatmap.unit.tokens"),tz:S}),className:"rounded-[2px] transition-transform hover:scale-125 hover:z-10",style:{width:An,height:An,background:k}},x)}))})]})]})}),!s&&y.jsxs("div",{className:"flex items-center justify-center gap-2 mt-3",children:[y.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:V("heatmap.legend.less")}),y.jsx("div",{className:"flex gap-0.5",children:i.map((p,g)=>y.jsx("span",{className:"rounded-[1px]",style:{width:10,height:10,background:p}},g))}),y.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:V("heatmap.legend.more")})]})]})}const Y0={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Pf={...Y0,position:"fixed",top:0,left:0};function Ht(e){const t=Cn(H0,e).current;return t.next=e,Me(t.effect),t}function H0(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var bo=Symbol("NOT_FOUND");function U0(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function z0(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function G0(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(s=>typeof s=="function"?`function ${s.name||"unnamed"}()`:typeof s).join(", ");throw new TypeError(`${t}[${n}]`)}}var Sc=e=>Array.isArray(e)?e:[e];function K0(e){const t=Array.isArray(e[0])?e[0]:e;return G0(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function q0(e,t){const n=[],{length:s}=e;for(let r=0;r<s;r++)n.push(e[r].apply(null,t));return n}function X0(e){let t;return{get(n){return t&&e(t.key,n)?t.value:bo},put(n,s){t={key:n,value:s}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Z0(e,t){let n=[];function s(a){const l=n.findIndex(c=>t(a,c.key));if(l>-1){const c=n[l];return l>0&&(n.splice(l,1),n.unshift(c)),c.value}return bo}function r(a,l){s(a)===bo&&(n.unshift({key:a,value:l}),n.length>e&&n.pop())}function o(){return n}function i(){n=[]}return{get:s,put:r,getEntries:o,clear:i}}var J0=(e,t)=>e===t;function Q0(e){return function(n,s){if(n===null||s===null||n.length!==s.length)return!1;const{length:r}=n;for(let o=0;o<r;o++)if(!e(n[o],s[o]))return!1;return!0}}function ex(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:s=J0,maxSize:r=1,resultEqualityCheck:o}=n,i=Q0(s);let a=0;const l=r<=1?X0(i):Z0(r,i);function c(){let u=l.get(arguments);if(u===bo){if(u=e.apply(null,arguments),a++,o){const f=l.getEntries().find(m=>o(m.value,u));f&&(u=f.value,a!==0&&a--)}l.put(arguments,u)}return u}return c.clearCache=()=>{l.clear(),c.resetResultsCount()},c.resultsCount=()=>a,c.resetResultsCount=()=>{a=0},c}var tx=class{constructor(e){this.value=e}deref(){return this.value}},nx=typeof WeakRef<"u"?WeakRef:tx,sx=0,Tc=1;function Lr(){return{s:sx,v:void 0,o:null,p:null}}function Rf(e,t={}){let n=Lr();const{resultEqualityCheck:s}=t;let r,o=0;function i(){let a=n;const{length:l}=arguments;for(let d=0,f=l;d<f;d++){const m=arguments[d];if(typeof m=="function"||typeof m=="object"&&m!==null){let p=a.o;p===null&&(a.o=p=new WeakMap);const g=p.get(m);g===void 0?(a=Lr(),p.set(m,a)):a=g}else{let p=a.p;p===null&&(a.p=p=new Map);const g=p.get(m);g===void 0?(a=Lr(),p.set(m,a)):a=g}}const c=a;let u;if(a.s===Tc)u=a.v;else if(u=e.apply(null,arguments),o++,s){const d=r?.deref?.()??r;d!=null&&s(d,u)&&(u=d,o!==0&&o--),r=typeof u=="object"&&u!==null||typeof u=="function"?new nx(u):u}return c.s=Tc,c.v=u,u}return i.clearCache=()=>{n=Lr(),i.resetResultsCount()},i.resultsCount=()=>o,i.resetResultsCount=()=>{o=0},i}function Af(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,s=(...r)=>{let o=0,i=0,a,l={},c=r.pop();typeof c=="object"&&(l=c,c=r.pop()),U0(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const u={...n,...l},{memoize:d,memoizeOptions:f=[],argsMemoize:m=Rf,argsMemoizeOptions:p=[]}=u,g=Sc(f),b=Sc(p),w=K0(r),x=d(function(){return o++,c.apply(null,arguments)},...g),v=m(function(){i++;const S=q0(w,arguments);return a=x.apply(null,S),a},...b);return Object.assign(v,{resultFunc:c,memoizedResultFunc:x,dependencies:w,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>a,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:d,argsMemoize:m})};return Object.assign(s,{withTypes:()=>s}),s}var rx=Af(Rf),ox=Object.assign((e,t=rx)=>{z0(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),s=n.map(o=>e[o]);return t(s,(...o)=>o.reduce((i,a,l)=>(i[n[l]]=a,i),{}))},{withTypes:()=>ox});Af({memoize:ex,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const pe=(e,t,n,s,r,o,...i)=>{if(i.length>0)throw new Error(zn(1));let a;if(e)a=e;else throw new Error("Missing arguments");return a};var ci={exports:{}},ui={};var Cc;function ix(){if(Cc)return ui;Cc=1;var e=jd();function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,r=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function a(d,f){var m=f(),p=s({inst:{value:m,getSnapshot:f}}),g=p[0].inst,b=p[1];return o(function(){g.value=m,g.getSnapshot=f,l(g)&&b({inst:g})},[d,m,f]),r(function(){return l(g)&&b({inst:g}),d(function(){l(g)&&b({inst:g})})},[d]),i(m),m}function l(d){var f=d.getSnapshot;d=d.value;try{var m=f();return!n(d,m)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return ui.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,ui}var Mc;function Of(){return Mc||(Mc=1,ci.exports=ix()),ci.exports}var ax=Of(),di={exports:{}},fi={};var Ec;function lx(){if(Ec)return fi;Ec=1;var e=jd(),t=Of();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var s=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;return fi.useSyncExternalStoreWithSelector=function(c,u,d,f,m){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function w(C){if(!x){if(x=!0,v=C,C=f(C),m!==void 0&&g.hasValue){var E=g.value;if(m(E,C))return k=E}return k=C}if(E=k,s(v,C))return E;var M=f(C);return m!==void 0&&m(E,M)?(v=C,E):(v=C,k=M)}var x=!1,v,k,S=d===void 0?null:d;return[function(){return w(u())},S===null?void 0:function(){return w(S())}]},[u,d,f,m]);var b=r(c,p[0],p[1]);return i(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},fi}var Dc;function cx(){return Dc||(Dc=1,di.exports=lx()),di.exports}var ux=cx();const dx=Id(19),fx=dx?mx:px;function hx(e,t,n,s,r){return fx(e,t,n,s,r)}function mx(e,t,n,s,r){const o=h.useCallback(()=>t(e.getSnapshot(),n,s,r),[e,t,n,s,r]);return ax.useSyncExternalStore(e.subscribe,o,o)}function px(e,t,n,s,r){return ux.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,o=>t(o,n,s,r))}class zs{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const s of this.listeners){if(n!==this.updateTick)return;s(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){zs.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||zs.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};zs.prototype.setState.call(this,t)}}class Va extends zs{constructor(t,n={},s){super(t),this.context=n,this.selectors=s}controlledValues=new Map;useSyncedValue(t,n){h.useDebugValue(t),Me(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const s=this;Me(()=>(s.state[t]!==n&&s.set(t,n),()=>{s.set(t,void 0)}),[s,t,n])}useSyncedValues(t){const n=this,s=Object.values(t);Me(()=>{n.update(t)},[n,...s])}useControlledProp(t,n,s){h.useDebugValue(t);const r=this,o=n!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,o),!o&&!Object.is(this.state[t],s)&&super.setState({...this.state,[t]:s})),Me(()=>{o&&!Object.is(r.state[t],n)&&super.setState({...r.state,[t]:n})},[r,t,n,s,o])}set(t,n){this.controlledValues.get(t)!==!0&&super.set(t,n)}update(t){const n={...t};for(const s in n)if(Object.hasOwn(n,s)&&this.controlledValues.get(s)===!0){delete n[s];continue}super.update(n)}setState(t){const n={...t};for(const s in n)if(Object.hasOwn(n,s)&&this.controlledValues.get(s)===!0){delete n[s];continue}super.setState({...this.state,...n})}select=(t,n,s,r)=>{const o=this.selectors[t];return o(this.state,n,s,r)};useState=(t,n,s,r)=>{h.useDebugValue(t);const o=this.selectors[t];return hx(this,o,n,s,r)};useContextCallback(t,n){h.useDebugValue(t);const s=he(n??Fd);this.context[t]=s}useStateSetter(t){const n=h.useRef(void 0);return n.current===void 0&&(n.current=s=>{this.set(t,s)}),n.current}observe(t,n){let s;typeof t=="function"?s=t:s=this.selectors[t];let r=s(this.state);return n(r,r,this),this.subscribe(o=>{const i=s(o);if(!Object.is(r,i)){const a=r;r=i,n(i,a,this)}})}}const _r=null;class gx{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,s=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,s>0)for(let r=0;r<n.length;r+=1)n[r]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const Vr=new gx;class $t{static create(){return new $t}static request(t){return Vr.request(t)}static cancel(t){return Vr.cancel(t)}currentId=_r;request(t){this.cancel(),this.currentId=Vr.request(()=>{this.currentId=_r,t()})}cancel=()=>{this.currentId!==_r&&(Vr.cancel(this.currentId),this.currentId=_r)};disposeEffect=()=>this.cancel}function Wa(){const e=Cn($t.create).current;return Aa(e.disposeEffect),e}function Nf(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(s=>s(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class yx{nodesRef={current:[]};events=Nf();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(s=>s===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const jf=h.createContext(null),If=h.createContext(null),Xn=()=>h.useContext(jf)?.id||null,Ps=e=>{const t=h.useContext(If);return e??t};function bx(e){const t=ur(),n=Ps(e),s=Xn();return Me(()=>{if(!t)return;const r={id:t,parentId:s};return n?.addNode(r),()=>{n?.removeNode(r)}},[n,t,s]),t}function xx(e){const{children:t,id:n}=e,s=Xn();return y.jsx(jf.Provider,{value:h.useMemo(()=>({id:n,parentId:s}),[n,s]),children:t})}function vx(e){const{children:t,externalTree:n}=e,s=Cn(()=>n??new yx).current;return y.jsx(If.Provider,{value:s,children:t})}function er(e){return`data-base-ui-${e}`}function hi(e,t,n){if(n&&!xs(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const s=e();return typeof s=="number"?s:s?.[t]}return e?.[t]}const Ss=h.forwardRef(function(t,n){const[s,r]=h.useState();Me(()=>{rb&&r("button")},[]);const o={tabIndex:0,role:s};return y.jsx("span",{...t,ref:n,style:Pf,"aria-hidden":s?void 0:!0,...o,"data-base-ui-focus-guard":""})});let Pc=0;function mi(e,t={}){const{preventScroll:n=!1,cancelPrevious:s=!0,sync:r=!1}=t;s&&cancelAnimationFrame(Pc);const o=()=>e?.focus({preventScroll:n});r?o():Pc=requestAnimationFrame(o)}const ps={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Rc(e){return e==="inert"?ps.inert:e==="aria-hidden"?ps["aria-hidden"]:ps.none}let Wr=new WeakSet,Br={},pi=0;const Ff=e=>e&&(e.host||Ff(e.parentNode)),wx=(e,t)=>t.map(n=>{if(e.contains(n))return n;const s=Ff(n);return e.contains(s)?s:null}).filter(n=>n!=null);function kx(e,t,n,s){const r="data-base-ui-inert",o=s?"inert":n?"aria-hidden":null,i=wx(t,e),a=new Set,l=new Set(i),c=[];Br[r]||(Br[r]=new WeakMap);const u=Br[r];i.forEach(d),f(t),a.clear();function d(m){!m||a.has(m)||(a.add(m),m.parentNode&&d(m.parentNode))}function f(m){!m||l.has(m)||[].forEach.call(m.children,p=>{if(dr(p)!=="script")if(a.has(p))f(p);else{const g=o?p.getAttribute(o):null,b=g!==null&&g!=="false",w=Rc(o),x=(w.get(p)||0)+1,v=(u.get(p)||0)+1;w.set(p,x),u.set(p,v),c.push(p),x===1&&b&&Wr.add(p),v===1&&p.setAttribute(r,""),!b&&o&&p.setAttribute(o,o==="inert"?"":"true")}})}return pi+=1,()=>{c.forEach(m=>{const p=Rc(o),b=(p.get(m)||0)-1,w=(u.get(m)||0)-1;p.set(m,b),u.set(m,w),b||(!Wr.has(m)&&o&&m.removeAttribute(o),Wr.delete(m)),w||m.removeAttribute(r)}),pi-=1,pi||(ps.inert=new WeakMap,ps["aria-hidden"]=new WeakMap,ps.none=new WeakMap,Wr=new WeakSet,Br={})}}function Sx(e,t=!1,n=!1){const s=qe(e[0]).body;return kx(e.concat(Array.from(s.querySelectorAll("[aria-live]"))),s,t,n)}const Lf=h.createContext(null),_f=()=>h.useContext(Lf),Tx=er("portal");function Cx(e={}){const{ref:t,container:n,componentProps:s=_n,elementProps:r,elementState:o}=e,i=ur(),l=_f()?.portalNode,[c,u]=h.useState(null),[d,f]=h.useState(null),m=he(w=>{w!==null&&f(w)}),p=h.useRef(null);Me(()=>{if(n===null){p.current&&(p.current=null,f(null),u(null));return}if(i==null)return;const w=(n&&(Py(n)?n:n.current))??l??document.body;if(w==null){p.current&&(p.current=null,f(null),u(null));return}p.current!==w&&(p.current=w,f(null),u(w))},[n,l,i]);const g=hn("div",s,{ref:[t,m],state:o,props:[{id:i,[Tx]:""},r]});return{portalNode:d,portalSubtree:c&&g?kn.createPortal(g,c):null}}const Vf=h.forwardRef(function(t,n){const{children:s,container:r,className:o,render:i,renderGuards:a,...l}=t,{portalNode:c,portalSubtree:u}=Cx({container:r,ref:n,componentProps:t,elementProps:l}),d=h.useRef(null),f=h.useRef(null),m=h.useRef(null),p=h.useRef(null),[g,b]=h.useState(null),w=g?.modal,x=g?.open,v=typeof a=="boolean"?a:!!g&&!g.modal&&g.open&&!!c;h.useEffect(()=>{if(!c||w)return;function S(C){c&&C.relatedTarget&&hs(C)&&(C.type==="focusin"?mc:Wb)(c)}return c.addEventListener("focusin",S,!0),c.addEventListener("focusout",S,!0),()=>{c.removeEventListener("focusin",S,!0),c.removeEventListener("focusout",S,!0)}},[c,w]),h.useEffect(()=>{!c||x||mc(c)},[x,c]);const k=h.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:m,afterInsideRef:p,portalNode:c,setFocusManagerState:b}),[c]);return y.jsxs(h.Fragment,{children:[u,y.jsxs(Lf.Provider,{value:k,children:[v&&c&&y.jsx(Ss,{"data-type":"outside",ref:d,onFocus:S=>{if(hs(S,c))m.current?.focus();else{const C=g?g.domReference:null;uf(C)?.focus()}}}),v&&c&&y.jsx("span",{"aria-owns":c.id,style:tb}),c&&kn.createPortal(s,c),v&&c&&y.jsx(Ss,{"data-type":"outside",ref:f,onFocus:S=>{if(hs(S,c))p.current?.focus();else{const C=g?g.domReference:null;Ia(C)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,_e(Qs,S.nativeEvent))}}})]})]})});function ln(e){return e==null?e:"current"in e?e.current:e}function Mx(e,t){const n=wt(e.target);return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const Ac=20;let xn=[];function Ba(){xn=xn.filter(e=>e.isConnected)}function Ex(e){Ba(),e&&dr(e)!=="body"&&(xn.push(e),xn.length>Ac&&(xn=xn.slice(-Ac)))}function gi(){return Ba(),xn[xn.length-1]}function Dx(e){if(!e)return null;const t=Ds();return lf(e,t)?e:hr(e,t)[0]||e}function Px(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Lt(e).display!=="none"}function Oc(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=Ds(),r=Lb(e,n).filter(i=>{const a=i.getAttribute("data-tabindex")||"";return lf(i,n)||i.hasAttribute("data-tabindex")&&!a.startsWith("-")}),o=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?o!=="0"&&e.setAttribute("tabindex","0"):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Wf(e){const{context:t,children:n,disabled:s=!1,order:r=["content"],initialFocus:o=!0,returnFocus:i=!0,restoreFocus:a=!1,modal:l=!0,closeOnFocusOut:c=!0,openInteractionType:u="",getInsideElements:d=()=>[],nextFocusableElement:f,previousFocusableElement:m,beforeContentFocusGuardRef:p,externalTree:g}=e,b="rootStore"in t?t.rootStore:t,w=b.useState("open"),x=b.useState("domReferenceElement"),v=b.useState("floatingElement"),{events:k,dataRef:S}=b.context,C=he(()=>S.current.floatingContext?.nodeId),E=he(d),M=o===!1,A=cc(x)&&M,T=Ht(r),R=Ht(o),O=Ht(i),D=Ht(u),F=Ps(g),N=_f(),_=h.useRef(null),z=h.useRef(null),P=h.useRef(!1),I=h.useRef(!1),B=h.useRef(!1),W=h.useRef(-1),J=h.useRef(""),Y=h.useRef(""),$=h.useRef(null),K=h.useRef(null),Z=ic($,p,N?.beforeInsideRef),le=ic(K,N?.afterInsideRef),Ce=Yn(),Ae=Yn(),De=Wa(),tt=N!=null,L=qi(v),ce=he((U=L)=>U?hr(U,Ds()):[]),te=he(U=>{const se=ce(U);return T.current.map(()=>se).filter(Boolean).flat()});h.useEffect(()=>{if(s||!l)return;function U(re){re.key==="Tab"&&Se(L,is(qe(L)))&&ce().length===0&&!A&&ub(re)}const se=qe(L);return se.addEventListener("keydown",U),()=>{se.removeEventListener("keydown",U)}},[s,x,L,l,T,A,ce,te]),h.useEffect(()=>{if(s||!v)return;function U(se){const re=ht(se),ge=ce().indexOf(re);ge!==-1&&(W.current=ge)}return v.addEventListener("focusin",U),()=>{v.removeEventListener("focusin",U)}},[s,v,ce]),h.useEffect(()=>{if(s||!w)return;const U=qe(L);function se(){B.current=!1}function re(ge){const Q=ht(ge),ne=Se(v,Q)||Se(x,Q)||Se(N?.portalNode,Q);B.current=!ne,Y.current=ge.pointerType||"keyboard"}function me(){Y.current="keyboard"}return U.addEventListener("pointerdown",re,!0),U.addEventListener("pointerup",se,!0),U.addEventListener("pointercancel",se,!0),U.addEventListener("keydown",me,!0),()=>{U.removeEventListener("pointerdown",re,!0),U.removeEventListener("pointerup",se,!0),U.removeEventListener("pointercancel",se,!0),U.removeEventListener("keydown",me,!0)}},[s,v,x,L,w,N]),h.useEffect(()=>{if(s||!c)return;function U(){I.current=!0,Ae.start(0,()=>{I.current=!1})}function se(Q){const ne=Q.relatedTarget,je=Q.currentTarget,be=ht(Q);queueMicrotask(()=>{const Be=C(),$e=b.context.triggerElements,ct=ne?.hasAttribute(er("focus-guard"))&&[$.current,K.current,N?.beforeInsideRef.current,N?.afterInsideRef.current,N?.beforeOutsideRef.current,N?.afterOutsideRef.current,ln(m),ln(f)].includes(ne),nt=!(Se(x,ne)||Se(v,ne)||Se(ne,v)||Se(N?.portalNode,ne)||ne!=null&&$e.hasElement(ne)||$e.hasMatchingElement(ye=>Se(ye,ne))||ct||F&&(Wn(F.nodesRef.current,Be).find(ye=>Se(ye.context?.elements.floating,ne)||Se(ye.context?.elements.domReference,ne))||uc(F.nodesRef.current,Be).find(ye=>[ye.context?.elements.floating,qi(ye.context?.elements.floating)].includes(ne)||ye.context?.elements.domReference===ne)));if(je===x&&L&&Oc(L,T),a&&je!==x&&!Px(be)&&is(qe(L))===qe(L).body){if(rt(L)&&(L.focus(),a==="popup")){De.request(()=>{L.focus()});return}const ye=W.current,ve=ce(),Ie=ve[ye]||ve[ve.length-1]||L;rt(Ie)&&Ie.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(A||!l)&&ne&&nt&&!I.current&&(A||ne!==gi())&&(P.current=!0,b.setOpen(!1,_e(Qs,Q)))})}function re(){B.current||(S.current.insideReactTree=!0,Ce.start(0,()=>{S.current.insideReactTree=!1}))}const me=rt(x)?x:null,ge=[];if(!(!v&&!me))return me&&(me.addEventListener("focusout",se),me.addEventListener("pointerdown",U),ge.push(()=>{me.removeEventListener("focusout",se),me.removeEventListener("pointerdown",U)})),v&&(v.addEventListener("focusout",se),N&&(v.addEventListener("focusout",re,!0),ge.push(()=>{v.removeEventListener("focusout",re,!0)})),ge.push(()=>{v.removeEventListener("focusout",se)})),()=>{ge.forEach(Q=>{Q()})}},[s,x,v,L,l,F,N,b,c,a,ce,A,C,T,S,Ce,Ae,De,f,m]),h.useEffect(()=>{if(s||!v||!w)return;const U=Array.from(N?.portalNode?.querySelectorAll(`[${er("portal")}]`)||[]),re=(F?uc(F.nodesRef.current,C()):[]).find(Q=>cc(Q.context?.elements.domReference||null))?.context?.elements.domReference,me=[v,re,...U,...E(),_.current,z.current,$.current,K.current,N?.beforeOutsideRef.current,N?.afterOutsideRef.current,ln(m),ln(f),A?x:null].filter(Q=>Q!=null),ge=Sx(me,l||A);return()=>{ge()}},[w,s,x,v,l,T,N,A,F,C,E,f,m]),Me(()=>{if(!w||s||!rt(L))return;const U=qe(L),se=is(U);queueMicrotask(()=>{const re=te(L),me=R.current,ge=typeof me=="function"?me(D.current||""):me;if(ge===void 0||ge===!1)return;let Q;ge===!0||ge===null?Q=re[0]||L:Q=ln(ge),Q=Q||re[0]||L,!Se(L,se)&&mi(Q,{preventScroll:Q===L})})},[s,w,L,M,te,R,D]),Me(()=>{if(s||!L)return;const U=qe(L),se=is(U);Ex(se);function re(Q){if(Q.open||(J.current=Mx(Q.nativeEvent,Y.current)),Q.reason===ft&&Q.nativeEvent.type==="mouseleave"&&(P.current=!0),Q.reason===Ld)if(Q.nested)P.current=!1;else if(fb(Q.nativeEvent)||hb(Q.nativeEvent))P.current=!1;else{let ne=!1;document.createElement("div").focus({get preventScroll(){return ne=!0,!1}}),ne?P.current=!1:P.current=!0}}k.on("openchange",re);const me=U.createElement("span");me.setAttribute("tabindex","-1"),me.setAttribute("aria-hidden","true"),Object.assign(me.style,Pf),tt&&x&&x.insertAdjacentElement("afterend",me);function ge(){const Q=O.current;let ne=typeof Q=="function"?Q(J.current):Q;if(ne===void 0||ne===!1)return null;if(ne===null&&(ne=!0),typeof ne=="boolean"){const be=x||gi();return be&&be.isConnected?be:me}const je=x||gi()||me;return ln(ne)||je}return()=>{k.off("openchange",re);const Q=is(U),ne=Se(v,Q)||F&&Wn(F.nodesRef.current,C(),!1).some(be=>Se(be.context?.elements.floating,Q)),je=ge();queueMicrotask(()=>{const be=Dx(je),Be=typeof O.current!="boolean";O.current&&!P.current&&rt(be)&&(!(!Be&&be!==Q&&Q!==U.body)||ne)&&be.focus({preventScroll:!0}),me.remove()})}},[s,v,L,O,S,k,F,tt,x,C]),h.useEffect(()=>{queueMicrotask(()=>{P.current=!1})},[s]),h.useEffect(()=>{if(s||!w)return;function U(re){ht(re)?.closest(`[${Ud}]`)&&(I.current=!0)}const se=qe(L);return se.addEventListener("pointerdown",U,!0),()=>{se.removeEventListener("pointerdown",U,!0)}},[s,w,L]),Me(()=>{if(!s&&N)return N.setFocusManagerState({modal:l,closeOnFocusOut:c,open:w,onOpenChange:b.setOpen,domReference:x}),()=>{N.setFocusManagerState(null)}},[s,N,l,w,b,c,x]),Me(()=>{if(!(s||!L))return Oc(L,T),()=>{queueMicrotask(Ba)}},[s,L,T]);const Pe=!s&&(l?!A:!0)&&(tt||l);return y.jsxs(h.Fragment,{children:[Pe&&y.jsx(Ss,{"data-type":"inside",ref:Z,onFocus:U=>{if(l){const se=te();mi(se[se.length-1])}else N?.portalNode&&(P.current=!1,hs(U,N.portalNode)?Ia(x)?.focus():ln(m??N.beforeOutsideRef)?.focus())}}),n,Pe&&y.jsx(Ss,{"data-type":"inside",ref:le,onFocus:U=>{l?mi(te()[0]):N?.portalNode&&(c&&(P.current=!0),hs(U,N.portalNode)?uf(x)?.focus():ln(f??N.afterOutsideRef)?.focus())}})]})}function Rx(e,t={}){const n="rootStore"in e?e.rootStore:e,s=n.context.dataRef,{enabled:r=!0,event:o="click",toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:l=!0,touchOpenDelay:c=0}=t,u=h.useRef(void 0),d=Wa(),f=Yn(),m=h.useMemo(()=>({onPointerDown(p){u.current=p.pointerType},onMouseDown(p){const g=u.current,b=p.nativeEvent,w=n.select("open");if(p.button!==0||o==="click"||xs(g,!0)&&a)return;const x=s.current.openEvent,v=x?.type,k=n.select("domReferenceElement")!==p.currentTarget,S=w&&k||!(w&&i&&(!(x&&l)||v==="click"||v==="mousedown"));if(Jd(b.target)){const E=_e(wn,b,b.target);S&&g==="touch"&&c>0?f.start(c,()=>{n.setOpen(!0,E)}):n.setOpen(S,E);return}const C=p.currentTarget;d.request(()=>{const E=_e(wn,b,C);S&&g==="touch"&&c>0?f.start(c,()=>{n.setOpen(!0,E)}):n.setOpen(S,E)})},onClick(p){if(o==="mousedown-only")return;const g=u.current;if(o==="mousedown"&&g){u.current=void 0;return}if(xs(g,!0)&&a)return;const b=n.select("open"),w=s.current.openEvent,x=n.select("domReferenceElement")!==p.currentTarget,v=b&&x||!(b&&i&&(!(w&&l)||Qd(w))),k=_e(wn,p.nativeEvent,p.currentTarget);v&&g==="touch"&&c>0?f.start(c,()=>{n.setOpen(!0,k)}):n.setOpen(v,k)},onKeyDown(){u.current=void 0}}),[s,o,a,n,l,i,d,f,c]);return h.useMemo(()=>r?{reference:m}:_n,[r,m])}function Nc(e,t,n){let{reference:s,floating:r}=e;const o=bt(t),i=ja(t),a=Na(i),l=at(t),c=o==="y",u=s.x+s.width/2-r.width/2,d=s.y+s.height/2-r.height/2,f=s[a]/2-r[a]/2;let m;switch(l){case"top":m={x:u,y:s.y-r.height};break;case"bottom":m={x:u,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:d};break;case"left":m={x:s.x-r.width,y:d};break;default:m={x:s.x,y:s.y}}switch(Mn(t)){case"start":m[i]-=f*(n&&c?-1:1);break;case"end":m[i]+=f*(n&&c?-1:1);break}return m}async function Ax(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:o,rects:i,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:m=0}=dn(t,e),p=ef(m),b=a[f?d==="floating"?"reference":"floating":d],w=uo(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(b)))==null||n?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),x=d==="floating"?{x:s,y:r,width:i.floating.width,height:i.floating.height}:i.reference,v=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),k=await(o.isElement==null?void 0:o.isElement(v))?await(o.getScale==null?void 0:o.getScale(v))||{x:1,y:1}:{x:1,y:1},S=uo(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:v,strategy:l}):x);return{top:(w.top-S.top+p.top)/k.y,bottom:(S.bottom-w.bottom+p.bottom)/k.y,left:(w.left-S.left+p.left)/k.x,right:(S.right-w.right+p.right)/k.x}}const Ox=50,Nx=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:o=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:Ax},l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:d}=Nc(c,s,l),f=s,m=0;const p={};for(let g=0;g<o.length;g++){const b=o[g];if(!b)continue;const{name:w,fn:x}=b,{x:v,y:k,data:S,reset:C}=await x({x:u,y:d,initialPlacement:s,placement:f,strategy:r,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});u=v??u,d=k??d,p[w]={...p[w],...S},C&&m<Ox&&(m++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(c=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):C.rects),{x:u,y:d}=Nc(c,f,l)),g=-1)}return{x:u,y:d,placement:f,strategy:r,middlewareData:p}},jx=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:o,rects:i,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...b}=dn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const w=at(r),x=bt(a),v=at(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=f||(v||!g?[co(a)]:yb(a)),C=p!=="none";!f&&C&&S.push(...wb(a,g,p,k));const E=[a,...S],M=await l.detectOverflow(t,b),A=[];let T=((s=o.flip)==null?void 0:s.overflows)||[];if(u&&A.push(M[w]),d){const F=gb(r,i,k);A.push(M[F[0]],M[F[1]])}if(T=[...T,{placement:r,overflows:A}],!A.every(F=>F<=0)){var R,O;const F=(((R=o.flip)==null?void 0:R.index)||0)+1,N=E[F];if(N&&(!(d==="alignment"?x!==bt(N):!1)||T.every(P=>bt(P.placement)===x?P.overflows[0]>0:!0)))return{data:{index:F,overflows:T},reset:{placement:N}};let _=(O=T.filter(z=>z.overflows[0]<=0).sort((z,P)=>z.overflows[1]-P.overflows[1])[0])==null?void 0:O.placement;if(!_)switch(m){case"bestFit":{var D;const z=(D=T.filter(P=>{if(C){const I=bt(P.placement);return I===x||I==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(I=>I>0).reduce((I,B)=>I+B,0)]).sort((P,I)=>P[1]-I[1])[0])==null?void 0:D[0];z&&(_=z);break}case"initialPlacement":_=a;break}if(r!==_)return{reset:{placement:_}}}return{}}}};function jc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ic(e){return mb.some(t=>e[t]>=0)}const Ix=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...o}=dn(e,t);switch(r){case"referenceHidden":{const i=await s.detectOverflow(t,{...o,elementContext:"reference"}),a=jc(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Ic(a)}}}case"escaped":{const i=await s.detectOverflow(t,{...o,altBoundary:!0}),a=jc(i,n.floating);return{data:{escapedOffsets:a,escaped:Ic(a)}}}default:return{}}}}},Bf=new Set(["left","top"]);async function Fx(e,t){const{placement:n,platform:s,elements:r}=e,o=await(s.isRTL==null?void 0:s.isRTL(r.floating)),i=at(n),a=Mn(n),l=bt(n)==="y",c=Bf.has(i)?-1:1,u=o&&l?-1:1,d=dn(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(m=a==="end"?p*-1:p),l?{x:m*u,y:f*c}:{x:f*c,y:m*u}}const Lx=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:r,y:o,placement:i,middlewareData:a}=t,l=await Fx(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+l.x,y:o+l.y,data:{...l,placement:i}}}}},_x=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r,platform:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:w=>{let{x,y:v}=w;return{x,y:v}}},...c}=dn(e,t),u={x:n,y:s},d=await o.detectOverflow(t,c),f=bt(at(r)),m=Oa(f);let p=u[m],g=u[f];if(i){const w=m==="y"?"top":"left",x=m==="y"?"bottom":"right",v=p+d[w],k=p-d[x];p=Xi(v,p,k)}if(a){const w=f==="y"?"top":"left",x=f==="y"?"bottom":"right",v=g+d[w],k=g-d[x];g=Xi(v,g,k)}const b=l.fn({...t,[m]:p,[f]:g});return{...b,data:{x:b.x-n,y:b.y-s,enabled:{[m]:i,[f]:a}}}}}},Vx=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:r,rects:o,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=dn(e,t),u={x:n,y:s},d=bt(r),f=Oa(d);let m=u[f],p=u[d];const g=dn(a,t),b=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const v=f==="y"?"height":"width",k=o.reference[f]-o.floating[v]+b.mainAxis,S=o.reference[f]+o.reference[v]-b.mainAxis;m<k?m=k:m>S&&(m=S)}if(c){var w,x;const v=f==="y"?"width":"height",k=Bf.has(at(r)),S=o.reference[d]-o.floating[v]+(k&&((w=i.offset)==null?void 0:w[d])||0)+(k?0:b.crossAxis),C=o.reference[d]+o.reference[v]+(k?0:((x=i.offset)==null?void 0:x[d])||0)-(k?b.crossAxis:0);p<S?p=S:p>C&&(p=C)}return{[f]:m,[d]:p}}}},Wx=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:r,rects:o,platform:i,elements:a}=t,{apply:l=()=>{},...c}=dn(e,t),u=await i.detectOverflow(t,c),d=at(r),f=Mn(r),m=bt(r)==="y",{width:p,height:g}=o.floating;let b,w;d==="top"||d==="bottom"?(b=d,w=f===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(w=d,b=f==="end"?"top":"bottom");const x=g-u.top-u.bottom,v=p-u.left-u.right,k=vs(g-u[b],x),S=vs(p-u[w],v),C=!t.middlewareData.shift;let E=k,M=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(M=v),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(E=x),C&&!f){const T=mt(u.left,0),R=mt(u.right,0),O=mt(u.top,0),D=mt(u.bottom,0);m?M=p-2*(T!==0||R!==0?T+R:mt(u.left,u.right)):E=g-2*(O!==0||D!==0?O+D:mt(u.top,u.bottom))}await l({...t,availableWidth:M,availableHeight:E});const A=await i.getDimensions(a.floating);return p!==A.width||g!==A.height?{reset:{rects:!0}}:{}}}};function $f(e){const t=Lt(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=rt(e),o=r?e.offsetWidth:n,i=r?e.offsetHeight:s,a=lo(n)!==o||lo(s)!==i;return a&&(n=o,s=i),{width:n,height:s,$:a}}function $a(e){return Oe(e)?e:e.contextElement}function gs(e){const t=$a(e);if(!rt(t))return Gt(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:o}=$f(t);let i=(o?lo(n.width):n.width)/s,a=(o?lo(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Bx=Gt(0);function Yf(e){const t=wt(e);return!Da()||!t.visualViewport?Bx:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $x(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==wt(e)?!1:t}function Hn(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=$a(e);let i=Gt(1);t&&(s?Oe(s)&&(i=gs(s)):i=gs(e));const a=$x(o,n,s)?Yf(o):Gt(0);let l=(r.left+a.x)/i.x,c=(r.top+a.y)/i.y,u=r.width/i.x,d=r.height/i.y;if(o){const f=wt(o),m=s&&Oe(s)?wt(s):s;let p=f,g=ac(p);for(;g&&s&&m!==p;){const b=gs(g),w=g.getBoundingClientRect(),x=Lt(g),v=w.left+(g.clientLeft+parseFloat(x.paddingLeft))*b.x,k=w.top+(g.clientTop+parseFloat(x.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,d*=b.y,l+=v,c+=k,p=wt(g),g=ac(p)}}return uo({width:u,height:d,x:l,y:c})}function Ao(e,t){const n=Ro(e).scrollLeft;return t?t.left+n:Hn(mn(e)).left+n}function Hf(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Ao(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function Yx(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const o=r==="fixed",i=mn(s),a=t?Pa(t.floating):!1;if(s===i||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Gt(1);const u=Gt(0),d=rt(s);if((d||!d&&!o)&&((dr(s)!=="body"||fr(i))&&(l=Ro(s)),d)){const m=Hn(s);c=gs(s),u.x=m.x+s.clientLeft,u.y=m.y+s.clientTop}const f=i&&!d&&!o?Hf(i,l):Gt(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function Hx(e){return Array.from(e.getClientRects())}function Ux(e){const t=mn(e),n=Ro(e),s=e.ownerDocument.body,r=mt(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=mt(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let i=-n.scrollLeft+Ao(e);const a=-n.scrollTop;return Lt(s).direction==="rtl"&&(i+=mt(t.clientWidth,s.clientWidth)-r),{width:r,height:o,x:i,y:a}}const Fc=25;function zx(e,t){const n=wt(e),s=mn(e),r=n.visualViewport;let o=s.clientWidth,i=s.clientHeight,a=0,l=0;if(r){o=r.width,i=r.height;const u=Da();(!u||u&&t==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}const c=Ao(s);if(c<=0){const u=s.ownerDocument,d=u.body,f=getComputedStyle(d),m=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(s.clientWidth-d.clientWidth-m);p<=Fc&&(o-=p)}else c<=Fc&&(o+=c);return{width:o,height:i,x:a,y:l}}function Gx(e,t){const n=Hn(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,o=rt(e)?gs(e):Gt(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,l=r*o.x,c=s*o.y;return{width:i,height:a,x:l,y:c}}function Lc(e,t,n){let s;if(t==="viewport")s=zx(e,n);else if(t==="document")s=Ux(mn(e));else if(Oe(t))s=Gx(t,n);else{const r=Yf(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return uo(s)}function Uf(e,t){const n=bs(e);return n===t||!Oe(n)||Vn(n)?!1:Lt(n).position==="fixed"||Uf(n,t)}function Kx(e,t){const n=t.get(e);if(n)return n;let s=fs(e,[],!1).filter(a=>Oe(a)&&dr(a)!=="body"),r=null;const o=Lt(e).position==="fixed";let i=o?bs(e):e;for(;Oe(i)&&!Vn(i);){const a=Lt(i),l=_d(i);!l&&a.position==="fixed"&&(r=null),(o?!l&&!r:!l&&a.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||fr(i)&&!l&&Uf(e,i))?s=s.filter(u=>u!==i):r=a,i=bs(i)}return t.set(e,s),s}function qx(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?Pa(t)?[]:Kx(t,this._c):[].concat(n),s],a=Lc(t,i[0],r);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let f=1;f<i.length;f++){const m=Lc(t,i[f],r);l=mt(m.top,l),c=vs(m.right,c),u=vs(m.bottom,u),d=mt(m.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function Xx(e){const{width:t,height:n}=$f(e);return{width:t,height:n}}function Zx(e,t,n){const s=rt(t),r=mn(t),o=n==="fixed",i=Hn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Gt(0);function c(){l.x=Ao(r)}if(s||!s&&!o)if((dr(t)!=="body"||fr(r))&&(a=Ro(t)),s){const m=Hn(t,!0,o,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else r&&c();o&&!s&&r&&c();const u=r&&!s&&!o?Hf(r,a):Gt(0),d=i.left+a.scrollLeft-l.x-u.x,f=i.top+a.scrollTop-l.y-u.y;return{x:d,y:f,width:i.width,height:i.height}}function yi(e){return Lt(e).position==="static"}function _c(e,t){if(!rt(e)||Lt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return mn(e)===n&&(n=n.ownerDocument.body),n}function zf(e,t){const n=wt(e);if(Pa(e))return n;if(!rt(e)){let r=bs(e);for(;r&&!Vn(r);){if(Oe(r)&&!yi(r))return r;r=bs(r)}return n}let s=_c(e,t);for(;s&&Ry(s)&&yi(s);)s=_c(s,t);return s&&Vn(s)&&yi(s)&&!_d(s)?n:s||Ay(e)||n}const Jx=async function(e){const t=this.getOffsetParent||zf,n=this.getDimensions,s=await n(e.floating);return{reference:Zx(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Qx(e){return Lt(e).direction==="rtl"}const ev={convertOffsetParentRelativeRectToViewportRelativeRect:Yx,getDocumentElement:mn,getClippingRect:qx,getOffsetParent:zf,getElementRects:Jx,getClientRects:Hx,getDimensions:Xx,getScale:gs,isElement:Oe,isRTL:Qx};function Gf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tv(e,t){let n=null,s;const r=mn(e);function o(){var a;clearTimeout(s),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:m}=c;if(a||t(),!f||!m)return;const p=Fr(d),g=Fr(r.clientWidth-(u+f)),b=Fr(r.clientHeight-(d+m)),w=Fr(u),v={rootMargin:-p+"px "+-g+"px "+-b+"px "+-w+"px",threshold:mt(0,vs(1,l))||1};let k=!0;function S(C){const E=C[0].intersectionRatio;if(E!==l){if(!k)return i();E?i(!1,E):s=setTimeout(()=>{i(!1,1e-7)},1e3)}E===1&&!Gf(c,e.getBoundingClientRect())&&i(),k=!1}try{n=new IntersectionObserver(S,{...v,root:r.ownerDocument})}catch{n=new IntersectionObserver(S,v)}n.observe(e)}return i(!0),o}function Vc(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,c=$a(e),u=r||o?[...c?fs(c):[],...t?fs(t):[]]:[];u.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),o&&w.addEventListener("resize",n)});const d=c&&a?tv(c,n):null;let f=-1,m=null;i&&(m=new ResizeObserver(w=>{let[x]=w;x&&x.target===c&&m&&t&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),c&&!l&&m.observe(c),t&&m.observe(t));let p,g=l?Hn(e):null;l&&b();function b(){const w=Hn(e);g&&!Gf(g,w)&&n(),g=w,p=requestAnimationFrame(b)}return n(),()=>{var w;u.forEach(x=>{r&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),d?.(),(w=m)==null||w.disconnect(),m=null,l&&cancelAnimationFrame(p)}}const nv=Lx,sv=_x,rv=jx,ov=Wx,iv=Ix,av=Vx,lv=(e,t,n)=>{const s=new Map,r={platform:ev,...n},o={...r.platform,_c:s};return Nx(e,t,{...r,platform:o})};var cv=typeof document<"u",uv=function(){},qr=cv?h.useLayoutEffect:uv;function xo(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!xo(e[s],t[s]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,r[s]))return!1;for(s=n;s--!==0;){const o=r[s];if(!(o==="_owner"&&e.$$typeof)&&!xo(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Kf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Wc(e,t){const n=Kf(e);return Math.round(t*n)/n}function bi(e){const t=h.useRef(e);return qr(()=>{t.current=e}),t}function dv(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:r,elements:{reference:o,floating:i}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=h.useState(s);xo(f,s)||m(s);const[p,g]=h.useState(null),[b,w]=h.useState(null),x=h.useCallback(P=>{P!==C.current&&(C.current=P,g(P))},[]),v=h.useCallback(P=>{P!==E.current&&(E.current=P,w(P))},[]),k=o||p,S=i||b,C=h.useRef(null),E=h.useRef(null),M=h.useRef(u),A=l!=null,T=bi(l),R=bi(r),O=bi(c),D=h.useCallback(()=>{if(!C.current||!E.current)return;const P={placement:t,strategy:n,middleware:f};R.current&&(P.platform=R.current),lv(C.current,E.current,P).then(I=>{const B={...I,isPositioned:O.current!==!1};F.current&&!xo(M.current,B)&&(M.current=B,kn.flushSync(()=>{d(B)}))})},[f,t,n,R,O]);qr(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,d(P=>({...P,isPositioned:!1})))},[c]);const F=h.useRef(!1);qr(()=>(F.current=!0,()=>{F.current=!1}),[]),qr(()=>{if(k&&(C.current=k),S&&(E.current=S),k&&S){if(T.current)return T.current(k,S,D);D()}},[k,S,D,T,A]);const N=h.useMemo(()=>({reference:C,floating:E,setReference:x,setFloating:v}),[x,v]),_=h.useMemo(()=>({reference:k,floating:S}),[k,S]),z=h.useMemo(()=>{const P={position:n,left:0,top:0};if(!_.floating)return P;const I=Wc(_.floating,u.x),B=Wc(_.floating,u.y);return a?{...P,transform:"translate("+I+"px, "+B+"px)",...Kf(_.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:B}},[n,a,_.floating,u.x,u.y]);return h.useMemo(()=>({...u,update:D,refs:N,elements:_,floatingStyles:z}),[u,D,N,_,z])}const fv=(e,t)=>{const n=nv(e);return{name:n.name,fn:n.fn,options:[e,t]}},hv=(e,t)=>{const n=sv(e);return{name:n.name,fn:n.fn,options:[e,t]}},mv=(e,t)=>({fn:av(e).fn,options:[e,t]}),pv=(e,t)=>{const n=rv(e);return{name:n.name,fn:n.fn,options:[e,t]}},gv=(e,t)=>{const n=ov(e);return{name:n.name,fn:n.fn,options:[e,t]}},yv=(e,t)=>{const n=iv(e);return{name:n.name,fn:n.fn,options:[e,t]}},bv={intentional:"onClick",sloppy:"onPointerDown"};function xv(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function qf(e,t={}){const n="rootStore"in e?e.rootStore:e,s=n.useState("open"),r=n.useState("floatingElement"),o=n.useState("referenceElement"),i=n.useState("domReferenceElement"),{onOpenChange:a,dataRef:l}=n.context,{enabled:c=!0,escapeKey:u=!0,outsidePress:d=!0,outsidePressEvent:f="sloppy",referencePress:m=!1,referencePressEvent:p="sloppy",ancestorScroll:g=!1,bubbles:b,externalTree:w}=t,x=Ps(w),v=he(typeof d=="function"?d:()=>!1),k=typeof d=="function"?v:d,S=h.useRef(!1),{escapeKey:C,outsidePress:E}=xv(b),M=h.useRef(null),A=Yn(),T=Yn(),R=he(()=>{T.clear(),l.current.insideReactTree=!1}),O=h.useRef(!1),D=h.useRef(""),F=he(L=>{D.current=L.pointerType}),N=he(()=>{const L=D.current,ce=L==="pen"||!L?"mouse":L,te=typeof f=="function"?f():f;return typeof te=="string"?te:te[ce]}),_=he(L=>{if(!s||!c||!u||L.key!=="Escape"||O.current)return;const ce=l.current.floatingContext?.nodeId,te=x?Wn(x.nodesRef.current,ce):[];if(!C&&te.length>0){let se=!0;if(te.forEach(re=>{re.context?.open&&!re.context.dataRef.current.__escapeKeyBubbles&&(se=!1)}),!se)return}const Pe=db(L)?L.nativeEvent:L,U=_e(Vd,Pe);n.setOpen(!1,U),!C&&!U.isPropagationAllowed&&L.stopPropagation()}),z=he(L=>{const ce=N();return ce==="intentional"&&L.type!=="click"||ce==="sloppy"&&L.type==="click"}),P=he(()=>{l.current.insideReactTree=!0,T.start(0,R)}),I=he((L,ce=!1)=>{if(z(L)){R();return}if(l.current.insideReactTree){R();return}if(N()==="intentional"&&ce||typeof k=="function"&&!k(L))return;const te=ht(L),Pe=`[${er("inert")}]`,U=qe(n.select("floatingElement")).querySelectorAll(Pe),se=n.context.triggerElements;if(te&&(se.hasElement(te)||se.hasMatchingElement(ne=>Se(ne,te))))return;let re=Oe(te)?te:null;for(;re&&!Vn(re);){const ne=bs(re);if(Vn(ne)||!Oe(ne))break;re=ne}if(U.length&&Oe(te)&&!cb(te)&&!Se(te,n.select("floatingElement"))&&Array.from(U).every(ne=>!Se(re,ne)))return;if(rt(te)&&!("touches"in L)){const ne=Vn(te),je=Lt(te),be=/auto|scroll/,Be=ne||be.test(je.overflowX),$e=ne||be.test(je.overflowY),ct=Be&&te.clientWidth>0&&te.scrollWidth>te.clientWidth,nt=$e&&te.clientHeight>0&&te.scrollHeight>te.clientHeight,ye=je.direction==="rtl",ve=nt&&(ye?L.offsetX<=te.offsetWidth-te.clientWidth:L.offsetX>te.clientWidth),Ie=ct&&L.offsetY>te.clientHeight;if(ve||Ie)return}const me=l.current.floatingContext?.nodeId,ge=x&&Wn(x.nodesRef.current,me).some(ne=>Dt(L,ne.context?.elements.floating));if(Dt(L,n.select("floatingElement"))||Dt(L,n.select("domReferenceElement"))||ge)return;const Q=x?Wn(x.nodesRef.current,me):[];if(Q.length>0){let ne=!0;if(Q.forEach(je=>{je.context?.open&&!je.context.dataRef.current.__outsidePressBubbles&&(ne=!1)}),!ne)return}n.setOpen(!1,_e(Ld,L)),R()}),B=he(L=>{N()!=="sloppy"||L.pointerType==="touch"||!n.select("open")||!c||Dt(L,n.select("floatingElement"))||Dt(L,n.select("domReferenceElement"))||I(L)}),W=he(L=>{if(N()!=="sloppy"||!n.select("open")||!c||Dt(L,n.select("floatingElement"))||Dt(L,n.select("domReferenceElement")))return;const ce=L.touches[0];ce&&(M.current={startTime:Date.now(),startX:ce.clientX,startY:ce.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},A.start(1e3,()=>{M.current&&(M.current.dismissOnTouchEnd=!1,M.current.dismissOnMouseDown=!1)}))}),J=he(L=>{const ce=ht(L);function te(){W(L),ce?.removeEventListener(L.type,te)}ce?.addEventListener(L.type,te)}),Y=he(L=>{const ce=S.current;if(S.current=!1,A.clear(),L.type==="mousedown"&&M.current&&!M.current.dismissOnMouseDown)return;const te=ht(L);function Pe(){L.type==="pointerdown"?B(L):I(L,ce),te?.removeEventListener(L.type,Pe)}te?.addEventListener(L.type,Pe)}),$=he(L=>{if(N()!=="sloppy"||!M.current||Dt(L,n.select("floatingElement"))||Dt(L,n.select("domReferenceElement")))return;const ce=L.touches[0];if(!ce)return;const te=Math.abs(ce.clientX-M.current.startX),Pe=Math.abs(ce.clientY-M.current.startY),U=Math.sqrt(te*te+Pe*Pe);U>5&&(M.current.dismissOnTouchEnd=!0),U>10&&(I(L),A.clear(),M.current=null)}),K=he(L=>{const ce=ht(L);function te(){$(L),ce?.removeEventListener(L.type,te)}ce?.addEventListener(L.type,te)}),Z=he(L=>{N()!=="sloppy"||!M.current||Dt(L,n.select("floatingElement"))||Dt(L,n.select("domReferenceElement"))||(M.current.dismissOnTouchEnd&&I(L),A.clear(),M.current=null)}),le=he(L=>{const ce=ht(L);function te(){Z(L),ce?.removeEventListener(L.type,te)}ce?.addEventListener(L.type,te)});h.useEffect(()=>{if(!s||!c)return;l.current.__escapeKeyBubbles=C,l.current.__outsidePressBubbles=E;const L=new Sn;function ce(re){n.setOpen(!1,_e(Oy,re))}function te(){L.clear(),O.current=!0}function Pe(){L.start(Da()?5:0,()=>{O.current=!1})}const U=qe(r);U.addEventListener("pointerdown",F,!0),u&&(U.addEventListener("keydown",_),U.addEventListener("compositionstart",te),U.addEventListener("compositionend",Pe)),k&&(U.addEventListener("click",Y,!0),U.addEventListener("pointerdown",Y,!0),U.addEventListener("touchstart",J,!0),U.addEventListener("touchmove",K,!0),U.addEventListener("touchend",le,!0),U.addEventListener("mousedown",Y,!0));let se=[];return g&&(Oe(i)&&(se=fs(i)),Oe(r)&&(se=se.concat(fs(r))),!Oe(o)&&o&&o.contextElement&&(se=se.concat(fs(o.contextElement)))),se=se.filter(re=>re!==U.defaultView?.visualViewport),se.forEach(re=>{re.addEventListener("scroll",ce,{passive:!0})}),()=>{U.removeEventListener("pointerdown",F,!0),u&&(U.removeEventListener("keydown",_),U.removeEventListener("compositionstart",te),U.removeEventListener("compositionend",Pe)),k&&(U.removeEventListener("click",Y,!0),U.removeEventListener("pointerdown",Y,!0),U.removeEventListener("touchstart",J,!0),U.removeEventListener("touchmove",K,!0),U.removeEventListener("touchend",le,!0),U.removeEventListener("mousedown",Y,!0)),se.forEach(re=>{re.removeEventListener("scroll",ce)}),L.clear(),S.current=!1}},[l,r,o,i,u,k,s,a,g,c,C,E,_,I,Y,B,J,K,le,F,n]),h.useEffect(R,[k,R]);const Ce=h.useMemo(()=>({onKeyDown:_,...m&&{[bv[p]]:L=>{n.setOpen(!1,_e(wn,L.nativeEvent))},...p!=="intentional"&&{onClick(L){n.setOpen(!1,_e(wn,L.nativeEvent))}}}}),[_,n,m,p]),Ae=he(L=>{const ce=ht(L.nativeEvent);!Se(n.select("floatingElement"),ce)||L.button!==0||(S.current=!0)}),De=he(L=>{!s||!c||L.button!==0||(S.current=!0)}),tt=h.useMemo(()=>({onKeyDown:_,onPointerDown:Ae,onMouseDown:Ae,onMouseUp:Ae,onClickCapture:P,onMouseDownCapture(L){P(),De(L)},onPointerDownCapture(L){P(),De(L)},onMouseUpCapture:P,onTouchEndCapture:P,onTouchMoveCapture:P}),[_,Ae,P,De]);return h.useMemo(()=>c?{reference:Ce,floating:tt,trigger:Ce}:{},[c,Ce,tt])}const vv={open:pe(e=>e.open),domReferenceElement:pe(e=>e.domReferenceElement),referenceElement:pe(e=>e.positionReference??e.referenceElement),floatingElement:pe(e=>e.floatingElement),floatingId:pe(e=>e.floatingId)};class Ya extends Va{constructor(t){const{nested:n,noEmit:s,onOpenChange:r,triggerElements:o,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Nf(),nested:n,noEmit:s,triggerElements:o},vv)}setOpen=(t,n)=>{if((!t||!this.state.open||Qd(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const s={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",s)}this.context.onOpenChange?.(t,n)}}function wv(e,t=!1,n=!1){const[s,r]=h.useState(e&&t?"idle":void 0),[o,i]=h.useState(e);return e&&!o&&(i(!0),r("starting")),!e&&o&&s!=="ending"&&!n&&r("ending"),!e&&!o&&s==="ending"&&r(void 0),Me(()=>{if(!e&&o&&s!=="ending"&&n){const a=$t.request(()=>{r("ending")});return()=>{$t.cancel(a)}}},[e,o,s,n]),Me(()=>{if(!e||t)return;const a=$t.request(()=>{r(void 0)});return()=>{$t.cancel(a)}},[t,e]),Me(()=>{if(!e||!t)return;e&&o&&s!=="idle"&&r("starting");const a=$t.request(()=>{r("idle")});return()=>{$t.cancel(a)}},[t,e,o,r,s]),h.useMemo(()=>({mounted:o,setMounted:i,transitionStatus:s}),[o,s])}let tr=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const kv={[tr.startingStyle]:""},Sv={[tr.endingStyle]:""},Oo={transitionStatus(e){return e==="starting"?kv:e==="ending"?Sv:null}};function Xf(e,t=!1,n=!0){const s=Wa();return he((r,o=null)=>{s.cancel();function i(){kn.flushSync(r)}const a=ln(e);if(a==null)return;const l=a;if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)r();else{let c=function(){const d=tr.startingStyle;if(!l.hasAttribute(d)){s.request(u);return}const f=new MutationObserver(()=>{l.hasAttribute(d)||(f.disconnect(),u())});f.observe(l,{attributes:!0,attributeFilter:[d]}),o?.addEventListener("abort",()=>f.disconnect(),{once:!0})},u=function(){Promise.all(l.getAnimations().map(d=>d.finished)).then(()=>{o?.aborted||i()}).catch(()=>{const d=l.getAnimations();if(n){if(o?.aborted)return;i()}else d.length>0&&d.some(f=>f.pending||f.playState!=="finished")&&u()})};if(t){c();return}s.request(u)}})}function Ha(e){const{enabled:t=!0,open:n,ref:s,onComplete:r}=e,o=he(r),i=Xf(s,n,!1);h.useEffect(()=>{if(!t)return;const a=new AbortController;return i(o,a.signal),()=>{a.abort()}},[t,n,o,i])}function Tv(e,t){const n=h.useRef(null),s=h.useRef(null);return h.useCallback(r=>{if(e!==void 0){if(n.current!==null){const o=n.current,i=s.current,a=t.context.triggerElements.getById(o);i&&a===i&&t.context.triggerElements.delete(o),n.current=null,s.current=null}r!==null&&(n.current=e,s.current=r,t.context.triggerElements.add(e,r))}},[t,e])}function Cv(e,t,n,s){const r=n.useState("isMountedByTrigger",e),o=Tv(e,n),i=he(a=>{if(o(a),!a||!n.select("open"))return;const l=n.select("activeTriggerId");if(l===e){n.update({activeTriggerElement:a,...s});return}l==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...s})});return Me(()=>{r&&n.update({activeTriggerElement:t.current,...s})},[r,n,t,...Object.values(s)]),{registerTrigger:i,isMountedByThisTrigger:r}}function Zf(e){const t=e.useState("open");Me(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[s,r]=n.value;e.update({activeTriggerId:s,activeTriggerElement:r})}}},[t,e])}function Jf(e,t,n){const{mounted:s,setMounted:r,transitionStatus:o}=wv(e);t.useSyncedValues({mounted:s,transitionStatus:o});const i=he(()=>{r(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return Ha({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:o}}class No{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const s=this.idMap.get(t);s!==n&&(s!==void 0&&this.elements.delete(s),this.elements.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elements.delete(n),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const n of this.elements)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function Mv(){return new Ya({open:!1,floatingElement:null,referenceElement:null,triggerElements:new No,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Qf(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:Mv(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:_n,inactiveTriggerProps:_n,popupProps:_n}}const eh={open:pe(e=>e.open),mounted:pe(e=>e.mounted),transitionStatus:pe(e=>e.transitionStatus),floatingRootContext:pe(e=>e.floatingRootContext),preventUnmountingOnClose:pe(e=>e.preventUnmountingOnClose),payload:pe(e=>e.payload),activeTriggerId:pe(e=>e.activeTriggerId),activeTriggerElement:pe(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:pe((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:pe((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:pe((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:pe((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:pe(e=>e.popupProps),popupElement:pe(e=>e.popupElement),positionerElement:pe(e=>e.positionerElement)};function Ev(e){const{open:t=!1,onOpenChange:n,elements:s={}}=e,r=ur(),o=Xn()!=null,i=Cn(()=>new Ya({open:t,onOpenChange:n,referenceElement:s.reference??null,floatingElement:s.floating??null,triggerElements:s.triggers??new No,floatingId:r,nested:o,noEmit:e.noEmit||!1})).current;return Me(()=>{const a={open:t,floatingId:r};s.reference!==void 0&&(a.referenceElement=s.reference,a.domReferenceElement=Oe(s.reference)?s.reference:null),s.floating!==void 0&&(a.floatingElement=s.floating),i.update(a)},[t,r,s.reference,s.floating,i]),i.context.onOpenChange=n,i.context.nested=o,i.context.noEmit=e.noEmit||!1,i}function Dv(e={}){const{nodeId:t,externalTree:n}=e,s=Ev(e),r=e.rootContext||s,o={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[i,a]=h.useState(null),l=h.useRef(null),c=Ps(n);Me(()=>{o.domReference&&(l.current=o.domReference)},[o.domReference]);const u=dv({...e,elements:{...o,...i&&{reference:i}}}),d=h.useCallback(E=>{const M=Oe(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;a(M),u.refs.setReference(M)},[u.refs]),[f,m]=h.useState(null),[p,g]=h.useState(null);r.useSyncedValue("referenceElement",f),r.useSyncedValue("domReferenceElement",Oe(f)?f:null),r.useSyncedValue("floatingElement",p);const b=h.useCallback(E=>{(Oe(E)||E===null)&&(l.current=E,m(E)),(Oe(u.refs.reference.current)||u.refs.reference.current===null||E!==null&&!Oe(E))&&u.refs.setReference(E)},[u.refs,m]),w=h.useCallback(E=>{g(E),u.refs.setFloating(E)},[u.refs]),x=h.useMemo(()=>({...u.refs,setReference:b,setFloating:w,setPositionReference:d,domReference:l}),[u.refs,b,w,d]),v=h.useMemo(()=>({...u.elements,domReference:o.domReference}),[u.elements,o.domReference]),k=r.useState("open"),S=r.useState("floatingId"),C=h.useMemo(()=>({...u,dataRef:r.context.dataRef,open:k,onOpenChange:r.setOpen,events:r.context.events,floatingId:S,refs:x,elements:v,nodeId:t,rootStore:r}),[u,x,v,t,r,k,S]);return Me(()=>{r.context.dataRef.current.floatingContext=C;const E=c?.nodesRef.current.find(M=>M.id===t);E&&(E.context=C)}),h.useMemo(()=>({...u,context:C,refs:x,elements:v,rootStore:r}),[u,x,v,C,r])}function th(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:s=!1,onOpenChange:r}=e,o=ur(),i=Xn()!=null,a=t.useState("open"),l=t.useState("activeTriggerElement"),c=t.useState(s?"popupElement":"positionerElement"),u=t.context.triggerElements,d=Cn(()=>new Ya({open:a,referenceElement:l,floatingElement:c,triggerElements:u,onOpenChange:r,floatingId:o,nested:i,noEmit:n})).current;return Me(()=>{const f={open:a,floatingId:o,referenceElement:l,floatingElement:c};Oe(l)&&(f.domReferenceElement=l),d.state.positionReference===d.state.referenceElement&&(f.positionReference=l),d.update(f)},[a,o,l,c,d]),d.context.onOpenChange=r,d.context.nested=i,d.context.noEmit=n,d}const ta=er("safe-polygon"),Pv=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Zd}`;function Rv(e){return e?!!e.closest(Pv):!1}function nh(e){const t=h.useRef(void 0),n=h.useRef(!1),s=h.useRef(void 0),r=h.useRef(!0),o=h.useRef(!1),i=h.useRef(()=>{}),a=h.useRef(!1),l=Yn(),c=Yn(),u=h.useRef(void 0);return h.useMemo(()=>{const d=e.context.dataRef.current;return d.hoverInteractionState||(d.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:s,blockMouseMoveRef:r,performedPointerEventsMutationRef:o,unbindMouseMoveRef:i,restTimeoutPendingRef:a,openChangeTimeout:l,restTimeout:c,handleCloseOptionsRef:u}),d.hoverInteractionState},[e,t,n,s,r,o,i,a,l,c,u])}const Av=new Set(["click","mousedown"]);function Ov(e,t={}){const n="rootStore"in e?e.rootStore:e,s=n.useState("open"),r=n.useState("floatingElement"),o=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:a=!0,closeDelay:l=0,externalTree:c}=t,{pointerTypeRef:u,interactedInsideRef:d,handlerRef:f,performedPointerEventsMutationRef:m,unbindMouseMoveRef:p,restTimeoutPendingRef:g,openChangeTimeout:b,handleCloseOptionsRef:w}=nh(n),x=Ps(c),v=Xn(),k=he(()=>d.current?!0:i.current.openEvent?Av.has(i.current.openEvent.type):!1),S=he(()=>{const T=i.current.openEvent?.type;return T?.includes("mouse")&&T!=="mousedown"}),C=h.useCallback((T,R=!0)=>{const O=Nv(l,u.current);O&&!f.current?b.start(O,()=>n.setOpen(!1,_e(ft,T))):R&&(b.clear(),n.setOpen(!1,_e(ft,T)))},[l,f,n,u,b]),E=he(()=>{p.current(),f.current=void 0}),M=he(()=>{if(m.current){const T=qe(r).body;T.style.pointerEvents="",T.removeAttribute(ta),m.current=!1}}),A=he(T=>{const R=ht(T);if(!Rv(R)){d.current=!1;return}d.current=!0});Me(()=>{s||(u.current=void 0,g.current=!1,d.current=!1,E(),M())},[s,u,g,d,E,M]),h.useEffect(()=>()=>{E()},[E]),h.useEffect(()=>M,[M]),Me(()=>{if(a&&s&&w.current?.blockPointerEvents&&S()&&Oe(o)&&r){m.current=!0;const T=qe(r).body;T.setAttribute(ta,"");const R=o,O=r,D=x?.nodesRef.current.find(F=>F.id===v)?.context?.elements.floating;return D&&(D.style.pointerEvents=""),T.style.pointerEvents="none",R.style.pointerEvents="auto",O.style.pointerEvents="auto",()=>{T.style.pointerEvents="",R.style.pointerEvents="",O.style.pointerEvents=""}}},[a,s,o,r,w,S,x,v,m]),h.useEffect(()=>{if(!a)return;function T(F){if(k()||!i.current.floatingContext||!n.select("open"))return;const N=n.context.triggerElements;F.relatedTarget&&N.hasElement(F.relatedTarget)||(M(),E(),k()||C(F))}function R(F){b.clear(),M(),f.current?.(F),E()}function O(F){k()||C(F,!1)}const D=r;return D&&(D.addEventListener("mouseleave",T),D.addEventListener("mouseenter",R),D.addEventListener("mouseleave",O),D.addEventListener("pointerdown",A,!0)),()=>{D&&(D.removeEventListener("mouseleave",T),D.removeEventListener("mouseenter",R),D.removeEventListener("mouseleave",O),D.removeEventListener("pointerdown",A,!0))}})}function Nv(e,t){return t&&!xs(t)?0:typeof e=="function"?e():e}function xi(e){return typeof e=="function"?e():e}const jv={current:null};function Iv(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:s,events:r}=n.context,{enabled:o=!0,delay:i=0,handleClose:a=null,mouseOnly:l=!1,restMs:c=0,move:u=!0,triggerElementRef:d=jv,externalTree:f,isActiveTrigger:m=!0}=t,p=Ps(f),{pointerTypeRef:g,interactedInsideRef:b,handlerRef:w,blockMouseMoveRef:x,performedPointerEventsMutationRef:v,unbindMouseMoveRef:k,restTimeoutPendingRef:S,openChangeTimeout:C,restTimeout:E,handleCloseOptionsRef:M}=nh(n),A=Ht(a),T=Ht(i),R=Ht(c);m&&(M.current=A.current?.__options);const O=he(()=>b.current?!0:s.current.openEvent?["click","mousedown"].includes(s.current.openEvent.type):!1),D=h.useCallback((z,P=!0)=>{const I=hi(T.current,"close",g.current);I&&!w.current?C.start(I,()=>n.setOpen(!1,_e(ft,z))):P&&(C.clear(),n.setOpen(!1,_e(ft,z)))},[T,w,n,g,C]),F=he(()=>{k.current(),w.current=void 0}),N=he(()=>{if(v.current){const z=qe(n.select("domReferenceElement")).body;z.style.pointerEvents="",z.removeAttribute(ta),v.current=!1}});h.useEffect(()=>{if(!o)return;function z(P){P.open||(C.clear(),E.clear(),x.current=!0,S.current=!1)}return r.on("openchange",z),()=>{r.off("openchange",z)}},[o,r,C,E,x,S]);const _=he(z=>{if(O()||!s.current.floatingContext)return;const P=n.context.triggerElements;if(z.relatedTarget&&P.hasElement(z.relatedTarget))return;const I=d.current;A.current?.({...s.current.floatingContext,tree:p,x:z.clientX,y:z.clientY,onClose(){N(),F(),!O()&&I===n.select("domReferenceElement")&&D(z)}})(z)});return h.useEffect(()=>{if(!o)return;const z=d.current??(m?n.select("domReferenceElement"):null);if(!Oe(z))return;function P(W){if(C.clear(),x.current=!1,l&&!xs(g.current)||xi(R.current)>0&&!hi(T.current,"open"))return;const J=hi(T.current,"open",g.current),Y=n.select("domReferenceElement"),$=n.context.triggerElements,K=($.hasElement(W.target)||$.hasMatchingElement(Ae=>Se(Ae,W.target)))&&(!Y||!Se(Y,W.target)),Z=W.currentTarget??null,le=n.select("open"),Ce=!le||K;K&&le?n.setOpen(!0,_e(ft,W,Z)):J?C.start(J,()=>{Ce&&n.setOpen(!0,_e(ft,W,Z))}):Ce&&n.setOpen(!0,_e(ft,W,Z))}function I(W){if(O()){N();return}k.current();const J=n.select("domReferenceElement"),Y=qe(J);E.clear(),S.current=!1;const $=n.context.triggerElements;if(W.relatedTarget&&$.hasElement(W.relatedTarget))return;if(A.current&&s.current.floatingContext){n.select("open")||C.clear();const Z=d.current;w.current=A.current({...s.current.floatingContext,tree:p,x:W.clientX,y:W.clientY,onClose(){N(),F(),!O()&&Z===n.select("domReferenceElement")&&D(W,!0)}});const le=w.current;le(W),Y.addEventListener("mousemove",le),k.current=()=>{Y.removeEventListener("mousemove",le)};return}(g.current!=="touch"||!Se(n.select("floatingElement"),W.relatedTarget))&&D(W)}function B(W){_(W)}return n.select("open")&&z.addEventListener("mouseleave",B),u&&z.addEventListener("mousemove",P,{once:!0}),z.addEventListener("mouseenter",P),z.addEventListener("mouseleave",I),()=>{z.removeEventListener("mouseleave",B),u&&z.removeEventListener("mousemove",P),z.removeEventListener("mouseenter",P),z.removeEventListener("mouseleave",I)}},[F,N,x,s,T,D,n,o,A,_,m,O,l,u,g,R,E,S,C,d,p,k,w]),h.useMemo(()=>{function z(P){g.current=P.pointerType}return{onPointerDown:z,onPointerEnter:z,onMouseMove(P){const{nativeEvent:I}=P,B=P.currentTarget,W=n.select("domReferenceElement"),J=n.context.triggerElements,Y=n.select("open"),$=(J.hasElement(P.target)||J.hasMatchingElement(Z=>Se(Z,P.target)))&&(!W||!Se(W,P.target));if(l&&!xs(g.current)||Y&&!$||xi(R.current)===0||!$&&S.current&&P.movementX**2+P.movementY**2<2)return;E.clear();function K(){if(S.current=!1,O())return;const Z=n.select("open");!x.current&&(!Z||$)&&n.setOpen(!0,_e(ft,I,B))}g.current==="touch"?kn.flushSync(()=>{K()}):$&&Y?K():(S.current=!0,E.start(xi(R.current),K))}}},[x,O,l,n,g,R,E,S])}function Ua(e=[]){const t=e.map(c=>c?.reference),n=e.map(c=>c?.floating),s=e.map(c=>c?.item),r=e.map(c=>c?.trigger),o=h.useCallback(c=>$r(c,e,"reference"),t),i=h.useCallback(c=>$r(c,e,"floating"),n),a=h.useCallback(c=>$r(c,e,"item"),s),l=h.useCallback(c=>$r(c,e,"trigger"),r);return h.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:a,getTriggerProps:l}),[o,i,a,l])}function $r(e,t,n){const s=new Map,r=n==="item",o={};n==="floating"&&(o.tabIndex=-1,o[Ki]="");for(const i in e)r&&e&&(i===qd||i===Xd)||(o[i]=e[i]);for(let i=0;i<t.length;i+=1){let a;const l=t[i]?.[n];typeof l=="function"?a=e?l(e):null:a=l,a&&Bc(o,a,r,s)}return Bc(o,e,r,s),o}function Bc(e,t,n,s){for(const r in t){const o=t[r];n&&(r===qd||r===Xd)||(r.startsWith("on")?(s.has(r)||s.set(r,[]),typeof o=="function"&&(s.get(r)?.push(o),e[r]=(...i)=>s.get(r)?.map(a=>a(...i)).find(a=>a!==void 0))):e[r]=o)}}const Fv=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function sh(e,t={}){const n="rootStore"in e?e.rootStore:e,s=n.useState("open"),r=n.useState("floatingId"),o=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{enabled:a=!0,role:l="dialog"}=t,c=ur(),u=o?.id||c,d=h.useMemo(()=>qi(i)?.id||r,[i,r]),f=Fv.get(l)??l,p=Xn()!=null,g=h.useMemo(()=>f==="tooltip"||l==="label"?_n:{"aria-haspopup":f==="alertdialog"?"dialog":f,"aria-expanded":"false",...f==="listbox"&&{role:"combobox"},...f==="menu"&&p&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[f,p,l]),b=h.useMemo(()=>f==="tooltip"||l==="label"?{[`aria-${l==="label"?"labelledby":"describedby"}`]:s?d:void 0}:{...g,"aria-expanded":s?"true":"false","aria-controls":s?d:void 0,...f==="menu"&&{id:u}},[f,d,s,u,l,g]),w=h.useMemo(()=>{const v={id:d,...f&&{role:f}};return f==="tooltip"||l==="label"?v:{...v,...f==="menu"&&{"aria-labelledby":u}}},[f,d,u,l]),x=h.useCallback(({active:v,selected:k})=>{const S={role:"option",...v&&{id:`${d}-fui-option`}};switch(l){case"select":case"combobox":return{...S,"aria-selected":k}}return{}},[d,l]);return h.useMemo(()=>a?{reference:b,floating:w,item:x,trigger:g}:{},[a,b,w,g,x])}function $c(e,t){const[n,s]=e;let r=!1;const o=t.length;for(let i=0,a=o-1;i<o;a=i++){const[l,c]=t[i]||[0,0],[u,d]=t[a]||[0,0];c>=s!=d>=s&&n<=(u-l)*(s-c)/(d-c)+l&&(r=!r)}return r}function Lv(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function _v(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:s=!0}=e,r=new Sn;let o=!1,i=null,a=null,l=typeof performance<"u"?performance.now():0;function c(d,f){const m=performance.now(),p=m-l;if(i===null||a===null||p===0)return i=d,a=f,l=m,null;const g=d-i,b=f-a,x=Math.sqrt(g*g+b*b)/p;return i=d,a=f,l=m,x}const u=({x:d,y:f,placement:m,elements:p,onClose:g,nodeId:b,tree:w})=>function(v){function k(){r.clear(),g()}if(r.clear(),!p.domReference||!p.floating||m==null||d==null||f==null)return;const{clientX:S,clientY:C}=v,E=[S,C],M=ht(v),A=v.type==="mouseleave",T=Se(p.floating,M),R=Se(p.domReference,M),O=p.domReference.getBoundingClientRect(),D=p.floating.getBoundingClientRect(),F=m.split("-")[0],N=d>D.right-D.width/2,_=f>D.bottom-D.height/2,z=Lv(E,O),P=D.width>O.width,I=D.height>O.height,B=(P?O:D).left,W=(P?O:D).right,J=(I?O:D).top,Y=(I?O:D).bottom;if(T&&(o=!0,!A))return;if(R&&(o=!1),R&&!A){o=!0;return}if(A&&Oe(v.relatedTarget)&&Se(p.floating,v.relatedTarget)||w&&Wn(w.nodesRef.current,b).some(({context:Z})=>Z?.open))return;if(F==="top"&&f>=O.bottom-1||F==="bottom"&&f<=O.top+1||F==="left"&&d>=O.right-1||F==="right"&&d<=O.left+1)return k();let $=[];switch(F){case"top":$=[[B,O.top+1],[B,D.bottom-1],[W,D.bottom-1],[W,O.top+1]];break;case"bottom":$=[[B,D.top+1],[B,O.bottom-1],[W,O.bottom-1],[W,D.top+1]];break;case"left":$=[[D.right-1,Y],[D.right-1,J],[O.left+1,J],[O.left+1,Y]];break;case"right":$=[[O.right-1,Y],[O.right-1,J],[D.left+1,J],[D.left+1,Y]];break}function K([Z,le]){switch(F){case"top":{const Ce=[P?Z+t/2:N?Z+t*4:Z-t*4,le+t+1],Ae=[P?Z-t/2:N?Z+t*4:Z-t*4,le+t+1],De=[[D.left,N||P?D.bottom-t:D.top],[D.right,N?P?D.bottom-t:D.top:D.bottom-t]];return[Ce,Ae,...De]}case"bottom":{const Ce=[P?Z+t/2:N?Z+t*4:Z-t*4,le-t],Ae=[P?Z-t/2:N?Z+t*4:Z-t*4,le-t],De=[[D.left,N||P?D.top+t:D.bottom],[D.right,N?P?D.top+t:D.bottom:D.top+t]];return[Ce,Ae,...De]}case"left":{const Ce=[Z+t+1,I?le+t/2:_?le+t*4:le-t*4],Ae=[Z+t+1,I?le-t/2:_?le+t*4:le-t*4];return[...[[_||I?D.right-t:D.left,D.top],[_?I?D.right-t:D.left:D.right-t,D.bottom]],Ce,Ae]}case"right":{const Ce=[Z-t,I?le+t/2:_?le+t*4:le-t*4],Ae=[Z-t,I?le-t/2:_?le+t*4:le-t*4],De=[[_||I?D.left+t:D.right,D.top],[_?I?D.left+t:D.right:D.left+t,D.bottom]];return[Ce,Ae,...De]}default:return[]}}if(!$c([S,C],$)){if(o&&!z)return k();if(!A&&s){const Z=c(v.clientX,v.clientY);if(Z!==null&&Z<.1)return k()}$c([S,C],K([d,f]))?!o&&s&&r.start(40,k):k()}};return u.__options={blockPointerEvents:n},u}function Vv(e){const t=h.useRef(""),n=h.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:h.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r&&e(r,r.pointerType),e(r,t.current),t.current=""},[e]),onPointerDown:n}}function rh(e){const[t,n]=h.useState(null),s=he((a,l)=>{e||n(l||(Kd?"touch":""))}),r=h.useCallback(()=>{n(null)},[]),{onClick:o,onPointerDown:i}=Vv(s);return h.useMemo(()=>({openMethod:t,reset:r,triggerProps:{onClick:o,onPointerDown:i}}),[t,r,o,i])}let jt=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=tr.startingStyle]="startingStyle",e[e.endingStyle=tr.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),na=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const Wv={[na.popupOpen]:""},Bv={[na.popupOpen]:"",[na.pressed]:""},$v={[jt.open]:""},Yv={[jt.closed]:""},Hv={[jt.anchorHidden]:""},Uv={open(e){return e?Wv:null}},zv={open(e){return e?Bv:null}},pr={open(e){return e?$v:Yv},anchorHidden(e){return e?Hv:null}};function oh(e){return Id(19)?e:e?"true":void 0}let Yc={},Hc={},Uc="";function Gv(e){if(typeof document>"u")return!1;const t=Gn(e);return wt(t).innerWidth-t.documentElement.clientWidth>0}function Kv(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const s=Gn(e).documentElement,r={scrollbarGutter:s.style.scrollbarGutter,overflowY:s.style.overflowY};s.style.scrollbarGutter="stable",s.style.overflowY="scroll";const o=s.offsetWidth;s.style.overflowY="hidden";const i=s.offsetWidth;return Object.assign(s.style,r),o===i}function qv(e){const t=Gn(e),n=t.documentElement,s=t.body,r=fr(n)?n:s,o=r.style.overflow;return r.style.overflow="hidden",()=>{r.style.overflow=o}}function Xv(e){const t=Gn(e),n=t.documentElement,s=t.body,r=wt(n);let o=0,i=0,a=!1;const l=$t.create();if(sb&&(r.visualViewport?.scale??1)!==1)return()=>{};function c(){const f=r.getComputedStyle(n),m=r.getComputedStyle(s),b=(f.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,Yc={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Uc=n.style.scrollBehavior,Hc={position:s.style.position,height:s.style.height,width:s.style.width,boxSizing:s.style.boxSizing,overflowY:s.style.overflowY,overflowX:s.style.overflowX,scrollBehavior:s.style.scrollBehavior};const w=n.scrollHeight>n.clientHeight,x=n.scrollWidth>n.clientWidth,v=f.overflowY==="scroll"||m.overflowY==="scroll",k=f.overflowX==="scroll"||m.overflowX==="scroll",S=Math.max(0,r.innerWidth-s.clientWidth),C=Math.max(0,r.innerHeight-s.clientHeight),E=parseFloat(m.marginTop)+parseFloat(m.marginBottom),M=parseFloat(m.marginLeft)+parseFloat(m.marginRight),A=fr(n)?n:s;if(a=Kv(e),a){n.style.scrollbarGutter=b,A.style.overflowY="hidden",A.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:b,overflowY:"hidden",overflowX:"hidden"}),(w||v)&&(n.style.overflowY="scroll"),(x||k)&&(n.style.overflowX="scroll"),Object.assign(s.style,{position:"relative",height:E||C?`calc(100dvh - ${E+C}px)`:"100dvh",width:M||S?`calc(100vw - ${M+S}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),s.scrollTop=o,s.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function u(){Object.assign(n.style,Yc),Object.assign(s.style,Hc),a||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Uc)}function d(){u(),l.request(c)}return c(),r.addEventListener("resize",d),()=>{l.cancel(),u(),typeof r.removeEventListener=="function"&&r.removeEventListener("resize",d)}}class Zv{lockCount=0;restore=null;timeoutLock=Sn.create();timeoutUnlock=Sn.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const s=Gn(t).documentElement,r=wt(s).getComputedStyle(s).overflowY;if(r==="hidden"||r==="clip"){this.restore=Fd;return}const o=Kd||!Gv(t);this.restore=o?qv(t):Xv(t)}}const Jv=new Zv;function ih(e=!0,t=null){Me(()=>{if(e)return Jv.acquire(t)},[e,t])}const Qv=h.createContext(void 0);function ew(){return h.useContext(Qv)?.direction??"ltr"}const tw=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:o,platform:i,elements:a,middlewareData:l}=t,{element:c,padding:u=0,offsetParent:d="real"}=dn(e,t)||{};if(c==null)return{};const f=ef(u),m={x:n,y:s},p=ja(r),g=Na(p),b=await i.getDimensions(c),w=p==="y",x=w?"top":"left",v=w?"bottom":"right",k=w?"clientHeight":"clientWidth",S=o.reference[g]+o.reference[p]-m[p]-o.floating[g],C=m[p]-o.reference[p],E=d==="real"?await i.getOffsetParent?.(c):a.floating;let M=a.floating[k]||o.floating[g];(!M||!await i.isElement?.(E))&&(M=a.floating[k]||o.floating[g]);const A=S/2-C/2,T=M/2-b[g]/2-1,R=Math.min(f[x],T),O=Math.min(f[v],T),D=R,F=M-b[g]-O,N=M/2-b[g]/2+A,_=Xi(D,N,F),z=!l.arrow&&Mn(r)!=null&&N!==_&&o.reference[g]/2-(N<D?R:O)-b[g]/2<0,P=z?N<D?N-D:N-F:0;return{[p]:m[p]+P,data:{[p]:_,centerOffset:N-_-P,...z&&{alignmentOffset:P}},reset:z}}}),nw=(e,t)=>({...tw(e),options:[e,t]}),sw={name:"hide",async fn(e){const{width:t,height:n,x:s,y:r}=e.rects.reference,o=t===0&&n===0&&s===0&&r===0;return{data:{referenceHidden:(await yv().fn(e)).data?.referenceHidden||o}}}},Xr={sideX:"left",sideY:"top"},rw={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:s},elements:{floating:r},platform:o,strategy:i,placement:a}=e,l=wt(r),c=l.getComputedStyle(r);if(!(c.transitionDuration!=="0s"&&c.transitionDuration!==""))return{x:t,y:n,data:Xr};const d=await o.getOffsetParent?.(r);let f={width:0,height:0};if(i==="fixed"&&l?.visualViewport)f={width:l.visualViewport.width,height:l.visualViewport.height};else if(d===l){const x=Gn(r);f={width:x.documentElement.clientWidth,height:x.documentElement.clientHeight}}else await o.isElement?.(d)&&(f=await o.getDimensions(d));const m=at(a);let p=t,g=n;m==="left"&&(p=f.width-(t+s.width)),m==="top"&&(g=f.height-(n+s.height));const b=m==="left"?"right":Xr.sideX,w=m==="top"?"bottom":Xr.sideY;return{x:p,y:g,data:{sideX:b,sideY:w}}}};function ah(e,t,n){const s=e==="inline-start"||e==="inline-end";return{top:"top",right:s?n?"inline-start":"inline-end":"right",bottom:"bottom",left:s?n?"inline-end":"inline-start":"left"}[t]}function zc(e,t,n){const{rects:s,placement:r}=e;return{side:ah(t,at(r),n),align:Mn(r)||"center",anchor:{width:s.reference.width,height:s.reference.height},positioner:{width:s.floating.width,height:s.floating.height}}}function ow(e){const{anchor:t,positionMethod:n="absolute",side:s="bottom",sideOffset:r=0,align:o="center",alignOffset:i=0,collisionBoundary:a,collisionPadding:l=5,sticky:c=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:m,mounted:p,collisionAvoidance:g,shiftCrossAxis:b=!1,nodeId:w,adaptiveOrigin:x,lazyFlip:v=!1,externalTree:k}=e,[S,C]=h.useState(null);!p&&S!==null&&C(null);const E=g.side||"flip",M=g.align||"flip",A=g.fallbackAxisSide||"end",T=typeof t=="function"?t:void 0,R=he(T),O=T?R:t,D=Ht(t),N=ew()==="rtl",_=S||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":N?"left":"right","inline-start":N?"right":"left"}[s],z=o==="center"?_:`${_}-${o}`;let P=l;const I=1,B=s==="bottom"?I:0,W=s==="top"?I:0,J=s==="right"?I:0,Y=s==="left"?I:0;typeof P=="number"?P={top:P+B,right:P+Y,bottom:P+W,left:P+J}:P&&(P={top:(P.top||0)+B,right:(P.right||0)+Y,bottom:(P.bottom||0)+W,left:(P.left||0)+J});const $={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:P},K=h.useRef(null),Z=Ht(r),le=Ht(i),De=[fv(xe=>{const Ye=zc(xe,s,N),oe=typeof Z.current=="function"?Z.current(Ye):Z.current,ue=typeof le.current=="function"?le.current(Ye):le.current;return{mainAxis:oe,crossAxis:ue,alignmentAxis:ue}},[typeof r!="function"?r:0,typeof i!="function"?i:0,N,s])],tt=M==="none"&&E!=="shift",L=!tt&&(c||b||E==="shift"),ce=E==="none"?null:pv({...$,padding:{top:P.top+I,right:P.right+I,bottom:P.bottom+I,left:P.left+I},mainAxis:!b&&E==="flip",crossAxis:M==="flip"?"alignment":!1,fallbackAxisSideDirection:A}),te=tt?null:hv(xe=>{const Ye=Gn(xe.elements.floating).documentElement;return{...$,rootBoundary:b?{x:0,y:0,width:Ye.clientWidth,height:Ye.clientHeight}:void 0,mainAxis:M!=="none",crossAxis:L,limiter:c||b?void 0:mv(oe=>{if(!K.current)return{};const{width:ue,height:H}=K.current.getBoundingClientRect(),fe=bt(at(oe.placement)),we=fe==="y"?ue:H,de=fe==="y"?P.left+P.right:P.top+P.bottom;return{offset:we/2+de/2}})}},[$,c,b,P,M]);E==="shift"||M==="shift"||o==="center"?De.push(te,ce):De.push(ce,te),De.push(gv({...$,apply({elements:{floating:xe},rects:{reference:Ye},availableWidth:oe,availableHeight:ue}){Object.entries({"--available-width":`${oe}px`,"--available-height":`${ue}px`,"--anchor-width":`${Ye.width}px`,"--anchor-height":`${Ye.height}px`}).forEach(([H,fe])=>{xe.style.setProperty(H,fe)})}}),nw(()=>({element:K.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(xe){const{elements:Ye,middlewareData:oe,placement:ue,rects:H,y:fe}=xe,we=at(ue),de=bt(we),Jt=K.current,Qt=oe.arrow?.x||0,Dn=oe.arrow?.y||0,en=Jt?.clientWidth||0,tn=Jt?.clientHeight||0,Jn=Qt+en/2,nn=Dn+tn/2,Er=Math.abs(oe.shift?.y||0),Vt=H.reference.height/2,ze=typeof r=="function"?r(zc(xe,s,N)):r,$o=Er>ze,Dr={top:`${Jn}px calc(100% + ${ze}px)`,bottom:`${Jn}px ${-ze}px`,left:`calc(100% + ${ze}px) ${nn}px`,right:`${-ze}px ${nn}px`}[we],Yo=`${Jn}px ${H.reference.y+Vt-fe}px`;return Ye.floating.style.setProperty("--transform-origin",L&&de==="y"&&$o?Yo:Dr),{}}},sw,x),Me(()=>{!p&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[p,m]);const Pe=h.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:U,elements:se,x:re,y:me,middlewareData:ge,update:Q,placement:ne,context:je,isPositioned:be,floatingStyles:Be}=Dv({rootContext:m,placement:z,middleware:De,strategy:n,whileElementsMounted:f?void 0:(...xe)=>Vc(...xe,Pe),nodeId:w,externalTree:k}),{sideX:$e,sideY:ct}=ge.adaptiveOrigin||Xr,nt=be?n:"fixed",ye=h.useMemo(()=>x?{position:nt,[$e]:re,[ct]:me}:{position:nt,...Be},[x,nt,$e,re,ct,me,Be]),ve=h.useRef(null);Me(()=>{if(!p)return;const xe=D.current,Ye=typeof xe=="function"?xe():xe,ue=(Gc(Ye)?Ye.current:Ye)||null||null;ue!==ve.current&&(U.setPositionReference(ue),ve.current=ue)},[p,U,O,D]),h.useEffect(()=>{if(!p)return;const xe=D.current;typeof xe!="function"&&Gc(xe)&&xe.current!==ve.current&&(U.setPositionReference(xe.current),ve.current=xe.current)},[p,U,O,D]),h.useEffect(()=>{if(f&&p&&se.domReference&&se.floating)return Vc(se.domReference,se.floating,Q,Pe)},[f,p,se,Q,Pe]);const Ie=at(ne),ut=ah(s,Ie,N),_t=Mn(ne)||"center",Tt=!!ge.hide?.referenceHidden;Me(()=>{v&&p&&be&&C(Ie)},[v,p,be,Ie]);const st=h.useMemo(()=>({position:"absolute",top:ge.arrow?.y,left:ge.arrow?.x}),[ge.arrow]),pn=ge.arrow?.centerOffset!==0;return h.useMemo(()=>({positionerStyles:ye,arrowStyles:st,arrowRef:K,arrowUncentered:pn,side:ut,align:_t,physicalSide:Ie,anchorHidden:Tt,refs:U,context:je,isPositioned:be,update:Q}),[ye,st,K,pn,ut,_t,Ie,Tt,U,je,be,Q])}function Gc(e){return e!=null&&"current"in e}const lh=h.forwardRef(function(t,n){const{cutout:s,...r}=t;let o;if(s){const i=s?.getBoundingClientRect();o=`polygon(
2
+ 0% 0%,
3
+ 100% 0%,
4
+ 100% 100%,
5
+ 0% 100%,
6
+ 0% 0%,
7
+ ${i.left}px ${i.top}px,
8
+ ${i.left}px ${i.bottom}px,
9
+ ${i.right}px ${i.bottom}px,
10
+ ${i.right}px ${i.top}px,
11
+ ${i.left}px ${i.top}px
12
+ )`}return y.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})}),iw=h.createContext(void 0);function aw(e){return h.useContext(iw)}const ch="ArrowUp",uh="ArrowDown",dh="ArrowLeft",fh="ArrowRight",hh="Home",mh="End",lw=new Set([dh,fh]),cw=new Set([ch,uh]),uw=new Set([...lw,...cw]);[...uw];const ph=new Set([ch,uh,dh,fh,hh,mh]);function gh(e){return e==="starting"?Qy:_n}function dw({prefersReducedMotion:e,screenshotCapture:t}){return!(t||e)}const za=h.createContext({});function gr(e){const t=h.useRef(null);return t.current===null&&(t.current=e()),t.current}const fw=typeof window<"u",Ga=fw?h.useLayoutEffect:h.useEffect,jo=h.createContext(null);function Ka(e,t){e.indexOf(t)===-1&&e.push(t)}function vo(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const qt=(e,t,n)=>n>t?t:n<e?e:n;let qa=()=>{};const Tn={},yh=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function bh(e){return typeof e=="object"&&e!==null}const xh=e=>/^0[^.\s]+$/u.test(e);function vh(e){let t;return()=>(t===void 0&&(t=e()),t)}const kt=e=>e,hw=(e,t)=>n=>t(e(n)),yr=(...e)=>e.reduce(hw),nr=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s};class Xa{constructor(){this.subscriptions=[]}add(t){return Ka(this.subscriptions,t),()=>vo(this.subscriptions,t)}notify(t,n,s){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](t,n,s);else for(let o=0;o<r;o++){const i=this.subscriptions[o];i&&i(t,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const pt=e=>e*1e3,xt=e=>e/1e3;function wh(e,t){return t?e*(1e3/t):0}const kh=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,mw=1e-7,pw=12;function gw(e,t,n,s,r){let o,i,a=0;do i=t+(n-t)/2,o=kh(i,s,r)-e,o>0?n=i:t=i;while(Math.abs(o)>mw&&++a<pw);return i}function br(e,t,n,s){if(e===t&&n===s)return kt;const r=o=>gw(o,0,1,e,n);return o=>o===0||o===1?o:kh(r(o),t,s)}const Sh=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Th=e=>t=>1-e(1-t),Ch=br(.33,1.53,.69,.99),Za=Th(Ch),Mh=Sh(Za),Eh=e=>e>=1?1:(e*=2)<1?.5*Za(e):.5*(2-Math.pow(2,-10*(e-1))),Ja=e=>1-Math.sin(Math.acos(e)),Dh=Th(Ja),Ph=Sh(Ja),yw=br(.42,0,1,1),bw=br(0,0,.58,1),Rh=br(.42,0,.58,1),xw=e=>Array.isArray(e)&&typeof e[0]!="number",Ah=e=>Array.isArray(e)&&typeof e[0]=="number",vw={linear:kt,easeIn:yw,easeInOut:Rh,easeOut:bw,circIn:Ja,circInOut:Ph,circOut:Dh,backIn:Za,backInOut:Mh,backOut:Ch,anticipate:Eh},ww=e=>typeof e=="string",Kc=e=>{if(Ah(e)){qa(e.length===4);const[t,n,s,r]=e;return br(t,n,s,r)}else if(ww(e))return vw[e];return e},Yr=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function kw(e,t){let n=new Set,s=new Set,r=!1,o=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){i.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&r?n:s;return d&&i.add(u),p.add(u),u},cancel:u=>{s.delete(u),i.delete(u)},process:u=>{if(a=u,r){o=!0;return}r=!0;const d=n;n=s,s=d,n.forEach(l),n.clear(),r=!1,o&&(o=!1,c.process(u))}};return c}const Sw=40;function Oh(e,t){let n=!1,s=!0;const r={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,i=Yr.reduce((v,k)=>(v[k]=kw(o),v),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:f,render:m,postRender:p}=i,g=()=>{const v=Tn.useManualTiming,k=v?r.timestamp:performance.now();n=!1,v||(r.delta=s?1e3/60:Math.max(Math.min(k-r.timestamp,Sw),1)),r.timestamp=k,r.isProcessing=!0,a.process(r),l.process(r),c.process(r),u.process(r),d.process(r),f.process(r),m.process(r),p.process(r),r.isProcessing=!1,n&&t&&(s=!1,e(g))},b=()=>{n=!0,s=!0,r.isProcessing||e(g)};return{schedule:Yr.reduce((v,k)=>{const S=i[k];return v[k]=(C,E=!1,M=!1)=>(n||b(),S.schedule(C,E,M)),v},{}),cancel:v=>{for(let k=0;k<Yr.length;k++)i[Yr[k]].cancel(v)},state:r,steps:i}}const{schedule:Te,cancel:fn,state:Ze,steps:vi}=Oh(typeof requestAnimationFrame<"u"?requestAnimationFrame:kt,!0);let Zr;function Tw(){Zr=void 0}const ot={now:()=>(Zr===void 0&&ot.set(Ze.isProcessing||Tn.useManualTiming?Ze.timestamp:performance.now()),Zr),set:e=>{Zr=e,queueMicrotask(Tw)}},Nh=e=>t=>typeof t=="string"&&t.startsWith(e),jh=Nh("--"),Cw=Nh("var(--"),Qa=e=>Cw(e)?Mw.test(e.split("/*")[0].trim()):!1,Mw=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function qc(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Rs={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},sr={...Rs,transform:e=>qt(0,1,e)},Hr={...Rs,default:1},Gs=e=>Math.round(e*1e5)/1e5,el=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Ew(e){return e==null}const Dw=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,tl=(e,t)=>n=>!!(typeof n=="string"&&Dw.test(n)&&n.startsWith(e)||t&&!Ew(n)&&Object.prototype.hasOwnProperty.call(n,t)),Ih=(e,t,n)=>s=>{if(typeof s!="string")return s;const[r,o,i,a]=s.match(el);return{[e]:parseFloat(r),[t]:parseFloat(o),[n]:parseFloat(i),alpha:a!==void 0?parseFloat(a):1}},Pw=e=>qt(0,255,e),wi={...Rs,transform:e=>Math.round(Pw(e))},In={test:tl("rgb","red"),parse:Ih("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+wi.transform(e)+", "+wi.transform(t)+", "+wi.transform(n)+", "+Gs(sr.transform(s))+")"};function Rw(e){let t="",n="",s="",r="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),r=e.substring(4,5),t+=t,n+=n,s+=s,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:r?parseInt(r,16)/255:1}}const sa={test:tl("#"),parse:Rw,transform:In.transform},xr=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),yn=xr("deg"),Kt=xr("%"),ee=xr("px"),Aw=xr("vh"),Ow=xr("vw"),Xc={...Kt,parse:e=>Kt.parse(e)/100,transform:e=>Kt.transform(e*100)},cs={test:tl("hsl","hue"),parse:Ih("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+Kt.transform(Gs(t))+", "+Kt.transform(Gs(n))+", "+Gs(sr.transform(s))+")"},He={test:e=>In.test(e)||sa.test(e)||cs.test(e),parse:e=>In.test(e)?In.parse(e):cs.test(e)?cs.parse(e):sa.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?In.transform(e):cs.transform(e),getAnimatableNone:e=>{const t=He.parse(e);return t.alpha=0,He.transform(t)}},Nw=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function jw(e){return isNaN(e)&&typeof e=="string"&&(e.match(el)?.length||0)+(e.match(Nw)?.length||0)>0}const Fh="number",Lh="color",Iw="var",Fw="var(",Zc="${}",Lw=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ts(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},r=[];let o=0;const a=t.replace(Lw,l=>(He.test(l)?(s.color.push(o),r.push(Lh),n.push(He.parse(l))):l.startsWith(Fw)?(s.var.push(o),r.push(Iw),n.push(l)):(s.number.push(o),r.push(Fh),n.push(parseFloat(l))),++o,Zc)).split(Zc);return{values:n,split:a,indexes:s,types:r}}function _w(e){return Ts(e).values}function _h({split:e,types:t}){const n=e.length;return s=>{let r="";for(let o=0;o<n;o++)if(r+=e[o],s[o]!==void 0){const i=t[o];i===Fh?r+=Gs(s[o]):i===Lh?r+=He.transform(s[o]):r+=s[o]}return r}}function Vw(e){return _h(Ts(e))}const Ww=e=>typeof e=="number"?0:He.test(e)?He.getAnimatableNone(e):e,Bw=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:Ww(e);function $w(e){const t=Ts(e);return _h(t)(t.values.map((s,r)=>Bw(s,t.split[r])))}const Ft={test:jw,parse:_w,createTransformer:Vw,getAnimatableNone:$w};function ki(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Yw({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let r=0,o=0,i=0;if(!t)r=o=i=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=ki(l,a,e+1/3),o=ki(l,a,e),i=ki(l,a,e-1/3)}return{red:Math.round(r*255),green:Math.round(o*255),blue:Math.round(i*255),alpha:s}}function wo(e,t){return n=>n>0?t:e}const Ne=(e,t,n)=>e+(t-e)*n,Si=(e,t,n)=>{const s=e*e,r=n*(t*t-s)+s;return r<0?0:Math.sqrt(r)},Hw=[sa,In,cs],Uw=e=>Hw.find(t=>t.test(e));function Jc(e){const t=Uw(e);if(!t)return!1;let n=t.parse(e);return t===cs&&(n=Yw(n)),n}const Qc=(e,t)=>{const n=Jc(e),s=Jc(t);if(!n||!s)return wo(e,t);const r={...n};return o=>(r.red=Si(n.red,s.red,o),r.green=Si(n.green,s.green,o),r.blue=Si(n.blue,s.blue,o),r.alpha=Ne(n.alpha,s.alpha,o),In.transform(r))},ra=new Set(["none","hidden"]);function zw(e,t){return ra.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Gw(e,t){return n=>Ne(e,t,n)}function nl(e){return typeof e=="number"?Gw:typeof e=="string"?Qa(e)?wo:He.test(e)?Qc:Xw:Array.isArray(e)?Vh:typeof e=="object"?He.test(e)?Qc:Kw:wo}function Vh(e,t){const n=[...e],s=n.length,r=e.map((o,i)=>nl(o)(o,t[i]));return o=>{for(let i=0;i<s;i++)n[i]=r[i](o);return n}}function Kw(e,t){const n={...e,...t},s={};for(const r in n)e[r]!==void 0&&t[r]!==void 0&&(s[r]=nl(e[r])(e[r],t[r]));return r=>{for(const o in s)n[o]=s[o](r);return n}}function qw(e,t){const n=[],s={color:0,var:0,number:0};for(let r=0;r<t.values.length;r++){const o=t.types[r],i=e.indexes[o][s[o]],a=e.values[i]??0;n[r]=a,s[o]++}return n}const Xw=(e,t)=>{const n=Ft.createTransformer(t),s=Ts(e),r=Ts(t);return s.indexes.var.length===r.indexes.var.length&&s.indexes.color.length===r.indexes.color.length&&s.indexes.number.length>=r.indexes.number.length?ra.has(e)&&!r.values.length||ra.has(t)&&!s.values.length?zw(e,t):yr(Vh(qw(s,r),r.values),n):wo(e,t)};function Wh(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Ne(e,t,n):nl(e)(e,t)}const Zw=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Te.update(t,n),stop:()=>fn(t),now:()=>Ze.isProcessing?Ze.timestamp:ot.now()}},Bh=(e,t,n=10)=>{let s="";const r=Math.max(Math.round(t/n),2);for(let o=0;o<r;o++)s+=Math.round(e(o/(r-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},ko=2e4;function sl(e){let t=0;const n=50;let s=e.next(t);for(;!s.done&&t<ko;)t+=n,s=e.next(t);return t>=ko?1/0:t}function Jw(e,t=100,n){const s=n({...e,keyframes:[0,t]}),r=Math.min(sl(s),ko);return{type:"keyframes",ease:o=>s.next(r*o).value/t,duration:xt(r)}}const We={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function oa(e,t){return e*Math.sqrt(1-t*t)}const Qw=12;function ek(e,t,n){let s=n;for(let r=1;r<Qw;r++)s=s-e(s)/t(s);return s}const Ti=.001;function tk({duration:e=We.duration,bounce:t=We.bounce,velocity:n=We.velocity,mass:s=We.mass}){let r,o,i=1-t;i=qt(We.minDamping,We.maxDamping,i),e=qt(We.minDuration,We.maxDuration,xt(e)),i<1?(r=c=>{const u=c*i,d=u*e,f=u-n,m=oa(c,i),p=Math.exp(-d);return Ti-f/m*p},o=c=>{const d=c*i*e,f=d*n+n,m=Math.pow(i,2)*Math.pow(c,2)*e,p=Math.exp(-d),g=oa(Math.pow(c,2),i);return(-r(c)+Ti>0?-1:1)*((f-m)*p)/g}):(r=c=>{const u=Math.exp(-c*e),d=(c-n)*e+1;return-Ti+u*d},o=c=>{const u=Math.exp(-c*e),d=(n-c)*(e*e);return u*d});const a=5/e,l=ek(r,o,a);if(e=pt(e),isNaN(l))return{stiffness:We.stiffness,damping:We.damping,duration:e};{const c=Math.pow(l,2)*s;return{stiffness:c,damping:i*2*Math.sqrt(s*c),duration:e}}}const nk=["duration","bounce"],sk=["stiffness","damping","mass"];function eu(e,t){return t.some(n=>e[n]!==void 0)}function rk(e){let t={velocity:We.velocity,stiffness:We.stiffness,damping:We.damping,mass:We.mass,isResolvedFromDuration:!1,...e};if(!eu(e,sk)&&eu(e,nk))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),r=s*s,o=2*qt(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:We.mass,stiffness:r,damping:o}}else{const n=tk({...e,velocity:0});t={...t,...n,mass:We.mass},t.isResolvedFromDuration=!0}return t}function So(e=We.visualDuration,t=We.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:r}=n;const o=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:c,mass:u,duration:d,velocity:f,isResolvedFromDuration:m}=rk({...n,velocity:-xt(n.velocity||0)}),p=f||0,g=c/(2*Math.sqrt(l*u)),b=i-o,w=xt(Math.sqrt(l/u)),x=Math.abs(b)<5;s||(s=x?We.restSpeed.granular:We.restSpeed.default),r||(r=x?We.restDelta.granular:We.restDelta.default);let v,k,S,C,E,M;if(g<1)S=oa(w,g),C=(p+g*w*b)/S,v=T=>{const R=Math.exp(-g*w*T);return i-R*(C*Math.sin(S*T)+b*Math.cos(S*T))},E=g*w*C+b*S,M=g*w*b-C*S,k=T=>Math.exp(-g*w*T)*(E*Math.sin(S*T)+M*Math.cos(S*T));else if(g===1){v=R=>i-Math.exp(-w*R)*(b+(p+w*b)*R);const T=p+w*b;k=R=>Math.exp(-w*R)*(w*T*R-p)}else{const T=w*Math.sqrt(g*g-1);v=F=>{const N=Math.exp(-g*w*F),_=Math.min(T*F,300);return i-N*((p+g*w*b)*Math.sinh(_)+T*b*Math.cosh(_))/T};const R=(p+g*w*b)/T,O=g*w*R-b*T,D=g*w*b-R*T;k=F=>{const N=Math.exp(-g*w*F),_=Math.min(T*F,300);return N*(O*Math.sinh(_)+D*Math.cosh(_))}}const A={calculatedDuration:m&&d||null,velocity:T=>pt(k(T)),next:T=>{if(!m&&g<1){const O=Math.exp(-g*w*T),D=Math.sin(S*T),F=Math.cos(S*T),N=i-O*(C*D+b*F),_=pt(O*(E*D+M*F));return a.done=Math.abs(_)<=s&&Math.abs(i-N)<=r,a.value=a.done?i:N,a}const R=v(T);if(m)a.done=T>=d;else{const O=pt(k(T));a.done=Math.abs(O)<=s&&Math.abs(i-R)<=r}return a.value=a.done?i:R,a},toString:()=>{const T=Math.min(sl(A),ko),R=Bh(O=>A.next(T*O).value,T,30);return T+"ms "+R},toTransition:()=>{}};return A}So.applyToOptions=e=>{const t=Jw(e,100,So);return e.ease=t.ease,e.duration=pt(t.duration),e.type="keyframes",e};const ok=5;function $h(e,t,n){const s=Math.max(t-ok,0);return wh(n-e(s),t-s)}function ia({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:r=10,bounceStiffness:o=500,modifyTarget:i,min:a,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],f={done:!1,value:d},m=M=>a!==void 0&&M<a||l!==void 0&&M>l,p=M=>a===void 0?l:l===void 0||Math.abs(a-M)<Math.abs(l-M)?a:l;let g=n*t;const b=d+g,w=i===void 0?b:i(b);w!==b&&(g=w-d);const x=M=>-g*Math.exp(-M/s),v=M=>w+x(M),k=M=>{const A=x(M),T=v(M);f.done=Math.abs(A)<=c,f.value=f.done?w:T};let S,C;const E=M=>{m(f.value)&&(S=M,C=So({keyframes:[f.value,p(f.value)],velocity:$h(v,M,f.value),damping:r,stiffness:o,restDelta:c,restSpeed:u}))};return E(0),{calculatedDuration:null,next:M=>{let A=!1;return!C&&S===void 0&&(A=!0,k(M),E(M)),S!==void 0&&M>=S?C.next(M-S):(!A&&k(M),f)}}}function ik(e,t,n){const s=[],r=n||Tn.mix||Wh,o=e.length-1;for(let i=0;i<o;i++){let a=r(e[i],e[i+1]);if(t){const l=Array.isArray(t)?t[i]||kt:t;a=yr(l,a)}s.push(a)}return s}function Yh(e,t,{clamp:n=!0,ease:s,mixer:r}={}){const o=e.length;if(qa(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=ik(t,s,r),l=a.length,c=u=>{if(i&&u<e[0])return t[0];let d=0;if(l>1)for(;d<e.length-2&&!(u<e[d+1]);d++);const f=nr(e[d],e[d+1],u);return a[d](f)};return n?u=>c(qt(e[0],e[o-1],u)):c}function ak(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const r=nr(0,t,s);e.push(Ne(n,1,r))}}function lk(e){const t=[0];return ak(t,e.length-1),t}function ck(e,t){return e.map(n=>n*t)}function uk(e,t){return e.map(()=>t||Rh).splice(0,e.length-1)}function Ks({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const r=xw(s)?s.map(Kc):Kc(s),o={done:!1,value:t[0]},i=ck(n&&n.length===t.length?n:lk(t),e),a=Yh(i,t,{ease:Array.isArray(r)?r:uk(t,r)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}const dk=e=>e!==null;function Io(e,{repeat:t,repeatType:n="loop"},s,r=1){const o=e.filter(dk),a=r<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!a||s===void 0?o[a]:s}const fk={decay:ia,inertia:ia,tween:Ks,keyframes:Ks,spring:So};function Hh(e){typeof e.type=="string"&&(e.type=fk[e.type])}class rl{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const hk=e=>e/100;class rr extends rl{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==ot.now()&&this.tick(ot.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;Hh(t);const{type:n=Ks,repeat:s=0,repeatDelay:r=0,repeatType:o,velocity:i=0}=t;let{keyframes:a}=t;const l=n||Ks;l!==Ks&&typeof a[0]!="number"&&(this.mixKeyframes=yr(hk,Wh(a[0],a[1])),a=[0,100]);const c=l({...t,keyframes:a});o==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...a].reverse(),velocity:-i})),c.calculatedDuration===null&&(c.calculatedDuration=sl(c));const{calculatedDuration:u}=c;this.calculatedDuration=u,this.resolvedDuration=u+r,this.totalDuration=this.resolvedDuration*(s+1)-r,this.generator=c}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:s,totalDuration:r,mixKeyframes:o,mirroredGenerator:i,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return s.next(0);const{delay:c=0,keyframes:u,repeat:d,repeatType:f,repeatDelay:m,type:p,onUpdate:g,finalKeyframe:b}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-r/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const w=this.currentTime-c*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?w<0:w>r;this.currentTime=Math.max(w,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,k=s;if(d){const M=Math.min(this.currentTime,r)/a;let A=Math.floor(M),T=M%1;!T&&M>=1&&(T=1),T===1&&A--,A=Math.min(A,d+1),A%2&&(f==="reverse"?(T=1-T,m&&(T-=m/a)):f==="mirror"&&(k=i)),v=qt(0,1,T)*a}let S;x?(this.delayState.value=u[0],S=this.delayState):S=k.next(v),o&&!x&&(S.value=o(S.value));let{done:C}=S;!x&&l!==null&&(C=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const E=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return E&&p!==ia&&(S.value=Io(u,this.options,b,this.speed)),g&&g(S.value),E&&this.finish(),S}then(t,n){return this.finished.then(t,n)}get duration(){return xt(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+xt(t)}get time(){return xt(this.currentTime)}set time(t){t=pt(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return $h(s=>this.generator.next(s).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(ot.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=xt(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=Zw,startTime:n}=this.options;this.driver||(this.driver=t(r=>this.tick(r))),this.options.onPlay?.();const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=n??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(ot.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function mk(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Fn=e=>e*180/Math.PI,aa=e=>{const t=Fn(Math.atan2(e[1],e[0]));return la(t)},pk={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:aa,rotateZ:aa,skewX:e=>Fn(Math.atan(e[1])),skewY:e=>Fn(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},la=e=>(e=e%360,e<0&&(e+=360),e),tu=aa,nu=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),su=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),gk={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:nu,scaleY:su,scale:e=>(nu(e)+su(e))/2,rotateX:e=>la(Fn(Math.atan2(e[6],e[5]))),rotateY:e=>la(Fn(Math.atan2(-e[2],e[0]))),rotateZ:tu,rotate:tu,skewX:e=>Fn(Math.atan(e[4])),skewY:e=>Fn(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function ca(e){return e.includes("scale")?1:0}function ua(e,t){if(!e||e==="none")return ca(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,r;if(n)s=gk,r=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=pk,r=a}if(!r)return ca(t);const o=s[t],i=r[1].split(",").map(bk);return typeof o=="function"?o(i):i[o]}const yk=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return ua(n,t)};function bk(e){return parseFloat(e.trim())}const As=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Os=new Set(As),ru=e=>e===Rs||e===ee,xk=new Set(["x","y","z"]),vk=As.filter(e=>!xk.has(e));function wk(e){const t=[];return vk.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const vn={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:s})=>{const r=e.max-e.min;return s==="border-box"?r:r-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:s})=>{const r=e.max-e.min;return s==="border-box"?r:r-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>ua(t,"x"),y:(e,{transform:t})=>ua(t,"y")};vn.translateX=vn.x;vn.translateY=vn.y;const Bn=new Set;let da=!1,fa=!1,ha=!1;function Uh(){if(fa){const e=Array.from(Bn).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const r=wk(s);r.length&&(n.set(s,r),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const r=n.get(s);r&&r.forEach(([o,i])=>{s.getValue(o)?.set(i)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}fa=!1,da=!1,Bn.forEach(e=>e.complete(ha)),Bn.clear()}function zh(){Bn.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(fa=!0)})}function kk(){ha=!0,zh(),Uh(),ha=!1}class ol{constructor(t,n,s,r,o,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=r,this.element=o,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(Bn.add(this),da||(da=!0,Te.read(zh),Te.resolveKeyframes(Uh))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:r}=this;if(t[0]===null){const o=r?.get(),i=t[t.length-1];if(o!==void 0)t[0]=o;else if(s&&n){const a=s.readValue(n,i);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=i),r&&o===void 0&&r.set(t[0])}mk(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Bn.delete(this)}cancel(){this.state==="scheduled"&&(Bn.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Sk=e=>e.startsWith("--");function Gh(e,t,n){Sk(t)?e.style.setProperty(t,n):e.style[t]=n}const Tk={};function Kh(e,t){const n=vh(e);return()=>Tk[t]??n()}const Ck=Kh(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),qh=Kh(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Hs=([e,t,n,s])=>`cubic-bezier(${e}, ${t}, ${n}, ${s})`,ou={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Hs([0,.65,.55,1]),circOut:Hs([.55,0,1,.45]),backIn:Hs([.31,.01,.66,-.59]),backOut:Hs([.33,1.53,.69,.99])};function Xh(e,t){if(e)return typeof e=="function"?qh()?Bh(e,t):"ease-out":Ah(e)?Hs(e):Array.isArray(e)?e.map(n=>Xh(n,t)||ou.easeOut):ou[e]}function Mk(e,t,n,{delay:s=0,duration:r=300,repeat:o=0,repeatType:i="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=Xh(a,r);Array.isArray(d)&&(u.easing=d);const f={delay:s,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:i==="reverse"?"alternate":"normal"};return c&&(f.pseudoElement=c),e.animate(u,f)}function Zh(e){return typeof e=="function"&&"applyToOptions"in e}function Ek({type:e,...t}){return Zh(e)&&qh()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class Jh extends rl{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:s,keyframes:r,pseudoElement:o,allowFlatten:i=!1,finalKeyframe:a,onComplete:l}=t;this.isPseudoElement=!!o,this.allowFlatten=i,this.options=t,qa(typeof t.type!="string");const c=Ek(t);this.animation=Mk(n,s,r,c,o),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const u=Io(r,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(u),Gh(n,s,u),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return xt(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+xt(t)}get time(){return xt(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=pt(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:s,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&Ck()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),s&&(this.animation.rangeEnd=s),kt):r(this)}}const Qh={anticipate:Eh,backInOut:Mh,circInOut:Ph};function Dk(e){return e in Qh}function Pk(e){typeof e.ease=="string"&&Dk(e.ease)&&(e.ease=Qh[e.ease])}const Ci=10;class Rk extends Jh{constructor(t){Pk(t),Hh(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:s,onComplete:r,element:o,...i}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const a=new rr({...i,autoplay:!1}),l=Math.max(Ci,ot.now()-this.startTime),c=qt(0,Ci,l-Ci),u=a.sample(l).value,{name:d}=this.options;o&&d&&Gh(o,d,u),n.setWithVelocity(a.sample(Math.max(0,l-c)).value,u,c),a.stop()}}const iu=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Ft.test(e)||e==="0")&&!e.startsWith("url("));function Ak(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Ok(e,t,n,s){const r=e[0];if(r===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],i=iu(r,t),a=iu(o,t);return!i||!a?!1:Ak(e)||(n==="spring"||Zh(n))&&s}function ma(e){e.duration=0,e.type="keyframes"}const em=new Set(["opacity","clipPath","filter","transform"]),Nk=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function jk(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&Nk.test(e[t]))return!0;return!1}const Ik=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Fk=vh(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Lk(e){const{motionValue:t,name:n,repeatDelay:s,repeatType:r,damping:o,type:i,keyframes:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=t.owner.getProps();return Fk()&&n&&(em.has(n)||Ik.has(n)&&jk(a))&&(n!=="transform"||!u)&&!c&&!s&&r!=="mirror"&&o!==0&&i!=="inertia"}const _k=40;class Vk extends rl{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:i="loop",keyframes:a,name:l,motionValue:c,element:u,...d}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=ot.now();const f={autoplay:t,delay:n,type:s,repeat:r,repeatDelay:o,repeatType:i,name:l,motionValue:c,element:u,...d},m=u?.KeyframeResolver||ol;this.keyframeResolver=new m(a,(p,g,b)=>this.onKeyframesResolved(p,g,f,!b),l,c,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,s,r){this.keyframeResolver=void 0;const{name:o,type:i,velocity:a,delay:l,isHandoff:c,onUpdate:u}=s;this.resolvedAt=ot.now();let d=!0;Ok(t,o,i,a)||(d=!1,(Tn.instantAnimations||!l)&&u?.(Io(t,s,n)),t[0]=t[t.length-1],ma(s),s.repeat=0);const m={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>_k?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:t},p=d&&!c&&Lk(m),g=m.motionValue?.owner?.current;let b;if(p)try{b=new Rk({...m,element:g})}catch{b=new rr(m)}else b=new rr(m);b.finished.then(()=>{this.notifyFinished()}).catch(kt),this.pendingTimeline&&(this.stopTimeline=b.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=b}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),kk()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function tm(e,t,n,s=0,r=1){const o=Array.from(e).sort((c,u)=>c.sortNodePosition(u)).indexOf(t),i=e.size,a=(i-1)*s;return typeof n=="function"?n(o,i):r===1?o*s:a-o*s}const Wk=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Bk(e){const t=Wk.exec(e);if(!t)return[,];const[,n,s,r]=t;return[`--${n??s}`,r]}function nm(e,t,n=1){const[s,r]=Bk(e);if(!s)return;const o=window.getComputedStyle(t).getPropertyValue(s);if(o){const i=o.trim();return yh(i)?parseFloat(i):i}return Qa(r)?nm(r,t,n+1):r}const $k={type:"spring",stiffness:500,damping:25,restSpeed:10},Yk=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Hk={type:"keyframes",duration:.8},Uk={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},zk=(e,{keyframes:t})=>t.length>2?Hk:Os.has(e)?e.startsWith("scale")?Yk(t[1]):$k:Uk;function sm(e,t){if(e?.inherit&&t){const{inherit:n,...s}=e;return{...t,...s}}return e}function il(e,t){const n=e?.[t]??e?.default??e;return n!==e?sm(n,e):n}const Gk=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function Kk(e){for(const t in e)if(!Gk.has(t))return!0;return!1}const al=(e,t,n,s={},r,o)=>i=>{const a=il(s,e)||{},l=a.delay||s.delay||0;let{elapsed:c=0}=s;c=c-pt(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-c,onUpdate:f=>{t.set(f),a.onUpdate&&a.onUpdate(f)},onComplete:()=>{i(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:o?void 0:r};Kk(a)||Object.assign(u,zk(e,u)),u.duration&&(u.duration=pt(u.duration)),u.repeatDelay&&(u.repeatDelay=pt(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(ma(u),u.delay===0&&(d=!0)),(Tn.instantAnimations||Tn.skipAnimations||r?.shouldSkipAnimations)&&(d=!0,ma(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,d&&!o&&t.get()!==void 0){const f=Io(u.keyframes,a);if(f!==void 0){Te.update(()=>{u.onUpdate(f),u.onComplete()});return}}return a.isSync?new rr(u):new Vk(u)};function au(e){const t=[{},{}];return e?.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function ll(e,t,n,s){if(typeof t=="function"){const[r,o]=au(s);t=t(n!==void 0?n:e.custom,r,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[r,o]=au(s);t=t(n!==void 0?n:e.custom,r,o)}return t}function $n(e,t,n){const s=e.getProps();return ll(s,t,n!==void 0?n:s.custom,e)}const rm=new Set(["width","height","top","left","right","bottom",...As]),lu=30,qk=e=>!isNaN(parseFloat(e)),qs={current:void 0};class Xk{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{const r=ot.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=ot.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=qk(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Xa);const s=this.events[t].add(n);return t==="change"?()=>{s(),Te.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return qs.current&&qs.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=ot.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>lu)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,lu);return wh(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Un(e,t){return new Xk(e,t)}const pa=e=>Array.isArray(e);function Zk(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Un(n))}function Jk(e){return pa(e)?e[e.length-1]||0:e}function Qk(e,t){const n=$n(e,t);let{transitionEnd:s={},transition:r={},...o}=n||{};o={...o,...s};for(const i in o){const a=Jk(o[i]);Zk(e,i,a)}}const Xe=e=>!!(e&&e.getVelocity);function eS(e){return!!(Xe(e)&&e.add)}function ga(e,t){const n=e.getValue("willChange");if(eS(n))return n.add(t);if(!n&&Tn.WillChange){const s=new Tn.WillChange("auto");e.addValue("willChange",s),s.add(t)}}function cl(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const tS="framerAppearId",om="data-"+cl(tS);function im(e){return e.props[om]}function nS({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function am(e,t,{delay:n=0,transitionOverride:s,type:r}={}){let{transition:o,transitionEnd:i,...a}=t;const l=e.getDefaultTransition();o=o?sm(o,l):l;const c=o?.reduceMotion;s&&(o=s);const u=[],d=r&&e.animationState&&e.animationState.getState()[r];for(const f in a){const m=e.getValue(f,e.latestValues[f]??null),p=a[f];if(p===void 0||d&&nS(d,f))continue;const g={delay:n,...il(o||{},f)},b=m.get();if(b!==void 0&&!m.isAnimating()&&!Array.isArray(p)&&p===b&&!g.velocity){Te.update(()=>m.set(p));continue}let w=!1;if(window.MotionHandoffAnimation){const k=im(e);if(k){const S=window.MotionHandoffAnimation(k,f,Te);S!==null&&(g.startTime=S,w=!0)}}ga(e,f);const x=c??e.shouldReduceMotion;m.start(al(f,m,p,x&&rm.has(f)?{type:!1}:g,e,w));const v=m.animation;v&&u.push(v)}if(i){const f=()=>Te.update(()=>{i&&Qk(e,i)});u.length?Promise.all(u).then(f):f()}return u}function ya(e,t,n={}){const s=$n(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const o=s?()=>Promise.all(am(e,s,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:c=0,staggerChildren:u,staggerDirection:d}=r;return sS(e,t,l,c,u,d,n)}:()=>Promise.resolve(),{when:a}=r;if(a){const[l,c]=a==="beforeChildren"?[o,i]:[i,o];return l().then(()=>c())}else return Promise.all([o(),i(n.delay)])}function sS(e,t,n=0,s=0,r=0,o=1,i){const a=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),a.push(ya(l,t,{...i,delay:n+(typeof s=="function"?0:s)+tm(e.variantChildren,l,s,r,o)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(a)}function rS(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const r=t.map(o=>ya(e,o,n));s=Promise.all(r)}else if(typeof t=="string")s=ya(e,t,n);else{const r=typeof t=="function"?$n(e,t,n.custom):t;s=Promise.all(am(e,r,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}const oS={test:e=>e==="auto",parse:e=>e},lm=e=>t=>t.test(e),cm=[Rs,ee,Kt,yn,Ow,Aw,oS],cu=e=>cm.find(lm(e));function iS(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||xh(e):!0}const aS=new Set(["brightness","contrast","saturate","opacity"]);function lS(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(el)||[];if(!s)return e;const r=n.replace(s,"");let o=aS.has(t)?1:0;return s!==n&&(o*=100),t+"("+o+r+")"}const cS=/\b([a-z-]*)\(.*?\)/gu,ba={...Ft,getAnimatableNone:e=>{const t=e.match(cS);return t?t.map(lS).join(" "):e}},xa={...Ft,getAnimatableNone:e=>{const t=Ft.parse(e);return Ft.createTransformer(e)(t.map(s=>typeof s=="number"?0:typeof s=="object"?{...s,alpha:1}:s))}},uu={...Rs,transform:Math.round},uS={rotate:yn,rotateX:yn,rotateY:yn,rotateZ:yn,scale:Hr,scaleX:Hr,scaleY:Hr,scaleZ:Hr,skew:yn,skewX:yn,skewY:yn,distance:ee,translateX:ee,translateY:ee,translateZ:ee,x:ee,y:ee,z:ee,perspective:ee,transformPerspective:ee,opacity:sr,originX:Xc,originY:Xc,originZ:ee},ul={borderWidth:ee,borderTopWidth:ee,borderRightWidth:ee,borderBottomWidth:ee,borderLeftWidth:ee,borderRadius:ee,borderTopLeftRadius:ee,borderTopRightRadius:ee,borderBottomRightRadius:ee,borderBottomLeftRadius:ee,width:ee,maxWidth:ee,height:ee,maxHeight:ee,top:ee,right:ee,bottom:ee,left:ee,inset:ee,insetBlock:ee,insetBlockStart:ee,insetBlockEnd:ee,insetInline:ee,insetInlineStart:ee,insetInlineEnd:ee,padding:ee,paddingTop:ee,paddingRight:ee,paddingBottom:ee,paddingLeft:ee,paddingBlock:ee,paddingBlockStart:ee,paddingBlockEnd:ee,paddingInline:ee,paddingInlineStart:ee,paddingInlineEnd:ee,margin:ee,marginTop:ee,marginRight:ee,marginBottom:ee,marginLeft:ee,marginBlock:ee,marginBlockStart:ee,marginBlockEnd:ee,marginInline:ee,marginInlineStart:ee,marginInlineEnd:ee,fontSize:ee,backgroundPositionX:ee,backgroundPositionY:ee,...uS,zIndex:uu,fillOpacity:sr,strokeOpacity:sr,numOctaves:uu},dS={...ul,color:He,backgroundColor:He,outlineColor:He,fill:He,stroke:He,borderColor:He,borderTopColor:He,borderRightColor:He,borderBottomColor:He,borderLeftColor:He,filter:ba,WebkitFilter:ba,mask:xa,WebkitMask:xa},um=e=>dS[e],fS=new Set([ba,xa]);function dm(e,t){let n=um(e);return fS.has(n)||(n=Ft),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const hS=new Set(["auto","none","0"]);function mS(e,t,n){let s=0,r;for(;s<e.length&&!r;){const o=e[s];typeof o=="string"&&!hS.has(o)&&Ts(o).values.length&&(r=e[s]),s++}if(r&&n)for(const o of t)e[o]=dm(n,r)}class pS extends ol{constructor(t,n,s,r,o){super(t,n,s,r,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<t.length;u++){let d=t[u];if(typeof d=="string"&&(d=d.trim(),Qa(d))){const f=nm(d,n.current);f!==void 0&&(t[u]=f),u===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!rm.has(s)||t.length!==2)return;const[r,o]=t,i=cu(r),a=cu(o),l=qc(r),c=qc(o);if(l!==c&&vn[s]){this.needsMeasurement=!0;return}if(i!==a)if(ru(i)&&ru(a))for(let u=0;u<t.length;u++){const d=t[u];typeof d=="string"&&(t[u]=parseFloat(d))}else vn[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,s=[];for(let r=0;r<t.length;r++)(t[r]===null||iS(t[r]))&&s.push(r);s.length&&mS(t,s,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:s}=this;if(!t||!t.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=vn[s](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&t.getValue(s,r).jump(r,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:s}=this;if(!t||!t.current)return;const r=t.getValue(n);r&&r.jump(this.measuredOrigin,!1);const o=s.length-1,i=s[o];s[o]=vn[n](t.measureViewportBox(),window.getComputedStyle(t.current)),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),this.removedTransforms?.length&&this.removedTransforms.forEach(([a,l])=>{t.getValue(a).set(l)}),this.resolveNoneKeyframes()}}function fm(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let s=document;const r=n?.[e]??s.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(s=>s!=null)}const hm=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Jr(e){return bh(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:dl}=Oh(queueMicrotask,!1),At={x:!1,y:!1};function mm(){return At.x||At.y}function gS(e){return e==="x"||e==="y"?At[e]?null:(At[e]=!0,()=>{At[e]=!1}):At.x||At.y?null:(At.x=At.y=!0,()=>{At.x=At.y=!1})}function pm(e,t){const n=fm(e),s=new AbortController,r={passive:!0,...t,signal:s.signal};return[n,r,()=>s.abort()]}function yS(e){return!(e.pointerType==="touch"||mm())}function bS(e,t,n={}){const[s,r,o]=pm(e,n);return s.forEach(i=>{let a=!1,l=!1,c;const u=()=>{i.removeEventListener("pointerleave",p)},d=b=>{c&&(c(b),c=void 0),u()},f=b=>{a=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),l&&(l=!1,d(b))},m=()=>{a=!0,window.addEventListener("pointerup",f,r),window.addEventListener("pointercancel",f,r)},p=b=>{if(b.pointerType!=="touch"){if(a){l=!0;return}d(b)}},g=b=>{if(!yS(b))return;l=!1;const w=t(i,b);typeof w=="function"&&(c=w,i.addEventListener("pointerleave",p,r))};i.addEventListener("pointerenter",g,r),i.addEventListener("pointerdown",m,r)}),o}const gm=(e,t)=>t?e===t?!0:gm(e,t.parentElement):!1,fl=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,xS=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function vS(e){return xS.has(e.tagName)||e.isContentEditable===!0}const wS=new Set(["INPUT","SELECT","TEXTAREA"]);function kS(e){return wS.has(e.tagName)||e.isContentEditable===!0}const Qr=new WeakSet;function du(e){return t=>{t.key==="Enter"&&e(t)}}function Mi(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const SS=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=du(()=>{if(Qr.has(n))return;Mi(n,"down");const r=du(()=>{Mi(n,"up")}),o=()=>Mi(n,"cancel");n.addEventListener("keyup",r,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function fu(e){return fl(e)&&!mm()}const hu=new WeakSet;function TS(e,t,n={}){const[s,r,o]=pm(e,n),i=a=>{const l=a.currentTarget;if(!fu(a)||hu.has(a))return;Qr.add(l),n.stopPropagation&&hu.add(a);const c=t(l,a),u=(m,p)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",f),Qr.has(l)&&Qr.delete(l),fu(m)&&typeof c=="function"&&c(m,{success:p})},d=m=>{u(m,l===window||l===document||n.useGlobalTarget||gm(l,m.target))},f=m=>{u(m,!1)};window.addEventListener("pointerup",d,r),window.addEventListener("pointercancel",f,r)};return s.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",i,r),Jr(a)&&(a.addEventListener("focus",c=>SS(c,r)),!vS(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),o}function hl(e){return bh(e)&&"ownerSVGElement"in e}const eo=new WeakMap;let to;const ym=(e,t,n)=>(s,r)=>r&&r[0]?r[0][e+"Size"]:hl(s)&&"getBBox"in s?s.getBBox()[t]:s[n],CS=ym("inline","width","offsetWidth"),MS=ym("block","height","offsetHeight");function ES({target:e,borderBoxSize:t}){eo.get(e)?.forEach(n=>{n(e,{get width(){return CS(e,t)},get height(){return MS(e,t)}})})}function DS(e){e.forEach(ES)}function PS(){typeof ResizeObserver>"u"||(to=new ResizeObserver(DS))}function RS(e,t){to||PS();const n=fm(e);return n.forEach(s=>{let r=eo.get(s);r||(r=new Set,eo.set(s,r)),r.add(t),to?.observe(s)}),()=>{n.forEach(s=>{const r=eo.get(s);r?.delete(t),r?.size||to?.unobserve(s)})}}const no=new Set;let us;function AS(){us=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};no.forEach(t=>t(e))},window.addEventListener("resize",us)}function OS(e){return no.add(e),us||AS(),()=>{no.delete(e),!no.size&&typeof us=="function"&&(window.removeEventListener("resize",us),us=void 0)}}function mu(e,t){return typeof e=="function"?OS(e):RS(e,t)}function NS(e){return hl(e)&&e.tagName==="svg"}function jS(...e){const t=!Array.isArray(e[0]),n=t?0:-1,s=e[0+n],r=e[1+n],o=e[2+n],i=e[3+n],a=Yh(r,o,i);return t?a(s):a}function IS(e,t,n={}){const s=e.get();let r=null,o=s,i;const a=typeof s=="string"?s.replace(/[\d.-]/g,""):void 0,l=()=>{r&&(r.stop(),r=null),e.animation=void 0},c=()=>{const d=pu(e.get()),f=pu(o);if(d===f){l();return}const m=r?r.getGeneratorVelocity():e.getVelocity();l(),r=new rr({keyframes:[d,f],velocity:m,type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:i})},u=()=>{c(),e.animation=r??void 0,e.events.animationStart?.notify(),r?.then(()=>{e.animation=void 0,e.events.animationComplete?.notify()})};if(e.attach((d,f)=>{o=d,i=m=>f(Ei(m,a)),Te.postRender(u)},l),Xe(t)){let d=n.skipInitialAnimation===!0;const f=t.on("change",p=>{d?(d=!1,e.jump(Ei(p,a),!1)):e.set(Ei(p,a))}),m=e.on("destroy",f);return()=>{f(),m()}}return l}function Ei(e,t){return t?e+t:e}function pu(e){return typeof e=="number"?e:parseFloat(e)}const FS=[...cm,He,Ft],LS=e=>FS.find(lm(e)),gu=()=>({translate:0,scale:1,origin:0,originPoint:0}),ds=()=>({x:gu(),y:gu()}),yu=()=>({min:0,max:0}),Ke=()=>({x:yu(),y:yu()}),_S=new WeakMap;function Fo(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function or(e){return typeof e=="string"||Array.isArray(e)}const ml=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],pl=["initial",...ml];function Lo(e){return Fo(e.animate)||pl.some(t=>or(e[t]))}function bm(e){return!!(Lo(e)||e.variants)}function VS(e,t,n){for(const s in t){const r=t[s],o=n[s];if(Xe(r))e.addValue(s,r);else if(Xe(o))e.addValue(s,Un(r,{owner:e}));else if(o!==r)if(e.hasValue(s)){const i=e.getValue(s);i.liveStyle===!0?i.jump(r):i.hasAnimated||i.set(r)}else{const i=e.getStaticValue(s);e.addValue(s,Un(i!==void 0?i:r,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const To={current:null},gl={current:!1},WS=typeof window<"u";function xm(){if(gl.current=!0,!!WS)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>To.current=e.matches;e.addEventListener("change",t),t()}else To.current=!1}const bu=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Co={};function vm(e){Co=e}function BS(){return Co}class $S{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:r,skipAnimations:o,blockInitialAnimation:i,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=ol,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=ot.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,Te.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=a;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=o,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=Lo(n),this.isVariantNode=bm(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:d,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in f){const p=f[m];c[m]!==void 0&&Xe(p)&&p.set(c[m])}}mount(t){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=t,_S.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(gl.current||xm(),this.shouldReduceMotion=To.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),fn(this.notifyUpdate),fn(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&em.has(t)&&this.current instanceof HTMLElement){const{factory:i,keyframes:a,times:l,ease:c,duration:u}=n.accelerate,d=new Jh({element:this.current,name:t,keyframes:a,times:l,ease:c,duration:pt(u)}),f=i(d);this.valueSubscriptions.set(t,()=>{f(),d.cancel()});return}const s=Os.has(t);s&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&Te.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;typeof window<"u"&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Co){const n=Co[t];if(!n)continue;const{isEnabled:s,Feature:r}=n;if(!this.features[t]&&r&&s(this.props)&&(this.features[t]=new r(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ke()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<bu.length;s++){const r=bu[s];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const o="on"+r,i=t[o];i&&(this.propEventSubscriptions[r]=this.on(r,i))}this.prevMotionValues=VS(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=Un(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(yh(s)||xh(s))?s=parseFloat(s):!LS(s)&&Ft.test(n)&&(s=dm(t,n)),this.setBaseTarget(t,Xe(s)?s.get():s)),Xe(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const o=ll(this.props,n,this.presenceContext?.custom);o&&(s=o[t])}if(n&&s!==void 0)return s;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!Xe(r)?r:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Xa),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){dl.render(this.render)}}class wm extends $S{constructor(){super(...arguments),this.KeyframeResolver=pS}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const s=t.style;return s?s[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Xe(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class En{constructor(t){this.isMounted=!1,this.node=t}update(){}}function km({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function YS({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function HS(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function Di(e){return e===void 0||e===1}function va({scale:e,scaleX:t,scaleY:n}){return!Di(e)||!Di(t)||!Di(n)}function Nn(e){return va(e)||Sm(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Sm(e){return xu(e.x)||xu(e.y)}function xu(e){return e&&e!=="0%"}function Mo(e,t,n){const s=e-n,r=t*s;return n+r}function vu(e,t,n,s,r){return r!==void 0&&(e=Mo(e,r,s)),Mo(e,n,s)+t}function wa(e,t=0,n=1,s,r){e.min=vu(e.min,t,n,s,r),e.max=vu(e.max,t,n,s,r)}function Tm(e,{x:t,y:n}){wa(e.x,t.translate,t.scale,t.originPoint),wa(e.y,n.translate,n.scale,n.originPoint)}const wu=.999999999999,ku=1.0000000000001;function US(e,t,n,s=!1){const r=n.length;if(!r)return;t.x=t.y=1;let o,i;for(let a=0;a<r;a++){o=n[a],i=o.projectionDelta;const{visualElement:l}=o.options;l&&l.props.style&&l.props.style.display==="contents"||(s&&o.options.layoutScroll&&o.scroll&&o!==o.root&&(Yt(e.x,-o.scroll.offset.x),Yt(e.y,-o.scroll.offset.y)),i&&(t.x*=i.x.scale,t.y*=i.y.scale,Tm(e,i)),s&&Nn(o.latestValues)&&so(e,o.latestValues,o.layout?.layoutBox))}t.x<ku&&t.x>wu&&(t.x=1),t.y<ku&&t.y>wu&&(t.y=1)}function Yt(e,t){e.min+=t,e.max+=t}function Su(e,t,n,s,r=.5){const o=Ne(e.min,e.max,r);wa(e,t,n,o,s)}function Tu(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function so(e,t,n){const s=n??e;Su(e.x,Tu(t.x,s.x),t.scaleX,t.scale,t.originX),Su(e.y,Tu(t.y,s.y),t.scaleY,t.scale,t.originY)}function Cm(e,t){return km(HS(e.getBoundingClientRect(),t))}function zS(e,t,n){const s=Cm(e,n),{scroll:r}=t;return r&&(Yt(s.x,r.offset.x),Yt(s.y,r.offset.y)),s}const GS={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},KS=As.length;function qS(e,t,n){let s="",r=!0;for(let o=0;o<KS;o++){const i=As[o],a=e[i];if(a===void 0)continue;let l=!0;if(typeof a=="number")l=a===(i.startsWith("scale")?1:0);else{const c=parseFloat(a);l=i.startsWith("scale")?c===1:c===0}if(!l||n){const c=hm(a,ul[i]);if(!l){r=!1;const u=GS[i]||i;s+=`${u}(${c}) `}n&&(t[i]=c)}}return s=s.trim(),n?s=n(t,r?"":s):r&&(s="none"),s}function yl(e,t,n){const{style:s,vars:r,transformOrigin:o}=e;let i=!1,a=!1;for(const l in t){const c=t[l];if(Os.has(l)){i=!0;continue}else if(jh(l)){r[l]=c;continue}else{const u=hm(c,ul[l]);l.startsWith("origin")?(a=!0,o[l]=u):s[l]=u}}if(t.transform||(i||n?s.transform=qS(t,e.transform,n):s.transform&&(s.transform="none")),a){const{originX:l="50%",originY:c="50%",originZ:u=0}=o;s.transformOrigin=`${l} ${c} ${u}`}}function Mm(e,{style:t,vars:n},s,r){const o=e.style;let i;for(i in t)o[i]=t[i];r?.applyProjectionStyles(o,s);for(i in n)o.setProperty(i,n[i])}function Cu(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Ws={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ee.test(e))e=parseFloat(e);else return e;const n=Cu(e,t.target.x),s=Cu(e,t.target.y);return`${n}% ${s}%`}},XS={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,r=Ft.parse(e);if(r.length>5)return s;const o=Ft.createTransformer(e),i=typeof r[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;r[0+i]/=a,r[1+i]/=l;const c=Ne(a,l,.5);return typeof r[2+i]=="number"&&(r[2+i]/=c),typeof r[3+i]=="number"&&(r[3+i]/=c),o(r)}},ka={borderRadius:{...Ws,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ws,borderTopRightRadius:Ws,borderBottomLeftRadius:Ws,borderBottomRightRadius:Ws,boxShadow:XS};function Em(e,{layout:t,layoutId:n}){return Os.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!ka[e]||e==="opacity")}function bl(e,t,n){const s=e.style,r=t?.style,o={};if(!s)return o;for(const i in s)(Xe(s[i])||r&&Xe(r[i])||Em(i,e)||n?.getValue(i)?.liveStyle!==void 0)&&(o[i]=s[i]);return o}function ZS(e){return window.getComputedStyle(e)}class JS extends wm{constructor(){super(...arguments),this.type="html",this.renderInstance=Mm}readValueFromInstance(t,n){if(Os.has(n))return this.projection?.isProjecting?ca(n):yk(t,n);{const s=ZS(t),r=(jh(n)?s.getPropertyValue(n):s[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Cm(t,n)}build(t,n,s){yl(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return bl(t,n,s)}}const QS={offset:"stroke-dashoffset",array:"stroke-dasharray"},eT={offset:"strokeDashoffset",array:"strokeDasharray"};function tT(e,t,n=1,s=0,r=!0){e.pathLength=1;const o=r?QS:eT;e[o.offset]=`${-s}`,e[o.array]=`${t} ${n}`}const nT=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Dm(e,{attrX:t,attrY:n,attrScale:s,pathLength:r,pathSpacing:o=1,pathOffset:i=0,...a},l,c,u){if(yl(e,a,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??"fill-box",delete d.transformBox);for(const m of nT)d[m]!==void 0&&(f[m]=d[m],delete d[m]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),s!==void 0&&(d.scale=s),r!==void 0&&tT(d,r,o,i,!1)}const Pm=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Rm=e=>typeof e=="string"&&e.toLowerCase()==="svg";function sT(e,t,n,s){Mm(e,t,void 0,s);for(const r in t.attrs)e.setAttribute(Pm.has(r)?r:cl(r),t.attrs[r])}function Am(e,t,n){const s=bl(e,t,n);for(const r in e)if(Xe(e[r])||Xe(t[r])){const o=As.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;s[o]=e[r]}return s}class rT extends wm{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ke}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Os.has(n)){const s=um(n);return s&&s.default||0}return n=Pm.has(n)?n:cl(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return Am(t,n,s)}build(t,n,s){Dm(t,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(t,n,s,r){sT(t,n,s,r)}mount(t){this.isSVGTag=Rm(t.tagName),super.mount(t)}}const oT=pl.length;function Om(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Om(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<oT;n++){const s=pl[n],r=e.props[s];(or(r)||r===!1)&&(t[s]=r)}return t}function Nm(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s<n;s++)if(t[s]!==e[s])return!1;return!0}const iT=[...ml].reverse(),aT=ml.length;function lT(e){return t=>Promise.all(t.map(({animation:n,options:s})=>rS(e,n,s)))}function cT(e){let t=lT(e),n=Mu(),s=!0,r=!1;const o=c=>(u,d)=>{const f=$n(e,d,c==="exit"?e.presenceContext?.custom:void 0);if(f){const{transition:m,transitionEnd:p,...g}=f;u={...u,...g,...p}}return u};function i(c){t=c(e)}function a(c){const{props:u}=e,d=Om(e.parent)||{},f=[],m=new Set;let p={},g=1/0;for(let w=0;w<aT;w++){const x=iT[w],v=n[x],k=u[x]!==void 0?u[x]:d[x],S=or(k),C=x===c?v.isActive:null;C===!1&&(g=w);let E=k===d[x]&&k!==u[x]&&S;if(E&&(s||r)&&e.manuallyAnimateOnMount&&(E=!1),v.protectedKeys={...p},!v.isActive&&C===null||!k&&!v.prevProp||Fo(k)||typeof k=="boolean")continue;if(x==="exit"&&v.isActive&&C!==!0){v.prevResolvedValues&&(p={...p,...v.prevResolvedValues});continue}const M=uT(v.prevProp,k);let A=M||x===c&&v.isActive&&!E&&S||w>g&&S,T=!1;const R=Array.isArray(k)?k:[k];let O=R.reduce(o(x),{});C===!1&&(O={});const{prevResolvedValues:D={}}=v,F={...D,...O},N=P=>{A=!0,m.has(P)&&(T=!0,m.delete(P)),v.needsAnimating[P]=!0;const I=e.getValue(P);I&&(I.liveStyle=!1)};for(const P in F){const I=O[P],B=D[P];if(p.hasOwnProperty(P))continue;let W=!1;pa(I)&&pa(B)?W=!Nm(I,B):W=I!==B,W?I!=null?N(P):m.add(P):I!==void 0&&m.has(P)?N(P):v.protectedKeys[P]=!0}v.prevProp=k,v.prevResolvedValues=O,v.isActive&&(p={...p,...O}),(s||r)&&e.blockInitialAnimation&&(A=!1);const _=E&&M;A&&(!_||T)&&f.push(...R.map(P=>{const I={type:x};if(typeof P=="string"&&(s||r)&&!_&&e.manuallyAnimateOnMount&&e.parent){const{parent:B}=e,W=$n(B,P);if(B.enteringChildren&&W){const{delayChildren:J}=W.transition||{};I.delay=tm(B.enteringChildren,e,J)}}return{animation:P,options:I}}))}if(m.size){const w={};if(typeof u.initial!="boolean"){const x=$n(e,Array.isArray(u.initial)?u.initial[0]:u.initial);x&&x.transition&&(w.transition=x.transition)}m.forEach(x=>{const v=e.getBaseTarget(x),k=e.getValue(x);k&&(k.liveStyle=!0),w[x]=v??null}),f.push({animation:w})}let b=!!f.length;return s&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),s=!1,r=!1,b?t(f):Promise.resolve()}function l(c,u){if(n[c].isActive===u)return Promise.resolve();e.variantChildren?.forEach(f=>f.animationState?.setActive(c,u)),n[c].isActive=u;const d=a(c);for(const f in n)n[f].protectedKeys={};return d}return{animateChanges:a,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=Mu(),r=!0}}}function uT(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Nm(t,e):!1}function On(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Mu(){return{animate:On(!0),whileInView:On(),whileHover:On(),whileTap:On(),whileDrag:On(),whileFocus:On(),exit:On()}}function Sa(e,t){e.min=t.min,e.max=t.max}function Pt(e,t){Sa(e.x,t.x),Sa(e.y,t.y)}function Eu(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const jm=1e-4,dT=1-jm,fT=1+jm,Im=.01,hT=0-Im,mT=0+Im;function it(e){return e.max-e.min}function pT(e,t,n){return Math.abs(e-t)<=n}function Du(e,t,n,s=.5){e.origin=s,e.originPoint=Ne(t.min,t.max,e.origin),e.scale=it(n)/it(t),e.translate=Ne(n.min,n.max,e.origin)-e.originPoint,(e.scale>=dT&&e.scale<=fT||isNaN(e.scale))&&(e.scale=1),(e.translate>=hT&&e.translate<=mT||isNaN(e.translate))&&(e.translate=0)}function Xs(e,t,n,s){Du(e.x,t.x,n.x,s?s.originX:void 0),Du(e.y,t.y,n.y,s?s.originY:void 0)}function Pu(e,t,n,s=0){const r=s?Ne(n.min,n.max,s):n.min;e.min=r+t.min,e.max=e.min+it(t)}function gT(e,t,n,s){Pu(e.x,t.x,n.x,s?.x),Pu(e.y,t.y,n.y,s?.y)}function Ru(e,t,n,s=0){const r=s?Ne(n.min,n.max,s):n.min;e.min=t.min-r,e.max=e.min+it(t)}function Eo(e,t,n,s){Ru(e.x,t.x,n.x,s?.x),Ru(e.y,t.y,n.y,s?.y)}function Au(e,t,n,s,r){return e-=t,e=Mo(e,1/n,s),r!==void 0&&(e=Mo(e,1/r,s)),e}function yT(e,t=0,n=1,s=.5,r,o=e,i=e){if(Kt.test(t)&&(t=parseFloat(t),t=Ne(i.min,i.max,t/100)-i.min),typeof t!="number")return;let a=Ne(o.min,o.max,s);e===o&&(a-=t),e.min=Au(e.min,t,n,a,r),e.max=Au(e.max,t,n,a,r)}function Ou(e,t,[n,s,r],o,i){yT(e,t[n],t[s],t[r],t.scale,o,i)}const bT=["x","scaleX","originX"],xT=["y","scaleY","originY"];function Nu(e,t,n,s){Ou(e.x,t,bT,n?n.x:void 0,s?s.x:void 0),Ou(e.y,t,xT,n?n.y:void 0,s?s.y:void 0)}function ju(e){return e.translate===0&&e.scale===1}function Fm(e){return ju(e.x)&&ju(e.y)}function Iu(e,t){return e.min===t.min&&e.max===t.max}function vT(e,t){return Iu(e.x,t.x)&&Iu(e.y,t.y)}function Fu(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Lm(e,t){return Fu(e.x,t.x)&&Fu(e.y,t.y)}function Lu(e){return it(e.x)/it(e.y)}function _u(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Wt(e){return[e("x"),e("y")]}function wT(e,t,n){let s="";const r=e.x.translate/t.x,o=e.y.translate/t.y,i=n?.z||0;if((r||o||i)&&(s=`translate3d(${r}px, ${o}px, ${i}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:c,rotate:u,rotateX:d,rotateY:f,skewX:m,skewY:p}=n;c&&(s=`perspective(${c}px) ${s}`),u&&(s+=`rotate(${u}deg) `),d&&(s+=`rotateX(${d}deg) `),f&&(s+=`rotateY(${f}deg) `),m&&(s+=`skewX(${m}deg) `),p&&(s+=`skewY(${p}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(s+=`scale(${a}, ${l})`),s||"none"}const _m=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],kT=_m.length,Vu=e=>typeof e=="string"?parseFloat(e):e,Wu=e=>typeof e=="number"||ee.test(e);function ST(e,t,n,s,r,o){r?(e.opacity=Ne(0,n.opacity??1,TT(s)),e.opacityExit=Ne(t.opacity??1,0,CT(s))):o&&(e.opacity=Ne(t.opacity??1,n.opacity??1,s));for(let i=0;i<kT;i++){const a=_m[i];let l=Bu(t,a),c=Bu(n,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||Wu(l)===Wu(c)?(e[a]=Math.max(Ne(Vu(l),Vu(c),s),0),(Kt.test(c)||Kt.test(l))&&(e[a]+="%")):e[a]=c}(t.rotate||n.rotate)&&(e.rotate=Ne(t.rotate||0,n.rotate||0,s))}function Bu(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const TT=Vm(0,.5,Dh),CT=Vm(.5,.95,kt);function Vm(e,t,n){return s=>s<e?0:s>t?1:n(nr(e,t,s))}function MT(e,t,n){const s=Xe(e)?e:Un(e);return s.start(al("",s,t,n)),s.animation}function ir(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}const ET=(e,t)=>e.depth-t.depth;class DT{constructor(){this.children=[],this.isDirty=!1}add(t){Ka(this.children,t),this.isDirty=!0}remove(t){vo(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(ET),this.isDirty=!1,this.children.forEach(t)}}function PT(e,t){const n=ot.now(),s=({timestamp:r})=>{const o=r-n;o>=t&&(fn(s),e(o-t))};return Te.setup(s,!0),()=>fn(s)}function ro(e){return Xe(e)?e.get():e}class RT{constructor(){this.members=[]}add(t){Ka(this.members,t);for(let n=this.members.length-1;n>=0;n--){const s=this.members[n];if(s===t||s===this.lead||s===this.prevLead)continue;const r=s.instance;(!r||r.isConnected===!1)&&!s.snapshot&&(vo(this.members,s),s.unmount())}t.scheduleRender()}remove(t){if(vo(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){for(let n=this.members.indexOf(t)-1;n>=0;n--){const s=this.members[n];if(s.isPresent!==!1&&s.instance?.isConnected!==!1)return this.promote(s),!0}return!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.updateSnapshot(),t.scheduleRender();const{layoutDependency:r}=s.options,{layoutDependency:o}=t.options;(r===void 0||r!==o)&&(t.resumeFrom=s,n&&(s.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const oo={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Pi=["","X","Y","Z"],AT=1e3;let OT=0;function Ri(e,t,n,s){const{latestValues:r}=t;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),s&&(s[e]=0))}function Wm(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=im(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Te,!(r||o))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&Wm(s)}function Bm({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:r}){return class{constructor(i={},a=t?.()){this.id=OT++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(IT),this.nodes.forEach(BT),this.nodes.forEach($T),this.nodes.forEach(FT)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new DT)}addEventListener(i,a){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new Xa),this.eventHandlers.get(i).add(a)}notifyListeners(i,...a){const l=this.eventHandlers.get(i);l&&l.notify(...a)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=hl(i)&&!NS(i),this.instance=i;const{layoutId:a,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||a)&&(this.isLayoutDirty=!0),e){let u,d=0;const f=()=>this.root.updateBlockedByResize=!1;Te.read(()=>{d=window.innerWidth}),e(i,()=>{const m=window.innerWidth;m!==d&&(d=m,this.root.updateBlockedByResize=!0,u&&u(),u=PT(f,250),oo.hasAnimatedSinceResize&&(oo.hasAnimatedSinceResize=!1,this.nodes.forEach(Hu)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d,hasRelativeLayoutChanged:f,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const p=this.options.transition||c.getDefaultTransition()||GT,{onLayoutAnimationStart:g,onLayoutAnimationComplete:b}=c.getProps(),w=!this.targetLayout||!Lm(this.targetLayout,m),x=!d&&f;if(this.options.layoutRoot||this.resumeFrom||x||d&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const v={...il(p,"layout"),onPlay:g,onComplete:b};(c.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v),this.setAnimationOrigin(u,x)}else d||Hu(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),fn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(YT),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Wm(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const d=this.path[u];d.shouldResetTransform=!0,(typeof d.latestValues.x=="string"||typeof d.latestValues.y=="string")&&(d.isLayoutDirty=!0),d.updateScroll("snapshot"),d.options.layoutRoot&&d.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const l=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),l&&this.nodes.forEach(_T),this.nodes.forEach($u);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Yu);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(VT),this.nodes.forEach(WT),this.nodes.forEach(NT),this.nodes.forEach(jT)):this.nodes.forEach(Yu),this.clearAllSnapshots();const a=ot.now();Ze.delta=qt(0,1e3/60,a-Ze.timestamp),Ze.timestamp=a,Ze.isProcessing=!0,vi.update.process(Ze),vi.preRender.process(Ze),vi.render.process(Ze),Ze.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,dl.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(LT),this.sharedNodes.forEach(HT)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Te.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Te.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!it(this.snapshot.measuredBox.x)&&!it(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Ke()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(a=!1),a&&this.instance){const l=s(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!r)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!Fm(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;i&&this.instance&&(a||Nn(this.latestValues)||u)&&(r(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return i&&(l=this.removeTransform(l)),KT(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:i}=this.options;if(!i)return Ke();const a=i.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(qT))){const{scroll:c}=this.root;c&&(Yt(a.x,c.offset.x),Yt(a.y,c.offset.y))}return a}removeElementScroll(i){const a=Ke();if(Pt(a,i),this.scroll?.wasRoot)return a;for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:u,options:d}=c;c!==this.root&&u&&d.layoutScroll&&(u.wasRoot&&Pt(a,i),Yt(a.x,u.offset.x),Yt(a.y,u.offset.y))}return a}applyTransform(i,a=!1,l){const c=l||Ke();Pt(c,i);for(let u=0;u<this.path.length;u++){const d=this.path[u];!a&&d.options.layoutScroll&&d.scroll&&d!==d.root&&(Yt(c.x,-d.scroll.offset.x),Yt(c.y,-d.scroll.offset.y)),Nn(d.latestValues)&&so(c,d.latestValues,d.layout?.layoutBox)}return Nn(this.latestValues)&&so(c,this.latestValues,this.layout?.layoutBox),c}removeTransform(i){const a=Ke();Pt(a,i);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!Nn(c.latestValues))continue;let u;c.instance&&(va(c.latestValues)&&c.updateSnapshot(),u=Ke(),Pt(u,c.measurePageBox())),Nu(a,c.latestValues,c.snapshot?.layoutBox,u)}return Nn(this.latestValues)&&Nu(a,this.latestValues),a}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ze.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(i||l&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:d}=this.options;if(!this.layout||!(u||d))return;this.resolvedRelativeTargetAt=Ze.timestamp;const f=this.getClosestProjectingParent();f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Ke(),this.targetWithTransforms=Ke()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),gT(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Pt(this.target,this.layout.layoutBox),Tm(this.target,this.targetDelta)):Pt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||va(this.parent.latestValues)||Sm(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(i,a,l){this.relativeParent=i,this.linkedParentVersion=i.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ke(),this.relativeTargetOrigin=Ke(),Eo(this.relativeTargetOrigin,a,l,this.options.layoutAnchor||void 0),Pt(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const i=this.getLead(),a=!!this.resumingFrom||this!==i;let l=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Ze.timestamp&&(l=!1),l)return;const{layout:c,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||u))return;Pt(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,f=this.treeScale.y;US(this.layoutCorrected,this.treeScale,this.path,a),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=Ke());const{target:m}=i;if(!m){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Eu(this.prevProjectionDelta.x,this.projectionDelta.x),Eu(this.prevProjectionDelta.y,this.projectionDelta.y)),Xs(this.projectionDelta,this.layoutCorrected,m,this.latestValues),(this.treeScale.x!==d||this.treeScale.y!==f||!_u(this.projectionDelta.x,this.prevProjectionDelta.x)||!_u(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",m))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){if(this.options.visualElement?.scheduleRender(),i){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ds(),this.projectionDelta=ds(),this.projectionDeltaWithTransform=ds()}setAnimationOrigin(i,a=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},d=ds();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const f=Ke(),m=l?l.source:void 0,p=this.layout?this.layout.source:void 0,g=m!==p,b=this.getStack(),w=!b||b.members.length<=1,x=!!(g&&!w&&this.options.crossfade===!0&&!this.path.some(zT));this.animationProgress=0;let v;this.mixTargetDelta=k=>{const S=k/1e3;Uu(d.x,i.x,S),Uu(d.y,i.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Eo(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),UT(this.relativeTarget,this.relativeTargetOrigin,f,S),v&&vT(this.relativeTarget,v)&&(this.isProjectionDirty=!1),v||(v=Ke()),Pt(v,this.relativeTarget)),g&&(this.animationValues=u,ST(u,c,this.latestValues,S,x,w)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(fn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Te.update(()=>{oo.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Un(0)),this.motionValue.jump(0,!1),this.currentAnimation=MT(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:a=>{this.mixTargetDelta(a),i.onUpdate&&i.onUpdate(a)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(AT),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=i;if(!(!a||!l||!c)){if(this!==i&&this.layout&&c&&$m(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||Ke();const d=it(this.layout.layoutBox.x);l.x.min=i.target.x.min,l.x.max=l.x.min+d;const f=it(this.layout.layoutBox.y);l.y.min=i.target.y.min,l.y.max=l.y.min+f}Pt(a,l),so(a,u),Xs(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(i,a){this.sharedNodes.has(i)||this.sharedNodes.set(i,new RT),this.sharedNodes.get(i).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){const{layoutId:i}=this.options;return i?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:i}=this.options;return i?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),i&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let a=!1;const{latestValues:l}=i;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&Ri("z",i,c,this.animationValues);for(let u=0;u<Pi.length;u++)Ri(`rotate${Pi[u]}`,i,c,this.animationValues),Ri(`skew${Pi[u]}`,i,c,this.animationValues);i.render();for(const u in c)i.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);i.scheduleRender()}applyProjectionStyles(i,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=ro(a?.pointerEvents)||"",i.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=ro(a?.pointerEvents)||""),this.hasProjected&&!Nn(this.latestValues)&&(i.transform=l?l({},""):"none",this.hasProjected=!1);return}i.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let d=wT(this.projectionDeltaWithTransform,this.treeScale,u);l&&(d=l(u,d)),i.transform=d;const{x:f,y:m}=this.projectionDelta;i.transformOrigin=`${f.origin*100}% ${m.origin*100}% 0`,c.animationValues?i.opacity=c===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:i.opacity=c===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const p in ka){if(u[p]===void 0)continue;const{correct:g,applyTo:b,isCSSVariable:w}=ka[p],x=d==="none"?u[p]:g(u[p],c);if(b){const v=b.length;for(let k=0;k<v;k++)i[b[k]]=x}else w?this.options.visualElement.renderState.vars[p]=x:i[p]=x}this.options.layoutId&&(i.pointerEvents=c===this?ro(a?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>i.currentAnimation?.stop()),this.root.nodes.forEach($u),this.root.sharedNodes.clear()}}}function NT(e){e.updateLayout()}function jT(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:s}=e.layout,{animationType:r}=e.options,o=t.source!==e.layout.source;if(r==="size")Wt(u=>{const d=o?t.measuredBox[u]:t.layoutBox[u],f=it(d);d.min=n[u].min,d.max=d.min+f});else if(r==="x"||r==="y"){const u=r==="x"?"y":"x";Sa(o?t.measuredBox[u]:t.layoutBox[u],n[u])}else $m(r,t.layoutBox,n)&&Wt(u=>{const d=o?t.measuredBox[u]:t.layoutBox[u],f=it(n[u]);d.max=d.min+f,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+f)});const i=ds();Xs(i,n,t.layoutBox);const a=ds();o?Xs(a,e.applyTransform(s,!0),t.measuredBox):Xs(a,n,t.layoutBox);const l=!Fm(i);let c=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:d,layout:f}=u;if(d&&f){const m=e.options.layoutAnchor||void 0,p=Ke();Eo(p,t.layoutBox,d.layoutBox,m);const g=Ke();Eo(g,n,f.layoutBox,m),Lm(p,g)||(c=!0),u.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=p,e.relativeParent=u)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:a,layoutDelta:i,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function IT(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function FT(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function LT(e){e.clearSnapshot()}function $u(e){e.clearMeasurements()}function _T(e){e.isLayoutDirty=!0,e.updateLayout()}function Yu(e){e.isLayoutDirty=!1}function VT(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function WT(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Hu(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function BT(e){e.resolveTargetDelta()}function $T(e){e.calcProjection()}function YT(e){e.resetSkewAndRotation()}function HT(e){e.removeLeadSnapshot()}function Uu(e,t,n){e.translate=Ne(t.translate,0,n),e.scale=Ne(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function zu(e,t,n,s){e.min=Ne(t.min,n.min,s),e.max=Ne(t.max,n.max,s)}function UT(e,t,n,s){zu(e.x,t.x,n.x,s),zu(e.y,t.y,n.y,s)}function zT(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const GT={duration:.45,ease:[.4,0,.1,1]},Gu=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ku=Gu("applewebkit/")&&!Gu("chrome/")?Math.round:kt;function qu(e){e.min=Ku(e.min),e.max=Ku(e.max)}function KT(e){qu(e.x),qu(e.y)}function $m(e,t,n){return e==="position"||e==="preserve-aspect"&&!pT(Lu(t),Lu(n),.2)}function qT(e){return e!==e.root&&e.scroll?.wasRoot}const XT=Bm({attachResizeListener:(e,t)=>ir(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Ai={current:void 0},Ym=Bm({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Ai.current){const e=new XT({});e.mount(window),e.setOptions({layoutScroll:!0}),Ai.current=e}return Ai.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),vr=h.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function Xu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ZT(...e){return t=>{let n=!1;const s=e.map(r=>{const o=Xu(r,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let r=0;r<s.length;r++){const o=s[r];typeof o=="function"?o():Xu(e[r],null)}}}}function JT(...e){return h.useCallback(ZT(...e),e)}class QT extends h.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(Jr(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const s=n.offsetParent,r=Jr(s)&&s.offsetWidth||0,o=Jr(s)&&s.offsetHeight||0,i=getComputedStyle(n),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=n.offsetTop,a.left=n.offsetLeft,a.right=r-a.width-a.left,a.bottom=o-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}}function eC({children:e,isPresent:t,anchorX:n,anchorY:s,root:r,pop:o}){const i=h.useId(),a=h.useRef(null),l=h.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:c}=h.useContext(vr),u=e.props?.ref??e?.ref,d=JT(a,u);return h.useInsertionEffect(()=>{const{width:f,height:m,top:p,left:g,right:b,bottom:w}=l.current;if(t||o===!1||!a.current||!f||!m)return;const x=n==="left"?`left: ${g}`:`right: ${b}`,v=s==="bottom"?`bottom: ${w}`:`top: ${p}`;a.current.dataset.motionPopId=i;const k=document.createElement("style");c&&(k.nonce=c);const S=r??document.head;return S.appendChild(k),k.sheet&&k.sheet.insertRule(`
13
+ [data-motion-pop-id="${i}"] {
14
+ position: absolute !important;
15
+ width: ${f}px !important;
16
+ height: ${m}px !important;
17
+ ${x}px !important;
18
+ ${v}px !important;
19
+ }
20
+ `),()=>{a.current?.removeAttribute("data-motion-pop-id"),S.contains(k)&&S.removeChild(k)}},[t]),y.jsx(QT,{isPresent:t,childRef:a,sizeRef:l,pop:o,children:o===!1?e:h.cloneElement(e,{ref:d})})}const tC=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:r,presenceAffectsLayout:o,mode:i,anchorX:a,anchorY:l,root:c})=>{const u=gr(nC),d=h.useId();let f=!0,m=h.useMemo(()=>(f=!1,{id:d,initial:t,isPresent:n,custom:r,onExitComplete:p=>{u.set(p,!0);for(const g of u.values())if(!g)return;s&&s()},register:p=>(u.set(p,!1),()=>u.delete(p))}),[n,u,s]);return o&&f&&(m={...m}),h.useMemo(()=>{u.forEach((p,g)=>u.set(g,!1))},[n]),h.useEffect(()=>{!n&&!u.size&&s&&s()},[n]),e=y.jsx(eC,{pop:i==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:c,children:e}),y.jsx(jo.Provider,{value:m,children:e})};function nC(){return new Map}function Hm(e=!0){const t=h.useContext(jo);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:r}=t,o=h.useId();h.useEffect(()=>{if(e)return r(o)},[e]);const i=h.useCallback(()=>e&&s&&s(o),[o,s,e]);return!n&&s?[!1,i]:[!0]}const Ur=e=>e.key||"";function Zu(e){const t=[];return h.Children.forEach(e,n=>{h.isValidElement(n)&&t.push(n)}),t}const sC=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:r=!0,mode:o="sync",propagate:i=!1,anchorX:a="left",anchorY:l="top",root:c})=>{const[u,d]=Hm(i),f=h.useMemo(()=>Zu(e),[e]),m=i&&!u?[]:f.map(Ur),p=h.useRef(!0),g=h.useRef(f),b=gr(()=>new Map),w=h.useRef(new Set),[x,v]=h.useState(f),[k,S]=h.useState(f);Ga(()=>{p.current=!1,g.current=f;for(let M=0;M<k.length;M++){const A=Ur(k[M]);m.includes(A)?(b.delete(A),w.current.delete(A)):b.get(A)!==!0&&b.set(A,!1)}},[k,m.length,m.join("-")]);const C=[];if(f!==x){let M=[...f];for(let A=0;A<k.length;A++){const T=k[A],R=Ur(T);m.includes(R)||(M.splice(A,0,T),C.push(T))}return o==="wait"&&C.length&&(M=C),S(Zu(M)),v(f),null}const{forceRender:E}=h.useContext(za);return y.jsx(y.Fragment,{children:k.map(M=>{const A=Ur(M),T=i&&!u?!1:f===k||m.includes(A),R=()=>{if(w.current.has(A))return;if(b.has(A))w.current.add(A),b.set(A,!0);else return;let O=!0;b.forEach(D=>{D||(O=!1)}),O&&(E?.(),S(g.current),i&&d?.(),s&&s())};return y.jsx(tC,{isPresent:T,initial:!p.current||n?void 0:!1,custom:t,presenceAffectsLayout:r,mode:o,root:c,onExitComplete:T?void 0:R,anchorX:a,anchorY:l,children:M},A)})})},Um=h.createContext({strict:!1}),Ju={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Qu=!1;function rC(){if(Qu)return;const e={};for(const t in Ju)e[t]={isEnabled:n=>Ju[t].some(s=>!!n[s])};vm(e),Qu=!0}function zm(){return rC(),BS()}function oC(e){const t=zm();for(const n in e)t[n]={...t[n],...e[n]};vm(t)}const iC=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Do(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||iC.has(e)}let Gm=e=>!Do(e);function aC(e){typeof e=="function"&&(Gm=t=>t.startsWith("on")?!Do(t):e(t))}try{aC(require("@emotion/is-prop-valid").default)}catch{}function lC(e,t,n){const s={};for(const r in e)r==="values"&&typeof e.values=="object"||Xe(e[r])||(Gm(r)||n===!0&&Do(r)||!t&&!Do(r)||e.draggable&&r.startsWith("onDrag"))&&(s[r]=e[r]);return s}const _o=h.createContext({});function cC(e,t){if(Lo(e)){const{initial:n,animate:s}=e;return{initial:n===!1||or(n)?n:void 0,animate:or(s)?s:void 0}}return e.inherit!==!1?t:{}}function uC(e){const{initial:t,animate:n}=cC(e,h.useContext(_o));return h.useMemo(()=>({initial:t,animate:n}),[ed(t),ed(n)])}function ed(e){return Array.isArray(e)?e.join(" "):e}const xl=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Km(e,t,n){for(const s in t)!Xe(t[s])&&!Em(s,n)&&(e[s]=t[s])}function dC({transformTemplate:e},t){return h.useMemo(()=>{const n=xl();return yl(n,t,e),Object.assign({},n.vars,n.style)},[t])}function fC(e,t){const n=e.style||{},s={};return Km(s,n,e),Object.assign(s,dC(e,t)),s}function hC(e,t){const n={},s=fC(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}const qm=()=>({...xl(),attrs:{}});function mC(e,t,n,s){const r=h.useMemo(()=>{const o=qm();return Dm(o,t,Rm(s),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};Km(o,e.style,e),r.style={...o,...r.style}}return r}const pC=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function vl(e){return typeof e!="string"||e.includes("-")?!1:!!(pC.indexOf(e)>-1||/[A-Z]/u.test(e))}function gC(e,t,n,{latestValues:s},r,o=!1,i){const l=(i??vl(e)?mC:hC)(t,s,r,e),c=lC(t,typeof e=="string",o),u=e!==h.Fragment?{...c,...l,ref:n}:{},{children:d}=t,f=h.useMemo(()=>Xe(d)?d.get():d,[d]);return h.createElement(e,{...u,children:f})}function yC({scrapeMotionValuesFromProps:e,createRenderState:t},n,s,r){return{latestValues:bC(n,s,r,e),renderState:t()}}function bC(e,t,n,s){const r={},o=s(e,{});for(const f in o)r[f]=ro(o[f]);let{initial:i,animate:a}=e;const l=Lo(e),c=bm(e);t&&c&&!l&&e.inherit!==!1&&(i===void 0&&(i=t.initial),a===void 0&&(a=t.animate));let u=n?n.initial===!1:!1;u=u||i===!1;const d=u?a:i;if(d&&typeof d!="boolean"&&!Fo(d)){const f=Array.isArray(d)?d:[d];for(let m=0;m<f.length;m++){const p=ll(e,f[m]);if(p){const{transitionEnd:g,transition:b,...w}=p;for(const x in w){let v=w[x];if(Array.isArray(v)){const k=u?v.length-1:0;v=v[k]}v!==null&&(r[x]=v)}for(const x in g)r[x]=g[x]}}}return r}const Xm=e=>(t,n)=>{const s=h.useContext(_o),r=h.useContext(jo),o=()=>yC(e,t,s,r);return n?o():gr(o)},xC=Xm({scrapeMotionValuesFromProps:bl,createRenderState:xl}),vC=Xm({scrapeMotionValuesFromProps:Am,createRenderState:qm}),wC=Symbol.for("motionComponentSymbol");function kC(e,t,n){const s=h.useRef(n);h.useInsertionEffect(()=>{s.current=n});const r=h.useRef(null);return h.useCallback(o=>{o&&e.onMount?.(o);const i=s.current;if(typeof i=="function")if(o){const a=i(o);typeof a=="function"&&(r.current=a)}else r.current?(r.current(),r.current=null):i(o);else i&&(i.current=o);t&&(o?t.mount(o):t.unmount())},[t])}const Zm=h.createContext({});function as(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function SC(e,t,n,s,r,o){const{visualElement:i}=h.useContext(_o),a=h.useContext(Um),l=h.useContext(jo),c=h.useContext(vr),u=c.reducedMotion,d=c.skipAnimations,f=h.useRef(null),m=h.useRef(!1);s=s||a.renderer,!f.current&&s&&(f.current=s(e,{visualState:t,parent:i,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:o}),m.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const p=f.current,g=h.useContext(Zm);p&&!p.projection&&r&&(p.type==="html"||p.type==="svg")&&TC(f.current,n,r,g);const b=h.useRef(!1);h.useInsertionEffect(()=>{p&&b.current&&p.update(n,l)});const w=n[om],x=h.useRef(!!w&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(w)&&window.MotionHasOptimisedAnimation?.(w));return Ga(()=>{m.current=!0,p&&(b.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),x.current&&p.animationState&&p.animationState.animateChanges())}),h.useEffect(()=>{p&&(!x.current&&p.animationState&&p.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(w)}),x.current=!1),p.enteringChildren=void 0)}),p}function TC(e,t,n,s){const{layoutId:r,layout:o,drag:i,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Jm(e.parent)),e.projection.setOptions({layoutId:r,layout:o,alwaysMeasureLayout:!!i||a&&as(a),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:s,crossfade:d,layoutScroll:l,layoutRoot:c,layoutAnchor:u})}function Jm(e){if(e)return e.options.allowProjection!==!1?e.projection:Jm(e.parent)}function Oi(e,{forwardMotionProps:t=!1,type:n}={},s,r){s&&oC(s);const o=n?n==="svg":vl(e),i=o?vC:xC;function a(c,u){let d;const f={...h.useContext(vr),...c,layoutId:CC(c)},{isStatic:m}=f,p=uC(c),g=i(c,m);if(!m&&typeof window<"u"){MC();const b=EC(f);d=b.MeasureLayout,p.visualElement=SC(e,g,f,r,b.ProjectionNode,o)}return y.jsxs(_o.Provider,{value:p,children:[d&&p.visualElement?y.jsx(d,{visualElement:p.visualElement,...f}):null,gC(e,c,kC(g,p.visualElement,u),g,m,t,o)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=h.forwardRef(a);return l[wC]=e,l}function CC({layoutId:e}){const t=h.useContext(za).id;return t&&e!==void 0?t+"-"+e:e}function MC(e,t){h.useContext(Um).strict}function EC(e){const t=zm(),{drag:n,layout:s}=t;if(!n&&!s)return{};const r={...n,...s};return{MeasureLayout:n?.isEnabled(e)||s?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function DC(e,t){if(typeof Proxy>"u")return Oi;const n=new Map,s=(o,i)=>Oi(o,i,e,t),r=(o,i)=>s(o,i);return new Proxy(r,{get:(o,i)=>i==="create"?s:(n.has(i)||n.set(i,Oi(i,void 0,e,t)),n.get(i))})}const PC=(e,t)=>t.isSVG??vl(e)?new rT(t):new JS(t,{allowProjection:e!==h.Fragment});class RC extends En{constructor(t){super(t),t.animationState||(t.animationState=cT(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Fo(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let AC=0;class OC extends En{constructor(){super(...arguments),this.id=AC++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;if(t&&s===!1){if(this.isExitComplete){const{initial:o,custom:i}=this.node.getProps();if(typeof o=="string"){const a=$n(this.node,o,i);if(a){const{transition:l,transitionEnd:c,...u}=a;for(const d in u)this.node.getValue(d)?.jump(u[d])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const NC={animation:{Feature:RC},exit:{Feature:OC}};function wr(e){return{point:{x:e.pageX,y:e.pageY}}}const jC=e=>t=>fl(t)&&e(t,wr(t));function Zs(e,t,n,s){return ir(e,t,jC(n),s)}const Qm=({current:e})=>e?e.ownerDocument.defaultView:null,td=(e,t)=>Math.abs(e-t);function IC(e,t){const n=td(e.x,t.x),s=td(e.y,t.y);return Math.sqrt(n**2+s**2)}const nd=new Set(["auto","scroll"]);class ep{constructor(t,n,{transformPagePoint:s,contextWindow:r=window,dragSnapToOrigin:o=!1,distanceThreshold:i=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=m=>{this.handleScroll(m.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=zr(this.lastRawMoveEventInfo,this.transformPagePoint));const m=Ni(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=IC(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!g)return;const{point:b}=m,{timestamp:w}=Ze;this.history.push({...b,timestamp:w});const{onStart:x,onMove:v}=this.handlers;p||(x&&x(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,m)},this.handlePointerMove=(m,p)=>{this.lastMoveEvent=m,this.lastRawMoveEventInfo=p,this.lastMoveEventInfo=zr(p,this.transformPagePoint),Te.update(this.updatePoint,!0)},this.handlePointerUp=(m,p)=>{this.end();const{onEnd:g,onSessionEnd:b,resumeAnimation:w}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=Ni(m.type==="pointercancel"?this.lastMoveEventInfo:zr(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(m,x),b&&b(m,x)},!fl(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=s,this.distanceThreshold=i,this.contextWindow=r||window;const l=wr(t),c=zr(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=Ze;this.history=[{...u,timestamp:d}];const{onSessionStart:f}=n;f&&f(t,Ni(c,this.history)),this.removeListeners=yr(Zs(this.contextWindow,"pointermove",this.handlePointerMove),Zs(this.contextWindow,"pointerup",this.handlePointerUp),Zs(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const s=getComputedStyle(n);(nd.has(s.overflowX)||nd.has(s.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const s=t===window,r=s?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},o={x:r.x-n.x,y:r.y-n.y};o.x===0&&o.y===0||(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=o.x,this.lastMoveEventInfo.point.y+=o.y):this.history.length>0&&(this.history[0].x-=o.x,this.history[0].y-=o.y),this.scrollPositions.set(t,r),Te.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),fn(this.updatePoint)}}function zr(e,t){return t?{point:t(e.point)}:e}function sd(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ni({point:e},t){return{point:e,delta:sd(e,tp(t)),offset:sd(e,FC(t)),velocity:LC(t,.1)}}function FC(e){return e[0]}function tp(e){return e[e.length-1]}function LC(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const r=tp(e);for(;n>=0&&(s=e[n],!(r.timestamp-s.timestamp>pt(t)));)n--;if(!s)return{x:0,y:0};s===e[0]&&e.length>2&&r.timestamp-s.timestamp>pt(t)*2&&(s=e[1]);const o=xt(r.timestamp-s.timestamp);if(o===0)return{x:0,y:0};const i={x:(r.x-s.x)/o,y:(r.y-s.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function _C(e,{min:t,max:n},s){return t!==void 0&&e<t?e=s?Ne(t,e,s.min):Math.max(e,t):n!==void 0&&e>n&&(e=s?Ne(n,e,s.max):Math.min(e,n)),e}function rd(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function VC(e,{top:t,left:n,bottom:s,right:r}){return{x:rd(e.x,n,r),y:rd(e.y,t,s)}}function od(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,s]=[s,n]),{min:n,max:s}}function WC(e,t){return{x:od(e.x,t.x),y:od(e.y,t.y)}}function BC(e,t){let n=.5;const s=it(e),r=it(t);return r>s?n=nr(t.min,t.max-s,e.min):s>r&&(n=nr(e.min,e.max-r,t.min)),qt(0,1,n)}function $C(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Ta=.35;function YC(e=Ta){return e===!1?e=0:e===!0&&(e=Ta),{x:id(e,"left","right"),y:id(e,"top","bottom")}}function id(e,t,n){return{min:ad(e,t),max:ad(e,n)}}function ad(e,t){return typeof e=="number"?e:e[t]||0}const HC=new WeakMap;class UC{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ke(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:s}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const o=d=>{n&&this.snapToCursor(wr(d).point),this.stopAnimation()},i=(d,f)=>{const{drag:m,dragPropagation:p,onDragStart:g}=this.getProps();if(m&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=gS(m),!this.openDragLock))return;this.latestPointerEvent=d,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Wt(w=>{let x=this.getAxisMotionValue(w).get()||0;if(Kt.test(x)){const{projection:v}=this.visualElement;if(v&&v.layout){const k=v.layout.layoutBox[w];k&&(x=it(k)*(parseFloat(x)/100))}}this.originPoint[w]=x}),g&&Te.update(()=>g(d,f),!1,!0),ga(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(d,f)=>{this.latestPointerEvent=d,this.latestPanInfo=f;const{dragPropagation:m,dragDirectionLock:p,onDirectionLock:g,onDrag:b}=this.getProps();if(!m&&!this.openDragLock)return;const{offset:w}=f;if(p&&this.currentDirection===null){this.currentDirection=GC(w),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,w),this.updateAxis("y",f.point,w),this.visualElement.render(),b&&Te.update(()=>b(d,f),!1,!0)},l=(d,f)=>{this.latestPointerEvent=d,this.latestPanInfo=f,this.stop(d,f),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:d}=this.getProps();(d||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new ep(t,{onSessionStart:o,onStart:i,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:s,contextWindow:Qm(this.visualElement),element:this.visualElement.current})}stop(t,n){const s=t||this.latestPointerEvent,r=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!r||!s)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&Te.postRender(()=>a(s,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,s){const{drag:r}=this.getProps();if(!s||!Gr(t,r,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(i=_C(i,this.constraints[t],this.elastic[t])),o.set(i)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;t&&as(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=VC(s.layoutBox,t):this.constraints=!1,this.elastic=YC(n),r!==this.constraints&&!as(t)&&s&&this.constraints&&!this.hasMutatedConstraints&&Wt(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=$C(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!as(t))return!1;const s=t.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const o=zS(s,r.root,this.visualElement.getTransformPagePoint());let i=WC(r.layout.layoutBox,o);if(n){const a=n(YS(i));this.hasMutatedConstraints=!!a,a&&(i=km(a))}return i}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:r,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=Wt(u=>{if(!Gr(u,n,this.currentDirection))return;let d=l&&l[u]||{};(i===!0||i===u)&&(d={min:0,max:0});const f=r?200:1e6,m=r?40:1e7,p={type:"inertia",velocity:s?t[u]:0,bounceStiffness:f,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...o,...d};return this.startAxisValueAnimation(u,p)});return Promise.all(c).then(a)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return ga(this.visualElement,t),s.start(al(t,s,0,n,this.visualElement,!1))}stopAnimation(){Wt(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),r=s[n];return r||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){Wt(n=>{const{drag:s}=this.getProps();if(!Gr(n,s,this.currentDirection))return;const{projection:r}=this.visualElement,o=this.getAxisMotionValue(n);if(r&&r.layout){const{min:i,max:a}=r.layout.layoutBox[n],l=o.get()||0;o.set(t[n]-Ne(i,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!as(n)||!s||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Wt(i=>{const a=this.getAxisMotionValue(i);if(a&&this.constraints!==!1){const l=a.get();r[i]=BC({min:l,max:l},this.constraints[i])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.constraints=!1,this.resolveConstraints(),Wt(i=>{if(!Gr(i,t,null))return;const a=this.getAxisMotionValue(i),{min:l,max:c}=this.constraints[i];a.set(Ne(l,c,r[i]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;HC.set(this.visualElement,this);const t=this.visualElement.current,n=Zs(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps(),f=c.target,m=f!==t&&kS(f);u&&d&&!m&&this.start(c)});let s;const r=()=>{const{dragConstraints:c}=this.getProps();as(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),s||(s=zC(t,c.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,i=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Te.read(r);const a=ir(window,"resize",()=>this.scalePositionWithinConstraints()),l=o.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Wt(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())}));return()=>{a(),n(),i(),l&&l(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:o=!1,dragElastic:i=Ta,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:r,dragConstraints:o,dragElastic:i,dragMomentum:a}}}function ld(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function zC(e,t,n){const s=mu(e,ld(n)),r=mu(t,ld(n));return()=>{s(),r()}}function Gr(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function GC(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class KC extends En{constructor(t){super(t),this.removeGroupControls=kt,this.removeListeners=kt,this.controls=new UC(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||kt}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const ji=e=>(t,n)=>{e&&Te.update(()=>e(t,n),!1,!0)};class qC extends En{constructor(){super(...arguments),this.removePointerDownListener=kt}onPointerDown(t){this.session=new ep(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Qm(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:ji(t),onStart:ji(n),onMove:ji(s),onEnd:(o,i)=>{delete this.session,r&&Te.postRender(()=>r(o,i))}}}mount(){this.removePointerDownListener=Zs(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Ii=!1;class XC extends h.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:r}=this.props,{projection:o}=t;o&&(n.group&&n.group.add(o),s&&s.register&&r&&s.register(o),Ii&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),oo.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:r,isPresent:o}=this.props,{projection:i}=s;return i&&(i.isPresent=o,t.layoutDependency!==n&&i.setOptions({...i.options,layoutDependency:n}),Ii=!0,r||t.layoutDependency!==n||n===void 0||t.isPresent!==o?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||Te.postRender(()=>{const a=i.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:s}=t;s&&(s.options.layoutAnchor=n,s.root.didUpdate(),dl.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:r}=t;Ii=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function np(e){const[t,n]=Hm(),s=h.useContext(za);return y.jsx(XC,{...e,layoutGroup:s,switchLayoutGroup:h.useContext(Zm),isPresent:t,safeToRemove:n})}const ZC={pan:{Feature:qC},drag:{Feature:KC,ProjectionNode:Ym,MeasureLayout:np}};function cd(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,o=s[r];o&&Te.postRender(()=>o(t,wr(t)))}class JC extends En{mount(){const{current:t}=this.node;t&&(this.unmount=bS(t,(n,s)=>(cd(this.node,s,"Start"),r=>cd(this.node,r,"End"))))}unmount(){}}class QC extends En{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=yr(ir(this.node.current,"focus",()=>this.onFocus()),ir(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function ud(e,t,n){const{props:s}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),o=s[r];o&&Te.postRender(()=>o(t,wr(t)))}class eM extends En{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:s}=this.node.props;this.unmount=TS(t,(r,o)=>(ud(this.node,o,"Start"),(i,{success:a})=>ud(this.node,i,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:s?.tap===!1})}unmount(){}}const Ca=new WeakMap,Fi=new WeakMap,tM=e=>{const t=Ca.get(e.target);t&&t(e)},nM=e=>{e.forEach(tM)};function sM({root:e,...t}){const n=e||document;Fi.has(n)||Fi.set(n,{});const s=Fi.get(n),r=JSON.stringify(t);return s[r]||(s[r]=new IntersectionObserver(nM,{root:e,...t})),s[r]}function rM(e,t,n){const s=sM(t);return Ca.set(e,n),s.observe(e),()=>{Ca.delete(e),s.unobserve(e)}}const oM={some:0,all:1};class iM extends En{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:r="some",once:o}=t,i={root:n?n.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:oM[r]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,o&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:d}=this.node.getProps(),f=c?u:d;f&&f(l)};this.stopObserver=rM(this.node.current,i,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(aM(t,n))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function aM({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const lM={inView:{Feature:iM},tap:{Feature:eM},focus:{Feature:QC},hover:{Feature:JC}},cM={layout:{ProjectionNode:Ym,MeasureLayout:np}},uM={...NC,...lM,...ZC,...cM},et=DC(uM,PC);function wl(e){const t=gr(()=>Un(e)),{isStatic:n}=h.useContext(vr);if(n){const[,s]=h.useState(e);h.useEffect(()=>t.on("change",s),[])}return t}function sp(e,t){const n=wl(t()),s=()=>n.set(t());return s(),Ga(()=>{const r=()=>Te.preRender(s,!1,!0),o=e.map(i=>i.on("change",r));return()=>{o.forEach(i=>i()),fn(s)}}),n}function dM(e){qs.current=[],e();const t=sp(qs.current,e);return qs.current=void 0,t}function rp(e,t,n,s){if(typeof e=="function")return dM(e);const o=typeof t=="function"?t:jS(t,n,s),i=Array.isArray(e)?dd(e,o):dd([e],([l])=>o(l)),a=Array.isArray(e)?void 0:e.accelerate;return a&&!a.isTransformed&&typeof t!="function"&&Array.isArray(n)&&s?.clamp!==!1&&(i.accelerate={...a,times:t,keyframes:n,isTransformed:!0}),i}function dd(e,t){const n=gr(()=>[]);return sp(e,()=>{n.length=0;const s=e.length;for(let r=0;r<s;r++)n[r]=e[r].get();return t(n)})}function fM(e,t={}){const{isStatic:n}=h.useContext(vr),s=()=>Xe(e)?e.get():e;if(n)return rp(s);const r=wl(s());return h.useInsertionEffect(()=>IS(r,e,t),[r,JSON.stringify(t)]),r}function hM(e,t={}){return fM(e,{type:"spring",...t})}function kr(){!gl.current&&xm();const[e]=h.useState(To.current);return e}function ar({children:e,variant:t="primary",size:n="md",onClick:s,disabled:r=!1,className:o="",as:i="button",...a}){const l="inline-flex items-center justify-center font-medium transition-all duration-200 rounded-md focus:outline-none focus:ring-2 focus:ring-oai-blue/30 active:scale-[0.98] active:duration-100",c={primary:"bg-oai-black dark:bg-oai-white text-white dark:text-oai-black border border-transparent hover:bg-oai-gray-800 dark:hover:bg-oai-gray-200 active:bg-oai-gray-900 dark:active:bg-oai-gray-300 disabled:bg-oai-gray-300 dark:disabled:bg-oai-gray-700 disabled:text-oai-gray-500 dark:disabled:text-oai-gray-400 focus:ring-oai-brand/30 transition-colors duration-200",secondary:"bg-oai-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white border border-oai-gray-300 dark:border-oai-gray-700 hover:border-oai-brand hover:text-oai-brand active:bg-oai-gray-50 dark:active:bg-oai-gray-800 active:border-oai-brand-dark disabled:text-oai-gray-400 dark:disabled:text-oai-gray-500 disabled:border-oai-gray-200 dark:disabled:border-oai-gray-700 focus:ring-oai-brand/30 transition-colors duration-200",ghost:"bg-transparent text-oai-gray-600 dark:text-oai-gray-300 border border-transparent hover:text-oai-brand hover:bg-oai-brand-50/50 dark:hover:bg-oai-brand-950/30 active:bg-oai-brand-50 dark:active:bg-oai-brand-900/50 disabled:text-oai-gray-400 dark:disabled:text-oai-gray-500 focus:ring-oai-brand/30 transition-colors duration-200"},u={sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-12 px-6 text-base"},d=r?"cursor-not-allowed opacity-60":"cursor-pointer",f=`${l} ${c[t]} ${u[n]} ${d} ${o}`;return y.jsx(i,{className:f,onClick:s,disabled:r,...a,children:e})}function Vo({children:e,title:t,subtitle:n,className:s="",bodyClassName:r=""}){return y.jsxs("div",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 transition-colors duration-200 ${s}`,children:[(t||n)&&y.jsxs("div",{className:"px-5 py-4 border-b border-oai-gray-200 dark:border-oai-gray-800 transition-colors duration-200",children:[t&&y.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide transition-colors duration-200",children:t}),n&&y.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300 mt-1 transition-colors duration-200",children:n})]}),y.jsx("div",{className:`p-5 ${r}`,children:e})]})}function mM({theme:e,onToggle:t,className:n="",size:s=36,iconSize:r=20}){const o=kr(),i=e==="dark",a=()=>{t?.(i?"light":"dark")},l={width:s,height:s,borderRadius:8,background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--oai-gray-600)",transition:"background-color 150ms ease, color 150ms ease"},c={backgroundColor:"var(--oai-gray-100)",color:"var(--oai-black)"},u=()=>y.jsxs("svg",{"aria-hidden":"true",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("circle",{cx:"12",cy:"12",r:"4"}),y.jsx("path",{d:"M12 2v2"}),y.jsx("path",{d:"M12 20v2"}),y.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),y.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),y.jsx("path",{d:"M2 12h2"}),y.jsx("path",{d:"M20 12h2"}),y.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),y.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]}),d=()=>y.jsx("svg",{"aria-hidden":"true",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:y.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})});return o?y.jsx("button",{type:"button","aria-label":i?"Switch to light mode":"Switch to dark mode",onClick:a,className:`oai-button-ghost oai-button-sm ${n}`,style:{...l,width:s,height:s,padding:0},title:i?"切换到亮色模式":"切换到暗色模式",onMouseEnter:f=>{f.currentTarget.style.backgroundColor=c.backgroundColor,f.currentTarget.style.color=c.color},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent",f.currentTarget.style.color="var(--oai-gray-600)"},children:i?y.jsx(d,{}):y.jsx(u,{})}):y.jsx(et.button,{type:"button","aria-label":i?"Switch to light mode":"Switch to dark mode",onClick:a,className:`oai-button-ghost oai-button-sm ${n}`,style:{...l,width:s,height:s,padding:0},title:i?"切换到亮色模式":"切换到暗色模式",whileHover:{backgroundColor:"var(--oai-gray-100)",color:"var(--oai-black)"},whileTap:{scale:.95},transition:{type:"spring",stiffness:400,damping:25},children:y.jsx(et.div,{initial:{scale:.8,opacity:0,rotate:-20},animate:{scale:1,opacity:1,rotate:0},exit:{scale:.8,opacity:0,rotate:20},transition:{type:"spring",stiffness:400,damping:25},children:i?y.jsx(d,{}):y.jsx(u,{})},i?"moon":"sun")})}function pM(){return y.jsxs("div",{className:"flex items-center gap-2.5",children:[y.jsx("div",{className:"w-8 h-8 rounded-lg bg-oai-black dark:bg-oai-white flex items-center justify-center",children:y.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"text-oai-white dark:text-oai-black",children:[y.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),y.jsx("path",{d:"M2 17l10 5 10-5M2 12l10 5 10-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),y.jsx("span",{className:"text-base font-semibold text-oai-black dark:text-oai-white leading-tight",children:"Token Tracker"})]})}function gM({repo:e="mm7894215/tokentracker"}){const[t,n]=h.useState(null);return h.useEffect(()=>{if(typeof window>"u")return;const s=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,r=typeof document<"u"&&(document.documentElement?.classList.contains("screenshot-capture")||document.body?.classList.contains("screenshot-capture"));dw({prefersReducedMotion:s,screenshotCapture:r})&&fetch(`https://api.github.com/repos/${e}`).then(o=>o.json()).then(o=>{o&&typeof o.stargazers_count=="number"&&n(o.stargazers_count)}).catch(()=>{})},[e]),y.jsxs("a",{href:`https://github.com/${e}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 transition-colors no-underline",children:[y.jsx("svg",{height:"16",viewBox:"0 0 16 16",width:"16",className:"fill-oai-gray-700 dark:fill-oai-gray-300",children:y.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),y.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300",children:"Star"}),t!==null&&y.jsx("span",{className:"text-xs font-semibold text-oai-gray-900 dark:text-oai-white tabular-nums",children:t})]})}function yM({children:e,header:t,footer:n,className:s="",hideHeader:r=!1,hideFooter:o=!1}){const{resolvedTheme:i,toggleTheme:a}=_a();return y.jsxs("div",{className:`min-h-screen bg-oai-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-sans flex flex-col transition-colors duration-200 ${s}`,children:[!r&&y.jsxs("header",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 flex items-center justify-between transition-colors duration-200",children:[y.jsx(pM,{}),y.jsx("div",{className:"flex-1 flex justify-center",children:t}),y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx(gM,{}),y.jsx(mM,{theme:i,onToggle:a})]})]}),y.jsx("main",{className:"flex-1 px-6 py-6",children:e}),!o&&n&&y.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 mt-auto transition-colors duration-200",children:n})]})}function bM({children:e,variant:t="info",size:n="md",className:s=""}){const r="inline-flex items-center font-medium",o={success:"bg-oai-brand-100 dark:bg-oai-brand-900/30 text-oai-brand-700 dark:text-oai-brand-400 rounded-full",warning:"bg-oai-amber-50 dark:bg-oai-amber-900/30 text-oai-amber-dark dark:text-oai-amber-400 rounded-full",error:"bg-red-50 dark:bg-red-900/30 text-red-600 dark:text-red-400 rounded-full",info:"bg-oai-gray-100 dark:bg-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 rounded-full",secondary:"bg-oai-gray-100 dark:bg-oai-gray-800 text-oai-gray-500 dark:text-oai-gray-300 rounded-md"},i={sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-sm"},a=`${r} ${o[t]} ${i[n]} ${s}`.trim();return y.jsx("span",{className:a,children:e})}var xM={};function vM(e,t){return e==="."?{width:"0.34ch",justifyContent:"center",marginInline:"-0.04ch"}:e===","?{width:"0.08ch",justifyContent:"center",marginInline:"-0.30ch"}:{width:"0.72ch",justifyContent:"flex-start",paddingLeft:"0.04ch",height:t}}function wM({mv:e,digit:t,height:n}){const s=rp(e,r=>{const o=(r%10+10)%10,i=(10+t-o)%10;let a=i*n;return i>5&&(a-=10*n),a});return y.jsx(et.span,{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",y:s},children:t})}function kM(e){const t=Math.round(e),n=1e-9*Math.max(1,Math.abs(e));return Math.abs(e-t)<n?t:e}function SM(e,t){const n=e/t;return Math.floor(kM(n))}function TM(e){const t=String(e??""),n=Array.from(t),s=n.indexOf(".");let r=n.filter((a,l)=>/\d/.test(a)&&(s===-1||l<s)).length,o=0,i=!1;return n.map(a=>{if(!/\d/.test(a))return a==="."&&(i=!0),a;if(!i){const l=10**Math.max(r-1,0);return r-=1,l}return o+=1,10**-o})}function CM({place:e,value:t,height:n,digitStyle:s,shouldReduceMotion:r}){if(typeof e!="number"){const l=vM(e,n);return y.jsx("span",{"data-counter-token":"static",className:"relative inline-flex items-center justify-center",style:{height:n,...l,...s},children:e})}const o=SM(t,e),i=wl(0),a=hM(i,{stiffness:220,damping:26,mass:.8});return h.useEffect(()=>{i.set(o)},[i,o]),r?y.jsx("span",{"data-counter-token":"digit",className:"relative inline-flex items-center justify-center overflow-hidden",style:{height:n,position:"relative",width:"0.9ch",fontVariantNumeric:"tabular-nums",...s},children:Math.abs(o)%10}):y.jsx("span",{"data-counter-token":"digit",className:"relative inline-flex overflow-hidden",style:{height:n,position:"relative",width:"0.9ch",fontVariantNumeric:"tabular-nums",...s},children:Array.from({length:10},(l,c)=>y.jsx(wM,{mv:a,digit:c,height:n},c))})}function MM({value:e,displayValue:t,fontSize:n=72,padding:s=0,places:r,gap:o=6,borderRadius:i=4,horizontalPadding:a=0,textColor:l="inherit",fontWeight:c="inherit",containerStyle:u,counterStyle:d,digitStyle:f,gradientHeight:m=14,gradientFrom:p="rgba(255,255,255,0.95)",gradientTo:g="rgba(255,255,255,0)",topGradientStyle:b,bottomGradientStyle:w}){const x=String(t??e??""),v=h.useMemo(()=>Array.isArray(r)&&r.length?r:TM(x),[r,x]),k=typeof navigator<"u"&&/jsdom/i.test(navigator.userAgent||"")||typeof process<"u"&&xM?.VITEST==="true",S=kr()||k,C=Number.isFinite(Number(e))?Math.abs(Number(e)):0,E=n+s;return S?y.jsx("span",{"data-counter-root":"true",style:{display:"inline-flex",alignItems:"center",color:l,fontSize:n,fontWeight:c,lineHeight:1,...u,...d},children:x}):y.jsxs("span",{"data-counter-root":"true",style:{position:"relative",display:"inline-block",...u},children:[y.jsx("span",{style:{fontSize:n,display:"flex",gap:o,overflow:"hidden",borderRadius:i,paddingLeft:a,paddingRight:a,lineHeight:1,color:l,fontWeight:c,...d},children:v.map((M,A)=>y.jsx(CM,{place:M,value:C,height:E,digitStyle:f,shouldReduceMotion:S},`${String(M)}-${A}`))}),y.jsxs("span",{style:{pointerEvents:"none",position:"absolute",inset:0,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[y.jsx("span",{style:b??{height:m,background:`linear-gradient(to bottom, ${p}, ${g})`}}),y.jsx("span",{style:w??{height:m,background:`linear-gradient(to top, ${p}, ${g})`}})]})]})}const op=h.createContext(void 0);function Zn(e){const t=h.useContext(op);if(e===!1&&t===void 0)throw new Error(zn(27));return t}const EM={...pr,...Oo},DM=h.forwardRef(function(t,n){const{render:s,className:r,forceRender:o=!1,...i}=t,{store:a}=Zn(),l=a.useState("open"),c=a.useState("nested"),u=a.useState("mounted"),d=a.useState("transitionStatus"),f=h.useMemo(()=>({open:l,transitionStatus:d}),[l,d]);return hn("div",t,{state:f,ref:[a.context.backdropRef,n],stateAttributesMapping:EM,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},i],enabled:o||!c})}),fd=h.forwardRef(function(t,n){const{render:s,className:r,disabled:o=!1,nativeButton:i=!0,...a}=t,{store:l}=Zn(),c=l.useState("open");function u(p){c&&l.setOpen(!1,_e(Ny,p.nativeEvent))}const{getButtonProps:d,buttonRef:f}=Wd({disabled:o,native:i}),m=h.useMemo(()=>({disabled:o}),[o]);return hn("button",t,{state:m,ref:[n,f],props:[{onClick:u},a,d]})});let PM=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),RM=(function(e){return e[e.open=jt.open]="open",e[e.closed=jt.closed]="closed",e[e.startingStyle=jt.startingStyle]="startingStyle",e[e.endingStyle=jt.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const ip=h.createContext(void 0);function ap(){const e=h.useContext(ip);if(e===void 0)throw new Error(zn(26));return e}const AM={...pr,...Oo,nestedDialogOpen(e){return e?{[RM.nestedDialogOpen]:""}:null}},OM=h.forwardRef(function(t,n){const{className:s,finalFocus:r,initialFocus:o,render:i,...a}=t,{store:l}=Zn(),c=l.useState("descriptionElementId"),u=l.useState("disablePointerDismissal"),d=l.useState("floatingRootContext"),f=l.useState("popupProps"),m=l.useState("modal"),p=l.useState("mounted"),g=l.useState("nested"),b=l.useState("nestedOpenDialogCount"),w=l.useState("open"),x=l.useState("openMethod"),v=l.useState("titleElementId"),k=l.useState("transitionStatus"),S=l.useState("role");ap(),Ha({open:w,ref:l.context.popupRef,onComplete(){w&&l.context.onOpenChangeComplete?.(!0)}});function C(R){return R==="touch"?l.context.popupRef.current:!0}const E=o===void 0?C:o,M=b>0,A=h.useMemo(()=>({open:w,nested:g,transitionStatus:k,nestedDialogOpen:M}),[w,g,k,M]),T=hn("div",t,{state:A,props:[f,{"aria-labelledby":v??void 0,"aria-describedby":c??void 0,role:S,tabIndex:-1,hidden:!p,onKeyDown(R){ph.has(R.key)&&R.stopPropagation()},style:{[PM.nestedDialogs]:b}},a],ref:[n,l.context.popupRef,l.useStateSetter("popupElement")],stateAttributesMapping:AM});return y.jsx(Wf,{context:d,openInteractionType:x,disabled:!p,closeOnFocusOut:!u,initialFocus:E,returnFocus:r,modal:m!==!1,restoreFocus:"popup",children:T})}),NM=h.forwardRef(function(t,n){const{keepMounted:s=!1,...r}=t,{store:o}=Zn(),i=o.useState("mounted"),a=o.useState("modal"),l=o.useState("open");return i||s?y.jsx(ip.Provider,{value:s,children:y.jsxs(Vf,{ref:n,...r,children:[i&&a===!0&&y.jsx(lh,{ref:o.context.internalBackdropRef,inert:oh(!l)}),t.children]})}):null});function jM(e){const{store:t,parentContext:n,actionsRef:s}=e,r=t.useState("open"),o=t.useState("disablePointerDismissal"),i=t.useState("modal"),a=t.useState("popupElement"),{openMethod:l,triggerProps:c,reset:u}=rh(r);Zf(t);const{forceUnmount:d}=Jf(r,t,()=>{u()}),f=he(T=>{const R=_e(T);return R.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},R}),m=h.useCallback(()=>{t.setOpen(!1,f(Bd))},[t,f]);h.useImperativeHandle(s,()=>({unmount:d,close:m}),[d,m]);const p=th({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[g,b]=h.useState(0),w=g===0,x=sh(p),v=qf(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(T){if("button"in T&&T.button!==0||"touches"in T&&T.touches.length!==1)return!1;const R=ht(T);if(w&&!o){const O=R;return i&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===O||t.context.backdropRef.current===O||Se(O,a)&&!O?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:w});ih(r&&i===!0,a);const{getReferenceProps:k,getFloatingProps:S,getTriggerProps:C}=Ua([x,v]);t.useContextCallback("onNestedDialogOpen",T=>{b(T+1)}),t.useContextCallback("onNestedDialogClose",()=>{b(0)}),h.useEffect(()=>(n?.onNestedDialogOpen&&r&&n.onNestedDialogOpen(g),n?.onNestedDialogClose&&!r&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&r&&n.onNestedDialogClose()}),[r,n,g]);const E=h.useMemo(()=>k(c),[k,c]),M=h.useMemo(()=>C(c),[C,c]),A=h.useMemo(()=>S(),[S]);t.useSyncedValues({openMethod:l,activeTriggerProps:E,inactiveTriggerProps:M,popupProps:A,floatingRootContext:p,nestedOpenDialogCount:g})}const IM={...eh,modal:pe(e=>e.modal),nested:pe(e=>e.nested),nestedOpenDialogCount:pe(e=>e.nestedOpenDialogCount),disablePointerDismissal:pe(e=>e.disablePointerDismissal),openMethod:pe(e=>e.openMethod),descriptionElementId:pe(e=>e.descriptionElementId),titleElementId:pe(e=>e.titleElementId),viewportElement:pe(e=>e.viewportElement),role:pe(e=>e.role)};class FM extends Va{constructor(t){super(LM(t),{popupRef:h.createRef(),backdropRef:h.createRef(),internalBackdropRef:h.createRef(),triggerElements:new No,onOpenChange:void 0,onOpenChangeComplete:void 0},IM)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;const s={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",s);const r={open:t},o=n.trigger?.id??null;(o||t)&&(r.activeTriggerId=o,r.activeTriggerElement=n.trigger??null),this.update(r)}}function LM(e={}){return{...Qf(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function _M(e){const{children:t,open:n,defaultOpen:s=!1,onOpenChange:r,onOpenChangeComplete:o,disablePointerDismissal:i=!1,modal:a=!0,actionsRef:l,handle:c,triggerId:u,defaultTriggerId:d=null}=e,f=Zn(!0),m=!!f,p=Cn(()=>c?.store??new FM({open:n??s,activeTriggerId:u!==void 0?u:d,modal:a,disablePointerDismissal:i,nested:m})).current;p.useControlledProp("open",n,s),p.useControlledProp("activeTriggerId",u,d),p.useSyncedValues({disablePointerDismissal:i,nested:m,modal:a}),p.useContextCallback("onOpenChange",r),p.useContextCallback("onOpenChangeComplete",o);const g=p.useState("payload");jM({store:p,actionsRef:l,parentContext:f?.store.context});const b=h.useMemo(()=>({store:p}),[p]);return y.jsx(op.Provider,{value:b,children:typeof t=="function"?t({payload:g}):t})}let hd=(function(e){return e[e.open=jt.open]="open",e[e.closed=jt.closed]="closed",e[e.startingStyle=jt.startingStyle]="startingStyle",e[e.endingStyle=jt.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const VM={...pr,...Oo,nested(e){return e?{[hd.nested]:""}:null},nestedDialogOpen(e){return e?{[hd.nestedDialogOpen]:""}:null}},WM=h.forwardRef(function(t,n){const{className:s,render:r,children:o,...i}=t,a=ap(),{store:l}=Zn(),c=l.useState("open"),u=l.useState("nested"),d=l.useState("transitionStatus"),f=l.useState("nestedOpenDialogCount"),m=l.useState("mounted"),p=f>0,g=h.useMemo(()=>({open:c,nested:u,transitionStatus:d,nestedDialogOpen:p}),[c,u,d,p]);return hn("div",t,{enabled:a||m,state:g,ref:[n,l.useStateSetter("viewportElement")],stateAttributesMapping:VM,props:[{role:"presentation",hidden:!m,children:o},i]})}),BM=h.forwardRef(function(t,n){const{render:s,className:r,id:o,...i}=t,{store:a}=Zn(),l=$d(o);return a.useSyncedValueWithCleanup("titleElementId",l),hn("h2",t,{ref:n,props:[{id:l},i]})});function md(e){if(!Number.isFinite(e))return V("shared.placeholder.short");const t=Ra(e.toFixed(6));return t==="-"?V("shared.placeholder.short"):t}function $M(e){return!Number.isFinite(e)||e<=0?null:e<.01?"<$0.01":Ra(e.toFixed(2))}const YM=q.memo(function({isOpen:t,onClose:n,fleetData:s=[]}){if(!t)return null;const r=V("shared.unit.percent"),o=(Array.isArray(s)?s:[]).map(l=>{const c=vt(l?.usd),u=Number.isFinite(c)?c:0,d=Array.isArray(l?.models)?l.models:[];return{label:l?.label?String(l.label):"",usdValue:u,usdLabel:md(u),models:d.map(f=>{const m=vt(f?.share),p=Number.isFinite(m)?`${m}${r}`:V("shared.placeholder.short"),g=vt(f?.cost),b=$M(g);return{id:f?.id?String(f.id):"",name:f?.name?String(f.name):"",shareLabel:p,costLabel:b}})}}),i=o.reduce((l,c)=>l+c.usdValue,0),a=md(i);return y.jsx(_M,{open:t,onOpenChange:l=>{l||n?.()},children:y.jsxs(NM,{children:[y.jsx(DM,{className:"cost-modal-backdrop","data-cost-analysis-backdrop":"true"}),y.jsx(WM,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:y.jsxs(OM,{className:"cost-modal-popup w-full max-w-xl rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-oai-lg overflow-hidden",children:[y.jsxs("div",{className:"px-6 py-4 border-b border-oai-gray-200 dark:border-oai-gray-800 flex items-center justify-between",children:[y.jsx(BM,{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:V("dashboard.cost_breakdown.title")}),y.jsx(fd,{type:"button",className:"w-7 h-7 flex items-center justify-center rounded-md text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-gray-600 dark:hover:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors","aria-label":V("dashboard.cost_breakdown.close"),children:"✕"})]}),y.jsxs("div",{className:"px-6 py-6 text-center border-b border-oai-gray-100 dark:border-oai-gray-800",children:[y.jsx("div",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400 uppercase tracking-wide mb-2",children:V("dashboard.cost_breakdown.total_label")}),y.jsx("div",{className:"text-3xl font-bold text-oai-brand tabular-nums tracking-tight",children:a})]}),y.jsx("div",{className:"px-6 py-4 max-h-[45vh] overflow-y-auto oai-scrollbar",children:y.jsx("div",{className:"space-y-5",children:o.map((l,c)=>y.jsxs("div",{children:[y.jsxs("div",{className:"flex justify-between items-baseline pb-2 mb-2 border-b border-oai-gray-100 dark:border-oai-gray-800",children:[y.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white",children:l.label}),y.jsx("span",{className:"text-sm font-semibold text-oai-brand tabular-nums",children:l.usdLabel})]}),y.jsx("div",{className:"space-y-1",children:l.models.map((u,d)=>{const f=u?.id||`${u.name}-${d}`;return y.jsxs("div",{className:"flex justify-between items-center py-1 text-xs",children:[y.jsxs("span",{className:"text-oai-gray-600 dark:text-oai-gray-300",children:[u.name,y.jsx("span",{className:"ml-1.5 text-oai-gray-400 dark:text-oai-gray-500 tabular-nums",children:u.shareLabel})]}),u.costLabel?y.jsx("span",{className:"text-oai-gray-600 dark:text-oai-gray-300 font-medium tabular-nums",children:u.costLabel}):null]},f)})})]},`${l.label}-${c}`))})}),y.jsxs("div",{className:"px-6 py-4 border-t border-oai-gray-200 dark:border-oai-gray-800 flex justify-between items-center",children:[y.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500",children:V("dashboard.cost_breakdown.footer")}),y.jsx(fd,{render:y.jsx(ar,{variant:"secondary",size:"sm"}),children:V("dashboard.cost_breakdown.close")})]})]})})]})})});function HM({projectEntries:e=[],projectLimit:t=3,onProjectLimitChange:n,copy:s,hasDetailsActual:r,dailyEmptyPrefix:o,installSyncCmd:i,dailyEmptySuffix:a,detailsColumns:l,ariaSortFor:c,toggleSort:u,sortIconFor:d,pagedDetails:f,dailyBreakdownRows:m=[],dailyBreakdownColumns:p=[],dailyBreakdownAriaSortFor:g,dailyBreakdownSortIconFor:b,dailyBreakdownDateKey:w="day",detailsDateKey:x,renderDetailDate:v,renderDailyBreakdownDate:k,renderDetailCell:S,DETAILS_PAGED_PERIODS:C,period:E,detailsPageCount:M,detailsPage:A,setDetailsPage:T}){const[R,O]=h.useState("daily");return y.jsxs(Vo,{children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[y.jsxs("div",{role:"tablist","aria-label":"Data view",className:"flex gap-1",children:[y.jsx("button",{role:"tab","aria-selected":R==="daily",type:"button",onClick:()=>O("daily"),className:`text-xs font-medium px-3 py-1.5 rounded transition-colors ${R==="daily"?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/50"}`,children:s("dashboard.daily.title")}),y.jsx("button",{role:"tab","aria-selected":R==="projects",type:"button",onClick:()=>O("projects"),className:`text-xs font-medium px-3 py-1.5 rounded transition-colors ${R==="projects"?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/50"}`,children:s("dashboard.projects.title")})]}),R==="projects"&&y.jsxs("select",{"aria-label":"Number of projects to display",value:t,onChange:D=>n?.(Number(D.target.value)),className:"text-xs text-oai-gray-600 dark:text-oai-gray-300 bg-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-700 rounded px-2 py-1 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 focus:border-oai-brand dark:focus:border-oai-brand focus:outline-none transition-colors",children:[y.jsx("option",{value:3,children:s("dashboard.projects.limit_top_3")}),y.jsx("option",{value:6,children:s("dashboard.projects.limit_top_6")}),y.jsx("option",{value:10,children:s("dashboard.projects.limit_top_10")})]})]}),R==="projects"&&y.jsx("div",{className:"space-y-1",children:e.slice(0,t).map(D=>y.jsxs("a",{href:D?.project_ref||"#",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-2 rounded-lg hover:oai-bg-elevated transition-colors",children:[y.jsx("div",{className:"w-8 h-8 rounded-md oai-bg-elevated flex items-center justify-center oai-text-caption font-medium text-oai-gray-500 dark:text-oai-gray-300",children:(D?.project_key?.[0]||"?").toUpperCase()}),y.jsx("div",{className:"min-w-0 flex-1",children:y.jsx("div",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white truncate",children:D?.project_key||D?.project_ref?.split("/")?.pop()||"—"})}),y.jsx("div",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",children:D?.billable_total_tokens?.toLocaleString?.()||D?.total_tokens?.toLocaleString?.()||"—"})]},D?.project_key||D?.project_ref))}),R==="daily"&&y.jsxs("div",{children:[m?.length===0?y.jsxs("div",{className:"oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300 mb-4",children:[o,y.jsx("code",{className:"mx-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 oai-bg-elevated px-1.5 py-0.5 font-mono oai-text-caption",children:i}),a]}):y.jsx("div",{className:"overflow-auto max-h-[384px] -mx-4 oai-scrollbar",children:y.jsxs("table",{className:"w-full border-collapse",children:[y.jsx("thead",{className:"sticky top-0 z-10",children:y.jsx("tr",{className:"border-b border-oai-gray-200 dark:border-oai-gray-700",children:p.map(D=>y.jsx("th",{"aria-sort":g?.(D.key)||"none",className:"text-left p-0 bg-white dark:bg-oai-gray-900",children:y.jsx("button",{type:"button",onClick:()=>u(D.key),className:"flex w-full items-center justify-start px-4 py-2 text-left oai-text-caption font-semibold text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white transition-colors",children:y.jsxs("span",{className:"inline-flex items-center gap-1",children:[y.jsx("span",{children:D.label}),y.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-400",children:b?.(D.key)||""})]})})},D.key))})}),y.jsx("tbody",{children:m.map(D=>y.jsxs("tr",{className:`border-b border-oai-gray-100 dark:border-oai-gray-800 last:border-b-0 hover:bg-oai-gray-50/50 dark:hover:bg-oai-gray-800/50 transition-colors ${D.missing?"text-oai-gray-400 dark:text-oai-gray-400":D.future?"text-oai-gray-300 dark:text-oai-gray-600":"text-oai-black dark:text-oai-white"}`,children:[y.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300",children:k?k(D):v(D)}),y.jsx("td",{className:"px-4 py-2 oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",children:S(D,"total_tokens")}),y.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(D,"input_tokens")}),y.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(D,"output_tokens")}),y.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(D,"cached_input_tokens")}),y.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(D,"reasoning_output_tokens")}),y.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:S(D,"conversation_count")})]},String(D?.[w]||D?.day||D?.hour||D?.month||"")))})]})}),R!=="daily"&&C.has(E)&&M>1?y.jsxs("div",{className:"mt-3 flex items-center justify-between oai-text-caption",children:[y.jsx("button",{type:"button",onClick:()=>T(D=>Math.max(0,D-1)),disabled:A===0,className:"px-3 py-1.5 text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:s("details.pagination.prev")}),y.jsxs("span",{className:"oai-text-muted",children:[A+1," / ",M]}),y.jsx("button",{type:"button",onClick:()=>T(D=>Math.min(M-1,D+1)),disabled:A+1>=M,className:"px-3 py-1.5 text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:s("details.pagination.next")})]}):null]})]})}function bn({children:e,delay:t=0,duration:n=.4,y:s=20,className:r="",once:o=!0}){return kr()?y.jsx("div",{className:r,children:e}):y.jsx(et.div,{initial:{opacity:0,y:s},animate:{opacity:1,y:0},transition:{duration:n,delay:t,ease:[.25,.1,.25,1]},className:r,children:e})}function io(e){return typeof e!="string"?"":e.trim()}function pd(e){const t=io(e);return t?t.split(/[_\-\s]+/).filter(Boolean).map(n=>n.slice(0,1).toUpperCase()+n.slice(1).toLowerCase()).join(" "):""}function UM(e){if(!Array.isArray(e))return[];const t=new Map;for(const n of e){if(!n||typeof n!="object")continue;const s=io(n.tool),r=io(n.planType)||io(n.plan_type);if(!s||!r)continue;const o=pd(s)||s,i=pd(r)||r;t.set(`${s.toLowerCase()}::${r.toLowerCase()}`,{tool:o,plan:i})}return Array.from(t.values())}function zM({period:e="month",rankLabel:t,streakDays:n,subscriptions:s=[],periodConversations:r,rolling:o,topModels:i=[],className:a=""}){const l=V("shared.placeholder.short"),c=V("shared.unit.percent"),u=t??V("identity_card.rank_placeholder"),d=Number.isFinite(Number(n))?Number(n):0,f=d?V("identity_card.streak_value",{days:d}):V("identity_card.rank_placeholder"),m=UM(s),p={thousandSuffix:V("shared.unit.thousand_abbrev"),millionSuffix:V("shared.unit.million_abbrev"),billionSuffix:V("shared.unit.billion_abbrev")},g=x=>{if(x==null)return l;const v=Yd(x,p);return v==="-"?l:v},b=(()=>{switch(e){case"day":return"today convs";case"week":return"week convs";case"month":return"month convs";case"total":return"all convs";default:return"convs"}})(),w=i.slice(0,3);return y.jsx(bn,{delay:.1,children:y.jsxs(Vo,{className:`h-full ${a}`,children:[y.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[y.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[y.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:g(o?.last_7d?.totals?.billable_total_tokens)}),y.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:"7d"})]}),y.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[y.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:g(o?.last_30d?.totals?.billable_total_tokens)}),y.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:"30d"})]}),y.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[y.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:g(o?.last_30d?.avg_per_active_day)}),y.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:"avg"})]}),y.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[y.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:g(r)}),y.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:b})]})]}),w.length>0&&y.jsx("div",{className:"mt-4 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800",children:w.map((x,v)=>{const k=x?.name?String(x.name):l,S=x?.percent?String(x.percent):"",C=v===w.length-1,E=v+1;return y.jsxs("div",{className:`flex items-center py-2 ${C?"":"border-b border-oai-gray-50 dark:border-oai-gray-800"}`,children:[y.jsx("span",{className:"w-5 h-5 flex items-center justify-center rounded-full bg-oai-gray-100 dark:bg-oai-gray-800 text-[10px] font-semibold text-oai-gray-500 dark:text-oai-gray-300 flex-shrink-0",children:E}),y.jsx("span",{className:"flex-1 text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate px-2.5",title:k,children:k}),y.jsxs("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums flex-shrink-0",children:[S,c]})]},x.id||k)})}),m.length>0&&y.jsx("div",{className:"mt-3 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800 flex flex-wrap gap-1.5",children:m.map((x,v)=>y.jsxs(bM,{variant:"secondary",size:"sm",children:[x.tool," ",x.plan]},`${x.tool}:${x.plan}:${v}`))}),y.jsxs("div",{className:"mt-4 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800 flex items-center justify-between text-xs text-oai-gray-400 dark:text-oai-gray-400",children:[y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx("span",{children:V("identity_card.rank_label")}),y.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:u})]}),y.jsxs("div",{className:"flex items-center gap-1",children:[y.jsx("span",{children:V("identity_card.streak_label")}),y.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:f})]})]})]})})}const lp=h.createContext(void 0);function Sr(e){const t=h.useContext(lp);if(t===void 0&&!e)throw new Error(zn(47));return t}function GM(){return{...Qf(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const KM={...eh,disabled:pe(e=>e.disabled),instantType:pe(e=>e.instantType),openMethod:pe(e=>e.openMethod),openChangeReason:pe(e=>e.openChangeReason),modal:pe(e=>e.modal),stickIfOpen:pe(e=>e.stickIfOpen),titleElementId:pe(e=>e.titleElementId),descriptionElementId:pe(e=>e.descriptionElementId),openOnHover:pe(e=>e.openOnHover),closeDelay:pe(e=>e.closeDelay),hasViewport:pe(e=>e.hasViewport)};class kl extends Va{constructor(t){const n={...GM(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:h.createRef(),backdropRef:h.createRef(),internalBackdropRef:h.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:h.createRef(),beforeContentFocusGuardRef:h.createRef(),stickIfOpenTimeout:new Sn,triggerElements:new No},KM)}setOpen=(t,n)=>{const s=n.reason===ft,r=n.reason===wn&&n.event.detail===0,o=!t&&(n.reason===Vd||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const i={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested,triggerElement:n.trigger};this.state.floatingRootContext.context.events?.emit("openchange",i);const l=()=>{const c={open:t,openChangeReason:n.reason},u=n.trigger?.id??null;(u||t)&&(c.activeTriggerId=u,c.activeTriggerElement=n.trigger??null),this.update(c)};s?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Jy,()=>{this.set("stickIfOpen",!1)}),kn.flushSync(l)):l(),r||o?this.set("instantType",r?"click":"dismiss"):n.reason===Qs?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const s=Cn(()=>new kl(n)).current,r=t??s;return Aa(s.disposeEffect),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function gd({props:e}){const{children:t,open:n,defaultOpen:s=!1,onOpenChange:r,onOpenChangeComplete:o,modal:i=!1,handle:a,triggerId:l,defaultTriggerId:c=null}=e,u=kl.useStore(a?.store,{open:n??s,modal:i,activeTriggerId:l!==void 0?l:c});u.useControlledProp("open",n,s),u.useControlledProp("activeTriggerId",l,c);const d=u.useState("open"),f=u.useState("positionerElement"),m=u.useState("payload"),p=u.useState("openChangeReason");u.useContextCallback("onOpenChange",r),u.useContextCallback("onOpenChangeComplete",o);const{openMethod:g,triggerProps:b,reset:w}=rh(d);Zf(u);const{forceUnmount:x}=Jf(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null}),w()});ih(d&&i===!0&&p!==ft&&g!=="touch",f),h.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);const v=h.useCallback(N=>{const _=_e(N);return _.preventUnmountOnClose=()=>{u.set("preventUnmountingOnClose",!0)},_},[u]),k=h.useCallback(()=>{u.setOpen(!1,v(Bd))},[u,v]);h.useImperativeHandle(e.actionsRef,()=>({unmount:x,close:k}),[x,k]);const S=th({popupStore:u,onOpenChange:u.setOpen}),C=qf(S,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),E=sh(S),{getReferenceProps:M,getFloatingProps:A,getTriggerProps:T}=Ua([C,E]),R=h.useMemo(()=>M(b),[M,b]),O=h.useMemo(()=>T(b),[T,b]),D=h.useMemo(()=>A(),[A]);u.useSyncedValues({modal:i,openMethod:g,activeTriggerProps:R,inactiveTriggerProps:O,popupProps:D,floatingRootContext:S,nested:Xn()!=null});const F=h.useMemo(()=>({store:u}),[u]);return y.jsx(lp.Provider,{value:F,children:typeof t=="function"?t({payload:m}):t})}function qM(e){return Sr(!0)?y.jsx(gd,{props:e}):y.jsx(vx,{children:y.jsx(gd,{props:e})})}const XM=300,ZM=h.forwardRef(function(t,n){const{render:s,className:r,disabled:o=!1,nativeButton:i=!0,handle:a,payload:l,openOnHover:c=!1,delay:u=XM,closeDelay:d=0,id:f,...m}=t,p=Sr(!0),g=a?.store??p?.store;if(!g)throw new Error(zn(74));const b=$d(f),w=g.useState("isTriggerActive",b),x=g.useState("floatingRootContext"),v=g.useState("isOpenedByTrigger",b),k=h.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=Cv(b,k,g,{payload:l,disabled:o,openOnHover:c,closeDelay:d}),E=g.useState("openChangeReason"),M=g.useState("stickIfOpen"),A=g.useState("openMethod"),T=Iv(x,{enabled:x!=null&&c&&(A!=="touch"||E!==wn),mouseOnly:!0,move:!1,handleClose:_v(),restMs:u,delay:{close:d},triggerElementRef:k,isActiveTrigger:w}),R=Rx(x,{enabled:x!=null,stickIfOpen:M}),O=Ua([R]),D=g.useState("triggerProps",C),F=h.useMemo(()=>({disabled:o,open:v}),[o,v]),{getButtonProps:N,buttonRef:_}=Wd({disabled:o,native:i}),z=h.useMemo(()=>({open(J){return J&&E===wn?zv.open(J):Uv.open(J)}}),[E]),P=hn("button",t,{state:F,ref:[_,n,S,k],props:[O.getReferenceProps(),T,D,{[Ud]:"",id:b},m,N],stateAttributesMapping:z}),I=h.useRef(null),B=he(J=>{kn.flushSync(()=>{g.setOpen(!1,_e(Qs,J.nativeEvent,J.currentTarget))}),Vb(I.current)?.focus()}),W=he(J=>{const Y=g.select("positionerElement");if(Y&&hs(J,Y))g.context.beforeContentFocusGuardRef.current?.focus();else{kn.flushSync(()=>{g.setOpen(!1,_e(Qs,J.nativeEvent,J.currentTarget))});let $=_b(g.context.triggerFocusTargetRef.current||k.current);for(;$!==null&&Se(Y,$);){const K=$;if($=Ia($),$===K)break}$?.focus()}});return w?y.jsxs(h.Fragment,{children:[y.jsx(Ss,{ref:I,onFocus:B}),y.jsx(h.Fragment,{children:P},b),y.jsx(Ss,{ref:g.context.triggerFocusTargetRef,onFocus:W})]}):y.jsx(h.Fragment,{children:P},b)}),cp=h.createContext(void 0);function JM(){const e=h.useContext(cp);if(e===void 0)throw new Error(zn(45));return e}const QM=h.forwardRef(function(t,n){const{keepMounted:s=!1,...r}=t,{store:o}=Sr();return o.useState("mounted")||s?y.jsx(cp.Provider,{value:s,children:y.jsx(Vf,{ref:n,...r,renderGuards:!1})}):null}),up=h.createContext(void 0);function eE(){const e=h.useContext(up);if(!e)throw new Error(zn(46));return e}const tE=h.forwardRef(function(t,n){const{render:s,className:r,anchor:o,positionMethod:i="absolute",side:a="bottom",align:l="center",sideOffset:c=0,alignOffset:u=0,collisionBoundary:d="clipping-ancestors",collisionPadding:f=5,arrowPadding:m=5,sticky:p=!1,disableAnchorTracking:g=!1,collisionAvoidance:b=eb,...w}=t,{store:x}=Sr(),v=JM(),k=bx(),S=x.useState("floatingRootContext"),C=x.useState("mounted"),E=x.useState("open"),M=x.useState("openChangeReason"),A=x.useState("activeTriggerElement"),T=x.useState("modal"),R=x.useState("positionerElement"),O=x.useState("instantType"),D=x.useState("transitionStatus"),F=x.useState("hasViewport"),N=h.useRef(null),_=Xf(R,!1,!1),z=ow({anchor:o,floatingRootContext:S,positionMethod:i,mounted:C,side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:m,collisionBoundary:d,collisionPadding:f,sticky:p,disableAnchorTracking:g,keepMounted:v,nodeId:k,collisionAvoidance:b,adaptiveOrigin:F?rw:void 0}),P=h.useMemo(()=>{const $={};return E||($.pointerEvents="none"),{role:"presentation",hidden:!C,style:{...z.positionerStyles,...$}}},[E,C,z.positionerStyles]),I=h.useMemo(()=>({props:P,...z}),[P,z]),B=S?.select("domReferenceElement");Me(()=>{const $=B,K=N.current;if($&&(N.current=$),K&&$&&$!==K){x.set("instantType",void 0);const Z=new AbortController;return _(()=>{x.set("instantType","trigger-change")},Z.signal),()=>{Z.abort()}}},[B,_,x]);const W=h.useMemo(()=>({open:E,side:I.side,align:I.align,anchorHidden:I.anchorHidden,instant:O}),[E,I.side,I.align,I.anchorHidden,O]),J=h.useCallback($=>{x.set("positionerElement",$)},[x]),Y=hn("div",t,{state:W,props:[I.props,gh(D),w],ref:[n,J],stateAttributesMapping:pr});return y.jsxs(up.Provider,{value:I,children:[C&&T===!0&&M!==ft&&y.jsx(lh,{ref:x.context.internalBackdropRef,inert:oh(!E),cutout:A}),y.jsx(xx,{id:k,children:Y})]})}),nE={...pr,...Oo},sE=h.forwardRef(function(t,n){const{className:s,render:r,initialFocus:o,finalFocus:i,...a}=t,{store:l}=Sr(),c=eE(),u=aw()!=null,d=l.useState("open"),f=l.useState("openMethod"),m=l.useState("instantType"),p=l.useState("transitionStatus"),g=l.useState("popupProps"),b=l.useState("titleElementId"),w=l.useState("descriptionElementId"),x=l.useState("modal"),v=l.useState("mounted"),k=l.useState("openChangeReason"),S=l.useState("activeTriggerElement"),C=l.useState("floatingRootContext");Ha({open:d,ref:l.context.popupRef,onComplete(){d&&l.context.onOpenChangeComplete?.(!0)}});const E=l.useState("disabled"),M=l.useState("openOnHover"),A=l.useState("closeDelay");Ov(C,{enabled:M&&!E,closeDelay:A});function T(N){return N==="touch"?l.context.popupRef.current:!0}const R=o===void 0?T:o,O=h.useMemo(()=>({open:d,side:c.side,align:c.align,instant:m,transitionStatus:p}),[d,c.side,c.align,m,p]),D=h.useCallback(N=>{l.set("popupElement",N)},[l]),F=hn("div",t,{state:O,ref:[n,l.context.popupRef,D],props:[g,{"aria-labelledby":b,"aria-describedby":w,onKeyDown(N){u&&ph.has(N.key)&&N.stopPropagation()}},gh(p),a],stateAttributesMapping:nE});return y.jsx(Wf,{context:C,openInteractionType:f,modal:x==="trap-focus",disabled:!v||k===ft,initialFocus:R,returnFocus:i,restoreFocus:"popup",previousFocusableElement:rt(S)?S:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:F})});function rE(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const oE={},Us={};function Ln(e,t){try{const s=(oE[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return s in Us?Us[s]:yd(s,s.split(":"))}catch{if(e in Us)return Us[e];const n=e?.match(iE);return n?yd(e,n.slice(1)):NaN}}const iE=/([+-]\d\d):?(\d\d)?/;function yd(e,t){const n=+(t[0]||0),s=+(t[1]||0),r=+(t[2]||0)/60;return Us[e]=n*60+s>0?n*60+s+r:n*60-s-r}class Ut extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(Ln(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),dp(this),Ma(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new Ut(...n,t):new Ut(Date.now(),t)}withTimeZone(t){return new Ut(+this,t)}getTimezoneOffset(){const t=-Ln(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),Ma(this),+this}[Symbol.for("constructDateFrom")](t){return new Ut(+new Date(t),this.timeZone)}}const bd=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!bd.test(e))return;const t=e.replace(bd,"$1UTC");Ut.prototype[t]&&(e.startsWith("get")?Ut.prototype[e]=function(){return this.internal[t]()}:(Ut.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),aE(this),+this},Ut.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Ma(this),+this}))});function Ma(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Ln(e.timeZone,e)*60))}function aE(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),dp(e)}function dp(e){const t=Ln(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),s=new Date(+e);s.setUTCHours(s.getUTCHours()-1);const r=-new Date(+e).getTimezoneOffset(),o=-new Date(+s).getTimezoneOffset(),i=r-o,a=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();i&&a&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+i);const l=r-n;l&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+l);const c=new Date(+e);c.setUTCSeconds(0);const u=r>0?c.getSeconds():(c.getSeconds()-60)%60,d=Math.round(-(Ln(e.timeZone,e)*60))%60;(d||u)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+d),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+d+u));const f=Ln(e.timeZone,e),m=f>0?Math.floor(f):Math.ceil(f),g=-new Date(+e).getTimezoneOffset()-m,b=m!==n,w=g-l;if(b&&w){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+w);const x=Ln(e.timeZone,e),v=x>0?Math.floor(x):Math.ceil(x),k=m-v;k&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+k),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+k))}}class Qe extends Ut{static tz(t,...n){return n.length?new Qe(...n,t):new Qe(Date.now(),t)}toISOString(){const[t,n,s]=this.tzComponents(),r=`${t}${n}:${s}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,s,r]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${s} ${n} ${r}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,s,r]=this.tzComponents();return`${t} GMT${n}${s}${r} (${rE(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",s=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),r=String(Math.abs(t)%60).padStart(2,"0");return[n,s,r]}withTimeZone(t){return new Qe(+this,t)}[Symbol.for("constructDateFrom")](t){return new Qe(+new Date(t),this.timeZone)}}const fp=6048e5,lE=864e5,xd=Symbol.for("constructDateFrom");function Ue(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&xd in e?e[xd](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ee(e,t){return Ue(t||e,e)}function hp(e,t,n){const s=Ee(e,n?.in);return isNaN(t)?Ue(e,NaN):(t&&s.setDate(s.getDate()+t),s)}function mp(e,t,n){const s=Ee(e,n?.in);if(isNaN(t))return Ue(e,NaN);if(!t)return s;const r=s.getDate(),o=Ue(e,s.getTime());o.setMonth(s.getMonth()+t+1,0);const i=o.getDate();return r>=i?o:(s.setFullYear(o.getFullYear(),o.getMonth(),r),s)}let cE={};function Tr(){return cE}function Cs(e,t){const n=Tr(),s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=Ee(e,t?.in),o=r.getDay(),i=(o<s?7:0)+o-s;return r.setDate(r.getDate()-i),r.setHours(0,0,0,0),r}function lr(e,t){return Cs(e,{...t,weekStartsOn:1})}function pp(e,t){const n=Ee(e,t?.in),s=n.getFullYear(),r=Ue(n,0);r.setFullYear(s+1,0,4),r.setHours(0,0,0,0);const o=lr(r),i=Ue(n,0);i.setFullYear(s,0,4),i.setHours(0,0,0,0);const a=lr(i);return n.getTime()>=o.getTime()?s+1:n.getTime()>=a.getTime()?s:s-1}function vd(e){const t=Ee(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Ns(e,...t){const n=Ue.bind(null,t.find(s=>typeof s=="object"));return t.map(n)}function cr(e,t){const n=Ee(e,t?.in);return n.setHours(0,0,0,0),n}function Sl(e,t,n){const[s,r]=Ns(n?.in,e,t),o=cr(s),i=cr(r),a=+o-vd(o),l=+i-vd(i);return Math.round((a-l)/lE)}function uE(e,t){const n=pp(e,t),s=Ue(e,0);return s.setFullYear(n,0,4),s.setHours(0,0,0,0),lr(s)}function dE(e,t,n){return hp(e,t*7,n)}function fE(e,t,n){return mp(e,t*12,n)}function hE(e,t){let n,s=t?.in;return e.forEach(r=>{!s&&typeof r=="object"&&(s=Ue.bind(null,r));const o=Ee(r,s);(!n||n<o||isNaN(+o))&&(n=o)}),Ue(s,n||NaN)}function mE(e,t){let n,s=t?.in;return e.forEach(r=>{!s&&typeof r=="object"&&(s=Ue.bind(null,r));const o=Ee(r,s);(!n||n>o||isNaN(+o))&&(n=o)}),Ue(s,n||NaN)}function pE(e,t,n){const[s,r]=Ns(n?.in,e,t);return+cr(s)==+cr(r)}function gp(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function gE(e){return!(!gp(e)&&typeof e!="number"||isNaN(+Ee(e)))}function yp(e,t,n){const[s,r]=Ns(n?.in,e,t),o=s.getFullYear()-r.getFullYear(),i=s.getMonth()-r.getMonth();return o*12+i}function yE(e,t){const n=Ee(e,t?.in),s=n.getMonth();return n.setFullYear(n.getFullYear(),s+1,0),n.setHours(23,59,59,999),n}function bp(e,t){const[n,s]=Ns(e,t.start,t.end);return{start:n,end:s}}function bE(e,t){const{start:n,end:s}=bp(t?.in,e);let r=+n>+s;const o=r?+n:+s,i=r?s:n;i.setHours(0,0,0,0),i.setDate(1);let a=1;const l=[];for(;+i<=o;)l.push(Ue(n,i)),i.setMonth(i.getMonth()+a);return r?l.reverse():l}function xE(e,t){const n=Ee(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function vE(e,t){const n=Ee(e,t?.in),s=n.getFullYear();return n.setFullYear(s+1,0,0),n.setHours(23,59,59,999),n}function xp(e,t){const n=Ee(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function wE(e,t){const{start:n,end:s}=bp(t?.in,e);let r=+n>+s;const o=r?+n:+s,i=r?s:n;i.setHours(0,0,0,0),i.setMonth(0,1);let a=1;const l=[];for(;+i<=o;)l.push(Ue(n,i)),i.setFullYear(i.getFullYear()+a);return r?l.reverse():l}function vp(e,t){const n=Tr(),s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=Ee(e,t?.in),o=r.getDay(),i=(o<s?-7:0)+6-(o-s);return r.setDate(r.getDate()+i),r.setHours(23,59,59,999),r}function kE(e,t){return vp(e,{...t,weekStartsOn:1})}const SE={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},TE=(e,t,n)=>{let s;const r=SE[e];return typeof r=="string"?s=r:t===1?s=r.one:s=r.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Li(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const CE={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ME={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},EE={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},DE={date:Li({formats:CE,defaultWidth:"full"}),time:Li({formats:ME,defaultWidth:"full"}),dateTime:Li({formats:EE,defaultWidth:"full"})},PE={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},RE=(e,t,n,s)=>PE[e];function Bs(e){return(t,n)=>{const s=n?.context?String(n.context):"standalone";let r;if(s==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,a=n?.width?String(n.width):i;r=e.formattingValues[a]||e.formattingValues[i]}else{const i=e.defaultWidth,a=n?.width?String(n.width):e.defaultWidth;r=e.values[a]||e.values[i]}const o=e.argumentCallback?e.argumentCallback(t):t;return r[o]}}const AE={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},OE={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},NE={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},jE={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},IE={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},FE={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},LE=(e,t)=>{const n=Number(e),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},_E={ordinalNumber:LE,era:Bs({values:AE,defaultWidth:"wide"}),quarter:Bs({values:OE,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Bs({values:NE,defaultWidth:"wide"}),day:Bs({values:jE,defaultWidth:"wide"}),dayPeriod:Bs({values:IE,defaultWidth:"wide",formattingValues:FE,defaultFormattingWidth:"wide"})};function $s(e){return(t,n={})=>{const s=n.width,r=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],o=t.match(r);if(!o)return null;const i=o[0],a=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?WE(a,d=>d.test(i)):VE(a,d=>d.test(i));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=t.slice(i.length);return{value:c,rest:u}}}function VE(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function WE(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function BE(e){return(t,n={})=>{const s=t.match(e.matchPattern);if(!s)return null;const r=s[0],o=t.match(e.parsePattern);if(!o)return null;let i=e.valueCallback?e.valueCallback(o[0]):o[0];i=n.valueCallback?n.valueCallback(i):i;const a=t.slice(r.length);return{value:i,rest:a}}}const $E=/^(\d+)(th|st|nd|rd)?/i,YE=/\d+/i,HE={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},UE={any:[/^b/i,/^(a|c)/i]},zE={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},GE={any:[/1/i,/2/i,/3/i,/4/i]},KE={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},qE={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},XE={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ZE={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},JE={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},QE={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},e1={ordinalNumber:BE({matchPattern:$E,parsePattern:YE,valueCallback:e=>parseInt(e,10)}),era:$s({matchPatterns:HE,defaultMatchWidth:"wide",parsePatterns:UE,defaultParseWidth:"any"}),quarter:$s({matchPatterns:zE,defaultMatchWidth:"wide",parsePatterns:GE,defaultParseWidth:"any",valueCallback:e=>e+1}),month:$s({matchPatterns:KE,defaultMatchWidth:"wide",parsePatterns:qE,defaultParseWidth:"any"}),day:$s({matchPatterns:XE,defaultMatchWidth:"wide",parsePatterns:ZE,defaultParseWidth:"any"}),dayPeriod:$s({matchPatterns:JE,defaultMatchWidth:"any",parsePatterns:QE,defaultParseWidth:"any"})},ls={code:"en-US",formatDistance:TE,formatLong:DE,formatRelative:RE,localize:_E,match:e1,options:{weekStartsOn:0,firstWeekContainsDate:1}};function t1(e,t){const n=Ee(e,t?.in);return Sl(n,xp(n))+1}function Tl(e,t){const n=Ee(e,t?.in),s=+lr(n)-+uE(n);return Math.round(s/fp)+1}function wp(e,t){const n=Ee(e,t?.in),s=n.getFullYear(),r=Tr(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,i=Ue(t?.in||e,0);i.setFullYear(s+1,0,o),i.setHours(0,0,0,0);const a=Cs(i,t),l=Ue(t?.in||e,0);l.setFullYear(s,0,o),l.setHours(0,0,0,0);const c=Cs(l,t);return+n>=+a?s+1:+n>=+c?s:s-1}function n1(e,t){const n=Tr(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,r=wp(e,t),o=Ue(t?.in||e,0);return o.setFullYear(r,0,s),o.setHours(0,0,0,0),Cs(o,t)}function Cl(e,t){const n=Ee(e,t?.in),s=+Cs(n,t)-+n1(n,t);return Math.round(s/fp)+1}function ke(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const gn={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return ke(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):ke(n+1,2)},d(e,t){return ke(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(e,t){return ke(e.getHours()%12||12,t.length)},H(e,t){return ke(e.getHours(),t.length)},m(e,t){return ke(e.getMinutes(),t.length)},s(e,t){return ke(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),r=Math.trunc(s*Math.pow(10,n-3));return ke(r,t.length)}},rs={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wd={G:function(e,t,n){const s=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});default:return n.era(s,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const s=e.getFullYear(),r=s>0?s:1-s;return n.ordinalNumber(r,{unit:"year"})}return gn.y(e,t)},Y:function(e,t,n,s){const r=wp(e,s),o=r>0?r:1-r;if(t==="YY"){const i=o%100;return ke(i,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):ke(o,t.length)},R:function(e,t){const n=pp(e);return ke(n,t.length)},u:function(e,t){const n=e.getFullYear();return ke(n,t.length)},Q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return ke(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return ke(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,n){const s=e.getMonth();switch(t){case"M":case"MM":return gn.M(e,t);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,n){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return ke(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,n,s){const r=Cl(e,s);return t==="wo"?n.ordinalNumber(r,{unit:"week"}):ke(r,t.length)},I:function(e,t,n){const s=Tl(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):ke(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):gn.d(e,t)},D:function(e,t,n){const s=t1(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):ke(s,t.length)},E:function(e,t,n){const s=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,n,s){const r=e.getDay(),o=(r-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return ke(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(e,t,n,s){const r=e.getDay(),o=(r-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return ke(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,n){const s=e.getDay(),r=s===0?7:s;switch(t){case"i":return String(r);case"ii":return ke(r,t.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,n){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){const s=e.getHours();let r;switch(s===12?r=rs.noon:s===0?r=rs.midnight:r=s/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){const s=e.getHours();let r;switch(s>=17?r=rs.evening:s>=12?r=rs.afternoon:s>=4?r=rs.morning:r=rs.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let s=e.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return gn.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):gn.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):ke(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):ke(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):gn.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):gn.s(e,t)},S:function(e,t){return gn.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return Sd(s);case"XXXX":case"XX":return jn(s);default:return jn(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return Sd(s);case"xxxx":case"xx":return jn(s);default:return jn(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+kd(s,":");default:return"GMT"+jn(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+kd(s,":");default:return"GMT"+jn(s,":")}},t:function(e,t,n){const s=Math.trunc(+e/1e3);return ke(s,t.length)},T:function(e,t,n){return ke(+e,t.length)}};function kd(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),r=Math.trunc(s/60),o=s%60;return o===0?n+String(r):n+String(r)+t+ke(o,2)}function Sd(e,t){return e%60===0?(e>0?"-":"+")+ke(Math.abs(e)/60,2):jn(e,t)}function jn(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),r=ke(Math.trunc(s/60),2),o=ke(s%60,2);return n+r+t+o}const Td=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},kp=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},s1=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],r=n[2];if(!r)return Td(e,t);let o;switch(s){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",Td(s,t)).replace("{{time}}",kp(r,t))},r1={p:kp,P:s1},o1=/^D+$/,i1=/^Y+$/,a1=["D","DD","YY","YYYY"];function l1(e){return o1.test(e)}function c1(e){return i1.test(e)}function u1(e,t,n){const s=d1(e,t,n);if(console.warn(s),a1.includes(e))throw new RangeError(s)}function d1(e,t,n){const s=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const f1=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,h1=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,m1=/^'([^]*?)'?$/,p1=/''/g,g1=/[a-zA-Z]/;function zt(e,t,n){const s=Tr(),r=n?.locale??s.locale??ls,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,a=Ee(e,n?.in);if(!gE(a))throw new RangeError("Invalid time value");let l=t.match(h1).map(u=>{const d=u[0];if(d==="p"||d==="P"){const f=r1[d];return f(u,r.formatLong)}return u}).join("").match(f1).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:y1(u)};if(wd[d])return{isToken:!0,value:u};if(d.match(g1))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});r.localize.preprocessor&&(l=r.localize.preprocessor(a,l));const c={firstWeekContainsDate:o,weekStartsOn:i,locale:r};return l.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!n?.useAdditionalWeekYearTokens&&c1(d)||!n?.useAdditionalDayOfYearTokens&&l1(d))&&u1(d,t,String(e));const f=wd[d[0]];return f(a,d,r.localize,c)}).join("")}function y1(e){const t=e.match(m1);return t?t[1].replace(p1,"'"):e}function b1(e,t){const n=Ee(e,t?.in),s=n.getFullYear(),r=n.getMonth(),o=Ue(n,0);return o.setFullYear(s,r+1,0),o.setHours(0,0,0,0),o.getDate()}function x1(e,t){return Ee(e,t?.in).getMonth()}function v1(e,t){return Ee(e,t?.in).getFullYear()}function w1(e,t){return+Ee(e)>+Ee(t)}function k1(e,t){return+Ee(e)<+Ee(t)}function S1(e,t,n){const[s,r]=Ns(n?.in,e,t);return s.getFullYear()===r.getFullYear()&&s.getMonth()===r.getMonth()}function T1(e,t,n){const[s,r]=Ns(n?.in,e,t);return s.getFullYear()===r.getFullYear()}function C1(e,t,n){const s=Ee(e,n?.in),r=s.getFullYear(),o=s.getDate(),i=Ue(e,0);i.setFullYear(r,t,15),i.setHours(0,0,0,0);const a=b1(i);return s.setMonth(t,Math.min(o,a)),s}function M1(e,t,n){const s=Ee(e,n?.in);return isNaN(+s)?Ue(e,NaN):(s.setFullYear(t),s)}const Cd=5,E1=4;function D1(e,t){const n=t.startOfMonth(e),s=n.getDay()>0?n.getDay():7,r=t.addDays(e,-s+1),o=t.addDays(r,Cd*7-1);return t.getMonth(e)===t.getMonth(o)?Cd:E1}function Sp(e,t){const n=t.startOfMonth(e),s=n.getDay();return s===1?n:s===0?t.addDays(n,-6):t.addDays(n,-1*(s-1))}function P1(e,t){const n=Sp(e,t),s=D1(e,t);return t.addDays(n,s*7-1)}const Tp={...ls,labels:{labelDayButton:(e,t,n,s)=>{let r;s&&typeof s.format=="function"?r=s.format.bind(s):r=(i,a)=>zt(i,a,{locale:ls,...n});let o=r(e,"PPPP");return t.today&&(o=`Today, ${o}`),t.selected&&(o=`${o}, selected`),o},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:"Choose the Year",labelGrid:(e,t,n)=>{let s;return n&&typeof n.format=="function"?s=n.format.bind(n):s=(r,o)=>zt(r,o,{locale:ls,...t}),s(e,"LLLL yyyy")},labelGridcell:(e,t,n,s)=>{let r;s&&typeof s.format=="function"?r=s.format.bind(s):r=(i,a)=>zt(i,a,{locale:ls,...n});let o=r(e,"PPPP");return t?.today&&(o=`Today, ${o}`),o},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,t,n)=>{let s;return n&&typeof n.format=="function"?s=n.format.bind(n):s=(r,o)=>zt(r,o,{locale:ls,...t}),s(e,"cccc")}}};class gt{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Qe.tz(this.options.timeZone):new this.Date,this.newDate=(s,r,o)=>this.overrides?.newDate?this.overrides.newDate(s,r,o):this.options.timeZone?new Qe(s,r,o,this.options.timeZone):new Date(s,r,o),this.addDays=(s,r)=>this.overrides?.addDays?this.overrides.addDays(s,r):hp(s,r),this.addMonths=(s,r)=>this.overrides?.addMonths?this.overrides.addMonths(s,r):mp(s,r),this.addWeeks=(s,r)=>this.overrides?.addWeeks?this.overrides.addWeeks(s,r):dE(s,r),this.addYears=(s,r)=>this.overrides?.addYears?this.overrides.addYears(s,r):fE(s,r),this.differenceInCalendarDays=(s,r)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(s,r):Sl(s,r),this.differenceInCalendarMonths=(s,r)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(s,r):yp(s,r),this.eachMonthOfInterval=s=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(s):bE(s),this.eachYearOfInterval=s=>{const r=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(s):wE(s),o=new Set(r.map(a=>this.getYear(a)));if(o.size===r.length)return r;const i=[];return o.forEach(a=>{i.push(new Date(a,0,1))}),i},this.endOfBroadcastWeek=s=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(s):P1(s,this),this.endOfISOWeek=s=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(s):kE(s),this.endOfMonth=s=>this.overrides?.endOfMonth?this.overrides.endOfMonth(s):yE(s),this.endOfWeek=(s,r)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(s,r):vp(s,this.options),this.endOfYear=s=>this.overrides?.endOfYear?this.overrides.endOfYear(s):vE(s),this.format=(s,r,o)=>{const i=this.overrides?.format?this.overrides.format(s,r,this.options):zt(s,r,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(i):i},this.getISOWeek=s=>this.overrides?.getISOWeek?this.overrides.getISOWeek(s):Tl(s),this.getMonth=(s,r)=>this.overrides?.getMonth?this.overrides.getMonth(s,this.options):x1(s,this.options),this.getYear=(s,r)=>this.overrides?.getYear?this.overrides.getYear(s,this.options):v1(s,this.options),this.getWeek=(s,r)=>this.overrides?.getWeek?this.overrides.getWeek(s,this.options):Cl(s,this.options),this.isAfter=(s,r)=>this.overrides?.isAfter?this.overrides.isAfter(s,r):w1(s,r),this.isBefore=(s,r)=>this.overrides?.isBefore?this.overrides.isBefore(s,r):k1(s,r),this.isDate=s=>this.overrides?.isDate?this.overrides.isDate(s):gp(s),this.isSameDay=(s,r)=>this.overrides?.isSameDay?this.overrides.isSameDay(s,r):pE(s,r),this.isSameMonth=(s,r)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(s,r):S1(s,r),this.isSameYear=(s,r)=>this.overrides?.isSameYear?this.overrides.isSameYear(s,r):T1(s,r),this.max=s=>this.overrides?.max?this.overrides.max(s):hE(s),this.min=s=>this.overrides?.min?this.overrides.min(s):mE(s),this.setMonth=(s,r)=>this.overrides?.setMonth?this.overrides.setMonth(s,r):C1(s,r),this.setYear=(s,r)=>this.overrides?.setYear?this.overrides.setYear(s,r):M1(s,r),this.startOfBroadcastWeek=(s,r)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(s,this):Sp(s,this),this.startOfDay=s=>this.overrides?.startOfDay?this.overrides.startOfDay(s):cr(s),this.startOfISOWeek=s=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(s):lr(s),this.startOfMonth=s=>this.overrides?.startOfMonth?this.overrides.startOfMonth(s):xE(s),this.startOfWeek=(s,r)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(s,this.options):Cs(s,this.options),this.startOfYear=s=>this.overrides?.startOfYear?this.overrides.startOfYear(s):xp(s),this.options={locale:Tp,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),s={};for(let r=0;r<10;r++)s[r.toString()]=n.format(r);return s}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,s=>n[s]||s)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&gt.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:s,numerals:r}=this.options,o=n?.code;if(o&&gt.yearFirstLocales.has(o))try{return new Intl.DateTimeFormat(o,{month:"long",year:"numeric",timeZone:s,numberingSystem:r}).format(t)}catch{}const i=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,i)}}gt.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Zt=new gt;class Cp{constructor(t,n,s=Zt){this.date=t,this.displayMonth=n,this.outside=!!(n&&!s.isSameMonth(t,n)),this.dateLib=s,this.isoDate=s.format(t,"yyyy-MM-dd"),this.displayMonthId=s.format(n,"yyyy-MM"),this.dateMonthId=s.format(t,"yyyy-MM")}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class R1{constructor(t,n){this.date=t,this.weeks=n}}class A1{constructor(t,n){this.days=n,this.weekNumber=t}}function O1(e){return q.createElement("button",{...e})}function N1(e){return q.createElement("span",{...e})}function j1(e){const{size:t=24,orientation:n="left",className:s}=e;return q.createElement("svg",{className:s,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&q.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&q.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&q.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&q.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function I1(e){const{day:t,modifiers:n,...s}=e;return q.createElement("td",{...s})}function F1(e){const{day:t,modifiers:n,...s}=e,r=q.useRef(null);return q.useEffect(()=>{n.focused&&r.current?.focus()},[n.focused]),q.createElement("button",{ref:r,...s})}var ie;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(ie||(ie={}));var Le;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(Le||(Le={}));var It;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(It||(It={}));var dt;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(dt||(dt={}));function L1(e){const{options:t,className:n,components:s,classNames:r,...o}=e,i=[r[ie.Dropdown],n].join(" "),a=t?.find(({value:l})=>l===o.value);return q.createElement("span",{"data-disabled":o.disabled,className:r[ie.DropdownRoot]},q.createElement(s.Select,{className:i,...o},t?.map(({value:l,label:c,disabled:u})=>q.createElement(s.Option,{key:l,value:l,disabled:u},c))),q.createElement("span",{className:r[ie.CaptionLabel],"aria-hidden":!0},a?.label,q.createElement(s.Chevron,{orientation:"down",size:18,className:r[ie.Chevron]})))}function _1(e){return q.createElement("div",{...e})}function V1(e){return q.createElement("div",{...e})}function W1(e){const{calendarMonth:t,displayIndex:n,...s}=e;return q.createElement("div",{...s},e.children)}function B1(e){const{calendarMonth:t,displayIndex:n,...s}=e;return q.createElement("div",{...s})}function $1(e){return q.createElement("table",{...e})}function Y1(e){return q.createElement("div",{...e})}const Mp=h.createContext(void 0);function Cr(){const e=h.useContext(Mp);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function H1(e){const{components:t}=Cr();return q.createElement(t.Dropdown,{...e})}function U1(e){const{onPreviousClick:t,onNextClick:n,previousMonth:s,nextMonth:r,...o}=e,{components:i,classNames:a,labels:{labelPrevious:l,labelNext:c}}=Cr(),u=h.useCallback(f=>{r&&n?.(f)},[r,n]),d=h.useCallback(f=>{s&&t?.(f)},[s,t]);return q.createElement("nav",{...o},q.createElement(i.PreviousMonthButton,{type:"button",className:a[ie.PreviousMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":l(s),onClick:d},q.createElement(i.Chevron,{disabled:s?void 0:!0,className:a[ie.Chevron],orientation:"left"})),q.createElement(i.NextMonthButton,{type:"button",className:a[ie.NextMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:u},q.createElement(i.Chevron,{disabled:r?void 0:!0,orientation:"right",className:a[ie.Chevron]})))}function z1(e){const{components:t}=Cr();return q.createElement(t.Button,{...e})}function G1(e){return q.createElement("option",{...e})}function K1(e){const{components:t}=Cr();return q.createElement(t.Button,{...e})}function q1(e){const{rootRef:t,...n}=e;return q.createElement("div",{...n,ref:t})}function X1(e){return q.createElement("select",{...e})}function Z1(e){const{week:t,...n}=e;return q.createElement("tr",{...n})}function J1(e){return q.createElement("th",{...e})}function Q1(e){return q.createElement("thead",{"aria-hidden":!0},q.createElement("tr",{...e}))}function eD(e){const{week:t,...n}=e;return q.createElement("th",{...n})}function tD(e){return q.createElement("th",{...e})}function nD(e){return q.createElement("tbody",{...e})}function sD(e){const{components:t}=Cr();return q.createElement(t.Dropdown,{...e})}const rD=Object.freeze(Object.defineProperty({__proto__:null,Button:O1,CaptionLabel:N1,Chevron:j1,Day:I1,DayButton:F1,Dropdown:L1,DropdownNav:_1,Footer:V1,Month:W1,MonthCaption:B1,MonthGrid:$1,Months:Y1,MonthsDropdown:H1,Nav:U1,NextMonthButton:z1,Option:G1,PreviousMonthButton:K1,Root:q1,Select:X1,Week:Z1,WeekNumber:eD,WeekNumberHeader:tD,Weekday:J1,Weekdays:Q1,Weeks:nD,YearsDropdown:sD},Symbol.toStringTag,{value:"Module"}));function cn(e,t,n=!1,s=Zt){let{from:r,to:o}=e;const{differenceInCalendarDays:i,isSameDay:a}=s;return r&&o?(i(o,r)<0&&([r,o]=[o,r]),i(t,r)>=(n?1:0)&&i(o,t)>=(n?1:0)):!n&&o?a(o,t):!n&&r?a(r,t):!1}function Ml(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Wo(e){return!!(e&&typeof e=="object"&&"from"in e)}function El(e){return!!(e&&typeof e=="object"&&"after"in e)}function Dl(e){return!!(e&&typeof e=="object"&&"before"in e)}function Ep(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Dp(e,t){return Array.isArray(e)&&e.every(t.isDate)}function un(e,t,n=Zt){const s=Array.isArray(t)?t:[t],{isSameDay:r,differenceInCalendarDays:o,isAfter:i}=n;return s.some(a=>{if(typeof a=="boolean")return a;if(n.isDate(a))return r(e,a);if(Dp(a,n))return a.some(l=>r(e,l));if(Wo(a))return cn(a,e,!1,n);if(Ep(a))return Array.isArray(a.dayOfWeek)?a.dayOfWeek.includes(e.getDay()):a.dayOfWeek===e.getDay();if(Ml(a)){const l=o(a.before,e),c=o(a.after,e),u=l>0,d=c<0;return i(a.before,a.after)?d&&u:u||d}return El(a)?o(e,a.after)>0:Dl(a)?o(a.before,e)>0:typeof a=="function"?a(e):!1})}function oD(e,t,n,s,r){const{disabled:o,hidden:i,modifiers:a,showOutsideDays:l,broadcastCalendar:c,today:u=r.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:m,isBefore:p,endOfMonth:g,isAfter:b}=r,w=n&&m(n),x=s&&g(s),v={[Le.focused]:[],[Le.outside]:[],[Le.disabled]:[],[Le.hidden]:[],[Le.today]:[]},k={};for(const S of e){const{date:C,displayMonth:E}=S,M=!!(E&&!f(C,E)),A=!!(w&&p(C,w)),T=!!(x&&b(C,x)),R=!!(o&&un(C,o,r)),O=!!(i&&un(C,i,r))||A||T||!c&&!l&&M||c&&l===!1&&M,D=d(C,u);M&&v.outside.push(S),R&&v.disabled.push(S),O&&v.hidden.push(S),D&&v.today.push(S),a&&Object.keys(a).forEach(F=>{const N=a?.[F];N&&un(C,N,r)&&(k[F]?k[F].push(S):k[F]=[S])})}return S=>{const C={[Le.focused]:!1,[Le.disabled]:!1,[Le.hidden]:!1,[Le.outside]:!1,[Le.today]:!1},E={};for(const M in v){const A=v[M];C[M]=A.some(T=>T===S)}for(const M in k)E[M]=k[M].some(A=>A===S);return{...C,...E}}}function iD(e,t,n={}){return Object.entries(e).filter(([,r])=>r===!0).reduce((r,[o])=>(n[o]?r.push(n[o]):t[Le[o]]?r.push(t[Le[o]]):t[It[o]]&&r.push(t[It[o]]),r),[t[ie.Day]])}function aD(e){return{...rD,...e}}function lD(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,s])=>{n.startsWith("data-")&&(t[n]=s)}),t}function cD(){const e={};for(const t in ie)e[ie[t]]=`rdp-${ie[t]}`;for(const t in Le)e[Le[t]]=`rdp-${Le[t]}`;for(const t in It)e[It[t]]=`rdp-${It[t]}`;for(const t in dt)e[dt[t]]=`rdp-${dt[t]}`;return e}function Pp(e,t,n){return(n??new gt(t)).formatMonthYear(e)}const uD=Pp;function dD(e,t,n){return(n??new gt(t)).format(e,"d")}function fD(e,t=Zt){return t.format(e,"LLLL")}function hD(e,t,n){return(n??new gt(t)).format(e,"cccccc")}function mD(e,t=Zt){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function pD(){return""}function Rp(e,t=Zt){return t.format(e,"yyyy")}const gD=Rp,yD=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Pp,formatDay:dD,formatMonthCaption:uD,formatMonthDropdown:fD,formatWeekNumber:mD,formatWeekNumberHeader:pD,formatWeekdayName:hD,formatYearCaption:gD,formatYearDropdown:Rp},Symbol.toStringTag,{value:"Module"}));function bD(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...yD,...e}}function Pl(e,t,n,s){let r=(s??new gt(n)).format(e,"PPPP");return t.today&&(r=`Today, ${r}`),t.selected&&(r=`${r}, selected`),r}const xD=Pl;function Rl(e,t,n){return(n??new gt(t)).formatMonthYear(e)}const vD=Rl;function Ap(e,t,n,s){let r=(s??new gt(n)).format(e,"PPPP");return t?.today&&(r=`Today, ${r}`),r}function Op(e){return"Choose the Month"}function Np(){return""}const wD="Go to the Next Month";function jp(e,t){return wD}function Ip(e){return"Go to the Previous Month"}function Fp(e,t,n){return(n??new gt(t)).format(e,"cccc")}function Lp(e,t){return`Week ${e}`}function _p(e){return"Week Number"}function Vp(e){return"Choose the Year"}const kD=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:vD,labelDay:xD,labelDayButton:Pl,labelGrid:Rl,labelGridcell:Ap,labelMonthDropdown:Op,labelNav:Np,labelNext:jp,labelPrevious:Ip,labelWeekNumber:Lp,labelWeekNumberHeader:_p,labelWeekday:Fp,labelYearDropdown:Vp},Symbol.toStringTag,{value:"Module"})),Rt=(e,t,n)=>t||(n?typeof n=="function"?n:(...s)=>n:e);function SD(e,t){const n=t.locale?.labels??{};return{...kD,...e??{},labelDayButton:Rt(Pl,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:Rt(Op,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:Rt(jp,e?.labelNext,n.labelNext),labelPrevious:Rt(Ip,e?.labelPrevious,n.labelPrevious),labelWeekNumber:Rt(Lp,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:Rt(Vp,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:Rt(Rl,e?.labelGrid,n.labelGrid),labelGridcell:Rt(Ap,e?.labelGridcell,n.labelGridcell),labelNav:Rt(Np,e?.labelNav,n.labelNav),labelWeekNumberHeader:Rt(_p,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:Rt(Fp,e?.labelWeekday,n.labelWeekday)}}function TD(e,t,n,s,r){const{startOfMonth:o,startOfYear:i,endOfYear:a,eachMonthOfInterval:l,getMonth:c}=r;return l({start:i(e),end:a(e)}).map(f=>{const m=s.formatMonthDropdown(f,r),p=c(f),g=t&&f<o(t)||n&&f>o(n)||!1;return{value:p,label:m,disabled:g}})}function CD(e,t={},n={}){let s={...t?.[ie.Day]};return Object.entries(e).filter(([,r])=>r===!0).forEach(([r])=>{s={...s,...n?.[r]}}),s}function MD(e,t,n,s){const r=s??e.today(),o=n?e.startOfBroadcastWeek(r,e):t?e.startOfISOWeek(r):e.startOfWeek(r),i=[];for(let a=0;a<7;a++){const l=e.addDays(o,a);i.push(l)}return i}function ED(e,t,n,s,r=!1){if(!e||!t)return;const{startOfYear:o,endOfYear:i,eachYearOfInterval:a,getYear:l}=s,c=o(e),u=i(t),d=a({start:c,end:u});return r&&d.reverse(),d.map(f=>{const m=n.formatYearDropdown(f,s);return{value:l(f),label:m,disabled:!1}})}function DD(e,t={}){const{weekStartsOn:n,locale:s}=t,r=n??s?.options?.weekStartsOn??0,o=a=>{const l=typeof a=="number"||typeof a=="string"?new Date(a):a;return new Qe(l.getFullYear(),l.getMonth(),l.getDate(),12,0,0,e)},i=a=>{const l=o(a);return new Date(l.getFullYear(),l.getMonth(),l.getDate(),0,0,0,0)};return{today:()=>o(Qe.tz(e)),newDate:(a,l,c)=>new Qe(a,l,c,12,0,0,e),startOfDay:a=>o(a),startOfWeek:(a,l)=>{const c=o(a),u=l?.weekStartsOn??r,d=(c.getDay()-u+7)%7;return c.setDate(c.getDate()-d),c},startOfISOWeek:a=>{const l=o(a),c=(l.getDay()-1+7)%7;return l.setDate(l.getDate()-c),l},startOfMonth:a=>{const l=o(a);return l.setDate(1),l},startOfYear:a=>{const l=o(a);return l.setMonth(0,1),l},endOfWeek:(a,l)=>{const c=o(a),f=(((l?.weekStartsOn??r)+6)%7-c.getDay()+7)%7;return c.setDate(c.getDate()+f),c},endOfISOWeek:a=>{const l=o(a),c=(7-l.getDay())%7;return l.setDate(l.getDate()+c),l},endOfMonth:a=>{const l=o(a);return l.setMonth(l.getMonth()+1,0),l},endOfYear:a=>{const l=o(a);return l.setMonth(11,31),l},eachMonthOfInterval:a=>{const l=o(a.start),c=o(a.end),u=[],d=new Qe(l.getFullYear(),l.getMonth(),1,12,0,0,e),f=c.getFullYear()*12+c.getMonth();for(;d.getFullYear()*12+d.getMonth()<=f;)u.push(new Qe(d,e)),d.setMonth(d.getMonth()+1,1);return u},addDays:(a,l)=>{const c=o(a);return c.setDate(c.getDate()+l),c},addWeeks:(a,l)=>{const c=o(a);return c.setDate(c.getDate()+l*7),c},addMonths:(a,l)=>{const c=o(a);return c.setMonth(c.getMonth()+l),c},addYears:(a,l)=>{const c=o(a);return c.setFullYear(c.getFullYear()+l),c},eachYearOfInterval:a=>{const l=o(a.start),c=o(a.end),u=[],d=new Qe(l.getFullYear(),0,1,12,0,0,e);for(;d.getFullYear()<=c.getFullYear();)u.push(new Qe(d,e)),d.setFullYear(d.getFullYear()+1,0,1);return u},getWeek:(a,l)=>{const c=i(a);return Cl(c,{weekStartsOn:l?.weekStartsOn??r,firstWeekContainsDate:l?.firstWeekContainsDate??s?.options?.firstWeekContainsDate??1})},getISOWeek:a=>{const l=i(a);return Tl(l)},differenceInCalendarDays:(a,l)=>{const c=i(a),u=i(l);return Sl(c,u)},differenceInCalendarMonths:(a,l)=>{const c=i(a),u=i(l);return yp(c,u)}}}const Mr=e=>e instanceof HTMLElement?e:null,_i=e=>[...e.querySelectorAll("[data-animated-month]")??[]],PD=e=>Mr(e.querySelector("[data-animated-month]")),Vi=e=>Mr(e.querySelector("[data-animated-caption]")),Wi=e=>Mr(e.querySelector("[data-animated-weeks]")),RD=e=>Mr(e.querySelector("[data-animated-nav]")),AD=e=>Mr(e.querySelector("[data-animated-weekdays]"));function OD(e,t,{classNames:n,months:s,focused:r,dateLib:o}){const i=h.useRef(null),a=h.useRef(s),l=h.useRef(!1);h.useLayoutEffect(()=>{const c=a.current;if(a.current=s,!t||!e.current||!(e.current instanceof HTMLElement)||s.length===0||c.length===0||s.length!==c.length)return;const u=o.isSameMonth(s[0].date,c[0].date),d=o.isAfter(s[0].date,c[0].date),f=d?n[dt.caption_after_enter]:n[dt.caption_before_enter],m=d?n[dt.weeks_after_enter]:n[dt.weeks_before_enter],p=i.current,g=e.current.cloneNode(!0);if(g instanceof HTMLElement?(_i(g).forEach(v=>{if(!(v instanceof HTMLElement))return;const k=PD(v);k&&v.contains(k)&&v.removeChild(k);const S=Vi(v);S&&S.classList.remove(f);const C=Wi(v);C&&C.classList.remove(m)}),i.current=g):i.current=null,l.current||u||r)return;const b=p instanceof HTMLElement?_i(p):[],w=_i(e.current);if(w?.every(x=>x instanceof HTMLElement)&&b&&b.every(x=>x instanceof HTMLElement)){l.current=!0,e.current.style.isolation="isolate";const x=RD(e.current);x&&(x.style.zIndex="1"),w.forEach((v,k)=>{const S=b[k];if(!S)return;v.style.position="relative",v.style.overflow="hidden";const C=Vi(v);C&&C.classList.add(f);const E=Wi(v);E&&E.classList.add(m);const M=()=>{l.current=!1,e.current&&(e.current.style.isolation=""),x&&(x.style.zIndex=""),C&&C.classList.remove(f),E&&E.classList.remove(m),v.style.position="",v.style.overflow="",v.contains(S)&&v.removeChild(S)};S.style.pointerEvents="none",S.style.position="absolute",S.style.overflow="hidden",S.setAttribute("aria-hidden","true");const A=AD(S);A&&(A.style.opacity="0");const T=Vi(S);T&&(T.classList.add(d?n[dt.caption_before_exit]:n[dt.caption_after_exit]),T.addEventListener("animationend",M));const R=Wi(S);R&&R.classList.add(d?n[dt.weeks_before_exit]:n[dt.weeks_after_exit]),v.insertBefore(S,v.firstChild)})}})}function ND(e,t,n,s){const r=e[0],o=e[e.length-1],{ISOWeek:i,fixedWeeks:a,broadcastCalendar:l}=n??{},{addDays:c,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:m,endOfMonth:p,endOfWeek:g,isAfter:b,startOfBroadcastWeek:w,startOfISOWeek:x,startOfWeek:v}=s,k=l?w(r,s):i?x(r):v(r),S=l?f(o):i?m(p(o)):g(p(o)),C=t&&(l?f(t):i?m(t):g(t)),E=C&&b(S,C)?C:S,M=u(E,k),A=d(o,r)+1,T=[];for(let D=0;D<=M;D++){const F=c(k,D);T.push(F)}const O=(l?35:42)*A;if(a&&T.length<O){const D=O-T.length;for(let F=0;F<D;F++){const N=c(T[T.length-1],1);T.push(N)}}return T}function jD(e){const t=[];return e.reduce((n,s)=>{const r=s.weeks.reduce((o,i)=>o.concat(i.days.slice()),t.slice());return n.concat(r.slice())},t.slice())}function ID(e,t,n,s){const{numberOfMonths:r=1}=n,o=[];for(let i=0;i<r;i++){const a=s.addMonths(e,i);if(t&&a>t)break;o.push(a)}return o}function Md(e,t,n,s){const{month:r,defaultMonth:o,today:i=s.today(),numberOfMonths:a=1}=e;let l=r||o||i;const{differenceInCalendarMonths:c,addMonths:u,startOfMonth:d}=s;if(n&&c(n,l)<a-1){const f=-1*(a-1);l=u(n,f)}return t&&c(l,t)<0&&(l=t),d(l)}function FD(e,t,n,s){const{addDays:r,endOfBroadcastWeek:o,endOfISOWeek:i,endOfMonth:a,endOfWeek:l,getISOWeek:c,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:m}=s,p=e.reduce((g,b)=>{const w=n.broadcastCalendar?d(b,s):n.ISOWeek?f(b):m(b),x=n.broadcastCalendar?o(b):n.ISOWeek?i(a(b)):l(a(b)),v=t.filter(E=>E>=w&&E<=x),k=n.broadcastCalendar?35:42;if(n.fixedWeeks&&v.length<k){const E=t.filter(M=>{const A=k-v.length;return M>x&&M<=r(x,A)});v.push(...E)}const S=v.reduce((E,M)=>{const A=n.ISOWeek?c(M):u(M),T=E.find(O=>O.weekNumber===A),R=new Cp(M,b,s);return T?T.days.push(R):E.push(new A1(A,[R])),E},[]),C=new R1(b,S);return g.push(C),g},[]);return n.reverseMonths?p.reverse():p}function LD(e,t){let{startMonth:n,endMonth:s}=e;const{startOfYear:r,startOfDay:o,startOfMonth:i,endOfMonth:a,addYears:l,endOfYear:c,newDate:u,today:d}=t,{fromYear:f,toYear:m,fromMonth:p,toMonth:g}=e;!n&&p&&(n=p),!n&&f&&(n=t.newDate(f,0,1)),!s&&g&&(s=g),!s&&m&&(s=u(m,11,31));const b=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=i(n):f?n=u(f,0,1):!n&&b&&(n=r(l(e.today??d(),-100))),s?s=a(s):m?s=u(m,11,31):!s&&b&&(s=c(e.today??d())),[n&&o(n),s&&o(s)]}function _D(e,t,n,s){if(n.disableNavigation)return;const{pagedNavigation:r,numberOfMonths:o=1}=n,{startOfMonth:i,addMonths:a,differenceInCalendarMonths:l}=s,c=r?o:1,u=i(e);if(!t)return a(u,c);if(!(l(t,e)<o))return a(u,c)}function VD(e,t,n,s){if(n.disableNavigation)return;const{pagedNavigation:r,numberOfMonths:o}=n,{startOfMonth:i,addMonths:a,differenceInCalendarMonths:l}=s,c=r?o??1:1,u=i(e);if(!t)return a(u,-c);if(!(l(u,t)<=0))return a(u,-c)}function WD(e){const t=[];return e.reduce((n,s)=>n.concat(s.weeks.slice()),t.slice())}function Bo(e,t){const[n,s]=h.useState(e);return[t===void 0?n:t,s]}function BD(e,t){const[n,s]=LD(e,t),{startOfMonth:r,endOfMonth:o}=t,i=Md(e,n,s,t),[a,l]=Bo(i,e.month?i:void 0);h.useEffect(()=>{const k=Md(e,n,s,t);l(k)},[e.timeZone]);const{months:c,weeks:u,days:d,previousMonth:f,nextMonth:m}=h.useMemo(()=>{const k=ID(a,s,{numberOfMonths:e.numberOfMonths},t),S=ND(k,e.endMonth?o(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),C=FD(k,S,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),E=WD(C),M=jD(C),A=VD(a,n,e,t),T=_D(a,s,e,t);return{months:C,weeks:E,days:M,previousMonth:A,nextMonth:T}},[t,a.getTime(),s?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:p,onMonthChange:g}=e,b=k=>u.some(S=>S.days.some(C=>C.isEqualTo(k))),w=k=>{if(p)return;let S=r(k);n&&S<r(n)&&(S=r(n)),s&&S>r(s)&&(S=r(s)),l(S),g?.(S)};return{months:c,weeks:u,days:d,navStart:n,navEnd:s,previousMonth:f,nextMonth:m,goToMonth:w,goToDay:k=>{b(k)||w(k.date)}}}var Bt;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Bt||(Bt={}));function Ed(e){return!e[Le.disabled]&&!e[Le.hidden]&&!e[Le.outside]}function $D(e,t,n,s){let r,o=-1;for(const i of e){const a=t(i);Ed(a)&&(a[Le.focused]&&o<Bt.FocusedModifier?(r=i,o=Bt.FocusedModifier):s?.isEqualTo(i)&&o<Bt.LastFocused?(r=i,o=Bt.LastFocused):n(i.date)&&o<Bt.Selected?(r=i,o=Bt.Selected):a[Le.today]&&o<Bt.Today&&(r=i,o=Bt.Today))}return r||(r=e.find(i=>Ed(t(i)))),r}function YD(e,t,n,s,r,o,i){const{ISOWeek:a,broadcastCalendar:l}=o,{addDays:c,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:m,endOfISOWeek:p,endOfWeek:g,max:b,min:w,startOfBroadcastWeek:x,startOfISOWeek:v,startOfWeek:k}=i;let C={day:c,week:d,month:u,year:f,startOfWeek:E=>l?x(E,i):a?v(E):k(E),endOfWeek:E=>l?m(E):a?p(E):g(E)}[e](n,t==="after"?1:-1);return t==="before"&&s?C=b([s,C]):t==="after"&&r&&(C=w([r,C])),C}function Wp(e,t,n,s,r,o,i,a=0){if(a>365)return;const l=YD(e,t,n.date,s,r,o,i),c=!!(o.disabled&&un(l,o.disabled,i)),u=!!(o.hidden&&un(l,o.hidden,i)),d=l,f=new Cp(l,d,i);return!c&&!u?f:Wp(e,t,f,s,r,o,i,a+1)}function HD(e,t,n,s,r){const{autoFocus:o}=e,[i,a]=h.useState(),l=$D(t.days,n,s||(()=>!1),i),[c,u]=h.useState(o?l:void 0);return{isFocusTarget:g=>!!l?.isEqualTo(g),setFocused:u,focused:c,blur:()=>{a(c),u(void 0)},moveFocus:(g,b)=>{if(!c)return;const w=Wp(g,b,c,t.navStart,t.navEnd,e,r);w&&(e.disableNavigation&&!t.days.some(v=>v.isEqualTo(w))||(t.goToDay(w),u(w)))}}}function UD(e,t){const{selected:n,required:s,onSelect:r}=e,[o,i]=Bo(n,r?n:void 0),a=r?n:o,{isSameDay:l}=t,c=m=>a?.some(p=>l(p,m))??!1,{min:u,max:d}=e;return{selected:a,select:(m,p,g)=>{let b=[...a??[]];if(c(m)){if(a?.length===u||s&&a?.length===1)return;b=a?.filter(w=>!l(w,m))}else a?.length===d?b=[m]:b=[...b,m];return r||i(b),r?.(b,m,p,g),b},isSelected:c}}function zD(e,t,n=0,s=0,r=!1,o=Zt){const{from:i,to:a}=t||{},{isSameDay:l,isAfter:c,isBefore:u}=o;let d;if(!i&&!a)d={from:e,to:n>0?void 0:e};else if(i&&!a)l(i,e)?n===0?d={from:i,to:e}:r?d={from:i,to:void 0}:d=void 0:u(e,i)?d={from:e,to:i}:d={from:i,to:e};else if(i&&a)if(l(i,e)&&l(a,e))r?d={from:i,to:a}:d=void 0;else if(l(i,e))d={from:i,to:n>0?void 0:e};else if(l(a,e))d={from:e,to:n>0?void 0:e};else if(u(e,i))d={from:e,to:a};else if(c(e,i))d={from:i,to:e};else if(c(e,a))d={from:i,to:e};else throw new Error("Invalid range");if(d?.from&&d?.to){const f=o.differenceInCalendarDays(d.to,d.from);s>0&&f>s?d={from:e,to:void 0}:n>1&&f<n&&(d={from:e,to:void 0})}return d}function GD(e,t,n=Zt){const s=Array.isArray(t)?t:[t];let r=e.from;const o=n.differenceInCalendarDays(e.to,e.from),i=Math.min(o,6);for(let a=0;a<=i;a++){if(s.includes(r.getDay()))return!0;r=n.addDays(r,1)}return!1}function Dd(e,t,n=Zt){return cn(e,t.from,!1,n)||cn(e,t.to,!1,n)||cn(t,e.from,!1,n)||cn(t,e.to,!1,n)}function KD(e,t,n=Zt){const s=Array.isArray(t)?t:[t];if(s.filter(a=>typeof a!="function").some(a=>typeof a=="boolean"?a:n.isDate(a)?cn(e,a,!1,n):Dp(a,n)?a.some(l=>cn(e,l,!1,n)):Wo(a)?a.from&&a.to?Dd(e,{from:a.from,to:a.to},n):!1:Ep(a)?GD(e,a.dayOfWeek,n):Ml(a)?n.isAfter(a.before,a.after)?Dd(e,{from:n.addDays(a.after,1),to:n.addDays(a.before,-1)},n):un(e.from,a,n)||un(e.to,a,n):El(a)||Dl(a)?un(e.from,a,n)||un(e.to,a,n):!1))return!0;const i=s.filter(a=>typeof a=="function");if(i.length){let a=e.from;const l=n.differenceInCalendarDays(e.to,e.from);for(let c=0;c<=l;c++){if(i.some(u=>u(a)))return!0;a=n.addDays(a,1)}}return!1}function qD(e,t){const{disabled:n,excludeDisabled:s,resetOnSelect:r,selected:o,required:i,onSelect:a}=e,[l,c]=Bo(o,a?o:void 0),u=a?o:l;return{selected:u,select:(m,p,g)=>{const{min:b,max:w}=e;let x;if(m){const v=u?.from,k=u?.to,S=!!v&&!!k,C=!!v&&!!k&&t.isSameDay(v,k)&&t.isSameDay(m,v);r&&(S||!u?.from)?!i&&C?x=void 0:x={from:m,to:void 0}:x=zD(m,u,b,w,i,t)}return s&&n&&x?.from&&x.to&&KD({from:x.from,to:x.to},n,t)&&(x.from=m,x.to=void 0),a||c(x),a?.(x,m,p,g),x},isSelected:m=>u&&cn(u,m,!1,t)}}function XD(e,t){const{selected:n,required:s,onSelect:r}=e,[o,i]=Bo(n,r?n:void 0),a=r?n:o,{isSameDay:l}=t;return{selected:a,select:(d,f,m)=>{let p=d;return!s&&a&&a&&l(d,a)&&(p=void 0),r||i(p),r?.(p,d,f,m),p},isSelected:d=>a?l(a,d):!1}}function ZD(e,t){const n=XD(e,t),s=UD(e,t),r=qD(e,t);switch(e.mode){case"single":return n;case"multiple":return s;case"range":return r;default:return}}function yt(e,t){return e instanceof Qe&&e.timeZone===t?e:new Qe(e,t)}function os(e,t,n){return yt(e,t)}function Pd(e,t,n){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?os(e,t):Array.isArray(e)?e.map(s=>s instanceof Date?os(s,t):s):Wo(e)?{...e,from:e.from?yt(e.from,t):e.from,to:e.to?yt(e.to,t):e.to}:Ml(e)?{before:os(e.before,t),after:os(e.after,t)}:El(e)?{after:os(e.after,t)}:Dl(e)?{before:os(e.before,t)}:e}function Bi(e,t,n){return e&&(Array.isArray(e)?e.map(s=>Pd(s,t)):Pd(e,t))}function JD(e){let t=e;const n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&(t.today=yt(t.today,n)),t.month&&(t.month=yt(t.month,n)),t.defaultMonth&&(t.defaultMonth=yt(t.defaultMonth,n)),t.startMonth&&(t.startMonth=yt(t.startMonth,n)),t.endMonth&&(t.endMonth=yt(t.endMonth,n)),t.mode==="single"&&t.selected?t.selected=yt(t.selected,n):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(oe=>yt(oe,n)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?yt(t.selected.from,n):t.selected.from,to:t.selected.to?yt(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=Bi(t.disabled,n)),t.hidden!==void 0&&(t.hidden=Bi(t.hidden,n)),t.modifiers)){const oe={};Object.keys(t.modifiers).forEach(ue=>{oe[ue]=Bi(t.modifiers?.[ue],n)}),t.modifiers=oe}const{components:s,formatters:r,labels:o,dateLib:i,locale:a,classNames:l}=h.useMemo(()=>{const oe={...Tp,...t.locale},ue=t.broadcastCalendar?1:t.weekStartsOn,H=t.noonSafe&&t.timeZone?DD(t.timeZone,{weekStartsOn:ue,locale:oe}):void 0,fe=t.dateLib&&H?{...H,...t.dateLib}:t.dateLib??H,we=new gt({locale:oe,weekStartsOn:ue,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},fe);return{dateLib:we,components:aD(t.components),formatters:bD(t.formatters),labels:SD(t.labels,we.options),locale:oe,classNames:{...cD(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:i.today()});const{captionLayout:c,mode:u,navLayout:d,numberOfMonths:f=1,onDayBlur:m,onDayClick:p,onDayFocus:g,onDayKeyDown:b,onDayMouseEnter:w,onDayMouseLeave:x,onNextClick:v,onPrevClick:k,showWeekNumber:S,styles:C}=t,{formatCaption:E,formatDay:M,formatMonthDropdown:A,formatWeekNumber:T,formatWeekNumberHeader:R,formatWeekdayName:O,formatYearDropdown:D}=r,F=BD(t,i),{days:N,months:_,navStart:z,navEnd:P,previousMonth:I,nextMonth:B,goToMonth:W}=F,J=oD(N,t,z,P,i),{isSelected:Y,select:$,selected:K}=ZD(t,i)??{},{blur:Z,focused:le,isFocusTarget:Ce,moveFocus:Ae,setFocused:De}=HD(t,F,J,Y??(()=>!1),i),{labelDayButton:tt,labelGridcell:L,labelGrid:ce,labelMonthDropdown:te,labelNav:Pe,labelPrevious:U,labelNext:se,labelWeekday:re,labelWeekNumber:me,labelWeekNumberHeader:ge,labelYearDropdown:Q}=o,ne=h.useMemo(()=>MD(i,t.ISOWeek,t.broadcastCalendar,t.today),[i,t.ISOWeek,t.broadcastCalendar,t.today]),je=u!==void 0||p!==void 0,be=h.useCallback(()=>{I&&(W(I),k?.(I))},[I,W,k]),Be=h.useCallback(()=>{B&&(W(B),v?.(B))},[W,B,v]),$e=h.useCallback((oe,ue)=>H=>{H.preventDefault(),H.stopPropagation(),De(oe),!ue.disabled&&($?.(oe.date,ue,H),p?.(oe.date,ue,H))},[$,p,De]),ct=h.useCallback((oe,ue)=>H=>{De(oe),g?.(oe.date,ue,H)},[g,De]),nt=h.useCallback((oe,ue)=>H=>{Z(),m?.(oe.date,ue,H)},[Z,m]),ye=h.useCallback((oe,ue)=>H=>{const fe={ArrowLeft:[H.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[H.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[H.shiftKey?"year":"week","after"],ArrowUp:[H.shiftKey?"year":"week","before"],PageUp:[H.shiftKey?"year":"month","before"],PageDown:[H.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(fe[H.key]){H.preventDefault(),H.stopPropagation();const[we,de]=fe[H.key];Ae(we,de)}b?.(oe.date,ue,H)},[Ae,b,t.dir]),ve=h.useCallback((oe,ue)=>H=>{w?.(oe.date,ue,H)},[w]),Ie=h.useCallback((oe,ue)=>H=>{x?.(oe.date,ue,H)},[x]),ut=h.useCallback(oe=>ue=>{const H=Number(ue.target.value),fe=i.setMonth(i.startOfMonth(oe),H);W(fe)},[i,W]),_t=h.useCallback(oe=>ue=>{const H=Number(ue.target.value),fe=i.setYear(i.startOfMonth(oe),H);W(fe)},[i,W]),{className:Tt,style:st}=h.useMemo(()=>({className:[l[ie.Root],t.className].filter(Boolean).join(" "),style:{...C?.[ie.Root],...t.style}}),[l,t.className,t.style,C]),pn=lD(t),xe=h.useRef(null);OD(xe,!!t.animate,{classNames:l,months:_,focused:le,dateLib:i});const Ye={dayPickerProps:t,selected:K,select:$,isSelected:Y,months:_,nextMonth:B,previousMonth:I,goToMonth:W,getModifiers:J,components:s,classNames:l,styles:C,labels:o,formatters:r};return q.createElement(Mp.Provider,{value:Ye},q.createElement(s.Root,{rootRef:t.animate?xe:void 0,className:Tt,style:st,dir:t.dir,id:t.id,lang:t.lang??a.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...pn},q.createElement(s.Months,{className:l[ie.Months],style:C?.[ie.Months]},!t.hideNavigation&&!d&&q.createElement(s.Nav,{"data-animated-nav":t.animate?"true":void 0,className:l[ie.Nav],style:C?.[ie.Nav],"aria-label":Pe(),onPreviousClick:be,onNextClick:Be,previousMonth:I,nextMonth:B}),_.map((oe,ue)=>q.createElement(s.Month,{"data-animated-month":t.animate?"true":void 0,className:l[ie.Month],style:C?.[ie.Month],key:ue,displayIndex:ue,calendarMonth:oe},d==="around"&&!t.hideNavigation&&ue===0&&q.createElement(s.PreviousMonthButton,{type:"button",className:l[ie.PreviousMonthButton],tabIndex:I?void 0:-1,"aria-disabled":I?void 0:!0,"aria-label":U(I),onClick:be,"data-animated-button":t.animate?"true":void 0},q.createElement(s.Chevron,{disabled:I?void 0:!0,className:l[ie.Chevron],orientation:t.dir==="rtl"?"right":"left"})),q.createElement(s.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:l[ie.MonthCaption],style:C?.[ie.MonthCaption],calendarMonth:oe,displayIndex:ue},c?.startsWith("dropdown")?q.createElement(s.DropdownNav,{className:l[ie.Dropdowns],style:C?.[ie.Dropdowns]},(()=>{const H=c==="dropdown"||c==="dropdown-months"?q.createElement(s.MonthsDropdown,{key:"month",className:l[ie.MonthsDropdown],"aria-label":te(),classNames:l,components:s,disabled:!!t.disableNavigation,onChange:ut(oe.date),options:TD(oe.date,z,P,r,i),style:C?.[ie.Dropdown],value:i.getMonth(oe.date)}):q.createElement("span",{key:"month"},A(oe.date,i)),fe=c==="dropdown"||c==="dropdown-years"?q.createElement(s.YearsDropdown,{key:"year",className:l[ie.YearsDropdown],"aria-label":Q(i.options),classNames:l,components:s,disabled:!!t.disableNavigation,onChange:_t(oe.date),options:ED(z,P,r,i,!!t.reverseYears),style:C?.[ie.Dropdown],value:i.getYear(oe.date)}):q.createElement("span",{key:"year"},D(oe.date,i));return i.getMonthYearOrder()==="year-first"?[fe,H]:[H,fe]})(),q.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(oe.date,i.options,i))):q.createElement(s.CaptionLabel,{className:l[ie.CaptionLabel],role:"status","aria-live":"polite"},E(oe.date,i.options,i))),d==="around"&&!t.hideNavigation&&ue===f-1&&q.createElement(s.NextMonthButton,{type:"button",className:l[ie.NextMonthButton],tabIndex:B?void 0:-1,"aria-disabled":B?void 0:!0,"aria-label":se(B),onClick:Be,"data-animated-button":t.animate?"true":void 0},q.createElement(s.Chevron,{disabled:B?void 0:!0,className:l[ie.Chevron],orientation:t.dir==="rtl"?"left":"right"})),ue===f-1&&d==="after"&&!t.hideNavigation&&q.createElement(s.Nav,{"data-animated-nav":t.animate?"true":void 0,className:l[ie.Nav],style:C?.[ie.Nav],"aria-label":Pe(),onPreviousClick:be,onNextClick:Be,previousMonth:I,nextMonth:B}),q.createElement(s.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":ce(oe.date,i.options,i)||void 0,className:l[ie.MonthGrid],style:C?.[ie.MonthGrid]},!t.hideWeekdays&&q.createElement(s.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:l[ie.Weekdays],style:C?.[ie.Weekdays]},S&&q.createElement(s.WeekNumberHeader,{"aria-label":ge(i.options),className:l[ie.WeekNumberHeader],style:C?.[ie.WeekNumberHeader],scope:"col"},R()),ne.map(H=>q.createElement(s.Weekday,{"aria-label":re(H,i.options,i),className:l[ie.Weekday],key:String(H),style:C?.[ie.Weekday],scope:"col"},O(H,i.options,i)))),q.createElement(s.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:l[ie.Weeks],style:C?.[ie.Weeks]},oe.weeks.map(H=>q.createElement(s.Week,{className:l[ie.Week],key:H.weekNumber,style:C?.[ie.Week],week:H},S&&q.createElement(s.WeekNumber,{week:H,style:C?.[ie.WeekNumber],"aria-label":me(H.weekNumber,{locale:a}),className:l[ie.WeekNumber],scope:"row",role:"rowheader"},T(H.weekNumber,i)),H.days.map(fe=>{const{date:we}=fe,de=J(fe);if(de[Le.focused]=!de.hidden&&!!le?.isEqualTo(fe),de[It.selected]=Y?.(we)||de.selected,Wo(K)){const{from:en,to:tn}=K;de[It.range_start]=!!(en&&tn&&i.isSameDay(we,en)),de[It.range_end]=!!(en&&tn&&i.isSameDay(we,tn)),de[It.range_middle]=cn(K,we,!0,i)}const Jt=CD(de,C,t.modifiersStyles),Qt=iD(de,l,t.modifiersClassNames),Dn=!je&&!de.hidden?L(we,de,i.options,i):void 0;return q.createElement(s.Day,{key:`${fe.isoDate}_${fe.displayMonthId}`,day:fe,modifiers:de,className:Qt.join(" "),style:Jt,role:"gridcell","aria-selected":de.selected||void 0,"aria-label":Dn,"data-day":fe.isoDate,"data-month":fe.outside?fe.dateMonthId:void 0,"data-selected":de.selected||void 0,"data-disabled":de.disabled||void 0,"data-hidden":de.hidden||void 0,"data-outside":fe.outside||void 0,"data-focused":de.focused||void 0,"data-today":de.today||void 0},!de.hidden&&je?q.createElement(s.DayButton,{className:l[ie.DayButton],style:C?.[ie.DayButton],type:"button",day:fe,modifiers:de,disabled:!de.focused&&de.disabled||void 0,"aria-disabled":de.focused&&de.disabled||void 0,tabIndex:Ce(fe)?0:-1,"aria-label":tt(we,de,i.options,i),onClick:$e(fe,de),onBlur:nt(fe,de),onFocus:ct(fe,de),onKeyDown:ye(fe,de),onMouseEnter:ve(fe,de),onMouseLeave:Ie(fe,de)},M(we,i.options,i)):!de.hidden&&M(fe.date,i.options,i))})))))))),t.footer&&q.createElement(s.Footer,{className:l[ie.Footer],style:C?.[ie.Footer],role:"status","aria-live":"polite"},t.footer)))}function Rd(e){if(!e)return"";const t=e.split("-");if(t.length!==3)return e;const n=new Date(Number(t[0]),Number(t[1])-1,Number(t[2]));return Number.isFinite(n.getTime())?zt(n,"MMM d"):e}function QD({from:e,to:t,onApply:n,onCancel:s}){const r=h.useMemo(()=>{const c={from:void 0,to:void 0};if(e){const u=e.split("-");c.from=new Date(Number(u[0]),Number(u[1])-1,Number(u[2]))}if(t){const u=t.split("-");c.to=new Date(Number(u[0]),Number(u[1])-1,Number(u[2]))}return c},[e,t]),[o,i]=h.useState(r),a=()=>{if(!o?.from)return;const c=zt(o.from,"yyyy-MM-dd"),u=o.to?zt(o.to,"yyyy-MM-dd"):c;n?.(c,u)},l=!!o?.from;return y.jsxs("div",{className:"p-4",children:[y.jsx(JD,{mode:"range",selected:o,onSelect:i,numberOfMonths:2,showOutsideDays:!1,classNames:{root:"rdp-oai",months:"flex gap-4",month:"space-y-3",month_caption:"flex justify-center items-center h-8",caption_label:"text-sm font-medium text-oai-black dark:text-oai-white",nav:"flex items-center justify-between absolute inset-x-0 top-0 px-2",button_previous:"inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",button_next:"inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",chevron:"w-4 h-4",month_grid:"border-collapse",weekdays:"flex",weekday:"w-9 text-center text-xs font-medium text-oai-gray-400 dark:text-oai-gray-500 py-1",week:"flex",day:"w-9 h-9 text-center text-sm p-0 relative",day_button:"w-full h-full inline-flex items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 text-oai-black dark:text-oai-white cursor-pointer rdp-day-btn",today:"font-bold",selected:"rdp-selected",range_start:"rdp-selected rdp-range-start",range_end:"rdp-selected rdp-range-end",range_middle:"rdp-range-mid",outside:"text-oai-gray-300 dark:text-oai-gray-600",disabled:"text-oai-gray-300 dark:text-oai-gray-600 cursor-not-allowed",hidden:"invisible"},styles:{months:{position:"relative"}}}),y.jsxs("div",{className:"flex items-center justify-end gap-2 mt-4 pt-3 border-t border-oai-gray-200 dark:border-oai-gray-700",children:[l&&o.from&&y.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mr-auto",children:[zt(o.from,"MMM d, yyyy"),o.to&&o.to.getTime()!==o.from.getTime()?` — ${zt(o.to,"MMM d, yyyy")}`:""]}),y.jsx(ar,{variant:"secondary",size:"sm",onClick:s,children:"Cancel"}),y.jsx(ar,{variant:"primary",size:"sm",onClick:a,disabled:!l,children:"Apply"})]})]})}function eP(e){return Array.isArray(e)?e.map(t=>typeof t=="string"?{key:t,label:t.toUpperCase()}:{key:t.key,label:t.label||String(t.key).toUpperCase()}):[]}function tP(e){if(typeof e!="string")return null;const t=e.replace(/,/g,"").match(/-?\d+(?:\.\d+)?/);if(!t)return null;const n=Number(t[0]);return Number.isFinite(n)?n:null}const nP={CODEX:"#10b981",CLAUDE:"#8b5cf6",OPENCODE:"#f59e0b",GEMINI:"#3b82f6"};function $i(e,t){const n=e?.toUpperCase?.()||"";return nP[n]||`hsl(${150+t*40}, 60%, 45%)`}function sP({loading:e,onClick:t}){const n=kr();return y.jsx(ar,{variant:"secondary",size:"sm",disabled:e,onClick:t,"aria-label":"Refresh data",className:"w-8 p-0",children:y.jsx(et.span,{"aria-hidden":"true",animate:e?{rotate:360}:{rotate:0},transition:e&&!n?{duration:1,repeat:1/0,ease:"linear"}:{duration:.3},style:{display:"inline-block"},children:"↻"})})}function rP({period:e,periods:t,onPeriodChange:n,summaryValue:s,summaryLabel:r,summaryCostValue:o,onCostInfo:i,fleetData:a=[],onRefresh:l,loading:c,className:u="",customFrom:d,customTo:f,onCustomRangeApply:m,customRangeOpen:p,onCustomRangeOpenChange:g}){const b=eP(t),w=tP(String(s??"")),x=w!=null,[v,k]=h.useState(null),{resolvedTheme:S}=_a(),C=S==="dark",E=C?"rgba(10,10,10,0.98)":"rgba(255,255,255,0.96)",M=C?"rgba(10,10,10,0)":"rgba(255,255,255,0)",A=a.filter(T=>T.models?.length>0);return y.jsx(bn,{delay:.2,children:y.jsxs(Vo,{className:u,children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 mb-6",children:[y.jsx("div",{role:"tablist","aria-label":"Time period",className:"flex gap-1",children:b.map(T=>{const R=e===T.key,O=`text-xs font-medium px-3 py-1.5 rounded-md transition-colors ${R?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800"}`;if(T.key==="custom"){const D=R&&d&&f?`${Rd(d)} — ${Rd(f)}`:T.label;return y.jsxs(qM,{open:p,onOpenChange:F=>{F?n?.("custom"):g?.(F)},children:[y.jsx(ZM,{render:y.jsx("button",{role:"tab","aria-selected":R,type:"button",className:O}),children:D}),y.jsx(QM,{children:y.jsx(tE,{sideOffset:8,side:"bottom",align:"start",className:"!z-[9999]",children:y.jsx(sE,{className:"bg-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-700 rounded-xl shadow-lg",children:y.jsx(QD,{from:d,to:f,onApply:m,onCancel:()=>g?.(!1)})})})})]},"custom")}return y.jsx("button",{role:"tab","aria-selected":R,type:"button",className:O,onClick:()=>n?.(T.key),children:T.label},T.key)})}),l&&y.jsx(sP,{loading:c,onClick:l})]}),y.jsxs("div",{className:"text-center mb-8",children:[y.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wider mb-3",children:r}),y.jsx("div",{className:"text-6xl md:text-7xl font-bold text-oai-black dark:text-oai-white tracking-tight tabular-nums",children:x?y.jsx(MM,{value:w,displayValue:s,fontSize:72,padding:6,gap:1,textColor:"var(--oai-black, #111827)",fontWeight:700,gradientHeight:C?0:8,gradientFrom:E,gradientTo:M,counterStyle:{paddingLeft:0,paddingRight:0,gap:0},digitStyle:{width:"0.88ch"}}):s}),o&&y.jsx("div",{className:"flex items-center justify-center gap-2 mt-4",children:i?y.jsxs("button",{type:"button",onClick:i,className:"inline-flex items-center gap-1.5 text-xl font-bold text-oai-brand hover:text-oai-brand-dark dark:hover:text-oai-brand-light transition-colors cursor-pointer","aria-label":"View cost breakdown",children:[o,y.jsx(Zy,{size:16,strokeWidth:2,className:"text-oai-gray-400 dark:text-oai-gray-500"})]}):y.jsx("span",{className:"text-xl font-bold text-oai-brand",children:o})})]}),A.length>0&&y.jsxs("div",{className:"space-y-6",children:[y.jsx("div",{role:"img","aria-label":`Provider distribution: ${A.map(T=>`${T.label} ${T.totalPercent}%`).join(", ")}`,className:"h-1.5 w-full bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden flex",children:A.map((T,R)=>{const O=$i(T.label,R);return y.jsx(et.div,{initial:{width:0},animate:{width:`${T.totalPercent}%`},transition:{duration:.6,delay:.3+R*.1},className:"h-full",style:{backgroundColor:O},title:`${T.label}: ${T.totalPercent}%`},T.label)})}),y.jsx("div",{className:"flex flex-wrap gap-3",children:A.map((T,R)=>{const O=$i(T.label,R),D=v===T.label;return y.jsxs("button",{"aria-expanded":D,"aria-controls":`provider-details-${T.label}`,"aria-label":`${T.label}: ${T.totalPercent}%. Click to ${D?"collapse":"expand"} details`,onClick:()=>k(D?null:T.label),className:`flex-1 min-w-[140px] text-left p-3 rounded-lg border transition-colors duration-200 ${D?"border-oai-gray-300 dark:border-oai-gray-600 bg-oai-gray-50 dark:bg-oai-gray-800":"border-oai-gray-200 dark:border-oai-gray-700 hover:border-oai-gray-300 dark:hover:border-oai-gray-600"}`,children:[y.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[y.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:O}}),y.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:T.label})]}),y.jsxs("div",{className:"text-lg font-semibold text-oai-black dark:text-oai-white tabular-nums",children:[T.totalPercent,"%"]}),y.jsxs("div",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:[T.models.length," models"]})]},T.label)})}),v&&y.jsx("div",{id:`provider-details-${v}`,role:"region","aria-label":`${v} model details`,className:"border border-oai-gray-200 dark:border-oai-gray-700 rounded-lg p-4 bg-oai-gray-50/30 dark:bg-oai-gray-800/30 overflow-hidden",children:A.filter(T=>T.label===v).map(T=>{const R=$i(T.label,0),O=[...T.models].sort((D,F)=>(F.share||0)-(D.share||0));return y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[y.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:R}}),y.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:T.label}),y.jsxs("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400",children:[T.totalPercent,"%"]})]}),y.jsx("div",{className:"space-y-2",children:O.map(D=>y.jsx("div",{className:"flex items-center gap-3",children:y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[y.jsx("span",{className:"text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate",children:D.name}),y.jsxs("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white tabular-nums shrink-0",children:[D.share,"%"]})]}),y.jsx("div",{className:"h-1 bg-oai-gray-200 dark:bg-oai-gray-700 rounded-full overflow-hidden",children:y.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${D.share}%`,backgroundColor:R,opacity:.7}})})]})},D.id||D.name))})]},T.label)})})]})]})})}function Ad(e,t){if(!Array.isArray(e)||e.length===0)return 0;if(e.length===1)return e[0];const n=(e.length-1)*t,s=Math.floor(n),r=Math.ceil(n);if(s===r)return e[s];const o=n-s;return e[s]+(e[r]-e[s])*o}function oP(e){const t=Array.isArray(e)?e.filter(r=>Number.isFinite(r)&&r>0).sort((r,o)=>r-o):[];if(t.length===0)return{rawMax:0,effectiveMax:1,clippedValues:Array.isArray(e)?e.map(()=>0):[]};const n=t.at(-1)??0;let s=n;if(t.length>=4){const r=Ad(t,.25),o=Ad(t,.75),i=Math.max(o-r,0),a=o+i*1.5;n>a&&(s=Math.max(a,o,1))}return{rawMax:n,effectiveMax:Math.max(s,1),clippedValues:Array.isArray(e)?e.map(r=>!Number.isFinite(r)||r<=0?0:Math.min(r,Math.max(s,1))):[]}}function iP({value:e,displayValue:t,scale:n,index:s,row:r,totalBars:o}){const i=kr(),a=n.effectiveMax>0?t/n.effectiveMax*100:0,l=`${Math.max(a,2)}%`,c=r?.missing,u=r?.future,d=o<=7?"6px":o<=14?"4px":"3px";return y.jsx(et.div,{className:"group relative flex-1 self-stretch",initial:{opacity:0,scaleY:0},animate:{opacity:1,scaleY:1},transition:{duration:i?0:.3,delay:i?0:s*.02,ease:[.25,.1,.25,1]},style:{originY:1},children:y.jsxs("div",{className:"absolute inset-x-0 bottom-0",style:{height:l},children:[y.jsx("div",{"data-trend-bar":"true",className:"h-full w-full cursor-pointer transition-all duration-200 group-hover:brightness-110",style:{minHeight:e>0?"4px":"2px",opacity:c||u?.2:1,borderRadius:`${d} ${d} 0 0`,background:e>0?"#10b981":"var(--oai-gray-100)"},title:`${e.toLocaleString()}`}),y.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-oai-black text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-20",children:e.toLocaleString()})]})})}function aP({rows:e,from:t,to:n,period:s,timeZoneLabel:r,showTimeZoneLabel:o=!0,className:i=""}){const a=Array.isArray(e)&&e.length?e:[],l=a.map(u=>{if(u?.missing||u?.future)return 0;const d=u?.billable_total_tokens??u?.total_tokens??u?.value;if(d==null)return 0;const f=Number(d);return Number.isFinite(f)?f:0}),c=oP(l);return y.jsxs("div",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5 ${i}`,children:[y.jsxs("div",{className:"mb-3",children:[y.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:V("trend.monitor.label")}),o&&r&&y.jsx("p",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:r})]}),y.jsxs("div",{className:"space-y-3",children:[y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:"absolute inset-0 flex flex-col justify-between pointer-events-none",children:[0,25,50,75,100].map(u=>y.jsx("div",{className:"w-full border-t border-oai-gray-100 dark:border-oai-gray-800",style:{top:`${100-u}%`}},u))}),y.jsx("div",{className:"h-40 flex items-end gap-1 relative z-0",children:l.length>0?l.map((u,d)=>y.jsx(iP,{value:u,displayValue:c.clippedValues[d]??0,scale:c,index:d,row:a[d],totalBars:l.length},d)):y.jsx("div",{className:"flex-1 h-full flex items-center justify-center",children:y.jsx("p",{className:"text-sm text-oai-gray-400 dark:text-oai-gray-400",children:"No data yet"})})})]}),t&&n&&y.jsxs("div",{className:"flex justify-between text-xs text-oai-gray-500 dark:text-oai-gray-300 font-medium pt-2 border-t border-oai-gray-100 dark:border-oai-gray-800",children:[y.jsx("span",{children:t}),y.jsx("span",{children:n})]})]})]})}const Yi="macAppBannerDismissed",lP="https://github.com/mm7894215/tokentracker/releases/latest";function cP({size:e=48,className:t=""}){const n=e/16,[s,r]=h.useState(!1);h.useEffect(()=>{const a=()=>{const c=2500+Math.random()*3e3;return setTimeout(()=>{r(!0),setTimeout(()=>{r(!1),a()},120)},c)},l=a();return()=>clearTimeout(l)},[]);const o="#DE886D",i="#000000";return y.jsxs("svg",{width:15*n,height:10*n,viewBox:"0 5.5 15 10",className:t,style:{imageRendering:"pixelated"},children:[y.jsx("rect",{x:"2",y:"6",width:"11",height:"7",fill:o}),y.jsx("rect",{x:"0",y:"9",width:"2",height:"2",fill:o}),y.jsx("rect",{x:"13",y:"9",width:"2",height:"2",fill:o}),y.jsx("rect",{x:"3",y:"13",width:"1",height:"2",fill:o}),y.jsx("rect",{x:"5",y:"13",width:"1",height:"2",fill:o}),y.jsx("rect",{x:"9",y:"13",width:"1",height:"2",fill:o}),y.jsx("rect",{x:"11",y:"13",width:"1",height:"2",fill:o}),y.jsx("rect",{x:"3",y:"15",width:"9",height:"1",fill:"#000",opacity:"0.12"}),s?y.jsxs(y.Fragment,{children:[y.jsx("rect",{x:"4",y:"9",width:"1",height:"0.4",fill:i}),y.jsx("rect",{x:"10",y:"9",width:"1",height:"0.4",fill:i})]}):y.jsxs(y.Fragment,{children:[y.jsx("rect",{x:"4",y:"8",width:"1",height:"2",fill:i}),y.jsx("rect",{x:"10",y:"8",width:"1",height:"2",fill:i})]})]})}function uP(){const[e,t]=h.useState(()=>{try{return localStorage.getItem(Yi)==="1"?!0:new URLSearchParams(window.location.search).get("from")==="menubar"?(localStorage.setItem(Yi,"1"),!0):!1}catch{return!1}}),n=h.useCallback(()=>{t(!0);try{localStorage.setItem(Yi,"1")}catch{}},[]);return e?null:y.jsx(sC,{children:y.jsx(et.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.3},className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4",children:y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx(et.div,{animate:{y:[0,-2,0]},transition:{duration:3.2,repeat:1/0,ease:"easeInOut"},className:"flex-shrink-0",children:y.jsx(cP,{size:44})}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("div",{className:"text-sm font-medium text-oai-gray-900 dark:text-oai-white",children:"Try the Menu Bar App"}),y.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-0.5",children:"Always-on stats with Clawd companion"})]}),y.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[y.jsxs(et.a,{href:lP,target:"_blank",rel:"noopener noreferrer",whileHover:{scale:1.03},whileTap:{scale:.97},className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-white bg-oai-gray-900 dark:bg-oai-white dark:text-oai-gray-900 rounded-md hover:opacity-90 transition-opacity",children:["Download",y.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:y.jsx("path",{d:"M6 2v6m0 0L3.5 5.5M6 8l2.5-2.5M2 10h8",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),y.jsx("button",{onClick:n,className:"p-1 text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-300 transition-colors","aria-label":"Dismiss",children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.jsx("path",{d:"M4 4l6 6m0-6L4 10",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})})]})]})})})}function dP(e){const{copy:t,screenshotMode:n,isNativeApp:s,publicViewInvalid:r,publicViewInvalidTitle:o,publicViewInvalidBody:i,showExpiredGate:a,showAuthGate:l,screenshotTitleLine1:c,screenshotTitleLine2:u,identityDisplayName:d,identityStartDate:f,activeDays:m,identitySubscriptions:p,identityScrambleDurationMs:g,projectUsageEntries:b,projectUsageLimit:w,setProjectUsageLimit:x,topModels:v,signedIn:k,publicMode:S,isLocalMode:C,shouldShowInstall:E,installPrompt:M,handleCopyInstall:A,installCopied:T,installInitCmdDisplay:R,publicViewTitle:O,handleTogglePublicView:D,publicViewBusy:F,publicViewEnabled:N,publicViewCopyButtonLabel:_,handleCopyPublicView:z,trendRowsForDisplay:P,trendFromForDisplay:I,trendToForDisplay:B,period:W,trendTimeZoneLabel:J,activityHeatmapBlock:Y,isCapturing:$,handleShareToX:K,screenshotTwitterButton:Z,screenshotTwitterHint:le,periodsForDisplay:Ce,setSelectedPeriod:Ae,customFrom:De,customTo:tt,onCustomRangeApply:L,customRangeOpen:ce,onCustomRangeOpenChange:te,summaryLabel:Pe,summaryValue:U,summaryCostValue:se,summaryConversationsValue:re,rollingUsage:me,costInfoEnabled:ge,openCostModal:Q,costModalOpen:ne,closeCostModal:je,allowBreakdownToggle:be,refreshAll:Be,usageLoadingState:$e,fleetData:ct,hasDetailsActual:nt,dailyEmptyPrefix:ye,installSyncCmd:ve,dailyEmptySuffix:Ie,detailsColumns:ut,ariaSortFor:_t,toggleSort:Tt,sortIconFor:st,pagedDetails:pn,dailyBreakdownRows:xe,dailyBreakdownColumns:Ye,dailyBreakdownAriaSortFor:oe,dailyBreakdownSortIconFor:ue,dailyBreakdownDateKey:H,detailsDateKey:fe,renderDetailDate:we,renderDailyBreakdownDate:de,renderDetailCell:Jt,DETAILS_PAGED_PERIODS:Qt,detailsPageCount:Dn,detailsPage:en,setDetailsPage:tn}=e;return y.jsxs(y.Fragment,{children:[y.jsxs(yM,{hideHeader:n||s,header:null,footer:n?null:null,className:n?"screenshot-mode":"",children:[r?y.jsx("div",{className:"mb-6",children:y.jsx(Vo,{title:o,className:"border-oai-gray-200 dark:border-oai-gray-800",children:y.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300 mt-0",children:i})})}):null,a||l?null:y.jsx(y.Fragment,{children:y.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4",children:[y.jsxs("div",{className:"lg:col-span-4 flex flex-col gap-4 min-w-0",children:[n?y.jsx("div",{className:"flex items-start justify-between gap-4",children:y.jsxs("div",{className:"flex flex-col gap-1",children:[y.jsx("span",{className:"text-3xl md:text-4xl font-semibold text-oai-black dark:text-oai-white tracking-tight leading-none",children:c}),y.jsx("span",{className:"text-2xl md:text-3xl font-semibold text-oai-black dark:text-oai-white tracking-tight leading-none",children:u})]})}):null,C&&!s?y.jsx(bn,{delay:.1,children:y.jsx(uP,{})}):s?y.jsx(bn,{delay:.1,children:y.jsx("a",{href:"https://github.com/mm7894215/tokentracker",target:"_blank",rel:"noopener noreferrer",className:"block rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4 hover:border-oai-gray-300 dark:hover:border-oai-gray-700 transition-colors no-underline",children:y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("div",{className:"flex-shrink-0",children:y.jsx("svg",{height:"32",viewBox:"0 0 16 16",width:"32",className:"fill-oai-gray-900 dark:fill-oai-white",children:y.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})})}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("div",{className:"text-sm font-medium text-oai-gray-900 dark:text-oai-white",children:"Star on GitHub"}),y.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-0.5",children:"Open source token usage tracker"})]}),y.jsx("div",{className:"flex-shrink-0",children:y.jsx("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-white bg-oai-gray-900 dark:bg-oai-white dark:text-oai-gray-900 rounded-md",children:"★ Star"})})]})})}):null,y.jsx(zM,{title:t("dashboard.identity.title"),subtitle:t("dashboard.identity.subtitle"),period:W,rankLabel:f??t("identity_card.rank_placeholder"),streakDays:m,subscriptions:p,periodConversations:re,rolling:me,topModels:v}),E?y.jsx(bn,{delay:.25,children:y.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-3",children:[y.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 mb-1.5",children:M}),y.jsxs(et.button,{onClick:A,whileHover:{scale:1.01},whileTap:{scale:.99},className:"w-full flex items-center justify-between px-3 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 rounded-lg transition-colors",children:[y.jsx("code",{className:"text-xs font-mono text-oai-gray-700 dark:text-oai-gray-300",children:R}),y.jsx(et.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"text-xs text-oai-brand",children:T?"Copied ✓":"Copy"},T?"copied":"copy")]})]})}):null,!n&&k&&!S?y.jsx(bn,{delay:.3,children:y.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-3 flex items-center justify-between",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(et.button,{type:"button",onClick:D,disabled:F,whileTap:{scale:.95},className:`relative inline-flex h-4 w-7 items-center px-0.5 transition-colors rounded-full ${N?"bg-oai-brand":"bg-oai-gray-300 dark:bg-oai-gray-600"} disabled:opacity-50`,children:y.jsx(et.span,{initial:!1,animate:{x:N?12:0},transition:{type:"spring",stiffness:500,damping:30},className:"inline-block h-3 w-3 bg-white rounded-full"})}),y.jsx(et.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",children:N?"Public":"Private"},N?"public":"private")]}),y.jsx(et.button,{onClick:z,disabled:!N||F,whileHover:{scale:N?1.05:1},whileTap:{scale:N?.95:1},className:"text-xs text-oai-brand hover:text-oai-brand-dark disabled:text-oai-gray-300 dark:disabled:text-oai-gray-600 transition-colors",children:_})]})}):null,Y&&y.jsx(bn,{delay:.4,children:Y}),n?null:y.jsx(aP,{rows:P,from:I,to:B,period:W,timeZoneLabel:J,showTimeZoneLabel:!1}),n?y.jsxs("div",{className:"mt-4 flex flex-col items-center gap-2","data-screenshot-exclude":"true",style:$?{display:"none"}:void 0,children:[y.jsx(ar,{type:"button",onClick:K,variant:"primary",size:"lg",disabled:$,children:Z}),y.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300",children:le})]}):null]}),y.jsxs("div",{className:"lg:col-span-8 flex flex-col gap-4 min-w-0",children:[y.jsx(rP,{period:W,periods:Ce,onPeriodChange:Ae,summaryLabel:Pe,summaryValue:U,summaryCostValue:se,onCostInfo:ge?Q:null,fleetData:ct,onRefresh:n?null:Be,loading:$e,customFrom:De,customTo:tt,onCustomRangeApply:L,customRangeOpen:ce,onCustomRangeOpenChange:te}),n?null:y.jsx(bn,{delay:.5,children:y.jsx(HM,{projectEntries:b,projectLimit:w,onProjectLimitChange:x,copy:t,hasDetailsActual:nt,dailyEmptyPrefix:ye,installSyncCmd:ve,dailyEmptySuffix:Ie,detailsColumns:ut,ariaSortFor:_t,toggleSort:Tt,sortIconFor:st,pagedDetails:pn,dailyBreakdownRows:xe,dailyBreakdownColumns:Ye,dailyBreakdownAriaSortFor:oe,dailyBreakdownSortIconFor:ue,dailyBreakdownDateKey:H,detailsDateKey:fe,renderDetailDate:we,renderDailyBreakdownDate:de,renderDetailCell:Jt,DETAILS_PAGED_PERIODS:Qt,period:W,detailsPageCount:Dn,detailsPage:en,setDetailsPage:tn})})]})]})})]}),y.jsx(YM,{isOpen:ne,onClose:je,fleetData:ct})]})}const fP=["day","week","month","total","custom"],Hi=new Set(["day","hour","month"]),Ys=new Set(["day","total","custom"]);function Ui(e,t){if(typeof t=="number"&&t>0)return!0;if(typeof e=="bigint")return e>0n;if(typeof e=="number")return Number.isFinite(e)&&e>0;if(typeof e=="string"){const n=e.trim();if(!n)return!1;if(/^[0-9]+$/.test(n))try{return BigInt(n)>0n}catch{return!1}const s=Number(n);return Number.isFinite(s)&&s>0}return!1}function Kr(e){return e?e?.billable_total_tokens??e?.total_tokens:null}function Od(e){return e?e?.billable_total_tokens??e?.value??e?.total_tokens:null}function hP(e){if(typeof e!="string"||!e)return null;const t=e.split("-");if(t.length!==3)return null;const n=Number(t[0]),s=Number(t[1])-1,r=Number(t[2]);if(!Number.isFinite(n)||!Number.isFinite(s)||!Number.isFinite(r))return null;const o=new Date(Date.UTC(n,s,r));return Number.isFinite(o.getTime())?o:null}function mP(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function pP(e){return e?e==="www.tokentracker.cc":!1}function gP(){if(typeof window>"u")return!1;const e=new URLSearchParams(window.location.search),t=String(e.get("force_install")||"").toLowerCase();return t!=="1"&&t!=="true"?!1:!pP(window.location.hostname)}function wP({baseUrl:e,auth:t,signedIn:n,sessionSoftExpired:s,signOut:r,publicMode:o=!1,publicToken:i=null,signInUrl:a="/sign-in",signUpUrl:l="/sign-up"}){const[c,u]=h.useState(!1),[d,f]=h.useState(null),[m,p]=h.useState(null),[g,b]=h.useState(!1),[w,x]=h.useState(null),[v,k]=h.useState(0),[S,C]=h.useState(0),[E,M]=h.useState(!1),[A,T]=h.useState(null),[R,O]=h.useState(!1),[D,F]=h.useState(!1),[N,_]=h.useState(!1),[z,P]=h.useState(null),[I,B]=h.useState(null),[W,J]=h.useState(null),[Y,$]=h.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(max-width: 640px)").matches),K=h.useMemo(()=>typeof window>"u"?!1:jy(window.location.search),[]),Z=h.useMemo(()=>gP(),[]),[le,Ce]=h.useState(!1),Ae=2200,[De,tt]=h.useState(!0),[L,ce]=h.useState(!1),[te,Pe]=h.useState(!1),[U,se]=h.useState(!1),re=Je(),me=n&&!s,ge=h.useMemo(()=>me&&(typeof t=="function"||typeof t=="string"||t&&typeof t=="object")?t:null,[t,me]),Q=me?ge:null,ne=o?Nd(i):Q,je=n||re||o,be=me&&Ms(Q),Be=n&&s&&!o;h.useEffect(()=>{if(!n||re){f(null),p(null),b(!1),x(null);return}if(o)return;if(!be){f(null),p(null),b(!1),x(null);return}let j=!0;const G=()=>{f(null),p(null),b(!1),x(null)};return b(!0),x(null),(async()=>{let X=null;try{X=await Ot(Q)}catch{X=null}if(j){if(!X){G();return}try{const ae=await Zb({baseUrl:e,accessToken:X});if(!j)return;f(typeof ae?.link_code=="string"?ae.link_code:null),p(typeof ae?.expires_at=="string"?ae.expires_at:null)}catch(ae){if(!j)return;f(null),p(null),x(ae?.message||"Failed to load link code")}finally{if(!j)return;b(!1)}}})(),()=>{j=!1}},[e,re,n,o,be,Q,S]),h.useEffect(()=>{if(!n||re||o){M(!1),T(null),O(!1),F(!1),_(!1);return}if(!be){M(!1),T(null),O(!1),F(!1),_(!1);return}let j=!0;return O(!0),(async()=>{let G=null;try{G=await Ot(Q)}catch{G=null}if(j){if(!G){M(!1),T(null),O(!1);return}try{const X=await pc({baseUrl:e,accessToken:G});if(!j)return;const ae=!!X?.enabled;M(ae),T(X?.share_token||null)}catch{if(!j)return;M(!1),T(null)}finally{if(!j)return;O(!1)}}})(),()=>{j=!1}},[e,re,n,o,be,Q]),h.useEffect(()=>{if(!o){P(null),B(null);return}if(!i){P(null),B(null);return}P(null),B(null);let j=!0;return Jb({baseUrl:e,accessToken:i}).then(G=>{j&&(P(typeof G?.display_name=="string"?G.display_name:null),B(typeof G?.avatar_url=="string"?G.avatar_url:null))}).catch(()=>{j&&(P(null),B(null))}),()=>{j=!1}},[e,o,i]);const $e=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),ct=Iy();h.useEffect(()=>{if(!$e&&(!n||re||o)){J(null);return}if(!$e&&!be){J(null);return}let j=!0;return(async()=>{let G=null;try{G=await Ot(Q)}catch{G=null}if(j){if(!G&&!$e){J(null);return}try{const X=await Ub({baseUrl:e,accessToken:G});if(!j)return;J(X&&typeof X=="object"?X:null)}catch{if(!j)return;J(null)}}})(),()=>{j=!1}},[be,e,Q,re,o,n]);const nt=h.useMemo(()=>{if(!m)return!1;const j=Date.parse(m);if(!Number.isFinite(j))return!1;const G=v||Date.now();return j<=G},[m,v]);h.useEffect(()=>{!n||re||o||!m||!nt||g||(f(null),p(null),x(null),C(j=>j+1))},[nt,m,g,re,n]),h.useEffect(()=>{if(!m||o)return;const j=Date.parse(m);if(!Number.isFinite(j))return;const G=Date.now();if(k(G),j<=G)return;const X=window.setTimeout(()=>k(Date.now()),j-G),ae=()=>{typeof document>"u"||document.visibilityState==="visible"&&k(Date.now())};return typeof document<"u"&&document.addEventListener("visibilitychange",ae),window.addEventListener("focus",ae),()=>{window.clearTimeout(X),typeof document<"u"&&document.removeEventListener("visibilitychange",ae),window.removeEventListener("focus",ae)}},[m]),h.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const j=window.matchMedia("(max-width: 640px)"),G=()=>$(j.matches);return G(),j.addEventListener?(j.addEventListener("change",G),()=>j.removeEventListener("change",G)):(j.addListener(G),()=>j.removeListener(G))},[]);const ye=h.useMemo(()=>Fy(),[]),ve=h.useMemo(()=>Ly(),[]),Ie=h.useMemo(()=>_y(),[]),ut=o?null:t?.userId||t?.email||"default",[_t,Tt]=h.useState("month"),[st,pn]=h.useState(null),[xe,Ye]=h.useState(null),[oe,ue]=h.useState(!1),H=K?"total":_t,fe=h.useMemo(()=>H==="custom"&&st&&xe?{from:st,to:xe}:Vy(H,{timeZone:ye,offsetMinutes:ve,now:Ie}),[Ie,H,ye,ve,st,xe]),we=fe.from,de=fe.to,Jt=h.useMemo(()=>Wy({timeZone:ye,offsetMinutes:ve}),[ye,ve]),Qt=h.useMemo(()=>By({timeZone:ye,offsetMinutes:ve}),[ye,ve]),Dn=h.useMemo(()=>`Local time (${Qt})`,[Qt]),en=ye,tn=ve,Jn=Jt,nn=h.useMemo(()=>Ea({timeZone:ye,offsetMinutes:ve,date:Ie||new Date}),[Ie,ye,ve]),Er=h.useMemo(()=>{const j=hP(nn)||new Date,G=mP(j,-29);return{from:ys(G),to:ys(j)}},[nn]),{daily:Vt,summary:ze,rolling:$o,source:Dr,loading:Yo,error:Ct,refresh:Al}=xc({baseUrl:e,accessToken:ne,guestAllowed:Be,from:we,to:de,includeDaily:H!=="total",cacheKey:ut,timeZone:ye,tzOffsetMinutes:ve,now:Ie}),{daily:Ol,loading:Bp,refresh:Nl}=xc({baseUrl:e,accessToken:ne,guestAllowed:Be,from:Er.from,to:Er.to,includeDaily:!0,cacheKey:ut?`${ut}.daily-breakdown`:"daily-breakdown",timeZone:ye,tzOffsetMinutes:ve,now:Ie}),{breakdown:Pn,loading:$p,refresh:jl}=p0({baseUrl:e,accessToken:ne,guestAllowed:Be,from:we,to:de,cacheKey:ut,timeZone:ye,tzOffsetMinutes:ve}),[Il,Yp]=h.useState(3),{entries:Hp,loading:Up,refresh:Fl}=i0({baseUrl:e,accessToken:ne,limit:Il,from:we,to:de,timeZone:ye,tzOffsetMinutes:ve}),Ll=H==="week"||H==="month",Pr=H==="week"||H==="month",_l=h.useMemo(()=>Vt.filter(j=>j?.future?!1:!j?.day||!nn?!0:String(j.day)<=String(nn)),[Vt,nn]),{rows:sn,from:zp,to:Gp,loading:Kp,refresh:Vl}=l0({baseUrl:e,accessToken:ne,guestAllowed:Be,period:H,from:we,to:de,months:24,cacheKey:ut,timeZone:en,tzOffsetMinutes:tn,now:Ie,sharedRows:Ll?Vt:null,sharedRange:Ll?{from:we,to:de}:null}),{daily:Qn,heatmap:rn,loading:Wl,refresh:Bl}=o0({baseUrl:e,accessToken:ne,guestAllowed:Be,weeks:52,cacheKey:ut,timeZone:ye,tzOffsetMinutes:ve,now:Ie}),Mt=h.useMemo(()=>H==="day"?"hour":H==="total"?"month":"day",[H]),qp=h.useMemo(()=>wc(Mt),[Mt]),Rr="day",Xp=h.useMemo(()=>wc(Rr),[]),[Et,$l]=h.useState(()=>({key:"day",dir:"desc"}));h.useEffect(()=>{$l(j=>!Hi.has(j.key)||j.key===Mt?j:{key:Mt,dir:j.dir})},[Mt]);const es=h.useMemo(()=>Hi.has(Et.key)&&Et.key!==Mt?{...Et,key:Mt}:Et,[Mt,Et]),Ar=h.useMemo(()=>{if(H==="day")return Array.isArray(sn)?sn.filter(X=>X?.hour&&!X?.future):[];if(H==="total"){const X=Array.isArray(sn)?sn.filter(ae=>ae?.month&&!ae?.future):[];return D0(X)}const j=_l;return!j.some(X=>!X?.missing&&!X?.future)&&Vt.length>0?Vt.filter(X=>!X?.future).slice(-30).filter(X=>X?.day):j},[H,sn,_l,Vt]),js=h.useMemo(()=>kc(Ar,es),[Ar,es]),Zp=h.useMemo(()=>Ar.some(j=>!j?.missing&&!j?.future),[Ar]),Ho=h.useMemo(()=>{if(!Ys.has(H))return 1;const j=Math.ceil(js.length/yo);return j>0?j:1},[H,js.length]),[Uo,Or]=h.useState(0);h.useEffect(()=>{if(!Ys.has(H)){Or(0);return}Or(j=>Math.min(j,Ho-1))},[Ho,H]),h.useEffect(()=>{Ys.has(H)&&Or(0)},[H,Et.dir,Et.key]);const Jp=h.useMemo(()=>Ys.has(H)?P0(js,Uo,yo):js,[Uo,H,js]),Yl=h.useMemo(()=>Ol.filter(j=>!j?.future&&j?.day).slice(-30),[Ol]),ts=h.useMemo(()=>Hi.has(Et.key)?{...Et,key:Rr}:Et,[Et]),Qp=h.useMemo(()=>kc(Yl,ts),[Yl,ts]),eg=h.useMemo(()=>Pr?Vt:H==="day"?Array.isArray(sn)?sn.filter(j=>j?.hour):[]:sn,[Vt,H,sn,Pr]),tg=Pr?we:zp,ng=Pr?de:Gp;function sg(j,G){return j?.future?"—":j?.missing?V("shared.status.unsynced"):G==="total_tokens"?an(Kr(j)):an(j?.[G])}function rg(j){const G=j?.[Mt];if(G==null)return"";const X=String(G);if(Mt==="hour"){const[ae,Fe]=X.split("T");if(ae&&Fe)return`${ae} ${Fe.slice(0,5)}`}return X}function og(j){const G=j?.[Rr];return G==null?"":String(G)}function ig(j){$l(G=>G.key===j?{key:j,dir:G.dir==="asc"?"desc":"asc"}:{key:j,dir:"desc"})}function ag(j){return es.key!==j?"none":es.dir==="asc"?"ascending":"descending"}function lg(j){return es.key!==j?"":es.dir==="asc"?"▲":"▼"}function cg(j){return ts.key!==j?"none":ts.dir==="asc"?"ascending":"descending"}function ug(j){return ts.key!==j?"":ts.dir==="asc"?"▲":"▼"}const Hl=h.useMemo(()=>{if(!n&&!re&&!o&&!$e)return 0;const j=Number(rn?.active_days);if(Number.isFinite(j))return j;let G=0;const X=new Set,ae=(Re,Ve,Ge)=>{typeof Re!="string"||!Re||X.has(Re)||Ui(Ve,Ge)&&(X.add(Re),G+=1)};if(Array.isArray(Qn))for(const Re of Qn)ae(Re?.day,Kr(Re));const Fe=Array.isArray(rn?.weeks)?rn.weeks:[];for(const Re of Fe)for(const Ve of Array.isArray(Re)?Re:[]){const Ge=Od(Ve);ae(Ve?.day,Ge,Ve?.level)}return G},[n,re,rn?.active_days,rn?.weeks,Qn]),[Ul,zl]=h.useState("month"),dg=h.useCallback(j=>{j==="custom"?(zl(G=>G==="custom"?"month":G),Tt(G=>st&&xe?"custom":G),ue(!0)):(Tt(j),zl(j),ue(!1))},[st,xe]),fg=h.useCallback((j,G)=>{pn(j),Ye(G),Tt("custom"),ue(!1)},[]),hg=h.useCallback(j=>{ue(j),!j&&_t==="custom"&&!st&&Tt(Ul)},[_t,st,Ul]),Gl=h.useCallback(async()=>{await Promise.all([Al(),Bl(),Vl(),jl(),Fl(),Nl()])},[Nl,Bl,jl,Fl,Vl,Al]),mg=h.useCallback(async()=>{se(!0);try{$e&&await zb(),await Gl()}catch(j){console.error("[DashboardPage] Refresh failed:",j)}finally{se(!1)}},[$e,Gl]),pg=U||Yo||Bp||Wl||Kp||$p||Up,gg=h.useMemo(()=>V("shared.data_source",{source:String(Dr||"edge").toUpperCase()}),[Dr]),yg=h.useMemo(()=>{if(!o||!Ct)return!1;if((typeof Ct=="object"&&Ct?Ct?.status??Ct?.statusCode:null)===401)return!0;const G=typeof Ct=="string"?Ct:String(Ct?.message||Ct||"");return/unauthorized|invalid|token|revoked|401/i.test(G)},[o,Ct]),Nr=h.useMemo(()=>typeof t?.name!="string"?"":t.name.trim(),[t?.name]),Kl=h.useMemo(()=>typeof z!="string"?"":z.trim(),[z]),ql=h.useMemo(()=>!Nr||Nr.includes("@")?V("dashboard.identity.fallback"):Nr,[Nr]),Xl=h.useMemo(()=>ql.replace(/[^a-zA-Z0-9._-]/g,"_"),[ql]),bg=h.useMemo(()=>o?Kl||V("dashboard.identity.fallback"):Xl,[Xl,Kl,o]),xg=h.useMemo(()=>{let j=null;const G=ae=>{typeof ae!="string"||!ae||(!j||ae<j)&&(j=ae)};if(Array.isArray(Qn))for(const ae of Qn)ae?.day&&Ui(Kr(ae))&&G(ae.day);const X=Array.isArray(rn?.weeks)?rn.weeks:[];for(const ae of X)for(const Fe of Array.isArray(ae)?ae:[]){if(!Fe?.day)continue;const Re=Od(Fe),Ve=Fe?.level;Ui(Re,Ve)&&G(Fe.day)}return j},[rn?.weeks,Qn]),vg=h.useMemo(()=>o?[]:(Array.isArray(W?.subscriptions?.items)?W.subscriptions.items:[]).map(X=>{const ae=typeof X?.tool=="string"?X.tool.trim():"",Re=(typeof X?.plan_type=="string"?X.plan_type:typeof X?.planType=="string"?X.planType:"").trim();return!ae||!Re?null:{tool:ae,planType:Re,provider:typeof X?.provider=="string"?X.provider.trim():"",product:typeof X?.product=="string"?X.product.trim():"",rateLimitTier:typeof X?.rate_limit_tier=="string"?X.rate_limit_tier.trim():typeof X?.rateLimitTier=="string"?X.rateLimitTier.trim():""}}).filter(Boolean).slice(0,6),[o,W]),wg=y.jsx($0,{heatmap:rn,timeZoneLabel:Jt,timeZoneShortLabel:Qt,hideLegend:K,defaultToLatestMonth:K}),kg=h.useMemo(()=>`${we}..${de}`,[we,H,de]),Sg=V("usage.summary.total"),ns=Kr(ze),Zl=V("shared.unit.thousand_abbrev"),Jl=V("shared.unit.million_abbrev"),Ql=V("shared.unit.billion_abbrev"),jr=vt(ns),ec=Y&&jr!=null&&Math.abs(jr)>=1e9,Tg=h.useMemo(()=>ec?Yd(jr,{thousandSuffix:Zl,millionSuffix:Jl,billionSuffix:Ql,decimals:1}):an(ns),[Ql,Jl,ns,jr,Zl,ec]),Cg=V("dashboard.core_index.collapse_label"),Mg=V("dashboard.core_index.expand_label"),Eg=V("dashboard.core_index.collapse_aria"),Dg=V("dashboard.core_index.expand_aria"),Pg=!K,Rg=V("dashboard.screenshot.title_line1"),Ag=V("dashboard.screenshot.title_line2"),Og=V("dashboard.screenshot.twitter_label"),Ng=V("dashboard.screenshot.twitter_button"),jg=V("dashboard.screenshot.twitter_hint"),ss=V("shared.placeholder.short"),zo=h.useMemo(()=>{const j=Array.isArray(Pn?.sources)?Pn.sources:[];let G=null,X=0;for(const Ve of j){const Ge=vt(Ve?.totals?.billable_total_tokens??Ve?.totals?.total_tokens);!Number.isFinite(Ge)||Ge<=0||Ge>X&&(X=Ge,G=Ve)}let ae=ss,Fe=ss,Re="0.0";if(G&&X>0){ae=G?.source?String(G.source).toUpperCase():ss;const Ve=Array.isArray(G?.models)?G.models:[];let Ge=0;for(const on of Ve){const Fs=vt(on?.totals?.billable_total_tokens??on?.totals?.total_tokens);!Number.isFinite(Fs)||Fs<=0||Fs>Ge&&(Ge=Fs,Fe=on?.model?String(on.model):ss)}Ge>0&&(Re=(Ge/X*100).toFixed(1))}return{agentName:ae,modelName:Fe,modelPercent:Re}},[Pn,ss]),tc=an(ns),nc=V("dashboard.screenshot.twitter_text",{total_tokens:tc==="-"?ss:tc,agent_name:zo.agentName,model_name:zo.modelName,model_percent:zo.modelPercent}),Go=h.useMemo(()=>{if(typeof window>"u")return"";const j=new URL("https://twitter.com/intent/tweet");return j.searchParams.set("text",nc),j.toString()},[nc]),sc=h.useCallback(async()=>{if(typeof window>"u")return null;const j=async()=>{const Ve=performance.now();for(;performance.now()-Ve<2e3;){const Ge=document.querySelector("[data-heatmap-scroll='true']");if(!Ge||Ge.dataset.latestMonthReady==="true")return;await new Promise(on=>requestAnimationFrame(on))}},G=document.querySelector("#root")||document.body,X=document.documentElement,{scrollWidth:ae,scrollHeight:Fe}=document.documentElement;X?.classList.add("screenshot-capture"),document.body?.classList.add("screenshot-capture"),await new Promise(Re=>requestAnimationFrame(Re)),await j();try{const{toBlob:Re,toPng:Ve}=await $y(async()=>{const{toBlob:Rn,toPng:gy}=await import("./index-BeoRn2gJ.js");return{toBlob:Rn,toPng:gy}},[]),Ge=await Re(G,{backgroundColor:"#050505",pixelRatio:2,cacheBust:!0,width:ae,height:Fe,style:{width:`${ae}px`,height:`${Fe}px`},filter:Rn=>!(Rn instanceof HTMLElement)||Rn.dataset?.screenshotExclude!=="true"});if(Ge)return Ge;const on=await Ve(G,{backgroundColor:"#050505",pixelRatio:2,cacheBust:!0,width:ae,height:Fe,style:{width:`${ae}px`,height:`${Fe}px`},filter:Rn=>!(Rn instanceof HTMLElement)||Rn.dataset?.screenshotExclude!=="true"});return on?await(await fetch(on)).blob():null}finally{X?.classList.remove("screenshot-capture"),document.body?.classList.remove("screenshot-capture")}},[]),Ig=h.useCallback(async()=>{if(typeof window>"u"||le)return;Ce(!0);const j=navigator?.userAgent||"",G=/iP(hone|od|ad)/i.test(j),X=/Safari/i.test(j)&&!/Chrome|Chromium|Edg|OPR|CriOS|FxiOS/i.test(j),ae=typeof navigator<"u"&&!!navigator.clipboard?.write&&typeof window<"u"&&!!window.ClipboardItem;let Re=!ae||G||X;try{const Ve=await sc();Ve&&ae&&(typeof document<"u"&&!document.hasFocus()&&window.focus?.(),Re=await Yy(Ve))}catch(Ve){console.error("Failed to capture screenshot",Ve)}finally{if(Ce(!1),!Re){console.warn("Failed to write screenshot to clipboard.");return}Go&&(window.location.href=Go)}},[sc,le,Go]),Fg=h.useMemo(()=>K?[]:fP,[K]),Lg=h.useMemo(()=>[{label:V("usage.metric.total"),value:an(ns),valueClassName:"text-white"},{label:V("usage.metric.input"),value:an(ze?.input_tokens)},{label:V("usage.metric.output"),value:an(ze?.output_tokens)},{label:V("usage.metric.cached_input"),value:an(ze?.cached_input_tokens)},{label:V("usage.metric.reasoning_output"),value:an(ze?.reasoning_output_tokens)}],[ze?.cached_input_tokens,ze?.input_tokens,ze?.output_tokens,ze?.reasoning_output_tokens,ns]),Ko=h.useMemo(()=>{const j=Ra(ze?.total_cost_usd);return!j||j==="-"||j.startsWith("$")?j:`$${j}`},[ze?.total_cost_usd]),_g=h.useMemo(()=>ze?.conversation_count??null,[ze?.conversation_count]),rc=h.useMemo(()=>O0(Pn,{copyFn:V}),[Pn]),Vg=h.useMemo(()=>N0(Pn,{limit:3,copyFn:V}),[Pn]),Wg=h.useCallback(()=>u(!0),[]),Bg=h.useCallback(()=>u(!1),[]),$g=Ko&&Ko!=="-"&&rc.length>0,Is=V("dashboard.install.cmd.init"),qo=nt?null:d,Xo=qo?V("dashboard.install.cmd.init_link_code",{link_code:qo}):Is,Yg=Is,Hg=V("dashboard.install.cmd.sync"),Ug=qo?V("dashboard.install.copy"):V("dashboard.install.copy_base"),zg=V("dashboard.install.copied");V("dashboard.session_expired.copy_label"),V("dashboard.session_expired.copied");const Gg=!!(W?.install?.has_active_device_token??W?.install?.hasActiveDeviceToken),Kg=R0({publicMode:o,screenshotMode:K,forceInstall:Z,accessEnabled:je,heatmapLoading:Wl,activeDays:Hl,hasActiveDeviceToken:Gg}),qg=V("dashboard.install.prompt"),Xg=V("dashboard.public_view.title"),Zg=V("dashboard.public_view.status.enabled"),Jg=V("dashboard.public_view.status.disabled"),Qg=V("dashboard.public_view.action.copy"),ey=V("dashboard.public_view.action.copied"),ty=V("dashboard.public_view.action.enable"),ny=V("dashboard.public_view.action.disable"),sy=V("dashboard.public_view.invalid.title"),ry=V("dashboard.public_view.invalid.body"),oy=R||D,iy=E?Zg:Jg,oc=h.useMemo(()=>!A||typeof window>"u"?"":new URL(`/share/${A}`,window.location.origin).toString(),[A]),ay=N?ey:Qg,ly=E?ny:ty,cy=h.useCallback(async()=>{!Xo||!await Jo(Xo)||(ce(!0),window.setTimeout(()=>ce(!1),2e3))},[Xo]);h.useCallback(async()=>{!Is||!await Jo(Is)||(Pe(!0),window.setTimeout(()=>Pe(!1),2e3))},[Is]);const uy=h.useCallback(async()=>{if(D||!E)return;let j=oc;if(!j){F(!0);try{const X=await Ot(Q);if(!X){F(!1);return}const ae=await pc({baseUrl:e,accessToken:X}),Fe=typeof ae?.share_token=="string"?ae.share_token:null;T(Fe),Fe&&typeof window<"u"&&(j=new URL(`/share/${Fe}`,window.location.origin).toString())}catch{}finally{F(!1)}}!j||!await Jo(j)||(_(!0),window.setTimeout(()=>_(!1),2e3))},[Q,e,D,E,oc]),dy=h.useCallback(async()=>{if(!D){_(!1),F(!0);try{const j=await Ot(Q);if(!j){F(!1);return}const X=await Hb({baseUrl:e,accessToken:j,enabled:!E}),ae=!!X?.enabled;M(ae),T(X?.share_token||null)}catch{}finally{F(!1)}}},[Q,e,D,E]),Zo=h.useMemo(()=>V("dashboard.daily.empty",{cmd:"{{cmd}}"}),[]),[fy,hy]=h.useMemo(()=>{const j=Zo.split("{{cmd}}");return j.length===1?[Zo,""]:[j[0],j.slice(1).join("{{cmd}}")]},[Zo]),my=s&&!o,py=!n&&!re&&!s&&!$e&&!o;return y.jsx(dP,{copy:V,screenshotMode:K,publicViewInvalid:yg,publicViewInvalidTitle:sy,publicViewInvalidBody:ry,showExpiredGate:my,showAuthGate:py,screenshotTitleLine1:Rg,screenshotTitleLine2:Ag,identityDisplayName:bg,identityStartDate:xg,activeDays:Hl,identitySubscriptions:vg,identityScrambleDurationMs:Ae,projectUsageEntries:Hp,projectUsageLimit:Il,setProjectUsageLimit:Yp,topModels:Vg,signedIn:n,publicMode:o,isLocalMode:$e,isNativeApp:ct,shouldShowInstall:Kg,installPrompt:qg,handleCopyInstall:cy,installCopied:L,installCopiedLabel:zg,installCopyLabel:Ug,installInitCmdDisplay:Yg,linkCodeLoading:g,linkCodeError:w,publicViewTitle:Xg,handleTogglePublicView:dy,publicViewBusy:oy,publicViewEnabled:E,publicViewToggleLabel:ly,publicViewStatusLabel:iy,publicViewCopyButtonLabel:ay,handleCopyPublicView:uy,trendRowsForDisplay:eg,trendFromForDisplay:tg,trendToForDisplay:ng,period:H,trendTimeZoneLabel:Jn,activityHeatmapBlock:wg,isCapturing:le,handleShareToX:Ig,screenshotTwitterLabel:Og,screenshotTwitterButton:Ng,screenshotTwitterHint:jg,periodsForDisplay:Fg,setSelectedPeriod:dg,customFrom:st,customTo:xe,onCustomRangeApply:fg,customRangeOpen:oe,onCustomRangeOpenChange:hg,metricsRows:Lg,summaryLabel:Sg,summaryValue:Tg,summaryCostValue:Ko,summaryConversationsValue:_g,rollingUsage:$o,costInfoEnabled:$g,openCostModal:Wg,allowBreakdownToggle:Pg,coreIndexCollapsed:De,setCoreIndexCollapsed:tt,coreIndexCollapseLabel:Cg,coreIndexExpandLabel:Mg,coreIndexCollapseAria:Eg,coreIndexExpandAria:Dg,refreshAll:mg,usageLoadingState:pg,usageError:Ct,rangeLabel:kg,timeZoneRangeLabel:Dn,usageSourceLabel:gg,fleetData:rc,hasDetailsActual:Zp,dailyEmptyPrefix:fy,installSyncCmd:Hg,dailyEmptySuffix:hy,detailsColumns:qp,ariaSortFor:ag,toggleSort:ig,sortIconFor:lg,pagedDetails:Jp,dailyBreakdownRows:Qp,dailyBreakdownColumns:Xp,dailyBreakdownAriaSortFor:cg,dailyBreakdownSortIconFor:ug,dailyBreakdownDateKey:Rr,detailsDateKey:Mt,renderDetailDate:rg,renderDailyBreakdownDate:og,renderDetailCell:sg,DETAILS_PAGED_PERIODS:Ys,detailsPageCount:Ho,detailsPage:Uo,setDetailsPage:Or,costModalOpen:c,closeCostModal:Bg})}export{wP as DashboardPage};