@deslop/scope 0.1.1228 → 0.1.1232
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/(home)-CdFcJ-zR.js +1 -0
- package/dist/client/assets/effect-BdXQ-SUq.js +15 -0
- package/dist/client/assets/index-BUygwqIz.js +4 -0
- package/dist/client/assets/react-CDnnZf73.js +9 -0
- package/dist/client/index.html +3 -1
- package/dist/server.js +3 -2
- package/package.json +4 -4
- package/dist/client/assets/(home)-DkKrI3Jv.js +0 -2
- package/dist/client/assets/index-B3AfjWoo.js +0 -25
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{$ as t,$a as n,$i as r,$n as i,$r as a,$t as o,A as s,Aa as c,Ai as l,An as u,Ar as d,At as f,B as p,Ba as m,Bi as h,Bn as g,Br as _,Bt as v,C as y,Ca as b,Ci as x,Cn as S,Co as C,Cr as w,Ct as T,D as E,Da as D,Di as O,Dn as k,Do as A,Dr as j,Dt as M,E as N,Ea as P,Ei as F,En as I,Eo as ee,Er as L,Et as te,F as R,Fa as z,Fi as B,Fn as ne,Fr as re,Ft as V,G as ie,Ga as H,Gi as U,Gn as ae,Gr as oe,Gt as W,H as se,Ha as ce,Hi as le,Hn as ue,Hr as de,Ht as fe,I as pe,Ia as me,Ii as he,In as ge,Ir as _e,It as ve,J as ye,Ja as be,Ji as xe,Jn as Se,Jr as Ce,Jt as we,K as Te,Ka as Ee,Ki as De,Kn as Oe,Kr as ke,Kt as Ae,L as je,La as Me,Li as Ne,Ln as Pe,Lr as Fe,Lt as Ie,M as Le,Ma as Re,Mi as ze,Mn as Be,Mr as Ve,Mt as He,N as Ue,Na as We,Ni as Ge,Nn as Ke,Nr as qe,Nt as Je,O as Ye,Oa as Xe,Oi as Ze,On as Qe,Or as $e,Ot as et,P as tt,Pa as nt,Pi as rt,Pn as it,Pr as at,Pt as ot,Q as st,Qa as ct,Qi as lt,Qn as ut,Qr as dt,Qt as ft,R as pt,Ra as mt,Ri as ht,Rn as gt,Rr as _t,Rt as vt,S as G,Sa as yt,Si as bt,Sn as xt,So as St,Sr as Ct,St as wt,T as Tt,Ta as Et,Ti as Dt,Tn as Ot,To as kt,Tr as At,Tt as jt,U as Mt,Ua as Nt,Ui as Pt,Un as Ft,Ur as It,Ut as Lt,V as Rt,Va as zt,Vi as Bt,Vn as Vt,Vr as Ht,Vt as Ut,W as Wt,Wa as Gt,Wi as Kt,Wn as qt,Wr as Jt,Wt as Yt,X as Xt,Xa as Zt,Xi as Qt,Xn as $t,Xr as en,Xt as tn,Y as nn,Ya as rn,Yi as an,Yn as on,Yr as sn,Yt as cn,Z as ln,Za as un,Zi as dn,Zn as fn,Zr as pn,Zt as mn,_ as hn,_a as gn,_i as _n,_n as vn,_o as yn,_r as bn,_t as xn,a as Sn,aa as Cn,ai as wn,an as Tn,ao as En,ar as Dn,at as On,b as kn,ba as An,bi as jn,bn as Mn,bo as Nn,br as Pn,bt as Fn,c as In,ca as Ln,ci as Rn,cn as zn,co as Bn,cr as Vn,ct as Hn,d as Un,da as Wn,di as Gn,dn as Kn,do as qn,dr as Jn,dt as Yn,ea as Xn,ei as Zn,en as Qn,eo as $n,er,et as tr,f as nr,fa as rr,fi as ir,fn as ar,fo as or,fr as sr,ft as cr,g as lr,ga as ur,gi as dr,gn as fr,go as pr,gr as mr,gt as hr,h as gr,ha as _r,hi as vr,hn as yr,ho as br,hr as xr,ht as Sr,i as Cr,ia as wr,ii as Tr,in as Er,io as Dr,ir as Or,it as kr,j as Ar,ja as jr,ji as Mr,jn as Nr,jr as Pr,jt as Fr,k as Ir,ka as Lr,ki as Rr,kn as zr,kr as Br,kt as Vr,l as Hr,la as Ur,li as Wr,ln as Gr,lo as Kr,lr as qr,lt as Jr,m as Yr,ma as Xr,mi as Zr,mn as Qr,mo as $r,mr as ei,mt as ti,n as ni,na as ri,ni as ii,nn as ai,no as oi,nr as si,nt as ci,o as li,oa as ui,oi as di,on as fi,oo as pi,or as mi,ot as hi,p as gi,pa as _i,pi as vi,pn as yi,po as bi,pr as xi,pt as Si,q as Ci,qa as wi,qi as Ti,qn as Ei,qr as Di,qt as Oi,r as ki,ra as Ai,ri as ji,rn as Mi,ro as Ni,rr as Pi,rt as Fi,s as Ii,sa as Li,si as Ri,sn as zi,so as Bi,sr as Vi,st as Hi,t as Ui,ta as Wi,ti as Gi,tn as Ki,to as qi,tr as Ji,tt as Yi,u as Xi,ua as Zi,ui as Qi,un as $i,uo as ea,ur as ta,ut as na,v as ra,va as ia,vi as aa,vn as oa,vo as sa,vr as ca,vt as la,w as ua,wa as da,wi as fa,wn as pa,wo as ma,wr as ha,wt as K,x as q,xa as ga,xi as _a,xn as va,xo as ya,xr as ba,xt as xa,y as Sa,ya as Ca,yi as wa,yn as Ta,yo as Ea,yr as Da,yt as Oa,z as ka,za as Aa,zi as ja,zn as Ma,zr as Na,zt as Pa}from"./index-B3AfjWoo.js";var Fa=globalThis.Number,Ia=Nt(ce),La=e=>{if(e===`NaN`)return zt(NaN);if(e===`Infinity`)return zt(1/0);if(e===`-Infinity`)return zt(-1/0);if(e.trim()===``)return Aa();let t=Fa(e);return Fa.isNaN(t)?Aa():zt(t)},Ra=pr(2,(e,t)=>{let n=10**t;return Math.round(e*n)/n}),za=`~effect/MutableHashMap`,Ba={[za]:za,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${un(Array.from(this))})`},toJSON(){return{_id:`MutableHashMap`,values:Zt(Array.from(this))}},[rn](){return this.toJSON()},pipe(){return ya(this,arguments)}},Va=()=>{let e=Object.create(Ba);return e.backing=new Map,e.buckets=new Map,e},Ha=pr(2,(e,t)=>{if(e.backing.has(t))return zt(e.backing.get(t));if(Ua(t))return Aa();let n=Dr(t),r=e.buckets.get(n);return r===void 0?Aa():Wa(e,r,t)}),Ua=e=>typeof e!=`object`&&typeof e!=`function`,Wa=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(qi(n,t[r])){let n=t[r];return zt(e.backing.get(n))}return Aa()},Ga=pr(3,(e,t,n)=>{if(e.backing.has(t)||Ua(t))return e.backing.set(t,n),e;let r=Dr(t),i=e.buckets.get(r);if(i===void 0)return e.buckets.set(r,[t]),e.backing.set(t,n),e;let a=Ka(i,t);return a===void 0&&(i.push(t),a=t),e.backing.set(a,n),e}),Ka=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(qi(t,e[n]))return e[n]},qa=pr(2,(e,t)=>{if(Ua(t))return e.backing.delete(t),e;let n=Dr(t),r=e.buckets.get(n);if(r===void 0)return e;for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i===t||qi(t,i)){e.backing.delete(i),r.splice(n,1);break}}return r.length===0&&e.buckets.delete(n),e});function Ja(e){return{_tag:`Value`,value:e}}function Ya(e,t){return{_tag:`Record`,keys:e,value:t}}function Xa(e,t){return{_tag:`Array`,length:e,value:t}}var Za=Kt(`effect/ConfigProvider`,{defaultValue:()=>ao()}),Qa={...Gt,toJSON(){return{_id:`ConfigProvider`}}},$a=e=>e;function eo(e,t){let n=Object.create(Qa);return n.load=e,n.mapInput=t,n}function to(e,t){return eo(n=>e(t(n)),n=>to(e,e=>n(t(e))))}function no(e){return to(e,$a)}function ro(e,t){return e===``&&!t?void 0:e}function io(e,t){let n=t?.preserveEmptyStrings===!0,r=oo(e);return no(t=>Na(so(r,e,t,n)))}function ao(e){return io(e?.env??{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`},{preserveEmptyStrings:e?.preserveEmptyStrings})}function oo(e){let t={};for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let e=n.split(`_`),i=t;for(let t of e){let e=i.children??=Object.create(null);i=e[t]??={}}}return t}function so(e,t,n,r){let i=n.map(String).join(`_`),a=ro(Object.hasOwn(t,i)?t[i]:void 0,r),o=co(e,n),s=o?.children?Object.keys(o.children):[];return s.length===0?a===void 0?void 0:Ja(a):s.every(Wn)?Xa(Math.max(...s.map(e=>parseInt(e,10)))+1,a):Ya(new Set(s),a)}function co(e,t){if(t.length===0)return e;let n=e;for(let e of t)if(n=n?.children?.[String(e)],!n)return;return n}var lo=`~effect/Config`,uo=class{_tag=`ConfigError`;name=`ConfigError`;cause;constructor(e){this.cause=e}get message(){return this.cause.toString()}toString(){return`ConfigError(${this.message})`}},fo={...Wi({label:`Config`,evaluate(e){return this.parse(e.getRef(Za))}}),[lo]:lo,toJSON(){return{_id:`Config`}}};function po(e){let t=Object.create(fo);return t.evaluator=e,t.parse=t=>sr(e(t,[]),xr),t}var mo=(e,t,n)=>e.evaluator(t,n),ho=pr(2,(e,t)=>po((n,r)=>Pn(mo(e,n,r),yt(t)))),go=pr(2,(e,t)=>po((n,r)=>Ct(mo(e,n,r),e=>An(e)?b(t):e))),_o=e=>e.pipe(ho(zt),go(Aa())),vo=e=>qn(e,`SourceError`),yo=()=>`<configuration>`,bo=e=>t=>Or(t,t=>ta(Dt(t.reasons.map(e)))),xo=(e,t)=>e.load(t).pipe(bo(e=>l(e)?Mr(e.error).annotate(Ge(e)):e),Ct(n=>({provider:e,path:t,node:n,toString:yo}))),So=(e,t)=>xo(e.provider,[...e.path,t]),Co=(e,t)=>ft(Ki,e,new ai(Tn(e=>t(e)),Er())),wo=e=>{switch(e._tag){case`Union`:return e.types.every(wo);case`Objects`:case`Arrays`:case`Suspend`:return!1;default:return!0}},To=(e,t)=>{switch(e._tag){case`Objects`:return t?._tag===`Record`;case`Arrays`:return t?._tag===`Array`;case`Union`:return e.types.some(e=>To(e,t));case`Suspend`:return To(e.thunk(),t);default:return t?.value!==void 0}},Eo=Ea(e=>{let t=new WeakSet,r=mn(e=>{switch(t.add(e),e._tag){case`Objects`:{let t=xi(function*(t){if(t.node?._tag!==`Record`)return;let r=t.node,i=new Set;for(let t of e.propertySignatures)typeof t.name==`string`&&i.add(t.name);if(e.indexSignatures.length>0){let t={};for(let e of r.keys)n(t,e,void 0);for(let n of e.indexSignatures)for(let e of o(t,n.parameter))typeof e==`string`&&i.add(e)}let a={};for(let e of i){let r=yield*So(t,e);r.node!==void 0&&n(a,e,r)}return a});return Co(e.recur(r,e=>e),t)}case`Arrays`:{let t=xi(function*(e){if(e.node?._tag!==`Array`)return;let t=[];for(let n=0;n<e.node.length;n++)t.push(yield*So(e,n));return t});return Co(e.recur(r),t)}case`Union`:for(let t of e.types)r(t);if(!wo(e))return e.recur(r);break;case`Suspend`:{let n=e.thunk();return t.has(n)||r(n),e.recur(r)}case`Declaration`:case`Any`:throw new globalThis.Error(`Config.schema does not support opaque StringTree encodings`,{cause:e})}return Co(e,e=>Na(e.node?.value))});return r(e)});function Do(e,t){let n=Oi(e),r=Qn(n.ast),i=tn(fe(Eo(n.ast))),a=typeof t==`string`?[t]:t??[];return po((e,t)=>{let n=[...t,...a];return xo(e,n).pipe(sr(e=>i(e).pipe(Ct(b),Dn(t=>{let i=new uo(new wt(n.length>0?new zn(n,t):t));return To(r,e.node)?qr(i):Na(Ca(i))}))),bo(e=>Rr(e)&&vo(e.defect)?ze(new uo(e.defect)).annotate(Ge(e)):e))})}function Oo(e){return Do(T,e)}var ko=`~effect/http/HttpBody`,Ao=class{[ko];constructor(){this[ko]=ko}[rn](){return this.toJSON()}toString(){return un(this,{ignoreToString:!0})}},jo=new class extends Ao{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}};globalThis.Buffer;var Mo=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`],[`QUERY`,`query`]],No=(e,t)=>t._tag===`Empty`||t._tag===`FormData`?S(S(e,`content-type`),`content-length`):(e=t.contentType===void 0?S(e,`content-type`):pa(e,`content-type`,t.contentType),Po(e,t)),Po=(e,t)=>{let n=t._tag===`Empty`||t._tag===`FormData`?void 0:t.contentLength;return n===void 0?S(e,`content-length`):pa(e,`content-length`,n.toString())},Fo=class extends he(`UrlError`){},Io=(e,t,n)=>da({try:()=>{let r=new URL(e,Lo());for(let e=0;e<t.params.length;e++){let[n,i]=t.params[e];i!==void 0&&r.searchParams.append(n,fr(i))}return n!==void 0&&(r.hash=n),r},catch:e=>new Fo({cause:e})}),Lo=()=>{if(`location`in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0){let e=location.origin+location.pathname;try{return new URL(e).href}catch{return}}},Ro=`~effect/http/HttpClientRequest`,zo={[Ro]:Ro,...wi,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:yi(this.url),urlParams:this.urlParams,hash:this.hash,headers:ct(this.headers),body:this.body.toJSON()}},pipe(){return ya(this,arguments)}};function Bo(e,t,n,r,i,a){let o=Object.create(zo);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var Vo=Bo(`GET`,``,Kn,Aa(),oa,jo),Ho=e=>(t,n)=>Uo(Vo,{method:e,url:t,...n??void 0}),Uo=pr(2,(e,t)=>{let n=e;return t.method&&(n=Wo(n,t.method)),t.url&&(n=Yo(n,t.url)),t.headers&&(n=Ko(n,t.headers)),t.urlParams&&(n=Xo(n,t.urlParams)),t.hash&&(n=Zo(n,t.hash)),t.body&&(n=Qo(n,t.body)),t.accept&&(n=qo(n,t.accept)),t.acceptJson&&(n=Jo(n)),n}),Wo=pr(2,(e,t)=>Bo(t,e.url,e.urlParams,e.hash,e.headers,e.body)),Go=pr(3,(e,t,n)=>Bo(e.method,e.url,e.urlParams,e.hash,pa(e.headers,t,n),e.body)),Ko=pr(2,(e,t)=>Bo(e.method,e.url,e.urlParams,e.hash,Ot(e.headers,t),e.body)),qo=pr(2,(e,t)=>Go(e,`Accept`,t)),Jo=qo(`application/json`),Yo=pr(2,(e,t)=>{if(typeof t==`string`)return Bo(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=ar(n.searchParams),i=jr(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,Bo(e.method,n.toString(),r,i,e.headers,e.body)}),Xo=pr(2,(e,t)=>Bo(e.method,e.url,Qr(e.urlParams,t),e.hash,e.headers,e.body)),Zo=pr(2,(e,t)=>Bo(e.method,e.url,e.urlParams,zt(t),e.headers,e.body)),Qo=pr(2,(e,t)=>Bo(e.method,e.url,e.urlParams,e.hash,No(e.headers,t),t));function $o(e){let t=Io(e.url,e.urlParams,nt(e.hash));return ga(t)?zt(t.success):Aa()}var es=`~effect/http/HttpIncomingMessage`,ts=(e,t)=>{let n=He(Ae(e)),r=t?.reviver===void 0?void 0:He(ve(Ae(e),t));return e=>r===void 0?Jn(e.json,e=>n(e,t)):Jn(e.text,i=>i===``?Jn(e.json,e=>n(e,t)):r(i,t))},ns=(e,t)=>({...t,headers:ct(e.headers),remoteAddress:e.remoteAddress}),rs=`~effect/http/HttpClientResponse/WebSource`,is=e=>e[rs]?.(),as=`~effect/http/HttpClientResponse`,os=(e,t)=>new cs(e,t),ss=e=>e.status>=200&&e.status<300?Na(e):qr(new ci({reason:new kr({response:e,request:e.request,description:`non 2xx status code`})})),cs=class extends be{[es];[as];request;source;constructor(e,t){super(),this.request=e,this.source=t,this[es]=es,this[as]=as}toJSON(){return ns(this,{_id:`HttpClientResponse`,request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get url(){if(this.source.url)return this.source.url.split(`#`)[0];let e=$o(this.request);return z(e)?``:(e.value.hash=``,e.value.href)}get headers(){return Ta(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=I(this.source.headers.getSetCookie?.()??[])}get remoteAddress(){return Aa()}[rs](){return this.source}get stream(){return this.source.body?ge({evaluate:()=>this.source.body,onError:e=>new ci({reason:new t({request:this.request,response:this,cause:e})})}):Be(new ci({reason:new tr({request:this.request,response:this,description:`can not create stream from empty body`})}))}get json(){return Jn(this.text,e=>oe({try:()=>e===``?null:JSON.parse(e),catch:e=>new ci({reason:new t({request:this.request,response:this,cause:e})})}))}textBody;get text(){return this.textBody??=Pn(this.arrayBuffer,e=>new TextDecoder().decode(e))}get urlParamsBody(){return Jn(this.arrayBuffer,e=>oe({try:()=>ar(yr(e)),catch:e=>new ci({reason:new t({request:this.request,response:this,cause:e})})}))}formDataBody;get formData(){return this.formDataBody??=Jt({try:()=>this.source.formData(),catch:e=>new ci({reason:new t({request:this.request,response:this,cause:e})})}).pipe(si,re)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody||=Jt({try:()=>this.source.arrayBuffer(),catch:e=>new ci({reason:new t({request:this.request,response:this,cause:e})})}).pipe(si,re),this.arrayBufferBody}get upgrade(){return qr(new ci({reason:new kr({request:this.request,response:this,description:`fetch cannot hand over the connection of an HTTP upgrade`})}))}pipe(){return ya(this,arguments)}},ls=e=>Mn({b3:`${e.traceId}-${e.spanId}-${e.sampled?`1`:`0`}${mt(e.parent,{onNone:()=>``,onSome:e=>`-${e.spanId}`})}`,traceparent:`00-${e.traceId.padStart(32,`0`)}-${e.spanId}-${e.sampled?`01`:`00`}`}),us={"http:":80,"https:":443,"ws:":80,"wss:":443},ds=(e,t,n)=>{let r=yi(t.search,n).slice(1);if(e.attribute(`url.full`,yi(t.href,n)),e.attribute(`url.path`,t.pathname),r!==``&&e.attribute(`url.query`,r),e.attribute(`url.scheme`,t.protocol.slice(0,-1)),t.hostname!==``){e.attribute(`server.address`,t.hostname.startsWith(`[`)?t.hostname.slice(1,-1):t.hostname);let n=t.port===``?us[t.protocol]:Number(t.port);n!==void 0&&e.attribute(`server.port`,n)}},fs=(e,t)=>{let n=e.params.filter(([,e])=>typeof e!=`string`).map(([e])=>e);return n.length===0?t:[...t,...new URLSearchParams(n.map(e=>[e,``])).keys()]},ps=(e,t,n,r,i)=>{for(let a in n)r(a,t)&&e.attribute(`http.${t}.header.${a}`,va(a,i)?`<redacted>`:n[a])},ms=`~effect/http/HttpClient`,hs=U(`effect/HttpClient`),gs=(e=>(...t)=>Jn(hs,n=>n[e](...t)))(`get`),_s=pr(2,(e,t)=>vs(n=>t(e.postprocess(n)),e.preprocess)),vs=(e,t)=>{let n=Object.create(ys);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},ys={[ms]:ms,pipe(){return ya(this,arguments)},...wi,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(Mo.map(([e,t])=>[t,function(t,n){return this.execute(Ho(e)(t,n))}]))},bs=e=>vs(t=>Jn(t,t=>pn(n=>{let r=Os.get(t),i=r??new AbortController,a=Io(t.url,t.urlParams,nt(t.hash));if(An(a))return qr(new ci({reason:new Fi({request:t,cause:a.failure})}));let o=a.success;if(n.getRef(B)||n.getRef(Ss)(t)){let a=e(t,o,i.signal,n);return r?Pn(a,e=>As(e,i,!0)):ke(e=>At(e(a),{onSuccess(e){return Na(As(e,i,!1))},onFailure(e){return F(e)&&i.abort(),ta(e)}}))}return Ce(n.getRef(Ts)(t),{kind:`client`},a=>{a.attribute(`http.request.method`,t.method);let s=n.getRef(vn);ds(a,o,fs(t.urlParams,n.getRef($i)));let c=n.getRef(Cs);return ps(a,`request`,t.headers,c,s),t=n.getRef(ws)?Ko(t,ls(a)):t,ke(l=>l(e(t,o,i.signal,n)).pipe(dt(a,{captureStackTrace:!1}),At({onSuccess:e=>(a.attribute(`http.response.status_code`,e.status),ps(a,`response`,e.headers,c,s),e.status>=400&&e.status<600&&(a.attribute(`error.type`,String(e.status)),xs(n,a,t,e)),Na(As(e,i,r!==void 0))),onFailure(e){return!r&&F(e)&&i.abort(),ta(e)}})))})})),Na),xs=(e,t,n,r)=>{let i=H();Ee(0);let a;try{a=vr(new ci({reason:new kr({request:n,response:r})}))}finally{Ee(i)}t.end(e.getRef(Zr)?e.getRef(_a).currentTimeNanosUnsafe():BigInt(0),a)},Ss=Kt(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>or}),Cs=Kt(`effect/http/HttpClient/TracerHeaderFilter`,{defaultValue:()=>or}),ws=Kt(`effect/http/HttpClient/TracerPropagationEnabled`,{defaultValue:bi}),Ts=Kt(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>e.method}),Es=e=>Tr(hs)(Vi(t=>Pn(e,e=>_s(e,Di(e=>r(t,e)))))),Ds=(()=>{if(`FinalizationRegistry`in globalThis&&globalThis.FinalizationRegistry){let e=new FinalizationRegistry(e=>{try{e.abort()}catch{}});return{register(t,n){e.register(t,n,t)},unregister(t){e.unregister(t)}}}let e=new WeakMap;return{register(t,n){e.set(t,setTimeout(()=>n.abort(),5e3))},unregister(t){let n=e.get(t);n!==void 0&&(clearTimeout(n),e.delete(t))}}})(),Os=new WeakMap,ks=new WeakMap,As=(e,t,n)=>(n||(Ds.register(e,t),e=new js(e,t)),ks.set(e,t),e),js=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[as]=as;[es]=es;applyInterrupt(e){return Ht(()=>(Ds.unregister(this.original),Br(e,()=>de(()=>{this.controller.abort()}))))}get request(){return this.original.request}get url(){return this.original.url}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get upgrade(){return this.applyInterrupt(this.original.upgrade)}[rs](){let e=is(this.original);return e!==void 0&&Ds.unregister(this.original),e}get stream(){return qt(()=>(Ds.unregister(this.original),Nr(this.original.stream,de(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[rn](){return this.original[rn]()}pipe(){return ya(this,arguments)}},Ms=Kt(`effect/http/FetchHttpClient/Fetch`,{defaultValue:()=>globalThis.fetch}),Ns=Kt(`effect/http/FetchHttpClient/StreamBodyFallback`,{defaultValue:()=>`error`}),Ps=class extends U()(`effect/http/FetchHttpClient/RequestInit`){},Fs,Is=()=>{try{let e=!1,t=new ReadableStream,n=new Request(`https://example.com`,{method:`POST`,body:t,get duplex(){return e=!0,`half`}});return(e||n.body===t)&&!n.headers.has(`Content-Type`)}catch{return!1}},Ls=Es(Na(bs((e,t,n,r)=>{if(e.headers.upgrade!==void 0)return qr(new ci({reason:new On({request:e,description:`fetch cannot send an HTTP upgrade request`})}));let i=r.getRef(Ms),a=an(r.context,Ps)??{},o=a.headers?xt(Ta(a.headers),e.headers):e.headers;o[`content-length`]&&(o=S(o,`content-length`));let s,c=de(()=>s?.abort()),l=r=>Pn(Jt({try:()=>i(t,{...a,method:e.method,headers:o,body:r,duplex:typeof ReadableStream<`u`&&r instanceof ReadableStream?`half`:void 0,signal:s?AbortSignal.any([n,s.signal]):n}),catch:t=>new ci({reason:new On({request:e,cause:t})})}),t=>{let n=os(e,t);return s?(t.body===null&&s.abort(),Object.create(n,{...Object.fromEntries([`arrayBuffer`,`text`,`json`,`formData`,`urlParamsBody`].map(e=>[e,{get:()=>Vn(n[e],c)}])),stream:{get:()=>Nr(n.stream,c)}})):n}).pipe(j(()=>c));switch(e.body._tag){case`Raw`:case`Uint8Array`:return l(e.body.body);case`FormData`:return l(e.body.formData);case`Stream`:if(Fs??=Is(),Fs){s=new AbortController;let t=AbortSignal.any([n,s.signal]),r=Pi(e=>{let n=()=>e(ca);if(t.aborted)n();else return t.addEventListener(`abort`,n,{once:!0}),de(()=>t.removeEventListener(`abort`,n))});return Jn(Oe(Pe(e.body.stream,r)),l)}return r.getRef(Ns)===`error`?qr(new ci({reason:new Yi({request:e,description:`Streaming request bodies are not supported in this runtime`})})):g(e.body.stream).pipe(w(t=>new ci({reason:new Yi({request:e,cause:t})})),Jn(l))}return l(void 0)}))),Rs=`~effect/reactivity/AsyncResult`,zs=e=>Bi(e,Rs),Bs={[Rs]:{E:sa,A:sa},pipe(){return ya(this,arguments)},[oi](e){if(!zs(e)||this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case`Initial`:return!0;case`Success`:return qi(this.value,e.value);case`Failure`:return qi(this.cause,e.cause)}},[pi](){let e=En(`${this._tag}:${this.waiting}`);return this._tag===`Initial`?e:Ni(e)(this._tag===`Success`?Dr(this.value):Dr(this.cause))}},Vs=(e,t)=>e._tag===`Success`?qs(e.value):Xs(e.cause,{previous:t}),Hs=e=>e._tag===`None`?Gs(!0):Qs(e.value),Us=e=>e._tag===`Initial`,Ws=e=>e._tag!==`Initial`,Gs=(e=!1)=>{let t=Object.create(Bs);return t._tag=`Initial`,t.waiting=e,t},Ks=e=>e._tag===`Success`,qs=(e,t)=>{let n=Object.create(Bs);return n._tag=`Success`,n.value=e,n.waiting=t?.waiting??!1,n.timestamp=t?.timestamp??Date.now(),n},Js=e=>e._tag===`Failure`,Ys=(e,t)=>{let n=Object.create(Bs);return n._tag=`Failure`,n.cause=e,n.previousSuccess=t?.previousSuccess??Aa(),n.waiting=t?.waiting??!1,n},Xs=(e,t)=>Ys(e,{previousSuccess:Xe(t.previous,e=>Ks(e)?zt(e):Js(e)?e.previousSuccess:Aa()),waiting:t.waiting}),Zs=(e,t)=>Xs(x(e),t),Qs=pr(e=>zs(e[0]),(e,t)=>{if(e.waiting)return t?.touch?$s(e):e;let n=Object.assign(Object.create(Bs),e);return n.waiting=!0,t?.touch&&Ks(n)&&(n.timestamp=Date.now()),n}),$s=e=>Ks(e)?qs(e.value,{waiting:e.waiting}):e,ec=pr(2,(e,t)=>e._tag===`Failure`?Xs(e.cause,{previous:t,waiting:e.waiting}):e),tc=e=>e._tag===`Success`?zt(e.value):e._tag===`Failure`?Me(e.previousSuccess,e=>e.value):Aa(),nc=pr(2,(e,t)=>Re(tc(e),t)),rc=e=>We(tc(e),()=>new bt(`AsyncResult.getOrThrow: no value found`)),ic=e=>{switch(e._tag){case`Success`:return wa(e.value);case`Failure`:return dr(e.cause);default:return vr(new bt)}},ac=pr(2,(e,t)=>{switch(e._tag){case`Initial`:return e;case`Failure`:return Ys(e.cause,{previousSuccess:Me(e.previousSuccess,e=>qs(t(e.value),e)),waiting:e.waiting});case`Success`:return qs(t(e.value),e)}}),oc=pr(2,(e,t)=>{switch(e._tag){case`Initial`:return t.onInitial(e);case`Failure`:return t.onFailure(e);case`Success`:return t.onSuccess(e)}}),sc=e=>{let t=e.success??la,n=e.error??la,r=Fr()([t,Hn(n,Jr())],([e,t])=>(n,r,i)=>{if(!zs(n))return qr(new zi(r,n,i));switch(n._tag){case`Initial`:return Na(n);case`Success`:return ba(tn(e)(n.value,i),{onSuccess:e=>qs(e,n),onFailure:e=>Gr(r,`value`,e,n,i)});case`Failure`:{let a=n.previousSuccess.pipe(Me(t=>ba(tn(e)(t.value,i),{onSuccess:e=>zt(qs(e,t)),onFailure:e=>new fi(r,[new zn([`previousSuccess`,`value`],e)],n,i)})),Re(()=>_)),o=ha(tn(t)(n.cause,i),e=>Gr(r,`cause`,e,n,i));return sr(a,e=>Ct(o,t=>Ys(t,{previousSuccess:e,waiting:n.waiting})))}}},{expected:`AsyncResult`,toCodec([e,t]){let n=M(`Success`,{value:e,waiting:Hi,timestamp:cr});return Ut()(et([M(`Initial`,{waiting:Hi}),n,M(`Failure`,{cause:t,previousSuccess:Fn(n),waiting:Hi})]),Mi({decode:e=>{switch(e._tag){case`Initial`:return Gs(e.waiting);case`Success`:return qs(e.value,{waiting:e.waiting,timestamp:e.timestamp});case`Failure`:return Ys(e.cause,{previousSuccess:Me(e.previousSuccess,e=>qs(e.value,e)),waiting:e.waiting})}},encode(e){switch(e._tag){case`Initial`:return{_tag:`Initial`,waiting:e.waiting};case`Success`:return{_tag:`Success`,value:e.value,waiting:e.waiting,timestamp:e.timestamp};case`Failure`:return{_tag:`Failure`,cause:e.cause,previousSuccess:e.previousSuccess,waiting:e.waiting}}}}))},toEquivalence:$n,toFormatter:([e,t])=>n=>{switch(n._tag){case`Success`:return`AsyncResult.Success(${e(n.value)}, ${n.waiting}, ${n.timestamp})`;case`Failure`:return`AsyncResult.Failure(${t(n.cause)}, ${n.waiting})`;case`Initial`:return`AsyncResult.Initial(${n.waiting}, ${n.waiting})`}}});return Object.assign(r,{success:t,error:n})},cc=`~effect/reactivity/Reactivity`,lc=U(`effect/reactivity/Reactivity`),uc=de(()=>{let e=new Map,t=t=>{let n=new Set;for(let r of t)e.get(r)?.forEach(e=>{n.has(e)||(n.add(e),e())})},n=e=>{let n=new Set;gc(e,e=>n.add(e)),t(n)},r=e=>Vi(t=>{let r=an(t,dc);return r?gc(e,e=>{r.add(e)}):n(e),sn}),i=(e,t)=>It(t,r(e)),a=(t,n)=>{let r=[];return gc(t,t=>{r.push(t);let i=e.get(t);i===void 0&&(i=new Set,e.set(t,i)),i.add(n)}),()=>{for(let t=0;t<r.length;t++){let i=e.get(r[t]);i!==void 0&&(i.delete(n),i.size===0&&e.delete(r[t]))}}},o=(e,t)=>mr(function*(){let n=yield*mi(),r=xe(n,Qi),i=yield*$t(),o=yn(qe(n),Ji(r)),s=!1,c=!1,l=!1,u=e=>{e._tag===`Failure`?(l=!0,c=!1,s=!1,f(),on(i,e.cause)):(fn(i,e.value),c?(c=!1,o(t).addObserver(u)):s=!1)};function d(){l||(s?c=!0:(s=!0,o(t).addObserver(u)))}let f=a(e,d);return yield*Gn(r,de(f)),d(),i}),s=(e,t)=>o(e,t).pipe(Pn(ne),Ei),c=e=>Ht(()=>{let n=new Set;return e.pipe(Pr(dc,n),$e(e=>de(()=>t(n))))});return lc.of({[cc]:cc,mutation:i,query:o,stream:s,invalidateUnsafe:n,invalidate:r,registerUnsafe:a,withBatch:c})}),dc=class extends U()(`effect/reactivity/Reactivity/PendingInvalidation`){},fc=pr(2,(e,t)=>lc.use(n=>n.mutation(t,e))),pc=e=>lc.use(t=>t.invalidate(e)),mc=Tr(lc)(uc);function hc(e){switch(typeof e){case`string`:case`number`:case`bigint`:case`boolean`:return String(e);default:return Dr(e)}}var gc=(e,t)=>{if(Array.isArray(e))for(let n=0;n<e.length;n++)t(hc(e[n]));else for(let n in e){t(n);let r=e[n];for(let e=0;e<r.length;e++)t(`${n}:${hc(r[e])}`)}},_c=`~effect/SubscriptionRef`,vc=e=>Bi(e,_c);({...Gt});var yc=e=>it(e.pubsub),bc=e=>de(()=>e.value),xc=(e,t)=>{e.value=t,ut(e.pubsub,t)},Sc=pr(2,(e,t)=>e.semaphore.withPermit(de(()=>xc(e,t)))),Cc=(e,t)=>!zs(e)||!zs(t)?!0:Us(t)?Us(e):Ks(e)&&Ks(t)?t.timestamp>=e.timestamp:!0,wc=`~effect/reactivity/AtomRegistry`,Tc=e=>Bi(e,wc),Ec=e=>new Fc(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),Dc=U(wc),Oc=pr(e=>Tc(e[0]),(e,t,n)=>{let r=n?.suspendOnWaiting??!1;return Pi(n=>{let i=e.get(t);if(i._tag!==`Initial`&&!(r&&i.waiting))return n(ic(i));let a=e.subscribe(t,e=>{e._tag!==`Initial`&&!(r&&e.waiting)&&(n(ic(e)),a())});return de(a)})}),kc={immediate:!0},Ac=e=>{e()},jc={};function Mc(e,t){let n=jc;for(let r of e)try{t(r)}catch(e){n===jc&&(n=e)}if(n!==jc)throw n}var Nc=`~effect-atom/atom/Atom/Serializable`,Pc=e=>Nc in e?e[Nc].key:e,Fc=class{[wc];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(e,t,n,r){if(this[wc]=wc,this.scheduler=new Ne(`sync`,t),this.schedulerAsync=new Ne(`async`,t),this.dispatcher=this.schedulerAsync.makeDispatcher(),this.defaultIdleTTL=r,this.timeoutResolution=n===void 0&&r!==void 0?Math.round(r/2):n??1e3,e!==void 0)for(let[t,n,r]of e){let e=t;for(;e.initialValueTarget;)e=e.initialValueTarget;this.ensureNode(e).setInitialValue(n,r?.skipInitialRun)}}nodes=new Map;preloadedSerializable=new Map;timeoutBuckets=new Map;nodeTimeoutBucket=new Map;disposed=!1;getNodes(){return this.nodes}get(e){return this.ensureNode(e).value()}set(e,t){e.write(this.ensureNode(e).writeContext,t)}setSerializable(e,t){this.preloadedSerializable.set(e,t)}modify(e,t){let n=this.ensureNode(e),r=t(n.value());return e.write(n.writeContext,r[1]),r[0]}update(e,t){let n=this.ensureNode(e);e.write(n.writeContext,t(n.value()))}refresh=e=>{e.refresh===void 0?this.invalidateAtom(e):e.refresh(this.refresh)};subscribe(e,t,n){let r=this.ensureNode(e);if(n?.immediate)t(r.value());else try{r.value()}catch(e){if((r.state&Ic.waitingForValue)===0)throw e}let i=r.subscribe(function(){t(r._value)});return()=>{i(),r.canBeRemoved&&this.scheduleNodeRemoval(r)}}mount(e){return this.subscribe(e,$r,kc)}atomHasTtl(e){return!e.keepAlive&&e.idleTTL!==0&&(e.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(e){let t=Pc(e),n=this.nodes.get(t);if(n===void 0?(n=this.createNode(e),this.nodes.set(t,n),this.onNodeAdded?.(n)):this.atomHasTtl(e)&&this.removeNodeTimeout(n),typeof t==`string`&&this.preloadedSerializable.has(t)){let r=this.preloadedSerializable.get(t);this.preloadedSerializable.delete(t);let i=e[Nc],a;try{a=i.decode(r)}catch(e){if(v(e))return n;throw e}let o=e;for(;o.initialValueTarget;)o=o.initialValueTarget;let s=o===e?n:this.ensureNode(o);Cc(s._value,a)&&s.setInitialValue(a,i.skipInitialRun)}return n}createNode(e){if(this.disposed)throw Error(`Cannot access Atom ${e}: registry is disposed`);return e.keepAlive||this.scheduleAtomRemoval(e),new Rc(this,e)}invalidateAtom=e=>{let t=this.ensureNode(e);t.skipInitialRun=!1,t.invalidate()};scheduleAtomRemoval(e){this.dispatcher.scheduleTask(()=>{let t=this.nodes.get(Pc(e));t!==void 0&&t.canBeRemoved&&this.removeNode(t)},0)}scheduleNodeRemoval(e){this.dispatcher.scheduleTask(()=>{e.canBeRemoved&&this.removeNode(e)},0)}removeNode(e){this.atomHasTtl(e.atom)?this.setNodeTimeout(e):(this.nodes.delete(Pc(e.atom)),e.remove(),this.onNodeRemoved?.(e))}setNodeTimeout(e){if(this.nodeTimeoutBucket.has(e))return;let t=e.atom.idleTTL??this.defaultIdleTTL;if(this.#e!==null&&(t-=this.#e,t<=0)){this.nodes.delete(Pc(e.atom)),e.remove(),this.onNodeRemoved?.(e);return}let n=Math.ceil(t/this.timeoutResolution)*this.timeoutResolution,r=Date.now()+n,i=r-r%this.timeoutResolution+this.timeoutResolution,a=this.timeoutBuckets.get(i);a===void 0&&(a=[new Set,setTimeout(()=>this.sweepBucket(i),i-Date.now())],this.timeoutBuckets.set(i,a)),a[0].add(e),this.nodeTimeoutBucket.set(e,i)}removeNodeTimeout(e){let t=this.nodeTimeoutBucket.get(e);if(t===void 0)return;this.nodeTimeoutBucket.delete(e),this.scheduleNodeRemoval(e);let[n,r]=this.timeoutBuckets.get(t);n.delete(e),n.size===0&&(clearTimeout(r),this.timeoutBuckets.delete(t))}#e=null;sweepBucket(e){let t=this.timeoutBuckets.get(e)[0];this.timeoutBuckets.delete(e),Mc(t,this.removeIdleNode)}removeIdleNode=e=>{if(this.nodeTimeoutBucket.delete(e),e.canBeRemoved){this.nodes.delete(Pc(e.atom)),this.onNodeRemoved?.(e),this.#e=e.atom.idleTTL??this.defaultIdleTTL;try{e.remove()}finally{this.#e=null}}};reset(){this.timeoutBuckets.forEach(([,e])=>clearTimeout(e)),this.timeoutBuckets.clear(),this.nodeTimeoutBucket.clear();let e=Array.from(this.nodes.values());this.nodes.clear();for(let t of e)t.state=Lc.removed;Mc(e,this.destroyNode)}destroyNode=e=>{e.remove(),this.onNodeRemoved?.(e)};dispose(){this.disposed=!0,this.reset()}},Ic={alive:1,initialized:2,waitingForValue:4},Lc={uninitialized:Ic.alive|Ic.waitingForValue,stale:Ic.alive|Ic.initialized|Ic.waitingForValue,valid:Ic.alive|Ic.initialized,removed:0},Rc=class{constructor(e,t){this.registry=e,this.atom=t,this.writeContext=new Hc(e,this)}registry;atom;state=Lc.uninitialized;lifetime;writeContext;preserveInitialValueOnBuild=!1;skipInitialRun=!1;keptParents;invalidatedDuringBuild=!1;failed=!1;parents=new Set;children=new Set;listeners=new Set;observedChildren=0;currentState(){switch(this.state){case Lc.uninitialized:return`uninitialized`;case Lc.stale:return`stale`;case Lc.valid:return`valid`;default:return`removed`}}get canBeRemoved(){return!this.atom.keepAlive&&this.listeners.size===0&&this.children.size===0&&this.state!==0}get building(){return this.lifetime!==void 0&&this.lifetime.reads!==void 0}get isObserved(){return!this.atom.lazy||this.listeners.size>0||this.observedChildren>0}childObserved(e){let t=this.isObserved;this.observedChildren+=e,t!==this.isObserved&&this.observedChanged(e)}observedChanged(e){for(let t of this.parents)t.childObserved(e)}_value=void 0;value(){for(;(this.state&Ic.waitingForValue)!==0;)this.build();return this._value}build(){let e=Vc(this);try{this.disposeLifetime()}catch(t){e.failure=t}this.invalidatedDuringBuild=!1,this.lifetime=e;let t,n=!1;try{t=this.atom.read(e),n=!0}finally{let t=e.reads;e.reads=void 0,this.lifetime===e&&(this.dropUnread(t),n||this.fail())}if(this.lifetime===e&&(this.state&Ic.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.skipInitialRun&&(this.keptParents=Array.from(this.parents,e=>[e,e.lifetime])),this.failed=!1,this.state=Lc.valid):this.setValue(t)),e.failure!==jc)throw e.failure}fail(){this.failed=!0;try{this.invalidateChildren()}catch{}}readTracked(e,t){let n=this.registry.ensureNode(e);this.parents.has(n)||(this.parents.add(n),n.children.add(this),this.isObserved&&n.childObserved(1));try{return n.value()}catch(e){if(t.reads===void 0||n.state!==Lc.valid)throw e;return t.failure===jc&&(t.failure=e),n._value}finally{t.reads!==void 0&&!t.disposed&&t.reads.add(n)}}dropUnread(e){if(e.size===this.parents.size)return;let t=this.isObserved;for(let n of this.parents)e.has(n)||(this.parents.delete(n),n.children.delete(this),t&&n.childObserved(-1),n.canBeRemoved&&this.registry.scheduleNodeRemoval(n))}valueOption(){return(this.state&Ic.initialized)===0?Aa():zt(this._value)}setInitialValue(e,t=!1){(this.state&Ic.initialized)===0?(this.preserveInitialValueOnBuild=!0,this.skipInitialRun=t,this.state=Lc.stale,this._value=e,this.listeners.size>0&&this.announce()):this.setValue(e)}setValue(e){let t=this.failed;this.failed=!1;let n=(this.state&Ic.initialized)!==0;if(this.state=Lc.valid,n&&this.atom.equals(this._value,e)){t&&this.invalidateChildren();return}this._value=e;let r=jc;try{(n||t)&&this.invalidateChildren()}catch(e){r=e}if(this.listeners.size>0)try{this.announce()}catch(e){r===jc&&(r=e)}if(r!==jc)throw r}announce(){Wc.phase===Uc.collect?Wc.notify.add(this):this.notify()}invalidate(){if(this.state===Lc.valid){this.state=Lc.stale;try{this.disposeLifetime()}finally{this.propagate()}}else this.building&&Wc.phase!==Uc.collect?this.build():this.propagate()}propagate(){Wc.phase===Uc.collect?(this.building&&(this.invalidatedDuringBuild=!0),Wc.stale.push(this)):this.isObserved?this.value():this.invalidateChildren()}invalidateChildren(){if(this.children.size===0)return;let e=jc;for(let t of Array.from(this.children))if(t.affectedBy(this))try{t.invalidate()}catch(t){e===jc&&(e=t)}if(e!==jc)throw e}affectedBy(e){if(this.state===Lc.valid)return!0;let t=this.lifetime?.reads;return t===void 0?this.isObserved&&e.state===Lc.valid:t.has(e)}notify(){Wc.phase===Uc.commit&&Wc.notify.delete(this),Mc(this.listeners,Ac)}disposeLifetime(){let e=this.lifetime;e!==void 0&&(this.lifetime=void 0,e.dispose())}remove(){let e=this.isObserved;this.state=Lc.removed,this.listeners.clear();try{this.disposeLifetime()}finally{let t=Array.from(this.parents);this.parents.clear(),Mc(t,t=>{t.children.delete(this),e&&t.childObserved(-1),t.canBeRemoved&&this.registry.removeNode(t)})}}subscribe(e){let t=this.isObserved;return this.listeners.add(e),t||this.observedChanged(1),()=>{this.listeners.delete(e)&&!this.isObserved&&this.observedChanged(-1)}}},zc=e=>{let t=e,n=t.node;if(!n.skipInitialRun)return!1;let r=n.keptParents;return n.skipInitialRun=!1,n.keptParents=void 0,!t.isFn&&!Us(n._value)&&(r===void 0||r.every(([e,t])=>e.lifetime===t))},Bc={get registry(){return this.node.registry},addFinalizer(e){if(this.disposed)return e();this.finalizers??=[],this.finalizers.push(e)},get(e){return this.disposed?this.node.registry.get(e):this.node.readTracked(e,this)},result(e,t){if(this.disposed||this.isFn)return this.resultOnce(e,t);let n=this.get(e);if(t?.suspendOnWaiting&&n.waiting)return L;switch(n._tag){case`Initial`:return L;case`Failure`:return dr(n.cause);case`Success`:return Na(n.value)}},resultOnce(e,t){return Pi(n=>{let r=this.once(e);if(r._tag!==`Initial`&&!(t?.suspendOnWaiting&&r.waiting))return n(ic(r));let i=this.node.registry.subscribe(e,e=>{e._tag===`Initial`||t?.suspendOnWaiting&&e.waiting||(i(),n(ic(e)))},{immediate:!1});return de(i)})},setResult(e,t){return this.disposed?L:(this.node.registry.set(e,t),this.resultOnce(e,{suspendOnWaiting:!0}))},some(e){if(this.disposed||this.isFn)return this.someOnce(e);let t=this.get(e);return t._tag===`None`?L:Na(t.value)},someOnce(e){return Pi(t=>{let n=this.once(e);if(me(n))return t(Na(n.value));let r=this.node.registry.subscribe(e,e=>{z(e)||(r(),t(Na(e.value)))},{immediate:!1});return de(r)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?Aa():this.node.valueOption()},refresh(e){this.disposed||this.node.registry.refresh(e)},refreshSelf(){this.disposed||this.node.invalidate()},mount(e){this.disposed||this.addFinalizer(this.node.registry.mount(e))},subscribe(e,t,n){this.disposed||this.addFinalizer(this.node.registry.subscribe(e,t,n))},setSelf(e){this.disposed||this.node.setValue(e)},set(e,t){this.disposed||this.node.registry.set(e,t)},stream(e,t){return this.disposed?u:zr(n=>de(()=>{this.subscribe(e,e=>fn(n,e),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(Ke(Ws),Ma(e=>e._tag===`Success`?Na(e.value):ta(e.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0,Mc(e.reverse(),Ac)}},Vc=e=>{function t(n){return t.disposed||t.isFn?e.registry.get(n):e.readTracked(n,t)}return Object.setPrototypeOf(t,Bc),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t.reads=new Set,t.failure=jc,t},Hc=class{constructor(e,t){this.registry=e,this.node=t}registry;node;get(e){return this.registry.get(e)}set(e,t){return this.registry.set(e,t)}setSelf(e){return this.node.setValue(e)}refreshSelf(){return this.node.invalidate()}},Uc={disabled:0,collect:1,commit:2},Wc={phase:Uc.disabled,depth:0,stale:[],notify:new Set};function Gc(e){let t=Wc.phase;Wc.phase=Uc.collect,Wc.depth++;let n=jc;try{e()}catch(e){n=e}if(Wc.depth===1){let{notify:e,stale:t}=Wc,r=0;do{for(Wc.phase=Uc.collect;r<t.length;r++)try{Kc(t[r])}catch(e){n===jc&&(n=e)}Wc.phase=Uc.commit;for(let t of e)try{t.notify()}catch(e){n===jc&&(n=e)}}while(r<t.length);Wc.stale=[],e.clear()}if(Wc.depth--,Wc.phase=t,n!==jc)throw n}function Kc(e){if(e.state===Lc.valid){if(!e.invalidatedDuringBuild)return;e.invalidatedDuringBuild=!1,e.state=Lc.stale,e.disposeLifetime()}e.value()}var qc=`~effect/reactivity/Atom`,Jc=e=>Bi(e,qc),Yc=`~effect/reactivity/Atom/Writable`,Xc=pr(2,(e,t)=>{let n=h(t),r=Bt(n);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!r,idleTTL:r?Pt(n):void 0})}),Zc=Xc(0),Qc={[qc]:qc,equals:Object.is,...Gt,toJSON(){return{_id:`Atom`,keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},$c={...Qc,atom(e,t){let n=sl(e,t);return rl(e=>{let t=e.self(),r=e(this);return r._tag===`Success`?n(e,r.value):ec(r,t)})},fn(e,t){return arguments.length===0?(e,t)=>el(this,e,t):el(this,e,t)},pull(e,t){let n=Zc(ul(0));return Tl(n,rl(r=>{let i=r.self(),a=r(this);return a._tag===`Success`?fl(r,wl(r,n,e,t),Gs(!0),a.value):ec(a,i)}))},subscriptionRef(e){return bl(Zc(rl(t=>{let n=t.self(),r=t(this);if(r._tag!==`Success`)return ec(r,n);let i=typeof e==`function`?e(t):e;return vc(i)?i:fl(t,i,Gs(!0),r.value)})),(e,t)=>yl(e,t,rc(e(this))))}},el=(e,t,n)=>{let[r,i,a]=Cl(n?.reactivityKeys?(e,r)=>{let i=t(e,r);return Da(i)?fc(i,n.reactivityKeys):Vt(i,pc(n.reactivityKeys))}:t,n);return il(t=>{t.get(a);let n=t.self(),i=t.get(e);return i._tag===`Success`?r(t,i.value):ec(i,n)},i)},tl={...Qc,[Yc]:Yc},nl=e=>Yc in e,rl=(e,t)=>{let n=Object.create(Qc);return n.keepAlive=!1,n.lazy=!0,n.read=e,n.refresh=t,n},il=(e,t,n)=>{let r=Object.create(tl);return r.keepAlive=!1,r.lazy=!0,r.read=e,r.write=t,r.refresh=n,r};function al(e,t){e.setSelf(t)}var ol=(e,t)=>{let n=sl(e,t);return`~effect/reactivity/Atom`in n?n:rl(n)},sl=(e,t)=>{if(typeof e==`function`&&!Da(e)&&!gt(e)){let n=e;return function(e,r){let i=n(e);switch(typeof i){case`function`:case`object`:return i===null?i:cl in i?dl(e,i,t,r):ll in i?_l(e,i,t,r):i;default:return i}}}return Da(e)?function(n,r){return dl(n,e,t,r)}:gt(e)?function(n,r){return _l(n,e,t,r)}:ul(e)},cl=`~effect/Effect`,ll=`~effect/Stream`,ul=e=>il(function(t){return e},al),dl=(e,t,n,r)=>fl(e,t,n?.initialValue===void 0?Gs():qs(n.initialValue),r,n?.uninterruptible);function fl(e,t,n,r=Ti(),i=!1){let a=e.self();if(a._tag===`Some`&&zc(e))return a.value;let o=typeof r==`function`?r:br(r),s=vi();e.addFinalizer(()=>{qe(o())(pl(s))});let c,l=!1,u=ml(o().pipe(De(Qi,s),De(Dc,e.registry),De(ht,e.registry.scheduler)),t,function(t){l?e.setSelf(Vs(t,e.self())):c=Vs(t,a)},i);return l=!0,u!==void 0&&e.addFinalizer(u),c===void 0?a._tag===`Some`?Hs(a):Qs(n):c}var pl=e=>Or(ir(e,jn),e=>O(e)?sn:bn(ta(e),{log:`Unhandled`,message:`Unhandled error in atom finalizer`}));function ml(e,t,n,r=!1){if(_n(t)){n(t);return}let i=qe(e)(t);i.currentDispatcher?.flush();let a=i.pollUnsafe();if(a){n(a);return}let o=i.addObserver(n);function s(){o(),r||i.interruptUnsafe()}return s}function hl(e){let t=e?.memoMap??Zc(ol(()=>di())),n=e=>Jc(t)?e(t):t,r=mc;function i(e){let t=Object.create($c);t.keepAlive=!1,t.lazy=!0,t.refresh=void 0,t.factory=i;let a=Dl(rl(typeof e==`function`?e:()=>e));return t.layer=a,t.read=function(e){let t=Wr(e(a),r),i=Ti();return fl(e,Jn(Fe,r=>Pn(ji(t,n(e),r),e=>(i=e,e))),Gs(),()=>i,!0)},t}i.memoMap=t,i.addGlobalLayer=e=>{r=Wr(r,Rn(e,mc))};let a=Zc(ol(e=>Vi(t=>ji(mc,n(e),xe(t,Qi))).pipe(Pn(xe(lc)))));return i.withReactivity=e=>t=>Ol(t,n=>{let r=rc(n(a));return n.addFinalizer(r.registerUnsafe(e,()=>{n.refresh(t)})),n.subscribe(t,e=>n.setSelf(e)),n.once(t)},{initialValueTarget:t}),i}var gl=hl();gl.withReactivity;var _l=(e,t,n,r)=>vl(e,t,n?.initialValue===void 0?Gs():qs(n.initialValue),r);function vl(e,t,n,r=Ti()){let i=e.self();if(i._tag===`Some`&&zc(e))return i.value;r=De(r,Dc,e.registry);let o=_t(n=>Jn(Se(t.channel,n),t=>en({while:bi,body:()=>t,step(t){e.setSelf(qs(Xr(t),{waiting:!0}))}}))).pipe(Or(t=>(a(t)?Nn(e.self(),Xe(tc),mt({onNone:()=>e.setSelf(Zs(new bt,{previous:e.self()})),onSome:t=>e.setSelf(qs(t))})):e.setSelf(Xs(t,{previous:e.self()})),sn))),s=ml(r.pipe(De(Dc,e.registry),De(ht,e.registry.scheduler)),o,$r,!1);return s!==void 0&&e.addFinalizer(s),i._tag===`Some`?Hs(i):Qs(n)}var yl=(e,t,n=Ti())=>vc(t)?(e.addFinalizer(yc(t).pipe(Ft(t=>{for(let n=0;n<t.length;n++)e.setSelf(t[n]);return sn}),Ve(n))),_e(n)(bc(t))):t._tag===`Success`?vl(e,yc(t.value),Gs(!0),n):t,bl=(e,t)=>{function n(t,n){let r=t.get(e);vc(r)?re(Sc(r,n)):Ks(r)&&re(Sc(r.value,n))}return il(n=>{let r=n(e);return vc(r)||Ks(r)?t(n,r):r},n)},xl=Symbol.for(`effect/reactivity/atom/Atom/Reset`),Sl=Symbol.for(`effect/reactivity/atom/Atom/Interrupt`);function Cl(e,t){let n=Zc(ul([0,void 0])),r=t?.initialValue===void 0?Gs():qs(t.initialValue),i=t?.concurrent?Zc(rl(e=>{let t=new Set;return e.addFinalizer(()=>t.forEach(e=>e.interruptUnsafe())),t})):void 0;function a(t,a){let o=i?t(i):void 0;t.isFn=!0;let[s,c]=t.get(n);if(s===0)return r;if(c===Sl)return Xs(Ze(),{previous:t.self()});let l=e(c,t);return cl in l?(o&&(l=Jn(ei(l,{startImmediately:!0}),e=>{o.add(e);let t=Array.from(o);return e.addObserver(()=>o.delete(e)),Pn(er(t),e=>e[0])})),fl(t,l,r,a,!1)):vl(t,l,r,a)}function o(e,t){Al(()=>{t===xl?e.set(n,[0,void 0]):t===Sl?e.set(n,[e.get(n)[0]+1,Sl]):e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})}return[a,o,n]}var wl=(e,t,n,r)=>Jn(ae(typeof n==`function`?n(e):n),n=>{let o=i().context,s=Ln(),c=At(n,{onFailure(e){return a(e)?rr(s)?Na({done:!0,items:s}):qr(new bt(`Atom.pull: no items`)):ta(e)},onSuccess(e){let t;return r?.disableAccumulation?t=e:(t=Ai(s,e),s=t),Na({done:!1,items:t})}}),l=new Set;return e.addFinalizer(()=>{for(let e of l)e()}),e.once(t),e.subscribe(t,()=>{e.setSelf(Hs(e.self()));let t;t=ml(o,c,n=>{t&&l.delete(t);let r=Vs(n,e.self()),i=l.size>0;e.setSelf(i?Qs(r):r)}),t&&l.add(t)}),c}),Tl=(e,t)=>il(t.read,function(t,n){t.set(e,t.get(e)+1)}),El=typeof WeakRef>`u`||typeof FinalizationRegistry>`u`?e=>{let t=Va();return function(n){let r=Ha(t,n);if(r._tag===`Some`)return r.value;let i=e(n);return Ga(t,n,i),i}}:e=>{let t=Va(),n=new FinalizationRegistry(e=>{let n=Ha(t,e);n._tag===`Some`&&n.value.deref()===void 0&&qa(t,e)});return function(r){let i=Ha(t,r).pipe(Lr(e=>e.deref()));if(i._tag===`Some`)return i.value;let a=e(r);return Ga(t,r,new WeakRef(a)),n.register(a,r),a}},Dl=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0}),Ol=pr(e=>Jc(e[0]),(e,t,n)=>{let r=Zc(nl(e)?il(n=>t(n,e),function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):rl(n=>t(n,e),e.refresh??function(t){t(e)}));return n?.initialValueTarget&&(r.initialValueTarget=kl(n.initialValueTarget)),r}),kl=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t},Al=Gc,jl=`~effect-atom/atom/Atom/Serializable`,Ml=pr(2,(e,t)=>{let n=Ae(t.schema);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,label:e.label??[t.key,H()===0?``:Error().stack?.split(`
|
|
2
|
-
`)[5]??``],[jl]:{key:t.key,encode:V(n),decode:Je(n),skipInitialRun:t.skipInitialRun}})}),Nl=`~effect-atom/atom/Atom/ServerValue`,Pl=pr(2,(e,t)=>`~effect-atom/atom/Atom/ServerValue`in e?e[Nl](e=>t.get(e)):t.get(e)),Fl=()=>(e,t)=>{let n=U()(e),r=Tr(n,t.makeEffect??ye(t.group,{...t,flatten:!0}));n.runtime=(t.runtime??gl)(typeof t.protocol==`function`?e=>Rn(r,Ri(t.protocol(e))):Rn(r,Ri(t.protocol))),n.mutation=El(r=>{let i=t.group.requests.get(r);return n.runtime.fn()(xi(function*({headers:e,payload:t,reactivityKeys:i}){let a=(yield*n)(r,t,{headers:e});return yield*i?fc(a,i):a})).pipe(Ml({key:`AtomRpc:mutation:${JSON.stringify([e,r])}`,schema:sc({success:i.successSchema,error:Il(i)})}))});let i=El(e=>{let{headers:r,payload:i,reactivityKeys:a,tag:o,timeToLive:s}=e,c=t.group.requests.get(o),l=st(c.successSchema),u=l?n.runtime.pull(Ei(n.use(e=>Na(e(o,i,{headers:r}))))):n.runtime.atom(n.use(e=>e(o,i,{headers:r})));return a&&(u=n.runtime.factory.withReactivity(a)(u)),!l&&e.serializationKey&&(u=Ml(u,{key:`AtomRpc:${e.tag}:${e.serializationKey}`,schema:sc({success:c.successSchema,error:Il(c)})})),s&&(u=Bt(s)?Xc(u,s):Dl(u)),u});return n.query=(e,t,n)=>{let r={tag:e,payload:t,headers:n?.headers?Ta(n.headers):void 0,reactivityKeys:n?.reactivityKeys,timeToLive:n?.timeToLive===void 0?void 0:h(n.timeToLive),serializationKey:n?.serializationKey};return i(r)},n},Il=e=>et([e.errorSchema,...Array.from(e.middlewares,e=>e.error),nn]),Ll={add(...e){let t=new Map(this.requests);for(let n of e)t.set(n._tag,n);return Rl({requests:t,annotations:this.annotations})},merge(...e){let t=new Map(this.requests),n=new Map(this.annotations.mapUnsafe);for(let r of e){for(let[e,n]of r.requests)t.set(e,n);for(let[e,t]of r.annotations.mapUnsafe)n.set(e,t)}return Rl({requests:t,annotations:lt(n)})},omit(...e){let t=new Map(this.requests);for(let n of e)t.delete(n);return Rl({requests:t,annotations:this.annotations})},middleware(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.middleware(e));return Rl({requests:t,annotations:this.annotations})},toHandlers(e){let t=this;return mr(function*(){let n=yield*mi(),r=Da(e)?yield*e:e,i=new Map;return t.requests.forEach((e,t)=>{i.set(e.key,{tag:e._tag,handler:r[t],context:n})}),lt(i)})},prefix(e){let t=new Map;for(let n of this.requests.values()){let r=n.prefix(e);t.set(r._tag,r)}return Rl({requests:t,annotations:this.annotations})},toLayer(e){return wn(this.toHandlers(e))},of:sa,toLayerHandler(e,t){let n=this;return wn(mr(function*(){let r=yield*mi(),i=Da(t)?yield*t:t,a=new Map,o=n.requests.get(e);return a.set(o.key,{handler:i,context:r}),lt(a)}))},accessHandler(e){return Vi(t=>{let n=this.requests.get(e),{handler:r,context:i}=Qt(t,n.key);return Na((e,t)=>{t.rpc=n;let a=r(e,t),o=Xt(a)?a.value:a;return Da(o)?d(o,i):ue(o,i)})})},annotate(e,t){return Rl({requests:this.requests,annotations:De(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(dn(e,t))},annotateMerge(e){return Rl({requests:this.requests,annotations:r(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[n,i]of this.requests)t.set(n,i.annotateMerge(r(e,i.annotations)));return Rl({requests:t,annotations:this.annotations})}},Rl=e=>Object.assign(function(){},Ll,{requests:e.requests,annotations:e.annotations}),zl=(...e)=>Rl({requests:new Map(e.map(e=>[e._tag,e])),annotations:Ti()}),Bl=`~effect/rpc/RpcMiddleware`,Vl=()=>(e,t)=>{let n=H(),r;n!==0&&(Ee(2),r=new globalThis.Error,Ee(n));function i(){}let a=i;return Object.setPrototypeOf(i,Object.getPrototypeOf(U(e))),i.key=e,Object.defineProperty(i,"stack",{get(){return r?.stack}}),a[Bl]=Bl,a.error=t?.error??la,a.requiredForClient=t?.requiredForClient??!1,i},Hl=(e,t)=>wn(mr(function*(){let n=(yield*mi()).pipe(Xn(Qi)),i=Da(t)?yield*t:t;return lt(new Map([[`${e.key}/Client`,e=>Di(i(e),e=>r(n,e))]]))})),Ul={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Ul.node;var Wl=Te(Ul),Gl={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]};Gl.node;var Kl=Te(Gl);function ql(e){return e?.ownerDocument||document}var J=e(A(),1),Y=ma(),X=Ci(),Jl=class extends te()(`AuthError`,{cause:Yt(Jr()),error:W(hr([`invalid_request`,`invalid_client`,`invalid_client_metadata`,`invalid_redirect_uri`,`invalid_grant`,`invalid_target`,`invalid_scope`,`unsupported_grant_type`,`unsupported_response_type`,`access_denied`,`temporarily_unavailable`])),message:T}){};K({id:Oa,name:Oa}),T.check(Pa(/^https:\/\/[a-z\d-]+\.mp281x\.xyz(?:\/mcp)?$/u)),K({accessToken:Oa,clientId:Oa,expiresAt:Yn,refreshToken:Oa}),K({client_id:Oa}),K({access_token:Oa,expires_in:Yn,refresh_token:Oa});var Yl=e(C(),1);function Xl(e){let t=Yl.unstable_scheduleCallback(4,e);return()=>Yl.unstable_cancelCallback(t)}var Zl=J.createContext(Ec({scheduleTask:Xl,defaultIdleTTL:400})),Ql=new WeakMap,$l=0,eu=new Set;function tu(e){$l++;try{return e()}finally{$l--}}function nu(e){if($l===0)return e();eu.size===0&&queueMicrotask(ru),eu.add(e)}function ru(){for(let e of eu)eu.delete(e),e()}function iu(e,t){let n=Ql.get(e);n===void 0&&(n=new WeakMap,Ql.set(e,n));let r=n.get(t);if(r!==void 0)return r;let i=0,a,o={subscribe(n){i++;let r=e.subscribe(t,()=>nu(n));return()=>{i--,eu.delete(n),r()}},snapshot(){return tu(()=>e.get(t))},getServerSnapshot(){return(i===0||a===void 0)&&(a={value:tu(()=>Pl(t,e))}),a.value}};return n.set(t,o),o}function au(e,t){let n=iu(e,t);return J.useEffect(ru),J.useSyncExternalStore(n.subscribe,n.snapshot,n.getServerSnapshot)}function ou(e,t,n){let r=iu(e,t),i=J.useMemo(()=>{let e;return t=>(e!==void 0&&Object.is(e.source,t)||(e={source:t,value:n(t)}),e.value)},[n]);return J.useEffect(ru),J.useSyncExternalStore(r.subscribe,()=>i(r.snapshot()),()=>i(r.getServerSnapshot()))}var su=(e,t)=>{let n=J.useContext(Zl);return t?ou(n,e,t):au(n,e)};function cu(e,t){J.useEffect(()=>e.mount(t),[t,e])}function lu(e,t,n){return n?.mode===`promise`||n?.mode===`promiseExit`?J.useCallback(r=>{e.set(t,r);let i=at(Oc(e,t,{suspendOnWaiting:!0}));return n.mode===`promise`?i.then(uu):i},[e,t,n.mode]):J.useCallback(n=>{e.set(t,typeof n==`function`?n(e.get(t)):n)},[e,t])}var uu=e=>{if(aa(e))return e.value;throw rt(e.cause)},du=(e,t)=>{let n=J.useContext(Zl);return cu(n,e),lu(n,e,t)},fu=e=>{let t=J.useContext(Zl);return cu(t,e),J.useCallback(()=>{t.refresh(e)},[t,e])},pu=(e,t)=>{let n=J.useContext(Zl);return[au(n,e),lu(n,e,t)]},mu={suspendOnWaiting:new WeakMap,default:new WeakMap};function hu(e,t,n){let r=n?mu.suspendOnWaiting:mu.default,i=r.get(e);i===void 0&&(i=new WeakMap,r.set(e,i));let a=i.get(t);return a===void 0&&(a=new Promise(r=>{let a=e.subscribe(t,e=>{e._tag===`Initial`||n&&e.waiting||(setTimeout(a,1e3),r(),i.delete(t))})}),i.set(t,a)),a}function gu(e,t,n){let r=au(e,t);if(r._tag===`Initial`||n&&r.waiting)throw hu(e,t,n);return r}var _u=(e,t)=>{let n=gu(J.useContext(Zl),e,t?.suspendOnWaiting??!1);if(n._tag===`Failure`&&!t?.includeFailure)throw rt(n.cause);return n},vu=J.createContext(void 0);function yu(){let e=J.useContext(vu);if(e===void 0)throw Error(Sa(13));return e}var bu={imageLoadingStatus:()=>null},xu=J.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,[o,s]=J.useState(`idle`),c={imageLoadingStatus:o},l=J.useMemo(()=>({imageLoadingStatus:o,setImageLoadingStatus:s}),[o,s]),u=Hr(`span`,e,{state:c,ref:t,props:a,stateAttributesMapping:bu});return(0,Y.jsx)(vu.Provider,{value:l,children:u})});function Su(e){J.useEffect(e,Xi)}var Cu=null;globalThis.requestAnimationFrame;var wu=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},Tu=class e{static create(){return new e}static request(e){return wu.request(e)}static cancel(e){return wu.cancel(e)}currentId=Cu;request(e){this.cancel(),this.currentId=wu.request(()=>{this.currentId=Cu,e()})}cancel=()=>{this.currentId!==Cu&&(wu.cancel(this.currentId),this.currentId=Cu)};disposeEffect=()=>this.cancel};function Eu(){let e=y(Tu.create).current;return Su(e.disposeEffect),e}function Du(e){return e==null?e:`current`in e?e.current:e}function Ou(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var ku=`data-starting-style`,Au=`data-ending-style`,ju=e(St(),1),Mu=null;function Nu(e){if(!Mu){let e=[];Mu=e,queueMicrotask(()=>{Mu=null,ju.flushSync(()=>{for(let t of e)t()})})}Mu.push(e)}function Pu(e,t=!1,n=!1){let r=Eu();return G((i,a=null)=>{r.cancel();let o=Du(e);if(o==null)return;let s=o,c=()=>{n?Nu(()=>{a?.aborted||i()}):ju.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(Ou(s).map(e=>e.finished.then(nr))).then(()=>{a?.aborted||c()},()=>{a?.aborted||(Ou(s).some(e=>e.pending||e.playState!==`finished`)?l():c())})}if(t){let e=ku;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}else r.request(l)})}function Fu(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=G(a),s=Pu(r,n,i);J.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}var Iu={[ku]:``},Lu={[Au]:``},Ru={transitionStatus(e){return e===`starting`?Iu:e===`ending`?Lu:null}};function zu(e,t=!1,n=!1,r=!1){let[i,a]=J.useState(e&&t?`idle`:void 0),[o,s]=J.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),q(()=>{if(!e&&o&&i!==`ending`&&n){let e=Tu.request(()=>{a(`ending`)});return()=>{Tu.cancel(e)}}},[e,o,i,n]),q(()=>{if(!e||t||i===void 0)return;let n=Tu.request(()=>{a(void 0)});return()=>{Tu.cancel(n)}},[t,e,i]),q(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=Tu.request(()=>{a(`idle`)});return()=>{Tu.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}function Bu(e,{referrerPolicy:t,crossOrigin:n,sizes:r,srcSet:i},a){let o=J.useState(`idle`),s=o[1];return q(()=>{if(!a)return nr;if(!e&&!i)return s(`error`),nr;let o=!0,c=new window.Image,l=e=>()=>{o&&s(e)};return s(`loading`),c.onload=l(`loaded`),c.onerror=l(`error`),t&&(c.referrerPolicy=t),c.crossOrigin=n??null,r&&(c.sizes=r),i&&(c.srcset=i),e&&(c.src=e),c.complete&&s(c.naturalWidth>0?`loaded`:`error`),()=>{o=!1}},[a,e,i,r,n,t,s]),o}var Vu={...bu,...Ru},Hu=J.forwardRef(function(e,t){let{className:n,render:r,onLoadingStatusChange:i,keepMounted:a=!1,style:o,sizes:s,srcSet:c,src:l,...u}=e,{setImageLoadingStatus:d}=yu(),[f,p]=Bu(l,e,!a),m=f===`loaded`,{mounted:h,transitionStatus:g,setMounted:_}=zu(m),v=J.useRef(null),y=J.useRef(!0);q(()=>{if(!a)return;let e=y.current;y.current=!1;let t=v.current;if(!t)return;if(!t.complete){p(`loading`);return}let n=t.naturalWidth>0?`loaded`:`error`;p(n),n===`loaded`&&e&&_(!0)},[a,l,c,s,u.crossOrigin,u.referrerPolicy,r,p,_]);let b=a?{"data-loading":f===`loading`?``:void 0,"data-error":f===`error`?``:void 0,"aria-hidden":f!==`loaded`||void 0,onLoad(){p(`loaded`)},onError(){p(`error`)}}:void 0,x=G(e=>{i?.(e),d(e)});q(()=>{f!==`idle`&&x(f)},[f,x]),q(()=>()=>d(`idle`),[d]),Fu({enabled:!m,open:m,ref:v,onComplete(){m||_(!1)}});let S={imageLoadingStatus:f,transitionStatus:a&&g===`ending`?void 0:g},C=a||h,w={};s!==void 0&&(w.sizes=s),c!==void 0&&(w.srcSet=c),l!==void 0&&(w.src=l);let T=Hr(`img`,e,{state:S,ref:[t,v],props:[b,u,w],stateAttributesMapping:Vu,enabled:C});return C?T:null}),Uu=0,Wu=class e{static create(){return new e}currentId=Uu;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Uu,t()},e)}isStarted(){return this.currentId!==Uu}clear=()=>{this.currentId!==Uu&&(clearTimeout(this.currentId),this.currentId=Uu)};disposeEffect=()=>this.clear};function Gu(){let e=y(Wu.create).current;return Su(e.disposeEffect),e}var Ku=J.forwardRef(function(e,t){let{className:n,render:r,delay:i=0,style:a,...o}=e,{imageLoadingStatus:s}=yu(),[c,l]=J.useState(i===0),u=Gu();return J.useEffect(()=>(i>0?u.start(i,()=>l(!0)):l(!0),u.clear),[u,i]),Hr(`span`,e,{state:{imageLoadingStatus:s},ref:t,props:o,stateAttributesMapping:bu,enabled:s!==`loaded`&&(i===0||c)})});function qu(e){let t=(0,X.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]===n?o=t[5]:(o=Wt(`group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Y.jsx)(xu,{"data-slot":`avatar`,"data-size":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function Ju(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Wt(`aspect-square size-full rounded-full object-cover`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(Hu,{"data-slot":`avatar-image`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Yu(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Wt(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(Ku,{"data-slot":`avatar-fallback`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Xu=J.createContext(void 0);function Zu(e){let t=J.useContext(Xu);if(t===void 0&&!e)throw Error(Sa(33));return t}var Qu=J.createContext(void 0);function $u(e){let t=J.useContext(Qu);if(t===void 0&&!e)throw Error(Sa(36));return t}var ed=`data-open`,td=`data-closed`,nd=`data-anchor-hidden`,rd=`data-popup-open`,id=`data-pressed`,ad={[rd]:``},od={[rd]:``,[id]:``},sd={[ed]:``},cd={[td]:``},ld={[nd]:``},ud={open(e){return e?ad:null}},dd={open(e){return e?od:null}},fd={open(e){return e?sd:cd},anchorHidden(e){return e?ld:null}},pd={...fd,...Ru},md=J.createContext(void 0);function hd(e=!0){let t=J.useContext(md);if(t===void 0&&!e)throw Error(Sa(25));return t}var gd=`none`,_d=`trigger-press`,vd=`trigger-hover`,yd=`trigger-focus`,bd=`outside-press`,xd=`item-press`,Sd=`focus-out`,Cd=`escape-key`,wd=`list-navigation`,Td=`keyboard`,Ed=`pointer`,Dd=`cancel-open`,Od=`sibling-open`,kd=`disabled`,Ad=`imperative-action`;function jd({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=J.useRef(e!==void 0),[a,o]=J.useState(()=>t);return[i&&e!==void 0?e:a,J.useCallback(e=>{i||o(e)},[])]}var Md=J.createContext(null);function Nd(e=`root`){let t=J.useContext(Md),n=J.useContext(Qu);return t===null||n===void 0?null:(e===`submenu-trigger`?n.virtualFocus||n.parentVirtualFocus:n.virtualFocus)?t:null}var Pd={visible:!0,ref:null};function Fd(){return Pd}function Id(e,t,n=`root`){let r=Nd(n),i=((n===`submenu-trigger`?r?.useSubmenuTrigger:r?.useItem)??Fd)({label:e.label,children:e.children,render:e.render}),a=Yr(t,i.ref);return{visible:i.visible,ref:a,props:i.props}}function Ld(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Rd,platform:zd,maxTouchPoints:Bd}=Ld(),Vd=Rd.toLowerCase(),Hd=zd.toLowerCase(),Ud=/^i(os$|p)/.test(Hd)||Hd===`macintel`&&Bd>1,Wd=`android`,Gd=Hd===Wd||Vd.includes(Wd),Kd=!Ud&&Hd.startsWith(`mac`);Hd.startsWith(`win`),!Gd&&/^(linux|chrome os)/.test(Hd);var qd=Kd||Ud,Jd=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!Jd&&Vd.includes(`firefox`),!Jd&&Vd.includes(`chrom`);var Yd=qd,Xd=/jsdom|happydom/.test(Vd);function Zd(e){e.preventDefault()}function Qd(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,l=$u(),u=hd(!0),d=c.type===`submenu-trigger`,f=d?l.parentVirtualFocus:l.virtualFocus,p=(d&&l.parent.type===`menu`?l.parent.store:l.store).useState(`webkitAriaSelected`,n),{events:m}=a.useState(`floatingTreeRoot`),h=a.useState(`open`),g=u!==void 0,_=!f&&h&&n?0:-1;return J.useMemo(()=>({id:r,role:`menuitem`,tabIndex:_,"aria-selected":p,onMouseDown:f?Zd:void 0,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&m.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&m.emit(`close`,{domEvent:e.nativeEvent,reason:xd})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,g&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||g&&!Kd&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!g||e.button===2)&&c.type===`regular-item`&&lr(s.current,e,{detail:1,pointerType:`mouse`})}}),[t,_,r,m,i,a.context.allowMouseUpTriggerRef,o,s,u,g,c.type,p,f])}var $d={type:`regular-item`};function ef(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=J.useRef(null),{getButtonProps:d,buttonRef:f}=gr({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Qd({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=J.useCallback(e=>kn(p,{onMouseEnter(e){c.type===`submenu-trigger`&&c.setActive(e.nativeEvent)}},e,d),[p,d,c]),h=Yr(u,f);return J.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var tf=J.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function nf(){return J.useContext(tf)}function rf(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=nf(),u=J.useRef(-1),[d,f]=J.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=J.useRef(null),h=J.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return q(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}function af(){let[,e]=J.useState({});return J.useCallback(()=>{e({})},[])}var of=0;function sf(e,t=`mui`){let n=J.useRef(void 0),r=af(),i=e??n.current;return J.useEffect(()=>{n.current??(of+=1,n.current=`${t}-${of}`,e??r())},[e,t,r]),i}var cf=ua.useId;function lf(e,t){if(cf!==void 0){let n=cf();return e??(t?`${t}-${n}`:n)}return sf(e,t)}function uf(e){return lf(e,`base-ui`)}function Z(e,t,n,r){let i=!1,a=!1,o=r??Un;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function df(e,t,n){let r=n??Un;return{reason:e,event:t??new Event(`base-ui`),...r}}var ff=J.createContext(void 0);function pf(){let e=J.useContext(ff);if(e===void 0)throw Error(Sa(31));return e}var mf=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=J.useState(void 0),c=Hr(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,Y.jsx)(ff.Provider,{value:s,children:c})}),hf=J.forwardRef(function(e,t){let n=Nd()?.Group??mf;return(0,Y.jsx)(n,{...e,ref:t})}),gf=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=uf(a),c=pf();return q(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),Hr(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),_f=J.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,{store:d}=$u(),f=rf({guess:!0,label:a}),p=uf(i),m=d.useState(`disabled`),h=d.useState(`isActive`,f.index),g=d.useState(`floatingNodeId`),_=d.useState(`itemProps`),v=s||m,{getItemProps:y,itemRef:b}=ef({closeOnClick:c,disabled:v,highlighted:h,id:p,store:d,nativeButton:o,nodeId:g,itemMetadata:$d});return Hr(`div`,e,{state:{disabled:v,highlighted:h},props:[_,u,y],ref:[b,t,f.ref]})}),vf=J.forwardRef(function(e,t){let n=Id(e,t);return n.visible?(0,Y.jsx)(_f,{...e,ref:n.ref}):null});function yf(e){e.preventDefault(),e.stopPropagation()}function bf(e){return`nativeEvent`in e}function xf(e){return e.pointerType===``&&e.isTrusted?!0:Gd&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Sf(e){return Xd?!1:!Gd&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(Gd||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function Cf(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function wf(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function Tf(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Q(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&p(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Ef(e,t){let n=e;for(;n;){if(R(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(p(n)?n.host:null)}return null}function Df(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var Of=`data-base-ui-focusable`,kf=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Af=`ArrowLeft`,jf=`ArrowRight`,Mf=`ArrowUp`,Nf=`ArrowDown`,Pf=`data-trigger-disabled`;function Ff(e,t){if(!R(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(Pf);for(let[,e]of t.entries())if(Q(e,n))return!e.hasAttribute(Pf);return!1}function If(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Lf(e){return e.matches(`html,body`)}function Rf(e){return pe(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function zf(e){return Ef(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${kf}`)!=null}function Bf(e){return e?e.getAttribute(`role`)===`combobox`&&Rf(e):!1}function Vf(e){if(!e||Xd)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Hf(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Uf(e,t){return t!=null&&!Cf(t)?0:typeof e==`function`?e():e}function Wf(e,t,n){let r=Uf(e,n);return typeof r==`number`?r:r?.[t]}function Gf(e){return typeof e==`function`?e():e}function Kf(e,t){return t||e===`click`||e===`mousedown`}function qf(e){return e?.includes(`mouse`)&&e!==`mousedown`}var Jf=J.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Wu,currentIdRef:{current:null},currentContextRef:{current:null}});function Yf(e,t){e.current=t.current}function Xf(e,t={open:!1}){let{open:n}=t,r=e.useState(`floatingId`),{currentIdRef:i,delayRef:a,timeoutMs:o,initialDelayRef:s,currentContextRef:c,hasProvider:l,timeout:u}=J.useContext(Jf),[d,f]=J.useState(!1),p=J.useRef(n);return q(()=>{p.current=n},[n]),q(()=>{function t(){c.current?.setIsInstantPhase(!1),i.current=null,c.current=null,a.current=s.current,u.clear()}if(i.current&&!n&&i.current===r){if(f(!1),o){let n=r;return u.start(o,()=>{e.select(`open`)||i.current&&i.current!==n||t()}),()=>{(p.current||i.current!==n)&&u.clear()}}t()}},[n,r,i,a,o,s,c,u,e]),q(()=>{if(!n)return;let t=c.current,o=i.current;u.clear(),c.current={onOpenChange:e.setOpen,setIsInstantPhase:f},i.current=r,a.current={open:0,close:Wf(s.current,`close`)},o!==null&&o!==r?(f(!0),t?.setIsInstantPhase(!0),t?.onOpenChange(!1,Z(gd))):(f(!1),t?.setIsInstantPhase(!1))},[n,r,e,i,a,s,c,u]),q(()=>()=>{if(i.current===r){if(c.current=null,!p.current)return;i.current=null,Yf(a,s),u.clear()}},[c,i,a,r,s,u]),J.useMemo(()=>({activeIdRef:i,hasProvider:l,delayRef:a,isInstantPhase:d}),[i,l,a,d])}function $(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Zf(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Qf(e){let t=y($f,e).current;return t.next=e,q(t.effect),t}function $f(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var ep={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},tp={...ep,position:`fixed`,margin:0,top:0,left:0};({...ep});var np=J.forwardRef(function(e,t){let[n,r]=J.useState();q(()=>{Yd&&Jd&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Y.jsx)(`span`,{...e,ref:t,style:tp,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),rp=Math.min,ip=Math.max,ap=Math.round,op=Math.floor,sp=e=>({x:e,y:e}),cp={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function lp(e,t,n){return ip(e,rp(t,n))}function up(e,t){return typeof e==`function`?e(t):e}function dp(e){return e.split(`-`)[0]}function fp(e){return e.split(`-`)[1]}function pp(e){return e===`x`?`y`:`x`}function mp(e){return e===`y`?`height`:`width`}function hp(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function gp(e){return pp(hp(e))}function _p(e,t,n){n===void 0&&(n=!1);let r=fp(e),i=gp(e),a=mp(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ep(o)),[o,Ep(o)]}function vp(e){let t=Ep(e);return[yp(e),t,yp(t)]}function yp(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var bp=[`left`,`right`],xp=[`right`,`left`],Sp=[`top`,`bottom`],Cp=[`bottom`,`top`];function wp(e,t,n){switch(e){case`top`:case`bottom`:return n?t?xp:bp:t?bp:xp;case`left`:case`right`:return t?Sp:Cp;default:return[]}}function Tp(e,t,n,r){let i=fp(e),a=wp(dp(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(yp)))),a}function Ep(e){let t=dp(e);return cp[t]+e.slice(t.length)}function Dp(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Op(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Dp(e)}function kp(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ap(e,t){return t<0||t>=e.length}function jp(e,t){return Pp(e.current,{disabledIndices:t})}function Mp(e,t){return Pp(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Np(e,t,n){let{decrement:r,loopFocus:i,allowEscape:a,disabledIndices:o,minIndex:s,maxIndex:c}=n,l=()=>Pp(e,{startingIndex:t,decrement:r,disabledIndices:o}),u,d=!1;if(!i)u=r?Math.max(s,l()):Math.min(c,l());else if(r?t<=s:t>=c){let n=r?-1:e.length;a&&t!==n?u=-1:(u=r?c:s,d=!0)}else u=l();return{index:Ap(e,u)?-1:u,wrapped:d}}function Pp(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&Fp(e,a,r));return a}function Fp(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!Lp(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function Ip(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Lp(e,t=e?Tt(e):null){return!e||!e.isConnected||!t||Ip(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Rp=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function zp(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return p(n)?n.host:null}function Bp(e){for(let t of Array.from(e.children))if(Ir(t)===`summary`)return t;return null}function Vp(e,t){let n=Bp(t);return!!n&&(e===n||Q(n,e))}function Hp(e){let t=e?Ir(e):``;return e!=null&&e.matches(Rp)&&(t!==`summary`||e.parentElement!=null&&Ir(e.parentElement)===`details`&&Bp(e.parentElement)===e)&&(t!==`details`||Bp(e)==null)&&(t!==`input`||e.type!==`hidden`)}function Up(e){if(!Hp(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=zp(t)){let n=t!==e,r=Ir(t)===`slot`;if(t.hasAttribute(`inert`)||n&&Ir(t)===`details`&&!t.open&&!Vp(e,t)||t.hasAttribute(`hidden`)||!r&&!Wp(t,n))return!1}return!0}function Wp(e,t){let n=Tt(e);return t?n.display!==`none`:Lp(e,n)}function Gp(e){let t=e.tabIndex;if(t<0){let t=Ir(e);if(t===`details`||t===`audio`||t===`video`||pe(e)&&e.isContentEditable)return 0}return t}function Kp(e){if(Ir(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function qp(e,t){let n=Kp(e);if(!n)return!0;let r=t.find(e=>{let t=Kp(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Kp(e);return t?.name===n.name&&t.form===n.form})===n}function Jp(e){if(pe(e)&&Ir(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return pe(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Yp(e,t){Jp(e).forEach(e=>{Hp(e)&&t.push(e),Yp(e,t)})}function Xp(e,t,n){Jp(e).forEach(e=>{pe(e)&&e.matches(t)&&n.push(e),Xp(e,t,n)})}function Zp(e){return Up(e)&&Gp(e)>=0}function Qp(e){let t=[];return Yp(e,t),t.filter(Up)}function $p(e){let t=Qp(e);return t.filter(e=>Gp(e)>=0&&qp(e,t))}function em(e,t){let n=$p(e),r=n.length;if(r===0)return;let i=Tf(ql(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function tm(e){return em(ql(e).body,1)||e}function nm(e){return em(ql(e).body,-1)||e}function rm(e,t,n){if(!e)return null;let r=[];Yp(ql(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(Up);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!Q(n,o)&&Zp(o)&&qp(o,a))return o}return r[i]}function im(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Q(n,r)}function am(e){$p(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function om(e){let t=[];Xp(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function sm(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...sm(e,t.id,n)])}function cm(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function lm(e){return`data-base-ui-${e}`}var um=0;function dm(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(um);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),nr;let o=requestAnimationFrame(a);return um=o,()=>{um===o&&(cancelAnimationFrame(o),um=0)}}var fm=`data-base-ui-inert`,pm=new WeakMap,mm=new WeakSet,hm=new WeakMap,gm=0;function _m(e){return e?p(e)?e.host:_m(e.parentNode):null}var vm=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=_m(t);return e.contains(n)?n:null}).filter(e=>e!=null),ym=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},bm=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{Ir(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function xm(e,t,n,{mark:r=!0}){let i=vm(t,e),a=r?bm(t,ym(i),new Set(i)):[],o=[],s=[];if(n){let e=vm(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);bm(t,ym(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(pm.get(e)||0)+1;pm.set(e,r),o.push(e),r===1&&n&&mm.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(hm.get(e)||0)+1;hm.set(e,t),s.push(e),t===1&&e.setAttribute(fm,``)}),gm+=1,()=>{o.forEach(e=>{let t=(pm.get(e)||0)-1;pm.set(e,t),t||(mm.has(e)||e.removeAttribute(`aria-hidden`),mm.delete(e))}),r&&s.forEach(e=>{let t=(hm.get(e)||0)-1;hm.set(e,t),t||e.removeAttribute(fm)}),--gm,gm||(pm=new WeakMap,mm=new WeakSet,hm=new WeakMap)}}function Sm(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=ql(e[0]).body;return xm(e,i,n,{mark:r})}var Cm={style:{transition:`none`}},wm={fallbackAxisSide:`none`},Tm={fallbackAxisSide:`end`},Em={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},Dm=J.createContext(null),Om=()=>J.useContext(Dm),km=lm(`portal`);function Am(e={}){let{ref:t,container:n,componentProps:r=Un,elementProps:i}=e,a=lf(),o=Om()?.portalNode,[s,c]=J.useState(null),[l,u]=J.useState(null),d=G(e=>{e!==null&&u(e)}),f=J.useRef(null);q(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(pt(n)?n:n.current))??o??document.body;e==null?f.current&&(f.current=null,u(null),c(null)):f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=Hr(`div`,r,{ref:[t,d],props:[{id:a,[km]:``},i]}),m=s&&p?ju.createPortal(p,s):null;return{node:l,nodeId:J.isValidElement(p)?p.props.id:void 0,subtree:m}}var jm=J.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=Am({container:o,ref:t,componentProps:e,elementProps:c}),f=J.useRef(null),p=J.useRef(null),m=J.useRef(null),h=J.useRef(null),[g,_]=J.useState(null),v=J.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;J.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&im(e)&&(e.type===`focusin`?v.current&&=(om(l),!1):(am(l),v.current=!0))}return Zf($(l,`focusin`,e,!0),$(l,`focusout`,e,!0))},[l,y]),q(()=>{l&&b===!0&&v.current&&(om(l),v.current=!1)},[b,l]);let S=J.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,Y.jsxs)(J.Fragment,{children:[d,(0,Y.jsxs)(Dm.Provider,{value:S,children:[x&&l&&(0,Y.jsx)(np,{"data-type":`outside`,ref:f,onFocus:e=>{im(e,l)?m.current?.focus():nm(g?g.domReference:null)?.focus()}}),x&&l&&(0,Y.jsx)(`span`,{role:s,"aria-owns":u,style:Em}),l&&ju.createPortal(a,l),x&&l&&(0,Y.jsx)(np,{"data-type":`outside`,ref:p,onFocus:e=>{im(e,l)?h.current?.focus():(tm(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,Z(`focus-out`,e.nativeEvent)))}})]})]})});function Mm(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var Nm=class{nodesRef={current:[]};events=Mm();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},Pm=J.createContext(null),Fm=J.createContext(null),Im=()=>J.useContext(Pm)?.id||null,Lm=e=>{let t=J.useContext(Fm);return e??t};function Rm(e){let t=lf(),n=Lm(e),r=Im();return q(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function zm(e){let{children:t,id:n}=e,r=Im();return(0,Y.jsx)(Pm.Provider,{value:J.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Bm(e){let{children:t,externalTree:n}=e,r=y(()=>n??new Nm).current;return(0,Y.jsx)(Fm.Provider,{value:r,children:t})}function Vm(e,t){let n=Ue(Df(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(xf(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var Hm=20,Um=[];function Wm(){Um=Um.filter(e=>e.deref()?.isConnected)}function Gm(e){Wm(),e&&Ir(e)!==`body`&&(Um.push(new WeakRef(e)),Um.length>Hm&&(Um=Um.slice(-20)))}function Km(){return Wm(),Um[Um.length-1]?.deref()}function qm(e){return e?Zp(e)?e:$p(e)[0]||e:null}function Jm(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=Qp(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Zp(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Ym(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,explicitReturnFocus:o,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=t.useState(`open`),_=t.useState(`domReferenceElement`),v=t.useState(`floatingElement`),{events:y,dataRef:b}=t.context,x=G(()=>b.current.floatingContext?.nodeId),S=i===!1,C=Bf(_)&&S,w=Qf(i),T=Qf(a),E=Qf(o),D=Qf(u),O=Qf(g),k=Lm(m),A=Om(),j=J.useRef(!1),M=J.useRef(!1),N=J.useRef(!1),P=J.useRef(null),F=J.useRef(``),I=J.useRef(``),ee=J.useRef(null),L=J.useRef(null),te=Yr(ee,p,A?.beforeInsideRef),R=Yr(L,A?.afterInsideRef),z=Gu(),B=Gu(),ne=Eu(),re=A!=null,V=Hf(v),ie=G((e=V)=>e?$p(e):[]),H=G(()=>h?.().filter(e=>e!=null)??[]);J.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&Q(V,Tf(ql(V)))&&ie().length===0&&!C&&yf(e)}return $(ql(V),`keydown`,e)},[r,V,c,C,ie]),J.useEffect(()=>{if(r||!g)return;let e=ql(V);function t(){N.current=!1}function n(e){let t=Df(e),n=H(),r=Q(v,t)||Q(_,t)||Q(A?.portalNode,t)||n.some(e=>e===t||Q(e,t));N.current=!r,I.current=e.pointerType||`keyboard`,Ef(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,B.start(0,()=>{M.current=!1}))}function i(){I.current=`keyboard`}return Zf($(e,`pointerdown`,n,!0),$(e,`pointerup`,t,!0),$(e,`pointercancel`,t,!0),$(e,`keydown`,i,!0),t)},[r,v,_,V,g,A,B,H]),J.useEffect(()=>{if(r||!l)return;let e=ql(V);function n(){M.current=!0,B.start(0,()=>{M.current=!1})}function i(e){let t=Df(e);Zp(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=Df(n);c&&r==null&&a!=null&&Q(v,a)&&Gm(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=H(),p=r?.hasAttribute(lm(`focus-guard`))&&[ee.current,L.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,Du(f),Du(d)].includes(r),m=!(Q(_,r)||Q(v,r)||Q(r,v)||Q(A?.portalNode,r)||u.some(e=>e===r||Q(e,r))||l.hasMatchingElement(e=>Q(e,r))||p||k&&(sm(k.nodesRef.current,o).find(e=>Q(e.context?.elements.floating,r)||Q(e.context?.elements.domReference,r))||cm(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,Hf(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&V&&Jm(V),s&&i!==_&&!Lp(a)&&Tf(e)===e.body){if(pe(V)&&(V.focus(),s===`popup`)){ne.request(()=>{V.focus()});return}let e=ie(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||V;pe(n)&&n.focus()}b.current.insideReactTree?b.current.insideReactTree=!1:(C||!c)&&r&&m&&!M.current&&(C||r!==Km())&&(j.current=!0,t.setOpen(!1,Z(Sd,n)))})}function o(){N.current||(b.current.insideReactTree=!0,z.start(0,()=>{b.current.insideReactTree=!1}))}let u=pe(_)?_:null;if(v||u)return Zf(u&&$(u,`focusout`,a),u&&$(u,`pointerdown`,n),v&&$(v,`focusin`,i),v&&$(v,`focusout`,a),v&&A&&$(v,`focusout`,o,!0))},[r,_,v,V,c,k,A,t,l,s,ie,C,x,b,z,B,ne,d,f,H]),J.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${lm(`portal`)}]`)||[]),t=(k?cm(k.nodesRef.current,x()):[]).find(e=>Bf(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Sm([v,...e,ee.current,L.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...H(),t,Du(f),Du(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=Sm([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,H]),q(()=>{if(!g||r||!pe(V))return;F.current=``,I.current=``;let e=ql(V),t=Tf(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||Q(V,t))return;let i=null,a=()=>(i??=ie(V),i[0]||V),o;o=r===!0||r===null?a():Du(r),o||=a();let s=Q(V,Tf(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&xf(c);dm(o,{sync:l,preventScroll:o===V,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=Tf(e);return!(t!==o&&Q(V,t))}})})},[r,g,V,ie,w,D,O,b]);let U=J.useRef(null);q(()=>{if(r||!V){U.current=null;return}U.current&&=(U.current.cancelled=!0,null);let e=ql(V),t=Tf(e),n=D.current==null;Gm(t);function i(e){if(e.open||(F.current=Vm(e.nativeEvent,I.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(lm(`focus-guard`))||e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`)&&(j.current=!0),e.reason===`outside-press`){if(e.nested)j.current=!1;else if(xf(e.nativeEvent)||Sf(e.nativeEvent))j.current=!1;else{let e=!1;ql(V).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&Ir(t)!==`body`?t:null,s=n?o||a:a||o;return s||=Km()||null,typeof i==`boolean`?s:Du(i)||s||null}return()=>{y.off(`openchange`,i);let t=Tf(e),n=H(),r=Q(v,t)||n.some(e=>e===t||Q(e,t))||k&&sm(k.nodesRef.current,x(),!1).some(e=>Q(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s),l={cancelled:!1};U.current=l,queueMicrotask(()=>{U.current===l&&(U.current=null);let n=qm(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&pe(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}j.current=!1})}},[r,v,V,T,E,D,y,k,_,x,H]),q(()=>{if(!Jd||g||!v)return;let e=Tf(ql(v));pe(e)&&Rf(e)&&Q(v,e)&&e.blur()},[g,v]),q(()=>{if(!r&&A)return A.setFocusManagerState({modal:c,closeOnFocusOut:l,open:g,onOpenChange:t.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,c,g,t,l,_]),q(()=>{if(!r&&V)return Jm(V),()=>{queueMicrotask(Wm)}},[r,V]);let ae=!r&&(!c||!C)&&(re||c);return(0,Y.jsxs)(J.Fragment,{children:[ae&&(0,Y.jsx)(np,{"data-type":`inside`,ref:te,onFocus:e=>{if(c){let e=ie();dm(e[e.length-1])}else A?.portalNode&&(j.current=!1,im(e,A.portalNode)?tm(_)?.focus():Du(f??A.beforeOutsideRef)?.focus())}}),n,ae&&(0,Y.jsx)(np,{"data-type":`inside`,ref:R,onFocus:e=>{c?dm(ie()[0]):A?.portalNode&&(l&&(j.current=!0),im(e,A.portalNode)?nm(_)?.focus():Du(d??A.afterOutsideRef)?.focus())}})]})}function Xm(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=_d}=t,l=e.context.dataRef,u=J.useRef(void 0),d=Eu(),f=Gu(),p=J.useMemo(()=>{function t(t,n,r,i){let a=Z(c,n,r);t&&i===`touch`&&s>0?f.start(s,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=l.current.openEvent,s=e.select(`domReferenceElement`)!==n;return t&&s||!t||!i?!0:a&&(typeof o==`function`?o():o)?!r(a.type):!1}return{onPointerDown(e){u.current=Cf(e.pointerType,!0)&&Sf(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||Cf(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=Df(s),p=Rf(f);if(p||o===`virtual`){t(l,s,p?f:i.currentTarget,o);return}let m=i.currentTarget;d.request(()=>{t(l,s,m,o)})},onClick(i){if(r===`mousedown-only`)return;let o=u.current;r===`mousedown`&&o?u.current=void 0:Cf(o,!0)&&a||t(n(e.select(`open`),i.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),i.nativeEvent,i.currentTarget,o)},onKeyDown(){u.current=void 0}}},[l,r,a,c,e,o,i,d,f,s]);return J.useMemo(()=>n?{reference:p}:Un,[n,p])}function Zm(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,(!i||c)&&(d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function Qm(e){return e!=null&&e.clientX!=null}function $m(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=e.useState(`open`),a=e.useState(`floatingElement`),o=e.useState(`domReferenceElement`),s=e.context.dataRef,c=J.useRef(!1),l=J.useRef(null),[u,d]=J.useState(),[f,p]=J.useState([]),m=G(t=>{e.set(`positionReference`,t)}),h=G((t,n,i)=>{c.current||(!s.current.openEvent||Qm(s.current.openEvent))&&e.set(`positionReference`,Zm(i??o,{x:t,y:n,axis:r,dataRef:s,pointerType:u}))}),g=G(e=>{i?l.current||(h(e.clientX,e.clientY,e.currentTarget),p([])):h(e.clientX,e.clientY,e.currentTarget)}),_=Cf(u)?a:i;J.useEffect(()=>{if(!n){m(o);return}if(!_)return;function e(){l.current?.(),l.current=null}let t=Ue(a);function r(t){let n=Df(t);Q(a,n)?e():h(t.clientX,t.clientY)}return!s.current.openEvent||Qm(s.current.openEvent)?l.current=$(t,`mousemove`,r):m(o),e},[_,n,a,s,o,e,h,m,f]),J.useEffect(()=>()=>{e.set(`positionReference`,null)},[e]),J.useEffect(()=>{n&&!a&&(c.current=!1)},[n,a]),J.useEffect(()=>{!n&&i&&(c.current=!0)},[n,i]);let v=J.useMemo(()=>{function e(e){d(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:g,onMouseEnter:g}},[g]);return J.useMemo(()=>n?{reference:v,trigger:v}:{},[n,v])}function eh(){return!1}function th(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function nh(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=eh,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,m=Lm(c),h=G(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=G(()=>a),{escapeKey:y,outsidePress:b}=th(s),x=J.useRef(!1),S=J.useRef(!1),C=J.useRef(!1),w=J.useRef(!1),T=J.useRef(!1),E=J.useRef(``),D=J.useRef(null),O=Gu(),k=Gu(),A=Gu(),j=G(()=>{k.clear(),d.current.insideReactTree=!1}),M=G(e=>{let t=d.current.floatingContext?.nodeId;return(m?sm(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),N=G(t=>If(t,e.select(`floatingElement`))||If(t,e.select(`domReferenceElement`))),P=G(t=>{o()&&e.setOpen(!1,Z(_d,t.nativeEvent))}),F=G(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=bf(t)?t.nativeEvent:t;if(T.current||i.isComposing||!y&&M(`__escapeKeyBubbles`))return;let a=Z(Cd,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!y&&!a.isPropagationAllowed&&t.stopPropagation()}),I=G(()=>{d.current.insideReactTree=!0,k.start(0,j)}),ee=G(t=>{if(!l||!n||t.button!==0)return;let r=Df(t.nativeEvent);Q(e.select(`floatingElement`),r)&&(x.current||(x.current=!0,S.current=!1))}),L=G(e=>{l&&n&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&x.current&&(S.current=!0)});J.useEffect(()=>{function e(e){e.open||(w.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),J.useEffect(()=>j,[j]),J.useEffect(()=>{if(!l||!n)return l||(w.current=!1,T.current=!1,E.current=``,D.current=null),j;d.current.__escapeKeyBubbles=y,d.current.__outsidePressBubbles=b;let t=new Wu,i=ql(u);function a(){A.clear(),T.current=!0}function o(){T.current=!0,A.start(Jd?5:0,()=>{T.current=!1})}function s(){C.current=!0,t.start(0,()=>{C.current=!1})}function c(){x.current=!1,S.current=!1}function f(){let e=E.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function h(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function k(e){let t=d.current.floatingContext?.nodeId,n=m&&sm(m.nodesRef.current,t).some(t=>If(e,t.context?.elements.floating));return N(e)||n}function P(n){if(h(n)){n.type!==`click`&&!N(n)&&(t.clear(),C.current=!1),j();return}if(d.current.insideReactTree){j();return}let r=Df(n),i=`[${lm(`inert`)}]`,a=R(r)?r.getRootNode():null,o=Array.from((p(a)?a:ql(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>Q(e,r))))return;let c=R(r)?r:null;for(;c&&!je(c);){let e=Le(c);if(je(e)||!R(e))break;c=e}if(!(o.length&&R(r)&&!Lf(r)&&!Q(r,e.select(`floatingElement`))&&o.every(e=>!Q(c,e)))){if(pe(r)&&!(`touches`in n)){let e=je(r),t=Tt(r),i=/auto|scroll/,a=e||i.test(t.overflowX),o=e||i.test(t.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=t.direction===`rtl`,u=c&&(l?n.offsetX<=r.offsetWidth-r.clientWidth:n.offsetX>r.clientWidth),d=s&&n.offsetY>r.clientHeight;if(u||d)return}if(!k(n)){if(f()===`intentional`){if(n.detail!==0&&!xf(n)&&!w.current)return;if(C.current){t.clear(),C.current=!1;return}}typeof g==`function`&&!g(n)||M(`__outsidePressBubbles`)||(e.setOpen(!1,Z(bd,n)),j())}}}function I(t){f()===`sloppy`&&t.pointerType!==`touch`&&e.select(`open`)&&n&&!N(t)&&P(t)}function ee(t){if(f()!==`sloppy`||!e.select(`open`)||!n||N(t))return;let r=t.touches[0];r&&(D.current={startTime:Date.now(),startX:r.clientX,startY:r.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=Df(e);if(!n)return;let r=$(n,e.type,()=>{t(e),r()})}function te(e){E.current=`touch`,L(e,ee)}function z(e){O.clear(),e.type===`pointerdown`&&(e.button===0&&(w.current=!0),E.current=e.pointerType),(e.type!==`mousedown`||!D.current||D.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?I(e):P(e)})}function B(e){if(e.type===`pointercancel`&&(w.current=!1),!x.current)return;let n=S.current;c(),f()===`intentional`&&(e.type===`pointercancel`?n&&s():k(e)||(n?s():(typeof g!=`function`||g(e))&&(t.clear(),C.current=!0,j())))}function ne(e){if(f()!==`sloppy`||!D.current||N(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-D.current.startX),r=Math.abs(t.clientY-D.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(D.current.dismissOnTouchEnd=!0),i>10&&(P(e),O.clear(),D.current=null)}function re(e){L(e,ne)}function V(e){f()===`sloppy`&&D.current&&!N(e)&&(D.current.dismissOnTouchEnd&&P(e),O.clear(),D.current=null)}function ie(e){L(e,V)}let H=Zf(r&&Zf($(i,`keydown`,F),$(i,`compositionstart`,a),$(i,`compositionend`,o)),_&&Zf($(i,`click`,z,!0),$(i,`pointerdown`,z,!0),$(i,`pointerup`,B,!0),$(i,`pointercancel`,B,!0),$(i,`mousedown`,z,!0),$(i,`mouseup`,B,!0),$(i,`touchstart`,te,{capture:!0,passive:!0}),$(i,`touchmove`,re,{capture:!0,passive:!0}),$(i,`touchend`,ie,{capture:!0,passive:!0})));return()=>{H(),t.clear(),c(),C.current=!1}},[d,u,r,_,g,l,n,y,b,F,j,v,M,N,m,e,O,A]);let te=J.useMemo(()=>({onKeyDown:F,onPointerDown:P,onClick:P}),[F,P]),z=J.useMemo(()=>({onKeyDown:F,onPointerDown:L,onMouseDown:L,onClickCapture:I,onMouseDownCapture(e){I(),ee(e)},onPointerDownCapture(e){I(),ee(e)},onMouseUpCapture:I,onTouchEndCapture:I,onTouchMoveCapture:I}),[F,I,ee,L]);return J.useMemo(()=>n?{reference:te,floating:z,trigger:te}:{},[n,te,z])}function rh(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=o;return t.useSyncedValue(`floatingId`,i),q(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};R(c)&&(e.domReferenceElement=c),r.state.positionReference===r.state.referenceElement&&(e.positionReference=c),r.update(e)},[s,i,c,l,r]),r.context.onOpenChange=u,r.context.nested=a,r}var ih=Kd&&Jd;function ah(e,t={}){let{enabled:n=!0,delay:r}=t,{events:i,dataRef:a}=e.context,o=J.useRef(!1),s=J.useRef(null),c=J.useRef(!0),l=Gu();J.useEffect(()=>{let t=e.select(`domReferenceElement`);if(!n)return;let r=Ue(t);function i(){let t=e.select(`domReferenceElement`);!e.select(`open`)&&pe(t)&&t===Tf(ql(t))&&(o.current=!0,s.current=t)}function a(){c.current=!0}function l(){c.current=!1}return Zf($(r,`blur`,i),ih&&$(r,`keydown`,a,!0),ih&&$(r,`pointerdown`,l,!0))},[e,n]),J.useEffect(()=>{if(!n)return;function t(t){if(t.reason===`trigger-press`||t.reason===`escape-key`){let t=e.select(`domReferenceElement`);R(t)&&(s.current=t,o.current=!0)}}return i.on(`openchange`,t),()=>{i.off(`openchange`,t)}},[i,n,e]);let u=J.useMemo(()=>{function t(){o.current=!1,s.current=null}return{onMouseLeave(){t()},onFocus(n){let i=n.currentTarget;if(o.current){if(s.current===i)return;t()}let a=Df(n.nativeEvent);if(R(a)){if(ih&&!n.relatedTarget){if(!c.current&&!Rf(a))return}else if(!Vf(a))return}let u=Ff(n.relatedTarget,e.context.triggerElements),{nativeEvent:d,currentTarget:f}=n;e.select(`open`)&&u||!r?e.setOpen(!0,Z(yd,d,f)):l.start(r,()=>{o.current||e.setOpen(!0,Z(yd,d,f))})},onBlur(n){t();let r=n.relatedTarget,i=n.nativeEvent,o=R(r)&&r.hasAttribute(lm(`focus-guard`))&&r.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let t=e.select(`domReferenceElement`),n=Tf(ql(t));!r&&n===t||Q(a.current.floatingContext?.refs.floating.current,n)||Q(t,n)||o||Ff(r??n,e.context.triggerElements)||e.setOpen(!1,Z(yd,i))})}}},[a,r,e,l]);return J.useMemo(()=>n?{reference:u,trigger:u}:{},[n,u])}var oh=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new Wu;restTimeout=new Wu;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},sh=new WeakMap;function ch(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&sh.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),sh.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function lh(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=sh.get(n);a&&a!==e&&ch(a),ch(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,sh.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function uh(e){let t=e.context.dataRef.current,n=y(()=>t.hoverInteractionState??oh.create()).current;return t.hoverInteractionState||=n,Su(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function dh(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=e.useState(`open`),o=e.useState(`floatingElement`),s=e.useState(`domReferenceElement`),{dataRef:c}=e.context,l=Lm(),u=Im(),d=uh(e),f=Gu(),p=G(()=>Kf(c.current.openEvent?.type,d.interactedInside)),m=G(()=>qf(c.current.openEvent?.type)),h=G(()=>{ch(d)});q(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),J.useEffect(()=>h,[h]),q(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&R(s)&&o){let e=s,t=o,n=ql(o),r=l?.nodesRef.current.find(e=>e.id===u)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=d.pointerEventsScopeElement===t?null:d.pointerEventsScopeElement,a=r===t?null:r,c=d.handleCloseOptions?.getScope?.()??i??a??Ef(e,`[data-rootownerid]`)??n.body;return lh(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),J.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&sm(l.nodesRef.current,u).length>0)}function a(t){let n=Wf(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,Z(vd,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=Df(e);zf(t)?d.interactedInside=Ef(t,`[aria-haspopup]`)!=null:d.interactedInside=!1}function g(){d.openChangeTimeout.clear(),f.clear(),l?.events.off(`floating.closed`,v),h()}function _(n){if(t()&&l){l.events.on(`floating.closed`,v);return}if(Ff(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;l&&r&&R(o)&&sm(l.nodesRef.current,r,!1).some(e=>Q(e.context?.elements.floating,o))||(d.handler?d.handler(n):(h(),m()&&!p()&&a(n)))}function v(n){l&&u&&!t()&&f.start(0,()=>{l.events.off(`floating.closed`,v),e.setOpen(!1,Z(vd,n)),l.events.emit(`floating.closed`,n)})}let y=o;return Zf(y&&$(y,`mouseenter`,g),y&&$(y,`mouseleave`,_),y&&$(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var fh={current:null};function ph(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=fh,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=Lm(l),v=uh(e),y=J.useRef(!1),b=Qf(i),x=Qf(r),S=Qf(o),C=Qf(n),w=Qf(p),T=Qf(f),E=G(()=>Kf(h.current.openEvent?.type,v.interactedInside)),D=G(()=>w.current?.()!==!1),O=G((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!Q(t,n);if(!R(r))return!1;let a=r;return i.hasMatchingElement(e=>Q(e,a))&&(!t||!Q(t,a))}),k=G(()=>{v.handler&&=(ql(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=G(()=>{ch(v)});return u&&(v.handleCloseOptions=i?.__options),J.useEffect(()=>k,[k]),J.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===vd,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),J.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=Wf(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,Z(vd,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,Z(vd,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!R(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!Cf(v.pointerType))return;let n=Gf(S.current),r=Wf(x.current,`open`,v.pointerType),i=Df(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(R(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(Q(t,i)){c=t;break}}R(o)&&R(s)&&!e.context.triggerElements.hasElement(o)&&Q(o,s)&&(c=s);let l=c!=null&&O(s,c,i),u=e.select(`open`),d=T.current?.()??e.select(`transitionStatus`)===`ending`,f=!u&&d&&y.current,p=!l&&R(c)&&R(s)&&Q(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;h?D()&&e.setOpen(!0,Z(vd,t,c)):m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,Z(vd,t,c))}):g&&D()&&e.setOpen(!0,Z(vd,t,c)))}function o(n){if(E()){A();return}k();let r=ql(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!Ff(n.relatedTarget,e.context.triggerElements)){if(b.current&&i){e.select(`open`)||v.openChangeTimeout.clear();let a=c.current;v.handler=b.current({...i,tree:_,x:n.clientX,y:n.clientY,onClose(){A(),k(),C.current&&!E()&&a===e.select(`domReferenceElement`)&&t(n,!0)}}),r.addEventListener(`mousemove`,v.handler),v.handler(n)}else v.pointerType===`touch`&&Q(e.select(`floatingElement`),n.relatedTarget)||t(n)}}function l(e){Q(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?$(r,`mouseout`,l):void 0;return s?Zf($(r,`mousemove`,i,{once:!0}),$(r,`mouseenter`,i),$(r,`mouseleave`,o),f):Zf($(r,`mouseenter`,i),$(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),J.useMemo(()=>{if(!n)return;function t(e){v.pointerType=e.pointerType}return{onPointerDown:t,onPointerEnter:t,onMouseMove(t){let{nativeEvent:n}=t,r=t.currentTarget,i=e.select(`domReferenceElement`),o=e.select(`open`),s=O(i,r,t.target);if(a&&!Cf(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;lh(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=Gf(S.current);if(o&&!s||c===0||!s&&v.restTimeoutPending&&t.movementX**2+t.movementY**2<2)return;v.restTimeout.clear();function l(){if(v.restTimeoutPending=!1,E())return;let t=e.select(`open`);!v.blockMouseMove&&(!t||s)&&D()&&e.setOpen(!0,Z(vd,n,r))}v.pointerType===`touch`?ju.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}function mh(e){return Jd&&e.movementX===0&&e.movementY===0}function hh(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function gh(e,t){return hh(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function _h(e,t,n){return hh(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function vh(e,t,n){return hh(t,n?e===Af:e===jf,e===Nf)}function yh(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:hh(t,n?e===jf:e===Af,e===Mf)}function bh(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,triggerOrientation:_=g,parentOrientation:v,id:y,resetOnPointerLeave:b=!0,externalTree:x,nestedReturnFocusRef:S,grid:C}=t,w=C!=null,T=e.useState(`open`),E=e.useState(`floatingElement`),D=e.useState(`domReferenceElement`),O=e.context.dataRef,k=Hf(E),A=Bf(D),j=Qf(k),M=Im(),N=Lm(x),P=J.useRef(f),F=J.useRef(o??-1),I=J.useRef(null),ee=J.useRef(!0),L=G(e=>{i(F.current===-1?null:F.current,e)}),te=J.useRef(!!E),R=J.useRef(T),z=J.useRef(!1),B=J.useRef(!1),ne=J.useRef(null),re=Qf(h),V=Qf(T),ie=Qf(o),H=Qf(b),U=Eu(),ae=Eu(),oe=G(()=>{U.cancel();function e(e){d||(ne.current=dm(e,{sync:z.current,preventScroll:!0}))}let t=n.current[F.current],r=B.current;t&&e(t),(z.current?e=>e():e=>U.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),de&&(r||!ee.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});q(()=>{O.current.orientation=g},[O,g]),q(()=>{T||(I.current=null),T&&f===`auto`||(P.current=f)},[T,f]),q(()=>{a&&(T&&E?(F.current=o??-1,P.current&&o!=null&&(B.current=!0,L())):te.current&&(F.current=-1,L()))},[a,T,E,o,L]),q(()=>{if(a){if(!T)z.current=!1;else if(E){if(r==null){if(z.current=!1,ie.current!=null)return;if(te.current&&(F.current=-1,oe()),(!R.current||!te.current)&&P.current&&(I.current!=null||P.current===!0&&I.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ae.request(e):queueMicrotask)(t),e+=1):(F.current=I.current==null||_h(I.current,_,u)||l?jp(n):Mp(n),I.current=null,L())};t()}}else Ap(n.current,r)||(F.current=r,oe(),B.current=!1)}}},[a,T,E,r,ie,l,n,_,u,L,oe,ae]),q(()=>{if(!a||E||!N||d||!te.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=Tf(ql(D??t??null)),r=e.some(e=>e.context&&Q(e.context.elements.floating,n));t&&!r&&ee.current&&t.focus({preventScroll:!0})},[a,E,D,N,M,d]),q(()=>{R.current=T,te.current=!!E});let W=r!=null,se=G(e=>{if(!V.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,L(e))}),ce=G(()=>v??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation),le=G(()=>jp(n,re.current)),ue=G(t=>{if(ee.current=!1,z.current=!0,t.which===229||!V.current&&t.currentTarget===j.current)return;if(l&&yh(t.key,g,u,w)){gh(t.key,ce())||yf(t),e.setOpen(!1,Z(wd,t.nativeEvent));let n=S?.current??D;pe(n)&&n.focus();return}r!=null&&r!==F.current&&!Ap(n.current,r)&&(F.current=r);let i=F.current,a=jp(n,h),o=Mp(n,h);if(A||(t.key===`Home`&&(yf(t),F.current=a,L(t)),t.key===`End`&&(yf(t),F.current=o,L(t))),C!=null){let e=C(t,F.current,n,g,c,u,h,a,o);if(e!=null&&e!==F.current&&(F.current=e,L(t)),g===`both`)return}if(gh(t.key,g)){yf(t);let e=Tf(t.currentTarget.ownerDocument);if(T&&!d&&Q(t.currentTarget,e)&&!n.current.some(t=>t!=null&&Q(t,e))){F.current=_h(t.key,g,u)?a:o,L(t),r===F.current&&oe();return}let{index:l,wrapped:f}=Np(n.current,i,{decrement:!_h(t.key,g,u),loopFocus:c,allowEscape:s,disabledIndices:h,minIndex:a,maxIndex:o});f&&(z.current=!1),F.current=l,L(t)}}),de=J.useMemo(()=>({onFocus(e){z.current=!0,se(e)},onClick({currentTarget:e}){d||e.focus({preventScroll:!0})},onMouseMove(e){mh(e)||(z.current=!0,B.current=!1,p&&se(e))},onPointerLeave(e){if(!V.current||!ee.current||e.pointerType===`touch`)return;z.current=!0;let t=e.relatedTarget;if(p&&!n.current.includes(t)&&H.current&&(ne.current?.(),ne.current=null,F.current=-1,L(e),!d)){let e=j.current,t=Tf(ql(e));e&&Q(e,t)&&e.focus({preventScroll:!0})}}}),[se,V,j,p,n,L,H,d]),fe=J.useMemo(()=>d&&T&&W&&{"aria-activedescendant":`${y}-${r}`},[d,T,W,y,r]),me=J.useMemo(()=>({...A?{}:fe,onKeyDown(t){if(t.key===`Tab`&&t.shiftKey&&T&&!d){let n=Df(t.nativeEvent);if(n&&!Q(j.current,n))return;yf(t);let r=Z(Sd,t.nativeEvent);e.setOpen(!1,r);let i=S?.current??D;!r.isCanceled&&pe(i)&&i.focus()}else ue(t)},onPointerMove(e){mh(e)||(ee.current=!0)}}),[fe,ue,j,A,e,T,d,D,S]),he=J.useMemo(()=>{function t(t){e.setOpen(!0,Z(wd,t.nativeEvent,t.currentTarget))}function n(e){f===`auto`&&xf(e.nativeEvent)&&(P.current=!d)}function r(e){P.current=f,f===`auto`&&Sf(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(n){let r=e.select(`open`);ee.current=!1;let i=n.key.startsWith(`Arrow`),a=vh(n.key,ce(),u),o=gh(n.key,r?g:_),s=(l?a:o)||n.key===`Enter`||n.key.trim()===``;if(d&&r&&(!l||Rf(n.currentTarget)))return ue(n);if(r||m||!i){if(s){let e=gh(n.key,ce());I.current=l&&e?null:n.key}l?a&&(yf(n),r?(F.current=le(),L(n),d&&j.current?.focus()):t(n)):o&&(ie.current!=null&&(F.current=ie.current),yf(n),!r&&m?t(n):ue(n),r&&L(n))}},onFocus(t){t.target===t.currentTarget&&e.select(`open`)&&!d&&(F.current=-1,L(t))},onPointerDown:r,onPointerEnter:r,onMouseDown:n,onClick:n}},[ue,f,le,l,L,e,m,g,_,ce,u,ie,d,j]),ge=J.useMemo(()=>({...fe,...he}),[fe,he]);return J.useMemo(()=>a?{reference:ge,floating:me,item:de,trigger:he}:{},[a,ge,me,he,de])}function xh(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=G(s),f=e.useState(`open`),p=Gu(),m=J.useRef(``),h=J.useRef(u??i??-1),g=J.useRef(null),_=G(e=>{function t(e){return r?.current[e]}function s(e){let n=t(e);return n&&!Lp(n)||n?.matches(`:disabled`)?!1:o==null||!Fp(Xi,e,o)}function c(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(e[n]?.toLowerCase().startsWith(i)&&s(n))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(yf(e),d?.(!0)),m.current.length>0&&m.current[0]!==` `&&c(_,m.current)===-1&&e.key!==` `&&d?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(yf(e),d?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&s(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,d?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=c(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,d?.(!1)):(a?.(b,e),g.current=b)}),v=G(t=>{let n=t.relatedTarget,r=e.select(`domReferenceElement`),i=e.select(`floatingElement`);Q(r,n)||Q(i,n)||(p.clear(),m.current=``,h.current=g.current,d?.(!1))});q(()=>{(f||u===null)&&(p.clear(),g.current=null,m.current!==``&&(m.current=``,d?.(!1)))},[f,u,p,d]);let y=J.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return J.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var Sh=.1,Ch=Sh*Sh,wh=.5;function Th(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Eh(e,t,n,r,i,a,o,s,c,l){let u=!1;return Th(e,t,n,r,i,a)&&(u=!u),Th(e,t,i,a,o,s)&&(u=!u),Th(e,t,o,s,c,l)&&(u=!u),Th(e,t,c,l,n,r)&&(u=!u),u}function Dh(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Oh(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function kh(e={}){let{blockPointerEvents:t=!1}=e,n=new Wu,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*Ch;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=Df(r),g=r.type===`mouseleave`,_=Q(u,h),v=Q(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&R(r.relatedTarget)&&Q(u,r.relatedTarget))return;function y(){return!!(s&&sm(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Oh(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Oh(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Oh(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Oh(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Dh(d,f,x)||!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?wh/2:wh*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+wh+1,o=C||T?S.bottom-wh:S.top,s=C?T?S.bottom-wh:S.top:S.bottom-wh;M=Eh(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?wh/2:wh*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-wh,o=C||T?S.top+wh:S.bottom,s=C?T?S.top+wh:S.bottom:S.top+wh;M=Eh(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?wh/2:wh*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+wh+1,o=w||E?S.right-wh:S.left,s=w?E?S.right-wh:S.left:S.right-wh;M=Eh(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?wh/2:wh*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-wh,o=w||E?S.left+wh:S.right,s=w?E?S.left+wh:S.right:S.left+wh;M=Eh(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function Ah(e,t,n){let{reference:r,floating:i}=e,a=hp(t),o=gp(t),s=mp(o),c=dp(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=fp(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function jh(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=up(t,e),p=Op(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=kp(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=kp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Mh=50,Nh=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:jh},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ah(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Mh&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Ah(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ph=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=up(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=dp(r),_=hp(o),v=dp(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ep(o)]:vp(o)),x=p!==`none`;!d&&x&&b.push(...Tp(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=_p(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===hp(t)||T.every(e=>hp(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=hp(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},Fh=new Set([`left`,`top`]);async function Ih(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=dp(n),s=fp(n),c=hp(n)===`y`,l=Fh.has(o)?-1:1,u=a&&c?-1:1,d=up(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Lh=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Ih(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Rh=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=up(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=hp(i),p=pp(f),m=u[p],h=u[f],g=(e,t)=>lp(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},zh=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=up(e,t),u={x:n,y:r},d=hp(i),f=pp(d),p=u[f],m=u[d],h=up(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Fh.has(dp(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Bh=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=up(e,t),c=await i.detectOverflow(t,s),l=dp(n),u=fp(n),d=hp(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=rp(p-c[m],g),y=rp(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*ip(c.left,c.right):S=p-2*ip(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Vh(e){let t=Tt(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=pe(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ap(n)!==a||ap(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Hh(e){return R(e)?e:e.contextElement}function Uh(e){let t=Hh(e);if(!pe(t))return sp(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Vh(t),o=(a?ap(n.width):n.width)/r,s=(a?ap(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}var Wh=sp(0);function Gh(e){let t=Ue(e);return!Mt()||!t.visualViewport?Wh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Kh(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ue(e)}function qh(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Hh(e),o=sp(1);t&&(r?R(r)&&(o=Uh(r)):o=Uh(e));let s=Kh(a,n,r)?Gh(a):sp(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Ue(a),t=R(r)?Ue(r):r,n=e,i=Ye(n);for(;i&&t!==n;){let e=Uh(i),t=i.getBoundingClientRect(),r=Tt(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ue(i),i=Ye(n)}}return kp({width:u,height:d,x:c,y:l})}function Jh(e,t){let n=s(e).scrollLeft;return t?t.left+n:qh(E(e)).left+n}function Yh(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Jh(e,n),y:n.top+t.scrollTop}}function Xh(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=E(r),c=t?se(t.floating):!1;if(r===o||c&&a)return n;let l={scrollLeft:0,scrollTop:0},u=sp(1),d=sp(0),f=pe(r);if((f||!a)&&((Ir(r)!==`body`||ka(o))&&(l=s(r)),f)){let e=qh(r);u=Uh(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}let p=o&&!f&&!a?Yh(o,l):sp(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function Zh(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Qh(e){let t=s(e),n=e.ownerDocument.body,r=ip(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=ip(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Jh(e),o=-t.scrollTop;return Tt(n).direction===`rtl`&&(a+=ip(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var $h=25;function eg(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Ue(e),a=E(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Mt()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Jh(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=$h&&(s-=o)}return{width:s,height:c,x:l,y:u}}function tg(e,t){let n=qh(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Uh(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ng(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=eg(e,n,t);else if(t===`document`)r=Qh(E(e));else if(R(t))r=tg(t,n);else{let n=Gh(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return kp(r)}function rg(e,t){let n=t.get(e);if(n)return n;let r=Ar(e,[],!1).filter(e=>R(e)&&Ir(e)!==`body`),i=null,a=Tt(e).position===`fixed`,o=a?Le(e):e;for(;R(o)&&!je(o);){let e=Tt(o),t=tt(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Le(o)}return t.set(e,r),r}function ig(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?se(t)?[]:rg(t,this._c):[].concat(n),r],o=ng(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=ng(t,a[e],i);s=ip(n.top,s),c=rp(n.right,c),l=rp(n.bottom,l),u=ip(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ag(e){let{width:t,height:n}=Vh(e);return{width:t,height:n}}function og(e,t,n){let r=pe(t),i=E(t),a=n===`fixed`,o=qh(e,!0,a,t),c={scrollLeft:0,scrollTop:0},l=sp(0);if((r||!a)&&((Ir(t)!==`body`||ka(i))&&(c=s(t)),r)){let e=qh(t,!0,a,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}!r&&i&&(l.x=Jh(i));let u=i&&!r&&!a?Yh(i,c):sp(0);return{x:o.left+c.scrollLeft-l.x-u.x,y:o.top+c.scrollTop-l.y-u.y,width:o.width,height:o.height}}function sg(e){return Tt(e).position===`static`}function cg(e,t){if(!pe(e)||Tt(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return E(e)===n&&(n=n.ownerDocument.body),n}function lg(e,t){let n=Ue(e);if(se(e))return n;if(!pe(e)){let t=Le(e);for(;t&&!je(t);){if(R(t)&&!sg(t))return t;t=Le(t)}return n}let r=cg(e,t);for(;r&&Rt(r)&&sg(r);)r=cg(r,t);return r&&je(r)&&sg(r)&&!tt(r)?n:r||N(e)||n}var ug=async function(e){let t=this.getOffsetParent||lg,n=this.getDimensions,r=await n(e.floating);return{reference:og(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function dg(e){return Tt(e).direction===`rtl`}var fg={convertOffsetParentRelativeRectToViewportRelativeRect:Xh,getDocumentElement:E,getClippingRect:ig,getOffsetParent:lg,getElementRects:ug,getClientRects:Zh,getDimensions:ag,getScale:Uh,isElement:R,isRTL:dg};function pg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function mg(e,t,n){let r=null,i,a=E(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=op(d),h=op(a.clientWidth-(u+f)),g=op(a.clientHeight-(d+p)),_=op(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ip(0,rp(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!pg(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Ue(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function hg(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Hh(e),u=i||a?[...l?Ar(l):[],...t?Ar(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?mg(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?qh(e):null;c&&g();function g(){let t=qh(e);h&&!pg(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var gg=Lh,_g=Rh,vg=Ph,yg=Bh,bg=zh,xg=(e,t,n)=>{let r=new Map,i=n??{},a={...fg,...i.platform,_c:r};return Nh(e,t,{...i,platform:a})},Sg=typeof document<`u`?J.useLayoutEffect:function(){};function Cg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Cg(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Cg(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function wg(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Tg(e,t){let n=wg(e);return Math.round(t*n)/n}function Eg(e){let t=J.useRef(e);return Sg(()=>{t.current=e}),t}function Dg(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=J.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=J.useState(r);Cg(f,r)||p(r);let[m,h]=J.useState(null),[g,_]=J.useState(null),v=J.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=J.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=J.useRef(null),C=J.useRef(null),w=J.useRef(u),T=c!=null,E=Eg(c),D=Eg(i),O=Eg(l),k=J.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),xg(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Cg(w.current,t)&&(w.current=t,ju.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Sg(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=J.useRef(!1);Sg(()=>(A.current=!0,()=>{A.current=!1}),[]),Sg(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=J.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=J.useMemo(()=>({reference:b,floating:x}),[b,x]),N=J.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Tg(M.floating,u.x),r=Tg(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...wg(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return J.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Og=(e,t)=>{let n=gg(e);return{name:n.name,fn:n.fn,options:[e,t]}},kg=(e,t)=>{let n=_g(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ag=(e,t)=>({fn:bg(e).fn,options:[e,t]}),jg=(e,t)=>{let n=vg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mg=(e,t)=>{let n=yg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ng=J.createContext(void 0);function Pg(e){let t=J.useContext(Ng);if(t===void 0&&!e)throw Error(Sa(69));return t}var Fg=`ArrowUp`,Ig=`ArrowDown`,Lg=`ArrowLeft`,Rg=`ArrowRight`,zg=new Set([Fg,Ig,Lg,Rg,`Home`,`End`]),Bg=[`Shift`,`Control`,`Alt`,`Meta`];function Vg(e){return pe(e)&&e.tagName===`INPUT`}function Hg(e){return!!(Vg(e)&&e.selectionStart!=null||pe(e)&&e.tagName===`TEXTAREA`)}function Ug(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=Wg(e,t,`left`),a=Gg(e),o=Gg(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=Wg(e,t,`top`),r=Gg(e),i=Gg(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function Wg(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function Gg(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}function Kg(e){return e===`starting`?Cm:Un}var qg=J.createContext(void 0);function Jg(){return J.useContext(qg)}function Yg(e,t){let n=In(e.render);if(J.isValidElement(n)){let e=n.props;if(Object.hasOwn(e,`id`))return e.id??``}return e.id??t}function Xg(e,t,n){let r=Yg(e,t),i=r===t?void 0:r;return[r,J.useCallback(e=>n?.(e?i:void 0),[i,n])]}function Zg(e,t,n){let r=In(e.render),i=J.isValidElement(r)?r.props:void 0,a=e[`aria-label`]??i?.[`aria-label`],o=e[`aria-labelledby`]??i?.[`aria-labelledby`];return o==null&&!a&&(o=t?t.id||void 0:n||void 0),o}var Qg=J.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,id:o,initialFocus:s,...c}=e,{store:l,defaultFloatingId:u,setRenderedFloatingId:d,virtualFocus:f,orientation:p}=$u(),m=Jg(),{side:h,align:g}=Zu(),_=Pg(!0)!=null,v=l.useState(`open`),y=l.useState(`transitionStatus`),b=l.useState(`popupProps`),x=l.useState(`mounted`),S=l.useState(`instantType`),C=l.useState(`activeTriggerElement`),w=l.useState(`parent`),T=l.useState(`lastOpenChangeReason`),E=l.useState(`rootId`),D=l.useState(`floatingRootContext`),O=l.useState(`floatingTreeRoot`),k=l.useState(`closeDelay`),A=l.useState(`hoverEnabled`),j=l.useState(`disabled`),M=l.useState(`openMethod`),N=l.useState(`activeTriggerId`),P=l.useState(`listElement`),[F,I]=Xg(e,u,d),ee=Zg(e,C,N),L=w.type===`menu`?m:void 0,te=w.type===`context-menu`,R=s??w.type!==`menu`;s===void 0&&P&&w.type!==`menu`&&(R=()=>l.state.activeIndex===null&&P),Fu({open:v,ref:l.context.popupRef,onComplete(){v&&l.context.onOpenChangeComplete?.(!0)}}),J.useEffect(()=>{function e(e){l.setOpen(!1,Z(e.reason,e.domEvent))}return O.events.on(`close`,e),()=>{O.events.off(`close`,e)}},[O.events,l]),dh(D,{enabled:A&&!j&&!te&&w.type!==`menubar`,closeDelay:k});let z=l.useStateSetter(`popupElement`),{parentVirtualFocusRef:B,handleFocus:ne}=(J.useContext(Md)?.useParentHandoff??e_)(l,w,v,f),re={transitionStatus:y,side:h,align:g,open:v,nested:w.type===`menu`,instant:S},V=Hr(`div`,e,{state:re,ref:[t,l.context.popupRef,z,I],stateAttributesMapping:pd,props:[b,{id:F,...P?{role:`presentation`}:{role:`menu`,"aria-orientation":p===`horizontal`?`horizontal`:void 0,"aria-labelledby":ee},onKeyDown(e){L?.onPopupKeyDown?.(e),_&&zg.has(e.key)&&e.stopPropagation()},onFocus:ne},Kg(y),c,{"data-rootownerid":E}]}),ie=w.type===void 0||te;(C||w.type===`menubar`&&T!==`outside-press`)&&(ie=!0);let H=L?.getReturnElement??B;return(0,Y.jsx)(Ym,{context:D,openInteractionType:M,modal:te,disabled:!x,returnFocus:a??H??ie,explicitReturnFocus:a===void 0&&H?!1:void 0,initialFocus:R,restoreFocus:!0,getInsideElements:w.type===void 0?()=>[l.context.beforeTriggerFocusGuardRef.current]:void 0,externalTree:w.type===`menubar`?void 0:O,previousFocusableElement:C,nextFocusableElement:w.type===void 0?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:V})}),$g={parentVirtualFocusRef:void 0,handleFocus:void 0};function e_(){return $g}var t_=J.forwardRef(function(e,t){let n=Nd()?.Popup??Qg;return(0,Y.jsx)(n,{...e,ref:t})}),n_=J.createContext(void 0);function r_(){let e=J.useContext(n_);if(e===void 0)throw Error(Sa(32));return e}var i_=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=$u();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,Y.jsx)(n_.Provider,{value:n,children:(0,Y.jsx)(jm,{ref:t,...r,portalOwnerRole:o})})});function a_(e){return gi(19)?e:e?`true`:void 0}function o_(e){let{nodeId:t,externalTree:n,rootContext:r}=e,i=r.useState(`referenceElement`),a=r.useState(`floatingElement`),o=r.useState(`domReferenceElement`),s=r.useState(`open`),c=r.useState(`floatingId`),[l,u]=J.useState(null),d=J.useRef(null),f=Lm(n),p=J.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=Dg({...e,elements:{...p,...l&&{reference:l}}}),h=J.useCallback(e=>{let t=R(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=J.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=J.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=J.useMemo(()=>({...m,dataRef:r.context.dataRef,open:s,onOpenChange:r.setOpen,events:r.context.events,floatingId:c,refs:g,elements:_,nodeId:t,rootStore:r}),[m,g,_,t,r,s,c]);return q(()=>{o&&(d.current=o)},[o]),q(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),J.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var s_=J.createContext(void 0);function c_(){return J.useContext(s_)?.direction??`ltr`}var l_=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=up(e,t)||{};if(l==null)return{};let d=Op(u),f={x:n,y:r},p=gp(i),m=mp(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=s.floating[y]||a.floating[m],C=b/2-x/2,w=S/2-h[m]/2-1,T=Math.min(d[_],w),E=Math.min(d[v],w),D=T,O=S-h[m]-E,k=S/2-h[m]/2+C,A=lp(D,k,O),j=!c.arrow&&fp(i)!=null&&k!==A&&a.reference[m]/2-(k<D?T:E)-h[m]/2<0,M=j?k<D?k-D:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),u_=(e,t)=>{let{name:n,fn:r}=l_(e);return{name:n,fn:r,options:[e,t]}},d_={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},f_={sideX:`left`,sideY:`top`},p_=`--available-width`,m_=`--available-height`,h_=`--anchor-width`,g_=`--anchor-height`,__=`--transform-origin`,v_=p_,y_=m_;function b_(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function x_(e,t,n){let{rects:r,placement:i}=e;return{side:b_(t,dp(i),n),align:fp(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function S_(e){return C_(e,o_)}function C_(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,C=_.side||`flip`,w=_.align||`flip`,T=_.fallbackAxisSide||`end`,E=v?.crossAxis??!1,D=v?.rootBoundary,O=typeof n==`function`?n:void 0,k=G(O),A=O?k:n,j=Qf(n),M=Qf(g),N=c_()===`rtl`,[P,F]=J.useState(null);!g&&P!==null&&F(null);let I=x===`placement`,ee=P?dp(P):null,L=P&&I?fp(P)||`center`:null,te=ee||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],R=L||o,z=R===`center`?te:`${te}-${R}`,B=l;typeof B==`number`?B={top:B,right:B,bottom:B,left:B}:B&&={top:B.top||0,right:B.right||0,bottom:B.bottom||0,left:B.left||0};let ne=+(i===`bottom`),re=+(i===`top`),V=+(i===`right`),ie=+(i===`left`),H={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:B},U=J.useRef(null),ae=Qf(a),oe=Qf(s),W=typeof a==`function`?0:a,se=typeof s==`function`?0:s,ce=[];p&&ce.push(p),ce.push(Og(e=>{let t=x_(e,i,N),n=typeof ae.current==`function`?ae.current(t):ae.current,r=typeof oe.current==`function`?oe.current(t):oe.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[W,se,N,i]));let le=w===`none`&&C!==`shift`,ue=!le&&(u||E||C===`shift`),de=C===`none`?null:jg({...H,padding:{top:B.top+1+ne,right:B.right+1+ie,bottom:B.bottom+1+re,left:B.left+1+V},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),fe=le?null:kg({...H,rootBoundary:D,mainAxis:w!==`none`,crossAxis:ue,limiter:u||E?void 0:Ag(e=>{if(!U.current)return{};let{width:t,height:n}=U.current.getBoundingClientRect(),r=hp(dp(e.placement)),i=r===`y`?t:n,a=r===`y`?B.left+B.right:B.top+B.bottom;return{offset:i/2+a/2}})},[H,u,E,D,B,w]);C===`shift`||w===`shift`||R===`center`?ce.push(fe,de):ce.push(de,fe),ce.push(Mg({...H,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(v_,`${t}px`),i.setProperty(y_,`${n}px`);let a=Ue(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(h_,`${u}px`),i.setProperty(g_,`${d}px`)}}),u_(e=>({element:U.current||ql(e.elements.floating).createElement(`div`),padding:U.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=dp(r),u=fp(r),d=hp(l)===`y`,f=U.current,p=typeof a==`function`?a(x_(e,i,N)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return ue&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(__,d?`${m} ${h}`:`${h} ${m}`),{}}},d_,b),q(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let pe=J.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:me,elements:he,x:ge,y:_e,middlewareData:ve,update:ye,placement:be,context:xe,isPositioned:Se,floatingStyles:Ce}=t({rootContext:h,open:m?g:void 0,placement:z,middleware:ce,strategy:r,whileElementsMounted:m?void 0:(...e)=>hg(...e,pe),nodeId:y,externalTree:S}),{sideX:we,sideY:Te}=ve.adaptiveOrigin||f_,Ee=Se?r:`fixed`,De=J.useMemo(()=>{let e;return e=Se?b?{position:Ee,[we]:ge,[Te]:_e}:{...Ce,position:Ee}:{position:Ee,top:0,left:0},e[v_]=`100vw`,e[y_]=`100vh`,Se||(e.opacity=0),e},[b,Ee,we,ge,Te,_e,Ce,Se]),Oe=J.useRef(null);q(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(w_(t)?t.current:t)||null;n!==Oe.current&&(me.setPositionReference(n),Oe.current=n)},[g,me,A,j]),J.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&w_(e)&&e.current!==Oe.current&&(me.setPositionReference(e.current),Oe.current=e.current)},[g,me,A,j]),J.useEffect(()=>{if(m&&g&&he.reference&&he.floating)return hg(he.reference,he.floating,ye,pe)},[m,g,he,ye,pe]);let ke=dp(be),Ae=b_(i,ke,N),je=fp(be)||`center`,Me=!!ve.hide?.referenceHidden;q(()=>{x&&g&&Se&&(ke!==te||I&&je!==R)&&F(be)},[x,I,g,Se,be,ke,je,te,R]);let Ne=J.useMemo(()=>({position:`absolute`,top:ve.arrow?.y,left:ve.arrow?.x}),[ve.arrow]),Pe=ve.arrow?.centerOffset!==0;return J.useMemo(()=>({positionerStyles:De,arrowStyles:Ne,arrowRef:U,arrowUncentered:Pe,side:Ae,align:je,physicalSide:ke,anchorHidden:Me,refs:me,context:xe,isPositioned:Se,update:ye}),[De,Ne,U,Pe,Ae,je,ke,Me,me,xe,Se,ye])}function w_(e){return e!=null&&`current`in e}function T_(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=G(i),[,o]=J.useState(0),s=y(D_).current,c=y(E_).current,l=J.useRef(0),u=J.useRef(!0),d=J.useRef(null),f=J.useRef(null),p=G(()=>{u.current||(u.current=!0,o(e=>e+1))}),m=G((e,t)=>{c.set(e,t),p()}),h=G(e=>{c.delete(e),p()}),g=G(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!A_(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&j_(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=k_(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=G(()=>{let[e,t]=O_(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});q(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),q(()=>{u.current&&v()}),q(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let b=G(e=>(s.add(e),()=>{s.delete(e)})),x=J.useMemo(()=>({register:m,unregister:h,subscribeMapChange:b,nextIndexRef:l}),[m,h,b,l]);return(0,Y.jsx)(tf.Provider,{value:x,children:t})}function E_(){return new Map}function D_(){return new Set}function O_(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>j_(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function k_(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function A_(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function j_(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var M_=J.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,Y.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function N_(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=J.useRef(null),o=J.useRef(null),s=Pu(r);q(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),q(()=>{let e=n,r=a.current;if(e&&(a.current=e),!r||!e||e===r||!t.select(`open`))return;t.set(`instantType`,void 0);let i=new AbortController;return o.current=i,s(()=>{t.select(`open`)&&t.set(`instantType`,`trigger-change`)},i.signal),()=>{i.abort()}},[n,s,t])}function P_(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),Hr(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Kg(r),i],stateAttributesMapping:fd})}var F_={},I_={},L_=``;function R_(e,t){return ka(e)?e:t}function z_(e,t,n){return/hidden|clip/.test(e.getComputedStyle(R_(t,n)).overflowY)}function B_(e){if(typeof document>`u`)return!1;let t=ql(e);return Ue(t).innerWidth-t.documentElement.clientWidth>0}function V_(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=ql(e),n=t.documentElement,r=t.body,i=R_(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function H_(e){let t=ql(e),n=t.documentElement,r=t.body,i=R_(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function U_(e){let t=ql(e),n=t.documentElement,r=t.body,i=Ue(n),a=0,o=0,s=!1,c=Tu.create();if(Jd&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,F_={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},L_=n.style.scrollBehavior,I_={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=R_(n,r);s=V_(e),s?(n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`):(Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`)}function u(){Object.assign(n.style,F_),Object.assign(r.style,I_),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=L_)}function d(){u(),c.request(l)}l();let f=$(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var W_=new class{lockCount=0;restore=null;timeoutLock=Wu.create();timeoutUnlock=Wu.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=ql(e),n=t.documentElement,r=t.body,i=Ue(n);if(z_(i,n,r)){let t=new i.MutationObserver(()=>{z_(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=Ud||!B_(e);this.restore=a?H_(e):U_(e)}};function G_(e=!0,t=null){q(()=>{if(e)return W_.acquire(t)},[e,t])}var K_=20;function q_(e,t,n,r){let[i,a]=J.useState(!1);q(()=>{if(!e||!t||n==null){a(!1);return}let r=ql(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-K_)},[e,t,n]),G_(e&&(!t||i),r)}var J_=J.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=wm,style:g,..._}=e,{store:v,virtualFocus:y,syncHighlightedItem:b}=$u(),x=r_(),S=hd(!0),C=v.useState(`parent`),w=v.useState(`floatingRootContext`),T=v.useState(`floatingTreeRoot`),E=v.useState(`mounted`),D=v.useState(`open`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`activeTriggerElement`),j=v.useState(`transitionStatus`),M=v.useState(`positionerElement`),N=v.useState(`instantType`),P=v.useState(`adaptiveOrigin`),F=v.useState(`lastOpenChangeReason`),I=v.useState(`floatingNodeId`),ee=v.useState(`floatingParentNodeId`),L=w.useState(`domReferenceElement`),te=n,R=c,z=l,B=s,ne=h;C.type===`context-menu`&&(te=n??C.context?.anchor,B??=`start`,!o&&B!==`center`&&(z=e.alignOffset??2,R=e.sideOffset??-5));let re=o,V=B;C.type===`menu`?(re??=`inline-end`,V??=`start`,ne=e.collisionAvoidance??Tm):C.type===`menubar`&&(re??=C.context.orientation===`vertical`?`inline-end`:`bottom`,V??=`start`);let ie=C.type===`context-menu`,H=S_({anchor:te,floatingRootContext:w,positionMethod:S?`fixed`:r,mounted:E,side:re,sideOffset:R,align:V,alignOffset:z,arrowPadding:ie?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:I,keepMounted:x,disableAnchorTracking:m,collisionAvoidance:ne,shift:ie?{crossAxis:!(`side`in ne&&ne.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:P,lazyFlip:y?`placement`:!1});J.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&v.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,Z(Od)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[v,T.events,I]),J.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,Z(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,v]);let U=Gu();J.useEffect(()=>{D||U.clear()},[D,U]),J.useEffect(()=>{function e(e){if(D&&e.nodeId===v.select(`floatingParentNodeId`)){if(e.target&&A&&A!==e.target){let e=v.select(`closeDelay`);e>0?U.isStarted()||U.start(e,()=>{v.setOpen(!1,Z(Od))}):v.setOpen(!1,Z(Od))}else U.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,v,U]),J.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:ee,reason:v.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,v,I,ee]),N_({store:v,domReference:L,positionerElement:M,open:D});let ae={open:D,side:H.side,align:H.align,anchorHidden:H.anchorHidden,nested:C.type===`menu`,instant:N},oe=C.type===`menubar`&&C.context.modal;q_(D&&(oe||O&&F!==`trigger-hover`),k===`touch`,M,A);let W=P_(e,ae,{styles:H.positionerStyles,transitionStatus:j,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),se=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),ce=null;return C.type===`menubar`?ce=C.context.contentElement:C.type===void 0&&(ce=A),(0,Y.jsxs)(Xu.Provider,{value:H,children:[se&&(0,Y.jsx)(M_,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:a_(!D),cutout:ce}),(0,Y.jsx)(zm,{id:I,children:(0,Y.jsx)(T_,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,onMapChange:b,children:W})})]})}),Y_=[],X_=void 0;function Z_(){return X_}function Q_(e){Y_.push(e)}function $_(e){let t=(t,n)=>{let r=y(tv).current,i;try{X_=r;for(let e of Y_)e.before(r);i=e(t,n);for(let e of Y_)e.after(r);r.didInitialize=!0}finally{X_=void 0}return i};return t.displayName=e.displayName||e.name,t}function ev(e){return J.forwardRef($_(e))}function tv(){return{didInitialize:!1}}var nv=J.createContext(null);function rv(e){let t=J.useContext(nv);if(t===null&&!e)throw Error(Sa(5));return t}function iv(e){let t=J.useRef(``),n=J.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:J.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function av(e,t){let n=J.useRef(e),r=G(t);q(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function ov(e,t){let{onClick:n,onPointerDown:r}=iv(G((n,r)=>{(typeof e==`function`?e():e)||t(r||(Ud?`touch`:``))}));return J.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function sv(e){let[t,n]=J.useState(null),r=ov(e,n);return av(e,t=>{t&&!e&&n(null)}),J.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function cv(e){return e==null?gd:e.type.startsWith(`key`)?Td:e.type.startsWith(`mouse`)||e.type.startsWith(`pointer`)?Ed:gd}var lv=ee(),uv=kt(),dv=gi(19)?mv:hv;function fv(e,t,n,r,i){return dv(e,t,n,r,i)}function pv(e,t,n,r,i){let a=J.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,lv.useSyncExternalStore)(e.subscribe,a,a)}Q_({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,lv.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function mv(e,t,n,r,i){let a=Z_();if(!a)return pv(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],s.store===e&&s.selector===t&&Object.is(s.a1,n)&&Object.is(s.a2,r)&&Object.is(s.a3,i)||(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function hv(e,t,n,r,i){return(0,uv.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var gv=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return fv(this,e,t,n,r)}},_v=class extends gv{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){J.useDebugValue(e);let n=this;q(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;q(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this,n=Object.values(e);q(()=>{t.update(e)},[t,...n])}useControlledProp(e,t){J.useDebugValue(e);let n=this,r=t!==void 0;q(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return J.useDebugValue(e),fv(this,this.selectors[e],t,n,r)}useContextCallback(e,t){J.useDebugValue(e);let n=G(t??nr);this.context[e]=n}useStateSetter(e){let t=J.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}};function vv(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=G(i),{mounted:c,setMounted:l,transitionStatus:u}=zu(t,!1,!1,o),d=!t&&r;q(()=>{t&&s(!1)},[t,s]);let f=J.useRef(c),p=J.useRef(!1),m=af(),h=()=>{f.current=!1,l(!1),a()};q(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=G(()=>{f.current&&(t?(p.current=!0,m()):h())});return Fu({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var yv={tabIndex:-1,[Of]:``};function bv(e,t=!1){let n=lf(),r=Im()!=null,i=y(()=>e(n,r)).current;return rh({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function xv({handle:e,store:t}){return q(()=>e.attachStore(t),[e,t]),null}function Sv(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function Cv(e,t){let n=J.useRef(null);return G(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),Sv(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),Sv(t))})}function wv(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function Tv(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Ev(e,t,n,r={}){let i=n.reason,a=i===vd,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=Tv(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i=wv(e.state,t,n.trigger,c()),l={...r.extraState,...i};o?l.instantType=`focus`:s?l.instantType=`dismiss`:a&&(l.instantType=void 0),e.update(l)};a?ju.flushSync(l):l()}function Dv(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Cv(e,n),o=G(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e)}else if(a==null&&i&&!n.state.openedWithoutTrigger){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=G(e=>{a(e),e&&o(e)});return q(()=>(s(t.current),()=>s(null)),[s,t,n,e]),q(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function Ov(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=J.useRef(null),i=e.useState(`open`),a=e.useState(`triggerCount`),o=e.useState(`activeTriggerId`),s=e.useState(`activeTriggerElement`);q(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0),e.state.openedWithoutTrigger&&e.set(`openedWithoutTrigger`,!1);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&!e.state.openedWithoutTrigger&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=Z(gd);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,a,o,s,n])}function kv(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=vv({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState(`preventUnmountingOnClose`),setPreventUnmountOnClose:e=>t.set(`preventUnmountingOnClose`,e),animateInitialOpen:r,onUnmount(){t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}});return y(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function Av(e,t){e.useSyncedValues(t),q(()=>()=>{e.update({activeTriggerProps:Un,inactiveTriggerProps:Un,popupProps:Un})},[e])}var jv=class{idMap=new Map;add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}},Mv={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},Nv=class extends _v{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Mm(),nested:n,triggerElements:i},Mv),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&wf(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{this.syncOnly||this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function Pv(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Nv({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Un,inactiveTriggerProps:Un,popupProps:Un}}var Fv=e=>e.triggerIdProp??e.activeTriggerId,Iv=e=>e.openProp??e.open,Lv=e=>(e.popupElement?.id??e.floatingId)||void 0;function Rv(e,t){return t!==void 0&&Iv(e)&&Fv(e)===t}function zv(e,t){return Rv(e,t)?!0:t!==void 0&&Iv(e)&&Fv(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var Bv={open:Iv,mounted:e=>e.mounted,transitionStatus:e=>Iv(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Fv,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Lv,isTriggerActive:(e,t)=>t!==void 0&&Fv(e)===t,isOpenedByTrigger:(e,t)=>Rv(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Fv(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>zv(e,t)?Lv(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Vv(e){let t=J.useCallback(t=>e===void 0?nr:e.subscribeStore(t),[e]),n=J.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,lv.useSyncExternalStore)(t,n,()=>e?.serverStore)}var Hv={...Bv,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,keyboardOpen:e=>e.keyboardOpen,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,listElement:e=>e.listElement,triggerControlsId:(e,t)=>{let n=Bv.triggerPopupId(e,t);return n?e.listElement?.id||n:void 0},filterTriggerProps:e=>e.filterTriggerProps,inputProps:e=>e.inputProps,webkitAriaSelected:(e,t)=>Jd&&e.inputFocused&&t?!0:void 0,highlightedItemId:e=>e.highlightedItem?.id||void 0,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType===`trigger-change`&&!Bv.open(e)?void 0:e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},Uv=class extends _v{constructor(e,t,n=!1){let r=new jv,i=Gv(r,t,n,e);super(i,Wv(r),Hv),this.observe(`parent`,e=>{e.type===`menu`?this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef:e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef)})}subscribeToParentMenu(){let e=this.state.parent;if(e.type!==`menu`)return;let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);return e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}setActiveIndex(e,t,n){if(this.state.activeIndex!==e){let r=(e===null?void 0:this.context.itemDomElements.current[e])===this.context.reportedItem;this.context.highlightReason=r?`none`:t,this.context.highlightEvent=r?void 0:n}this.set(`activeIndex`,e)}highlightItem(e,t,n){let r=this.context.itemDomElements.current.indexOf(e);r>-1&&this.setActiveIndex(r,t,n)}};function Wv(e){return{positionerRef:J.createRef(),popupRef:J.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},highlightReason:`none`,highlightEvent:void 0,reportedItem:void 0,allowMouseUpTriggerRef:{current:!1},virtualFocusRef:void 0,triggerFocusTargetRef:J.createRef(),beforeTriggerFocusGuardRef:J.createRef(),beforeContentFocusGuardRef:J.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function Gv(e,t,n=!1,r){return{...Pv(e,t,n),disabled:!1,modal:!0,openMethod:null,keyboardOpen:!1,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,listElement:null,filterTriggerProps:Un,inputProps:Un,inputFocused:!1,highlightedItem:void 0,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Nm,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Un,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var Kv=J.createContext(null);function qv(e,t){return(e===`trigger-press`||e===`item-press`)&&t?.detail===0}function Jv(e,t){return e===`list-navigation`||qv(e,t)}var Yv=$_(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,onItemHighlighted:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:g=!0,isSubmenu:_=!1,virtualFocus:v=!1,virtualFocusRef:b,allowEscape:x=!0,resetOnPointerLeave:S=!0}=e,C=hd(!0),w=$u(!0),T=rv(!0),E=w?.store,D=w?.virtualFocus??!1,O=J.useMemo(()=>_&&E?{type:`menu`,store:E}:T?{type:`menubar`,context:T}:C&&!E?{type:`context-menu`,context:C}:{type:void 0},[C,E,T,_]),k=uf(),A=uf(),[j,M]=J.useState(void 0),N=(j??A)||void 0,P=Im(),F=O.type===`menu`?O.store:void 0,I=(n??o)&&F?.state.transitionStatus===`starting`,ee=y(()=>I?F?.state.instantType:void 0).current,L=y(()=>{let e=new Uv({open:o,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:O,disabled:s,highlightItemOnHover:g,modal:O.type===void 0?c:void 0,rootId:k,instantType:ee},N,P!=null);return e.context.virtualFocusRef=b,e}).current;L.useControlledProp(`openProp`,n),L.useControlledProp(`triggerIdProp`,m),L.useContextCallback(`onOpenChangeComplete`,i);let te=L.useState(`floatingTreeRoot`),R=Rm(te),z=L.useState(`open`),B=L.useState(`activeTriggerElement`),ne=L.useState(`positionerElement`),re=L.useState(`hoverEnabled`),V=L.useState(`disabled`),ie=L.useState(`lastOpenChangeReason`),H=L.useState(`parent`),U=L.useState(`activeIndex`),ae=L.useState(`keyboardOpen`),oe=L.useState(`payload`),W=L.useState(`floatingParentNodeId`),se=J.useRef(null),ce=J.useRef(H.type!==`context-menu`),le=Gu(),ue=J.useRef(!0),de=Gu(),fe=W!=null,{openMethod:pe,triggerProps:me}=sv(z);L.useSyncedValues({disabled:s,highlightItemOnHover:g,modal:H.type===void 0?c:void 0,openMethod:pe,rootId:k}),Ov(L);let{forceUnmount:he,transitionStatus:ge}=kv(z,L,()=>{L.set(`allowMouseEnter`,!1)},I),_e=Pu(L.context.popupRef);J.useEffect(()=>{if(ee===void 0)return;let e=()=>{L.state.instantType===ee&&L.set(`instantType`,void 0)};if(!z){e();return}if(ge!==void 0)return;if(L.context.popupRef.current==null){e();return}let t=new AbortController;return _e(e,t.signal),()=>{t.abort()}},[ee,z,ge,_e,L]),q(()=>{C&&!w?L.update({parent:{type:`context-menu`,context:C},floatingNodeId:R,floatingParentNodeId:P}):(w||!L.select(`activeTriggerElement`))&&L.update({floatingNodeId:R,floatingParentNodeId:P})},[C,w,R,P,B,L]),J.useEffect(()=>{z||(se.current=null),H.type===`context-menu`&&(z?le.start(500,()=>{ce.current=!0}):(le.clear(),ce.current=!1))},[le,z,H.type]),q(()=>{!z&&!re&&L.set(`hoverEnabled`,!0)},[z,re,L]);let ve=G((e,t)=>{let n=t.reason;if(!e&&!L.select(`open`)||z===e&&t.trigger===B&&ie===n)return;let i=Tv(t);if(!e&&t.trigger==null&&(t.trigger=B??void 0),r?.(e,t),t.isCanceled)return;L.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&n!==`item-press`&&a?.type===`click`&&a.pointerType===`touch`&&!ue.current)return;e&&n===`trigger-focus`?(ue.current=!1,de.start(300,()=>{ue.current=!0})):(ue.current=!0,de.clear());let o=!e&&(n===`escape-key`||n==null);se.current=t.event;let s=wv(L.state,e,t.trigger,i());s.openChangeReason=n,s.keyboardOpen=e&&Jv(n,a),s.instantType=H.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:qv(n,a)?`click`:o?`dismiss`:void 0,L.update(s)}),ye=rh({popupStore:L,floatingRootContext:L.state.floatingRootContext,floatingId:N,nested:P!=null,onOpenChange:ve}),be=ye.context.events;q(()=>{let e=({open:e,eventDetails:t})=>ve(e,t);return be.on(`setOpen`,e),()=>{be?.off(`setOpen`,e)}},[be,ve]),q(()=>L.subscribeToParentMenu(),[L]);let xe=J.useCallback(()=>{L.setOpen(!1,Z(Ad))},[L]);J.useImperativeHandle(d,()=>({unmount:he,close:xe}),[he,xe]);let Se;H.type===`context-menu`&&(Se=H.context),J.useImperativeHandle(Se?.positionerRef,()=>ne,[ne]),J.useImperativeHandle(Se?.actionsRef,()=>({setOpen:ve}),[ve]);let Ce=nh(ye,{enabled:!V,bubbles:{escapeKey:f&&H.type===`menu`},outsidePress(){return H.type!==`context-menu`||se.current?.type===`contextmenu`||ce.current},externalTree:fe?te:void 0}),we=c_(),Te=bh(ye,{enabled:!V,listRef:L.context.itemDomElements,activeIndex:U,virtual:v,nested:H.type===`menubar`||!v&&H.type!==void 0,parentOrientation:H.type===`menubar`?H.context.orientation:void 0,loopFocus:l,focusItemOnOpen:v?ae:void 0,allowEscape:v&&l&&x,orientation:u,triggerOrientation:v?`vertical`:u,rtl:we===`rtl`,disabledIndices:Xi,onNavigate(e,t){L.setActiveIndex(e,cv(t),t?.nativeEvent)},openOnArrowKeyDown:H.type!==`context-menu`&&!(v&&_),externalTree:!v&&fe?te:void 0,nestedReturnFocusRef:F?.context.virtualFocusRef,focusItemOnHover:g,resetOnPointerLeave:S}),Ee=J.useCallback(e=>{L.context.typingRef.current=e},[L]),De=xh(ye,{enabled:!V&&!v,listRef:L.context.itemLabels,elementsRef:L.context.itemDomElements,activeIndex:U,resetMs:500,onMatch:(e,t)=>{z&&e!==U&&L.setActiveIndex(e,Td,t.nativeEvent)},onTyping:Ee}),Oe=G(a),ke=J.useRef(-1),Ae=G(()=>{let e=L.state.activeIndex,t=e===null?void 0:L.context.itemDomElements.current[e]??void 0;if(t?.isConnected===!1)return;let n=t===void 0?-1:e;if(ke.current===n&&L.context.reportedItem===t)return;ke.current=n,L.context.reportedItem=t,v&&L.set(`highlightedItem`,t);let{highlightReason:r,highlightEvent:i}=L.context;L.context.highlightReason=gd,L.context.highlightEvent=void 0,a&&Oe(t,df(r,i,{label:t===void 0?void 0:L.context.itemLabels.current[n]??void 0}))});q(()=>{Ae()},[U,Ae]);let je=J.useMemo(()=>{if(!v)return Te.reference;if(!Te.trigger)return Un;let{onFocus:e,...t}=Te.trigger;return t},[v,Te.reference,Te.trigger]);L.useSyncedValue(`inputProps`,v?Te.reference??Un:Un);let Me=J.useMemo(()=>{let e=kn(De.reference,je,Ce.reference,{onMouseMove(){L.set(`allowMouseEnter`,!0)}},me);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=z,e},[L,De.reference,je,Ce.reference,me,z]),Ne=J.useMemo(()=>{let e=kn(Te.trigger,Ce.trigger,me);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[Te.trigger,Ce.trigger,me]);y(()=>(L.update({inactiveTriggerProps:Ne}),null)),Av(L,{floatingRootContext:ye,activeTriggerProps:Me,inactiveTriggerProps:Ne,popupProps:J.useMemo(()=>kn(yv,{onMouseMove(){L.set(`allowMouseEnter`,!0),H.type===`menu`&&L.set(`hoverEnabled`,!1)},onClick(){L.select(`hoverEnabled`)&&L.set(`hoverEnabled`,!1)},onKeyDown(e){let t=L.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},De.floating,Te.floating,Ce.floating),[H.type,L,De.floating,Te.floating,Ce.floating]),itemProps:Te.item??Un});let Pe=J.useMemo(()=>({store:L,parent:O,orientation:u,loopFocus:l,allowEscape:x,defaultFloatingId:A,setRenderedFloatingId:M,virtualFocus:v,parentVirtualFocus:D,syncHighlightedItem:Ae}),[L,O,u,l,x,A,v,D,Ae]),Fe=typeof t==`function`?t({payload:oe}):t,Ie=(0,Y.jsxs)(Qu.Provider,{value:Pe,children:[p&&(0,Y.jsx)(xv,{handle:p,store:L}),Fe]});return(H.type===void 0||H.type===`context-menu`)&&(Ie=(0,Y.jsx)(Bm,{externalTree:te,children:Ie})),Ie});function Xv(e){let t=J.useContext(Kv);if(t===null)return(0,Y.jsx)(Yv,{...e});let n=t.Root;return(0,Y.jsx)(Kv.Provider,{value:null,children:(0,Y.jsx)(n,{...t.options,...e})})}var Zv=5;function Qv(e,t){let n=$v(t);return e.clientX>=n.left-Zv&&e.clientX<=n.right+Zv&&e.clientY>=n.top-Zv&&e.clientY<=n.bottom+Zv}function $v(e){let t=e.getBoundingClientRect(),n=Ue(e);if(Xd)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function ey(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=ra(),{ref:i,index:a}=rf(e),o=n===a,s=J.useRef(null),c=Yr(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function ty(e){let{render:t,className:n,style:r,state:i=Un,props:a=Xi,refs:o=Xi,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=ey({metadata:s});return Hr(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function ny(e){if(pe(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!je(e))return ny(Le(e))}function ry(e,t){function n(n,r,i){let a=n.currentTarget;ju.flushSync(()=>{e.setOpen(!1,Z(Sd,n.nativeEvent,a))}),rm(a.isConnected?a:t.current,r,i)?.focus()}function r(t){n(t,-1,e.select(`positionerElement`))}function i(t){let r=e.select(`positionerElement`);r&&im(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function iy(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=J.useRef(!1);return J.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,ql(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:Un,[t,n,r])}var ay=ev(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=$u(!0),h=Vv(d)??m?.store;if(!h)throw Error(Sa(85));let g=uf(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerControlsId`,g),x=J.useRef(null),S=sy(),C=ra(!0),w=Lm(),T=J.useMemo(()=>w??new Nm,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=Dv(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:Rm(T),floatingParentNodeId:Im(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=gr({disabled:A,native:o});J.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=J.useRef(null),P=Gu(),F=G(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;Q(N.current,t)||Q(h.select(`positionerElement`),t)||t===N.current||t!=null&&ny(t)===h.select(`rootId`)||Qv(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:Dd})});J.useEffect(()=>{let e=ql(N.current);if(y&&h.select(`lastOpenChangeReason`)===`trigger-hover`)return e.addEventListener(`mouseup`,F,{once:!0}),()=>{e.removeEventListener(`mouseup`,F)}},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,ee=ph(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:kh({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),L=oy(y,h.select(`lastOpenChangeReason`)),te=Xm(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&L}),R=ah(v,{enabled:!A&&I}),z=iy({open:y,enabled:O,mouseDownAction:`open`}),B=J.useMemo(()=>kn(R.reference,te.reference),[R.reference,te.reference]),ne=h.useState(`triggerProps`,D),re=h.useState(`filterTriggerProps`),{handlePreFocusGuardFocus:V,handleFocusTargetFocus:ie}=ry(h,x),H={disabled:A,open:y},U=[N,t,M,E,x],ae=[B,ee??Un,ne,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),ql(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},re,O?{role:`menuitem`}:{},z,p,j],oe=Hr(`button`,e,{enabled:!O,stateAttributesMapping:dd,state:H,ref:U,props:ae});return O?(0,Y.jsx)(ty,{tag:`button`,render:n,className:r,style:i,state:H,refs:U,props:ae,stateAttributesMapping:dd}):y?(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsx)(np,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:V},`${g}-pre-focus-guard`),(0,Y.jsx)(J.Fragment,{children:oe},g),(0,Y.jsx)(np,{ref:h.context.triggerFocusTargetRef,onFocus:ie},`${g}-post-focus-guard`)]}):(0,Y.jsx)(J.Fragment,{children:oe},g)});function oy(e,t){let n=Gu(),[r,i]=J.useState(!1);return q(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function sy(){let e=rv(!0);return J.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var cy=J.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return Hr(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function ly(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function uy(e){let t=(0,X.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Y.jsx)(Xv,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function dy(e){let t=(0,X.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Y.jsx)(ay,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function fy(e){let t=(0,X.c)(18),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({align:i,alignOffset:a,side:o,sideOffset:s,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=i===void 0?`start`:i,l=a===void 0?0:a,u=o===void 0?`bottom`:o,d=s===void 0?4:s,f;t[7]===n?f=t[8]:(f=Wt(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[7]=n,t[8]=f);let p;t[9]!==r||t[10]!==f?(p=(0,Y.jsx)(t_,{"data-slot":`dropdown-menu-content`,className:f,...r}),t[9]=r,t[10]=f,t[11]=p):p=t[11];let m;return t[12]!==c||t[13]!==l||t[14]!==u||t[15]!==d||t[16]!==p?(m=(0,Y.jsx)(i_,{children:(0,Y.jsx)(J_,{className:`isolate z-50 outline-none`,align:c,alignOffset:l,side:u,sideOffset:d,children:p})}),t[12]=c,t[13]=l,t[14]=u,t[15]=d,t[16]=p,t[17]=m):m=t[17],m}function py(e){let t=(0,X.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Y.jsx)(hf,{"data-slot":`dropdown-menu-group`,...n}),t[2]=n,t[3]=r),r}function my(e){let t=(0,X.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Wt(`px-2 py-1.5 text-xs text-muted-foreground data-inset:pl-7.5`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Y.jsx)(gf,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function hy(e){let t=(0,X.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=Wt(`group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Y.jsx)(vf,{"data-slot":`dropdown-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function gy(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Wt(`-mx-1 my-1 h-px bg-border/50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(cy,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var _y=K({id:T,name:T,signOut:Hi}),vy=gl(Ls).atom(Nn(gs(`/auth/user`),Jn(ss),Jn(ts(_y))));function yy(){let e=(0,X.c)(27),t=su(vy);if(!Ks(t))return null;let n;e[0]===t.value.id?n=e[1]:(n=Zn(`github:`,``)(t.value.id),e[0]=t.value.id,e[1]=n);let r=`https://avatars.githubusercontent.com/u/${n}?s=96`,i;e[2]!==t.value.name||e[3]!==r?(i=(0,Y.jsx)(Ju,{src:r,alt:t.value.name}),e[2]=t.value.name,e[3]=r,e[4]=i):i=e[4];let a;e[5]===t.value.name?a=e[6]:(a=ii(Gi(0,1)(t.value.name)),e[5]=t.value.name,e[6]=a);let o;e[7]===a?o=e[8]:(o=(0,Y.jsx)(Yu,{children:a}),e[7]=a,e[8]=o);let s;e[9]!==i||e[10]!==o?(s=(0,Y.jsx)(dy,{"aria-label":`Account`,children:(0,Y.jsxs)(qu,{size:`sm`,children:[i,o]})}),e[9]=i,e[10]=o,e[11]=s):s=e[11];let c;e[12]===t.value.name?c=e[13]:(c=(0,Y.jsx)(py,{children:(0,Y.jsxs)(my,{children:[`@`,t.value.name]})}),e[12]=t.value.name,e[13]=c);let l;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(gy,{}),e[14]=l):l=e[14];let u=!t.value.signOut,d;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(d=new URLSearchParams({next:location.href}),e[15]=d):d=e[15];let f=`/auth/sign-out?${d}`,p;e[16]===f?p=e[17]:(p=(0,Y.jsx)(`a`,{"aria-label":`Sign out`,href:f}),e[16]=f,e[17]=p);let m;e[18]!==p||e[19]!==u?(m=(0,Y.jsx)(hy,{variant:`destructive`,disabled:u,render:p,children:`Sign out`}),e[18]=p,e[19]=u,e[20]=m):m=e[20];let h;e[21]!==m||e[22]!==c?(h=(0,Y.jsxs)(fy,{align:`end`,className:`w-auto min-w-48`,children:[c,l,m]}),e[21]=m,e[22]=c,e[23]=h):h=e[23];let g;return e[24]!==h||e[25]!==s?(g=(0,Y.jsxs)(uy,{children:[s,h]}),e[24]=h,e[25]=s,e[26]=g):g=e[26],g}function by(e){let t=(0,X.c)(15),n;t[0]===e.icon?n=t[1]:(n=(0,Y.jsx)(`img`,{src:e.icon,alt:``,className:`pixelated size-8`}),t[0]=e.icon,t[1]=n);let r;t[2]===e.name?r=t[3]:(r=(0,Y.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:e.name}),t[2]=e.name,t[3]=r);let i;t[4]!==n||t[5]!==r?(i=(0,Y.jsxs)(`a`,{href:`/`,className:`-ml-1 flex shrink-0 items-center gap-1.5`,children:[n,r]}),t[4]=n,t[5]=r,t[6]=i):i=t[6];let a;t[7]===e.account?a=t[8]:(a=e.account??(0,Y.jsx)(yy,{}),t[7]=e.account,t[8]=a);let o;t[9]!==e.children||t[10]!==a?(o=(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[e.children,a]}),t[9]=e.children,t[10]=a,t[11]=o):o=t[11];let s;return t[12]!==i||t[13]!==o?(s=(0,Y.jsxs)(`header`,{className:`bg-background border-border sticky top-0 z-30 flex h-12 shrink-0 items-center justify-between gap-4 border-b px-4`,children:[i,o]}),t[12]=i,t[13]=o,t[14]=s):s=t[14],s}function xy(e){return Hr(e.defaultTagName??`div`,e,e)}function Sy(e){let t=(0,X.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=Wt(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Y.jsx)(cy,{"data-slot":`separator`,orientation:a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Cy(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Wt(`group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function wy(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Wt(`my-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(Sy,{"data-slot":`item-separator`,orientation:`horizontal`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Ty=ie(`group/item flex w-full flex-wrap items-center rounded-md border text-xs/relaxed transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-2.5 px-3 py-2.5`,sm:`gap-2.5 px-3 py-2.5`,xs:`gap-2.5 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function Ey(e){let t=(0,X.c)(15),n,r,i,a,o,s;if(t[0]!==e){let{className:c,variant:l,size:u,render:d,...f}=e;n=d,s=l===void 0?`default`:l,r=u===void 0?`default`:u,o=xy,i=`div`,a=kn({className:Wt(Ty({variant:s,size:r,className:c}))},f),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6];let c;t[7]!==r||t[8]!==s?(c={slot:`item`,variant:s,size:r},t[7]=r,t[8]=s,t[9]=c):c=t[9];let l;return t[10]!==n||t[11]!==i||t[12]!==a||t[13]!==c?(l={defaultTagName:i,props:a,render:n,state:c},t[10]=n,t[11]=i,t[12]=a,t[13]=c,t[14]=l):l=t[14],o(l)}var Dy=ie(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-8 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function Oy(e){let t=(0,X.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=Wt(Dy({variant:a,className:n})),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Y.jsx)(`div`,{"data-slot":`item-media`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function ky(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Wt(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0.5 [&+[data-slot=item-content]]:flex-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`item-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ay(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Wt(`line-clamp-1 flex w-fit items-center gap-2 text-xs/relaxed leading-snug font-medium underline-offset-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`item-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jy(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Wt(`line-clamp-2 text-left text-xs/relaxed font-normal text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`p`,{"data-slot":`item-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function My(e){let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Wt(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`skeleton`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ny(e){let t=(0,X.c)(5),n=e.label,r;t[0]===e.children?r=t[1]:(r=_r(e.children,Py),t[0]=e.children,t[1]=r);let i;return t[2]!==e.label||t[3]!==r?(i=(0,Y.jsx)(Cy,{"aria-label":n,className:`gap-0 has-data-[size=sm]:gap-0 has-data-[size=xs]:gap-0`,children:r}),t[2]=e.label,t[3]=r,t[4]=i):i=t[4],i}function Py(e,t){return(0,Y.jsxs)(J.Fragment,{children:[e,(0,Y.jsx)(wy,{className:`my-0`})]},e.key??t)}function Fy(e){let t=(0,X.c)(11),n=e.label,r=e.label,i;if(t[0]!==e.media||t[1]!==e.rows){let n;t[3]===e.media?n=t[4]:(n=t=>(0,Y.jsxs)(Ey,{role:`listitem`,size:`sm`,"aria-hidden":!0,children:[e.media===!0&&(0,Y.jsx)(Oy,{children:(0,Y.jsx)(My,{className:`size-8`})}),(0,Y.jsxs)(ky,{children:[(0,Y.jsx)(My,{className:`h-4 w-1/3`}),(0,Y.jsx)(My,{className:`h-3 w-1/2`})]})]},t),t[3]=e.media,t[4]=n),i=_r(gn(1,e.rows),n),t[0]=e.media,t[1]=e.rows,t[2]=i}else i=t[2];let a;t[5]!==e.label||t[6]!==i?(a=(0,Y.jsx)(Ny,{label:r,children:i}),t[5]=e.label,t[6]=i,t[7]=a):a=t[7];let o;return t[8]!==e.label||t[9]!==a?(o=(0,Y.jsx)(`div`,{"aria-busy":`true`,"aria-label":n,role:`status`,children:a}),t[8]=e.label,t[9]=a,t[10]=o):o=t[10],o}var Iy=ie(`inline-block size-1.5 shrink-0 rounded-full`,{defaultVariants:{status:`live`},variants:{status:{error:`bg-destructive`,live:`bg-primary`,off:`border-muted-foreground border`,quiet:`bg-muted-foreground/50`,warning:`bg-warning`}}});function Ly(e){let t=(0,X.c)(6),n;t[0]!==e.className||t[1]!==e.status||t[2]!==e.waiting?(n=Wt(Iy({status:e.status}),e.waiting===!0&&`motion-safe:animate-pulse`,e.className),t[0]=e.className,t[1]=e.status,t[2]=e.waiting,t[3]=n):n=t[3];let r;return t[4]===n?r=t[5]:(r=(0,Y.jsx)(`span`,{"data-slot":`status-dot`,"aria-hidden":`true`,className:n}),t[4]=n,t[5]=r),r}var Ry=J.createContext(void 0);function zy(){return J.useContext(Ry)}var By=J.forwardRef(function(e,t){let{className:n,defaultPressed:r=!1,disabled:i=!1,form:a,onPressedChange:o,pressed:s,render:c,type:l,value:u,nativeButton:d=!0,style:f,...p}=e,m=uf(u||void 0),h=zy(),g=h?.value??[],_=(i||h?.disabled)??!1,[v,y]=jd({controlled:h?m!==void 0&&g.indexOf(m)>-1:s,default:r,name:`Toggle`,state:`pressed`}),{getButtonProps:b,buttonRef:x}=gr({disabled:_,native:d}),S={disabled:_,pressed:v},C=[x,t],w=[{"aria-pressed":v,onClick(e){let t=!v,n=Z(gd,e.nativeEvent);o?.(t,n),!n.isCanceled&&(m&&h?.setGroupValue?.(m,t,n),!n.isCanceled&&y(t))}},p,b],T=Hr(`button`,e,{enabled:!h,state:S,ref:C,props:w}),E=J.useMemo(()=>({disabled:_,focusableWhenDisabled:!1}),[_]);return h?(0,Y.jsx)(ty,{tag:`button`,render:c,className:n,style:f,metadata:E,state:S,refs:C,props:w}):T}),Vy=ie(`group/toggle inline-flex items-center justify-center gap-1 rounded-md text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`},size:{default:`h-7 min-w-7 px-2 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5`,sm:`h-6 min-w-6 rounded-[min(var(--radius-md),8px)] px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,lg:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}});function Hy(e){let t=(0,X.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a===void 0?`default`:a,c;t[5]!==n||t[6]!==s||t[7]!==o?(c=Wt(Vy({variant:o,size:s,className:n})),t[5]=n,t[6]=s,t[7]=o,t[8]=c):c=t[8];let l;return t[9]!==r||t[10]!==c?(l=(0,Y.jsx)(By,{"data-slot":`toggle`,className:c,...r}),t[9]=r,t[10]=c,t[11]=l):l=t[11],l}function Uy(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=Xi}=e,[p,m]=J.useState(0),h=r!=null,g=J.useRef(null),_=Yr(g,c),v=J.useRef([]),y=J.useRef(!1),b=J.useRef(null),x=o??p,S=G((e,t=!1)=>{if(b.current=v.current[e]??null,(s??m)(e),t){let t=v.current[e];Ug(g.current,t,a,n)}}),C=G(e=>{if(e.size===0)return;if(y.current){let e=v.current,t=e.indexOf(b.current);if(t===-1){let t=e[x];!t||Fp(e,x,d)?S(Wy(e,d)):b.current=t}else t!==x&&S(t);return}y.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)S(i);else if(Fp(t,x,d)){let e=Pp(t,{disabledIndices:d});Ap(t,e)||S(e)}Ug(g.current,r,a,n)});q(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(Fp(e,x,d)){let t=Pp(e,{disabledIndices:d});Ap(e,t)||S(t)}},[d,o,x,v,S]);let w=G((e,t,n)=>i?i(e,t,n,v):n),T=G(e=>{let o=e.key===`Home`||e.key===`End`;if(!zg.has(e.key)||!l&&o||Gy(e,f)||!g.current)return;let s=a===`rtl`,c=s?Lg:Rg,p=s?Rg:Lg,m=n===`vertical`?Ig:c,_=n===`vertical`?Fg:p,y=Df(e.nativeEvent);if(y!=null&&Hg(y)&&!ly(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let b=x,C=jp(v,d),T=Mp(v,d);r!=null&&(b=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:x,loopFocus:t,maxIndex:T,minIndex:C,onLoop:w,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?b=C:e.key===`End`&&(b=T)),b===x&&(E||D)&&(t&&b===T&&E?(b=C,i&&(b=i(e,x,b,v))):t&&b===C&&D?(b=T,i&&(b=i(e,x,b,v))):b=Pp(v.current,{startingIndex:b,decrement:D,disabledIndices:d})),b!==x&&!Ap(v.current,b)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),S(b,!0),queueMicrotask(()=>{v.current[b]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=Df(e.nativeEvent);t&&n!=null&&Hg(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:T},highlightedIndex:x,onHighlightedIndexChange:S,elementsRef:v,onMapChange:C,relayKeyboardEvent:T}}function Wy(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!Fp(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function Gy(e,t){for(let n of Bg)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Ky(e){let{render:t,className:n,style:r,refs:i=Xi,props:a=Xi,state:o=Un,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:D,relayKeyboardEvent:O}=Uy({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:c_(),disabledIndices:v,modifierKeys:y}),k=Hr(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),A=J.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,Y.jsx)(hn.Provider,{value:A,children:(0,Y.jsx)(T_,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}var qy=J.createContext(void 0);function Jy(){return J.useContext(qy)}var Yy=J.forwardRef(function(e,t){let{defaultValue:n,disabled:r=!1,loopFocus:i=!0,onValueChange:a,orientation:o=`horizontal`,multiple:s=!1,value:c,className:l,render:u,style:d,...f}=e,p=Pg(!0),m=Jy(),h=n??Xi,g=c!==void 0||n!==void 0,_=(p?.disabled??!1)||(m?.disabled??!1)||r,[v,y]=jd({controlled:c,default:h,name:`ToggleGroup`,state:`value`}),b=G((e,t,n)=>{let r;s?(r=v.slice(),t?r.push(e):r.splice(v.indexOf(e),1)):r=t?[e]:[],a?.(r,n),!n.isCanceled&&y(r)}),x={disabled:_,multiple:s,orientation:o},S=J.useMemo(()=>({disabled:_,setGroupValue:b,value:v,isValueInitialized:g}),[_,b,v,g]),C={role:`group`},w=Hr(`div`,e,{enabled:!!p,state:x,ref:t,props:[C,f]});return(0,Y.jsx)(Ry.Provider,{value:S,children:p?w:(0,Y.jsx)(Ky,{render:u,className:l,style:d,state:x,refs:[t],props:[C,f],loopFocus:i,enableHomeAndEndKeys:!0,orientation:o})})}),Xy=J.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function Zy(e){let t=(0,X.c)(29),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({className:r,variant:c,size:a,spacing:o,orientation:s,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?2:o,u=s===void 0?`horizontal`:s,d;t[8]===l?d=t[9]:(d={"--gap":l},t[8]=l,t[9]=d);let f=d,p;t[10]===r?p=t[11]:(p=Wt(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-md data-[size=sm]:rounded-[min(var(--radius-md),8px)] data-vertical:flex-col data-vertical:items-stretch`,r),t[10]=r,t[11]=p);let m;t[12]!==u||t[13]!==a||t[14]!==l||t[15]!==c?(m={variant:c,size:a,spacing:l,orientation:u},t[12]=u,t[13]=a,t[14]=l,t[15]=c,t[16]=m):m=t[16];let h;t[17]!==n||t[18]!==m?(h=(0,Y.jsx)(Xy.Provider,{value:m,children:n}),t[17]=n,t[18]=m,t[19]=h):h=t[19];let g;return t[20]!==u||t[21]!==i||t[22]!==a||t[23]!==l||t[24]!==f||t[25]!==p||t[26]!==h||t[27]!==c?(g=(0,Y.jsx)(Yy,{"data-slot":`toggle-group`,"data-variant":c,"data-size":a,"data-spacing":l,"data-orientation":u,style:f,className:p,...i,children:h}),t[20]=u,t[21]=i,t[22]=a,t[23]=l,t[24]=f,t[25]=p,t[26]=h,t[27]=c,t[28]=g):g=t[28],g}function Qy(e){let t=(0,X.c)(19),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:a,size:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`default`:a,c=o===void 0?`default`:o,l=J.useContext(Xy),u=l.variant||s,d=l.size||c,f=l.spacing,p;t[6]!==r||t[7]!==l.size||t[8]!==l.variant||t[9]!==c||t[10]!==s?(p=Wt(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,Vy({variant:l.variant||s,size:l.size||c}),r),t[6]=r,t[7]=l.size,t[8]=l.variant,t[9]=c,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==n||t[13]!==l.spacing||t[14]!==i||t[15]!==u||t[16]!==d||t[17]!==p?(m=(0,Y.jsx)(By,{"data-slot":`toggle-group-item`,"data-variant":u,"data-size":d,"data-spacing":f,className:p,...i,children:n}),t[12]=n,t[13]=l.spacing,t[14]=i,t[15]=u,t[16]=d,t[17]=p,t[18]=m):m=t[18],m}var $y=J.createContext(void 0);function eb(e){let t=J.useContext($y);if(t===void 0&&!e)throw Error(Sa(72));return t}var tb={...Bv,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,appliedTriggerProps:(e,t)=>t?e.activeTriggerProps:void 0,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},nb=class extends _v{constructor(e,t,n){let r=new jv;super(rb(e,r,t,n),ib(r),tb)}setOpen=(e,t)=>{Ev(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,Z(_d,e))}};function rb(e,t,n,r=!1){return{...Pv(t,n,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function ib(e){return{popupRef:J.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var ab=$_(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=bv((e,t)=>new nb({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),Ov(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=kv(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=J.useRef(null);q(()=>{m&&t&&p.setOpen(!1,Z(kd))},[m,t,p]),q(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),q(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),J.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,Z(Ad))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,Y.jsxs)($y.Provider,{value:p,children:[l&&(0,Y.jsx)(xv,{handle:l,store:p}),T&&(0,Y.jsx)(ob,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function ob({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=nh(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=$m(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=J.useMemo(()=>kn(a.reference,i.reference),[a.reference,i.reference]);return Av(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??Un}),null}var sb=J.createContext(void 0);function cb(){return J.useContext(sb)}var lb=`data-base-ui-tooltip-trigger`;function ub(e){let t=Df(e);return R(t)?t:null}var db=ev(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=eb(!0),m=Vv(a)??p;if(!m)throw Error(Sa(82));let h=uf(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=J.useRef(null),b=u??0,{registerTrigger:x,isMountedByThisTrigger:S}=Dv(h,y,m,{payload:o,closeOnClick:l,closeDelay:b}),C=cb(),{activeIdRef:w,delayRef:T,isInstantPhase:E,hasProvider:D}=Xf(v,{open:_}),O=uh(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=Qf(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=J.useRef(!1),F=Gu(),I=J.useRef(void 0);function ee(){return D&&w.current!=null?0:c??C??600}function L(e){let t=y.current;if(!t||!e)return!1;let n=Ef(e,`[${lb}]`);return n!==null&&n!==t&&Q(t,n)}function te(e){let t=L(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let R=ph(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?kh():null,restMs:ee,delay(){return u==null&&D?{close:Wf(T.current,`close`)}:{close:b}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),z=ah(v,{enabled:!A}).reference,B=e=>{let t=P.current,n=ub(e),r=te(n),i=y.current,a=i&&n&&Q(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`)m.setOpen(!1,Z(vd,e));else if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&Cf(I.current)){let t=()=>{P.current||j.current||m.select(`open`)||m.setOpen(!0,Z(vd,e,i))},n=ee();n===0?(F.clear(),t()):F.start(n,t)}},ne=m.useState(`appliedTriggerProps`,S||M!==`none`);return Hr(`button`,e,{state:{open:_},ref:[t,x,y],props:[R,z,ne,{onMouseOver(e){B(e.nativeEvent)},onFocus(e){L(ub(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[Pf]:A?``:void 0,[lb]:A?void 0:``},f],stateAttributesMapping:ud})}),fb=J.createContext(void 0);function pb(){let e=J.useContext(fb);if(e===void 0)throw Error(Sa(70));return e}var mb=J.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=Am({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,Y.jsxs)(J.Fragment,{children:[l,c&&ju.createPortal(n,c)]})}),hb=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return eb().useState(`mounted`)||n?(0,Y.jsx)(fb.Provider,{value:n,children:(0,Y.jsx)(mb,{ref:t,...r})}):null}),gb=J.createContext(void 0);function _b(){let e=J.useContext(gb);if(e===void 0)throw Error(Sa(71));return e}var vb=J.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Tm,style:g,..._}=e,v=eb(),y=pb(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=S_({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=P_(e,J.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,Y.jsx)(gb.Provider,{value:D,children:O})}),yb=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=eb(),{side:s,align:c}=_b(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);Fu({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),dh(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return Hr(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[yv,f,Kg(d),a],stateAttributesMapping:pd})}),bb=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=eb(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=_b(),f={open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)};return Hr(`div`,e,{state:f,ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:fd})});function xb(e){let t=(0,X.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Y.jsx)(ab,{"data-slot":`tooltip`,...n}),t[2]=n,t[3]=r),r}function Sb(e){let t=(0,X.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Y.jsx)(db,{"data-slot":`tooltip-trigger`,...n}),t[2]=n,t[3]=r),r}function Cb(e){let t=(0,X.c)(21),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({className:r,side:a,sideOffset:o,align:s,alignOffset:c,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=a===void 0?`top`:a,u=o===void 0?4:o,d=s===void 0?`center`:s,f=c===void 0?0:c,p;t[8]===r?p=t[9]:(p=Wt(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,r),t[8]=r,t[9]=p);let m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Y.jsx)(bb,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`}),t[10]=m):m=t[10];let h;t[11]!==n||t[12]!==i||t[13]!==p?(h=(0,Y.jsxs)(yb,{"data-slot":`tooltip-content`,className:p,...i,children:[n,m]}),t[11]=n,t[12]=i,t[13]=p,t[14]=h):h=t[14];let g;return t[15]!==d||t[16]!==f||t[17]!==l||t[18]!==u||t[19]!==h?(g=(0,Y.jsx)(hb,{children:(0,Y.jsx)(vb,{align:d,alignOffset:f,side:l,sideOffset:u,className:`isolate z-50`,children:h})}),t[15]=d,t[16]=f,t[17]=l,t[18]=u,t[19]=h,t[20]=g):g=t[20],g}ho(_o(Oo(`AUTH_URL`)),z);function wb(e){return`${new URL(e).origin}/auth/sign-in?${new URLSearchParams({next:e})}`}function Tb(e){return Ie(Jl)(e)&&e.error!==`temporarily_unavailable`&&e.error!==`access_denied`}U()(`@deslop/runtime/auth/lib/utils/CurrentUser`);var Eb=class e extends Vl()(`@deslop/runtime/auth/lib/utils/RpcAuth`,{error:Jl}){static layerClient=t=>Hl(e,e=>mr(function*(){return yield*e.next({...e.request,headers:pa(e.request.headers,`authorization`,`Bearer ${yield*t}`)})}))},Db=class extends te()(`TelemetryError`,{cause:Yt(Jr()),message:T}){},Ob=Nn(T,f(Pa(/^[a-fA-F0-9]{32}$/u))),kb=Nn(T,f(Pa(/^[a-fA-F0-9]{16}$/u))),Ab=Nn(T,f(Pa(/^\d{1,20}$/u))),jb=K({key:T,value:ti}),Mb=jt(K({attributes:W(hi(jb))}),[ti]),Nb=K({attributes:W(hi(jb)),events:W(hi(jt(K({attributes:W(hi(jb)),name:T,timeUnixNano:Ab}),[ti]))),links:W(hi(jt(K({attributes:W(hi(jb)),spanId:kb,traceId:Ob}),[ti])))}),Pb=jt(K({...Nb.fields,endTimeUnixNano:W(Ab),name:W(T),parentSpanId:W(et([kb,Sr(``)])),spanId:kb,startTimeUnixNano:Ab,status:W(jt(K({code:W(cr)}),[ti])),traceId:Ob}),[ti]),Fb=jt(K({attributes:W(hi(jb)),body:W(ti),observedTimeUnixNano:W(Ab),severityNumber:W(cr),severityText:W(T),spanId:W(et([kb,Sr(``)])),timeUnixNano:W(Ab),traceId:W(et([Ob,Sr(``)]))}),[ti]);K({resourceSpans:W(hi(jt(K({resource:W(Mb),schemaUrl:W(T),scopeSpans:W(hi(jt(K({schemaUrl:W(T),scope:W(Mb),spans:W(hi(Pb))}),[ti])))}),[ti])))}),K({resourceLogs:W(hi(jt(K({resource:W(Mb),schemaUrl:W(T),scopeLogs:W(hi(jt(K({logRecords:W(hi(Fb)),schemaUrl:W(T),scope:W(Mb)}),[ti])))}),[ti])))});var Ib=K({durationMs:Yn,id:Oa,name:T,payload:ti,resource:Mb,resourceSchemaUrl:T,scope:Mb,scopeSchemaUrl:T,service:T,signal:hr([`trace`,`log`]),spanId:T,status:cr,time:Ab,traceId:T}).mapFields(cn([`resource`,`resourceSchemaUrl`,`scope`,`scopeSchemaUrl`])),Lb=K({errors:Hi,from:Yn,limit:Nn(cr,f(vt({maximum:1e3,minimum:1}))),offset:Nn(cr,f(vt({maximum:1e5,minimum:0}))),operation:T,runs:hr([`current`,`all`]),service:T,sort:hr([`recent`,`slowest`]),text:T,to:Yn,traceId:T});K({entries:hi(Ib),total:cr});var Rb=hr([`web`,`mobile`,`server`,`unknown`]),zb=K({name:T,runtime:Rb}),Bb=K({...zb.fields,entries:xn,lastEventAt:Ab,runStartedAt:Ab}),Vb=K({count:xn,credential:hr([`authorization`,`cookie`,`none`]),lastAt:Yn,route:hr([`/v1/traces`,`/v1/logs`]),status:cr}),Hb=K({rejections:hi(Vb),services:hi(Bb),since:Yn}),Ub=K({durationMs:Yn,errors:cr,id:Ob,logs:cr,operation:T,service:T,services:hi(zb),spans:cr,time:Ab}),Wb=K({entries:hi(Ub),total:cr});K({count:cr,errors:cr,from:Yn,maxMs:Yn,p50Ms:Yn,p95Ms:Yn,to:Yn});var Gb=K({...Ib.fields,depth:xn,logs:hi(Ib),offsetMs:Yn,parentSpanId:T,runtime:Rb}),Kb=K({durationMs:Yn,id:Ob,logs:hi(Ib),services:hi(zb),spans:hi(Gb)}),qb=K({errors:Nn(Lb.fields.errors,we(Na(!1)),Vr({description:`Only failed spans and error logs.`})),operation:Nn(Lb.fields.operation,we(Na(``)),Vr({description:`Exact span name.`})),runs:Nn(Lb.fields.runs,we(Na(`current`)),Vr({description:`"current" searches the latest process/page load/app launch per service. "all" includes retained earlier runs in the lookback.`})),service:Nn(Lb.fields.service,we(Na(``)),Vr({description:`Exact service name, from list_services.`})),since:Nn(na,f(Lt(Bt,{expected:`a finite duration`})),we(Na(le(10))),Vr({description:`Lookback, such as "10 minutes" or "1 hour".`})),text:Nn(Lb.fields.text,we(Na(``)),Vr({description:`Case-insensitive text in the span name, log message or attributes.`})),traceId:Nn(Lb.fields.traceId,we(Na(``)),Vr({description:`Only entries of this trace.`}))}),Jb=K({...qb.fields,limit:Nn(Lb.fields.limit,we(Na(20)),Vr({description:`Page size, 1 to 1000.`})),offset:Nn(Lb.fields.offset,we(Na(0)),Vr({description:`Entries to skip, for the next page.`}))}),Yb=K({...Jb.fields,sort:Nn(Lb.fields.sort,we(Na(`recent`)),Vr({description:`"recent" puts the newest first, "slowest" the longest first.`}))}),Xb=class extends zl(ln(`scope.services`,{error:et([Jl,Db]),success:Hb}),ln(`scope.traces`,{error:et([Jl,Db]),payload:Yb,success:Wb}),ln(`scope.trace`,{error:et([Jl,Db]),payload:K({id:Ob}),success:Kb})).middleware(Eb){},Zb=class extends Fl()(`@deslop/scope/lib/utils/RpcClient`,{group:Xb,protocol:Ui}){},Qb=ol({errors:!1,service:``}),$b=ol(e=>Zb.query(`scope.traces`,{...e(Qb),limit:100,offset:0,operation:``,runs:`all`,since:ja(3),sort:`recent`,text:``,traceId:``})),ex=ol(e=>{let t=e(e($b));return Us(t)?mt(e.self(),{onNone:()=>t,onSome:e=>Qs(e)}):t}),tx=ol(e=>{let t=e(Qb),n=e(ex),r=Xe(e.self(),e=>e.baseline);if(!Ks(n)||n.waiting)return{arrived:Ln(),baseline:r};let i=_r(n.value.entries,e=>e.id);return{arrived:mt(D(r,e=>e.filters===t),{onNone:()=>Ln(),onSome:e=>Li(i,e.ids)}),baseline:zt({filters:t,ids:i})}}),nx=Zb.query(`scope.services`,void 0),rx=El(e=>Zb.query(`scope.trace`,{id:e})),ix=ol(Aa()),ax=ol(e=>Me(e(ix),t=>{let n=e(rx(t));return Us(n)?mt(c(e.self()),{onNone:()=>n,onSome:e=>Qs(e)}):n}));function ox(e,t){let n=Ia(0,(t-Re(La(Nn(e,Gi(0,-6))),()=>t))/1e3);return n<10?`now`:n<60?`${Ra(n,0)}s`:n<3600?`${Ra(n/60,0)}m`:n<86400?`${Ra(n/3600,0)}h`:`${Ra(n/86400,0)}d`}function sx(e){return Nn(e,Zn(/^@deslop\//u,``),Zn(/-server$/u,``),Zn(/-client$/u,` web`),Zn(/-ios$/u,` iOS`))}function cx(e){return e<1e3?`${Ra(e,0)} ms`:`${Ra(e/1e3,1)} s`}var lx=`/assets/icon-dark-8E7IJN5j.svg`,ux=hi(K({key:T,value:Si})),dx=xa(T,Si);function fx(e){return mt(fa(e.cause),{onNone:()=>(0,Y.jsx)(ni,{error:rt(e.cause),reset:()=>location.reload()}),onSome:e=>Tb(e)?(0,Y.jsx)(ki,{href:wb(location.href)}):(0,Y.jsx)(ni,{error:e,reset:()=>location.reload()})})}function px(){let e=(0,X.c)(23),[t,n]=pu(Qb),r=nc(ac(su(nx),vx),Ln),i=Zy,a;e[0]===t.service?a=e[1]:(a=ri(t.service===``,{onFalse:()=>t.service,onTrue:_x}),e[0]=t.service,e[1]=a);let o;e[2]===a?o=e[3]:(o=[a],e[2]=a,e[3]=o);let s;e[4]!==t||e[5]!==n?(s=e=>mt(_i(e),{onNone:gx,onSome:e=>n({...t,service:ri(e===`all`,{onFalse:()=>e,onTrue:hx})})}),e[4]=t,e[5]=n,e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(Qy,{value:`all`,children:`all`}),e[7]=c):c=e[7];let l=_r(r,mx),u;e[8]!==i||e[9]!==o||e[10]!==s||e[11]!==c||e[12]!==l?(u=(0,Y.jsxs)(i,{size:`sm`,value:o,onValueChange:s,children:[c,l]}),e[8]=i,e[9]=o,e[10]=s,e[11]=c,e[12]=l,e[13]=u):u=e[13];let d;e[14]!==t||e[15]!==n?(d=e=>n({...t,errors:e}),e[14]=t,e[15]=n,e[16]=d):d=e[16];let f;e[17]!==t.errors||e[18]!==d?(f=(0,Y.jsx)(Hy,{size:`sm`,pressed:t.errors,onPressedChange:d,"aria-label":`Only failed traces`,children:`errors`}),e[17]=t.errors,e[18]=d,e[19]=f):f=e[19];let p;return e[20]!==u||e[21]!==f?(p=(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 overflow-x-auto`,children:[u,f]}),e[20]=u,e[21]=f,e[22]=p):p=e[22],p}function mx(e){return(0,Y.jsx)(Qy,{value:e,children:sx(e)},e)}function hx(){return``}function gx(){}function _x(){return`all`}function vx(e){return ui(_r(e.services,yx))}function yx(e){return e.name}function bx(e){let t=(0,X.c)(44),n=e.arrived&&`grow-in`,r;t[0]===n?r=t[1]:(r=Wt(`grid`,n),t[0]=n,t[1]=r);let i;t[2]===e.selected?i=t[3]:(i=ri(e.selected,{onFalse:Sx,onTrue:xx}),t[2]=e.selected,t[3]=i);let a=e.onSelect,o=e.selected,s=e.trace.operation,c;t[4]===e.trace.service?c=t[5]:(c=sx(e.trace.service),t[4]=e.trace.service,t[5]=c);let l;t[6]===e.trace.durationMs?l=t[7]:(l=cx(e.trace.durationMs),t[6]=e.trace.durationMs,t[7]=l);let u=`${s}, ${c}, ${l}`,d;t[8]!==e.onSelect||t[9]!==e.selected||t[10]!==u?(d=(0,Y.jsx)(`button`,{type:`button`,onClick:a,"aria-current":o,"aria-label":u}),t[8]=e.onSelect,t[9]=e.selected,t[10]=u,t[11]=d):d=t[11];let f;t[12]===e.trace.operation?f=t[13]:(f=(0,Y.jsx)(Ay,{children:e.trace.operation}),t[12]=e.trace.operation,t[13]=f);let p;t[14]===e.trace.errors?p=t[15]:(p=e.trace.errors>0&&(0,Y.jsx)(Ly,{status:`error`}),t[14]=e.trace.errors,t[15]=p);let m;t[16]===e.trace.service?m=t[17]:(m=sx(e.trace.service),t[16]=e.trace.service,t[17]=m);let h;t[18]!==p||t[19]!==m?(h=(0,Y.jsxs)(jy,{className:`flex items-center gap-1.5 font-mono`,children:[p,m]}),t[18]=p,t[19]=m,t[20]=h):h=t[20];let g;t[21]!==f||t[22]!==h?(g=(0,Y.jsxs)(ky,{children:[f,h]}),t[21]=f,t[22]=h,t[23]=g):g=t[23];let _;t[24]!==e.now||t[25]!==e.trace.time?(_=ox(e.trace.time,e.now),t[24]=e.now,t[25]=e.trace.time,t[26]=_):_=t[26];let v;t[27]===_?v=t[28]:(v=(0,Y.jsx)(jy,{className:`font-mono`,children:_}),t[27]=_,t[28]=v);let y;t[29]===e.trace.durationMs?y=t[30]:(y=cx(e.trace.durationMs),t[29]=e.trace.durationMs,t[30]=y);let b;t[31]===y?b=t[32]:(b=(0,Y.jsx)(jy,{className:`text-foreground font-mono`,children:y}),t[31]=y,t[32]=b);let x;t[33]!==v||t[34]!==b?(x=(0,Y.jsxs)(ky,{className:`items-end`,children:[v,b]}),t[33]=v,t[34]=b,t[35]=x):x=t[35];let S;t[36]!==g||t[37]!==x||t[38]!==i||t[39]!==d?(S=(0,Y.jsxs)(Ey,{size:`sm`,variant:i,render:d,children:[g,x]}),t[36]=g,t[37]=x,t[38]=i,t[39]=d,t[40]=S):S=t[40];let C;return t[41]!==r||t[42]!==S?(C=(0,Y.jsx)(`div`,{role:`listitem`,className:r,children:S}),t[41]=r,t[42]=S,t[43]=C):C=t[43],C}function xx(){return`muted`}function Sx(){return`default`}function Cx(e){return Nn(ot(dx)(e),Xe(e=>Zi(ia(e))),D(e=>ea(e)||Kr(e)||Bn(e)),mt({onNone:()=>JSON.stringify(e),onSome:e=>`${e}`}))}function wx(e){let t=(0,X.c)(21),n;t[0]===e.span.status?n=t[1]:(n=e.span.status===2&&(0,Y.jsx)(Ly,{status:`error`}),t[0]=e.span.status,t[1]=n);let r=e.span.name,i;t[2]===e.span.durationMs?i=t[3]:(i=cx(e.span.durationMs),t[2]=e.span.durationMs,t[3]=i);let a;t[4]===i?a=t[5]:(a=(0,Y.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs font-normal`,children:i}),t[4]=i,t[5]=a);let o;t[6]!==e.span.name||t[7]!==n||t[8]!==a?(o=(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-medium`,children:[n,r,a]}),t[6]=e.span.name,t[7]=n,t[8]=a,t[9]=o):o=t[9];let s;t[10]!==e.span.payload.attributes||t[11]!==e.span.service?(s=_r([{key:`service`,value:e.span.service},..._r(Re(ot(ux)(e.span.payload.attributes),Ox),Dx)],Ex),t[10]=e.span.payload.attributes,t[11]=e.span.service,t[12]=s):s=t[12];let c;t[13]===s?c=t[14]:(c=(0,Y.jsx)(`dl`,{className:`flex flex-col gap-1 font-mono text-xs`,children:s}),t[13]=s,t[14]=c);let l;t[15]===e.span.logs?l=t[16]:(l=rr(e.span.logs)&&(0,Y.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-xs`,children:_r(e.span.logs,Tx)}),t[15]=e.span.logs,t[16]=l);let u;return t[17]!==o||t[18]!==c||t[19]!==l?(u=(0,Y.jsxs)(`section`,{className:`border-border flex flex-col gap-2 border-t pt-3`,"aria-label":`Span`,children:[o,c,l]}),t[17]=o,t[18]=c,t[19]=l,t[20]=u):u=t[20],u}function Tx(e){return(0,Y.jsx)(`li`,{className:Wt(`break-words select-text`,e.status===2&&`text-destructive`),children:e.name},e.id)}function Ex(e){return(0,Y.jsxs)(`div`,{className:`flex gap-4`,children:[(0,Y.jsx)(`dt`,{className:`text-muted-foreground w-40 shrink-0 truncate`,children:e.key}),(0,Y.jsx)(`dd`,{className:`min-w-0 break-all select-text`,children:e.value})]},e.key)}function Dx(e){return{key:e.key,value:Cx(e.value)}}function Ox(){return[]}function kx(e){let t=(0,X.c)(10),n=e.span.status===2&&`bg-destructive`,r=e.span.status!==2&&e.span.depth===0&&`bg-foreground`,i=e.span.status!==2&&e.span.depth>0&&`bg-muted-foreground/60`,a;t[0]!==n||t[1]!==r||t[2]!==i?(a=Wt(`absolute top-0 left-(--offset) h-2.5 w-(--length) min-w-0.5 rounded-sm`,n,r,i),t[0]=n,t[1]=r,t[2]=i,t[3]=a):a=t[3];let o=`calc(${e.span.durationMs} / var(--trace-total) * 100%)`,s=`calc(${e.span.offsetMs} / var(--trace-total) * 100%)`,c;t[4]!==o||t[5]!==s?(c={"--length":o,"--offset":s},t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,Y.jsx)(`span`,{className:`relative h-2.5 flex-1`,children:(0,Y.jsx)(`span`,{className:a,style:c})}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function Ax(e){let t=(0,X.c)(40),[n,r]=(0,J.useState)(),i;if(t[0]!==n||t[1]!==e.trace.durationMs||t[2]!==e.trace.id||t[3]!==e.trace.spans){let a;t[5]===n?a=t[6]:(a=e=>e.spanId===n,t[5]=n,t[6]=a);let o;t[7]===e.trace.spans?o=t[8]:(o=()=>Ur(e.trace.spans,Lx),t[7]=e.trace.spans,t[8]=o);let s;t[9]===e.trace.spans?s=t[10]:(s=()=>Zi(e.trace.spans),t[9]=e.trace.spans,t[10]=s);let c=Nn(Ur(e.trace.spans,a),m(o),m(s)),l;if(t[11]!==e.trace.id||t[12]!==e.trace.spans){let n;t[14]===e.trace.id?n=t[15]:(n=()=>e.trace.id,t[14]=e.trace.id,t[15]=n),l=mt(Zi(e.trace.spans),{onNone:n,onSome:Ix}),t[11]=e.trace.id,t[12]=e.trace.spans,t[13]=l}else l=t[13];let u;t[16]===l?u=t[17]:(u=(0,Y.jsx)(`h2`,{className:`truncate text-base font-semibold`,children:l}),t[16]=l,t[17]=u);let d;t[18]===e.trace.durationMs?d=t[19]:(d=cx(e.trace.durationMs),t[18]=e.trace.durationMs,t[19]=d);let f;t[20]===d?f=t[21]:(f=(0,Y.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:d}),t[20]=d,t[21]=f);let p;t[22]!==u||t[23]!==f?(p=(0,Y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[u,f]}),t[22]=u,t[23]=f,t[24]=p):p=t[24];let h;t[25]===e.trace.id?h=t[26]:(h=Nn(e.trace.id,Gi(0,8)),t[25]=e.trace.id,t[26]=h);let g=e.trace.spans.length,_;t[27]===e.trace.spans?_=t[28]:(_=Cn(e.trace.spans,Fx),t[27]=e.trace.spans,t[28]=_);let v;t[29]!==e.trace.spans.length||t[30]!==_||t[31]!==h?(v=(0,Y.jsxs)(`p`,{className:`text-muted-foreground font-mono text-xs`,children:[`trace `,h,` · `,g,` spans ·`,` `,_,` errors`]}),t[29]=e.trace.spans.length,t[30]=_,t[31]=h,t[32]=v):v=t[32];let y;t[33]!==v||t[34]!==p?(y=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[p,v]}),t[33]=v,t[34]=p,t[35]=y):y=t[35];let b;t[36]===e.trace.durationMs?b=t[37]:(b=Ia(e.trace.durationMs,1),t[36]=e.trace.durationMs,t[37]=b);let x=`${b}`,S;t[38]===x?S=t[39]:(S={"--trace-total":x},t[38]=x,t[39]=S),i=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[y,(0,Y.jsx)(`ol`,{className:`trace-axis flex flex-col`,style:S,children:_r(e.trace.spans,e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(Ii,{variant:ri(P(c,t=>t.spanId===e.spanId),{onFalse:Px,onTrue:Nx}),onClick:()=>r(e.spanId),className:`w-full gap-3 px-1 font-normal`,children:[(0,Y.jsx)(`span`,{className:`w-48 shrink-0 truncate pl-(--indent) text-left`,style:{"--indent":`${e.depth*12}px`},children:e.name}),(0,Y.jsx)(kx,{span:e}),(0,Y.jsx)(`span`,{className:`text-muted-foreground w-16 shrink-0 text-right font-mono`,children:cx(e.durationMs)})]})},e.spanId))}),mt(c,{onNone:Mx,onSome:jx})]}),t[0]=n,t[1]=e.trace.durationMs,t[2]=e.trace.id,t[3]=e.trace.spans,t[4]=i}else i=t[4];return i}function jx(e){return(0,Y.jsx)(wx,{span:e})}function Mx(){return null}function Nx(){return`secondary`}function Px(){return`ghost`}function Fx(e){return e.status===2}function Ix(e){return e.name}function Lx(e){return e.status===2}function Rx(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsxs)(`div`,{"aria-busy":`true`,"aria-label":`Trace`,role:`status`,className:`flex flex-col gap-3`,children:[(0,Y.jsx)(My,{className:`h-6 w-2/3`}),(0,Y.jsx)(My,{className:`h-4 w-1/3`}),_r(gn(1,5),zx)]}),e[0]=t):t=e[0],t}function zx(e){return(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(My,{className:`h-4 w-32`}),(0,Y.jsx)(My,{className:`h-3 flex-1`})]},e)}function Bx(){let e=(0,X.c)(2),t=du(ix),n;return e[0]===t?n=e[1]:(n=e=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(Ii,{variant:`ghost`,size:`sm`,className:`mb-2 -ml-2 md:hidden`,onClick:()=>t(Aa()),children:[(0,Y.jsx)(Wl,{}),`Traces`]}),oc(e,{onFailure:Ux,onInitial:Hx,onSuccess:Vx})]}),e[0]=t,e[1]=n),mt(su(ax),{onNone:Wx,onSome:n})}function Vx(e){return(0,Y.jsx)(`div`,{"aria-busy":e.waiting,className:Wt(`transition-opacity duration-150`,e.waiting&&`opacity-50`),children:(0,Y.jsx)(Ax,{trace:e.value})})}function Hx(){return(0,Y.jsx)(Rx,{})}function Ux(e){return(0,Y.jsx)(fx,{cause:e.cause})}function Wx(){return(0,Y.jsx)(Cr,{children:(0,Y.jsx)(Sn,{children:(0,Y.jsx)(li,{children:`No trace picked`})})})}function Gx(e){let t=(0,X.c)(19),n=su(ix),r;t[0]===n?r=t[1]:(r=Wt(`border-border pb-safe min-h-0 flex-1 overflow-y-auto md:w-80 md:flex-none md:border-r`,me(n)&&`hidden md:block`),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(px,{}),t[2]=i):i=t[2];let a;t[3]===e.waiting?a=t[4]:(a=e.waiting&&(0,Y.jsx)(Ly,{waiting:!0}),t[3]=e.waiting,t[4]=a);let o;t[5]===a?o=t[6]:(o=(0,Y.jsxs)(`div`,{className:`border-border bg-background sticky top-0 z-10 flex items-center gap-2 border-b px-2 py-1.5`,children:[i,a]}),t[5]=a,t[6]=o);let s;t[7]!==e.children||t[8]!==r||t[9]!==o?(s=(0,Y.jsxs)(`nav`,{className:r,"aria-label":`Traces`,children:[o,e.children]}),t[7]=e.children,t[8]=r,t[9]=o,t[10]=s):s=t[10];let c;t[11]===n?c=t[12]:(c=Wt(`pb-safe min-h-0 flex-1 overflow-y-auto px-4 pt-4 md:block md:px-6`,z(n)&&`hidden`),t[11]=n,t[12]=c);let l;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(Bx,{}),t[13]=l):l=t[13];let u;t[14]===c?u=t[15]:(u=(0,Y.jsx)(`main`,{className:c,children:l}),t[14]=c,t[15]=u);let d;return t[16]!==s||t[17]!==u?(d=(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col md:flex-row`,children:[s,u]}),t[16]=s,t[17]=u,t[18]=d):d=t[18],d}function Kx(){let e=(0,X.c)(16),[t,n]=pu(ix),r=su(tx).arrived,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=Qe(k()),e[0]=i):i=e[0];let a=i,o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o={includeFailure:!0},e[1]=o):o=e[1];let s=_u(ex,o);if(Js(s)){let t;return e[2]===s.cause?t=e[3]:(t=(0,Y.jsx)(fx,{cause:s.cause}),e[2]=s.cause,e[3]=t),t}let c=s.waiting,l;if(e[4]!==r||e[5]!==s.value.entries||e[6]!==t||e[7]!==n){let i;e[9]!==r||e[10]!==t||e[11]!==n?(i=e=>(0,Y.jsx)(Ny,{label:`Recent traces`,children:_r(e,e=>(0,Y.jsx)(bx,{arrived:wr(r,e.id),now:a,onSelect:()=>n(zt(e.id)),selected:Et(t,e.id),trace:e},e.id))}),e[9]=r,e[10]=t,e[11]=n,e[12]=i):i=e[12],l=ur(s.value.entries,{onEmpty:qx,onNonEmpty:i}),e[4]=r,e[5]=s.value.entries,e[6]=t,e[7]=n,e[8]=l}else l=e[8];let u;return e[13]!==s.waiting||e[14]!==l?(u=(0,Y.jsx)(Gx,{waiting:c,children:l}),e[13]=s.waiting,e[14]=l,e[15]=u):u=e[15],u}function qx(){return(0,Y.jsx)(Cr,{children:(0,Y.jsx)(Sn,{children:(0,Y.jsx)(li,{children:`No traces match`})})})}function Jx(){let e=(0,X.c)(8),t=fu(su($b)),n;e[0]===t?n=e[1]:(n=(0,Y.jsx)(Ii,{variant:`ghost`,size:`icon-sm`,"aria-label":`Refresh traces`,onClick:t}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsx)(Kl,{}),e[2]=r):r=e[2];let i;e[3]===n?i=e[4]:(i=(0,Y.jsx)(Sb,{render:n,children:r}),e[3]=n,e[4]=i);let a;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(Cb,{children:`Refresh traces`}),e[5]=a):a=e[5];let o;return e[6]===i?o=e[7]:(o=(0,Y.jsxs)(xb,{children:[i,a]}),e[6]=i,e[7]=o),o}function Yx(){let e=(0,X.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(by,{icon:lx,name:`scope`,children:(0,Y.jsx)(Jx,{})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsxs)(Y.Fragment,{children:[t,(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Gx,{waiting:!1,children:(0,Y.jsx)(Fy,{label:`Recent traces`,rows:8})}),children:(0,Y.jsx)(Kx,{})})]}),e[1]=n):n=e[1],n}export{Yx as component};
|