@ipv9/tokentracker-cli 0.39.52 → 0.39.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{Card-CEz9362Q.js → Card-BZkG7ExP.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-BEzDx9x_.js → DashboardPage-BXs8ZVPT.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-COYl0L0c.js → IpCheckPage-Hm0zUwdf.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-CxKP9yCf.js → LimitsPage-BxsnbmDo.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-mkvVeaxU.js → LocalOnlyNotice-BvwC1vCO.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-CcXnjekJ.js → PopoverPopup-HsE_7fXK.js} +1 -1
- package/dashboard/dist/assets/{Select-DfLcXuzD.js → Select-7_WyWhaS.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-BKATdxHm.js → SettingsPage-DbJxd3N7.js} +1 -1
- package/dashboard/dist/assets/{SkillsPage-BCS1cw7N.js → SkillsPage-Dae3HfP-.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-BZMXgdYx.js → WrappedPage-DZU9PYF5.js} +1 -1
- package/dashboard/dist/assets/{format-DXnZAXRS.js → format-DtQGOz67.js} +1 -1
- package/dashboard/dist/assets/{limitDisplay-Dkfaklpc.js → limitDisplay-B1ZUkTHM.js} +1 -1
- package/dashboard/dist/assets/{main-Dft1sGV7.js → main-BBQHiOju.js} +3 -3
- package/dashboard/dist/assets/{mock-data-u9UDfqcX.js → mock-data-Ct1Wvcew.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-Nj1Nil2m.js → use-limits-display-prefs-CYoiCfEE.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-BxAIQJRl.js → useCurrency-DGkZG989.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/lib/pricing/curated-overrides.json +2 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as i,x as f,p as s,r as I,F as O,L as P,S as C}from"./main-
|
|
1
|
+
import{j as i,x as f,p as s,r as I,F as O,L as P,S as C}from"./main-BBQHiOju.js";import{F as R,k as o,l as T,u as S}from"./limitDisplay-B1ZUkTHM.js";import{L as w,u as A}from"./use-limits-display-prefs-CYoiCfEE.js";import{C as v}from"./Card-BZkG7ExP.js";import{L as M}from"./LocalOnlyNotice-BvwC1vCO.js";import{i as z}from"./mock-data-Ct1Wvcew.js";import"./format-DtQGOz67.js";const D=[3,2,3,3,2,2,3];function x({className:n}){return i.jsx("div",{className:f("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",n)})}function G(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(x,{className:"h-3 w-12 shrink-0"}),i.jsx(x,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(x,{className:"h-3 w-[30px] shrink-0"}),i.jsx(x,{className:"h-3 w-6 shrink-0"})]})}function $({bars:n,index:e}){const r=e%3===0?"w-24":e%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(x,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(x,{className:f("h-4",r)})]}),Array.from({length:n},(l,t)=>i.jsx(G,{},t))]})}function H(){return i.jsx(v,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(x,{className:"h-3.5 w-28"}),D.map((n,e)=>i.jsx($,{bars:n,index:e},e))]})})}function U(n,e){const r=e===w.REMAINING?100-n:n;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function a({label:n,pct:e,reset:r,quotaWindow:l,mode:t=w.USED}){const u=T(l,t),p=Math.max(0,Math.min(100,Number(e)||0)),m=t===w.REMAINING?100-p:p,_=Math.round(m),y=m>0&&_===0?Math.max(m,.35):m,g=m>0&&_===0?"<1":String(_);return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:n}),i.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:`${U(m,t)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${y}%`,minWidth:m>0?"3px":0}})}),i.jsx("span",{className:`text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 text-right shrink-0 whitespace-nowrap ${u?"w-20":"w-9"}`,children:u?s("usage.overview.provider_limit_count",{used:u.used,limit:u.limit}):`${g}%`}),r?i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:r}):null]})}function d({name:n,icon:e,children:r}){const t=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"||e==="/brand-logos/copilot.svg"||e==="/brand-logos/kimi.svg"?"w-[14px] h-[14px] dark:invert":"w-[14px] h-[14px]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[e?i.jsx("img",{src:e,alt:"",className:t}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:n})]}),r]})}const F=["claude","codex","cursor","gemini","kimi","zai","kiro","copilot","antigravity"],B={claude:{name:"Claude",icon:"/brand-logos/claude-code.svg"},codex:{name:"Codex",icon:"/brand-logos/codex.svg"},cursor:{name:"Cursor",icon:"/brand-logos/cursor.svg"},gemini:{name:"Gemini",icon:"/brand-logos/gemini.svg"},kimi:{name:"Kimi",icon:"/brand-logos/kimi.svg"},zai:{name:"Z.AI",icon:null},kiro:{name:"Kiro",icon:"/brand-logos/kiro.svg"},copilot:{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg"},antigravity:{name:"Antigravity",icon:"/brand-logos/antigravity.svg"}};function c({children:n,tone:e="neutral"}){const r=e==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${r}`,children:n})}function W(n,e,r){const l=B[n];if(!l)return null;if(!e?.configured)return i.jsx(d,{name:l.name,icon:l.icon,children:i.jsx(c,{children:s("limits.status.not_connected")})},n);if(e.error)return i.jsx(d,{name:l.name,icon:l.icon,children:i.jsx(c,{tone:"error",children:s("shared.error.prefix",{error:e.error})})},n);const t=e.plan_label?`${l.name} ${e.plan_label}`:l.name;switch(n){case"claude":return i.jsxs(d,{name:t,icon:l.icon,children:[e.five_hour?i.jsx(a,{label:"5h",pct:e.five_hour.utilization,reset:o(e.five_hour.resets_at),mode:r}):null,e.seven_day?i.jsx(a,{label:"7d",pct:e.seven_day.utilization,reset:o(e.seven_day.resets_at),mode:r}):null,e.seven_day_opus?i.jsx(a,{label:"Opus",pct:e.seven_day_opus.utilization,reset:o(e.seven_day_opus.resets_at),mode:r}):null,e.cached?i.jsx(c,{children:s("limits.status.cached")}):null,!e.five_hour&&!e.seven_day&&!e.seven_day_opus?i.jsx(c,{children:s("limits.status.no_data")}):null]},"claude");case"codex":return i.jsxs(d,{name:t,icon:l.icon,children:[e.primary_window?i.jsx(a,{label:"5h",pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:"7d",pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"codex");case"cursor":return i.jsxs(d,{name:t,icon:l.icon,children:[e.primary_window?i.jsx(a,{label:s("limits.label.cursor_plan"),pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:s("limits.label.cursor_auto"),pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(a,{label:s("limits.label.cursor_api"),pct:e.tertiary_window.used_percent,reset:o(e.tertiary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"cursor");case"gemini":return i.jsxs(d,{name:t,icon:l.icon,children:[e.primary_window?i.jsx(a,{label:"Pro",pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:"Flash",pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(a,{label:"Lite",pct:e.tertiary_window.used_percent,reset:o(e.tertiary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"gemini");case"kimi":return i.jsxs(d,{name:t,icon:l.icon,children:[e.primary_window?i.jsx(a,{label:s("limits.label.kimi_weekly"),pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:s("limits.label.kimi_5h"),pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(a,{label:s("limits.label.kimi_total"),pct:e.tertiary_window.used_percent,reset:o(e.tertiary_window.reset_at),mode:r}):null,e.parallel_limit?i.jsx(c,{children:s("limits.label.kimi_parallel",{count:e.parallel_limit})}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kimi");case"zai":return i.jsxs(d,{name:t,icon:l.icon,children:[e.primary_window?i.jsx(a,{label:s("limits.label.zai_5h"),pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:s("limits.label.zai_weekly"),pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(a,{label:s("limits.label.zai_mcp"),pct:e.tertiary_window.used_percent,reset:o(e.tertiary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"zai");case"kiro":return i.jsxs(d,{name:t,icon:l.icon,children:[e.primary_window?i.jsx(a,{label:s("limits.label.kiro_month"),pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:s("limits.label.kiro_bonus"),pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kiro");case"antigravity":return i.jsxs(d,{name:t,icon:l.icon,children:[e.primary_window?i.jsx(a,{label:"Claude",pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:"G Pro",pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(a,{label:"Flash",pct:e.tertiary_window.used_percent,reset:o(e.tertiary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"antigravity");case"copilot":return i.jsxs(d,{name:t,icon:l.icon,children:[e.primary_window?i.jsx(a,{label:s("limits.label.copilot_premium"),pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),quotaWindow:e.primary_window,mode:r}):null,e.secondary_window?i.jsx(a,{label:s("limits.label.copilot_chat"),pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),quotaWindow:e.secondary_window,mode:r}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null,e.otel_has_files||e.otel_enabled?null:i.jsx(Y,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function Y({defaultDir:n}){const[e,r]=I.useState(!1),t=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${n||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
|
|
2
2
|
`),u=async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),1600)}catch{}};return i.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:s("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:s("limits.copilot.otelHint.body")}),i.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:t}),i.jsx("button",{type:"button",onClick:u,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:e?s("limits.copilot.otelHint.copied"):s("limits.copilot.otelHint.copy")})]})}function q({claude:n,codex:e,cursor:r,gemini:l,kimi:t,zai:u,kiro:p,antigravity:m,copilot:_,order:y,visibility:g,displayMode:k}){const N={claude:n,codex:e,cursor:r,gemini:l,kimi:t,zai:u,kiro:p,antigravity:m,copilot:_},L=Array.isArray(y)&&y.length>0?y:F,b=k===w.REMAINING?w.REMAINING:w.USED,E=b===w.REMAINING?s("limits.settings.display_mode_remaining"):s("limits.settings.display_mode_used"),j=L.filter(h=>!g||g[h]!==!1).map(h=>W(h,N[h],b)).filter(Boolean);return i.jsx(R,{delay:.15,children:i.jsx(v,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[s("limits.panel.title"),s("limits.panel.mode_separator"),E]}),j.length>0?j:i.jsx(c,{children:s("limits.status.all_hidden")})]})})})}const K=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function re(){const n=O(),{data:e,error:r,isLoading:l}=S(n?{initialRefresh:!0,initialState:n,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),t=A();return!K&&!z()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(M,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:s("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:s("limits.page.subtitle")})]}),i.jsx(P,{to:"/settings","aria-label":s("limits.page.openSettings"),title:s("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:i.jsx(C,{className:"h-4 w-4","aria-hidden":!0})})]}),l?i.jsx(H,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:s("shared.error.prefix",{error:r})}):null,i.jsx(q,{claude:e?.claude,codex:e?.codex,cursor:e?.cursor,gemini:e?.gemini,kimi:e?.kimi,zai:e?.zai,kiro:e?.kiro,antigravity:e?.antigravity,copilot:e?.copilot,order:t.order,visibility:t.visibility,displayMode:t.displayMode})]})]})})})}export{re as LimitsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,p as t}from"./main-
|
|
1
|
+
import{j as e,p as t}from"./main-BBQHiOju.js";function a(){return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")})]})})}export{a as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as it,Y as X,$ as ne,a7 as Ce,r,a3 as ae,ar as Fe,as as Te,at as de,au as ye,av as at,aw as ct,k as W,ax as z,ay as ce,az as Se,aA as q,s as le,aB as lt,aC as we,_ as oe,h as ee,a8 as fe,j as G,aD as Le,aE as De,aF as Be,aG as Ee,aH as ut,aI as dt,aJ as Re,aK as ft,g as pt,aL as gt,aM as Ie,aN as mt,aO as ht,aP as Et,aQ as Rt,aR as vt,aS as Ct,aT as Tt}from"./main-Dft1sGV7.js";import{z as ue,y as St,F as Ne,P as be,A as y,B as pe,D as je,E as ge,G as bt,H as se,J as Z,K as He,M as Ae,N as _e,O as Ue,Q as Ye,R as Ge,T as Pe,U as $e,n as Ke,V as Pt,W as Ot,X as yt,t as It,Y as xt,Z as Mt,_ as Ve,$ as kt,a0 as Ft,a1 as wt}from"./useCurrency-BxAIQJRl.js";const Lt=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],dn=it("loader-circle",Lt);function me(e,t,n){if(n&&!ue(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const i=e();return typeof i=="number"?i:i?.[t]}return e?.[t]}function Dt(e,t){const n=r.useRef(null),i=r.useRef(null);return r.useCallback(c=>{if(e!==void 0){if(n.current!==null){const l=n.current,d=i.current,f=t.context.triggerElements.getById(l);d&&f===d&&t.context.triggerElements.delete(l),n.current=null,i.current=null}c!==null&&(n.current=e,i.current=c,t.context.triggerElements.add(e,c))}},[t,e])}function Bt(e,t,n,i){const c=n.useState("isMountedByTrigger",e),l=Dt(e,n),d=X(f=>{if(l(f),!f||!n.select("open"))return;const o=n.select("activeTriggerId");if(o===e){n.update({activeTriggerElement:f,...i});return}o==null&&n.update({activeTriggerId:e,activeTriggerElement:f,...i})});return ne(()=>{c&&n.update({activeTriggerElement:t.current,...i})},[c,n,t,...Object.values(i)]),{registerTrigger:d,isMountedByThisTrigger:c}}function Xe(e){const t=e.useState("open");ne(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[i,c]=n.value;e.update({activeTriggerId:i,activeTriggerElement:c})}}},[t,e])}function We(e,t,n){const{mounted:i,setMounted:c,transitionStatus:l}=St(e);t.useSyncedValues({mounted:i,transitionStatus:l});const d=X(()=>{c(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),f=t.useState("preventUnmountingOnClose");return Ce({enabled:!f,open:e,ref:t.context.popupRef,onComplete(){e||d()}}),{forceUnmount:d,transitionStatus:l}}function Nt(){return new Ne({open:!1,floatingElement:null,referenceElement:null,triggerElements:new be,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function ze(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:Nt(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:ae,inactiveTriggerProps:ae,popupProps:ae}}const Je={open:y(e=>e.open),mounted:y(e=>e.mounted),transitionStatus:y(e=>e.transitionStatus),floatingRootContext:y(e=>e.floatingRootContext),preventUnmountingOnClose:y(e=>e.preventUnmountingOnClose),payload:y(e=>e.payload),activeTriggerId:y(e=>e.activeTriggerId),activeTriggerElement:y(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:y((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:y((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:y((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:y((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:y(e=>e.popupProps),popupElement:y(e=>e.popupElement),positionerElement:y(e=>e.positionerElement)};function qe(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:i=!1,onOpenChange:c}=e,l=Fe(),d=pe()!=null,f=t.useState("open"),o=t.useState("activeTriggerElement"),m=t.useState(i?"popupElement":"positionerElement"),u=t.context.triggerElements,a=Te(()=>new Ne({open:f,referenceElement:o,floatingElement:m,triggerElements:u,onOpenChange:c,floatingId:l,nested:d,noEmit:n})).current;return ne(()=>{const g={open:f,floatingId:l,referenceElement:o,floatingElement:m};de(o)&&(g.domReferenceElement=o),a.state.positionReference===a.state.referenceElement&&(g.positionReference=o),a.update(g)},[f,l,o,m,a]),a.context.onOpenChange=c,a.context.nested=d,a.context.noEmit=n,a}const ve=at("safe-polygon"),jt=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${ct}`;function Ht(e){return e?!!e.closest(jt):!1}function Qe(e){const t=r.useRef(void 0),n=r.useRef(!1),i=r.useRef(void 0),c=r.useRef(!0),l=r.useRef(!1),d=r.useRef(()=>{}),f=r.useRef(!1),o=ye(),m=ye(),u=r.useRef(void 0);return r.useMemo(()=>{const a=e.context.dataRef.current;return a.hoverInteractionState||(a.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:i,blockMouseMoveRef:c,performedPointerEventsMutationRef:l,unbindMouseMoveRef:d,restTimeoutPendingRef:f,openChangeTimeout:o,restTimeout:m,handleCloseOptionsRef:u}),a.hoverInteractionState},[e,t,n,i,c,l,d,f,o,m,u])}const At=new Set(["click","mousedown"]);function _t(e,t={}){const n="rootStore"in e?e.rootStore:e,i=n.useState("open"),c=n.useState("floatingElement"),l=n.useState("domReferenceElement"),{dataRef:d}=n.context,{enabled:f=!0,closeDelay:o=0,externalTree:m}=t,{pointerTypeRef:u,interactedInsideRef:a,handlerRef:g,performedPointerEventsMutationRef:b,unbindMouseMoveRef:E,restTimeoutPendingRef:p,openChangeTimeout:C,handleCloseOptionsRef:k}=Qe(n),R=je(m),F=pe(),O=X(()=>a.current?!0:d.current.openEvent?At.has(d.current.openEvent.type):!1),I=X(()=>{const v=d.current.openEvent?.type;return v?.includes("mouse")&&v!=="mousedown"}),w=r.useCallback((v,P=!0)=>{const h=Ut(o,u.current);h&&!g.current?C.start(h,()=>n.setOpen(!1,W(z,v))):P&&(C.clear(),n.setOpen(!1,W(z,v)))},[o,g,n,u,C]),x=X(()=>{E.current(),g.current=void 0}),A=X(()=>{if(b.current){const v=ce(c).body;v.style.pointerEvents="",v.removeAttribute(ve),b.current=!1}}),H=X(v=>{const P=Se(v);if(!Ht(P)){a.current=!1;return}a.current=!0});ne(()=>{i||(u.current=void 0,p.current=!1,a.current=!1,x(),A())},[i,u,p,a,x,A]),r.useEffect(()=>()=>{x()},[x]),r.useEffect(()=>A,[A]),ne(()=>{if(f&&i&&k.current?.blockPointerEvents&&I()&&de(l)&&c){b.current=!0;const v=ce(c).body;v.setAttribute(ve,"");const P=l,h=c,s=R?.nodesRef.current.find(j=>j.id===F)?.context?.elements.floating;return s&&(s.style.pointerEvents=""),v.style.pointerEvents="none",P.style.pointerEvents="auto",h.style.pointerEvents="auto",()=>{v.style.pointerEvents="",P.style.pointerEvents="",h.style.pointerEvents=""}}},[f,i,l,c,k,I,R,F,b]),r.useEffect(()=>{if(!f)return;function v(j){if(O()||!d.current.floatingContext||!n.select("open"))return;const N=n.context.triggerElements;j.relatedTarget&&N.hasElement(j.relatedTarget)||(A(),x(),O()||w(j))}function P(j){C.clear(),A(),g.current?.(j),x()}function h(j){O()||w(j,!1)}const s=c;return s&&(s.addEventListener("mouseleave",v),s.addEventListener("mouseenter",P),s.addEventListener("mouseleave",h),s.addEventListener("pointerdown",H,!0)),()=>{s&&(s.removeEventListener("mouseleave",v),s.removeEventListener("mouseenter",P),s.removeEventListener("mouseleave",h),s.removeEventListener("pointerdown",H,!0))}})}function Ut(e,t){return t&&!ue(t)?0:typeof e=="function"?e():e}function he(e){return typeof e=="function"?e():e}const Yt={current:null};function Gt(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:i,events:c}=n.context,{enabled:l=!0,delay:d=0,handleClose:f=null,mouseOnly:o=!1,restMs:m=0,move:u=!0,triggerElementRef:a=Yt,externalTree:g,isActiveTrigger:b=!0}=t,E=je(g),{pointerTypeRef:p,interactedInsideRef:C,handlerRef:k,blockMouseMoveRef:R,performedPointerEventsMutationRef:F,unbindMouseMoveRef:O,restTimeoutPendingRef:I,openChangeTimeout:w,restTimeout:x,handleCloseOptionsRef:A}=Qe(n),H=ge(f),v=ge(d),P=ge(m);b&&(A.current=H.current?.__options);const h=X(()=>C.current?!0:i.current.openEvent?["click","mousedown"].includes(i.current.openEvent.type):!1),s=r.useCallback((T,S=!0)=>{const D=me(v.current,"close",p.current);D&&!k.current?w.start(D,()=>n.setOpen(!1,W(z,T))):S&&(w.clear(),n.setOpen(!1,W(z,T)))},[v,k,n,p,w]),j=X(()=>{O.current(),k.current=void 0}),N=X(()=>{if(F.current){const T=ce(n.select("domReferenceElement")).body;T.style.pointerEvents="",T.removeAttribute(ve),F.current=!1}});r.useEffect(()=>{if(!l)return;function T(S){S.open||(w.clear(),x.clear(),R.current=!0,I.current=!1)}return c.on("openchange",T),()=>{c.off("openchange",T)}},[l,c,w,x,R,I]);const $=X(T=>{if(h()||!i.current.floatingContext)return;const S=n.context.triggerElements;if(T.relatedTarget&&S.hasElement(T.relatedTarget))return;const D=a.current;H.current?.({...i.current.floatingContext,tree:E,x:T.clientX,y:T.clientY,onClose(){N(),j(),!h()&&D===n.select("domReferenceElement")&&s(T)}})(T)});return r.useEffect(()=>{if(!l)return;const T=a.current??(b?n.select("domReferenceElement"):null);if(!de(T))return;function S(B){if(w.clear(),R.current=!1,o&&!ue(p.current)||he(P.current)>0&&!me(v.current,"open"))return;const _=me(v.current,"open",p.current),Y=n.select("domReferenceElement"),L=n.context.triggerElements,V=(L.hasElement(B.target)||L.hasMatchingElement(Q=>q(Q,B.target)))&&(!Y||!q(Y,B.target)),M=B.currentTarget??null,U=n.select("open"),J=!U||V;V&&U?n.setOpen(!0,W(z,B,M)):_?w.start(_,()=>{J&&n.setOpen(!0,W(z,B,M))}):J&&n.setOpen(!0,W(z,B,M))}function D(B){if(h()){N();return}O.current();const _=n.select("domReferenceElement"),Y=ce(_);x.clear(),I.current=!1;const L=n.context.triggerElements;if(B.relatedTarget&&L.hasElement(B.relatedTarget))return;if(H.current&&i.current.floatingContext){n.select("open")||w.clear();const M=a.current;k.current=H.current({...i.current.floatingContext,tree:E,x:B.clientX,y:B.clientY,onClose(){N(),j(),!h()&&M===n.select("domReferenceElement")&&s(B,!0)}});const U=k.current;U(B),Y.addEventListener("mousemove",U),O.current=()=>{Y.removeEventListener("mousemove",U)};return}(p.current!=="touch"||!q(n.select("floatingElement"),B.relatedTarget))&&s(B)}function K(B){$(B)}return n.select("open")&&T.addEventListener("mouseleave",K),u&&T.addEventListener("mousemove",S,{once:!0}),T.addEventListener("mouseenter",S),T.addEventListener("mouseleave",D),()=>{T.removeEventListener("mouseleave",K),u&&T.removeEventListener("mousemove",S),T.removeEventListener("mouseenter",S),T.removeEventListener("mouseleave",D)}},[j,N,R,i,v,s,n,l,H,$,b,h,o,u,p,P,x,I,w,a,E,O,k]),r.useMemo(()=>{function T(S){p.current=S.pointerType}return{onPointerDown:T,onPointerEnter:T,onMouseMove(S){const{nativeEvent:D}=S,K=S.currentTarget,B=n.select("domReferenceElement"),_=n.context.triggerElements,Y=n.select("open"),L=(_.hasElement(S.target)||_.hasMatchingElement(M=>q(M,S.target)))&&(!B||!q(B,S.target));if(o&&!ue(p.current)||Y&&!L||he(P.current)===0||!L&&I.current&&S.movementX**2+S.movementY**2<2)return;x.clear();function V(){if(I.current=!1,h())return;const M=n.select("open");!R.current&&(!M||L)&&n.setOpen(!0,W(z,D,K))}p.current==="touch"?le.flushSync(()=>{V()}):L&&Y?V():(I.current=!0,x.start(he(P.current),V))}}},[R,h,o,n,p,P,x,I])}const $t=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Ze(e,t={}){const n="rootStore"in e?e.rootStore:e,i=n.useState("open"),c=n.useState("floatingId"),l=n.useState("domReferenceElement"),d=n.useState("floatingElement"),{enabled:f=!0,role:o="dialog"}=t,m=Fe(),u=l?.id||m,a=r.useMemo(()=>lt(d)?.id||c,[d,c]),g=$t.get(o)??o,E=pe()!=null,p=r.useMemo(()=>g==="tooltip"||o==="label"?ae:{"aria-haspopup":g==="alertdialog"?"dialog":g,"aria-expanded":"false",...g==="listbox"&&{role:"combobox"},...g==="menu"&&E&&{role:"menuitem"},...o==="select"&&{"aria-autocomplete":"none"},...o==="combobox"&&{"aria-autocomplete":"list"}},[g,E,o]),C=r.useMemo(()=>g==="tooltip"||o==="label"?{[`aria-${o==="label"?"labelledby":"describedby"}`]:i?a:void 0}:{...p,"aria-expanded":i?"true":"false","aria-controls":i?a:void 0,...g==="menu"&&{id:u}},[g,a,i,u,o,p]),k=r.useMemo(()=>{const F={id:a,...g&&{role:g}};return g==="tooltip"||o==="label"?F:{...F,...g==="menu"&&{"aria-labelledby":u}}},[g,a,u,o]),R=r.useCallback(({active:F,selected:O})=>{const I={role:"option",...F&&{id:`${a}-fui-option`}};switch(o){case"select":case"combobox":return{...I,"aria-selected":O}}return{}},[a,o]);return r.useMemo(()=>f?{reference:C,floating:k,item:R,trigger:p}:{},[f,C,k,p,R])}function xe(e,t){const[n,i]=e;let c=!1;const l=t.length;for(let d=0,f=l-1;d<l;f=d++){const[o,m]=t[d]||[0,0],[u,a]=t[f]||[0,0];m>=i!=a>=i&&n<=(u-o)*(i-m)/(a-m)+o&&(c=!c)}return c}function Kt(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Vt(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:i=!0}=e,c=new we;let l=!1,d=null,f=null,o=typeof performance<"u"?performance.now():0;function m(a,g){const b=performance.now(),E=b-o;if(d===null||f===null||E===0)return d=a,f=g,o=b,null;const p=a-d,C=g-f,R=Math.sqrt(p*p+C*C)/E;return d=a,f=g,o=b,R}const u=({x:a,y:g,placement:b,elements:E,onClose:p,nodeId:C,tree:k})=>function(F){function O(){c.clear(),p()}if(c.clear(),!E.domReference||!E.floating||b==null||a==null||g==null)return;const{clientX:I,clientY:w}=F,x=[I,w],A=Se(F),H=F.type==="mouseleave",v=q(E.floating,A),P=q(E.domReference,A),h=E.domReference.getBoundingClientRect(),s=E.floating.getBoundingClientRect(),j=b.split("-")[0],N=a>s.right-s.width/2,$=g>s.bottom-s.height/2,T=Kt(x,h),S=s.width>h.width,D=s.height>h.height,K=(S?h:s).left,B=(S?h:s).right,_=(D?h:s).top,Y=(D?h:s).bottom;if(v&&(l=!0,!H))return;if(P&&(l=!1),P&&!H){l=!0;return}if(H&&de(F.relatedTarget)&&q(E.floating,F.relatedTarget)||k&&bt(k.nodesRef.current,C).some(({context:M})=>M?.open))return;if(j==="top"&&g>=h.bottom-1||j==="bottom"&&g<=h.top+1||j==="left"&&a>=h.right-1||j==="right"&&a<=h.left+1)return O();let L=[];switch(j){case"top":L=[[K,h.top+1],[K,s.bottom-1],[B,s.bottom-1],[B,h.top+1]];break;case"bottom":L=[[K,s.top+1],[K,h.bottom-1],[B,h.bottom-1],[B,s.top+1]];break;case"left":L=[[s.right-1,Y],[s.right-1,_],[h.left+1,_],[h.left+1,Y]];break;case"right":L=[[h.right-1,Y],[h.right-1,_],[s.left+1,_],[s.left+1,Y]];break}function V([M,U]){switch(j){case"top":{const J=[S?M+t/2:N?M+t*4:M-t*4,U+t+1],Q=[S?M-t/2:N?M+t*4:M-t*4,U+t+1],te=[[s.left,N||S?s.bottom-t:s.top],[s.right,N?S?s.bottom-t:s.top:s.bottom-t]];return[J,Q,...te]}case"bottom":{const J=[S?M+t/2:N?M+t*4:M-t*4,U-t],Q=[S?M-t/2:N?M+t*4:M-t*4,U-t],te=[[s.left,N||S?s.top+t:s.bottom],[s.right,N?S?s.top+t:s.bottom:s.top+t]];return[J,Q,...te]}case"left":{const J=[M+t+1,D?U+t/2:$?U+t*4:U-t*4],Q=[M+t+1,D?U-t/2:$?U+t*4:U-t*4];return[...[[$||D?s.right-t:s.left,s.top],[$?D?s.right-t:s.left:s.right-t,s.bottom]],J,Q]}case"right":{const J=[M-t,D?U+t/2:$?U+t*4:U-t*4],Q=[M-t,D?U-t/2:$?U+t*4:U-t*4],te=[[$||D?s.left+t:s.right,s.top],[$?D?s.left+t:s.right:s.left+t,s.bottom]];return[J,Q,...te]}default:return[]}}if(!xe([I,w],L)){if(l&&!T)return O();if(!H&&i){const M=m(F.clientX,F.clientY);if(M!==null&&M<.1)return O()}xe([I,w],V([a,g]))?!l&&i&&c.start(40,O):O()}};return u.__options={blockPointerEvents:n},u}const et=r.createContext(void 0);function re(e){const t=r.useContext(et);if(e===!1&&t===void 0)throw new Error(oe(27));return t}const Xt={...se,...fe},fn=r.forwardRef(function(t,n){const{render:i,className:c,forceRender:l=!1,...d}=t,{store:f}=re(),o=f.useState("open"),m=f.useState("nested"),u=f.useState("mounted"),a=f.useState("transitionStatus"),g=r.useMemo(()=>({open:o,transitionStatus:a}),[o,a]);return ee("div",t,{state:g,ref:[f.context.backdropRef,n],stateAttributesMapping:Xt,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},d],enabled:l||!m})});let Wt=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),zt=(function(e){return e[e.open=Z.open]="open",e[e.closed=Z.closed]="closed",e[e.startingStyle=Z.startingStyle]="startingStyle",e[e.endingStyle=Z.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const tt=r.createContext(void 0);function nt(){const e=r.useContext(tt);if(e===void 0)throw new Error(oe(26));return e}const Jt={...se,...fe,nestedDialogOpen(e){return e?{[zt.nestedDialogOpen]:""}:null}},pn=r.forwardRef(function(t,n){const{className:i,finalFocus:c,initialFocus:l,render:d,...f}=t,{store:o}=re(),m=o.useState("descriptionElementId"),u=o.useState("disablePointerDismissal"),a=o.useState("floatingRootContext"),g=o.useState("popupProps"),b=o.useState("modal"),E=o.useState("mounted"),p=o.useState("nested"),C=o.useState("nestedOpenDialogCount"),k=o.useState("open"),R=o.useState("openMethod"),F=o.useState("titleElementId"),O=o.useState("transitionStatus"),I=o.useState("role");nt(),Ce({open:k,ref:o.context.popupRef,onComplete(){k&&o.context.onOpenChangeComplete?.(!0)}});function w(P){return P==="touch"?o.context.popupRef.current:!0}const x=l===void 0?w:l,A=C>0,H=r.useMemo(()=>({open:k,nested:p,transitionStatus:O,nestedDialogOpen:A}),[k,p,O,A]),v=ee("div",t,{state:H,props:[g,{"aria-labelledby":F??void 0,"aria-describedby":m??void 0,role:I,tabIndex:-1,hidden:!E,onKeyDown(P){He.has(P.key)&&P.stopPropagation()},style:{[Wt.nestedDialogs]:C}},f],ref:[n,o.context.popupRef,o.useStateSetter("popupElement")],stateAttributesMapping:Jt});return G.jsx(Ae,{context:a,openInteractionType:R,disabled:!E,closeOnFocusOut:!u,initialFocus:x,returnFocus:c,modal:b!==!1,restoreFocus:"popup",children:v})}),gn=r.forwardRef(function(t,n){const{keepMounted:i=!1,...c}=t,{store:l}=re(),d=l.useState("mounted"),f=l.useState("modal"),o=l.useState("open");return d||i?G.jsx(tt.Provider,{value:i,children:G.jsxs(Le,{ref:n,...c,children:[d&&f===!0&&G.jsx(_e,{ref:l.context.internalBackdropRef,inert:De(!o)}),t.children]})}):null});function qt(e){const{store:t,parentContext:n,actionsRef:i}=e,c=t.useState("open"),l=t.useState("disablePointerDismissal"),d=t.useState("modal"),f=t.useState("popupElement"),{openMethod:o,triggerProps:m,reset:u}=Ue(c);Xe(t);const{forceUnmount:a}=We(c,t,()=>{u()}),g=X(v=>{const P=W(v);return P.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},P}),b=r.useCallback(()=>{t.setOpen(!1,g(Be))},[t,g]);r.useImperativeHandle(i,()=>({unmount:a,close:b}),[a,b]);const E=qe({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[p,C]=r.useState(0),k=p===0,R=Ze(E),F=Ye(E,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:d==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(v){if("button"in v&&v.button!==0||"touches"in v&&v.touches.length!==1)return!1;const P=Se(v);if(k&&!l){const h=P;return d&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===h||t.context.backdropRef.current===h||q(h,f)&&!h?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:k});Ge(c&&d===!0,f);const{getReferenceProps:O,getFloatingProps:I,getTriggerProps:w}=Pe([R,F]);t.useContextCallback("onNestedDialogOpen",v=>{C(v+1)}),t.useContextCallback("onNestedDialogClose",()=>{C(0)}),r.useEffect(()=>(n?.onNestedDialogOpen&&c&&n.onNestedDialogOpen(p),n?.onNestedDialogClose&&!c&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&c&&n.onNestedDialogClose()}),[c,n,p]);const x=r.useMemo(()=>O(m),[O,m]),A=r.useMemo(()=>w(m),[w,m]),H=r.useMemo(()=>I(),[I]);t.useSyncedValues({openMethod:o,activeTriggerProps:x,inactiveTriggerProps:A,popupProps:H,floatingRootContext:E,nestedOpenDialogCount:p})}const Qt={...Je,modal:y(e=>e.modal),nested:y(e=>e.nested),nestedOpenDialogCount:y(e=>e.nestedOpenDialogCount),disablePointerDismissal:y(e=>e.disablePointerDismissal),openMethod:y(e=>e.openMethod),descriptionElementId:y(e=>e.descriptionElementId),titleElementId:y(e=>e.titleElementId),viewportElement:y(e=>e.viewportElement),role:y(e=>e.role)};class Zt extends $e{constructor(t){super(en(t),{popupRef:r.createRef(),backdropRef:r.createRef(),internalBackdropRef:r.createRef(),triggerElements:new be,onOpenChange:void 0,onOpenChangeComplete:void 0},Qt)}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 i={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",i);const c={open:t},l=n.trigger?.id??null;(l||t)&&(c.activeTriggerId=l,c.activeTriggerElement=n.trigger??null),this.update(c)}}function en(e={}){return{...ze(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function mn(e){const{children:t,open:n,defaultOpen:i=!1,onOpenChange:c,onOpenChangeComplete:l,disablePointerDismissal:d=!1,modal:f=!0,actionsRef:o,handle:m,triggerId:u,defaultTriggerId:a=null}=e,g=re(!0),b=!!g,E=Te(()=>m?.store??new Zt({open:n??i,activeTriggerId:u!==void 0?u:a,modal:f,disablePointerDismissal:d,nested:b})).current;E.useControlledProp("open",n,i),E.useControlledProp("activeTriggerId",u,a),E.useSyncedValues({disablePointerDismissal:d,nested:b,modal:f}),E.useContextCallback("onOpenChange",c),E.useContextCallback("onOpenChangeComplete",l);const p=E.useState("payload");qt({store:E,actionsRef:o,parentContext:g?.store.context});const C=r.useMemo(()=>({store:E}),[E]);return G.jsx(et.Provider,{value:C,children:typeof t=="function"?t({payload:p}):t})}let Me=(function(e){return e[e.open=Z.open]="open",e[e.closed=Z.closed]="closed",e[e.startingStyle=Z.startingStyle]="startingStyle",e[e.endingStyle=Z.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const tn={...se,...fe,nested(e){return e?{[Me.nested]:""}:null},nestedDialogOpen(e){return e?{[Me.nestedDialogOpen]:""}:null}},hn=r.forwardRef(function(t,n){const{className:i,render:c,children:l,...d}=t,f=nt(),{store:o}=re(),m=o.useState("open"),u=o.useState("nested"),a=o.useState("transitionStatus"),g=o.useState("nestedOpenDialogCount"),b=o.useState("mounted"),E=g>0,p=r.useMemo(()=>({open:m,nested:u,transitionStatus:a,nestedDialogOpen:E}),[m,u,a,E]);return ee("div",t,{enabled:f||b,state:p,ref:[n,o.useStateSetter("viewportElement")],stateAttributesMapping:tn,props:[{role:"presentation",hidden:!b,children:l},d]})}),En=r.forwardRef(function(t,n){const{render:i,className:c,id:l,...d}=t,{store:f}=re(),o=Ke(l);return f.useSyncedValueWithCleanup("titleElementId",o),ee("h2",t,{ref:n,props:[{id:o},d]})}),ot=r.createContext(void 0);function ie(e){const t=r.useContext(ot);if(t===void 0&&!e)throw new Error(oe(47));return t}function nn(){return{...ze(),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 on={...Je,disabled:y(e=>e.disabled),instantType:y(e=>e.instantType),openMethod:y(e=>e.openMethod),openChangeReason:y(e=>e.openChangeReason),modal:y(e=>e.modal),stickIfOpen:y(e=>e.stickIfOpen),titleElementId:y(e=>e.titleElementId),descriptionElementId:y(e=>e.descriptionElementId),openOnHover:y(e=>e.openOnHover),closeDelay:y(e=>e.closeDelay),hasViewport:y(e=>e.hasViewport)};class Oe extends $e{constructor(t){const n={...nn(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:r.createRef(),backdropRef:r.createRef(),internalBackdropRef:r.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:r.createRef(),beforeContentFocusGuardRef:r.createRef(),stickIfOpenTimeout:new we,triggerElements:new be},on)}setOpen=(t,n)=>{const i=n.reason===z,c=n.reason===Ee&&n.event.detail===0,l=!t&&(n.reason===ut||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const d={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested,triggerElement:n.trigger};this.state.floatingRootContext.context.events?.emit("openchange",d);const o=()=>{const m={open:t,openChangeReason:n.reason},u=n.trigger?.id??null;(u||t)&&(m.activeTriggerId=u,m.activeTriggerElement=n.trigger??null),this.update(m)};i?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(dt,()=>{this.set("stickIfOpen",!1)}),le.flushSync(o)):o(),c||l?this.set("instantType",c?"click":"dismiss"):n.reason===Re?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const i=Te(()=>new Oe(n)).current,c=t??i;return ft(i.disposeEffect),c}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:t,open:n,defaultOpen:i=!1,onOpenChange:c,onOpenChangeComplete:l,modal:d=!1,handle:f,triggerId:o,defaultTriggerId:m=null}=e,u=Oe.useStore(f?.store,{open:n??i,modal:d,activeTriggerId:o!==void 0?o:m});u.useControlledProp("open",n,i),u.useControlledProp("activeTriggerId",o,m);const a=u.useState("open"),g=u.useState("positionerElement"),b=u.useState("payload"),E=u.useState("openChangeReason");u.useContextCallback("onOpenChange",c),u.useContextCallback("onOpenChangeComplete",l);const{openMethod:p,triggerProps:C,reset:k}=Ue(a);Xe(u);const{forceUnmount:R}=We(a,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null}),k()});Ge(a&&d===!0&&E!==z&&p!=="touch",g),r.useEffect(()=>{a||u.context.stickIfOpenTimeout.clear()},[u,a]);const F=r.useCallback(N=>{const $=W(N);return $.preventUnmountOnClose=()=>{u.set("preventUnmountingOnClose",!0)},$},[u]),O=r.useCallback(()=>{u.setOpen(!1,F(Be))},[u,F]);r.useImperativeHandle(e.actionsRef,()=>({unmount:R,close:O}),[R,O]);const I=qe({popupStore:u,onOpenChange:u.setOpen}),w=Ye(I,{outsidePressEvent:{mouse:d==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),x=Ze(I),{getReferenceProps:A,getFloatingProps:H,getTriggerProps:v}=Pe([w,x]),P=r.useMemo(()=>A(C),[A,C]),h=r.useMemo(()=>v(C),[v,C]),s=r.useMemo(()=>H(),[H]);u.useSyncedValues({modal:d,openMethod:p,activeTriggerProps:P,inactiveTriggerProps:h,popupProps:s,floatingRootContext:I,nested:pe()!=null});const j=r.useMemo(()=>({store:u}),[u]);return G.jsx(ot.Provider,{value:j,children:typeof t=="function"?t({payload:b}):t})}function Rn(e){return ie(!0)?G.jsx(ke,{props:e}):G.jsx(Pt,{children:G.jsx(ke,{props:e})})}const rn=300,vn=r.forwardRef(function(t,n){const{render:i,className:c,disabled:l=!1,nativeButton:d=!0,handle:f,payload:o,openOnHover:m=!1,delay:u=rn,closeDelay:a=0,id:g,...b}=t,E=ie(!0),p=f?.store??E?.store;if(!p)throw new Error(oe(74));const C=Ke(g),k=p.useState("isTriggerActive",C),R=p.useState("floatingRootContext"),F=p.useState("isOpenedByTrigger",C),O=r.useRef(null),{registerTrigger:I,isMountedByThisTrigger:w}=Bt(C,O,p,{payload:o,disabled:l,openOnHover:m,closeDelay:a}),x=p.useState("openChangeReason"),A=p.useState("stickIfOpen"),H=p.useState("openMethod"),v=Gt(R,{enabled:R!=null&&m&&(H!=="touch"||x!==Ee),mouseOnly:!0,move:!1,handleClose:Vt(),restMs:u,delay:{close:a},triggerElementRef:O,isActiveTrigger:k}),P=Ot(R,{enabled:R!=null,stickIfOpen:A}),h=Pe([P]),s=p.useState("triggerProps",w),j=r.useMemo(()=>({disabled:l,open:F}),[l,F]),{getButtonProps:N,buttonRef:$}=pt({disabled:l,native:d}),T=r.useMemo(()=>({open(_){return _&&x===Ee?yt.open(_):It.open(_)}}),[x]),S=ee("button",t,{state:j,ref:[$,n,I,O],props:[h.getReferenceProps(),v,s,{[gt]:"",id:C},b,N],stateAttributesMapping:T}),D=r.useRef(null),K=X(_=>{le.flushSync(()=>{p.setOpen(!1,W(Re,_.nativeEvent,_.currentTarget))}),mt(D.current)?.focus()}),B=X(_=>{const Y=p.select("positionerElement");if(Y&&ht(_,Y))p.context.beforeContentFocusGuardRef.current?.focus();else{le.flushSync(()=>{p.setOpen(!1,W(Re,_.nativeEvent,_.currentTarget))});let L=Et(p.context.triggerFocusTargetRef.current||O.current);for(;L!==null&&q(Y,L);){const V=L;if(L=Rt(L),L===V)break}L?.focus()}});return k?G.jsxs(r.Fragment,{children:[G.jsx(Ie,{ref:D,onFocus:K}),G.jsx(r.Fragment,{children:S},C),G.jsx(Ie,{ref:p.context.triggerFocusTargetRef,onFocus:B})]}):G.jsx(r.Fragment,{children:S},C)}),rt=r.createContext(void 0);function sn(){const e=r.useContext(rt);if(e===void 0)throw new Error(oe(45));return e}const Cn=r.forwardRef(function(t,n){const{keepMounted:i=!1,...c}=t,{store:l}=ie();return l.useState("mounted")||i?G.jsx(rt.Provider,{value:i,children:G.jsx(Le,{ref:n,...c,renderGuards:!1})}):null}),st=r.createContext(void 0);function an(){const e=r.useContext(st);if(!e)throw new Error(oe(46));return e}const Tn=r.forwardRef(function(t,n){const{render:i,className:c,anchor:l,positionMethod:d="absolute",side:f="bottom",align:o="center",sideOffset:m=0,alignOffset:u=0,collisionBoundary:a="clipping-ancestors",collisionPadding:g=5,arrowPadding:b=5,sticky:E=!1,disableAnchorTracking:p=!1,collisionAvoidance:C=vt,...k}=t,{store:R}=ie(),F=sn(),O=xt(),I=R.useState("floatingRootContext"),w=R.useState("mounted"),x=R.useState("open"),A=R.useState("openChangeReason"),H=R.useState("activeTriggerElement"),v=R.useState("modal"),P=R.useState("positionerElement"),h=R.useState("instantType"),s=R.useState("transitionStatus"),j=R.useState("hasViewport"),N=r.useRef(null),$=Ct(P,!1,!1),T=Mt({anchor:l,floatingRootContext:I,positionMethod:d,mounted:w,side:f,sideOffset:m,align:o,alignOffset:u,arrowPadding:b,collisionBoundary:a,collisionPadding:g,sticky:E,disableAnchorTracking:p,keepMounted:F,nodeId:O,collisionAvoidance:C,adaptiveOrigin:j?Ft:void 0}),S=r.useMemo(()=>{const L={};return x||(L.pointerEvents="none"),{role:"presentation",hidden:!w,style:{...T.positionerStyles,...L}}},[x,w,T.positionerStyles]),D=r.useMemo(()=>({props:S,...T}),[S,T]),K=I?.select("domReferenceElement");ne(()=>{const L=K,V=N.current;if(L&&(N.current=L),V&&L&&L!==V){R.set("instantType",void 0);const M=new AbortController;return $(()=>{R.set("instantType","trigger-change")},M.signal),()=>{M.abort()}}},[K,$,R]);const B=r.useMemo(()=>({open:x,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:h}),[x,D.side,D.align,D.anchorHidden,h]),_=r.useCallback(L=>{R.set("positionerElement",L)},[R]),Y=ee("div",t,{state:B,props:[D.props,Ve(s),k],ref:[n,_],stateAttributesMapping:se});return G.jsxs(st.Provider,{value:D,children:[w&&v===!0&&A!==z&&G.jsx(_e,{ref:R.context.internalBackdropRef,inert:De(!x),cutout:H}),G.jsx(kt,{id:O,children:Y})]})}),cn={...se,...fe},Sn=r.forwardRef(function(t,n){const{className:i,render:c,initialFocus:l,finalFocus:d,...f}=t,{store:o}=ie(),m=an(),u=wt()!=null,a=o.useState("open"),g=o.useState("openMethod"),b=o.useState("instantType"),E=o.useState("transitionStatus"),p=o.useState("popupProps"),C=o.useState("titleElementId"),k=o.useState("descriptionElementId"),R=o.useState("modal"),F=o.useState("mounted"),O=o.useState("openChangeReason"),I=o.useState("activeTriggerElement"),w=o.useState("floatingRootContext");Ce({open:a,ref:o.context.popupRef,onComplete(){a&&o.context.onOpenChangeComplete?.(!0)}});const x=o.useState("disabled"),A=o.useState("openOnHover"),H=o.useState("closeDelay");_t(w,{enabled:A&&!x,closeDelay:H});function v(N){return N==="touch"?o.context.popupRef.current:!0}const P=l===void 0?v:l,h=r.useMemo(()=>({open:a,side:m.side,align:m.align,instant:b,transitionStatus:E}),[a,m.side,m.align,b,E]),s=r.useCallback(N=>{o.set("popupElement",N)},[o]),j=ee("div",t,{state:h,ref:[n,o.context.popupRef,s],props:[p,{"aria-labelledby":C,"aria-describedby":k,onKeyDown(N){u&&He.has(N.key)&&N.stopPropagation()}},Ve(E),f],stateAttributesMapping:cn});return G.jsx(Ae,{context:w,openInteractionType:g,modal:R==="trap-focus",disabled:!F||O===z,initialFocus:P,returnFocus:d,restoreFocus:"popup",previousFocusableElement:Tt(I)?I:void 0,nextFocusableElement:o.context.triggerFocusTargetRef,beforeContentFocusGuardRef:o.context.beforeContentFocusGuardRef,children:j})});export{mn as D,dn as L,Rn as P,gn as a,fn as b,hn as c,pn as d,En as e,vn as f,Cn as g,Tn as h,Sn as i,re as u};
|
|
1
|
+
import{c as it,Y as X,$ as ne,a7 as Ce,r,a3 as ae,ar as Fe,as as Te,at as de,au as ye,av as at,aw as ct,k as W,ax as z,ay as ce,az as Se,aA as q,s as le,aB as lt,aC as we,_ as oe,h as ee,a8 as fe,j as G,aD as Le,aE as De,aF as Be,aG as Ee,aH as ut,aI as dt,aJ as Re,aK as ft,g as pt,aL as gt,aM as Ie,aN as mt,aO as ht,aP as Et,aQ as Rt,aR as vt,aS as Ct,aT as Tt}from"./main-BBQHiOju.js";import{z as ue,y as St,F as Ne,P as be,A as y,B as pe,D as je,E as ge,G as bt,H as se,J as Z,K as He,M as Ae,N as _e,O as Ue,Q as Ye,R as Ge,T as Pe,U as $e,n as Ke,V as Pt,W as Ot,X as yt,t as It,Y as xt,Z as Mt,_ as Ve,$ as kt,a0 as Ft,a1 as wt}from"./useCurrency-DGkZG989.js";const Lt=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],dn=it("loader-circle",Lt);function me(e,t,n){if(n&&!ue(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const i=e();return typeof i=="number"?i:i?.[t]}return e?.[t]}function Dt(e,t){const n=r.useRef(null),i=r.useRef(null);return r.useCallback(c=>{if(e!==void 0){if(n.current!==null){const l=n.current,d=i.current,f=t.context.triggerElements.getById(l);d&&f===d&&t.context.triggerElements.delete(l),n.current=null,i.current=null}c!==null&&(n.current=e,i.current=c,t.context.triggerElements.add(e,c))}},[t,e])}function Bt(e,t,n,i){const c=n.useState("isMountedByTrigger",e),l=Dt(e,n),d=X(f=>{if(l(f),!f||!n.select("open"))return;const o=n.select("activeTriggerId");if(o===e){n.update({activeTriggerElement:f,...i});return}o==null&&n.update({activeTriggerId:e,activeTriggerElement:f,...i})});return ne(()=>{c&&n.update({activeTriggerElement:t.current,...i})},[c,n,t,...Object.values(i)]),{registerTrigger:d,isMountedByThisTrigger:c}}function Xe(e){const t=e.useState("open");ne(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[i,c]=n.value;e.update({activeTriggerId:i,activeTriggerElement:c})}}},[t,e])}function We(e,t,n){const{mounted:i,setMounted:c,transitionStatus:l}=St(e);t.useSyncedValues({mounted:i,transitionStatus:l});const d=X(()=>{c(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),f=t.useState("preventUnmountingOnClose");return Ce({enabled:!f,open:e,ref:t.context.popupRef,onComplete(){e||d()}}),{forceUnmount:d,transitionStatus:l}}function Nt(){return new Ne({open:!1,floatingElement:null,referenceElement:null,triggerElements:new be,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function ze(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:Nt(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:ae,inactiveTriggerProps:ae,popupProps:ae}}const Je={open:y(e=>e.open),mounted:y(e=>e.mounted),transitionStatus:y(e=>e.transitionStatus),floatingRootContext:y(e=>e.floatingRootContext),preventUnmountingOnClose:y(e=>e.preventUnmountingOnClose),payload:y(e=>e.payload),activeTriggerId:y(e=>e.activeTriggerId),activeTriggerElement:y(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:y((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:y((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:y((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:y((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:y(e=>e.popupProps),popupElement:y(e=>e.popupElement),positionerElement:y(e=>e.positionerElement)};function qe(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:i=!1,onOpenChange:c}=e,l=Fe(),d=pe()!=null,f=t.useState("open"),o=t.useState("activeTriggerElement"),m=t.useState(i?"popupElement":"positionerElement"),u=t.context.triggerElements,a=Te(()=>new Ne({open:f,referenceElement:o,floatingElement:m,triggerElements:u,onOpenChange:c,floatingId:l,nested:d,noEmit:n})).current;return ne(()=>{const g={open:f,floatingId:l,referenceElement:o,floatingElement:m};de(o)&&(g.domReferenceElement=o),a.state.positionReference===a.state.referenceElement&&(g.positionReference=o),a.update(g)},[f,l,o,m,a]),a.context.onOpenChange=c,a.context.nested=d,a.context.noEmit=n,a}const ve=at("safe-polygon"),jt=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${ct}`;function Ht(e){return e?!!e.closest(jt):!1}function Qe(e){const t=r.useRef(void 0),n=r.useRef(!1),i=r.useRef(void 0),c=r.useRef(!0),l=r.useRef(!1),d=r.useRef(()=>{}),f=r.useRef(!1),o=ye(),m=ye(),u=r.useRef(void 0);return r.useMemo(()=>{const a=e.context.dataRef.current;return a.hoverInteractionState||(a.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:i,blockMouseMoveRef:c,performedPointerEventsMutationRef:l,unbindMouseMoveRef:d,restTimeoutPendingRef:f,openChangeTimeout:o,restTimeout:m,handleCloseOptionsRef:u}),a.hoverInteractionState},[e,t,n,i,c,l,d,f,o,m,u])}const At=new Set(["click","mousedown"]);function _t(e,t={}){const n="rootStore"in e?e.rootStore:e,i=n.useState("open"),c=n.useState("floatingElement"),l=n.useState("domReferenceElement"),{dataRef:d}=n.context,{enabled:f=!0,closeDelay:o=0,externalTree:m}=t,{pointerTypeRef:u,interactedInsideRef:a,handlerRef:g,performedPointerEventsMutationRef:b,unbindMouseMoveRef:E,restTimeoutPendingRef:p,openChangeTimeout:C,handleCloseOptionsRef:k}=Qe(n),R=je(m),F=pe(),O=X(()=>a.current?!0:d.current.openEvent?At.has(d.current.openEvent.type):!1),I=X(()=>{const v=d.current.openEvent?.type;return v?.includes("mouse")&&v!=="mousedown"}),w=r.useCallback((v,P=!0)=>{const h=Ut(o,u.current);h&&!g.current?C.start(h,()=>n.setOpen(!1,W(z,v))):P&&(C.clear(),n.setOpen(!1,W(z,v)))},[o,g,n,u,C]),x=X(()=>{E.current(),g.current=void 0}),A=X(()=>{if(b.current){const v=ce(c).body;v.style.pointerEvents="",v.removeAttribute(ve),b.current=!1}}),H=X(v=>{const P=Se(v);if(!Ht(P)){a.current=!1;return}a.current=!0});ne(()=>{i||(u.current=void 0,p.current=!1,a.current=!1,x(),A())},[i,u,p,a,x,A]),r.useEffect(()=>()=>{x()},[x]),r.useEffect(()=>A,[A]),ne(()=>{if(f&&i&&k.current?.blockPointerEvents&&I()&&de(l)&&c){b.current=!0;const v=ce(c).body;v.setAttribute(ve,"");const P=l,h=c,s=R?.nodesRef.current.find(j=>j.id===F)?.context?.elements.floating;return s&&(s.style.pointerEvents=""),v.style.pointerEvents="none",P.style.pointerEvents="auto",h.style.pointerEvents="auto",()=>{v.style.pointerEvents="",P.style.pointerEvents="",h.style.pointerEvents=""}}},[f,i,l,c,k,I,R,F,b]),r.useEffect(()=>{if(!f)return;function v(j){if(O()||!d.current.floatingContext||!n.select("open"))return;const N=n.context.triggerElements;j.relatedTarget&&N.hasElement(j.relatedTarget)||(A(),x(),O()||w(j))}function P(j){C.clear(),A(),g.current?.(j),x()}function h(j){O()||w(j,!1)}const s=c;return s&&(s.addEventListener("mouseleave",v),s.addEventListener("mouseenter",P),s.addEventListener("mouseleave",h),s.addEventListener("pointerdown",H,!0)),()=>{s&&(s.removeEventListener("mouseleave",v),s.removeEventListener("mouseenter",P),s.removeEventListener("mouseleave",h),s.removeEventListener("pointerdown",H,!0))}})}function Ut(e,t){return t&&!ue(t)?0:typeof e=="function"?e():e}function he(e){return typeof e=="function"?e():e}const Yt={current:null};function Gt(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:i,events:c}=n.context,{enabled:l=!0,delay:d=0,handleClose:f=null,mouseOnly:o=!1,restMs:m=0,move:u=!0,triggerElementRef:a=Yt,externalTree:g,isActiveTrigger:b=!0}=t,E=je(g),{pointerTypeRef:p,interactedInsideRef:C,handlerRef:k,blockMouseMoveRef:R,performedPointerEventsMutationRef:F,unbindMouseMoveRef:O,restTimeoutPendingRef:I,openChangeTimeout:w,restTimeout:x,handleCloseOptionsRef:A}=Qe(n),H=ge(f),v=ge(d),P=ge(m);b&&(A.current=H.current?.__options);const h=X(()=>C.current?!0:i.current.openEvent?["click","mousedown"].includes(i.current.openEvent.type):!1),s=r.useCallback((T,S=!0)=>{const D=me(v.current,"close",p.current);D&&!k.current?w.start(D,()=>n.setOpen(!1,W(z,T))):S&&(w.clear(),n.setOpen(!1,W(z,T)))},[v,k,n,p,w]),j=X(()=>{O.current(),k.current=void 0}),N=X(()=>{if(F.current){const T=ce(n.select("domReferenceElement")).body;T.style.pointerEvents="",T.removeAttribute(ve),F.current=!1}});r.useEffect(()=>{if(!l)return;function T(S){S.open||(w.clear(),x.clear(),R.current=!0,I.current=!1)}return c.on("openchange",T),()=>{c.off("openchange",T)}},[l,c,w,x,R,I]);const $=X(T=>{if(h()||!i.current.floatingContext)return;const S=n.context.triggerElements;if(T.relatedTarget&&S.hasElement(T.relatedTarget))return;const D=a.current;H.current?.({...i.current.floatingContext,tree:E,x:T.clientX,y:T.clientY,onClose(){N(),j(),!h()&&D===n.select("domReferenceElement")&&s(T)}})(T)});return r.useEffect(()=>{if(!l)return;const T=a.current??(b?n.select("domReferenceElement"):null);if(!de(T))return;function S(B){if(w.clear(),R.current=!1,o&&!ue(p.current)||he(P.current)>0&&!me(v.current,"open"))return;const _=me(v.current,"open",p.current),Y=n.select("domReferenceElement"),L=n.context.triggerElements,V=(L.hasElement(B.target)||L.hasMatchingElement(Q=>q(Q,B.target)))&&(!Y||!q(Y,B.target)),M=B.currentTarget??null,U=n.select("open"),J=!U||V;V&&U?n.setOpen(!0,W(z,B,M)):_?w.start(_,()=>{J&&n.setOpen(!0,W(z,B,M))}):J&&n.setOpen(!0,W(z,B,M))}function D(B){if(h()){N();return}O.current();const _=n.select("domReferenceElement"),Y=ce(_);x.clear(),I.current=!1;const L=n.context.triggerElements;if(B.relatedTarget&&L.hasElement(B.relatedTarget))return;if(H.current&&i.current.floatingContext){n.select("open")||w.clear();const M=a.current;k.current=H.current({...i.current.floatingContext,tree:E,x:B.clientX,y:B.clientY,onClose(){N(),j(),!h()&&M===n.select("domReferenceElement")&&s(B,!0)}});const U=k.current;U(B),Y.addEventListener("mousemove",U),O.current=()=>{Y.removeEventListener("mousemove",U)};return}(p.current!=="touch"||!q(n.select("floatingElement"),B.relatedTarget))&&s(B)}function K(B){$(B)}return n.select("open")&&T.addEventListener("mouseleave",K),u&&T.addEventListener("mousemove",S,{once:!0}),T.addEventListener("mouseenter",S),T.addEventListener("mouseleave",D),()=>{T.removeEventListener("mouseleave",K),u&&T.removeEventListener("mousemove",S),T.removeEventListener("mouseenter",S),T.removeEventListener("mouseleave",D)}},[j,N,R,i,v,s,n,l,H,$,b,h,o,u,p,P,x,I,w,a,E,O,k]),r.useMemo(()=>{function T(S){p.current=S.pointerType}return{onPointerDown:T,onPointerEnter:T,onMouseMove(S){const{nativeEvent:D}=S,K=S.currentTarget,B=n.select("domReferenceElement"),_=n.context.triggerElements,Y=n.select("open"),L=(_.hasElement(S.target)||_.hasMatchingElement(M=>q(M,S.target)))&&(!B||!q(B,S.target));if(o&&!ue(p.current)||Y&&!L||he(P.current)===0||!L&&I.current&&S.movementX**2+S.movementY**2<2)return;x.clear();function V(){if(I.current=!1,h())return;const M=n.select("open");!R.current&&(!M||L)&&n.setOpen(!0,W(z,D,K))}p.current==="touch"?le.flushSync(()=>{V()}):L&&Y?V():(I.current=!0,x.start(he(P.current),V))}}},[R,h,o,n,p,P,x,I])}const $t=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Ze(e,t={}){const n="rootStore"in e?e.rootStore:e,i=n.useState("open"),c=n.useState("floatingId"),l=n.useState("domReferenceElement"),d=n.useState("floatingElement"),{enabled:f=!0,role:o="dialog"}=t,m=Fe(),u=l?.id||m,a=r.useMemo(()=>lt(d)?.id||c,[d,c]),g=$t.get(o)??o,E=pe()!=null,p=r.useMemo(()=>g==="tooltip"||o==="label"?ae:{"aria-haspopup":g==="alertdialog"?"dialog":g,"aria-expanded":"false",...g==="listbox"&&{role:"combobox"},...g==="menu"&&E&&{role:"menuitem"},...o==="select"&&{"aria-autocomplete":"none"},...o==="combobox"&&{"aria-autocomplete":"list"}},[g,E,o]),C=r.useMemo(()=>g==="tooltip"||o==="label"?{[`aria-${o==="label"?"labelledby":"describedby"}`]:i?a:void 0}:{...p,"aria-expanded":i?"true":"false","aria-controls":i?a:void 0,...g==="menu"&&{id:u}},[g,a,i,u,o,p]),k=r.useMemo(()=>{const F={id:a,...g&&{role:g}};return g==="tooltip"||o==="label"?F:{...F,...g==="menu"&&{"aria-labelledby":u}}},[g,a,u,o]),R=r.useCallback(({active:F,selected:O})=>{const I={role:"option",...F&&{id:`${a}-fui-option`}};switch(o){case"select":case"combobox":return{...I,"aria-selected":O}}return{}},[a,o]);return r.useMemo(()=>f?{reference:C,floating:k,item:R,trigger:p}:{},[f,C,k,p,R])}function xe(e,t){const[n,i]=e;let c=!1;const l=t.length;for(let d=0,f=l-1;d<l;f=d++){const[o,m]=t[d]||[0,0],[u,a]=t[f]||[0,0];m>=i!=a>=i&&n<=(u-o)*(i-m)/(a-m)+o&&(c=!c)}return c}function Kt(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Vt(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:i=!0}=e,c=new we;let l=!1,d=null,f=null,o=typeof performance<"u"?performance.now():0;function m(a,g){const b=performance.now(),E=b-o;if(d===null||f===null||E===0)return d=a,f=g,o=b,null;const p=a-d,C=g-f,R=Math.sqrt(p*p+C*C)/E;return d=a,f=g,o=b,R}const u=({x:a,y:g,placement:b,elements:E,onClose:p,nodeId:C,tree:k})=>function(F){function O(){c.clear(),p()}if(c.clear(),!E.domReference||!E.floating||b==null||a==null||g==null)return;const{clientX:I,clientY:w}=F,x=[I,w],A=Se(F),H=F.type==="mouseleave",v=q(E.floating,A),P=q(E.domReference,A),h=E.domReference.getBoundingClientRect(),s=E.floating.getBoundingClientRect(),j=b.split("-")[0],N=a>s.right-s.width/2,$=g>s.bottom-s.height/2,T=Kt(x,h),S=s.width>h.width,D=s.height>h.height,K=(S?h:s).left,B=(S?h:s).right,_=(D?h:s).top,Y=(D?h:s).bottom;if(v&&(l=!0,!H))return;if(P&&(l=!1),P&&!H){l=!0;return}if(H&&de(F.relatedTarget)&&q(E.floating,F.relatedTarget)||k&&bt(k.nodesRef.current,C).some(({context:M})=>M?.open))return;if(j==="top"&&g>=h.bottom-1||j==="bottom"&&g<=h.top+1||j==="left"&&a>=h.right-1||j==="right"&&a<=h.left+1)return O();let L=[];switch(j){case"top":L=[[K,h.top+1],[K,s.bottom-1],[B,s.bottom-1],[B,h.top+1]];break;case"bottom":L=[[K,s.top+1],[K,h.bottom-1],[B,h.bottom-1],[B,s.top+1]];break;case"left":L=[[s.right-1,Y],[s.right-1,_],[h.left+1,_],[h.left+1,Y]];break;case"right":L=[[h.right-1,Y],[h.right-1,_],[s.left+1,_],[s.left+1,Y]];break}function V([M,U]){switch(j){case"top":{const J=[S?M+t/2:N?M+t*4:M-t*4,U+t+1],Q=[S?M-t/2:N?M+t*4:M-t*4,U+t+1],te=[[s.left,N||S?s.bottom-t:s.top],[s.right,N?S?s.bottom-t:s.top:s.bottom-t]];return[J,Q,...te]}case"bottom":{const J=[S?M+t/2:N?M+t*4:M-t*4,U-t],Q=[S?M-t/2:N?M+t*4:M-t*4,U-t],te=[[s.left,N||S?s.top+t:s.bottom],[s.right,N?S?s.top+t:s.bottom:s.top+t]];return[J,Q,...te]}case"left":{const J=[M+t+1,D?U+t/2:$?U+t*4:U-t*4],Q=[M+t+1,D?U-t/2:$?U+t*4:U-t*4];return[...[[$||D?s.right-t:s.left,s.top],[$?D?s.right-t:s.left:s.right-t,s.bottom]],J,Q]}case"right":{const J=[M-t,D?U+t/2:$?U+t*4:U-t*4],Q=[M-t,D?U-t/2:$?U+t*4:U-t*4],te=[[$||D?s.left+t:s.right,s.top],[$?D?s.left+t:s.right:s.left+t,s.bottom]];return[J,Q,...te]}default:return[]}}if(!xe([I,w],L)){if(l&&!T)return O();if(!H&&i){const M=m(F.clientX,F.clientY);if(M!==null&&M<.1)return O()}xe([I,w],V([a,g]))?!l&&i&&c.start(40,O):O()}};return u.__options={blockPointerEvents:n},u}const et=r.createContext(void 0);function re(e){const t=r.useContext(et);if(e===!1&&t===void 0)throw new Error(oe(27));return t}const Xt={...se,...fe},fn=r.forwardRef(function(t,n){const{render:i,className:c,forceRender:l=!1,...d}=t,{store:f}=re(),o=f.useState("open"),m=f.useState("nested"),u=f.useState("mounted"),a=f.useState("transitionStatus"),g=r.useMemo(()=>({open:o,transitionStatus:a}),[o,a]);return ee("div",t,{state:g,ref:[f.context.backdropRef,n],stateAttributesMapping:Xt,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},d],enabled:l||!m})});let Wt=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),zt=(function(e){return e[e.open=Z.open]="open",e[e.closed=Z.closed]="closed",e[e.startingStyle=Z.startingStyle]="startingStyle",e[e.endingStyle=Z.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const tt=r.createContext(void 0);function nt(){const e=r.useContext(tt);if(e===void 0)throw new Error(oe(26));return e}const Jt={...se,...fe,nestedDialogOpen(e){return e?{[zt.nestedDialogOpen]:""}:null}},pn=r.forwardRef(function(t,n){const{className:i,finalFocus:c,initialFocus:l,render:d,...f}=t,{store:o}=re(),m=o.useState("descriptionElementId"),u=o.useState("disablePointerDismissal"),a=o.useState("floatingRootContext"),g=o.useState("popupProps"),b=o.useState("modal"),E=o.useState("mounted"),p=o.useState("nested"),C=o.useState("nestedOpenDialogCount"),k=o.useState("open"),R=o.useState("openMethod"),F=o.useState("titleElementId"),O=o.useState("transitionStatus"),I=o.useState("role");nt(),Ce({open:k,ref:o.context.popupRef,onComplete(){k&&o.context.onOpenChangeComplete?.(!0)}});function w(P){return P==="touch"?o.context.popupRef.current:!0}const x=l===void 0?w:l,A=C>0,H=r.useMemo(()=>({open:k,nested:p,transitionStatus:O,nestedDialogOpen:A}),[k,p,O,A]),v=ee("div",t,{state:H,props:[g,{"aria-labelledby":F??void 0,"aria-describedby":m??void 0,role:I,tabIndex:-1,hidden:!E,onKeyDown(P){He.has(P.key)&&P.stopPropagation()},style:{[Wt.nestedDialogs]:C}},f],ref:[n,o.context.popupRef,o.useStateSetter("popupElement")],stateAttributesMapping:Jt});return G.jsx(Ae,{context:a,openInteractionType:R,disabled:!E,closeOnFocusOut:!u,initialFocus:x,returnFocus:c,modal:b!==!1,restoreFocus:"popup",children:v})}),gn=r.forwardRef(function(t,n){const{keepMounted:i=!1,...c}=t,{store:l}=re(),d=l.useState("mounted"),f=l.useState("modal"),o=l.useState("open");return d||i?G.jsx(tt.Provider,{value:i,children:G.jsxs(Le,{ref:n,...c,children:[d&&f===!0&&G.jsx(_e,{ref:l.context.internalBackdropRef,inert:De(!o)}),t.children]})}):null});function qt(e){const{store:t,parentContext:n,actionsRef:i}=e,c=t.useState("open"),l=t.useState("disablePointerDismissal"),d=t.useState("modal"),f=t.useState("popupElement"),{openMethod:o,triggerProps:m,reset:u}=Ue(c);Xe(t);const{forceUnmount:a}=We(c,t,()=>{u()}),g=X(v=>{const P=W(v);return P.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},P}),b=r.useCallback(()=>{t.setOpen(!1,g(Be))},[t,g]);r.useImperativeHandle(i,()=>({unmount:a,close:b}),[a,b]);const E=qe({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[p,C]=r.useState(0),k=p===0,R=Ze(E),F=Ye(E,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:d==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(v){if("button"in v&&v.button!==0||"touches"in v&&v.touches.length!==1)return!1;const P=Se(v);if(k&&!l){const h=P;return d&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===h||t.context.backdropRef.current===h||q(h,f)&&!h?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:k});Ge(c&&d===!0,f);const{getReferenceProps:O,getFloatingProps:I,getTriggerProps:w}=Pe([R,F]);t.useContextCallback("onNestedDialogOpen",v=>{C(v+1)}),t.useContextCallback("onNestedDialogClose",()=>{C(0)}),r.useEffect(()=>(n?.onNestedDialogOpen&&c&&n.onNestedDialogOpen(p),n?.onNestedDialogClose&&!c&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&c&&n.onNestedDialogClose()}),[c,n,p]);const x=r.useMemo(()=>O(m),[O,m]),A=r.useMemo(()=>w(m),[w,m]),H=r.useMemo(()=>I(),[I]);t.useSyncedValues({openMethod:o,activeTriggerProps:x,inactiveTriggerProps:A,popupProps:H,floatingRootContext:E,nestedOpenDialogCount:p})}const Qt={...Je,modal:y(e=>e.modal),nested:y(e=>e.nested),nestedOpenDialogCount:y(e=>e.nestedOpenDialogCount),disablePointerDismissal:y(e=>e.disablePointerDismissal),openMethod:y(e=>e.openMethod),descriptionElementId:y(e=>e.descriptionElementId),titleElementId:y(e=>e.titleElementId),viewportElement:y(e=>e.viewportElement),role:y(e=>e.role)};class Zt extends $e{constructor(t){super(en(t),{popupRef:r.createRef(),backdropRef:r.createRef(),internalBackdropRef:r.createRef(),triggerElements:new be,onOpenChange:void 0,onOpenChangeComplete:void 0},Qt)}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 i={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",i);const c={open:t},l=n.trigger?.id??null;(l||t)&&(c.activeTriggerId=l,c.activeTriggerElement=n.trigger??null),this.update(c)}}function en(e={}){return{...ze(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function mn(e){const{children:t,open:n,defaultOpen:i=!1,onOpenChange:c,onOpenChangeComplete:l,disablePointerDismissal:d=!1,modal:f=!0,actionsRef:o,handle:m,triggerId:u,defaultTriggerId:a=null}=e,g=re(!0),b=!!g,E=Te(()=>m?.store??new Zt({open:n??i,activeTriggerId:u!==void 0?u:a,modal:f,disablePointerDismissal:d,nested:b})).current;E.useControlledProp("open",n,i),E.useControlledProp("activeTriggerId",u,a),E.useSyncedValues({disablePointerDismissal:d,nested:b,modal:f}),E.useContextCallback("onOpenChange",c),E.useContextCallback("onOpenChangeComplete",l);const p=E.useState("payload");qt({store:E,actionsRef:o,parentContext:g?.store.context});const C=r.useMemo(()=>({store:E}),[E]);return G.jsx(et.Provider,{value:C,children:typeof t=="function"?t({payload:p}):t})}let Me=(function(e){return e[e.open=Z.open]="open",e[e.closed=Z.closed]="closed",e[e.startingStyle=Z.startingStyle]="startingStyle",e[e.endingStyle=Z.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const tn={...se,...fe,nested(e){return e?{[Me.nested]:""}:null},nestedDialogOpen(e){return e?{[Me.nestedDialogOpen]:""}:null}},hn=r.forwardRef(function(t,n){const{className:i,render:c,children:l,...d}=t,f=nt(),{store:o}=re(),m=o.useState("open"),u=o.useState("nested"),a=o.useState("transitionStatus"),g=o.useState("nestedOpenDialogCount"),b=o.useState("mounted"),E=g>0,p=r.useMemo(()=>({open:m,nested:u,transitionStatus:a,nestedDialogOpen:E}),[m,u,a,E]);return ee("div",t,{enabled:f||b,state:p,ref:[n,o.useStateSetter("viewportElement")],stateAttributesMapping:tn,props:[{role:"presentation",hidden:!b,children:l},d]})}),En=r.forwardRef(function(t,n){const{render:i,className:c,id:l,...d}=t,{store:f}=re(),o=Ke(l);return f.useSyncedValueWithCleanup("titleElementId",o),ee("h2",t,{ref:n,props:[{id:o},d]})}),ot=r.createContext(void 0);function ie(e){const t=r.useContext(ot);if(t===void 0&&!e)throw new Error(oe(47));return t}function nn(){return{...ze(),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 on={...Je,disabled:y(e=>e.disabled),instantType:y(e=>e.instantType),openMethod:y(e=>e.openMethod),openChangeReason:y(e=>e.openChangeReason),modal:y(e=>e.modal),stickIfOpen:y(e=>e.stickIfOpen),titleElementId:y(e=>e.titleElementId),descriptionElementId:y(e=>e.descriptionElementId),openOnHover:y(e=>e.openOnHover),closeDelay:y(e=>e.closeDelay),hasViewport:y(e=>e.hasViewport)};class Oe extends $e{constructor(t){const n={...nn(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:r.createRef(),backdropRef:r.createRef(),internalBackdropRef:r.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:r.createRef(),beforeContentFocusGuardRef:r.createRef(),stickIfOpenTimeout:new we,triggerElements:new be},on)}setOpen=(t,n)=>{const i=n.reason===z,c=n.reason===Ee&&n.event.detail===0,l=!t&&(n.reason===ut||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const d={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested,triggerElement:n.trigger};this.state.floatingRootContext.context.events?.emit("openchange",d);const o=()=>{const m={open:t,openChangeReason:n.reason},u=n.trigger?.id??null;(u||t)&&(m.activeTriggerId=u,m.activeTriggerElement=n.trigger??null),this.update(m)};i?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(dt,()=>{this.set("stickIfOpen",!1)}),le.flushSync(o)):o(),c||l?this.set("instantType",c?"click":"dismiss"):n.reason===Re?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const i=Te(()=>new Oe(n)).current,c=t??i;return ft(i.disposeEffect),c}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:t,open:n,defaultOpen:i=!1,onOpenChange:c,onOpenChangeComplete:l,modal:d=!1,handle:f,triggerId:o,defaultTriggerId:m=null}=e,u=Oe.useStore(f?.store,{open:n??i,modal:d,activeTriggerId:o!==void 0?o:m});u.useControlledProp("open",n,i),u.useControlledProp("activeTriggerId",o,m);const a=u.useState("open"),g=u.useState("positionerElement"),b=u.useState("payload"),E=u.useState("openChangeReason");u.useContextCallback("onOpenChange",c),u.useContextCallback("onOpenChangeComplete",l);const{openMethod:p,triggerProps:C,reset:k}=Ue(a);Xe(u);const{forceUnmount:R}=We(a,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null}),k()});Ge(a&&d===!0&&E!==z&&p!=="touch",g),r.useEffect(()=>{a||u.context.stickIfOpenTimeout.clear()},[u,a]);const F=r.useCallback(N=>{const $=W(N);return $.preventUnmountOnClose=()=>{u.set("preventUnmountingOnClose",!0)},$},[u]),O=r.useCallback(()=>{u.setOpen(!1,F(Be))},[u,F]);r.useImperativeHandle(e.actionsRef,()=>({unmount:R,close:O}),[R,O]);const I=qe({popupStore:u,onOpenChange:u.setOpen}),w=Ye(I,{outsidePressEvent:{mouse:d==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),x=Ze(I),{getReferenceProps:A,getFloatingProps:H,getTriggerProps:v}=Pe([w,x]),P=r.useMemo(()=>A(C),[A,C]),h=r.useMemo(()=>v(C),[v,C]),s=r.useMemo(()=>H(),[H]);u.useSyncedValues({modal:d,openMethod:p,activeTriggerProps:P,inactiveTriggerProps:h,popupProps:s,floatingRootContext:I,nested:pe()!=null});const j=r.useMemo(()=>({store:u}),[u]);return G.jsx(ot.Provider,{value:j,children:typeof t=="function"?t({payload:b}):t})}function Rn(e){return ie(!0)?G.jsx(ke,{props:e}):G.jsx(Pt,{children:G.jsx(ke,{props:e})})}const rn=300,vn=r.forwardRef(function(t,n){const{render:i,className:c,disabled:l=!1,nativeButton:d=!0,handle:f,payload:o,openOnHover:m=!1,delay:u=rn,closeDelay:a=0,id:g,...b}=t,E=ie(!0),p=f?.store??E?.store;if(!p)throw new Error(oe(74));const C=Ke(g),k=p.useState("isTriggerActive",C),R=p.useState("floatingRootContext"),F=p.useState("isOpenedByTrigger",C),O=r.useRef(null),{registerTrigger:I,isMountedByThisTrigger:w}=Bt(C,O,p,{payload:o,disabled:l,openOnHover:m,closeDelay:a}),x=p.useState("openChangeReason"),A=p.useState("stickIfOpen"),H=p.useState("openMethod"),v=Gt(R,{enabled:R!=null&&m&&(H!=="touch"||x!==Ee),mouseOnly:!0,move:!1,handleClose:Vt(),restMs:u,delay:{close:a},triggerElementRef:O,isActiveTrigger:k}),P=Ot(R,{enabled:R!=null,stickIfOpen:A}),h=Pe([P]),s=p.useState("triggerProps",w),j=r.useMemo(()=>({disabled:l,open:F}),[l,F]),{getButtonProps:N,buttonRef:$}=pt({disabled:l,native:d}),T=r.useMemo(()=>({open(_){return _&&x===Ee?yt.open(_):It.open(_)}}),[x]),S=ee("button",t,{state:j,ref:[$,n,I,O],props:[h.getReferenceProps(),v,s,{[gt]:"",id:C},b,N],stateAttributesMapping:T}),D=r.useRef(null),K=X(_=>{le.flushSync(()=>{p.setOpen(!1,W(Re,_.nativeEvent,_.currentTarget))}),mt(D.current)?.focus()}),B=X(_=>{const Y=p.select("positionerElement");if(Y&&ht(_,Y))p.context.beforeContentFocusGuardRef.current?.focus();else{le.flushSync(()=>{p.setOpen(!1,W(Re,_.nativeEvent,_.currentTarget))});let L=Et(p.context.triggerFocusTargetRef.current||O.current);for(;L!==null&&q(Y,L);){const V=L;if(L=Rt(L),L===V)break}L?.focus()}});return k?G.jsxs(r.Fragment,{children:[G.jsx(Ie,{ref:D,onFocus:K}),G.jsx(r.Fragment,{children:S},C),G.jsx(Ie,{ref:p.context.triggerFocusTargetRef,onFocus:B})]}):G.jsx(r.Fragment,{children:S},C)}),rt=r.createContext(void 0);function sn(){const e=r.useContext(rt);if(e===void 0)throw new Error(oe(45));return e}const Cn=r.forwardRef(function(t,n){const{keepMounted:i=!1,...c}=t,{store:l}=ie();return l.useState("mounted")||i?G.jsx(rt.Provider,{value:i,children:G.jsx(Le,{ref:n,...c,renderGuards:!1})}):null}),st=r.createContext(void 0);function an(){const e=r.useContext(st);if(!e)throw new Error(oe(46));return e}const Tn=r.forwardRef(function(t,n){const{render:i,className:c,anchor:l,positionMethod:d="absolute",side:f="bottom",align:o="center",sideOffset:m=0,alignOffset:u=0,collisionBoundary:a="clipping-ancestors",collisionPadding:g=5,arrowPadding:b=5,sticky:E=!1,disableAnchorTracking:p=!1,collisionAvoidance:C=vt,...k}=t,{store:R}=ie(),F=sn(),O=xt(),I=R.useState("floatingRootContext"),w=R.useState("mounted"),x=R.useState("open"),A=R.useState("openChangeReason"),H=R.useState("activeTriggerElement"),v=R.useState("modal"),P=R.useState("positionerElement"),h=R.useState("instantType"),s=R.useState("transitionStatus"),j=R.useState("hasViewport"),N=r.useRef(null),$=Ct(P,!1,!1),T=Mt({anchor:l,floatingRootContext:I,positionMethod:d,mounted:w,side:f,sideOffset:m,align:o,alignOffset:u,arrowPadding:b,collisionBoundary:a,collisionPadding:g,sticky:E,disableAnchorTracking:p,keepMounted:F,nodeId:O,collisionAvoidance:C,adaptiveOrigin:j?Ft:void 0}),S=r.useMemo(()=>{const L={};return x||(L.pointerEvents="none"),{role:"presentation",hidden:!w,style:{...T.positionerStyles,...L}}},[x,w,T.positionerStyles]),D=r.useMemo(()=>({props:S,...T}),[S,T]),K=I?.select("domReferenceElement");ne(()=>{const L=K,V=N.current;if(L&&(N.current=L),V&&L&&L!==V){R.set("instantType",void 0);const M=new AbortController;return $(()=>{R.set("instantType","trigger-change")},M.signal),()=>{M.abort()}}},[K,$,R]);const B=r.useMemo(()=>({open:x,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:h}),[x,D.side,D.align,D.anchorHidden,h]),_=r.useCallback(L=>{R.set("positionerElement",L)},[R]),Y=ee("div",t,{state:B,props:[D.props,Ve(s),k],ref:[n,_],stateAttributesMapping:se});return G.jsxs(st.Provider,{value:D,children:[w&&v===!0&&A!==z&&G.jsx(_e,{ref:R.context.internalBackdropRef,inert:De(!x),cutout:H}),G.jsx(kt,{id:O,children:Y})]})}),cn={...se,...fe},Sn=r.forwardRef(function(t,n){const{className:i,render:c,initialFocus:l,finalFocus:d,...f}=t,{store:o}=ie(),m=an(),u=wt()!=null,a=o.useState("open"),g=o.useState("openMethod"),b=o.useState("instantType"),E=o.useState("transitionStatus"),p=o.useState("popupProps"),C=o.useState("titleElementId"),k=o.useState("descriptionElementId"),R=o.useState("modal"),F=o.useState("mounted"),O=o.useState("openChangeReason"),I=o.useState("activeTriggerElement"),w=o.useState("floatingRootContext");Ce({open:a,ref:o.context.popupRef,onComplete(){a&&o.context.onOpenChangeComplete?.(!0)}});const x=o.useState("disabled"),A=o.useState("openOnHover"),H=o.useState("closeDelay");_t(w,{enabled:A&&!x,closeDelay:H});function v(N){return N==="touch"?o.context.popupRef.current:!0}const P=l===void 0?v:l,h=r.useMemo(()=>({open:a,side:m.side,align:m.align,instant:b,transitionStatus:E}),[a,m.side,m.align,b,E]),s=r.useCallback(N=>{o.set("popupElement",N)},[o]),j=ee("div",t,{state:h,ref:[n,o.context.popupRef,s],props:[p,{"aria-labelledby":C,"aria-describedby":k,onKeyDown(N){u&&He.has(N.key)&&N.stopPropagation()}},Ve(E),f],stateAttributesMapping:cn});return G.jsx(Ae,{context:w,openInteractionType:g,modal:R==="trap-focus",disabled:!F||O===z,initialFocus:P,returnFocus:d,restoreFocus:"popup",previousFocusableElement:Tt(I)?I:void 0,nextFocusableElement:o.context.triggerFocusTargetRef,beforeContentFocusGuardRef:o.context.beforeContentFocusGuardRef,children:j})});export{mn as D,dn as L,Rn as P,gn as a,fn as b,hn as c,pn as d,En as e,vn as f,Cn as g,Tn as h,Sn as i,re as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as S,Y as v,h as w,j as e,x as y}from"./main-
|
|
1
|
+
import{r as S,Y as v,h as w,j as e,x as y}from"./main-BBQHiOju.js";import{a as k,b as j,c as l,s as i,L as N,d as C,S as E,e as I,f as R,C as T,g as L,h as A,i as P,j as _,k as D,l as G,m as M}from"./useCurrency-DGkZG989.js";const O=S.forwardRef(function(s,o){const{className:n,render:p,...t}=s,{store:r,scrollHandlerRef:c}=k(),{alignItemWithTriggerActive:d}=j(),g=l(r,i.hasScrollArrows),h=l(r,i.openMethod),u=l(r,i.multiple),m={id:`${l(r,i.id)}-list`,role:"listbox","aria-multiselectable":u||void 0,onScroll(b){c.current?.(b.currentTarget)},...d&&{style:N},className:g&&h!=="touch"?C.className:void 0},x=v(b=>{r.set("listElement",b)});return w("div",s,{ref:[o,x],props:[m,t]})}),V="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function B({value:f,onValueChange:s,options:o=[],ariaLabel:n,id:p,disabled:t=!1,leadingIcon:r=null,className:c="",popupClassName:d="",align:g="start",matchTriggerWidth:h=!1}){const u=o.map(a=>({value:a.value,label:a.label}));return e.jsxs(E,{value:f,items:u,disabled:t,onValueChange:a=>{!t&&a!=null&&s?.(a)},children:[e.jsxs(I,{id:p,"aria-label":n,className:y(V,t&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",c),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r,e.jsx(R,{className:"truncate"})]}),e.jsx(T,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(A,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(P,{className:y("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",h&&"min-w-[var(--anchor-width)]",d),children:e.jsx(O,{role:"listbox","aria-label":n,children:o.map(a=>e.jsxs(_,{value:a.value,disabled:a.disabled,className:({selected:m,disabled:x})=>y("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",m?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",x&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(D,{children:e.jsx(G,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(M,{children:a.label})})]},String(a.value)))})})})})]})}export{B as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as k,r as c,b as E,f as O,H as y,j as e,o as M,x,p as r,q as R,z as A,I as T,K as G,N as P,O as U,C as $,Q as F,T as V,Z as H,U as W,V as z,W as K}from"./main-
|
|
1
|
+
import{c as k,r as c,b as E,f as O,H as y,j as e,o as M,x,p as r,q as R,z as A,I as T,K as G,N as P,O as U,C as $,Q as F,T as V,Z as H,U as W,V as z,W as K}from"./main-BBQHiOju.js";import{a as Y,b,u as Z,L as v}from"./use-limits-display-prefs-CYoiCfEE.js";import{u as q,I as J}from"./useCurrency-DGkZG989.js";import{S as N}from"./Select-7_WyWhaS.js";import{C as Q}from"./Card-BZkG7ExP.js";const B=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],X=k("grip-vertical",B);const ee=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],ae=k("languages",ee),te=a=>!a.isLayoutDirty&&a.willUpdate(!1);function j(){const a=new Set,t=new WeakMap,n=()=>a.forEach(te);return{add:s=>{a.add(s),t.set(s,s.addEventListener("willUpdate",n))},remove:s=>{a.delete(s);const l=t.get(s);l&&(l(),t.delete(s)),n()},dirty:n}}const se=c.createContext(null);function ne(){const a=c.useRef(!1);return E(()=>(a.current=!0,()=>{a.current=!1}),[]),a}function re(){const a=ne(),[t,n]=c.useState(0),s=c.useCallback(()=>{a.current&&n(t+1)},[t]);return[c.useCallback(()=>O.postRender(s),[s]),t]}const C=a=>a===!0,ie=a=>C(a===!0)||a==="id",le=({children:a,id:t,inherit:n=!0})=>{const s=c.useContext(y),l=c.useContext(se),[o,u]=re(),g=c.useRef(null),d=s.id||l;g.current===null&&(ie(n)&&d&&(t=t?d+"-"+t:d),g.current={id:t,group:C(n)&&s.group||j()});const m=c.useMemo(()=>({...g.current,forceRender:o}),[u]);return e.jsx(y.Provider,{value:m,children:a})},oe=new Set(["cursor","kiro","copilot","kimi"]);function ce({checked:a,onChange:t,ariaLabel:n}){return e.jsx("button",{type:"button",role:"switch","aria-checked":a,"aria-label":n,onClick:t,className:x("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",a?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:e.jsx("span",{className:x("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",a?"translate-x-[18px]":"translate-x-[3px]")})})}function ue({prefs:a}){const{order:t,visibility:n,toggle:s,moveToward:l}=a,[o,u]=c.useState(null),[g,d]=c.useState(null),m=i=>p=>{u(i),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",i)},D=i=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",o&&o!==i&&g!==i&&(d(i),l(o,i))},S=()=>{u(null),d(null)},I=i=>{i.preventDefault(),u(null),d(null)};return e.jsx(le,{children:e.jsx("div",{className:"flex flex-col",children:t.map(i=>{const p=n[i]!==!1,f=o===i;return e.jsxs(M.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:m(i),onDragOver:D(i),onDragEnd:S,onDrop:I,className:x("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",f&&"opacity-40"),style:{cursor:f?"grabbing":"grab"},children:[e.jsx(X,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("img",{src:Y[i],alt:"",width:18,height:18,className:x("h-[18px] w-[18px] shrink-0 pointer-events-none",oe.has(i)&&"dark:invert"),draggable:!1}),e.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:b[i]}),e.jsx("div",{onMouseDown:_=>_.stopPropagation(),draggable:!1,children:e.jsx(ce,{checked:p,onChange:()=>s(i),ariaLabel:`${r("limits.settings.toggle_visible")}: ${b[i]}`})})]},i)})})})}function h({label:a,hint:t,control:n}){return e.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:a}),t?e.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),e.jsx("div",{className:"shrink-0",children:n})]})}function w({title:a,subtitle:t,action:n,children:s}){return e.jsxs(Q,{children:[e.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:a}),t?e.jsx("p",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),n?e.jsx("div",{className:"shrink-0",children:n}):null]}),e.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:s})]})}function L({options:a,value:t,onChange:n}){return e.jsx("div",{className:"inline-flex items-center rounded-lg border border-oai-gray-200 bg-oai-gray-50 p-0.5 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:a.map(({value:s,label:l,Icon:o})=>{const u=t===s;return e.jsxs("button",{type:"button",onClick:()=>n(s),"aria-pressed":u,className:x("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors",u?"bg-white text-oai-black shadow-sm dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[o?e.jsx(o,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,e.jsx("span",{children:l})]},s)})})}function de(){return[{value:"light",label:r("settings.appearance.theme.light"),Icon:T},{value:"dark",label:r("settings.appearance.theme.dark"),Icon:G},{value:"system",label:r("settings.appearance.theme.system"),Icon:P}]}function ge(){return[{value:F,label:r("settings.appearance.language.system")},{value:V,label:r("settings.appearance.language.english")},{value:H,label:r("settings.appearance.language.chinese")},{value:W,label:r("settings.appearance.language.traditional_chinese")},{value:z,label:r("settings.appearance.language.japanese")},{value:K,label:r("settings.appearance.language.korean")}]}function pe(a){if(!a)return null;try{const t=new Date(a);return Number.isNaN(t.getTime())?null:t.toLocaleString()}catch{return null}}function xe(a,t){const n=r(`settings.appearance.currency.rate_source.${a}`),s=pe(t),l=s?r("settings.appearance.currency.rate_updated",{when:s}):r("settings.appearance.currency.rate_never");return`${n} · ${l}`}function me({locale:a,setLocale:t}){const n=ge();return e.jsx(N,{value:a,onValueChange:t,options:n,ariaLabel:r("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:e.jsx(ae,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function he({currency:a,setCurrency:t}){const n=U().map(s=>({value:s.code,label:r(s.labelKey)}));return e.jsx(N,{value:a,onValueChange:t,options:n,ariaLabel:r("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function fe({currency:a,rate:t,rateSource:n,rateFetchedAt:s}){if(a===$)return e.jsx(e.Fragment,{children:r("settings.appearance.currency.hint")});const l=xe(n,s);return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:`1 USD = ${t.toFixed(4)} ${a}`}),e.jsx("span",{role:"img","aria-label":l,title:l,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:e.jsx(J,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function ye(){const{theme:a,setTheme:t}=R(),{locale:n,setLocale:s}=A(),{currency:l,rate:o,rateSource:u,rateFetchedAt:g,setCurrency:d}=q();return e.jsxs(w,{title:r("settings.section.appearance"),children:[e.jsx(h,{label:r("settings.appearance.theme.label"),hint:r("settings.appearance.theme.hint"),control:e.jsx(L,{options:de(),value:a,onChange:t})}),e.jsx(h,{label:r("settings.appearance.language.label"),hint:r("settings.appearance.language.hint"),control:e.jsx(me,{locale:n,setLocale:s})}),e.jsx(h,{label:r("settings.appearance.currency.label"),hint:e.jsx(fe,{currency:l,rate:o,rateSource:u,rateFetchedAt:g}),control:e.jsx(he,{currency:l,setCurrency:d})})]})}function be({prefs:a}){return e.jsx(L,{options:[{value:v.USED,label:r("limits.settings.display_mode_used")},{value:v.REMAINING,label:r("limits.settings.display_mode_remaining")}],value:a.displayMode,onChange:a.setDisplayMode})}function we(){const a=Z();return e.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:r("settings.page.title")}),e.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:r("settings.page.subtitle")})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(ye,{}),e.jsx(w,{title:r("settings.section.limits"),action:e.jsx(be,{prefs:a}),children:e.jsx(ue,{prefs:a})})]})]})})})}export{we as SettingsPage};
|