@hasna/invoices 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,146 +1,16 @@
1
- # @hasna/invoices
1
+ # open-invoices
2
2
 
3
3
  Invoice generation and management for AI agents.
4
4
 
5
- `@hasna/invoices` ships four surfaces in one repo:
6
- - CLI (`invoices`)
7
- - MCP server (`invoices-mcp`)
8
- - REST API server (`invoices-serve`)
9
- - Web dashboard (`dashboard/`)
10
- - Typed Web/Node SDK (`sdk/` as `@hasna/invoices-sdk`)
5
+ ## Binaries
11
6
 
12
- ## Features
13
-
14
- - Local SQLite storage with WAL mode + migrations
15
- - PostgreSQL migration support via `@hasna/cloud`
16
- - Cloud sync push/pull between local SQLite and PostgreSQL
17
- - Feedback delivery with remote send + local fallback persistence
18
- - Invoice + line item CRUD with computed totals
19
- - FTS5 search over invoice number, parties, and notes
20
- - Agent registry (`register_agent`, `heartbeat`, `set_focus`, `list_agents`)
21
- - MCP tools for invoice workflows
22
- - Shadcn-based dashboard structure aligned with open-todos
23
-
24
- ## Install
25
-
26
- ```bash
27
- bun add @hasna/invoices
28
- ```
29
-
30
- ## CLI
31
-
32
- ```bash
33
- # initialize local SQLite schema
34
- invoices db:migrate
35
-
36
- # initialize PostgreSQL schema translated from local migrations
37
- invoices db:migrate:pg
38
-
39
- # cloud sync (all tables by default)
40
- invoices cloud:push
41
- invoices cloud:pull
42
-
43
- # optional subset
44
- invoices cloud:push --tables parties,invoices,invoice_lines
45
-
46
- # feedback
47
- invoices feedback:send --message "SDK auth flow failed on staging"
48
-
49
- # create parties
50
- invoices party:create --kind issuer --name "Hasna SRL"
51
- invoices party:create --kind customer --name "ACME GmbH"
52
-
53
- # create invoice
54
- invoices invoice:create \
55
- --number INV-1001 \
56
- --issuer-id <ISSUER_ID> \
57
- --customer-id <CUSTOMER_ID> \
58
- --currency EUR \
59
- --line "Implementation:10:5000:1900"
60
-
61
- # list/search/update
62
- invoices invoice:list
63
- invoices invoice:search "INV-1001"
64
- invoices invoice:status <INVOICE_ID> sent
65
-
66
- # agent lifecycle
67
- invoices agent:register --name octavian
68
- invoices agent:list
69
- ```
70
-
71
- ## REST API
72
-
73
- Run server:
74
-
75
- ```bash
76
- invoices-serve
77
- ```
78
-
79
- Key endpoints:
80
-
81
- - `GET /health`
82
- - `POST /api/migrate`
83
- - `POST /api/migrate/pg`
84
- - `POST /api/cloud/push`
85
- - `POST /api/cloud/pull`
86
- - `POST /api/feedback`
87
- - `GET|POST /api/parties`
88
- - `GET|POST /api/invoices`
89
- - `GET /api/invoices/search?q=...`
90
- - `POST /api/invoices/:id/status`
91
- - `GET /api/stats`
92
- - `GET|POST /api/agents`
93
- - `POST /api/agents/:id/heartbeat`
94
- - `POST /api/agents/:id/focus`
95
-
96
- ## MCP
97
-
98
- Run MCP stdio server:
99
-
100
- ```bash
101
- invoices-mcp
102
- ```
103
-
104
- Core tools:
105
-
106
- - `migrate_database`, `migrate_postgres`
107
- - `cloud_push`, `cloud_pull`, `send_feedback`
108
- - `create_party`, `list_parties`
109
- - `create_invoice`, `get_invoice`, `list_invoices`, `search_invoices`, `update_invoice_status`, `delete_invoice`
110
- - `register_agent`, `heartbeat`, `set_focus`, `list_agents`
111
-
112
- ## Dashboard
113
-
114
- ```bash
115
- cd dashboard
116
- bun install
117
- bun run dev
118
- ```
119
-
120
- Set API base if needed:
121
-
122
- ```bash
123
- export VITE_API_BASE_URL=http://localhost:3487
124
- ```
125
-
126
- ## Security
127
-
128
- - Optional API auth via `INVOICES_API_KEY`
129
- - Optional CORS allowlist via `INVOICES_ALLOWED_ORIGIN`
130
- - Security reports are stored under `reports/`
7
+ - `invoices` - CLI
8
+ - `invoices-mcp` - MCP server entrypoint
9
+ - `invoices-serve` - REST API server entrypoint
131
10
 
132
11
  ## Development
133
12
 
134
13
  ```bash
135
14
  bun install
136
- cd dashboard && bun install && cd ..
137
- cd sdk && bun install && cd ..
138
-
139
- bun run typecheck
140
15
  bun run build
141
- bun test
142
16
  ```
143
-
144
- ## License
145
-
146
- Apache-2.0
@@ -136,4 +136,4 @@ Error generating stack: `+l.message+`
136
136
  `)},qh=function(){var a=parseInt(document.body.getAttribute(Ma)||"0",10);return isFinite(a)?a:0},$x=function(){y.useEffect(function(){return document.body.setAttribute(Ma,(qh()+1).toString()),function(){var a=qh()-1;a<=0?document.body.removeAttribute(Ma):document.body.setAttribute(Ma,a.toString())}},[])},Wx=function(a){var u=a.noRelative,c=a.noImportant,r=a.gapMode,s=r===void 0?"margin":r;$x();var d=y.useMemo(function(){return Jx(s)},[s]);return y.createElement(Fx,{styles:Ix(d,!u,s,c?"":"!important")})},Rs=!1;if(typeof window<"u")try{var fo=Object.defineProperty({},"passive",{get:function(){return Rs=!0,!0}});window.addEventListener("test",fo,fo),window.removeEventListener("test",fo,fo)}catch{Rs=!1}var Ea=Rs?{passive:!1}:!1,Px=function(a){return a.tagName==="TEXTAREA"},Gg=function(a,u){if(!(a instanceof Element))return!1;var c=window.getComputedStyle(a);return c[u]!=="hidden"&&!(c.overflowY===c.overflowX&&!Px(a)&&c[u]==="visible")},e1=function(a){return Gg(a,"overflowY")},t1=function(a){return Gg(a,"overflowX")},kh=function(a,u){var c=u.ownerDocument,r=u;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Yg(a,r);if(s){var d=qg(a,r),m=d[1],v=d[2];if(m>v)return!0}r=r.parentNode}while(r&&r!==c.body);return!1},n1=function(a){var u=a.scrollTop,c=a.scrollHeight,r=a.clientHeight;return[u,c,r]},l1=function(a){var u=a.scrollLeft,c=a.scrollWidth,r=a.clientWidth;return[u,c,r]},Yg=function(a,u){return a==="v"?e1(u):t1(u)},qg=function(a,u){return a==="v"?n1(u):l1(u)},a1=function(a,u){return a==="h"&&u==="rtl"?-1:1},i1=function(a,u,c,r,s){var d=a1(a,window.getComputedStyle(u).direction),m=d*r,v=c.target,h=u.contains(v),p=!1,b=m>0,x=0,w=0;do{if(!v)break;var C=qg(a,v),R=C[0],M=C[1],N=C[2],U=M-N-d*R;(R||U)&&Yg(a,v)&&(x+=U,w+=R);var Q=v.parentNode;v=Q&&Q.nodeType===Node.DOCUMENT_FRAGMENT_NODE?Q.host:Q}while(!h&&v!==document.body||h&&(u.contains(v)||u===v));return(b&&Math.abs(x)<1||!b&&Math.abs(w)<1)&&(p=!0),p},mo=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,a.changedTouches[0].clientY]:[0,0]},Vh=function(a){return[a.deltaX,a.deltaY]},Xh=function(a){return a&&"current"in a?a.current:a},u1=function(a,u){return a[0]===u[0]&&a[1]===u[1]},o1=function(a){return`
137
137
  .block-interactivity-`.concat(a,` {pointer-events: none;}
138
138
  .allow-interactivity-`).concat(a,` {pointer-events: all;}
139
- `)},r1=0,wa=[];function c1(a){var u=y.useRef([]),c=y.useRef([0,0]),r=y.useRef(),s=y.useState(r1++)[0],d=y.useState(Bg)[0],m=y.useRef(a);y.useEffect(function(){m.current=a},[a]),y.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(s));var M=Nx([a.lockRef.current],(a.shards||[]).map(Xh),!0).filter(Boolean);return M.forEach(function(N){return N.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),M.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(s))})}}},[a.inert,a.lockRef.current,a.shards]);var v=y.useCallback(function(M,N){if("touches"in M&&M.touches.length===2||M.type==="wheel"&&M.ctrlKey)return!m.current.allowPinchZoom;var U=mo(M),Q=c.current,L="deltaX"in M?M.deltaX:Q[0]-U[0],B="deltaY"in M?M.deltaY:Q[1]-U[1],K,J=M.target,k=Math.abs(L)>Math.abs(B)?"h":"v";if("touches"in M&&k==="h"&&J.type==="range")return!1;var V=window.getSelection(),P=V&&V.anchorNode,se=P?P===J||P.contains(J):!1;if(se)return!1;var ve=kh(k,J);if(!ve)return!0;if(ve?K=k:(K=k==="v"?"h":"v",ve=kh(k,J)),!ve)return!1;if(!r.current&&"changedTouches"in M&&(L||B)&&(r.current=K),!K)return!0;var de=r.current||K;return i1(de,N,M,de==="h"?L:B)},[]),h=y.useCallback(function(M){var N=M;if(!(!wa.length||wa[wa.length-1]!==d)){var U="deltaY"in N?Vh(N):mo(N),Q=u.current.filter(function(K){return K.name===N.type&&(K.target===N.target||N.target===K.shadowParent)&&u1(K.delta,U)})[0];if(Q&&Q.should){N.cancelable&&N.preventDefault();return}if(!Q){var L=(m.current.shards||[]).map(Xh).filter(Boolean).filter(function(K){return K.contains(N.target)}),B=L.length>0?v(N,L[0]):!m.current.noIsolation;B&&N.cancelable&&N.preventDefault()}}},[]),p=y.useCallback(function(M,N,U,Q){var L={name:M,delta:N,target:U,should:Q,shadowParent:s1(U)};u.current.push(L),setTimeout(function(){u.current=u.current.filter(function(B){return B!==L})},1)},[]),b=y.useCallback(function(M){c.current=mo(M),r.current=void 0},[]),x=y.useCallback(function(M){p(M.type,Vh(M),M.target,v(M,a.lockRef.current))},[]),w=y.useCallback(function(M){p(M.type,mo(M),M.target,v(M,a.lockRef.current))},[]);y.useEffect(function(){return wa.push(d),a.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:w}),document.addEventListener("wheel",h,Ea),document.addEventListener("touchmove",h,Ea),document.addEventListener("touchstart",b,Ea),function(){wa=wa.filter(function(M){return M!==d}),document.removeEventListener("wheel",h,Ea),document.removeEventListener("touchmove",h,Ea),document.removeEventListener("touchstart",b,Ea)}},[]);var C=a.removeScrollBar,R=a.inert;return y.createElement(y.Fragment,null,R?y.createElement(d,{styles:o1(s)}):null,C?y.createElement(Wx,{noRelative:a.noRelative,gapMode:a.gapMode}):null)}function s1(a){for(var u=null;a!==null;)a instanceof ShadowRoot&&(u=a.host,a=a.host),a=a.parentNode;return u}const f1=Gx(Hg,c1);var kg=y.forwardRef(function(a,u){return y.createElement(Uo,an({},a,{ref:u,sideCar:f1}))});kg.classNames=Uo.classNames;var d1=function(a){if(typeof document>"u")return null;var u=Array.isArray(a)?a[0]:a;return u.ownerDocument.body},Aa=new WeakMap,vo=new WeakMap,ho={},Ss=0,Vg=function(a){return a&&(a.host||Vg(a.parentNode))},m1=function(a,u){return u.map(function(c){if(a.contains(c))return c;var r=Vg(c);return r&&a.contains(r)?r:(console.error("aria-hidden",c,"in not contained inside",a,". Doing nothing"),null)}).filter(function(c){return!!c})},v1=function(a,u,c,r){var s=m1(u,Array.isArray(a)?a:[a]);ho[c]||(ho[c]=new WeakMap);var d=ho[c],m=[],v=new Set,h=new Set(s),p=function(x){!x||v.has(x)||(v.add(x),p(x.parentNode))};s.forEach(p);var b=function(x){!x||h.has(x)||Array.prototype.forEach.call(x.children,function(w){if(v.has(w))b(w);else try{var C=w.getAttribute(r),R=C!==null&&C!=="false",M=(Aa.get(w)||0)+1,N=(d.get(w)||0)+1;Aa.set(w,M),d.set(w,N),m.push(w),M===1&&R&&vo.set(w,!0),N===1&&w.setAttribute(c,"true"),R||w.setAttribute(r,"true")}catch(U){console.error("aria-hidden: cannot operate on ",w,U)}})};return b(u),v.clear(),Ss++,function(){m.forEach(function(x){var w=Aa.get(x)-1,C=d.get(x)-1;Aa.set(x,w),d.set(x,C),w||(vo.has(x)||x.removeAttribute(r),vo.delete(x)),C||x.removeAttribute(c)}),Ss--,Ss||(Aa=new WeakMap,Aa=new WeakMap,vo=new WeakMap,ho={})}},h1=function(a,u,c){c===void 0&&(c="data-aria-hidden");var r=Array.from(Array.isArray(a)?a:[a]),s=d1(a);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),v1(r,s,c,"aria-hidden")):function(){return null}};function g1(a){const u=y.useRef({value:a,previous:a});return y.useMemo(()=>(u.current.value!==a&&(u.current.previous=u.current.value,u.current.value=a),u.current.previous),[a])}function p1(a){const[u,c]=y.useState(void 0);return $t(()=>{if(a){c({width:a.offsetWidth,height:a.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const d=s[0];let m,v;if("borderBoxSize"in d){const h=d.borderBoxSize,p=Array.isArray(h)?h[0]:h;m=p.inlineSize,v=p.blockSize}else m=a.offsetWidth,v=a.offsetHeight;c({width:m,height:v})});return r.observe(a,{box:"border-box"}),()=>r.unobserve(a)}else c(void 0)},[a]),u}const y1=["top","right","bottom","left"],cl=Math.min,Ot=Math.max,Mo=Math.round,go=Math.floor,on=a=>({x:a,y:a}),b1={left:"right",right:"left",bottom:"top",top:"bottom"};function _s(a,u,c){return Ot(a,cl(u,c))}function Rn(a,u){return typeof a=="function"?a(u):a}function _n(a){return a.split("-")[0]}function Oa(a){return a.split("-")[1]}function Ks(a){return a==="x"?"y":"x"}function Qs(a){return a==="y"?"height":"width"}function un(a){const u=a[0];return u==="t"||u==="b"?"y":"x"}function Zs(a){return Ks(un(a))}function S1(a,u,c){c===void 0&&(c=!1);const r=Oa(a),s=Zs(a),d=Qs(s);let m=s==="x"?r===(c?"end":"start")?"right":"left":r==="start"?"bottom":"top";return u.reference[d]>u.floating[d]&&(m=To(m)),[m,To(m)]}function x1(a){const u=To(a);return[Ns(a),u,Ns(u)]}function Ns(a){return a.includes("start")?a.replace("start","end"):a.replace("end","start")}const Kh=["left","right"],Qh=["right","left"],E1=["top","bottom"],w1=["bottom","top"];function A1(a,u,c){switch(a){case"top":case"bottom":return c?u?Qh:Kh:u?Kh:Qh;case"left":case"right":return u?E1:w1;default:return[]}}function M1(a,u,c,r){const s=Oa(a);let d=A1(_n(a),c==="start",r);return s&&(d=d.map(m=>m+"-"+s),u&&(d=d.concat(d.map(Ns)))),d}function To(a){const u=_n(a);return b1[u]+a.slice(u.length)}function T1(a){return{top:0,right:0,bottom:0,left:0,...a}}function Xg(a){return typeof a!="number"?T1(a):{top:a,right:a,bottom:a,left:a}}function Co(a){const{x:u,y:c,width:r,height:s}=a;return{width:r,height:s,top:c,left:u,right:u+r,bottom:c+s,x:u,y:c}}function Zh(a,u,c){let{reference:r,floating:s}=a;const d=un(u),m=Zs(u),v=Qs(m),h=_n(u),p=d==="y",b=r.x+r.width/2-s.width/2,x=r.y+r.height/2-s.height/2,w=r[v]/2-s[v]/2;let C;switch(h){case"top":C={x:b,y:r.y-s.height};break;case"bottom":C={x:b,y:r.y+r.height};break;case"right":C={x:r.x+r.width,y:x};break;case"left":C={x:r.x-s.width,y:x};break;default:C={x:r.x,y:r.y}}switch(Oa(u)){case"start":C[m]-=w*(c&&p?-1:1);break;case"end":C[m]+=w*(c&&p?-1:1);break}return C}async function C1(a,u){var c;u===void 0&&(u={});const{x:r,y:s,platform:d,rects:m,elements:v,strategy:h}=a,{boundary:p="clippingAncestors",rootBoundary:b="viewport",elementContext:x="floating",altBoundary:w=!1,padding:C=0}=Rn(u,a),R=Xg(C),N=v[w?x==="floating"?"reference":"floating":x],U=Co(await d.getClippingRect({element:(c=await(d.isElement==null?void 0:d.isElement(N)))==null||c?N:N.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(v.floating)),boundary:p,rootBoundary:b,strategy:h})),Q=x==="floating"?{x:r,y:s,width:m.floating.width,height:m.floating.height}:m.reference,L=await(d.getOffsetParent==null?void 0:d.getOffsetParent(v.floating)),B=await(d.isElement==null?void 0:d.isElement(L))?await(d.getScale==null?void 0:d.getScale(L))||{x:1,y:1}:{x:1,y:1},K=Co(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:v,rect:Q,offsetParent:L,strategy:h}):Q);return{top:(U.top-K.top+R.top)/B.y,bottom:(K.bottom-U.bottom+R.bottom)/B.y,left:(U.left-K.left+R.left)/B.x,right:(K.right-U.right+R.right)/B.x}}const R1=50,_1=async(a,u,c)=>{const{placement:r="bottom",strategy:s="absolute",middleware:d=[],platform:m}=c,v=m.detectOverflow?m:{...m,detectOverflow:C1},h=await(m.isRTL==null?void 0:m.isRTL(u));let p=await m.getElementRects({reference:a,floating:u,strategy:s}),{x:b,y:x}=Zh(p,r,h),w=r,C=0;const R={};for(let M=0;M<d.length;M++){const N=d[M];if(!N)continue;const{name:U,fn:Q}=N,{x:L,y:B,data:K,reset:J}=await Q({x:b,y:x,initialPlacement:r,placement:w,strategy:s,middlewareData:R,rects:p,platform:v,elements:{reference:a,floating:u}});b=L??b,x=B??x,R[U]={...R[U],...K},J&&C<R1&&(C++,typeof J=="object"&&(J.placement&&(w=J.placement),J.rects&&(p=J.rects===!0?await m.getElementRects({reference:a,floating:u,strategy:s}):J.rects),{x:b,y:x}=Zh(p,w,h)),M=-1)}return{x:b,y:x,placement:w,strategy:s,middlewareData:R}},N1=a=>({name:"arrow",options:a,async fn(u){const{x:c,y:r,placement:s,rects:d,platform:m,elements:v,middlewareData:h}=u,{element:p,padding:b=0}=Rn(a,u)||{};if(p==null)return{};const x=Xg(b),w={x:c,y:r},C=Zs(s),R=Qs(C),M=await m.getDimensions(p),N=C==="y",U=N?"top":"left",Q=N?"bottom":"right",L=N?"clientHeight":"clientWidth",B=d.reference[R]+d.reference[C]-w[C]-d.floating[R],K=w[C]-d.reference[C],J=await(m.getOffsetParent==null?void 0:m.getOffsetParent(p));let k=J?J[L]:0;(!k||!await(m.isElement==null?void 0:m.isElement(J)))&&(k=v.floating[L]||d.floating[R]);const V=B/2-K/2,P=k/2-M[R]/2-1,se=cl(x[U],P),ve=cl(x[Q],P),de=se,Me=k-M[R]-ve,ye=k/2-M[R]/2+V,Ee=_s(de,ye,Me),O=!h.arrow&&Oa(s)!=null&&ye!==Ee&&d.reference[R]/2-(ye<de?se:ve)-M[R]/2<0,Z=O?ye<de?ye-de:ye-Me:0;return{[C]:w[C]+Z,data:{[C]:Ee,centerOffset:ye-Ee-Z,...O&&{alignmentOffset:Z}},reset:O}}}),O1=function(a){return a===void 0&&(a={}),{name:"flip",options:a,async fn(u){var c,r;const{placement:s,middlewareData:d,rects:m,initialPlacement:v,platform:h,elements:p}=u,{mainAxis:b=!0,crossAxis:x=!0,fallbackPlacements:w,fallbackStrategy:C="bestFit",fallbackAxisSideDirection:R="none",flipAlignment:M=!0,...N}=Rn(a,u);if((c=d.arrow)!=null&&c.alignmentOffset)return{};const U=_n(s),Q=un(v),L=_n(v)===v,B=await(h.isRTL==null?void 0:h.isRTL(p.floating)),K=w||(L||!M?[To(v)]:x1(v)),J=R!=="none";!w&&J&&K.push(...M1(v,M,R,B));const k=[v,...K],V=await h.detectOverflow(u,N),P=[];let se=((r=d.flip)==null?void 0:r.overflows)||[];if(b&&P.push(V[U]),x){const ye=S1(s,m,B);P.push(V[ye[0]],V[ye[1]])}if(se=[...se,{placement:s,overflows:P}],!P.every(ye=>ye<=0)){var ve,de;const ye=(((ve=d.flip)==null?void 0:ve.index)||0)+1,Ee=k[ye];if(Ee&&(!(x==="alignment"?Q!==un(Ee):!1)||se.every(I=>un(I.placement)===Q?I.overflows[0]>0:!0)))return{data:{index:ye,overflows:se},reset:{placement:Ee}};let O=(de=se.filter(Z=>Z.overflows[0]<=0).sort((Z,I)=>Z.overflows[1]-I.overflows[1])[0])==null?void 0:de.placement;if(!O)switch(C){case"bestFit":{var Me;const Z=(Me=se.filter(I=>{if(J){const $=un(I.placement);return $===Q||$==="y"}return!0}).map(I=>[I.placement,I.overflows.filter($=>$>0).reduce(($,F)=>$+F,0)]).sort((I,$)=>I[1]-$[1])[0])==null?void 0:Me[0];Z&&(O=Z);break}case"initialPlacement":O=v;break}if(s!==O)return{reset:{placement:O}}}return{}}}};function Jh(a,u){return{top:a.top-u.height,right:a.right-u.width,bottom:a.bottom-u.height,left:a.left-u.width}}function Fh(a){return y1.some(u=>a[u]>=0)}const D1=function(a){return a===void 0&&(a={}),{name:"hide",options:a,async fn(u){const{rects:c,platform:r}=u,{strategy:s="referenceHidden",...d}=Rn(a,u);switch(s){case"referenceHidden":{const m=await r.detectOverflow(u,{...d,elementContext:"reference"}),v=Jh(m,c.reference);return{data:{referenceHiddenOffsets:v,referenceHidden:Fh(v)}}}case"escaped":{const m=await r.detectOverflow(u,{...d,altBoundary:!0}),v=Jh(m,c.floating);return{data:{escapedOffsets:v,escaped:Fh(v)}}}default:return{}}}}},Kg=new Set(["left","top"]);async function z1(a,u){const{placement:c,platform:r,elements:s}=a,d=await(r.isRTL==null?void 0:r.isRTL(s.floating)),m=_n(c),v=Oa(c),h=un(c)==="y",p=Kg.has(m)?-1:1,b=d&&h?-1:1,x=Rn(u,a);let{mainAxis:w,crossAxis:C,alignmentAxis:R}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return v&&typeof R=="number"&&(C=v==="end"?R*-1:R),h?{x:C*b,y:w*p}:{x:w*p,y:C*b}}const j1=function(a){return a===void 0&&(a=0),{name:"offset",options:a,async fn(u){var c,r;const{x:s,y:d,placement:m,middlewareData:v}=u,h=await z1(u,a);return m===((c=v.offset)==null?void 0:c.placement)&&(r=v.arrow)!=null&&r.alignmentOffset?{}:{x:s+h.x,y:d+h.y,data:{...h,placement:m}}}}},U1=function(a){return a===void 0&&(a={}),{name:"shift",options:a,async fn(u){const{x:c,y:r,placement:s,platform:d}=u,{mainAxis:m=!0,crossAxis:v=!1,limiter:h={fn:U=>{let{x:Q,y:L}=U;return{x:Q,y:L}}},...p}=Rn(a,u),b={x:c,y:r},x=await d.detectOverflow(u,p),w=un(_n(s)),C=Ks(w);let R=b[C],M=b[w];if(m){const U=C==="y"?"top":"left",Q=C==="y"?"bottom":"right",L=R+x[U],B=R-x[Q];R=_s(L,R,B)}if(v){const U=w==="y"?"top":"left",Q=w==="y"?"bottom":"right",L=M+x[U],B=M-x[Q];M=_s(L,M,B)}const N=h.fn({...u,[C]:R,[w]:M});return{...N,data:{x:N.x-c,y:N.y-r,enabled:{[C]:m,[w]:v}}}}}},L1=function(a){return a===void 0&&(a={}),{options:a,fn(u){const{x:c,y:r,placement:s,rects:d,middlewareData:m}=u,{offset:v=0,mainAxis:h=!0,crossAxis:p=!0}=Rn(a,u),b={x:c,y:r},x=un(s),w=Ks(x);let C=b[w],R=b[x];const M=Rn(v,u),N=typeof M=="number"?{mainAxis:M,crossAxis:0}:{mainAxis:0,crossAxis:0,...M};if(h){const L=w==="y"?"height":"width",B=d.reference[w]-d.floating[L]+N.mainAxis,K=d.reference[w]+d.reference[L]-N.mainAxis;C<B?C=B:C>K&&(C=K)}if(p){var U,Q;const L=w==="y"?"width":"height",B=Kg.has(_n(s)),K=d.reference[x]-d.floating[L]+(B&&((U=m.offset)==null?void 0:U[x])||0)+(B?0:N.crossAxis),J=d.reference[x]+d.reference[L]+(B?0:((Q=m.offset)==null?void 0:Q[x])||0)-(B?N.crossAxis:0);R<K?R=K:R>J&&(R=J)}return{[w]:C,[x]:R}}}},H1=function(a){return a===void 0&&(a={}),{name:"size",options:a,async fn(u){var c,r;const{placement:s,rects:d,platform:m,elements:v}=u,{apply:h=()=>{},...p}=Rn(a,u),b=await m.detectOverflow(u,p),x=_n(s),w=Oa(s),C=un(s)==="y",{width:R,height:M}=d.floating;let N,U;x==="top"||x==="bottom"?(N=x,U=w===(await(m.isRTL==null?void 0:m.isRTL(v.floating))?"start":"end")?"left":"right"):(U=x,N=w==="end"?"top":"bottom");const Q=M-b.top-b.bottom,L=R-b.left-b.right,B=cl(M-b[N],Q),K=cl(R-b[U],L),J=!u.middlewareData.shift;let k=B,V=K;if((c=u.middlewareData.shift)!=null&&c.enabled.x&&(V=L),(r=u.middlewareData.shift)!=null&&r.enabled.y&&(k=Q),J&&!w){const se=Ot(b.left,0),ve=Ot(b.right,0),de=Ot(b.top,0),Me=Ot(b.bottom,0);C?V=R-2*(se!==0||ve!==0?se+ve:Ot(b.left,b.right)):k=M-2*(de!==0||Me!==0?de+Me:Ot(b.top,b.bottom))}await h({...u,availableWidth:V,availableHeight:k});const P=await m.getDimensions(v.floating);return R!==P.width||M!==P.height?{reset:{rects:!0}}:{}}}};function Lo(){return typeof window<"u"}function Da(a){return Qg(a)?(a.nodeName||"").toLowerCase():"#document"}function Dt(a){var u;return(a==null||(u=a.ownerDocument)==null?void 0:u.defaultView)||window}function rn(a){var u;return(u=(Qg(a)?a.ownerDocument:a.document)||window.document)==null?void 0:u.documentElement}function Qg(a){return Lo()?a instanceof Node||a instanceof Dt(a).Node:!1}function Wt(a){return Lo()?a instanceof Element||a instanceof Dt(a).Element:!1}function On(a){return Lo()?a instanceof HTMLElement||a instanceof Dt(a).HTMLElement:!1}function Ih(a){return!Lo()||typeof ShadowRoot>"u"?!1:a instanceof ShadowRoot||a instanceof Dt(a).ShadowRoot}function Yi(a){const{overflow:u,overflowX:c,overflowY:r,display:s}=Pt(a);return/auto|scroll|overlay|hidden|clip/.test(u+r+c)&&s!=="inline"&&s!=="contents"}function B1(a){return/^(table|td|th)$/.test(Da(a))}function Ho(a){try{if(a.matches(":popover-open"))return!0}catch{}try{return a.matches(":modal")}catch{return!1}}const G1=/transform|translate|scale|rotate|perspective|filter/,Y1=/paint|layout|strict|content/,Ol=a=>!!a&&a!=="none";let xs;function Js(a){const u=Wt(a)?Pt(a):a;return Ol(u.transform)||Ol(u.translate)||Ol(u.scale)||Ol(u.rotate)||Ol(u.perspective)||!Fs()&&(Ol(u.backdropFilter)||Ol(u.filter))||G1.test(u.willChange||"")||Y1.test(u.contain||"")}function q1(a){let u=sl(a);for(;On(u)&&!Ca(u);){if(Js(u))return u;if(Ho(u))return null;u=sl(u)}return null}function Fs(){return xs==null&&(xs=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),xs}function Ca(a){return/^(html|body|#document)$/.test(Da(a))}function Pt(a){return Dt(a).getComputedStyle(a)}function Bo(a){return Wt(a)?{scrollLeft:a.scrollLeft,scrollTop:a.scrollTop}:{scrollLeft:a.scrollX,scrollTop:a.scrollY}}function sl(a){if(Da(a)==="html")return a;const u=a.assignedSlot||a.parentNode||Ih(a)&&a.host||rn(a);return Ih(u)?u.host:u}function Zg(a){const u=sl(a);return Ca(u)?a.ownerDocument?a.ownerDocument.body:a.body:On(u)&&Yi(u)?u:Zg(u)}function Li(a,u,c){var r;u===void 0&&(u=[]),c===void 0&&(c=!0);const s=Zg(a),d=s===((r=a.ownerDocument)==null?void 0:r.body),m=Dt(s);if(d){const v=Os(m);return u.concat(m,m.visualViewport||[],Yi(s)?s:[],v&&c?Li(v):[])}else return u.concat(s,Li(s,[],c))}function Os(a){return a.parent&&Object.getPrototypeOf(a.parent)?a.frameElement:null}function Jg(a){const u=Pt(a);let c=parseFloat(u.width)||0,r=parseFloat(u.height)||0;const s=On(a),d=s?a.offsetWidth:c,m=s?a.offsetHeight:r,v=Mo(c)!==d||Mo(r)!==m;return v&&(c=d,r=m),{width:c,height:r,$:v}}function Is(a){return Wt(a)?a:a.contextElement}function Ta(a){const u=Is(a);if(!On(u))return on(1);const c=u.getBoundingClientRect(),{width:r,height:s,$:d}=Jg(u);let m=(d?Mo(c.width):c.width)/r,v=(d?Mo(c.height):c.height)/s;return(!m||!Number.isFinite(m))&&(m=1),(!v||!Number.isFinite(v))&&(v=1),{x:m,y:v}}const k1=on(0);function Fg(a){const u=Dt(a);return!Fs()||!u.visualViewport?k1:{x:u.visualViewport.offsetLeft,y:u.visualViewport.offsetTop}}function V1(a,u,c){return u===void 0&&(u=!1),!c||u&&c!==Dt(a)?!1:u}function Dl(a,u,c,r){u===void 0&&(u=!1),c===void 0&&(c=!1);const s=a.getBoundingClientRect(),d=Is(a);let m=on(1);u&&(r?Wt(r)&&(m=Ta(r)):m=Ta(a));const v=V1(d,c,r)?Fg(d):on(0);let h=(s.left+v.x)/m.x,p=(s.top+v.y)/m.y,b=s.width/m.x,x=s.height/m.y;if(d){const w=Dt(d),C=r&&Wt(r)?Dt(r):r;let R=w,M=Os(R);for(;M&&r&&C!==R;){const N=Ta(M),U=M.getBoundingClientRect(),Q=Pt(M),L=U.left+(M.clientLeft+parseFloat(Q.paddingLeft))*N.x,B=U.top+(M.clientTop+parseFloat(Q.paddingTop))*N.y;h*=N.x,p*=N.y,b*=N.x,x*=N.y,h+=L,p+=B,R=Dt(M),M=Os(R)}}return Co({width:b,height:x,x:h,y:p})}function Go(a,u){const c=Bo(a).scrollLeft;return u?u.left+c:Dl(rn(a)).left+c}function Ig(a,u){const c=a.getBoundingClientRect(),r=c.left+u.scrollLeft-Go(a,c),s=c.top+u.scrollTop;return{x:r,y:s}}function X1(a){let{elements:u,rect:c,offsetParent:r,strategy:s}=a;const d=s==="fixed",m=rn(r),v=u?Ho(u.floating):!1;if(r===m||v&&d)return c;let h={scrollLeft:0,scrollTop:0},p=on(1);const b=on(0),x=On(r);if((x||!x&&!d)&&((Da(r)!=="body"||Yi(m))&&(h=Bo(r)),x)){const C=Dl(r);p=Ta(r),b.x=C.x+r.clientLeft,b.y=C.y+r.clientTop}const w=m&&!x&&!d?Ig(m,h):on(0);return{width:c.width*p.x,height:c.height*p.y,x:c.x*p.x-h.scrollLeft*p.x+b.x+w.x,y:c.y*p.y-h.scrollTop*p.y+b.y+w.y}}function K1(a){return Array.from(a.getClientRects())}function Q1(a){const u=rn(a),c=Bo(a),r=a.ownerDocument.body,s=Ot(u.scrollWidth,u.clientWidth,r.scrollWidth,r.clientWidth),d=Ot(u.scrollHeight,u.clientHeight,r.scrollHeight,r.clientHeight);let m=-c.scrollLeft+Go(a);const v=-c.scrollTop;return Pt(r).direction==="rtl"&&(m+=Ot(u.clientWidth,r.clientWidth)-s),{width:s,height:d,x:m,y:v}}const $h=25;function Z1(a,u){const c=Dt(a),r=rn(a),s=c.visualViewport;let d=r.clientWidth,m=r.clientHeight,v=0,h=0;if(s){d=s.width,m=s.height;const b=Fs();(!b||b&&u==="fixed")&&(v=s.offsetLeft,h=s.offsetTop)}const p=Go(r);if(p<=0){const b=r.ownerDocument,x=b.body,w=getComputedStyle(x),C=b.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,R=Math.abs(r.clientWidth-x.clientWidth-C);R<=$h&&(d-=R)}else p<=$h&&(d+=p);return{width:d,height:m,x:v,y:h}}function J1(a,u){const c=Dl(a,!0,u==="fixed"),r=c.top+a.clientTop,s=c.left+a.clientLeft,d=On(a)?Ta(a):on(1),m=a.clientWidth*d.x,v=a.clientHeight*d.y,h=s*d.x,p=r*d.y;return{width:m,height:v,x:h,y:p}}function Wh(a,u,c){let r;if(u==="viewport")r=Z1(a,c);else if(u==="document")r=Q1(rn(a));else if(Wt(u))r=J1(u,c);else{const s=Fg(a);r={x:u.x-s.x,y:u.y-s.y,width:u.width,height:u.height}}return Co(r)}function $g(a,u){const c=sl(a);return c===u||!Wt(c)||Ca(c)?!1:Pt(c).position==="fixed"||$g(c,u)}function F1(a,u){const c=u.get(a);if(c)return c;let r=Li(a,[],!1).filter(v=>Wt(v)&&Da(v)!=="body"),s=null;const d=Pt(a).position==="fixed";let m=d?sl(a):a;for(;Wt(m)&&!Ca(m);){const v=Pt(m),h=Js(m);!h&&v.position==="fixed"&&(s=null),(d?!h&&!s:!h&&v.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Yi(m)&&!h&&$g(a,m))?r=r.filter(b=>b!==m):s=v,m=sl(m)}return u.set(a,r),r}function I1(a){let{element:u,boundary:c,rootBoundary:r,strategy:s}=a;const m=[...c==="clippingAncestors"?Ho(u)?[]:F1(u,this._c):[].concat(c),r],v=Wh(u,m[0],s);let h=v.top,p=v.right,b=v.bottom,x=v.left;for(let w=1;w<m.length;w++){const C=Wh(u,m[w],s);h=Ot(C.top,h),p=cl(C.right,p),b=cl(C.bottom,b),x=Ot(C.left,x)}return{width:p-x,height:b-h,x,y:h}}function $1(a){const{width:u,height:c}=Jg(a);return{width:u,height:c}}function W1(a,u,c){const r=On(u),s=rn(u),d=c==="fixed",m=Dl(a,!0,d,u);let v={scrollLeft:0,scrollTop:0};const h=on(0);function p(){h.x=Go(s)}if(r||!r&&!d)if((Da(u)!=="body"||Yi(s))&&(v=Bo(u)),r){const C=Dl(u,!0,d,u);h.x=C.x+u.clientLeft,h.y=C.y+u.clientTop}else s&&p();d&&!r&&s&&p();const b=s&&!r&&!d?Ig(s,v):on(0),x=m.left+v.scrollLeft-h.x-b.x,w=m.top+v.scrollTop-h.y-b.y;return{x,y:w,width:m.width,height:m.height}}function Es(a){return Pt(a).position==="static"}function Ph(a,u){if(!On(a)||Pt(a).position==="fixed")return null;if(u)return u(a);let c=a.offsetParent;return rn(a)===c&&(c=c.ownerDocument.body),c}function Wg(a,u){const c=Dt(a);if(Ho(a))return c;if(!On(a)){let s=sl(a);for(;s&&!Ca(s);){if(Wt(s)&&!Es(s))return s;s=sl(s)}return c}let r=Ph(a,u);for(;r&&B1(r)&&Es(r);)r=Ph(r,u);return r&&Ca(r)&&Es(r)&&!Js(r)?c:r||q1(a)||c}const P1=async function(a){const u=this.getOffsetParent||Wg,c=this.getDimensions,r=await c(a.floating);return{reference:W1(a.reference,await u(a.floating),a.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function eE(a){return Pt(a).direction==="rtl"}const tE={convertOffsetParentRelativeRectToViewportRelativeRect:X1,getDocumentElement:rn,getClippingRect:I1,getOffsetParent:Wg,getElementRects:P1,getClientRects:K1,getDimensions:$1,getScale:Ta,isElement:Wt,isRTL:eE};function Pg(a,u){return a.x===u.x&&a.y===u.y&&a.width===u.width&&a.height===u.height}function nE(a,u){let c=null,r;const s=rn(a);function d(){var v;clearTimeout(r),(v=c)==null||v.disconnect(),c=null}function m(v,h){v===void 0&&(v=!1),h===void 0&&(h=1),d();const p=a.getBoundingClientRect(),{left:b,top:x,width:w,height:C}=p;if(v||u(),!w||!C)return;const R=go(x),M=go(s.clientWidth-(b+w)),N=go(s.clientHeight-(x+C)),U=go(b),L={rootMargin:-R+"px "+-M+"px "+-N+"px "+-U+"px",threshold:Ot(0,cl(1,h))||1};let B=!0;function K(J){const k=J[0].intersectionRatio;if(k!==h){if(!B)return m();k?m(!1,k):r=setTimeout(()=>{m(!1,1e-7)},1e3)}k===1&&!Pg(p,a.getBoundingClientRect())&&m(),B=!1}try{c=new IntersectionObserver(K,{...L,root:s.ownerDocument})}catch{c=new IntersectionObserver(K,L)}c.observe(a)}return m(!0),d}function lE(a,u,c,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:d=!0,elementResize:m=typeof ResizeObserver=="function",layoutShift:v=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,p=Is(a),b=s||d?[...p?Li(p):[],...u?Li(u):[]]:[];b.forEach(U=>{s&&U.addEventListener("scroll",c,{passive:!0}),d&&U.addEventListener("resize",c)});const x=p&&v?nE(p,c):null;let w=-1,C=null;m&&(C=new ResizeObserver(U=>{let[Q]=U;Q&&Q.target===p&&C&&u&&(C.unobserve(u),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var L;(L=C)==null||L.observe(u)})),c()}),p&&!h&&C.observe(p),u&&C.observe(u));let R,M=h?Dl(a):null;h&&N();function N(){const U=Dl(a);M&&!Pg(M,U)&&c(),M=U,R=requestAnimationFrame(N)}return c(),()=>{var U;b.forEach(Q=>{s&&Q.removeEventListener("scroll",c),d&&Q.removeEventListener("resize",c)}),x==null||x(),(U=C)==null||U.disconnect(),C=null,h&&cancelAnimationFrame(R)}}const aE=j1,iE=U1,uE=O1,oE=H1,rE=D1,eg=N1,cE=L1,sE=(a,u,c)=>{const r=new Map,s={platform:tE,...c},d={...s.platform,_c:r};return _1(a,u,{...s,platform:d})};var fE=typeof document<"u",dE=function(){},bo=fE?y.useLayoutEffect:dE;function Ro(a,u){if(a===u)return!0;if(typeof a!=typeof u)return!1;if(typeof a=="function"&&a.toString()===u.toString())return!0;let c,r,s;if(a&&u&&typeof a=="object"){if(Array.isArray(a)){if(c=a.length,c!==u.length)return!1;for(r=c;r--!==0;)if(!Ro(a[r],u[r]))return!1;return!0}if(s=Object.keys(a),c=s.length,c!==Object.keys(u).length)return!1;for(r=c;r--!==0;)if(!{}.hasOwnProperty.call(u,s[r]))return!1;for(r=c;r--!==0;){const d=s[r];if(!(d==="_owner"&&a.$$typeof)&&!Ro(a[d],u[d]))return!1}return!0}return a!==a&&u!==u}function ep(a){return typeof window>"u"?1:(a.ownerDocument.defaultView||window).devicePixelRatio||1}function tg(a,u){const c=ep(a);return Math.round(u*c)/c}function ws(a){const u=y.useRef(a);return bo(()=>{u.current=a}),u}function mE(a){a===void 0&&(a={});const{placement:u="bottom",strategy:c="absolute",middleware:r=[],platform:s,elements:{reference:d,floating:m}={},transform:v=!0,whileElementsMounted:h,open:p}=a,[b,x]=y.useState({x:0,y:0,strategy:c,placement:u,middlewareData:{},isPositioned:!1}),[w,C]=y.useState(r);Ro(w,r)||C(r);const[R,M]=y.useState(null),[N,U]=y.useState(null),Q=y.useCallback(I=>{I!==J.current&&(J.current=I,M(I))},[]),L=y.useCallback(I=>{I!==k.current&&(k.current=I,U(I))},[]),B=d||R,K=m||N,J=y.useRef(null),k=y.useRef(null),V=y.useRef(b),P=h!=null,se=ws(h),ve=ws(s),de=ws(p),Me=y.useCallback(()=>{if(!J.current||!k.current)return;const I={placement:u,strategy:c,middleware:w};ve.current&&(I.platform=ve.current),sE(J.current,k.current,I).then($=>{const F={...$,isPositioned:de.current!==!1};ye.current&&!Ro(V.current,F)&&(V.current=F,ks.flushSync(()=>{x(F)}))})},[w,u,c,ve,de]);bo(()=>{p===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,x(I=>({...I,isPositioned:!1})))},[p]);const ye=y.useRef(!1);bo(()=>(ye.current=!0,()=>{ye.current=!1}),[]),bo(()=>{if(B&&(J.current=B),K&&(k.current=K),B&&K){if(se.current)return se.current(B,K,Me);Me()}},[B,K,Me,se,P]);const Ee=y.useMemo(()=>({reference:J,floating:k,setReference:Q,setFloating:L}),[Q,L]),O=y.useMemo(()=>({reference:B,floating:K}),[B,K]),Z=y.useMemo(()=>{const I={position:c,left:0,top:0};if(!O.floating)return I;const $=tg(O.floating,b.x),F=tg(O.floating,b.y);return v?{...I,transform:"translate("+$+"px, "+F+"px)",...ep(O.floating)>=1.5&&{willChange:"transform"}}:{position:c,left:$,top:F}},[c,v,O.floating,b.x,b.y]);return y.useMemo(()=>({...b,update:Me,refs:Ee,elements:O,floatingStyles:Z}),[b,Me,Ee,O,Z])}const vE=a=>{function u(c){return{}.hasOwnProperty.call(c,"current")}return{name:"arrow",options:a,fn(c){const{element:r,padding:s}=typeof a=="function"?a(c):a;return r&&u(r)?r.current!=null?eg({element:r.current,padding:s}).fn(c):{}:r?eg({element:r,padding:s}).fn(c):{}}}},hE=(a,u)=>{const c=aE(a);return{name:c.name,fn:c.fn,options:[a,u]}},gE=(a,u)=>{const c=iE(a);return{name:c.name,fn:c.fn,options:[a,u]}},pE=(a,u)=>({fn:cE(a).fn,options:[a,u]}),yE=(a,u)=>{const c=uE(a);return{name:c.name,fn:c.fn,options:[a,u]}},bE=(a,u)=>{const c=oE(a);return{name:c.name,fn:c.fn,options:[a,u]}},SE=(a,u)=>{const c=rE(a);return{name:c.name,fn:c.fn,options:[a,u]}},xE=(a,u)=>{const c=vE(a);return{name:c.name,fn:c.fn,options:[a,u]}};var EE="Arrow",tp=y.forwardRef((a,u)=>{const{children:c,width:r=10,height:s=5,...d}=a;return S.jsx(Le.svg,{...d,ref:u,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:a.asChild?c:S.jsx("polygon",{points:"0,0 30,0 15,10"})})});tp.displayName=EE;var wE=tp,$s="Popper",[np,lp]=Na($s),[AE,ap]=np($s),ip=a=>{const{__scopePopper:u,children:c}=a,[r,s]=y.useState(null);return S.jsx(AE,{scope:u,anchor:r,onAnchorChange:s,children:c})};ip.displayName=$s;var up="PopperAnchor",op=y.forwardRef((a,u)=>{const{__scopePopper:c,virtualRef:r,...s}=a,d=ap(up,c),m=y.useRef(null),v=We(u,m),h=y.useRef(null);return y.useEffect(()=>{const p=h.current;h.current=(r==null?void 0:r.current)||m.current,p!==h.current&&d.onAnchorChange(h.current)}),r?null:S.jsx(Le.div,{...s,ref:v})});op.displayName=up;var Ws="PopperContent",[ME,TE]=np(Ws),rp=y.forwardRef((a,u)=>{var me,Ge,re,ft,zt,Zt;const{__scopePopper:c,side:r="bottom",sideOffset:s=0,align:d="center",alignOffset:m=0,arrowPadding:v=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:b=0,sticky:x="partial",hideWhenDetached:w=!1,updatePositionStrategy:C="optimized",onPlaced:R,...M}=a,N=ap(Ws,c),[U,Q]=y.useState(null),L=We(u,jt=>Q(jt)),[B,K]=y.useState(null),J=p1(B),k=(J==null?void 0:J.width)??0,V=(J==null?void 0:J.height)??0,P=r+(d!=="center"?"-"+d:""),se=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},ve=Array.isArray(p)?p:[p],de=ve.length>0,Me={padding:se,boundary:ve.filter(RE),altBoundary:de},{refs:ye,floatingStyles:Ee,placement:O,isPositioned:Z,middlewareData:I}=mE({strategy:"fixed",placement:P,whileElementsMounted:(...jt)=>lE(...jt,{animationFrame:C==="always"}),elements:{reference:N.anchor},middleware:[hE({mainAxis:s+V,alignmentAxis:m}),h&&gE({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?pE():void 0,...Me}),h&&yE({...Me}),bE({...Me,apply:({elements:jt,rects:rt,availableWidth:za,availableHeight:ja})=>{const{width:Qo,height:Xi}=rt.reference,Dn=jt.floating.style;Dn.setProperty("--radix-popper-available-width",`${za}px`),Dn.setProperty("--radix-popper-available-height",`${ja}px`),Dn.setProperty("--radix-popper-anchor-width",`${Qo}px`),Dn.setProperty("--radix-popper-anchor-height",`${Xi}px`)}}),B&&xE({element:B,padding:v}),_E({arrowWidth:k,arrowHeight:V}),w&&SE({strategy:"referenceHidden",...Me})]}),[$,F]=fp(O),A=ot(R);$t(()=>{Z&&(A==null||A())},[Z,A]);const Y=(me=I.arrow)==null?void 0:me.x,W=(Ge=I.arrow)==null?void 0:Ge.y,ee=((re=I.arrow)==null?void 0:re.centerOffset)!==0,[le,ie]=y.useState();return $t(()=>{U&&ie(window.getComputedStyle(U).zIndex)},[U]),S.jsx("div",{ref:ye.setFloating,"data-radix-popper-content-wrapper":"",style:{...Ee,transform:Z?Ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[(ft=I.transformOrigin)==null?void 0:ft.x,(zt=I.transformOrigin)==null?void 0:zt.y].join(" "),...((Zt=I.hide)==null?void 0:Zt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:a.dir,children:S.jsx(ME,{scope:c,placedSide:$,onArrowChange:K,arrowX:Y,arrowY:W,shouldHideArrow:ee,children:S.jsx(Le.div,{"data-side":$,"data-align":F,...M,ref:L,style:{...M.style,animation:Z?void 0:"none"}})})})});rp.displayName=Ws;var cp="PopperArrow",CE={top:"bottom",right:"left",bottom:"top",left:"right"},sp=y.forwardRef(function(u,c){const{__scopePopper:r,...s}=u,d=TE(cp,r),m=CE[d.placedSide];return S.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[m]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[d.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[d.placedSide],visibility:d.shouldHideArrow?"hidden":void 0},children:S.jsx(wE,{...s,ref:c,style:{...s.style,display:"block"}})})});sp.displayName=cp;function RE(a){return a!==null}var _E=a=>({name:"transformOrigin",options:a,fn(u){var N,U,Q;const{placement:c,rects:r,middlewareData:s}=u,m=((N=s.arrow)==null?void 0:N.centerOffset)!==0,v=m?0:a.arrowWidth,h=m?0:a.arrowHeight,[p,b]=fp(c),x={start:"0%",center:"50%",end:"100%"}[b],w=(((U=s.arrow)==null?void 0:U.x)??0)+v/2,C=(((Q=s.arrow)==null?void 0:Q.y)??0)+h/2;let R="",M="";return p==="bottom"?(R=m?x:`${w}px`,M=`${-h}px`):p==="top"?(R=m?x:`${w}px`,M=`${r.floating.height+h}px`):p==="right"?(R=`${-h}px`,M=m?x:`${C}px`):p==="left"&&(R=`${r.floating.width+h}px`,M=m?x:`${C}px`),{data:{x:R,y:M}}}});function fp(a){const[u,c="center"]=a.split("-");return[u,c]}var NE=ip,OE=op,DE=rp,zE=sp,As="rovingFocusGroup.onEntryFocus",jE={bubbles:!1,cancelable:!0},qi="RovingFocusGroup",[Ds,dp,UE]=zo(qi),[LE,mp]=Na(qi,[UE]),[HE,BE]=LE(qi),vp=y.forwardRef((a,u)=>S.jsx(Ds.Provider,{scope:a.__scopeRovingFocusGroup,children:S.jsx(Ds.Slot,{scope:a.__scopeRovingFocusGroup,children:S.jsx(GE,{...a,ref:u})})}));vp.displayName=qi;var GE=y.forwardRef((a,u)=>{const{__scopeRovingFocusGroup:c,orientation:r,loop:s=!1,dir:d,currentTabStopId:m,defaultCurrentTabStopId:v,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:b=!1,...x}=a,w=y.useRef(null),C=We(u,w),R=Vs(d),[M,N]=jo({prop:m,defaultProp:v??null,onChange:h,caller:qi}),[U,Q]=y.useState(!1),L=ot(p),B=dp(c),K=y.useRef(!1),[J,k]=y.useState(0);return y.useEffect(()=>{const V=w.current;if(V)return V.addEventListener(As,L),()=>V.removeEventListener(As,L)},[L]),S.jsx(HE,{scope:c,orientation:r,dir:R,loop:s,currentTabStopId:M,onItemFocus:y.useCallback(V=>N(V),[N]),onItemShiftTab:y.useCallback(()=>Q(!0),[]),onFocusableItemAdd:y.useCallback(()=>k(V=>V+1),[]),onFocusableItemRemove:y.useCallback(()=>k(V=>V-1),[]),children:S.jsx(Le.div,{tabIndex:U||J===0?-1:0,"data-orientation":r,...x,ref:C,style:{outline:"none",...a.style},onMouseDown:fe(a.onMouseDown,()=>{K.current=!0}),onFocus:fe(a.onFocus,V=>{const P=!K.current;if(V.target===V.currentTarget&&P&&!U){const se=new CustomEvent(As,jE);if(V.currentTarget.dispatchEvent(se),!se.defaultPrevented){const ve=B().filter(O=>O.focusable),de=ve.find(O=>O.active),Me=ve.find(O=>O.id===M),Ee=[de,Me,...ve].filter(Boolean).map(O=>O.ref.current);pp(Ee,b)}}K.current=!1}),onBlur:fe(a.onBlur,()=>Q(!1))})})}),hp="RovingFocusGroupItem",gp=y.forwardRef((a,u)=>{const{__scopeRovingFocusGroup:c,focusable:r=!0,active:s=!1,tabStopId:d,children:m,...v}=a,h=Ui(),p=d||h,b=BE(hp,c),x=b.currentTabStopId===p,w=dp(c),{onFocusableItemAdd:C,onFocusableItemRemove:R,currentTabStopId:M}=b;return y.useEffect(()=>{if(r)return C(),()=>R()},[r,C,R]),S.jsx(Ds.ItemSlot,{scope:c,id:p,focusable:r,active:s,children:S.jsx(Le.span,{tabIndex:x?0:-1,"data-orientation":b.orientation,...v,ref:u,onMouseDown:fe(a.onMouseDown,N=>{r?b.onItemFocus(p):N.preventDefault()}),onFocus:fe(a.onFocus,()=>b.onItemFocus(p)),onKeyDown:fe(a.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){b.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const U=kE(N,b.orientation,b.dir);if(U!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let L=w().filter(B=>B.focusable).map(B=>B.ref.current);if(U==="last")L.reverse();else if(U==="prev"||U==="next"){U==="prev"&&L.reverse();const B=L.indexOf(N.currentTarget);L=b.loop?VE(L,B+1):L.slice(B+1)}setTimeout(()=>pp(L))}}),children:typeof m=="function"?m({isCurrentTabStop:x,hasTabStop:M!=null}):m})})});gp.displayName=hp;var YE={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function qE(a,u){return u!=="rtl"?a:a==="ArrowLeft"?"ArrowRight":a==="ArrowRight"?"ArrowLeft":a}function kE(a,u,c){const r=qE(a.key,c);if(!(u==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(u==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return YE[r]}function pp(a,u=!1){const c=document.activeElement;for(const r of a)if(r===c||(r.focus({preventScroll:u}),document.activeElement!==c))return}function VE(a,u){return a.map((c,r)=>a[(u+r)%a.length])}var XE=vp,KE=gp,zs=["Enter"," "],QE=["ArrowDown","PageUp","Home"],yp=["ArrowUp","PageDown","End"],ZE=[...QE,...yp],JE={ltr:[...zs,"ArrowRight"],rtl:[...zs,"ArrowLeft"]},FE={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ki="Menu",[Hi,IE,$E]=zo(ki),[Ul,bp]=Na(ki,[$E,lp,mp]),Yo=lp(),Sp=mp(),[WE,Ll]=Ul(ki),[PE,Vi]=Ul(ki),xp=a=>{const{__scopeMenu:u,open:c=!1,children:r,dir:s,onOpenChange:d,modal:m=!0}=a,v=Yo(u),[h,p]=y.useState(null),b=y.useRef(!1),x=ot(d),w=Vs(s);return y.useEffect(()=>{const C=()=>{b.current=!0,document.addEventListener("pointerdown",R,{capture:!0,once:!0}),document.addEventListener("pointermove",R,{capture:!0,once:!0})},R=()=>b.current=!1;return document.addEventListener("keydown",C,{capture:!0}),()=>{document.removeEventListener("keydown",C,{capture:!0}),document.removeEventListener("pointerdown",R,{capture:!0}),document.removeEventListener("pointermove",R,{capture:!0})}},[]),S.jsx(NE,{...v,children:S.jsx(WE,{scope:u,open:c,onOpenChange:x,content:h,onContentChange:p,children:S.jsx(PE,{scope:u,onClose:y.useCallback(()=>x(!1),[x]),isUsingKeyboardRef:b,dir:w,modal:m,children:r})})})};xp.displayName=ki;var ew="MenuAnchor",Ps=y.forwardRef((a,u)=>{const{__scopeMenu:c,...r}=a,s=Yo(c);return S.jsx(OE,{...s,...r,ref:u})});Ps.displayName=ew;var ef="MenuPortal",[tw,Ep]=Ul(ef,{forceMount:void 0}),wp=a=>{const{__scopeMenu:u,forceMount:c,children:r,container:s}=a,d=Ll(ef,u);return S.jsx(tw,{scope:u,forceMount:c,children:S.jsx(Nn,{present:c||d.open,children:S.jsx(jg,{asChild:!0,container:s,children:r})})})};wp.displayName=ef;var Kt="MenuContent",[nw,tf]=Ul(Kt),Ap=y.forwardRef((a,u)=>{const c=Ep(Kt,a.__scopeMenu),{forceMount:r=c.forceMount,...s}=a,d=Ll(Kt,a.__scopeMenu),m=Vi(Kt,a.__scopeMenu);return S.jsx(Hi.Provider,{scope:a.__scopeMenu,children:S.jsx(Nn,{present:r||d.open,children:S.jsx(Hi.Slot,{scope:a.__scopeMenu,children:m.modal?S.jsx(lw,{...s,ref:u}):S.jsx(aw,{...s,ref:u})})})})}),lw=y.forwardRef((a,u)=>{const c=Ll(Kt,a.__scopeMenu),r=y.useRef(null),s=We(u,r);return y.useEffect(()=>{const d=r.current;if(d)return h1(d)},[]),S.jsx(nf,{...a,ref:s,trapFocus:c.open,disableOutsidePointerEvents:c.open,disableOutsideScroll:!0,onFocusOutside:fe(a.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>c.onOpenChange(!1)})}),aw=y.forwardRef((a,u)=>{const c=Ll(Kt,a.__scopeMenu);return S.jsx(nf,{...a,ref:u,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>c.onOpenChange(!1)})}),iw=wo("MenuContent.ScrollLock"),nf=y.forwardRef((a,u)=>{const{__scopeMenu:c,loop:r=!1,trapFocus:s,onOpenAutoFocus:d,onCloseAutoFocus:m,disableOutsidePointerEvents:v,onEntryFocus:h,onEscapeKeyDown:p,onPointerDownOutside:b,onFocusOutside:x,onInteractOutside:w,onDismiss:C,disableOutsideScroll:R,...M}=a,N=Ll(Kt,c),U=Vi(Kt,c),Q=Yo(c),L=Sp(c),B=IE(c),[K,J]=y.useState(null),k=y.useRef(null),V=We(u,k,N.onContentChange),P=y.useRef(0),se=y.useRef(""),ve=y.useRef(0),de=y.useRef(null),Me=y.useRef("right"),ye=y.useRef(0),Ee=R?kg:y.Fragment,O=R?{as:iw,allowPinchZoom:!0}:void 0,Z=$=>{var me,Ge;const F=se.current+$,A=B().filter(re=>!re.disabled),Y=document.activeElement,W=(me=A.find(re=>re.ref.current===Y))==null?void 0:me.textValue,ee=A.map(re=>re.textValue),le=pw(ee,F,W),ie=(Ge=A.find(re=>re.textValue===le))==null?void 0:Ge.ref.current;(function re(ft){se.current=ft,window.clearTimeout(P.current),ft!==""&&(P.current=window.setTimeout(()=>re(""),1e3))})(F),ie&&setTimeout(()=>ie.focus())};y.useEffect(()=>()=>window.clearTimeout(P.current),[]),_x();const I=y.useCallback($=>{var A,Y;return Me.current===((A=de.current)==null?void 0:A.side)&&bw($,(Y=de.current)==null?void 0:Y.area)},[]);return S.jsx(nw,{scope:c,searchRef:se,onItemEnter:y.useCallback($=>{I($)&&$.preventDefault()},[I]),onItemLeave:y.useCallback($=>{var F;I($)||((F=k.current)==null||F.focus(),J(null))},[I]),onTriggerLeave:y.useCallback($=>{I($)&&$.preventDefault()},[I]),pointerGraceTimerRef:ve,onPointerGraceIntentChange:y.useCallback($=>{de.current=$},[]),children:S.jsx(Ee,{...O,children:S.jsx(Dg,{asChild:!0,trapped:s,onMountAutoFocus:fe(d,$=>{var F;$.preventDefault(),(F=k.current)==null||F.focus({preventScroll:!0})}),onUnmountAutoFocus:m,children:S.jsx(Xs,{asChild:!0,disableOutsidePointerEvents:v,onEscapeKeyDown:p,onPointerDownOutside:b,onFocusOutside:x,onInteractOutside:w,onDismiss:C,children:S.jsx(XE,{asChild:!0,...L,dir:U.dir,orientation:"vertical",loop:r,currentTabStopId:K,onCurrentTabStopIdChange:J,onEntryFocus:fe(h,$=>{U.isUsingKeyboardRef.current||$.preventDefault()}),preventScrollOnEntryFocus:!0,children:S.jsx(DE,{role:"menu","aria-orientation":"vertical","data-state":Yp(N.open),"data-radix-menu-content":"",dir:U.dir,...Q,...M,ref:V,style:{outline:"none",...M.style},onKeyDown:fe(M.onKeyDown,$=>{const A=$.target.closest("[data-radix-menu-content]")===$.currentTarget,Y=$.ctrlKey||$.altKey||$.metaKey,W=$.key.length===1;A&&($.key==="Tab"&&$.preventDefault(),!Y&&W&&Z($.key));const ee=k.current;if($.target!==ee||!ZE.includes($.key))return;$.preventDefault();const ie=B().filter(me=>!me.disabled).map(me=>me.ref.current);yp.includes($.key)&&ie.reverse(),hw(ie)}),onBlur:fe(a.onBlur,$=>{$.currentTarget.contains($.target)||(window.clearTimeout(P.current),se.current="")}),onPointerMove:fe(a.onPointerMove,Bi($=>{const F=$.target,A=ye.current!==$.clientX;if($.currentTarget.contains(F)&&A){const Y=$.clientX>ye.current?"right":"left";Me.current=Y,ye.current=$.clientX}}))})})})})})})});Ap.displayName=Kt;var uw="MenuGroup",lf=y.forwardRef((a,u)=>{const{__scopeMenu:c,...r}=a;return S.jsx(Le.div,{role:"group",...r,ref:u})});lf.displayName=uw;var ow="MenuLabel",Mp=y.forwardRef((a,u)=>{const{__scopeMenu:c,...r}=a;return S.jsx(Le.div,{...r,ref:u})});Mp.displayName=ow;var _o="MenuItem",ng="menu.itemSelect",qo=y.forwardRef((a,u)=>{const{disabled:c=!1,onSelect:r,...s}=a,d=y.useRef(null),m=Vi(_o,a.__scopeMenu),v=tf(_o,a.__scopeMenu),h=We(u,d),p=y.useRef(!1),b=()=>{const x=d.current;if(!c&&x){const w=new CustomEvent(ng,{bubbles:!0,cancelable:!0});x.addEventListener(ng,C=>r==null?void 0:r(C),{once:!0}),Ao(x,w),w.defaultPrevented?p.current=!1:m.onClose()}};return S.jsx(Tp,{...s,ref:h,disabled:c,onClick:fe(a.onClick,b),onPointerDown:x=>{var w;(w=a.onPointerDown)==null||w.call(a,x),p.current=!0},onPointerUp:fe(a.onPointerUp,x=>{var w;p.current||(w=x.currentTarget)==null||w.click()}),onKeyDown:fe(a.onKeyDown,x=>{const w=v.searchRef.current!=="";c||w&&x.key===" "||zs.includes(x.key)&&(x.currentTarget.click(),x.preventDefault())})})});qo.displayName=_o;var Tp=y.forwardRef((a,u)=>{const{__scopeMenu:c,disabled:r=!1,textValue:s,...d}=a,m=tf(_o,c),v=Sp(c),h=y.useRef(null),p=We(u,h),[b,x]=y.useState(!1),[w,C]=y.useState("");return y.useEffect(()=>{const R=h.current;R&&C((R.textContent??"").trim())},[d.children]),S.jsx(Hi.ItemSlot,{scope:c,disabled:r,textValue:s??w,children:S.jsx(KE,{asChild:!0,...v,focusable:!r,children:S.jsx(Le.div,{role:"menuitem","data-highlighted":b?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...d,ref:p,onPointerMove:fe(a.onPointerMove,Bi(R=>{r?m.onItemLeave(R):(m.onItemEnter(R),R.defaultPrevented||R.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:fe(a.onPointerLeave,Bi(R=>m.onItemLeave(R))),onFocus:fe(a.onFocus,()=>x(!0)),onBlur:fe(a.onBlur,()=>x(!1))})})})}),rw="MenuCheckboxItem",Cp=y.forwardRef((a,u)=>{const{checked:c=!1,onCheckedChange:r,...s}=a;return S.jsx(Dp,{scope:a.__scopeMenu,checked:c,children:S.jsx(qo,{role:"menuitemcheckbox","aria-checked":No(c)?"mixed":c,...s,ref:u,"data-state":uf(c),onSelect:fe(s.onSelect,()=>r==null?void 0:r(No(c)?!0:!c),{checkForDefaultPrevented:!1})})})});Cp.displayName=rw;var Rp="MenuRadioGroup",[cw,sw]=Ul(Rp,{value:void 0,onValueChange:()=>{}}),_p=y.forwardRef((a,u)=>{const{value:c,onValueChange:r,...s}=a,d=ot(r);return S.jsx(cw,{scope:a.__scopeMenu,value:c,onValueChange:d,children:S.jsx(lf,{...s,ref:u})})});_p.displayName=Rp;var Np="MenuRadioItem",Op=y.forwardRef((a,u)=>{const{value:c,...r}=a,s=sw(Np,a.__scopeMenu),d=c===s.value;return S.jsx(Dp,{scope:a.__scopeMenu,checked:d,children:S.jsx(qo,{role:"menuitemradio","aria-checked":d,...r,ref:u,"data-state":uf(d),onSelect:fe(r.onSelect,()=>{var m;return(m=s.onValueChange)==null?void 0:m.call(s,c)},{checkForDefaultPrevented:!1})})})});Op.displayName=Np;var af="MenuItemIndicator",[Dp,fw]=Ul(af,{checked:!1}),zp=y.forwardRef((a,u)=>{const{__scopeMenu:c,forceMount:r,...s}=a,d=fw(af,c);return S.jsx(Nn,{present:r||No(d.checked)||d.checked===!0,children:S.jsx(Le.span,{...s,ref:u,"data-state":uf(d.checked)})})});zp.displayName=af;var dw="MenuSeparator",jp=y.forwardRef((a,u)=>{const{__scopeMenu:c,...r}=a;return S.jsx(Le.div,{role:"separator","aria-orientation":"horizontal",...r,ref:u})});jp.displayName=dw;var mw="MenuArrow",Up=y.forwardRef((a,u)=>{const{__scopeMenu:c,...r}=a,s=Yo(c);return S.jsx(zE,{...s,...r,ref:u})});Up.displayName=mw;var vw="MenuSub",[tM,Lp]=Ul(vw),Ni="MenuSubTrigger",Hp=y.forwardRef((a,u)=>{const c=Ll(Ni,a.__scopeMenu),r=Vi(Ni,a.__scopeMenu),s=Lp(Ni,a.__scopeMenu),d=tf(Ni,a.__scopeMenu),m=y.useRef(null),{pointerGraceTimerRef:v,onPointerGraceIntentChange:h}=d,p={__scopeMenu:a.__scopeMenu},b=y.useCallback(()=>{m.current&&window.clearTimeout(m.current),m.current=null},[]);return y.useEffect(()=>b,[b]),y.useEffect(()=>{const x=v.current;return()=>{window.clearTimeout(x),h(null)}},[v,h]),S.jsx(Ps,{asChild:!0,...p,children:S.jsx(Tp,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":s.contentId,"data-state":Yp(c.open),...a,ref:Gi(u,s.onTriggerChange),onClick:x=>{var w;(w=a.onClick)==null||w.call(a,x),!(a.disabled||x.defaultPrevented)&&(x.currentTarget.focus(),c.open||c.onOpenChange(!0))},onPointerMove:fe(a.onPointerMove,Bi(x=>{d.onItemEnter(x),!x.defaultPrevented&&!a.disabled&&!c.open&&!m.current&&(d.onPointerGraceIntentChange(null),m.current=window.setTimeout(()=>{c.onOpenChange(!0),b()},100))})),onPointerLeave:fe(a.onPointerLeave,Bi(x=>{var C,R;b();const w=(C=c.content)==null?void 0:C.getBoundingClientRect();if(w){const M=(R=c.content)==null?void 0:R.dataset.side,N=M==="right",U=N?-5:5,Q=w[N?"left":"right"],L=w[N?"right":"left"];d.onPointerGraceIntentChange({area:[{x:x.clientX+U,y:x.clientY},{x:Q,y:w.top},{x:L,y:w.top},{x:L,y:w.bottom},{x:Q,y:w.bottom}],side:M}),window.clearTimeout(v.current),v.current=window.setTimeout(()=>d.onPointerGraceIntentChange(null),300)}else{if(d.onTriggerLeave(x),x.defaultPrevented)return;d.onPointerGraceIntentChange(null)}})),onKeyDown:fe(a.onKeyDown,x=>{var C;const w=d.searchRef.current!=="";a.disabled||w&&x.key===" "||JE[r.dir].includes(x.key)&&(c.onOpenChange(!0),(C=c.content)==null||C.focus(),x.preventDefault())})})})});Hp.displayName=Ni;var Bp="MenuSubContent",Gp=y.forwardRef((a,u)=>{const c=Ep(Kt,a.__scopeMenu),{forceMount:r=c.forceMount,...s}=a,d=Ll(Kt,a.__scopeMenu),m=Vi(Kt,a.__scopeMenu),v=Lp(Bp,a.__scopeMenu),h=y.useRef(null),p=We(u,h);return S.jsx(Hi.Provider,{scope:a.__scopeMenu,children:S.jsx(Nn,{present:r||d.open,children:S.jsx(Hi.Slot,{scope:a.__scopeMenu,children:S.jsx(nf,{id:v.contentId,"aria-labelledby":v.triggerId,...s,ref:p,align:"start",side:m.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:b=>{var x;m.isUsingKeyboardRef.current&&((x=h.current)==null||x.focus()),b.preventDefault()},onCloseAutoFocus:b=>b.preventDefault(),onFocusOutside:fe(a.onFocusOutside,b=>{b.target!==v.trigger&&d.onOpenChange(!1)}),onEscapeKeyDown:fe(a.onEscapeKeyDown,b=>{m.onClose(),b.preventDefault()}),onKeyDown:fe(a.onKeyDown,b=>{var C;const x=b.currentTarget.contains(b.target),w=FE[m.dir].includes(b.key);x&&w&&(d.onOpenChange(!1),(C=v.trigger)==null||C.focus(),b.preventDefault())})})})})})});Gp.displayName=Bp;function Yp(a){return a?"open":"closed"}function No(a){return a==="indeterminate"}function uf(a){return No(a)?"indeterminate":a?"checked":"unchecked"}function hw(a){const u=document.activeElement;for(const c of a)if(c===u||(c.focus(),document.activeElement!==u))return}function gw(a,u){return a.map((c,r)=>a[(u+r)%a.length])}function pw(a,u,c){const s=u.length>1&&Array.from(u).every(p=>p===u[0])?u[0]:u,d=c?a.indexOf(c):-1;let m=gw(a,Math.max(d,0));s.length===1&&(m=m.filter(p=>p!==c));const h=m.find(p=>p.toLowerCase().startsWith(s.toLowerCase()));return h!==c?h:void 0}function yw(a,u){const{x:c,y:r}=a;let s=!1;for(let d=0,m=u.length-1;d<u.length;m=d++){const v=u[d],h=u[m],p=v.x,b=v.y,x=h.x,w=h.y;b>r!=w>r&&c<(x-p)*(r-b)/(w-b)+p&&(s=!s)}return s}function bw(a,u){if(!u)return!1;const c={x:a.clientX,y:a.clientY};return yw(c,u)}function Bi(a){return u=>u.pointerType==="mouse"?a(u):void 0}var Sw=xp,xw=Ps,Ew=wp,ww=Ap,Aw=lf,Mw=Mp,Tw=qo,Cw=Cp,Rw=_p,_w=Op,Nw=zp,Ow=jp,Dw=Up,zw=Hp,jw=Gp,ko="DropdownMenu",[Uw]=Na(ko,[bp]),st=bp(),[Lw,qp]=Uw(ko),kp=a=>{const{__scopeDropdownMenu:u,children:c,dir:r,open:s,defaultOpen:d,onOpenChange:m,modal:v=!0}=a,h=st(u),p=y.useRef(null),[b,x]=jo({prop:s,defaultProp:d??!1,onChange:m,caller:ko});return S.jsx(Lw,{scope:u,triggerId:Ui(),triggerRef:p,contentId:Ui(),open:b,onOpenChange:x,onOpenToggle:y.useCallback(()=>x(w=>!w),[x]),modal:v,children:S.jsx(Sw,{...h,open:b,onOpenChange:x,dir:r,modal:v,children:c})})};kp.displayName=ko;var Vp="DropdownMenuTrigger",Xp=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,disabled:r=!1,...s}=a,d=qp(Vp,c),m=st(c);return S.jsx(xw,{asChild:!0,...m,children:S.jsx(Le.button,{type:"button",id:d.triggerId,"aria-haspopup":"menu","aria-expanded":d.open,"aria-controls":d.open?d.contentId:void 0,"data-state":d.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Gi(u,d.triggerRef),onPointerDown:fe(a.onPointerDown,v=>{!r&&v.button===0&&v.ctrlKey===!1&&(d.onOpenToggle(),d.open||v.preventDefault())}),onKeyDown:fe(a.onKeyDown,v=>{r||(["Enter"," "].includes(v.key)&&d.onOpenToggle(),v.key==="ArrowDown"&&d.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(v.key)&&v.preventDefault())})})})});Xp.displayName=Vp;var Hw="DropdownMenuPortal",Kp=a=>{const{__scopeDropdownMenu:u,...c}=a,r=st(u);return S.jsx(Ew,{...r,...c})};Kp.displayName=Hw;var Qp="DropdownMenuContent",Zp=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=qp(Qp,c),d=st(c),m=y.useRef(!1);return S.jsx(ww,{id:s.contentId,"aria-labelledby":s.triggerId,...d,...r,ref:u,onCloseAutoFocus:fe(a.onCloseAutoFocus,v=>{var h;m.current||(h=s.triggerRef.current)==null||h.focus(),m.current=!1,v.preventDefault()}),onInteractOutside:fe(a.onInteractOutside,v=>{const h=v.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0,b=h.button===2||p;(!s.modal||b)&&(m.current=!0)}),style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Zp.displayName=Qp;var Bw="DropdownMenuGroup",Gw=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Aw,{...s,...r,ref:u})});Gw.displayName=Bw;var Yw="DropdownMenuLabel",Jp=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Mw,{...s,...r,ref:u})});Jp.displayName=Yw;var qw="DropdownMenuItem",Fp=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Tw,{...s,...r,ref:u})});Fp.displayName=qw;var kw="DropdownMenuCheckboxItem",Ip=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Cw,{...s,...r,ref:u})});Ip.displayName=kw;var Vw="DropdownMenuRadioGroup",Xw=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Rw,{...s,...r,ref:u})});Xw.displayName=Vw;var Kw="DropdownMenuRadioItem",Qw=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(_w,{...s,...r,ref:u})});Qw.displayName=Kw;var Zw="DropdownMenuItemIndicator",$p=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Nw,{...s,...r,ref:u})});$p.displayName=Zw;var Jw="DropdownMenuSeparator",Wp=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Ow,{...s,...r,ref:u})});Wp.displayName=Jw;var Fw="DropdownMenuArrow",Iw=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Dw,{...s,...r,ref:u})});Iw.displayName=Fw;var $w="DropdownMenuSubTrigger",Ww=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(zw,{...s,...r,ref:u})});Ww.displayName=$w;var Pw="DropdownMenuSubContent",eA=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(jw,{...s,...r,ref:u,style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eA.displayName=Pw;var tA=kp,nA=Xp,lA=Kp,aA=Zp,iA=Jp,uA=Fp,oA=Ip,rA=$p,cA=Wp,Hl="NavigationMenu",[of,Pp,sA]=zo(Hl),[js,fA,dA]=zo(Hl),[rf]=Na(Hl,[sA,dA]),[mA,Qt]=rf(Hl),[vA,hA]=rf(Hl),ey=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,value:r,onValueChange:s,defaultValue:d,delayDuration:m=200,skipDelayDuration:v=300,orientation:h="horizontal",dir:p,...b}=a,[x,w]=y.useState(null),C=We(u,P=>w(P)),R=Vs(p),M=y.useRef(0),N=y.useRef(0),U=y.useRef(0),[Q,L]=y.useState(!0),[B,K]=jo({prop:r,onChange:P=>{const se=P!=="",ve=v>0;se?(window.clearTimeout(U.current),ve&&L(!1)):(window.clearTimeout(U.current),U.current=window.setTimeout(()=>L(!0),v)),s==null||s(P)},defaultProp:d??"",caller:Hl}),J=y.useCallback(()=>{window.clearTimeout(N.current),N.current=window.setTimeout(()=>K(""),150)},[K]),k=y.useCallback(P=>{window.clearTimeout(N.current),K(P)},[K]),V=y.useCallback(P=>{B===P?window.clearTimeout(N.current):M.current=window.setTimeout(()=>{window.clearTimeout(N.current),K(P)},m)},[B,K,m]);return y.useEffect(()=>()=>{window.clearTimeout(M.current),window.clearTimeout(N.current),window.clearTimeout(U.current)},[]),S.jsx(ty,{scope:c,isRootMenu:!0,value:B,dir:R,orientation:h,rootNavigationMenu:x,onTriggerEnter:P=>{window.clearTimeout(M.current),Q?V(P):k(P)},onTriggerLeave:()=>{window.clearTimeout(M.current),J()},onContentEnter:()=>window.clearTimeout(N.current),onContentLeave:J,onItemSelect:P=>{K(se=>se===P?"":P)},onItemDismiss:()=>K(""),children:S.jsx(Le.nav,{"aria-label":"Main","data-orientation":h,dir:R,...b,ref:C})})});ey.displayName=Hl;var Us="NavigationMenuSub",gA=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,value:r,onValueChange:s,defaultValue:d,orientation:m="horizontal",...v}=a,h=Qt(Us,c),[p,b]=jo({prop:r,onChange:s,defaultProp:d??"",caller:Us});return S.jsx(ty,{scope:c,isRootMenu:!1,value:p,dir:h.dir,orientation:m,rootNavigationMenu:h.rootNavigationMenu,onTriggerEnter:x=>b(x),onItemSelect:x=>b(x),onItemDismiss:()=>b(""),children:S.jsx(Le.div,{"data-orientation":m,...v,ref:u})})});gA.displayName=Us;var ty=a=>{const{scope:u,isRootMenu:c,rootNavigationMenu:r,dir:s,orientation:d,children:m,value:v,onItemSelect:h,onItemDismiss:p,onTriggerEnter:b,onTriggerLeave:x,onContentEnter:w,onContentLeave:C}=a,[R,M]=y.useState(null),[N,U]=y.useState(new Map),[Q,L]=y.useState(null);return S.jsx(mA,{scope:u,isRootMenu:c,rootNavigationMenu:r,value:v,previousValue:g1(v),baseId:Ui(),dir:s,orientation:d,viewport:R,onViewportChange:M,indicatorTrack:Q,onIndicatorTrackChange:L,onTriggerEnter:ot(b),onTriggerLeave:ot(x),onContentEnter:ot(w),onContentLeave:ot(C),onItemSelect:ot(h),onItemDismiss:ot(p),onViewportContentChange:y.useCallback((B,K)=>{U(J=>(J.set(B,K),new Map(J)))},[]),onViewportContentRemove:y.useCallback(B=>{U(K=>K.has(B)?(K.delete(B),new Map(K)):K)},[]),children:S.jsx(of.Provider,{scope:u,children:S.jsx(vA,{scope:u,items:N,children:m})})})},ny="NavigationMenuList",ly=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,...r}=a,s=Qt(ny,c),d=S.jsx(Le.ul,{"data-orientation":s.orientation,...r,ref:u});return S.jsx(Le.div,{style:{position:"relative"},ref:s.onIndicatorTrackChange,children:S.jsx(of.Slot,{scope:c,children:s.isRootMenu?S.jsx(cy,{asChild:!0,children:d}):d})})});ly.displayName=ny;var ay="NavigationMenuItem",[pA,iy]=rf(ay),uy=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,value:r,...s}=a,d=Ui(),m=r||d||"LEGACY_REACT_AUTO_VALUE",v=y.useRef(null),h=y.useRef(null),p=y.useRef(null),b=y.useRef(()=>{}),x=y.useRef(!1),w=y.useCallback((R="start")=>{if(v.current){b.current();const M=Hs(v.current);M.length&&ff(R==="start"?M:M.reverse())}},[]),C=y.useCallback(()=>{if(v.current){const R=Hs(v.current);R.length&&(b.current=RA(R))}},[]);return S.jsx(pA,{scope:c,value:m,triggerRef:h,contentRef:v,focusProxyRef:p,wasEscapeCloseRef:x,onEntryKeyDown:w,onFocusProxyEnter:w,onRootContentClose:C,onContentFocusOutside:C,children:S.jsx(Le.li,{...s,ref:u})})});uy.displayName=ay;var Ls="NavigationMenuTrigger",yA=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,disabled:r,...s}=a,d=Qt(Ls,a.__scopeNavigationMenu),m=iy(Ls,a.__scopeNavigationMenu),v=y.useRef(null),h=We(v,m.triggerRef,u),p=fy(d.baseId,m.value),b=dy(d.baseId,m.value),x=y.useRef(!1),w=y.useRef(!1),C=m.value===d.value;return S.jsxs(S.Fragment,{children:[S.jsx(of.ItemSlot,{scope:c,value:m.value,children:S.jsx(sy,{asChild:!0,children:S.jsx(Le.button,{id:p,disabled:r,"data-disabled":r?"":void 0,"data-state":df(C),"aria-expanded":C,"aria-controls":b,...s,ref:h,onPointerEnter:fe(a.onPointerEnter,()=>{w.current=!1,m.wasEscapeCloseRef.current=!1}),onPointerMove:fe(a.onPointerMove,Oo(()=>{r||w.current||m.wasEscapeCloseRef.current||x.current||(d.onTriggerEnter(m.value),x.current=!0)})),onPointerLeave:fe(a.onPointerLeave,Oo(()=>{r||(d.onTriggerLeave(),x.current=!1)})),onClick:fe(a.onClick,()=>{d.onItemSelect(m.value),w.current=C}),onKeyDown:fe(a.onKeyDown,R=>{const N={horizontal:"ArrowDown",vertical:d.dir==="rtl"?"ArrowLeft":"ArrowRight"}[d.orientation];C&&R.key===N&&(m.onEntryKeyDown(),R.preventDefault())})})})}),C&&S.jsxs(S.Fragment,{children:[S.jsx(nx,{"aria-hidden":!0,tabIndex:0,ref:m.focusProxyRef,onFocus:R=>{const M=m.contentRef.current,N=R.relatedTarget,U=N===v.current,Q=M==null?void 0:M.contains(N);(U||!Q)&&m.onFocusProxyEnter(U?"start":"end")}}),d.viewport&&S.jsx("span",{"aria-owns":b})]})]})});yA.displayName=Ls;var bA="NavigationMenuLink",lg="navigationMenu.linkSelect",oy=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,active:r,onSelect:s,...d}=a;return S.jsx(sy,{asChild:!0,children:S.jsx(Le.a,{"data-active":r?"":void 0,"aria-current":r?"page":void 0,...d,ref:u,onClick:fe(a.onClick,m=>{const v=m.target,h=new CustomEvent(lg,{bubbles:!0,cancelable:!0});if(v.addEventListener(lg,p=>s==null?void 0:s(p),{once:!0}),Ao(v,h),!h.defaultPrevented&&!m.metaKey){const p=new CustomEvent(So,{bubbles:!0,cancelable:!0});Ao(v,p)}},{checkForDefaultPrevented:!1})})})});oy.displayName=bA;var cf="NavigationMenuIndicator",SA=y.forwardRef((a,u)=>{const{forceMount:c,...r}=a,s=Qt(cf,a.__scopeNavigationMenu),d=!!s.value;return s.indicatorTrack?Rg.createPortal(S.jsx(Nn,{present:c||d,children:S.jsx(xA,{...r,ref:u})}),s.indicatorTrack):null});SA.displayName=cf;var xA=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,...r}=a,s=Qt(cf,c),d=Pp(c),[m,v]=y.useState(null),[h,p]=y.useState(null),b=s.orientation==="horizontal",x=!!s.value;y.useEffect(()=>{var M;const R=(M=d().find(N=>N.value===s.value))==null?void 0:M.ref.current;R&&v(R)},[d,s.value]);const w=()=>{m&&p({size:b?m.offsetWidth:m.offsetHeight,offset:b?m.offsetLeft:m.offsetTop})};return Bs(m,w),Bs(s.indicatorTrack,w),h?S.jsx(Le.div,{"aria-hidden":!0,"data-state":x?"visible":"hidden","data-orientation":s.orientation,...r,ref:u,style:{position:"absolute",...b?{left:0,width:h.size+"px",transform:`translateX(${h.offset}px)`}:{top:0,height:h.size+"px",transform:`translateY(${h.offset}px)`},...r.style}}):null}),Ra="NavigationMenuContent",EA=y.forwardRef((a,u)=>{const{forceMount:c,...r}=a,s=Qt(Ra,a.__scopeNavigationMenu),d=iy(Ra,a.__scopeNavigationMenu),m=We(d.contentRef,u),v=d.value===s.value,h={value:d.value,triggerRef:d.triggerRef,focusProxyRef:d.focusProxyRef,wasEscapeCloseRef:d.wasEscapeCloseRef,onContentFocusOutside:d.onContentFocusOutside,onRootContentClose:d.onRootContentClose,...r};return s.viewport?S.jsx(wA,{forceMount:c,...h,ref:m}):S.jsx(Nn,{present:c||v,children:S.jsx(ry,{"data-state":df(v),...h,ref:m,onPointerEnter:fe(a.onPointerEnter,s.onContentEnter),onPointerLeave:fe(a.onPointerLeave,Oo(s.onContentLeave)),style:{pointerEvents:!v&&s.isRootMenu?"none":void 0,...h.style}})})});EA.displayName=Ra;var wA=y.forwardRef((a,u)=>{const c=Qt(Ra,a.__scopeNavigationMenu),{onViewportContentChange:r,onViewportContentRemove:s}=c;return $t(()=>{r(a.value,{ref:u,...a})},[a,u,r]),$t(()=>()=>s(a.value),[a.value,s]),null}),So="navigationMenu.rootContentDismiss",ry=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,value:r,triggerRef:s,focusProxyRef:d,wasEscapeCloseRef:m,onRootContentClose:v,onContentFocusOutside:h,...p}=a,b=Qt(Ra,c),x=y.useRef(null),w=We(x,u),C=fy(b.baseId,r),R=dy(b.baseId,r),M=Pp(c),N=y.useRef(null),{onItemDismiss:U}=b;y.useEffect(()=>{const L=x.current;if(b.isRootMenu&&L){const B=()=>{var K;U(),v(),L.contains(document.activeElement)&&((K=s.current)==null||K.focus())};return L.addEventListener(So,B),()=>L.removeEventListener(So,B)}},[b.isRootMenu,a.value,s,U,v]);const Q=y.useMemo(()=>{const B=M().map(se=>se.value);b.dir==="rtl"&&B.reverse();const K=B.indexOf(b.value),J=B.indexOf(b.previousValue),k=r===b.value,V=J===B.indexOf(r);if(!k&&!V)return N.current;const P=(()=>{if(K!==J){if(k&&J!==-1)return K>J?"from-end":"from-start";if(V&&K!==-1)return K>J?"to-start":"to-end"}return null})();return N.current=P,P},[b.previousValue,b.value,b.dir,M,r]);return S.jsx(cy,{asChild:!0,children:S.jsx(Xs,{id:R,"aria-labelledby":C,"data-motion":Q,"data-orientation":b.orientation,...p,ref:w,disableOutsidePointerEvents:!1,onDismiss:()=>{var B;const L=new Event(So,{bubbles:!0,cancelable:!0});(B=x.current)==null||B.dispatchEvent(L)},onFocusOutside:fe(a.onFocusOutside,L=>{var K;h();const B=L.target;(K=b.rootNavigationMenu)!=null&&K.contains(B)&&L.preventDefault()}),onPointerDownOutside:fe(a.onPointerDownOutside,L=>{var k;const B=L.target,K=M().some(V=>{var P;return(P=V.ref.current)==null?void 0:P.contains(B)}),J=b.isRootMenu&&((k=b.viewport)==null?void 0:k.contains(B));(K||J||!b.isRootMenu)&&L.preventDefault()}),onKeyDown:fe(a.onKeyDown,L=>{var J;const B=L.altKey||L.ctrlKey||L.metaKey;if(L.key==="Tab"&&!B){const k=Hs(L.currentTarget),V=document.activeElement,P=k.findIndex(de=>de===V),ve=L.shiftKey?k.slice(0,P).reverse():k.slice(P+1,k.length);ff(ve)?L.preventDefault():(J=d.current)==null||J.focus()}}),onEscapeKeyDown:fe(a.onEscapeKeyDown,L=>{m.current=!0})})})}),sf="NavigationMenuViewport",AA=y.forwardRef((a,u)=>{const{forceMount:c,...r}=a,d=!!Qt(sf,a.__scopeNavigationMenu).value;return S.jsx(Nn,{present:c||d,children:S.jsx(MA,{...r,ref:u})})});AA.displayName=sf;var MA=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,children:r,...s}=a,d=Qt(sf,c),m=We(u,d.onViewportChange),v=hA(Ra,a.__scopeNavigationMenu),[h,p]=y.useState(null),[b,x]=y.useState(null),w=h?(h==null?void 0:h.width)+"px":void 0,C=h?(h==null?void 0:h.height)+"px":void 0,R=!!d.value,M=R?d.value:d.previousValue;return Bs(b,()=>{b&&p({width:b.offsetWidth,height:b.offsetHeight})}),S.jsx(Le.div,{"data-state":df(R),"data-orientation":d.orientation,...s,ref:m,style:{pointerEvents:!R&&d.isRootMenu?"none":void 0,"--radix-navigation-menu-viewport-width":w,"--radix-navigation-menu-viewport-height":C,...s.style},onPointerEnter:fe(a.onPointerEnter,d.onContentEnter),onPointerLeave:fe(a.onPointerLeave,Oo(d.onContentLeave)),children:Array.from(v.items).map(([U,{ref:Q,forceMount:L,...B}])=>{const K=M===U;return S.jsx(Nn,{present:L||K,children:S.jsx(ry,{...B,ref:Gi(Q,J=>{K&&J&&x(J)})})},U)})})}),TA="FocusGroup",cy=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,...r}=a,s=Qt(TA,c);return S.jsx(js.Provider,{scope:c,children:S.jsx(js.Slot,{scope:c,children:S.jsx(Le.div,{dir:s.dir,...r,ref:u})})})}),ag=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"],CA="FocusGroupItem",sy=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,...r}=a,s=fA(c),d=Qt(CA,c);return S.jsx(js.ItemSlot,{scope:c,children:S.jsx(Le.button,{...r,ref:u,onKeyDown:fe(a.onKeyDown,m=>{if(["Home","End",...ag].includes(m.key)){let h=s().map(x=>x.ref.current);if([d.dir==="rtl"?"ArrowRight":"ArrowLeft","ArrowUp","End"].includes(m.key)&&h.reverse(),ag.includes(m.key)){const x=h.indexOf(m.currentTarget);h=h.slice(x+1)}setTimeout(()=>ff(h)),m.preventDefault()}})})})});function Hs(a){const u=[],c=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;c.nextNode();)u.push(c.currentNode);return u}function ff(a){const u=document.activeElement;return a.some(c=>c===u?!0:(c.focus(),document.activeElement!==u))}function RA(a){return a.forEach(u=>{u.dataset.tabindex=u.getAttribute("tabindex")||"",u.setAttribute("tabindex","-1")}),()=>{a.forEach(u=>{const c=u.dataset.tabindex;u.setAttribute("tabindex",c)})}}function Bs(a,u){const c=ot(u);$t(()=>{let r=0;if(a){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(c)});return s.observe(a),()=>{window.cancelAnimationFrame(r),s.unobserve(a)}}},[a,c])}function df(a){return a?"open":"closed"}function fy(a,u){return`${a}-trigger-${u}`}function dy(a,u){return`${a}-content-${u}`}function Oo(a){return u=>u.pointerType==="mouse"?a(u):void 0}var _A=ey,NA=ly,OA=uy,DA=oy;const zA=tA,jA=nA,my=y.forwardRef(({className:a,sideOffset:u=4,...c},r)=>S.jsx(lA,{children:S.jsx(aA,{ref:r,sideOffset:u,className:qe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in",a),...c})}));my.displayName="DropdownMenuContent";const xo=y.forwardRef(({className:a,inset:u,...c},r)=>S.jsx(uA,{ref:r,className:qe("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",u&&"pl-8",a),...c}));xo.displayName="DropdownMenuItem";const UA=y.forwardRef(({className:a,children:u,checked:c,...r},s)=>S.jsxs(oA,{ref:s,className:qe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:c,...r,children:[S.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:S.jsx(rA,{children:S.jsx(P0,{className:"h-4 w-4"})})}),u]}));UA.displayName="DropdownMenuCheckboxItem";const LA=y.forwardRef(({className:a,inset:u,...c},r)=>S.jsx(iA,{ref:r,className:qe("px-2 py-1.5 text-sm font-semibold",u&&"pl-8",a),...c}));LA.displayName="DropdownMenuLabel";const HA=y.forwardRef(({className:a,...u},c)=>S.jsx(cA,{ref:c,className:qe("-mx-1 my-1 h-px bg-muted",a),...u}));HA.displayName="DropdownMenuSeparator";function BA(){const{setTheme:a}=F0();return S.jsxs(zA,{children:[S.jsx(jA,{asChild:!0,children:S.jsxs(rl,{variant:"outline",size:"icon",className:"size-8",children:[S.jsx(wh,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),S.jsx(Eh,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),S.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),S.jsxs(my,{align:"end",children:[S.jsxs(xo,{onClick:()=>a("light"),children:[S.jsx(wh,{className:"mr-2 h-4 w-4"})," Light"]}),S.jsxs(xo,{onClick:()=>a("dark"),children:[S.jsx(Eh,{className:"mr-2 h-4 w-4"})," Dark"]}),S.jsxs(xo,{onClick:()=>a("system"),children:[S.jsx(tS,{className:"mr-2 h-4 w-4"})," System"]})]})]})}const Oi=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{ref:c,className:qe("rounded-xl border bg-card text-card-foreground",a),...u}));Oi.displayName="Card";const Di=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{ref:c,className:qe("flex flex-col space-y-1.5 p-6",a),...u}));Di.displayName="CardHeader";const zi=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{ref:c,className:qe("font-semibold leading-none tracking-tight",a),...u}));zi.displayName="CardTitle";const GA=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{ref:c,className:qe("text-sm text-muted-foreground",a),...u}));GA.displayName="CardDescription";const ji=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{ref:c,className:qe("p-6 pt-0",a),...u}));ji.displayName="CardContent";const YA=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{ref:c,className:qe("flex items-center p-6 pt-0",a),...u}));YA.displayName="CardFooter";function qA({stats:a}){return S.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[S.jsxs(Oi,{children:[S.jsx(Di,{children:S.jsx(zi,{children:"Total Invoices"})}),S.jsx(ji,{className:"text-3xl font-bold",children:a.total_invoices})]}),S.jsxs(Oi,{children:[S.jsx(Di,{children:S.jsx(zi,{children:"Sent / Paid"})}),S.jsxs(ji,{className:"text-3xl font-bold",children:[a.sent," / ",a.paid]})]}),S.jsxs(Oi,{children:[S.jsx(Di,{children:S.jsx(zi,{children:"Draft / Overdue"})}),S.jsxs(ji,{className:"text-3xl font-bold",children:[a.draft," / ",a.overdue]})]}),S.jsxs(Oi,{children:[S.jsx(Di,{children:S.jsx(zi,{children:"Parties / Agents"})}),S.jsxs(ji,{className:"text-3xl font-bold",children:[a.parties," / ",a.agents]})]})]})}const Vo=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{className:"relative w-full overflow-auto",children:S.jsx("table",{ref:c,className:qe("w-full caption-bottom text-sm",a),...u})}));Vo.displayName="Table";const Xo=y.forwardRef(({className:a,...u},c)=>S.jsx("thead",{ref:c,className:qe("[&_tr]:border-b",a),...u}));Xo.displayName="TableHeader";const Ko=y.forwardRef(({className:a,...u},c)=>S.jsx("tbody",{ref:c,className:qe("[&_tr:last-child]:border-0",a),...u}));Ko.displayName="TableBody";const kA=y.forwardRef(({className:a,...u},c)=>S.jsx("tfoot",{ref:c,className:qe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...u}));kA.displayName="TableFooter";const zl=y.forwardRef(({className:a,...u},c)=>S.jsx("tr",{ref:c,className:qe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...u}));zl.displayName="TableRow";const bt=y.forwardRef(({className:a,...u},c)=>S.jsx("th",{ref:c,className:qe("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...u}));bt.displayName="TableHead";const St=y.forwardRef(({className:a,...u},c)=>S.jsx("td",{ref:c,className:qe("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...u}));St.displayName="TableCell";const VA=y.forwardRef(({className:a,...u},c)=>S.jsx("caption",{ref:c,className:qe("mt-4 text-sm text-muted-foreground",a),...u}));VA.displayName="TableCaption";const XA=["draft","sent","partially_paid","paid","void","overdue"];function KA({data:a,onStatusChange:u,onRefresh:c}){const[r,s]=y.useState(null);async function d(m,v){s(m);try{await u(m,v)}finally{s(null)}}return S.jsxs("div",{className:"space-y-3",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("h2",{className:"text-lg font-semibold",children:"Invoices"}),S.jsx(rl,{variant:"outline",onClick:()=>void c(),children:"Refresh"})]}),S.jsxs(Vo,{children:[S.jsx(Xo,{children:S.jsxs(zl,{children:[S.jsx(bt,{children:"Number"}),S.jsx(bt,{children:"Status"}),S.jsx(bt,{children:"Total"}),S.jsx(bt,{children:"Issued"}),S.jsx(bt,{className:"text-right",children:"Actions"})]})}),S.jsx(Ko,{children:a.map(m=>S.jsxs(zl,{children:[S.jsx(St,{className:"font-medium",children:m.number}),S.jsx(St,{children:m.status}),S.jsxs(St,{children:[(m.total_cents/100).toFixed(2)," ",m.currency]}),S.jsx(St,{children:new Date(m.issued_at).toLocaleDateString()}),S.jsx(St,{className:"text-right",children:S.jsx("div",{className:"flex flex-wrap justify-end gap-1",children:XA.map(v=>S.jsx(rl,{size:"sm",variant:m.status===v?"default":"outline",disabled:r===m.id,onClick:()=>void d(m.id,v),children:v},v))})})]},m.id))})]})]})}const Do=y.forwardRef(({className:a,type:u,...c},r)=>S.jsx("input",{type:u,className:qe("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",a),ref:r,...c}));Do.displayName="Input";const ig="http://localhost:3487";function QA(){const[a,u]=y.useState([]),[c,r]=y.useState("issuer"),[s,d]=y.useState("");async function m(){const h=await fetch(`${ig}/api/parties`);h.ok&&u(await h.json())}y.useEffect(()=>{m()},[]);async function v(h){h.preventDefault(),s.trim()&&(await fetch(`${ig}/api/parties`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({kind:c,legal_name:s.trim()})}),d(""),await m())}return S.jsxs("div",{className:"space-y-4",children:[S.jsxs("form",{onSubmit:v,className:"flex flex-wrap items-end gap-2",children:[S.jsxs("div",{children:[S.jsx("label",{className:"mb-1 block text-sm text-muted-foreground",children:"Kind"}),S.jsxs("select",{value:c,onChange:h=>r(h.target.value),className:"h-10 rounded-md border px-3",children:[S.jsx("option",{value:"issuer",children:"issuer"}),S.jsx("option",{value:"customer",children:"customer"})]})]}),S.jsxs("div",{className:"min-w-[260px]",children:[S.jsx("label",{className:"mb-1 block text-sm text-muted-foreground",children:"Legal name"}),S.jsx(Do,{value:s,onChange:h=>d(h.target.value),placeholder:"Company SRL"})]}),S.jsx(rl,{type:"submit",children:"Create party"})]}),S.jsxs(Vo,{children:[S.jsx(Xo,{children:S.jsxs(zl,{children:[S.jsx(bt,{children:"Kind"}),S.jsx(bt,{children:"Legal Name"}),S.jsx(bt,{children:"Email"}),S.jsx(bt,{children:"Tax ID"})]})}),S.jsx(Ko,{children:a.map(h=>S.jsxs(zl,{children:[S.jsx(St,{children:h.kind}),S.jsx(St,{className:"font-medium",children:h.legal_name}),S.jsx(St,{children:h.email??"-"}),S.jsx(St,{children:h.tax_id??"-"})]},h.id))})]})]})}const ug="http://localhost:3487";function ZA(){const[a,u]=y.useState([]),[c,r]=y.useState(""),[s,d]=y.useState("");async function m(){const h=await fetch(`${ug}/api/agents`);h.ok&&u(await h.json())}y.useEffect(()=>{m()},[]);async function v(h){h.preventDefault(),c.trim()&&(await fetch(`${ug}/api/agents`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:c.trim(),description:s.trim()||void 0})}),r(""),d(""),await m())}return S.jsxs("div",{className:"space-y-4",children:[S.jsxs("form",{onSubmit:v,className:"flex flex-wrap items-end gap-2",children:[S.jsxs("div",{className:"min-w-[220px]",children:[S.jsx("label",{className:"mb-1 block text-sm text-muted-foreground",children:"Name"}),S.jsx(Do,{value:c,onChange:h=>r(h.target.value),placeholder:"agent-name"})]}),S.jsxs("div",{className:"min-w-[320px]",children:[S.jsx("label",{className:"mb-1 block text-sm text-muted-foreground",children:"Description"}),S.jsx(Do,{value:s,onChange:h=>d(h.target.value),placeholder:"role/intent"})]}),S.jsx(rl,{type:"submit",children:"Register"})]}),S.jsxs(Vo,{children:[S.jsx(Xo,{children:S.jsxs(zl,{children:[S.jsx(bt,{children:"Name"}),S.jsx(bt,{children:"Description"}),S.jsx(bt,{children:"Focus"}),S.jsx(bt,{children:"Last Seen"})]})}),S.jsx(Ko,{children:a.map(h=>S.jsxs(zl,{children:[S.jsx(St,{className:"font-medium",children:h.name}),S.jsx(St,{children:h.description??"-"}),S.jsx(St,{children:h.focus??"-"}),S.jsx(St,{children:new Date(h.last_seen_at).toLocaleString()})]},h.id))})]})]})}function JA(){return S.jsx("div",{className:"rounded-lg border bg-card p-4 text-sm text-muted-foreground",children:"Invoice plans/recurrence management UI will be expanded in upcoming tasks."})}function FA(){return S.jsxs("div",{className:"space-y-2 text-sm",children:[S.jsx("p",{className:"font-medium",children:"invoices Dashboard Help"}),S.jsx("p",{children:"1. Create issuers/customers in the Parties page."}),S.jsx("p",{children:"2. Create invoices via API/CLI and manage status in the Invoices page."}),S.jsx("p",{children:"3. Register agents and assign focus in the Agents page."}),S.jsx("p",{children:"4. Configure `VITE_API_BASE_URL` if API is not on `http://localhost:3487`."})]})}const vy=y.forwardRef(({className:a,children:u,...c},r)=>S.jsx(_A,{ref:r,className:qe("relative z-10 flex max-w-max flex-1 items-center justify-center",a),...c,children:u}));vy.displayName="NavigationMenu";const hy=y.forwardRef(({className:a,...u},c)=>S.jsx(NA,{ref:c,className:qe("group flex flex-1 list-none items-center justify-center gap-1",a),...u}));hy.displayName="NavigationMenuList";const IA=OA,$A=()=>"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50",WA=DA,Ms="http://localhost:3487",PA={total_invoices:0,draft:0,sent:0,partially_paid:0,paid:0,void:0,overdue:0,parties:0,issuers:0,customers:0,agents:0};function eM(){const[a,u]=y.useState("dashboard"),[c,r]=y.useState(PA),[s,d]=y.useState([]),[m,v]=y.useState(!1),[h,p]=y.useState(null);function b(R,M){p({message:R,type:M}),setTimeout(()=>p(null),3e3)}const x=y.useCallback(async()=>{v(!0);try{const[R,M]=await Promise.all([fetch(`${Ms}/api/stats`),fetch(`${Ms}/api/invoices?limit=100`)]);if(!R.ok||!M.ok)throw new Error("Failed to load dashboard data");r(await R.json()),d(await M.json())}catch(R){b(R instanceof Error?R.message:String(R),"error")}finally{v(!1)}},[]);y.useEffect(()=>{x()},[x]);async function w(R,M){const N=await fetch(`${Ms}/api/invoices/${R}/status`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({status:M})});if(!N.ok)throw new Error(`Status update failed (${N.status})`);b(`Invoice updated to ${M}`,"success"),await x()}const C=[{key:"dashboard",label:"Dashboard"},{key:"tasks",label:"Invoices"},{key:"projects",label:"Parties"},{key:"plans",label:"Plans"},{key:"agents",label:"Agents"}];return S.jsxs("div",{className:"min-h-screen",children:[S.jsx("header",{className:"border-b",children:S.jsxs("div",{className:"mx-auto flex h-14 max-w-6xl items-center justify-between px-6",children:[S.jsxs("div",{className:"flex items-center gap-4",children:[S.jsxs("button",{className:"flex items-center gap-3 hover:opacity-80 transition-opacity",onClick:()=>u("dashboard"),children:[S.jsx("img",{src:"/logo.jpg",alt:"Hasna",className:"h-7 w-auto rounded"}),S.jsxs("h1",{className:"text-base font-semibold",children:["Hasna ",S.jsx("span",{className:"font-normal text-muted-foreground",children:"Invoices"})]})]}),S.jsx(vy,{children:S.jsx(hy,{children:C.map(R=>S.jsx(IA,{children:S.jsx(WA,{className:$A(),"data-active":a===R.key?"":void 0,onClick:()=>u(R.key),style:{cursor:"pointer"},children:R.label})},R.key))})})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(rl,{variant:"outline",size:"icon",className:"size-8",onClick:()=>void x(),disabled:m,children:S.jsx(nS,{className:`size-4 ${m?"animate-spin":""}`})}),S.jsx(rl,{variant:a==="help"?"secondary":"outline",size:"icon",className:"size-8",onClick:()=>u("help"),children:S.jsx(eS,{className:"size-4"})}),S.jsx(BA,{})]})]})}),S.jsxs("main",{className:"mx-auto max-w-6xl space-y-6 px-6 py-6",children:[a==="dashboard"&&S.jsx(qA,{stats:c}),a==="tasks"&&S.jsx(KA,{data:s,onStatusChange:w,onRefresh:x}),a==="projects"&&S.jsx(QA,{}),a==="plans"&&S.jsx(JA,{}),a==="agents"&&S.jsx(ZA,{}),a==="help"&&S.jsx(FA,{})]}),h&&S.jsx("div",{className:`fixed bottom-6 right-6 z-50 rounded-lg border px-4 py-3 text-sm shadow-lg ${h.type==="success"?"border-green-200 bg-green-50 text-green-800 dark:border-green-900 dark:bg-green-950 dark:text-green-200":"border-red-200 bg-red-50 text-red-800 dark:border-red-900 dark:bg-red-950 dark:text-red-200"}`,children:h.message})]})}Z0.createRoot(document.getElementById("root")).render(S.jsx(y.StrictMode,{children:S.jsx(J0,{defaultTheme:"light",children:S.jsx(eM,{})})}));
139
+ `)},r1=0,wa=[];function c1(a){var u=y.useRef([]),c=y.useRef([0,0]),r=y.useRef(),s=y.useState(r1++)[0],d=y.useState(Bg)[0],m=y.useRef(a);y.useEffect(function(){m.current=a},[a]),y.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(s));var M=Nx([a.lockRef.current],(a.shards||[]).map(Xh),!0).filter(Boolean);return M.forEach(function(N){return N.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),M.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(s))})}}},[a.inert,a.lockRef.current,a.shards]);var v=y.useCallback(function(M,N){if("touches"in M&&M.touches.length===2||M.type==="wheel"&&M.ctrlKey)return!m.current.allowPinchZoom;var U=mo(M),Q=c.current,L="deltaX"in M?M.deltaX:Q[0]-U[0],B="deltaY"in M?M.deltaY:Q[1]-U[1],K,J=M.target,k=Math.abs(L)>Math.abs(B)?"h":"v";if("touches"in M&&k==="h"&&J.type==="range")return!1;var V=window.getSelection(),P=V&&V.anchorNode,se=P?P===J||P.contains(J):!1;if(se)return!1;var ve=kh(k,J);if(!ve)return!0;if(ve?K=k:(K=k==="v"?"h":"v",ve=kh(k,J)),!ve)return!1;if(!r.current&&"changedTouches"in M&&(L||B)&&(r.current=K),!K)return!0;var de=r.current||K;return i1(de,N,M,de==="h"?L:B)},[]),h=y.useCallback(function(M){var N=M;if(!(!wa.length||wa[wa.length-1]!==d)){var U="deltaY"in N?Vh(N):mo(N),Q=u.current.filter(function(K){return K.name===N.type&&(K.target===N.target||N.target===K.shadowParent)&&u1(K.delta,U)})[0];if(Q&&Q.should){N.cancelable&&N.preventDefault();return}if(!Q){var L=(m.current.shards||[]).map(Xh).filter(Boolean).filter(function(K){return K.contains(N.target)}),B=L.length>0?v(N,L[0]):!m.current.noIsolation;B&&N.cancelable&&N.preventDefault()}}},[]),p=y.useCallback(function(M,N,U,Q){var L={name:M,delta:N,target:U,should:Q,shadowParent:s1(U)};u.current.push(L),setTimeout(function(){u.current=u.current.filter(function(B){return B!==L})},1)},[]),b=y.useCallback(function(M){c.current=mo(M),r.current=void 0},[]),x=y.useCallback(function(M){p(M.type,Vh(M),M.target,v(M,a.lockRef.current))},[]),w=y.useCallback(function(M){p(M.type,mo(M),M.target,v(M,a.lockRef.current))},[]);y.useEffect(function(){return wa.push(d),a.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:w}),document.addEventListener("wheel",h,Ea),document.addEventListener("touchmove",h,Ea),document.addEventListener("touchstart",b,Ea),function(){wa=wa.filter(function(M){return M!==d}),document.removeEventListener("wheel",h,Ea),document.removeEventListener("touchmove",h,Ea),document.removeEventListener("touchstart",b,Ea)}},[]);var C=a.removeScrollBar,R=a.inert;return y.createElement(y.Fragment,null,R?y.createElement(d,{styles:o1(s)}):null,C?y.createElement(Wx,{noRelative:a.noRelative,gapMode:a.gapMode}):null)}function s1(a){for(var u=null;a!==null;)a instanceof ShadowRoot&&(u=a.host,a=a.host),a=a.parentNode;return u}const f1=Gx(Hg,c1);var kg=y.forwardRef(function(a,u){return y.createElement(Uo,an({},a,{ref:u,sideCar:f1}))});kg.classNames=Uo.classNames;var d1=function(a){if(typeof document>"u")return null;var u=Array.isArray(a)?a[0]:a;return u.ownerDocument.body},Aa=new WeakMap,vo=new WeakMap,ho={},Ss=0,Vg=function(a){return a&&(a.host||Vg(a.parentNode))},m1=function(a,u){return u.map(function(c){if(a.contains(c))return c;var r=Vg(c);return r&&a.contains(r)?r:(console.error("aria-hidden",c,"in not contained inside",a,". Doing nothing"),null)}).filter(function(c){return!!c})},v1=function(a,u,c,r){var s=m1(u,Array.isArray(a)?a:[a]);ho[c]||(ho[c]=new WeakMap);var d=ho[c],m=[],v=new Set,h=new Set(s),p=function(x){!x||v.has(x)||(v.add(x),p(x.parentNode))};s.forEach(p);var b=function(x){!x||h.has(x)||Array.prototype.forEach.call(x.children,function(w){if(v.has(w))b(w);else try{var C=w.getAttribute(r),R=C!==null&&C!=="false",M=(Aa.get(w)||0)+1,N=(d.get(w)||0)+1;Aa.set(w,M),d.set(w,N),m.push(w),M===1&&R&&vo.set(w,!0),N===1&&w.setAttribute(c,"true"),R||w.setAttribute(r,"true")}catch(U){console.error("aria-hidden: cannot operate on ",w,U)}})};return b(u),v.clear(),Ss++,function(){m.forEach(function(x){var w=Aa.get(x)-1,C=d.get(x)-1;Aa.set(x,w),d.set(x,C),w||(vo.has(x)||x.removeAttribute(r),vo.delete(x)),C||x.removeAttribute(c)}),Ss--,Ss||(Aa=new WeakMap,Aa=new WeakMap,vo=new WeakMap,ho={})}},h1=function(a,u,c){c===void 0&&(c="data-aria-hidden");var r=Array.from(Array.isArray(a)?a:[a]),s=d1(a);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),v1(r,s,c,"aria-hidden")):function(){return null}};function g1(a){const u=y.useRef({value:a,previous:a});return y.useMemo(()=>(u.current.value!==a&&(u.current.previous=u.current.value,u.current.value=a),u.current.previous),[a])}function p1(a){const[u,c]=y.useState(void 0);return $t(()=>{if(a){c({width:a.offsetWidth,height:a.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const d=s[0];let m,v;if("borderBoxSize"in d){const h=d.borderBoxSize,p=Array.isArray(h)?h[0]:h;m=p.inlineSize,v=p.blockSize}else m=a.offsetWidth,v=a.offsetHeight;c({width:m,height:v})});return r.observe(a,{box:"border-box"}),()=>r.unobserve(a)}else c(void 0)},[a]),u}const y1=["top","right","bottom","left"],cl=Math.min,Ot=Math.max,Mo=Math.round,go=Math.floor,on=a=>({x:a,y:a}),b1={left:"right",right:"left",bottom:"top",top:"bottom"};function _s(a,u,c){return Ot(a,cl(u,c))}function Rn(a,u){return typeof a=="function"?a(u):a}function _n(a){return a.split("-")[0]}function Oa(a){return a.split("-")[1]}function Ks(a){return a==="x"?"y":"x"}function Qs(a){return a==="y"?"height":"width"}function un(a){const u=a[0];return u==="t"||u==="b"?"y":"x"}function Zs(a){return Ks(un(a))}function S1(a,u,c){c===void 0&&(c=!1);const r=Oa(a),s=Zs(a),d=Qs(s);let m=s==="x"?r===(c?"end":"start")?"right":"left":r==="start"?"bottom":"top";return u.reference[d]>u.floating[d]&&(m=To(m)),[m,To(m)]}function x1(a){const u=To(a);return[Ns(a),u,Ns(u)]}function Ns(a){return a.includes("start")?a.replace("start","end"):a.replace("end","start")}const Kh=["left","right"],Qh=["right","left"],E1=["top","bottom"],w1=["bottom","top"];function A1(a,u,c){switch(a){case"top":case"bottom":return c?u?Qh:Kh:u?Kh:Qh;case"left":case"right":return u?E1:w1;default:return[]}}function M1(a,u,c,r){const s=Oa(a);let d=A1(_n(a),c==="start",r);return s&&(d=d.map(m=>m+"-"+s),u&&(d=d.concat(d.map(Ns)))),d}function To(a){const u=_n(a);return b1[u]+a.slice(u.length)}function T1(a){return{top:0,right:0,bottom:0,left:0,...a}}function Xg(a){return typeof a!="number"?T1(a):{top:a,right:a,bottom:a,left:a}}function Co(a){const{x:u,y:c,width:r,height:s}=a;return{width:r,height:s,top:c,left:u,right:u+r,bottom:c+s,x:u,y:c}}function Zh(a,u,c){let{reference:r,floating:s}=a;const d=un(u),m=Zs(u),v=Qs(m),h=_n(u),p=d==="y",b=r.x+r.width/2-s.width/2,x=r.y+r.height/2-s.height/2,w=r[v]/2-s[v]/2;let C;switch(h){case"top":C={x:b,y:r.y-s.height};break;case"bottom":C={x:b,y:r.y+r.height};break;case"right":C={x:r.x+r.width,y:x};break;case"left":C={x:r.x-s.width,y:x};break;default:C={x:r.x,y:r.y}}switch(Oa(u)){case"start":C[m]-=w*(c&&p?-1:1);break;case"end":C[m]+=w*(c&&p?-1:1);break}return C}async function C1(a,u){var c;u===void 0&&(u={});const{x:r,y:s,platform:d,rects:m,elements:v,strategy:h}=a,{boundary:p="clippingAncestors",rootBoundary:b="viewport",elementContext:x="floating",altBoundary:w=!1,padding:C=0}=Rn(u,a),R=Xg(C),N=v[w?x==="floating"?"reference":"floating":x],U=Co(await d.getClippingRect({element:(c=await(d.isElement==null?void 0:d.isElement(N)))==null||c?N:N.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(v.floating)),boundary:p,rootBoundary:b,strategy:h})),Q=x==="floating"?{x:r,y:s,width:m.floating.width,height:m.floating.height}:m.reference,L=await(d.getOffsetParent==null?void 0:d.getOffsetParent(v.floating)),B=await(d.isElement==null?void 0:d.isElement(L))?await(d.getScale==null?void 0:d.getScale(L))||{x:1,y:1}:{x:1,y:1},K=Co(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:v,rect:Q,offsetParent:L,strategy:h}):Q);return{top:(U.top-K.top+R.top)/B.y,bottom:(K.bottom-U.bottom+R.bottom)/B.y,left:(U.left-K.left+R.left)/B.x,right:(K.right-U.right+R.right)/B.x}}const R1=50,_1=async(a,u,c)=>{const{placement:r="bottom",strategy:s="absolute",middleware:d=[],platform:m}=c,v=m.detectOverflow?m:{...m,detectOverflow:C1},h=await(m.isRTL==null?void 0:m.isRTL(u));let p=await m.getElementRects({reference:a,floating:u,strategy:s}),{x:b,y:x}=Zh(p,r,h),w=r,C=0;const R={};for(let M=0;M<d.length;M++){const N=d[M];if(!N)continue;const{name:U,fn:Q}=N,{x:L,y:B,data:K,reset:J}=await Q({x:b,y:x,initialPlacement:r,placement:w,strategy:s,middlewareData:R,rects:p,platform:v,elements:{reference:a,floating:u}});b=L??b,x=B??x,R[U]={...R[U],...K},J&&C<R1&&(C++,typeof J=="object"&&(J.placement&&(w=J.placement),J.rects&&(p=J.rects===!0?await m.getElementRects({reference:a,floating:u,strategy:s}):J.rects),{x:b,y:x}=Zh(p,w,h)),M=-1)}return{x:b,y:x,placement:w,strategy:s,middlewareData:R}},N1=a=>({name:"arrow",options:a,async fn(u){const{x:c,y:r,placement:s,rects:d,platform:m,elements:v,middlewareData:h}=u,{element:p,padding:b=0}=Rn(a,u)||{};if(p==null)return{};const x=Xg(b),w={x:c,y:r},C=Zs(s),R=Qs(C),M=await m.getDimensions(p),N=C==="y",U=N?"top":"left",Q=N?"bottom":"right",L=N?"clientHeight":"clientWidth",B=d.reference[R]+d.reference[C]-w[C]-d.floating[R],K=w[C]-d.reference[C],J=await(m.getOffsetParent==null?void 0:m.getOffsetParent(p));let k=J?J[L]:0;(!k||!await(m.isElement==null?void 0:m.isElement(J)))&&(k=v.floating[L]||d.floating[R]);const V=B/2-K/2,P=k/2-M[R]/2-1,se=cl(x[U],P),ve=cl(x[Q],P),de=se,Me=k-M[R]-ve,ye=k/2-M[R]/2+V,Ee=_s(de,ye,Me),O=!h.arrow&&Oa(s)!=null&&ye!==Ee&&d.reference[R]/2-(ye<de?se:ve)-M[R]/2<0,Z=O?ye<de?ye-de:ye-Me:0;return{[C]:w[C]+Z,data:{[C]:Ee,centerOffset:ye-Ee-Z,...O&&{alignmentOffset:Z}},reset:O}}}),O1=function(a){return a===void 0&&(a={}),{name:"flip",options:a,async fn(u){var c,r;const{placement:s,middlewareData:d,rects:m,initialPlacement:v,platform:h,elements:p}=u,{mainAxis:b=!0,crossAxis:x=!0,fallbackPlacements:w,fallbackStrategy:C="bestFit",fallbackAxisSideDirection:R="none",flipAlignment:M=!0,...N}=Rn(a,u);if((c=d.arrow)!=null&&c.alignmentOffset)return{};const U=_n(s),Q=un(v),L=_n(v)===v,B=await(h.isRTL==null?void 0:h.isRTL(p.floating)),K=w||(L||!M?[To(v)]:x1(v)),J=R!=="none";!w&&J&&K.push(...M1(v,M,R,B));const k=[v,...K],V=await h.detectOverflow(u,N),P=[];let se=((r=d.flip)==null?void 0:r.overflows)||[];if(b&&P.push(V[U]),x){const ye=S1(s,m,B);P.push(V[ye[0]],V[ye[1]])}if(se=[...se,{placement:s,overflows:P}],!P.every(ye=>ye<=0)){var ve,de;const ye=(((ve=d.flip)==null?void 0:ve.index)||0)+1,Ee=k[ye];if(Ee&&(!(x==="alignment"?Q!==un(Ee):!1)||se.every(I=>un(I.placement)===Q?I.overflows[0]>0:!0)))return{data:{index:ye,overflows:se},reset:{placement:Ee}};let O=(de=se.filter(Z=>Z.overflows[0]<=0).sort((Z,I)=>Z.overflows[1]-I.overflows[1])[0])==null?void 0:de.placement;if(!O)switch(C){case"bestFit":{var Me;const Z=(Me=se.filter(I=>{if(J){const $=un(I.placement);return $===Q||$==="y"}return!0}).map(I=>[I.placement,I.overflows.filter($=>$>0).reduce(($,F)=>$+F,0)]).sort((I,$)=>I[1]-$[1])[0])==null?void 0:Me[0];Z&&(O=Z);break}case"initialPlacement":O=v;break}if(s!==O)return{reset:{placement:O}}}return{}}}};function Jh(a,u){return{top:a.top-u.height,right:a.right-u.width,bottom:a.bottom-u.height,left:a.left-u.width}}function Fh(a){return y1.some(u=>a[u]>=0)}const D1=function(a){return a===void 0&&(a={}),{name:"hide",options:a,async fn(u){const{rects:c,platform:r}=u,{strategy:s="referenceHidden",...d}=Rn(a,u);switch(s){case"referenceHidden":{const m=await r.detectOverflow(u,{...d,elementContext:"reference"}),v=Jh(m,c.reference);return{data:{referenceHiddenOffsets:v,referenceHidden:Fh(v)}}}case"escaped":{const m=await r.detectOverflow(u,{...d,altBoundary:!0}),v=Jh(m,c.floating);return{data:{escapedOffsets:v,escaped:Fh(v)}}}default:return{}}}}},Kg=new Set(["left","top"]);async function z1(a,u){const{placement:c,platform:r,elements:s}=a,d=await(r.isRTL==null?void 0:r.isRTL(s.floating)),m=_n(c),v=Oa(c),h=un(c)==="y",p=Kg.has(m)?-1:1,b=d&&h?-1:1,x=Rn(u,a);let{mainAxis:w,crossAxis:C,alignmentAxis:R}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return v&&typeof R=="number"&&(C=v==="end"?R*-1:R),h?{x:C*b,y:w*p}:{x:w*p,y:C*b}}const j1=function(a){return a===void 0&&(a=0),{name:"offset",options:a,async fn(u){var c,r;const{x:s,y:d,placement:m,middlewareData:v}=u,h=await z1(u,a);return m===((c=v.offset)==null?void 0:c.placement)&&(r=v.arrow)!=null&&r.alignmentOffset?{}:{x:s+h.x,y:d+h.y,data:{...h,placement:m}}}}},U1=function(a){return a===void 0&&(a={}),{name:"shift",options:a,async fn(u){const{x:c,y:r,placement:s,platform:d}=u,{mainAxis:m=!0,crossAxis:v=!1,limiter:h={fn:U=>{let{x:Q,y:L}=U;return{x:Q,y:L}}},...p}=Rn(a,u),b={x:c,y:r},x=await d.detectOverflow(u,p),w=un(_n(s)),C=Ks(w);let R=b[C],M=b[w];if(m){const U=C==="y"?"top":"left",Q=C==="y"?"bottom":"right",L=R+x[U],B=R-x[Q];R=_s(L,R,B)}if(v){const U=w==="y"?"top":"left",Q=w==="y"?"bottom":"right",L=M+x[U],B=M-x[Q];M=_s(L,M,B)}const N=h.fn({...u,[C]:R,[w]:M});return{...N,data:{x:N.x-c,y:N.y-r,enabled:{[C]:m,[w]:v}}}}}},L1=function(a){return a===void 0&&(a={}),{options:a,fn(u){const{x:c,y:r,placement:s,rects:d,middlewareData:m}=u,{offset:v=0,mainAxis:h=!0,crossAxis:p=!0}=Rn(a,u),b={x:c,y:r},x=un(s),w=Ks(x);let C=b[w],R=b[x];const M=Rn(v,u),N=typeof M=="number"?{mainAxis:M,crossAxis:0}:{mainAxis:0,crossAxis:0,...M};if(h){const L=w==="y"?"height":"width",B=d.reference[w]-d.floating[L]+N.mainAxis,K=d.reference[w]+d.reference[L]-N.mainAxis;C<B?C=B:C>K&&(C=K)}if(p){var U,Q;const L=w==="y"?"width":"height",B=Kg.has(_n(s)),K=d.reference[x]-d.floating[L]+(B&&((U=m.offset)==null?void 0:U[x])||0)+(B?0:N.crossAxis),J=d.reference[x]+d.reference[L]+(B?0:((Q=m.offset)==null?void 0:Q[x])||0)-(B?N.crossAxis:0);R<K?R=K:R>J&&(R=J)}return{[w]:C,[x]:R}}}},H1=function(a){return a===void 0&&(a={}),{name:"size",options:a,async fn(u){var c,r;const{placement:s,rects:d,platform:m,elements:v}=u,{apply:h=()=>{},...p}=Rn(a,u),b=await m.detectOverflow(u,p),x=_n(s),w=Oa(s),C=un(s)==="y",{width:R,height:M}=d.floating;let N,U;x==="top"||x==="bottom"?(N=x,U=w===(await(m.isRTL==null?void 0:m.isRTL(v.floating))?"start":"end")?"left":"right"):(U=x,N=w==="end"?"top":"bottom");const Q=M-b.top-b.bottom,L=R-b.left-b.right,B=cl(M-b[N],Q),K=cl(R-b[U],L),J=!u.middlewareData.shift;let k=B,V=K;if((c=u.middlewareData.shift)!=null&&c.enabled.x&&(V=L),(r=u.middlewareData.shift)!=null&&r.enabled.y&&(k=Q),J&&!w){const se=Ot(b.left,0),ve=Ot(b.right,0),de=Ot(b.top,0),Me=Ot(b.bottom,0);C?V=R-2*(se!==0||ve!==0?se+ve:Ot(b.left,b.right)):k=M-2*(de!==0||Me!==0?de+Me:Ot(b.top,b.bottom))}await h({...u,availableWidth:V,availableHeight:k});const P=await m.getDimensions(v.floating);return R!==P.width||M!==P.height?{reset:{rects:!0}}:{}}}};function Lo(){return typeof window<"u"}function Da(a){return Qg(a)?(a.nodeName||"").toLowerCase():"#document"}function Dt(a){var u;return(a==null||(u=a.ownerDocument)==null?void 0:u.defaultView)||window}function rn(a){var u;return(u=(Qg(a)?a.ownerDocument:a.document)||window.document)==null?void 0:u.documentElement}function Qg(a){return Lo()?a instanceof Node||a instanceof Dt(a).Node:!1}function Wt(a){return Lo()?a instanceof Element||a instanceof Dt(a).Element:!1}function On(a){return Lo()?a instanceof HTMLElement||a instanceof Dt(a).HTMLElement:!1}function Ih(a){return!Lo()||typeof ShadowRoot>"u"?!1:a instanceof ShadowRoot||a instanceof Dt(a).ShadowRoot}function Yi(a){const{overflow:u,overflowX:c,overflowY:r,display:s}=Pt(a);return/auto|scroll|overlay|hidden|clip/.test(u+r+c)&&s!=="inline"&&s!=="contents"}function B1(a){return/^(table|td|th)$/.test(Da(a))}function Ho(a){try{if(a.matches(":popover-open"))return!0}catch{}try{return a.matches(":modal")}catch{return!1}}const G1=/transform|translate|scale|rotate|perspective|filter/,Y1=/paint|layout|strict|content/,Ol=a=>!!a&&a!=="none";let xs;function Js(a){const u=Wt(a)?Pt(a):a;return Ol(u.transform)||Ol(u.translate)||Ol(u.scale)||Ol(u.rotate)||Ol(u.perspective)||!Fs()&&(Ol(u.backdropFilter)||Ol(u.filter))||G1.test(u.willChange||"")||Y1.test(u.contain||"")}function q1(a){let u=sl(a);for(;On(u)&&!Ca(u);){if(Js(u))return u;if(Ho(u))return null;u=sl(u)}return null}function Fs(){return xs==null&&(xs=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),xs}function Ca(a){return/^(html|body|#document)$/.test(Da(a))}function Pt(a){return Dt(a).getComputedStyle(a)}function Bo(a){return Wt(a)?{scrollLeft:a.scrollLeft,scrollTop:a.scrollTop}:{scrollLeft:a.scrollX,scrollTop:a.scrollY}}function sl(a){if(Da(a)==="html")return a;const u=a.assignedSlot||a.parentNode||Ih(a)&&a.host||rn(a);return Ih(u)?u.host:u}function Zg(a){const u=sl(a);return Ca(u)?a.ownerDocument?a.ownerDocument.body:a.body:On(u)&&Yi(u)?u:Zg(u)}function Li(a,u,c){var r;u===void 0&&(u=[]),c===void 0&&(c=!0);const s=Zg(a),d=s===((r=a.ownerDocument)==null?void 0:r.body),m=Dt(s);if(d){const v=Os(m);return u.concat(m,m.visualViewport||[],Yi(s)?s:[],v&&c?Li(v):[])}else return u.concat(s,Li(s,[],c))}function Os(a){return a.parent&&Object.getPrototypeOf(a.parent)?a.frameElement:null}function Jg(a){const u=Pt(a);let c=parseFloat(u.width)||0,r=parseFloat(u.height)||0;const s=On(a),d=s?a.offsetWidth:c,m=s?a.offsetHeight:r,v=Mo(c)!==d||Mo(r)!==m;return v&&(c=d,r=m),{width:c,height:r,$:v}}function Is(a){return Wt(a)?a:a.contextElement}function Ta(a){const u=Is(a);if(!On(u))return on(1);const c=u.getBoundingClientRect(),{width:r,height:s,$:d}=Jg(u);let m=(d?Mo(c.width):c.width)/r,v=(d?Mo(c.height):c.height)/s;return(!m||!Number.isFinite(m))&&(m=1),(!v||!Number.isFinite(v))&&(v=1),{x:m,y:v}}const k1=on(0);function Fg(a){const u=Dt(a);return!Fs()||!u.visualViewport?k1:{x:u.visualViewport.offsetLeft,y:u.visualViewport.offsetTop}}function V1(a,u,c){return u===void 0&&(u=!1),!c||u&&c!==Dt(a)?!1:u}function Dl(a,u,c,r){u===void 0&&(u=!1),c===void 0&&(c=!1);const s=a.getBoundingClientRect(),d=Is(a);let m=on(1);u&&(r?Wt(r)&&(m=Ta(r)):m=Ta(a));const v=V1(d,c,r)?Fg(d):on(0);let h=(s.left+v.x)/m.x,p=(s.top+v.y)/m.y,b=s.width/m.x,x=s.height/m.y;if(d){const w=Dt(d),C=r&&Wt(r)?Dt(r):r;let R=w,M=Os(R);for(;M&&r&&C!==R;){const N=Ta(M),U=M.getBoundingClientRect(),Q=Pt(M),L=U.left+(M.clientLeft+parseFloat(Q.paddingLeft))*N.x,B=U.top+(M.clientTop+parseFloat(Q.paddingTop))*N.y;h*=N.x,p*=N.y,b*=N.x,x*=N.y,h+=L,p+=B,R=Dt(M),M=Os(R)}}return Co({width:b,height:x,x:h,y:p})}function Go(a,u){const c=Bo(a).scrollLeft;return u?u.left+c:Dl(rn(a)).left+c}function Ig(a,u){const c=a.getBoundingClientRect(),r=c.left+u.scrollLeft-Go(a,c),s=c.top+u.scrollTop;return{x:r,y:s}}function X1(a){let{elements:u,rect:c,offsetParent:r,strategy:s}=a;const d=s==="fixed",m=rn(r),v=u?Ho(u.floating):!1;if(r===m||v&&d)return c;let h={scrollLeft:0,scrollTop:0},p=on(1);const b=on(0),x=On(r);if((x||!x&&!d)&&((Da(r)!=="body"||Yi(m))&&(h=Bo(r)),x)){const C=Dl(r);p=Ta(r),b.x=C.x+r.clientLeft,b.y=C.y+r.clientTop}const w=m&&!x&&!d?Ig(m,h):on(0);return{width:c.width*p.x,height:c.height*p.y,x:c.x*p.x-h.scrollLeft*p.x+b.x+w.x,y:c.y*p.y-h.scrollTop*p.y+b.y+w.y}}function K1(a){return Array.from(a.getClientRects())}function Q1(a){const u=rn(a),c=Bo(a),r=a.ownerDocument.body,s=Ot(u.scrollWidth,u.clientWidth,r.scrollWidth,r.clientWidth),d=Ot(u.scrollHeight,u.clientHeight,r.scrollHeight,r.clientHeight);let m=-c.scrollLeft+Go(a);const v=-c.scrollTop;return Pt(r).direction==="rtl"&&(m+=Ot(u.clientWidth,r.clientWidth)-s),{width:s,height:d,x:m,y:v}}const $h=25;function Z1(a,u){const c=Dt(a),r=rn(a),s=c.visualViewport;let d=r.clientWidth,m=r.clientHeight,v=0,h=0;if(s){d=s.width,m=s.height;const b=Fs();(!b||b&&u==="fixed")&&(v=s.offsetLeft,h=s.offsetTop)}const p=Go(r);if(p<=0){const b=r.ownerDocument,x=b.body,w=getComputedStyle(x),C=b.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,R=Math.abs(r.clientWidth-x.clientWidth-C);R<=$h&&(d-=R)}else p<=$h&&(d+=p);return{width:d,height:m,x:v,y:h}}function J1(a,u){const c=Dl(a,!0,u==="fixed"),r=c.top+a.clientTop,s=c.left+a.clientLeft,d=On(a)?Ta(a):on(1),m=a.clientWidth*d.x,v=a.clientHeight*d.y,h=s*d.x,p=r*d.y;return{width:m,height:v,x:h,y:p}}function Wh(a,u,c){let r;if(u==="viewport")r=Z1(a,c);else if(u==="document")r=Q1(rn(a));else if(Wt(u))r=J1(u,c);else{const s=Fg(a);r={x:u.x-s.x,y:u.y-s.y,width:u.width,height:u.height}}return Co(r)}function $g(a,u){const c=sl(a);return c===u||!Wt(c)||Ca(c)?!1:Pt(c).position==="fixed"||$g(c,u)}function F1(a,u){const c=u.get(a);if(c)return c;let r=Li(a,[],!1).filter(v=>Wt(v)&&Da(v)!=="body"),s=null;const d=Pt(a).position==="fixed";let m=d?sl(a):a;for(;Wt(m)&&!Ca(m);){const v=Pt(m),h=Js(m);!h&&v.position==="fixed"&&(s=null),(d?!h&&!s:!h&&v.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Yi(m)&&!h&&$g(a,m))?r=r.filter(b=>b!==m):s=v,m=sl(m)}return u.set(a,r),r}function I1(a){let{element:u,boundary:c,rootBoundary:r,strategy:s}=a;const m=[...c==="clippingAncestors"?Ho(u)?[]:F1(u,this._c):[].concat(c),r],v=Wh(u,m[0],s);let h=v.top,p=v.right,b=v.bottom,x=v.left;for(let w=1;w<m.length;w++){const C=Wh(u,m[w],s);h=Ot(C.top,h),p=cl(C.right,p),b=cl(C.bottom,b),x=Ot(C.left,x)}return{width:p-x,height:b-h,x,y:h}}function $1(a){const{width:u,height:c}=Jg(a);return{width:u,height:c}}function W1(a,u,c){const r=On(u),s=rn(u),d=c==="fixed",m=Dl(a,!0,d,u);let v={scrollLeft:0,scrollTop:0};const h=on(0);function p(){h.x=Go(s)}if(r||!r&&!d)if((Da(u)!=="body"||Yi(s))&&(v=Bo(u)),r){const C=Dl(u,!0,d,u);h.x=C.x+u.clientLeft,h.y=C.y+u.clientTop}else s&&p();d&&!r&&s&&p();const b=s&&!r&&!d?Ig(s,v):on(0),x=m.left+v.scrollLeft-h.x-b.x,w=m.top+v.scrollTop-h.y-b.y;return{x,y:w,width:m.width,height:m.height}}function Es(a){return Pt(a).position==="static"}function Ph(a,u){if(!On(a)||Pt(a).position==="fixed")return null;if(u)return u(a);let c=a.offsetParent;return rn(a)===c&&(c=c.ownerDocument.body),c}function Wg(a,u){const c=Dt(a);if(Ho(a))return c;if(!On(a)){let s=sl(a);for(;s&&!Ca(s);){if(Wt(s)&&!Es(s))return s;s=sl(s)}return c}let r=Ph(a,u);for(;r&&B1(r)&&Es(r);)r=Ph(r,u);return r&&Ca(r)&&Es(r)&&!Js(r)?c:r||q1(a)||c}const P1=async function(a){const u=this.getOffsetParent||Wg,c=this.getDimensions,r=await c(a.floating);return{reference:W1(a.reference,await u(a.floating),a.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function eE(a){return Pt(a).direction==="rtl"}const tE={convertOffsetParentRelativeRectToViewportRelativeRect:X1,getDocumentElement:rn,getClippingRect:I1,getOffsetParent:Wg,getElementRects:P1,getClientRects:K1,getDimensions:$1,getScale:Ta,isElement:Wt,isRTL:eE};function Pg(a,u){return a.x===u.x&&a.y===u.y&&a.width===u.width&&a.height===u.height}function nE(a,u){let c=null,r;const s=rn(a);function d(){var v;clearTimeout(r),(v=c)==null||v.disconnect(),c=null}function m(v,h){v===void 0&&(v=!1),h===void 0&&(h=1),d();const p=a.getBoundingClientRect(),{left:b,top:x,width:w,height:C}=p;if(v||u(),!w||!C)return;const R=go(x),M=go(s.clientWidth-(b+w)),N=go(s.clientHeight-(x+C)),U=go(b),L={rootMargin:-R+"px "+-M+"px "+-N+"px "+-U+"px",threshold:Ot(0,cl(1,h))||1};let B=!0;function K(J){const k=J[0].intersectionRatio;if(k!==h){if(!B)return m();k?m(!1,k):r=setTimeout(()=>{m(!1,1e-7)},1e3)}k===1&&!Pg(p,a.getBoundingClientRect())&&m(),B=!1}try{c=new IntersectionObserver(K,{...L,root:s.ownerDocument})}catch{c=new IntersectionObserver(K,L)}c.observe(a)}return m(!0),d}function lE(a,u,c,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:d=!0,elementResize:m=typeof ResizeObserver=="function",layoutShift:v=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,p=Is(a),b=s||d?[...p?Li(p):[],...u?Li(u):[]]:[];b.forEach(U=>{s&&U.addEventListener("scroll",c,{passive:!0}),d&&U.addEventListener("resize",c)});const x=p&&v?nE(p,c):null;let w=-1,C=null;m&&(C=new ResizeObserver(U=>{let[Q]=U;Q&&Q.target===p&&C&&u&&(C.unobserve(u),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var L;(L=C)==null||L.observe(u)})),c()}),p&&!h&&C.observe(p),u&&C.observe(u));let R,M=h?Dl(a):null;h&&N();function N(){const U=Dl(a);M&&!Pg(M,U)&&c(),M=U,R=requestAnimationFrame(N)}return c(),()=>{var U;b.forEach(Q=>{s&&Q.removeEventListener("scroll",c),d&&Q.removeEventListener("resize",c)}),x==null||x(),(U=C)==null||U.disconnect(),C=null,h&&cancelAnimationFrame(R)}}const aE=j1,iE=U1,uE=O1,oE=H1,rE=D1,eg=N1,cE=L1,sE=(a,u,c)=>{const r=new Map,s={platform:tE,...c},d={...s.platform,_c:r};return _1(a,u,{...s,platform:d})};var fE=typeof document<"u",dE=function(){},bo=fE?y.useLayoutEffect:dE;function Ro(a,u){if(a===u)return!0;if(typeof a!=typeof u)return!1;if(typeof a=="function"&&a.toString()===u.toString())return!0;let c,r,s;if(a&&u&&typeof a=="object"){if(Array.isArray(a)){if(c=a.length,c!==u.length)return!1;for(r=c;r--!==0;)if(!Ro(a[r],u[r]))return!1;return!0}if(s=Object.keys(a),c=s.length,c!==Object.keys(u).length)return!1;for(r=c;r--!==0;)if(!{}.hasOwnProperty.call(u,s[r]))return!1;for(r=c;r--!==0;){const d=s[r];if(!(d==="_owner"&&a.$$typeof)&&!Ro(a[d],u[d]))return!1}return!0}return a!==a&&u!==u}function ep(a){return typeof window>"u"?1:(a.ownerDocument.defaultView||window).devicePixelRatio||1}function tg(a,u){const c=ep(a);return Math.round(u*c)/c}function ws(a){const u=y.useRef(a);return bo(()=>{u.current=a}),u}function mE(a){a===void 0&&(a={});const{placement:u="bottom",strategy:c="absolute",middleware:r=[],platform:s,elements:{reference:d,floating:m}={},transform:v=!0,whileElementsMounted:h,open:p}=a,[b,x]=y.useState({x:0,y:0,strategy:c,placement:u,middlewareData:{},isPositioned:!1}),[w,C]=y.useState(r);Ro(w,r)||C(r);const[R,M]=y.useState(null),[N,U]=y.useState(null),Q=y.useCallback(I=>{I!==J.current&&(J.current=I,M(I))},[]),L=y.useCallback(I=>{I!==k.current&&(k.current=I,U(I))},[]),B=d||R,K=m||N,J=y.useRef(null),k=y.useRef(null),V=y.useRef(b),P=h!=null,se=ws(h),ve=ws(s),de=ws(p),Me=y.useCallback(()=>{if(!J.current||!k.current)return;const I={placement:u,strategy:c,middleware:w};ve.current&&(I.platform=ve.current),sE(J.current,k.current,I).then($=>{const F={...$,isPositioned:de.current!==!1};ye.current&&!Ro(V.current,F)&&(V.current=F,ks.flushSync(()=>{x(F)}))})},[w,u,c,ve,de]);bo(()=>{p===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,x(I=>({...I,isPositioned:!1})))},[p]);const ye=y.useRef(!1);bo(()=>(ye.current=!0,()=>{ye.current=!1}),[]),bo(()=>{if(B&&(J.current=B),K&&(k.current=K),B&&K){if(se.current)return se.current(B,K,Me);Me()}},[B,K,Me,se,P]);const Ee=y.useMemo(()=>({reference:J,floating:k,setReference:Q,setFloating:L}),[Q,L]),O=y.useMemo(()=>({reference:B,floating:K}),[B,K]),Z=y.useMemo(()=>{const I={position:c,left:0,top:0};if(!O.floating)return I;const $=tg(O.floating,b.x),F=tg(O.floating,b.y);return v?{...I,transform:"translate("+$+"px, "+F+"px)",...ep(O.floating)>=1.5&&{willChange:"transform"}}:{position:c,left:$,top:F}},[c,v,O.floating,b.x,b.y]);return y.useMemo(()=>({...b,update:Me,refs:Ee,elements:O,floatingStyles:Z}),[b,Me,Ee,O,Z])}const vE=a=>{function u(c){return{}.hasOwnProperty.call(c,"current")}return{name:"arrow",options:a,fn(c){const{element:r,padding:s}=typeof a=="function"?a(c):a;return r&&u(r)?r.current!=null?eg({element:r.current,padding:s}).fn(c):{}:r?eg({element:r,padding:s}).fn(c):{}}}},hE=(a,u)=>{const c=aE(a);return{name:c.name,fn:c.fn,options:[a,u]}},gE=(a,u)=>{const c=iE(a);return{name:c.name,fn:c.fn,options:[a,u]}},pE=(a,u)=>({fn:cE(a).fn,options:[a,u]}),yE=(a,u)=>{const c=uE(a);return{name:c.name,fn:c.fn,options:[a,u]}},bE=(a,u)=>{const c=oE(a);return{name:c.name,fn:c.fn,options:[a,u]}},SE=(a,u)=>{const c=rE(a);return{name:c.name,fn:c.fn,options:[a,u]}},xE=(a,u)=>{const c=vE(a);return{name:c.name,fn:c.fn,options:[a,u]}};var EE="Arrow",tp=y.forwardRef((a,u)=>{const{children:c,width:r=10,height:s=5,...d}=a;return S.jsx(Le.svg,{...d,ref:u,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:a.asChild?c:S.jsx("polygon",{points:"0,0 30,0 15,10"})})});tp.displayName=EE;var wE=tp,$s="Popper",[np,lp]=Na($s),[AE,ap]=np($s),ip=a=>{const{__scopePopper:u,children:c}=a,[r,s]=y.useState(null);return S.jsx(AE,{scope:u,anchor:r,onAnchorChange:s,children:c})};ip.displayName=$s;var up="PopperAnchor",op=y.forwardRef((a,u)=>{const{__scopePopper:c,virtualRef:r,...s}=a,d=ap(up,c),m=y.useRef(null),v=We(u,m),h=y.useRef(null);return y.useEffect(()=>{const p=h.current;h.current=(r==null?void 0:r.current)||m.current,p!==h.current&&d.onAnchorChange(h.current)}),r?null:S.jsx(Le.div,{...s,ref:v})});op.displayName=up;var Ws="PopperContent",[ME,TE]=np(Ws),rp=y.forwardRef((a,u)=>{var me,Ge,re,ft,zt,Zt;const{__scopePopper:c,side:r="bottom",sideOffset:s=0,align:d="center",alignOffset:m=0,arrowPadding:v=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:b=0,sticky:x="partial",hideWhenDetached:w=!1,updatePositionStrategy:C="optimized",onPlaced:R,...M}=a,N=ap(Ws,c),[U,Q]=y.useState(null),L=We(u,jt=>Q(jt)),[B,K]=y.useState(null),J=p1(B),k=(J==null?void 0:J.width)??0,V=(J==null?void 0:J.height)??0,P=r+(d!=="center"?"-"+d:""),se=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},ve=Array.isArray(p)?p:[p],de=ve.length>0,Me={padding:se,boundary:ve.filter(RE),altBoundary:de},{refs:ye,floatingStyles:Ee,placement:O,isPositioned:Z,middlewareData:I}=mE({strategy:"fixed",placement:P,whileElementsMounted:(...jt)=>lE(...jt,{animationFrame:C==="always"}),elements:{reference:N.anchor},middleware:[hE({mainAxis:s+V,alignmentAxis:m}),h&&gE({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?pE():void 0,...Me}),h&&yE({...Me}),bE({...Me,apply:({elements:jt,rects:rt,availableWidth:za,availableHeight:ja})=>{const{width:Qo,height:Xi}=rt.reference,Dn=jt.floating.style;Dn.setProperty("--radix-popper-available-width",`${za}px`),Dn.setProperty("--radix-popper-available-height",`${ja}px`),Dn.setProperty("--radix-popper-anchor-width",`${Qo}px`),Dn.setProperty("--radix-popper-anchor-height",`${Xi}px`)}}),B&&xE({element:B,padding:v}),_E({arrowWidth:k,arrowHeight:V}),w&&SE({strategy:"referenceHidden",...Me})]}),[$,F]=fp(O),A=ot(R);$t(()=>{Z&&(A==null||A())},[Z,A]);const Y=(me=I.arrow)==null?void 0:me.x,W=(Ge=I.arrow)==null?void 0:Ge.y,ee=((re=I.arrow)==null?void 0:re.centerOffset)!==0,[le,ie]=y.useState();return $t(()=>{U&&ie(window.getComputedStyle(U).zIndex)},[U]),S.jsx("div",{ref:ye.setFloating,"data-radix-popper-content-wrapper":"",style:{...Ee,transform:Z?Ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[(ft=I.transformOrigin)==null?void 0:ft.x,(zt=I.transformOrigin)==null?void 0:zt.y].join(" "),...((Zt=I.hide)==null?void 0:Zt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:a.dir,children:S.jsx(ME,{scope:c,placedSide:$,onArrowChange:K,arrowX:Y,arrowY:W,shouldHideArrow:ee,children:S.jsx(Le.div,{"data-side":$,"data-align":F,...M,ref:L,style:{...M.style,animation:Z?void 0:"none"}})})})});rp.displayName=Ws;var cp="PopperArrow",CE={top:"bottom",right:"left",bottom:"top",left:"right"},sp=y.forwardRef(function(u,c){const{__scopePopper:r,...s}=u,d=TE(cp,r),m=CE[d.placedSide];return S.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[m]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[d.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[d.placedSide],visibility:d.shouldHideArrow?"hidden":void 0},children:S.jsx(wE,{...s,ref:c,style:{...s.style,display:"block"}})})});sp.displayName=cp;function RE(a){return a!==null}var _E=a=>({name:"transformOrigin",options:a,fn(u){var N,U,Q;const{placement:c,rects:r,middlewareData:s}=u,m=((N=s.arrow)==null?void 0:N.centerOffset)!==0,v=m?0:a.arrowWidth,h=m?0:a.arrowHeight,[p,b]=fp(c),x={start:"0%",center:"50%",end:"100%"}[b],w=(((U=s.arrow)==null?void 0:U.x)??0)+v/2,C=(((Q=s.arrow)==null?void 0:Q.y)??0)+h/2;let R="",M="";return p==="bottom"?(R=m?x:`${w}px`,M=`${-h}px`):p==="top"?(R=m?x:`${w}px`,M=`${r.floating.height+h}px`):p==="right"?(R=`${-h}px`,M=m?x:`${C}px`):p==="left"&&(R=`${r.floating.width+h}px`,M=m?x:`${C}px`),{data:{x:R,y:M}}}});function fp(a){const[u,c="center"]=a.split("-");return[u,c]}var NE=ip,OE=op,DE=rp,zE=sp,As="rovingFocusGroup.onEntryFocus",jE={bubbles:!1,cancelable:!0},qi="RovingFocusGroup",[Ds,dp,UE]=zo(qi),[LE,mp]=Na(qi,[UE]),[HE,BE]=LE(qi),vp=y.forwardRef((a,u)=>S.jsx(Ds.Provider,{scope:a.__scopeRovingFocusGroup,children:S.jsx(Ds.Slot,{scope:a.__scopeRovingFocusGroup,children:S.jsx(GE,{...a,ref:u})})}));vp.displayName=qi;var GE=y.forwardRef((a,u)=>{const{__scopeRovingFocusGroup:c,orientation:r,loop:s=!1,dir:d,currentTabStopId:m,defaultCurrentTabStopId:v,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:b=!1,...x}=a,w=y.useRef(null),C=We(u,w),R=Vs(d),[M,N]=jo({prop:m,defaultProp:v??null,onChange:h,caller:qi}),[U,Q]=y.useState(!1),L=ot(p),B=dp(c),K=y.useRef(!1),[J,k]=y.useState(0);return y.useEffect(()=>{const V=w.current;if(V)return V.addEventListener(As,L),()=>V.removeEventListener(As,L)},[L]),S.jsx(HE,{scope:c,orientation:r,dir:R,loop:s,currentTabStopId:M,onItemFocus:y.useCallback(V=>N(V),[N]),onItemShiftTab:y.useCallback(()=>Q(!0),[]),onFocusableItemAdd:y.useCallback(()=>k(V=>V+1),[]),onFocusableItemRemove:y.useCallback(()=>k(V=>V-1),[]),children:S.jsx(Le.div,{tabIndex:U||J===0?-1:0,"data-orientation":r,...x,ref:C,style:{outline:"none",...a.style},onMouseDown:fe(a.onMouseDown,()=>{K.current=!0}),onFocus:fe(a.onFocus,V=>{const P=!K.current;if(V.target===V.currentTarget&&P&&!U){const se=new CustomEvent(As,jE);if(V.currentTarget.dispatchEvent(se),!se.defaultPrevented){const ve=B().filter(O=>O.focusable),de=ve.find(O=>O.active),Me=ve.find(O=>O.id===M),Ee=[de,Me,...ve].filter(Boolean).map(O=>O.ref.current);pp(Ee,b)}}K.current=!1}),onBlur:fe(a.onBlur,()=>Q(!1))})})}),hp="RovingFocusGroupItem",gp=y.forwardRef((a,u)=>{const{__scopeRovingFocusGroup:c,focusable:r=!0,active:s=!1,tabStopId:d,children:m,...v}=a,h=Ui(),p=d||h,b=BE(hp,c),x=b.currentTabStopId===p,w=dp(c),{onFocusableItemAdd:C,onFocusableItemRemove:R,currentTabStopId:M}=b;return y.useEffect(()=>{if(r)return C(),()=>R()},[r,C,R]),S.jsx(Ds.ItemSlot,{scope:c,id:p,focusable:r,active:s,children:S.jsx(Le.span,{tabIndex:x?0:-1,"data-orientation":b.orientation,...v,ref:u,onMouseDown:fe(a.onMouseDown,N=>{r?b.onItemFocus(p):N.preventDefault()}),onFocus:fe(a.onFocus,()=>b.onItemFocus(p)),onKeyDown:fe(a.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){b.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const U=kE(N,b.orientation,b.dir);if(U!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let L=w().filter(B=>B.focusable).map(B=>B.ref.current);if(U==="last")L.reverse();else if(U==="prev"||U==="next"){U==="prev"&&L.reverse();const B=L.indexOf(N.currentTarget);L=b.loop?VE(L,B+1):L.slice(B+1)}setTimeout(()=>pp(L))}}),children:typeof m=="function"?m({isCurrentTabStop:x,hasTabStop:M!=null}):m})})});gp.displayName=hp;var YE={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function qE(a,u){return u!=="rtl"?a:a==="ArrowLeft"?"ArrowRight":a==="ArrowRight"?"ArrowLeft":a}function kE(a,u,c){const r=qE(a.key,c);if(!(u==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(u==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return YE[r]}function pp(a,u=!1){const c=document.activeElement;for(const r of a)if(r===c||(r.focus({preventScroll:u}),document.activeElement!==c))return}function VE(a,u){return a.map((c,r)=>a[(u+r)%a.length])}var XE=vp,KE=gp,zs=["Enter"," "],QE=["ArrowDown","PageUp","Home"],yp=["ArrowUp","PageDown","End"],ZE=[...QE,...yp],JE={ltr:[...zs,"ArrowRight"],rtl:[...zs,"ArrowLeft"]},FE={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ki="Menu",[Hi,IE,$E]=zo(ki),[Ul,bp]=Na(ki,[$E,lp,mp]),Yo=lp(),Sp=mp(),[WE,Ll]=Ul(ki),[PE,Vi]=Ul(ki),xp=a=>{const{__scopeMenu:u,open:c=!1,children:r,dir:s,onOpenChange:d,modal:m=!0}=a,v=Yo(u),[h,p]=y.useState(null),b=y.useRef(!1),x=ot(d),w=Vs(s);return y.useEffect(()=>{const C=()=>{b.current=!0,document.addEventListener("pointerdown",R,{capture:!0,once:!0}),document.addEventListener("pointermove",R,{capture:!0,once:!0})},R=()=>b.current=!1;return document.addEventListener("keydown",C,{capture:!0}),()=>{document.removeEventListener("keydown",C,{capture:!0}),document.removeEventListener("pointerdown",R,{capture:!0}),document.removeEventListener("pointermove",R,{capture:!0})}},[]),S.jsx(NE,{...v,children:S.jsx(WE,{scope:u,open:c,onOpenChange:x,content:h,onContentChange:p,children:S.jsx(PE,{scope:u,onClose:y.useCallback(()=>x(!1),[x]),isUsingKeyboardRef:b,dir:w,modal:m,children:r})})})};xp.displayName=ki;var ew="MenuAnchor",Ps=y.forwardRef((a,u)=>{const{__scopeMenu:c,...r}=a,s=Yo(c);return S.jsx(OE,{...s,...r,ref:u})});Ps.displayName=ew;var ef="MenuPortal",[tw,Ep]=Ul(ef,{forceMount:void 0}),wp=a=>{const{__scopeMenu:u,forceMount:c,children:r,container:s}=a,d=Ll(ef,u);return S.jsx(tw,{scope:u,forceMount:c,children:S.jsx(Nn,{present:c||d.open,children:S.jsx(jg,{asChild:!0,container:s,children:r})})})};wp.displayName=ef;var Kt="MenuContent",[nw,tf]=Ul(Kt),Ap=y.forwardRef((a,u)=>{const c=Ep(Kt,a.__scopeMenu),{forceMount:r=c.forceMount,...s}=a,d=Ll(Kt,a.__scopeMenu),m=Vi(Kt,a.__scopeMenu);return S.jsx(Hi.Provider,{scope:a.__scopeMenu,children:S.jsx(Nn,{present:r||d.open,children:S.jsx(Hi.Slot,{scope:a.__scopeMenu,children:m.modal?S.jsx(lw,{...s,ref:u}):S.jsx(aw,{...s,ref:u})})})})}),lw=y.forwardRef((a,u)=>{const c=Ll(Kt,a.__scopeMenu),r=y.useRef(null),s=We(u,r);return y.useEffect(()=>{const d=r.current;if(d)return h1(d)},[]),S.jsx(nf,{...a,ref:s,trapFocus:c.open,disableOutsidePointerEvents:c.open,disableOutsideScroll:!0,onFocusOutside:fe(a.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>c.onOpenChange(!1)})}),aw=y.forwardRef((a,u)=>{const c=Ll(Kt,a.__scopeMenu);return S.jsx(nf,{...a,ref:u,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>c.onOpenChange(!1)})}),iw=wo("MenuContent.ScrollLock"),nf=y.forwardRef((a,u)=>{const{__scopeMenu:c,loop:r=!1,trapFocus:s,onOpenAutoFocus:d,onCloseAutoFocus:m,disableOutsidePointerEvents:v,onEntryFocus:h,onEscapeKeyDown:p,onPointerDownOutside:b,onFocusOutside:x,onInteractOutside:w,onDismiss:C,disableOutsideScroll:R,...M}=a,N=Ll(Kt,c),U=Vi(Kt,c),Q=Yo(c),L=Sp(c),B=IE(c),[K,J]=y.useState(null),k=y.useRef(null),V=We(u,k,N.onContentChange),P=y.useRef(0),se=y.useRef(""),ve=y.useRef(0),de=y.useRef(null),Me=y.useRef("right"),ye=y.useRef(0),Ee=R?kg:y.Fragment,O=R?{as:iw,allowPinchZoom:!0}:void 0,Z=$=>{var me,Ge;const F=se.current+$,A=B().filter(re=>!re.disabled),Y=document.activeElement,W=(me=A.find(re=>re.ref.current===Y))==null?void 0:me.textValue,ee=A.map(re=>re.textValue),le=pw(ee,F,W),ie=(Ge=A.find(re=>re.textValue===le))==null?void 0:Ge.ref.current;(function re(ft){se.current=ft,window.clearTimeout(P.current),ft!==""&&(P.current=window.setTimeout(()=>re(""),1e3))})(F),ie&&setTimeout(()=>ie.focus())};y.useEffect(()=>()=>window.clearTimeout(P.current),[]),_x();const I=y.useCallback($=>{var A,Y;return Me.current===((A=de.current)==null?void 0:A.side)&&bw($,(Y=de.current)==null?void 0:Y.area)},[]);return S.jsx(nw,{scope:c,searchRef:se,onItemEnter:y.useCallback($=>{I($)&&$.preventDefault()},[I]),onItemLeave:y.useCallback($=>{var F;I($)||((F=k.current)==null||F.focus(),J(null))},[I]),onTriggerLeave:y.useCallback($=>{I($)&&$.preventDefault()},[I]),pointerGraceTimerRef:ve,onPointerGraceIntentChange:y.useCallback($=>{de.current=$},[]),children:S.jsx(Ee,{...O,children:S.jsx(Dg,{asChild:!0,trapped:s,onMountAutoFocus:fe(d,$=>{var F;$.preventDefault(),(F=k.current)==null||F.focus({preventScroll:!0})}),onUnmountAutoFocus:m,children:S.jsx(Xs,{asChild:!0,disableOutsidePointerEvents:v,onEscapeKeyDown:p,onPointerDownOutside:b,onFocusOutside:x,onInteractOutside:w,onDismiss:C,children:S.jsx(XE,{asChild:!0,...L,dir:U.dir,orientation:"vertical",loop:r,currentTabStopId:K,onCurrentTabStopIdChange:J,onEntryFocus:fe(h,$=>{U.isUsingKeyboardRef.current||$.preventDefault()}),preventScrollOnEntryFocus:!0,children:S.jsx(DE,{role:"menu","aria-orientation":"vertical","data-state":Yp(N.open),"data-radix-menu-content":"",dir:U.dir,...Q,...M,ref:V,style:{outline:"none",...M.style},onKeyDown:fe(M.onKeyDown,$=>{const A=$.target.closest("[data-radix-menu-content]")===$.currentTarget,Y=$.ctrlKey||$.altKey||$.metaKey,W=$.key.length===1;A&&($.key==="Tab"&&$.preventDefault(),!Y&&W&&Z($.key));const ee=k.current;if($.target!==ee||!ZE.includes($.key))return;$.preventDefault();const ie=B().filter(me=>!me.disabled).map(me=>me.ref.current);yp.includes($.key)&&ie.reverse(),hw(ie)}),onBlur:fe(a.onBlur,$=>{$.currentTarget.contains($.target)||(window.clearTimeout(P.current),se.current="")}),onPointerMove:fe(a.onPointerMove,Bi($=>{const F=$.target,A=ye.current!==$.clientX;if($.currentTarget.contains(F)&&A){const Y=$.clientX>ye.current?"right":"left";Me.current=Y,ye.current=$.clientX}}))})})})})})})});Ap.displayName=Kt;var uw="MenuGroup",lf=y.forwardRef((a,u)=>{const{__scopeMenu:c,...r}=a;return S.jsx(Le.div,{role:"group",...r,ref:u})});lf.displayName=uw;var ow="MenuLabel",Mp=y.forwardRef((a,u)=>{const{__scopeMenu:c,...r}=a;return S.jsx(Le.div,{...r,ref:u})});Mp.displayName=ow;var _o="MenuItem",ng="menu.itemSelect",qo=y.forwardRef((a,u)=>{const{disabled:c=!1,onSelect:r,...s}=a,d=y.useRef(null),m=Vi(_o,a.__scopeMenu),v=tf(_o,a.__scopeMenu),h=We(u,d),p=y.useRef(!1),b=()=>{const x=d.current;if(!c&&x){const w=new CustomEvent(ng,{bubbles:!0,cancelable:!0});x.addEventListener(ng,C=>r==null?void 0:r(C),{once:!0}),Ao(x,w),w.defaultPrevented?p.current=!1:m.onClose()}};return S.jsx(Tp,{...s,ref:h,disabled:c,onClick:fe(a.onClick,b),onPointerDown:x=>{var w;(w=a.onPointerDown)==null||w.call(a,x),p.current=!0},onPointerUp:fe(a.onPointerUp,x=>{var w;p.current||(w=x.currentTarget)==null||w.click()}),onKeyDown:fe(a.onKeyDown,x=>{const w=v.searchRef.current!=="";c||w&&x.key===" "||zs.includes(x.key)&&(x.currentTarget.click(),x.preventDefault())})})});qo.displayName=_o;var Tp=y.forwardRef((a,u)=>{const{__scopeMenu:c,disabled:r=!1,textValue:s,...d}=a,m=tf(_o,c),v=Sp(c),h=y.useRef(null),p=We(u,h),[b,x]=y.useState(!1),[w,C]=y.useState("");return y.useEffect(()=>{const R=h.current;R&&C((R.textContent??"").trim())},[d.children]),S.jsx(Hi.ItemSlot,{scope:c,disabled:r,textValue:s??w,children:S.jsx(KE,{asChild:!0,...v,focusable:!r,children:S.jsx(Le.div,{role:"menuitem","data-highlighted":b?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...d,ref:p,onPointerMove:fe(a.onPointerMove,Bi(R=>{r?m.onItemLeave(R):(m.onItemEnter(R),R.defaultPrevented||R.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:fe(a.onPointerLeave,Bi(R=>m.onItemLeave(R))),onFocus:fe(a.onFocus,()=>x(!0)),onBlur:fe(a.onBlur,()=>x(!1))})})})}),rw="MenuCheckboxItem",Cp=y.forwardRef((a,u)=>{const{checked:c=!1,onCheckedChange:r,...s}=a;return S.jsx(Dp,{scope:a.__scopeMenu,checked:c,children:S.jsx(qo,{role:"menuitemcheckbox","aria-checked":No(c)?"mixed":c,...s,ref:u,"data-state":uf(c),onSelect:fe(s.onSelect,()=>r==null?void 0:r(No(c)?!0:!c),{checkForDefaultPrevented:!1})})})});Cp.displayName=rw;var Rp="MenuRadioGroup",[cw,sw]=Ul(Rp,{value:void 0,onValueChange:()=>{}}),_p=y.forwardRef((a,u)=>{const{value:c,onValueChange:r,...s}=a,d=ot(r);return S.jsx(cw,{scope:a.__scopeMenu,value:c,onValueChange:d,children:S.jsx(lf,{...s,ref:u})})});_p.displayName=Rp;var Np="MenuRadioItem",Op=y.forwardRef((a,u)=>{const{value:c,...r}=a,s=sw(Np,a.__scopeMenu),d=c===s.value;return S.jsx(Dp,{scope:a.__scopeMenu,checked:d,children:S.jsx(qo,{role:"menuitemradio","aria-checked":d,...r,ref:u,"data-state":uf(d),onSelect:fe(r.onSelect,()=>{var m;return(m=s.onValueChange)==null?void 0:m.call(s,c)},{checkForDefaultPrevented:!1})})})});Op.displayName=Np;var af="MenuItemIndicator",[Dp,fw]=Ul(af,{checked:!1}),zp=y.forwardRef((a,u)=>{const{__scopeMenu:c,forceMount:r,...s}=a,d=fw(af,c);return S.jsx(Nn,{present:r||No(d.checked)||d.checked===!0,children:S.jsx(Le.span,{...s,ref:u,"data-state":uf(d.checked)})})});zp.displayName=af;var dw="MenuSeparator",jp=y.forwardRef((a,u)=>{const{__scopeMenu:c,...r}=a;return S.jsx(Le.div,{role:"separator","aria-orientation":"horizontal",...r,ref:u})});jp.displayName=dw;var mw="MenuArrow",Up=y.forwardRef((a,u)=>{const{__scopeMenu:c,...r}=a,s=Yo(c);return S.jsx(zE,{...s,...r,ref:u})});Up.displayName=mw;var vw="MenuSub",[tM,Lp]=Ul(vw),Ni="MenuSubTrigger",Hp=y.forwardRef((a,u)=>{const c=Ll(Ni,a.__scopeMenu),r=Vi(Ni,a.__scopeMenu),s=Lp(Ni,a.__scopeMenu),d=tf(Ni,a.__scopeMenu),m=y.useRef(null),{pointerGraceTimerRef:v,onPointerGraceIntentChange:h}=d,p={__scopeMenu:a.__scopeMenu},b=y.useCallback(()=>{m.current&&window.clearTimeout(m.current),m.current=null},[]);return y.useEffect(()=>b,[b]),y.useEffect(()=>{const x=v.current;return()=>{window.clearTimeout(x),h(null)}},[v,h]),S.jsx(Ps,{asChild:!0,...p,children:S.jsx(Tp,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":s.contentId,"data-state":Yp(c.open),...a,ref:Gi(u,s.onTriggerChange),onClick:x=>{var w;(w=a.onClick)==null||w.call(a,x),!(a.disabled||x.defaultPrevented)&&(x.currentTarget.focus(),c.open||c.onOpenChange(!0))},onPointerMove:fe(a.onPointerMove,Bi(x=>{d.onItemEnter(x),!x.defaultPrevented&&!a.disabled&&!c.open&&!m.current&&(d.onPointerGraceIntentChange(null),m.current=window.setTimeout(()=>{c.onOpenChange(!0),b()},100))})),onPointerLeave:fe(a.onPointerLeave,Bi(x=>{var C,R;b();const w=(C=c.content)==null?void 0:C.getBoundingClientRect();if(w){const M=(R=c.content)==null?void 0:R.dataset.side,N=M==="right",U=N?-5:5,Q=w[N?"left":"right"],L=w[N?"right":"left"];d.onPointerGraceIntentChange({area:[{x:x.clientX+U,y:x.clientY},{x:Q,y:w.top},{x:L,y:w.top},{x:L,y:w.bottom},{x:Q,y:w.bottom}],side:M}),window.clearTimeout(v.current),v.current=window.setTimeout(()=>d.onPointerGraceIntentChange(null),300)}else{if(d.onTriggerLeave(x),x.defaultPrevented)return;d.onPointerGraceIntentChange(null)}})),onKeyDown:fe(a.onKeyDown,x=>{var C;const w=d.searchRef.current!=="";a.disabled||w&&x.key===" "||JE[r.dir].includes(x.key)&&(c.onOpenChange(!0),(C=c.content)==null||C.focus(),x.preventDefault())})})})});Hp.displayName=Ni;var Bp="MenuSubContent",Gp=y.forwardRef((a,u)=>{const c=Ep(Kt,a.__scopeMenu),{forceMount:r=c.forceMount,...s}=a,d=Ll(Kt,a.__scopeMenu),m=Vi(Kt,a.__scopeMenu),v=Lp(Bp,a.__scopeMenu),h=y.useRef(null),p=We(u,h);return S.jsx(Hi.Provider,{scope:a.__scopeMenu,children:S.jsx(Nn,{present:r||d.open,children:S.jsx(Hi.Slot,{scope:a.__scopeMenu,children:S.jsx(nf,{id:v.contentId,"aria-labelledby":v.triggerId,...s,ref:p,align:"start",side:m.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:b=>{var x;m.isUsingKeyboardRef.current&&((x=h.current)==null||x.focus()),b.preventDefault()},onCloseAutoFocus:b=>b.preventDefault(),onFocusOutside:fe(a.onFocusOutside,b=>{b.target!==v.trigger&&d.onOpenChange(!1)}),onEscapeKeyDown:fe(a.onEscapeKeyDown,b=>{m.onClose(),b.preventDefault()}),onKeyDown:fe(a.onKeyDown,b=>{var C;const x=b.currentTarget.contains(b.target),w=FE[m.dir].includes(b.key);x&&w&&(d.onOpenChange(!1),(C=v.trigger)==null||C.focus(),b.preventDefault())})})})})})});Gp.displayName=Bp;function Yp(a){return a?"open":"closed"}function No(a){return a==="indeterminate"}function uf(a){return No(a)?"indeterminate":a?"checked":"unchecked"}function hw(a){const u=document.activeElement;for(const c of a)if(c===u||(c.focus(),document.activeElement!==u))return}function gw(a,u){return a.map((c,r)=>a[(u+r)%a.length])}function pw(a,u,c){const s=u.length>1&&Array.from(u).every(p=>p===u[0])?u[0]:u,d=c?a.indexOf(c):-1;let m=gw(a,Math.max(d,0));s.length===1&&(m=m.filter(p=>p!==c));const h=m.find(p=>p.toLowerCase().startsWith(s.toLowerCase()));return h!==c?h:void 0}function yw(a,u){const{x:c,y:r}=a;let s=!1;for(let d=0,m=u.length-1;d<u.length;m=d++){const v=u[d],h=u[m],p=v.x,b=v.y,x=h.x,w=h.y;b>r!=w>r&&c<(x-p)*(r-b)/(w-b)+p&&(s=!s)}return s}function bw(a,u){if(!u)return!1;const c={x:a.clientX,y:a.clientY};return yw(c,u)}function Bi(a){return u=>u.pointerType==="mouse"?a(u):void 0}var Sw=xp,xw=Ps,Ew=wp,ww=Ap,Aw=lf,Mw=Mp,Tw=qo,Cw=Cp,Rw=_p,_w=Op,Nw=zp,Ow=jp,Dw=Up,zw=Hp,jw=Gp,ko="DropdownMenu",[Uw]=Na(ko,[bp]),st=bp(),[Lw,qp]=Uw(ko),kp=a=>{const{__scopeDropdownMenu:u,children:c,dir:r,open:s,defaultOpen:d,onOpenChange:m,modal:v=!0}=a,h=st(u),p=y.useRef(null),[b,x]=jo({prop:s,defaultProp:d??!1,onChange:m,caller:ko});return S.jsx(Lw,{scope:u,triggerId:Ui(),triggerRef:p,contentId:Ui(),open:b,onOpenChange:x,onOpenToggle:y.useCallback(()=>x(w=>!w),[x]),modal:v,children:S.jsx(Sw,{...h,open:b,onOpenChange:x,dir:r,modal:v,children:c})})};kp.displayName=ko;var Vp="DropdownMenuTrigger",Xp=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,disabled:r=!1,...s}=a,d=qp(Vp,c),m=st(c);return S.jsx(xw,{asChild:!0,...m,children:S.jsx(Le.button,{type:"button",id:d.triggerId,"aria-haspopup":"menu","aria-expanded":d.open,"aria-controls":d.open?d.contentId:void 0,"data-state":d.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Gi(u,d.triggerRef),onPointerDown:fe(a.onPointerDown,v=>{!r&&v.button===0&&v.ctrlKey===!1&&(d.onOpenToggle(),d.open||v.preventDefault())}),onKeyDown:fe(a.onKeyDown,v=>{r||(["Enter"," "].includes(v.key)&&d.onOpenToggle(),v.key==="ArrowDown"&&d.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(v.key)&&v.preventDefault())})})})});Xp.displayName=Vp;var Hw="DropdownMenuPortal",Kp=a=>{const{__scopeDropdownMenu:u,...c}=a,r=st(u);return S.jsx(Ew,{...r,...c})};Kp.displayName=Hw;var Qp="DropdownMenuContent",Zp=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=qp(Qp,c),d=st(c),m=y.useRef(!1);return S.jsx(ww,{id:s.contentId,"aria-labelledby":s.triggerId,...d,...r,ref:u,onCloseAutoFocus:fe(a.onCloseAutoFocus,v=>{var h;m.current||(h=s.triggerRef.current)==null||h.focus(),m.current=!1,v.preventDefault()}),onInteractOutside:fe(a.onInteractOutside,v=>{const h=v.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0,b=h.button===2||p;(!s.modal||b)&&(m.current=!0)}),style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Zp.displayName=Qp;var Bw="DropdownMenuGroup",Gw=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Aw,{...s,...r,ref:u})});Gw.displayName=Bw;var Yw="DropdownMenuLabel",Jp=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Mw,{...s,...r,ref:u})});Jp.displayName=Yw;var qw="DropdownMenuItem",Fp=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Tw,{...s,...r,ref:u})});Fp.displayName=qw;var kw="DropdownMenuCheckboxItem",Ip=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Cw,{...s,...r,ref:u})});Ip.displayName=kw;var Vw="DropdownMenuRadioGroup",Xw=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Rw,{...s,...r,ref:u})});Xw.displayName=Vw;var Kw="DropdownMenuRadioItem",Qw=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(_w,{...s,...r,ref:u})});Qw.displayName=Kw;var Zw="DropdownMenuItemIndicator",$p=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Nw,{...s,...r,ref:u})});$p.displayName=Zw;var Jw="DropdownMenuSeparator",Wp=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Ow,{...s,...r,ref:u})});Wp.displayName=Jw;var Fw="DropdownMenuArrow",Iw=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(Dw,{...s,...r,ref:u})});Iw.displayName=Fw;var $w="DropdownMenuSubTrigger",Ww=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(zw,{...s,...r,ref:u})});Ww.displayName=$w;var Pw="DropdownMenuSubContent",eA=y.forwardRef((a,u)=>{const{__scopeDropdownMenu:c,...r}=a,s=st(c);return S.jsx(jw,{...s,...r,ref:u,style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eA.displayName=Pw;var tA=kp,nA=Xp,lA=Kp,aA=Zp,iA=Jp,uA=Fp,oA=Ip,rA=$p,cA=Wp,Hl="NavigationMenu",[of,Pp,sA]=zo(Hl),[js,fA,dA]=zo(Hl),[rf]=Na(Hl,[sA,dA]),[mA,Qt]=rf(Hl),[vA,hA]=rf(Hl),ey=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,value:r,onValueChange:s,defaultValue:d,delayDuration:m=200,skipDelayDuration:v=300,orientation:h="horizontal",dir:p,...b}=a,[x,w]=y.useState(null),C=We(u,P=>w(P)),R=Vs(p),M=y.useRef(0),N=y.useRef(0),U=y.useRef(0),[Q,L]=y.useState(!0),[B,K]=jo({prop:r,onChange:P=>{const se=P!=="",ve=v>0;se?(window.clearTimeout(U.current),ve&&L(!1)):(window.clearTimeout(U.current),U.current=window.setTimeout(()=>L(!0),v)),s==null||s(P)},defaultProp:d??"",caller:Hl}),J=y.useCallback(()=>{window.clearTimeout(N.current),N.current=window.setTimeout(()=>K(""),150)},[K]),k=y.useCallback(P=>{window.clearTimeout(N.current),K(P)},[K]),V=y.useCallback(P=>{B===P?window.clearTimeout(N.current):M.current=window.setTimeout(()=>{window.clearTimeout(N.current),K(P)},m)},[B,K,m]);return y.useEffect(()=>()=>{window.clearTimeout(M.current),window.clearTimeout(N.current),window.clearTimeout(U.current)},[]),S.jsx(ty,{scope:c,isRootMenu:!0,value:B,dir:R,orientation:h,rootNavigationMenu:x,onTriggerEnter:P=>{window.clearTimeout(M.current),Q?V(P):k(P)},onTriggerLeave:()=>{window.clearTimeout(M.current),J()},onContentEnter:()=>window.clearTimeout(N.current),onContentLeave:J,onItemSelect:P=>{K(se=>se===P?"":P)},onItemDismiss:()=>K(""),children:S.jsx(Le.nav,{"aria-label":"Main","data-orientation":h,dir:R,...b,ref:C})})});ey.displayName=Hl;var Us="NavigationMenuSub",gA=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,value:r,onValueChange:s,defaultValue:d,orientation:m="horizontal",...v}=a,h=Qt(Us,c),[p,b]=jo({prop:r,onChange:s,defaultProp:d??"",caller:Us});return S.jsx(ty,{scope:c,isRootMenu:!1,value:p,dir:h.dir,orientation:m,rootNavigationMenu:h.rootNavigationMenu,onTriggerEnter:x=>b(x),onItemSelect:x=>b(x),onItemDismiss:()=>b(""),children:S.jsx(Le.div,{"data-orientation":m,...v,ref:u})})});gA.displayName=Us;var ty=a=>{const{scope:u,isRootMenu:c,rootNavigationMenu:r,dir:s,orientation:d,children:m,value:v,onItemSelect:h,onItemDismiss:p,onTriggerEnter:b,onTriggerLeave:x,onContentEnter:w,onContentLeave:C}=a,[R,M]=y.useState(null),[N,U]=y.useState(new Map),[Q,L]=y.useState(null);return S.jsx(mA,{scope:u,isRootMenu:c,rootNavigationMenu:r,value:v,previousValue:g1(v),baseId:Ui(),dir:s,orientation:d,viewport:R,onViewportChange:M,indicatorTrack:Q,onIndicatorTrackChange:L,onTriggerEnter:ot(b),onTriggerLeave:ot(x),onContentEnter:ot(w),onContentLeave:ot(C),onItemSelect:ot(h),onItemDismiss:ot(p),onViewportContentChange:y.useCallback((B,K)=>{U(J=>(J.set(B,K),new Map(J)))},[]),onViewportContentRemove:y.useCallback(B=>{U(K=>K.has(B)?(K.delete(B),new Map(K)):K)},[]),children:S.jsx(of.Provider,{scope:u,children:S.jsx(vA,{scope:u,items:N,children:m})})})},ny="NavigationMenuList",ly=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,...r}=a,s=Qt(ny,c),d=S.jsx(Le.ul,{"data-orientation":s.orientation,...r,ref:u});return S.jsx(Le.div,{style:{position:"relative"},ref:s.onIndicatorTrackChange,children:S.jsx(of.Slot,{scope:c,children:s.isRootMenu?S.jsx(cy,{asChild:!0,children:d}):d})})});ly.displayName=ny;var ay="NavigationMenuItem",[pA,iy]=rf(ay),uy=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,value:r,...s}=a,d=Ui(),m=r||d||"LEGACY_REACT_AUTO_VALUE",v=y.useRef(null),h=y.useRef(null),p=y.useRef(null),b=y.useRef(()=>{}),x=y.useRef(!1),w=y.useCallback((R="start")=>{if(v.current){b.current();const M=Hs(v.current);M.length&&ff(R==="start"?M:M.reverse())}},[]),C=y.useCallback(()=>{if(v.current){const R=Hs(v.current);R.length&&(b.current=RA(R))}},[]);return S.jsx(pA,{scope:c,value:m,triggerRef:h,contentRef:v,focusProxyRef:p,wasEscapeCloseRef:x,onEntryKeyDown:w,onFocusProxyEnter:w,onRootContentClose:C,onContentFocusOutside:C,children:S.jsx(Le.li,{...s,ref:u})})});uy.displayName=ay;var Ls="NavigationMenuTrigger",yA=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,disabled:r,...s}=a,d=Qt(Ls,a.__scopeNavigationMenu),m=iy(Ls,a.__scopeNavigationMenu),v=y.useRef(null),h=We(v,m.triggerRef,u),p=fy(d.baseId,m.value),b=dy(d.baseId,m.value),x=y.useRef(!1),w=y.useRef(!1),C=m.value===d.value;return S.jsxs(S.Fragment,{children:[S.jsx(of.ItemSlot,{scope:c,value:m.value,children:S.jsx(sy,{asChild:!0,children:S.jsx(Le.button,{id:p,disabled:r,"data-disabled":r?"":void 0,"data-state":df(C),"aria-expanded":C,"aria-controls":b,...s,ref:h,onPointerEnter:fe(a.onPointerEnter,()=>{w.current=!1,m.wasEscapeCloseRef.current=!1}),onPointerMove:fe(a.onPointerMove,Oo(()=>{r||w.current||m.wasEscapeCloseRef.current||x.current||(d.onTriggerEnter(m.value),x.current=!0)})),onPointerLeave:fe(a.onPointerLeave,Oo(()=>{r||(d.onTriggerLeave(),x.current=!1)})),onClick:fe(a.onClick,()=>{d.onItemSelect(m.value),w.current=C}),onKeyDown:fe(a.onKeyDown,R=>{const N={horizontal:"ArrowDown",vertical:d.dir==="rtl"?"ArrowLeft":"ArrowRight"}[d.orientation];C&&R.key===N&&(m.onEntryKeyDown(),R.preventDefault())})})})}),C&&S.jsxs(S.Fragment,{children:[S.jsx(nx,{"aria-hidden":!0,tabIndex:0,ref:m.focusProxyRef,onFocus:R=>{const M=m.contentRef.current,N=R.relatedTarget,U=N===v.current,Q=M==null?void 0:M.contains(N);(U||!Q)&&m.onFocusProxyEnter(U?"start":"end")}}),d.viewport&&S.jsx("span",{"aria-owns":b})]})]})});yA.displayName=Ls;var bA="NavigationMenuLink",lg="navigationMenu.linkSelect",oy=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,active:r,onSelect:s,...d}=a;return S.jsx(sy,{asChild:!0,children:S.jsx(Le.a,{"data-active":r?"":void 0,"aria-current":r?"page":void 0,...d,ref:u,onClick:fe(a.onClick,m=>{const v=m.target,h=new CustomEvent(lg,{bubbles:!0,cancelable:!0});if(v.addEventListener(lg,p=>s==null?void 0:s(p),{once:!0}),Ao(v,h),!h.defaultPrevented&&!m.metaKey){const p=new CustomEvent(So,{bubbles:!0,cancelable:!0});Ao(v,p)}},{checkForDefaultPrevented:!1})})})});oy.displayName=bA;var cf="NavigationMenuIndicator",SA=y.forwardRef((a,u)=>{const{forceMount:c,...r}=a,s=Qt(cf,a.__scopeNavigationMenu),d=!!s.value;return s.indicatorTrack?Rg.createPortal(S.jsx(Nn,{present:c||d,children:S.jsx(xA,{...r,ref:u})}),s.indicatorTrack):null});SA.displayName=cf;var xA=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,...r}=a,s=Qt(cf,c),d=Pp(c),[m,v]=y.useState(null),[h,p]=y.useState(null),b=s.orientation==="horizontal",x=!!s.value;y.useEffect(()=>{var M;const R=(M=d().find(N=>N.value===s.value))==null?void 0:M.ref.current;R&&v(R)},[d,s.value]);const w=()=>{m&&p({size:b?m.offsetWidth:m.offsetHeight,offset:b?m.offsetLeft:m.offsetTop})};return Bs(m,w),Bs(s.indicatorTrack,w),h?S.jsx(Le.div,{"aria-hidden":!0,"data-state":x?"visible":"hidden","data-orientation":s.orientation,...r,ref:u,style:{position:"absolute",...b?{left:0,width:h.size+"px",transform:`translateX(${h.offset}px)`}:{top:0,height:h.size+"px",transform:`translateY(${h.offset}px)`},...r.style}}):null}),Ra="NavigationMenuContent",EA=y.forwardRef((a,u)=>{const{forceMount:c,...r}=a,s=Qt(Ra,a.__scopeNavigationMenu),d=iy(Ra,a.__scopeNavigationMenu),m=We(d.contentRef,u),v=d.value===s.value,h={value:d.value,triggerRef:d.triggerRef,focusProxyRef:d.focusProxyRef,wasEscapeCloseRef:d.wasEscapeCloseRef,onContentFocusOutside:d.onContentFocusOutside,onRootContentClose:d.onRootContentClose,...r};return s.viewport?S.jsx(wA,{forceMount:c,...h,ref:m}):S.jsx(Nn,{present:c||v,children:S.jsx(ry,{"data-state":df(v),...h,ref:m,onPointerEnter:fe(a.onPointerEnter,s.onContentEnter),onPointerLeave:fe(a.onPointerLeave,Oo(s.onContentLeave)),style:{pointerEvents:!v&&s.isRootMenu?"none":void 0,...h.style}})})});EA.displayName=Ra;var wA=y.forwardRef((a,u)=>{const c=Qt(Ra,a.__scopeNavigationMenu),{onViewportContentChange:r,onViewportContentRemove:s}=c;return $t(()=>{r(a.value,{ref:u,...a})},[a,u,r]),$t(()=>()=>s(a.value),[a.value,s]),null}),So="navigationMenu.rootContentDismiss",ry=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,value:r,triggerRef:s,focusProxyRef:d,wasEscapeCloseRef:m,onRootContentClose:v,onContentFocusOutside:h,...p}=a,b=Qt(Ra,c),x=y.useRef(null),w=We(x,u),C=fy(b.baseId,r),R=dy(b.baseId,r),M=Pp(c),N=y.useRef(null),{onItemDismiss:U}=b;y.useEffect(()=>{const L=x.current;if(b.isRootMenu&&L){const B=()=>{var K;U(),v(),L.contains(document.activeElement)&&((K=s.current)==null||K.focus())};return L.addEventListener(So,B),()=>L.removeEventListener(So,B)}},[b.isRootMenu,a.value,s,U,v]);const Q=y.useMemo(()=>{const B=M().map(se=>se.value);b.dir==="rtl"&&B.reverse();const K=B.indexOf(b.value),J=B.indexOf(b.previousValue),k=r===b.value,V=J===B.indexOf(r);if(!k&&!V)return N.current;const P=(()=>{if(K!==J){if(k&&J!==-1)return K>J?"from-end":"from-start";if(V&&K!==-1)return K>J?"to-start":"to-end"}return null})();return N.current=P,P},[b.previousValue,b.value,b.dir,M,r]);return S.jsx(cy,{asChild:!0,children:S.jsx(Xs,{id:R,"aria-labelledby":C,"data-motion":Q,"data-orientation":b.orientation,...p,ref:w,disableOutsidePointerEvents:!1,onDismiss:()=>{var B;const L=new Event(So,{bubbles:!0,cancelable:!0});(B=x.current)==null||B.dispatchEvent(L)},onFocusOutside:fe(a.onFocusOutside,L=>{var K;h();const B=L.target;(K=b.rootNavigationMenu)!=null&&K.contains(B)&&L.preventDefault()}),onPointerDownOutside:fe(a.onPointerDownOutside,L=>{var k;const B=L.target,K=M().some(V=>{var P;return(P=V.ref.current)==null?void 0:P.contains(B)}),J=b.isRootMenu&&((k=b.viewport)==null?void 0:k.contains(B));(K||J||!b.isRootMenu)&&L.preventDefault()}),onKeyDown:fe(a.onKeyDown,L=>{var J;const B=L.altKey||L.ctrlKey||L.metaKey;if(L.key==="Tab"&&!B){const k=Hs(L.currentTarget),V=document.activeElement,P=k.findIndex(de=>de===V),ve=L.shiftKey?k.slice(0,P).reverse():k.slice(P+1,k.length);ff(ve)?L.preventDefault():(J=d.current)==null||J.focus()}}),onEscapeKeyDown:fe(a.onEscapeKeyDown,L=>{m.current=!0})})})}),sf="NavigationMenuViewport",AA=y.forwardRef((a,u)=>{const{forceMount:c,...r}=a,d=!!Qt(sf,a.__scopeNavigationMenu).value;return S.jsx(Nn,{present:c||d,children:S.jsx(MA,{...r,ref:u})})});AA.displayName=sf;var MA=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,children:r,...s}=a,d=Qt(sf,c),m=We(u,d.onViewportChange),v=hA(Ra,a.__scopeNavigationMenu),[h,p]=y.useState(null),[b,x]=y.useState(null),w=h?(h==null?void 0:h.width)+"px":void 0,C=h?(h==null?void 0:h.height)+"px":void 0,R=!!d.value,M=R?d.value:d.previousValue;return Bs(b,()=>{b&&p({width:b.offsetWidth,height:b.offsetHeight})}),S.jsx(Le.div,{"data-state":df(R),"data-orientation":d.orientation,...s,ref:m,style:{pointerEvents:!R&&d.isRootMenu?"none":void 0,"--radix-navigation-menu-viewport-width":w,"--radix-navigation-menu-viewport-height":C,...s.style},onPointerEnter:fe(a.onPointerEnter,d.onContentEnter),onPointerLeave:fe(a.onPointerLeave,Oo(d.onContentLeave)),children:Array.from(v.items).map(([U,{ref:Q,forceMount:L,...B}])=>{const K=M===U;return S.jsx(Nn,{present:L||K,children:S.jsx(ry,{...B,ref:Gi(Q,J=>{K&&J&&x(J)})})},U)})})}),TA="FocusGroup",cy=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,...r}=a,s=Qt(TA,c);return S.jsx(js.Provider,{scope:c,children:S.jsx(js.Slot,{scope:c,children:S.jsx(Le.div,{dir:s.dir,...r,ref:u})})})}),ag=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"],CA="FocusGroupItem",sy=y.forwardRef((a,u)=>{const{__scopeNavigationMenu:c,...r}=a,s=fA(c),d=Qt(CA,c);return S.jsx(js.ItemSlot,{scope:c,children:S.jsx(Le.button,{...r,ref:u,onKeyDown:fe(a.onKeyDown,m=>{if(["Home","End",...ag].includes(m.key)){let h=s().map(x=>x.ref.current);if([d.dir==="rtl"?"ArrowRight":"ArrowLeft","ArrowUp","End"].includes(m.key)&&h.reverse(),ag.includes(m.key)){const x=h.indexOf(m.currentTarget);h=h.slice(x+1)}setTimeout(()=>ff(h)),m.preventDefault()}})})})});function Hs(a){const u=[],c=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;c.nextNode();)u.push(c.currentNode);return u}function ff(a){const u=document.activeElement;return a.some(c=>c===u?!0:(c.focus(),document.activeElement!==u))}function RA(a){return a.forEach(u=>{u.dataset.tabindex=u.getAttribute("tabindex")||"",u.setAttribute("tabindex","-1")}),()=>{a.forEach(u=>{const c=u.dataset.tabindex;u.setAttribute("tabindex",c)})}}function Bs(a,u){const c=ot(u);$t(()=>{let r=0;if(a){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(c)});return s.observe(a),()=>{window.cancelAnimationFrame(r),s.unobserve(a)}}},[a,c])}function df(a){return a?"open":"closed"}function fy(a,u){return`${a}-trigger-${u}`}function dy(a,u){return`${a}-content-${u}`}function Oo(a){return u=>u.pointerType==="mouse"?a(u):void 0}var _A=ey,NA=ly,OA=uy,DA=oy;const zA=tA,jA=nA,my=y.forwardRef(({className:a,sideOffset:u=4,...c},r)=>S.jsx(lA,{children:S.jsx(aA,{ref:r,sideOffset:u,className:qe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in",a),...c})}));my.displayName="DropdownMenuContent";const xo=y.forwardRef(({className:a,inset:u,...c},r)=>S.jsx(uA,{ref:r,className:qe("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",u&&"pl-8",a),...c}));xo.displayName="DropdownMenuItem";const UA=y.forwardRef(({className:a,children:u,checked:c,...r},s)=>S.jsxs(oA,{ref:s,className:qe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:c,...r,children:[S.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:S.jsx(rA,{children:S.jsx(P0,{className:"h-4 w-4"})})}),u]}));UA.displayName="DropdownMenuCheckboxItem";const LA=y.forwardRef(({className:a,inset:u,...c},r)=>S.jsx(iA,{ref:r,className:qe("px-2 py-1.5 text-sm font-semibold",u&&"pl-8",a),...c}));LA.displayName="DropdownMenuLabel";const HA=y.forwardRef(({className:a,...u},c)=>S.jsx(cA,{ref:c,className:qe("-mx-1 my-1 h-px bg-muted",a),...u}));HA.displayName="DropdownMenuSeparator";function BA(){const{setTheme:a}=F0();return S.jsxs(zA,{children:[S.jsx(jA,{asChild:!0,children:S.jsxs(rl,{variant:"outline",size:"icon",className:"size-8",children:[S.jsx(wh,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),S.jsx(Eh,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),S.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),S.jsxs(my,{align:"end",children:[S.jsxs(xo,{onClick:()=>a("light"),children:[S.jsx(wh,{className:"mr-2 h-4 w-4"})," Light"]}),S.jsxs(xo,{onClick:()=>a("dark"),children:[S.jsx(Eh,{className:"mr-2 h-4 w-4"})," Dark"]}),S.jsxs(xo,{onClick:()=>a("system"),children:[S.jsx(tS,{className:"mr-2 h-4 w-4"})," System"]})]})]})}const Oi=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{ref:c,className:qe("rounded-xl border bg-card text-card-foreground",a),...u}));Oi.displayName="Card";const Di=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{ref:c,className:qe("flex flex-col space-y-1.5 p-6",a),...u}));Di.displayName="CardHeader";const zi=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{ref:c,className:qe("font-semibold leading-none tracking-tight",a),...u}));zi.displayName="CardTitle";const GA=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{ref:c,className:qe("text-sm text-muted-foreground",a),...u}));GA.displayName="CardDescription";const ji=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{ref:c,className:qe("p-6 pt-0",a),...u}));ji.displayName="CardContent";const YA=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{ref:c,className:qe("flex items-center p-6 pt-0",a),...u}));YA.displayName="CardFooter";function qA({stats:a}){return S.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[S.jsxs(Oi,{children:[S.jsx(Di,{children:S.jsx(zi,{children:"Total Invoices"})}),S.jsx(ji,{className:"text-3xl font-bold",children:a.total_invoices})]}),S.jsxs(Oi,{children:[S.jsx(Di,{children:S.jsx(zi,{children:"Sent / Paid"})}),S.jsxs(ji,{className:"text-3xl font-bold",children:[a.sent," / ",a.paid]})]}),S.jsxs(Oi,{children:[S.jsx(Di,{children:S.jsx(zi,{children:"Draft / Overdue"})}),S.jsxs(ji,{className:"text-3xl font-bold",children:[a.draft," / ",a.overdue]})]}),S.jsxs(Oi,{children:[S.jsx(Di,{children:S.jsx(zi,{children:"Parties / Agents"})}),S.jsxs(ji,{className:"text-3xl font-bold",children:[a.parties," / ",a.agents]})]})]})}const Vo=y.forwardRef(({className:a,...u},c)=>S.jsx("div",{className:"relative w-full overflow-auto",children:S.jsx("table",{ref:c,className:qe("w-full caption-bottom text-sm",a),...u})}));Vo.displayName="Table";const Xo=y.forwardRef(({className:a,...u},c)=>S.jsx("thead",{ref:c,className:qe("[&_tr]:border-b",a),...u}));Xo.displayName="TableHeader";const Ko=y.forwardRef(({className:a,...u},c)=>S.jsx("tbody",{ref:c,className:qe("[&_tr:last-child]:border-0",a),...u}));Ko.displayName="TableBody";const kA=y.forwardRef(({className:a,...u},c)=>S.jsx("tfoot",{ref:c,className:qe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...u}));kA.displayName="TableFooter";const zl=y.forwardRef(({className:a,...u},c)=>S.jsx("tr",{ref:c,className:qe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...u}));zl.displayName="TableRow";const bt=y.forwardRef(({className:a,...u},c)=>S.jsx("th",{ref:c,className:qe("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...u}));bt.displayName="TableHead";const St=y.forwardRef(({className:a,...u},c)=>S.jsx("td",{ref:c,className:qe("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...u}));St.displayName="TableCell";const VA=y.forwardRef(({className:a,...u},c)=>S.jsx("caption",{ref:c,className:qe("mt-4 text-sm text-muted-foreground",a),...u}));VA.displayName="TableCaption";const XA=["draft","sent","partially_paid","paid","void","overdue"];function KA({data:a,onStatusChange:u,onRefresh:c}){const[r,s]=y.useState(null);async function d(m,v){s(m);try{await u(m,v)}finally{s(null)}}return S.jsxs("div",{className:"space-y-3",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("h2",{className:"text-lg font-semibold",children:"Invoices"}),S.jsx(rl,{variant:"outline",onClick:()=>void c(),children:"Refresh"})]}),S.jsxs(Vo,{children:[S.jsx(Xo,{children:S.jsxs(zl,{children:[S.jsx(bt,{children:"Number"}),S.jsx(bt,{children:"Status"}),S.jsx(bt,{children:"Total"}),S.jsx(bt,{children:"Issued"}),S.jsx(bt,{className:"text-right",children:"Actions"})]})}),S.jsx(Ko,{children:a.map(m=>S.jsxs(zl,{children:[S.jsx(St,{className:"font-medium",children:m.number}),S.jsx(St,{children:m.status}),S.jsxs(St,{children:[(m.total_cents/100).toFixed(2)," ",m.currency]}),S.jsx(St,{children:new Date(m.issued_at).toLocaleDateString()}),S.jsx(St,{className:"text-right",children:S.jsx("div",{className:"flex flex-wrap justify-end gap-1",children:XA.map(v=>S.jsx(rl,{size:"sm",variant:m.status===v?"default":"outline",disabled:r===m.id,onClick:()=>void d(m.id,v),children:v},v))})})]},m.id))})]})]})}const Do=y.forwardRef(({className:a,type:u,...c},r)=>S.jsx("input",{type:u,className:qe("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",a),ref:r,...c}));Do.displayName="Input";const ig="http://localhost:3487";function QA(){const[a,u]=y.useState([]),[c,r]=y.useState("issuer"),[s,d]=y.useState("");async function m(){const h=await fetch(`${ig}/api/parties`);h.ok&&u(await h.json())}y.useEffect(()=>{m()},[]);async function v(h){h.preventDefault(),s.trim()&&(await fetch(`${ig}/api/parties`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({kind:c,legal_name:s.trim()})}),d(""),await m())}return S.jsxs("div",{className:"space-y-4",children:[S.jsxs("form",{onSubmit:v,className:"flex flex-wrap items-end gap-2",children:[S.jsxs("div",{children:[S.jsx("label",{className:"mb-1 block text-sm text-muted-foreground",children:"Kind"}),S.jsxs("select",{value:c,onChange:h=>r(h.target.value),className:"h-10 rounded-md border px-3",children:[S.jsx("option",{value:"issuer",children:"issuer"}),S.jsx("option",{value:"customer",children:"customer"})]})]}),S.jsxs("div",{className:"min-w-[260px]",children:[S.jsx("label",{className:"mb-1 block text-sm text-muted-foreground",children:"Legal name"}),S.jsx(Do,{value:s,onChange:h=>d(h.target.value),placeholder:"Company SRL"})]}),S.jsx(rl,{type:"submit",children:"Create party"})]}),S.jsxs(Vo,{children:[S.jsx(Xo,{children:S.jsxs(zl,{children:[S.jsx(bt,{children:"Kind"}),S.jsx(bt,{children:"Legal Name"}),S.jsx(bt,{children:"Email"}),S.jsx(bt,{children:"Tax ID"})]})}),S.jsx(Ko,{children:a.map(h=>S.jsxs(zl,{children:[S.jsx(St,{children:h.kind}),S.jsx(St,{className:"font-medium",children:h.legal_name}),S.jsx(St,{children:h.email??"-"}),S.jsx(St,{children:h.tax_id??"-"})]},h.id))})]})]})}const ug="http://localhost:3487";function ZA(){const[a,u]=y.useState([]),[c,r]=y.useState(""),[s,d]=y.useState("");async function m(){const h=await fetch(`${ug}/api/agents`);h.ok&&u(await h.json())}y.useEffect(()=>{m()},[]);async function v(h){h.preventDefault(),c.trim()&&(await fetch(`${ug}/api/agents`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:c.trim(),description:s.trim()||void 0})}),r(""),d(""),await m())}return S.jsxs("div",{className:"space-y-4",children:[S.jsxs("form",{onSubmit:v,className:"flex flex-wrap items-end gap-2",children:[S.jsxs("div",{className:"min-w-[220px]",children:[S.jsx("label",{className:"mb-1 block text-sm text-muted-foreground",children:"Name"}),S.jsx(Do,{value:c,onChange:h=>r(h.target.value),placeholder:"agent-name"})]}),S.jsxs("div",{className:"min-w-[320px]",children:[S.jsx("label",{className:"mb-1 block text-sm text-muted-foreground",children:"Description"}),S.jsx(Do,{value:s,onChange:h=>d(h.target.value),placeholder:"role/intent"})]}),S.jsx(rl,{type:"submit",children:"Register"})]}),S.jsxs(Vo,{children:[S.jsx(Xo,{children:S.jsxs(zl,{children:[S.jsx(bt,{children:"Name"}),S.jsx(bt,{children:"Description"}),S.jsx(bt,{children:"Focus"}),S.jsx(bt,{children:"Last Seen"})]})}),S.jsx(Ko,{children:a.map(h=>S.jsxs(zl,{children:[S.jsx(St,{className:"font-medium",children:h.name}),S.jsx(St,{children:h.description??"-"}),S.jsx(St,{children:h.focus??"-"}),S.jsx(St,{children:new Date(h.last_seen_at).toLocaleString()})]},h.id))})]})]})}function JA(){return S.jsx("div",{className:"rounded-lg border bg-card p-4 text-sm text-muted-foreground",children:"Invoice plans/recurrence management UI will be expanded in upcoming tasks."})}function FA(){return S.jsxs("div",{className:"space-y-2 text-sm",children:[S.jsx("p",{className:"font-medium",children:"open-invoices Dashboard Help"}),S.jsx("p",{children:"1. Create issuers/customers in the Parties page."}),S.jsx("p",{children:"2. Create invoices via API/CLI and manage status in the Invoices page."}),S.jsx("p",{children:"3. Register agents and assign focus in the Agents page."}),S.jsx("p",{children:"4. Configure `VITE_API_BASE_URL` if API is not on `http://localhost:3487`."})]})}const vy=y.forwardRef(({className:a,children:u,...c},r)=>S.jsx(_A,{ref:r,className:qe("relative z-10 flex max-w-max flex-1 items-center justify-center",a),...c,children:u}));vy.displayName="NavigationMenu";const hy=y.forwardRef(({className:a,...u},c)=>S.jsx(NA,{ref:c,className:qe("group flex flex-1 list-none items-center justify-center gap-1",a),...u}));hy.displayName="NavigationMenuList";const IA=OA,$A=()=>"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50",WA=DA,Ms="http://localhost:3487",PA={total_invoices:0,draft:0,sent:0,partially_paid:0,paid:0,void:0,overdue:0,parties:0,issuers:0,customers:0,agents:0};function eM(){const[a,u]=y.useState("dashboard"),[c,r]=y.useState(PA),[s,d]=y.useState([]),[m,v]=y.useState(!1),[h,p]=y.useState(null);function b(R,M){p({message:R,type:M}),setTimeout(()=>p(null),3e3)}const x=y.useCallback(async()=>{v(!0);try{const[R,M]=await Promise.all([fetch(`${Ms}/api/stats`),fetch(`${Ms}/api/invoices?limit=100`)]);if(!R.ok||!M.ok)throw new Error("Failed to load dashboard data");r(await R.json()),d(await M.json())}catch(R){b(R instanceof Error?R.message:String(R),"error")}finally{v(!1)}},[]);y.useEffect(()=>{x()},[x]);async function w(R,M){const N=await fetch(`${Ms}/api/invoices/${R}/status`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({status:M})});if(!N.ok)throw new Error(`Status update failed (${N.status})`);b(`Invoice updated to ${M}`,"success"),await x()}const C=[{key:"dashboard",label:"Dashboard"},{key:"tasks",label:"Invoices"},{key:"projects",label:"Parties"},{key:"plans",label:"Plans"},{key:"agents",label:"Agents"}];return S.jsxs("div",{className:"min-h-screen",children:[S.jsx("header",{className:"border-b",children:S.jsxs("div",{className:"mx-auto flex h-14 max-w-6xl items-center justify-between px-6",children:[S.jsxs("div",{className:"flex items-center gap-4",children:[S.jsxs("button",{className:"flex items-center gap-3 hover:opacity-80 transition-opacity",onClick:()=>u("dashboard"),children:[S.jsx("img",{src:"/logo.jpg",alt:"Hasna",className:"h-7 w-auto rounded"}),S.jsxs("h1",{className:"text-base font-semibold",children:["Hasna ",S.jsx("span",{className:"font-normal text-muted-foreground",children:"Invoices"})]})]}),S.jsx(vy,{children:S.jsx(hy,{children:C.map(R=>S.jsx(IA,{children:S.jsx(WA,{className:$A(),"data-active":a===R.key?"":void 0,onClick:()=>u(R.key),style:{cursor:"pointer"},children:R.label})},R.key))})})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(rl,{variant:"outline",size:"icon",className:"size-8",onClick:()=>void x(),disabled:m,children:S.jsx(nS,{className:`size-4 ${m?"animate-spin":""}`})}),S.jsx(rl,{variant:a==="help"?"secondary":"outline",size:"icon",className:"size-8",onClick:()=>u("help"),children:S.jsx(eS,{className:"size-4"})}),S.jsx(BA,{})]})]})}),S.jsxs("main",{className:"mx-auto max-w-6xl space-y-6 px-6 py-6",children:[a==="dashboard"&&S.jsx(qA,{stats:c}),a==="tasks"&&S.jsx(KA,{data:s,onStatusChange:w,onRefresh:x}),a==="projects"&&S.jsx(QA,{}),a==="plans"&&S.jsx(JA,{}),a==="agents"&&S.jsx(ZA,{}),a==="help"&&S.jsx(FA,{})]}),h&&S.jsx("div",{className:`fixed bottom-6 right-6 z-50 rounded-lg border px-4 py-3 text-sm shadow-lg ${h.type==="success"?"border-green-200 bg-green-50 text-green-800 dark:border-green-900 dark:bg-green-950 dark:text-green-200":"border-red-200 bg-red-50 text-red-800 dark:border-red-900 dark:bg-red-950 dark:text-red-200"}`,children:h.message})]})}Z0.createRoot(document.getElementById("root")).render(S.jsx(y.StrictMode,{children:S.jsx(J0,{defaultTheme:"light",children:S.jsx(eM,{})})}));
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Hasna Todos</title>
7
- <script type="module" crossorigin src="/assets/index-BhR1BMmj.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-NFe45aEq.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-khzrvnCp.css">
9
9
  </head>
10
10
  <body>