@openartifactsai/cli 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +23 -6
- package/package.json +1 -1
- package/vendor/CHANGELOG.md +1116 -0
- package/vendor/artifact-types/docs/SKILL.md +7 -5
- package/vendor/artifact-types/page/SKILL.md +3 -1
- package/vendor/artifact-types/page/artifact-type/reference/capabilities.d.ts +0 -1
- package/vendor/artifact-types/page/artifact-type/reference/capabilities.md +1 -1
- package/vendor/frame-host/client/comments.js +20 -25
- package/vendor/frame-host/client/page.js +1363 -0
- package/vendor/frame-host/client/review.js +279 -0
- package/vendor/frame-host/client/runtime.js +8 -6
- package/vendor/frame-host/client/sample.js +1 -1
- package/vendor/frame-host/client/shell.css +1 -0
- package/vendor/frame-host/client/shell.js +207 -6
- package/vendor/frame-host/client/translate.js +375 -0
- package/vendor/frame-host/frame-host.mjs +193 -32
- package/vendor/home/assets/{browser-models-DWkPVHmp.js → browser-models-CNChpEzB.js} +4 -4
- package/vendor/home/assets/library-DAVNFZ4g.js +1 -0
- package/vendor/home/assets/main-C7DAdnKi.js +32 -0
- package/vendor/home/assets/main-Cduee5v6.css +1 -0
- package/vendor/home/assets/node.browser-BX90gLvV.js +1 -0
- package/vendor/home/assets/node.browser-BltE9Vxw.js +1 -0
- package/vendor/home/assets/tokens-B6Dchhk5.js +572 -0
- package/vendor/home/index.html +3 -3
- package/vendor/home/library/index.html +2 -2
- package/vendor/open-artifacts.mjs +11128 -3829
- package/vendor/runtime.json +1 -1
- package/vendor/shell/assets/{browser-models-BzwWAVuE.js → browser-models-DEdnh4xg.js} +4 -4
- package/vendor/shell/assets/index-BbQPECay.js +47 -0
- package/vendor/shell/assets/index-Cduee5v6.css +1 -0
- package/vendor/shell/assets/{node.browser-BvryIsl7.js → node.browser-CzAEKnJQ.js} +1 -1
- package/vendor/shell/assets/{node.browser-BgqLTfql.js → node.browser-Dt1frvjW.js} +1 -1
- package/vendor/shell/index.html +2 -2
- package/vendor/type-server/cli.mjs +217 -34
- package/vendor/type-server/editors/data/assets/{index-CX_sn7ZZ.js → index-M7l6GYrQ.js} +6 -11
- package/vendor/type-server/editors/data/index.html +1 -1
- package/vendor/type-server/editors/design/assets/{index-BpNUmTVD.js → index-D3IExhNM.js} +79 -84
- package/vendor/type-server/editors/design/index.html +1 -1
- package/vendor/type-server/editors/design-system/assets/{index-CP6AEO1P.js → index-DdgIQkBN.js} +8 -13
- package/vendor/type-server/editors/design-system/index.html +1 -1
- package/vendor/type-server/editors/docs/assets/{abnfDiagram-WEYOIA3C-Do25i7oS.js → abnfDiagram-WEYOIA3C-DYZ28wZy.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{architectureDiagram-ZHVYKT53-BLlpboc2.js → architectureDiagram-ZHVYKT53-BlNOisCb.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{blockDiagram-RJAE7QA3-D0rO5p7M.js → blockDiagram-RJAE7QA3-CQVhlYNw.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{c4Diagram-XDPPPE54-OoTiysJI.js → c4Diagram-XDPPPE54-CGbpwSFn.js} +1 -1
- package/vendor/type-server/editors/docs/assets/channel-7ZHbNf0E.js +1 -0
- package/vendor/type-server/editors/docs/assets/{chunk-2E7WHVMD-yBl5BEaI.js → chunk-2E7WHVMD-CeCe17xo.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{chunk-2Q5K7J3B-DHKM5gd6.js → chunk-2Q5K7J3B-CzZ2Xznn.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{chunk-4EMNKR2T-B-f8WPM6.js → chunk-4EMNKR2T-CNzxjPBJ.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{chunk-55XCU76K-n8RDJr36.js → chunk-55XCU76K-CfB8c3Md.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{chunk-5VM5RSS4-DzLzcqXE.js → chunk-5VM5RSS4-DzQqctZp.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{chunk-JWPE2WC7-BLXkUVcK.js → chunk-JWPE2WC7-BOlMn2TP.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{chunk-VQ5W62QI-DAGNVD29.js → chunk-VQ5W62QI-DeIWF9s3.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{chunk-XXDRQBXY-fgVyAbWV.js → chunk-XXDRQBXY-DafVeBuV.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{chunk-ZCHMQSOR-D90xHR9n.js → chunk-ZCHMQSOR-Ck41oHN3.js} +2 -2
- package/vendor/type-server/editors/docs/assets/{classDiagram-v2-4MYWR3UA-uk1mPogR.js → classDiagram-v2-4MYWR3UA-Cplz4GWc.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{core-BMv5rGOd.js → core-BjihJIUD.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{cose-bilkent-JH36ORCC-BJdqW8l3.js → cose-bilkent-JH36ORCC-DWdy6m2J.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{cynefin-EF2NZ3EQ-BCce_ZhK.js → cynefin-EF2NZ3EQ-Dj_QahA-.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{cynefinDiagram-WF24UDRP-DxD-4yjR.js → cynefinDiagram-WF24UDRP-CsxxQbyD.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{dagre-NK4GIZVX-B3VAS51Y.js → dagre-NK4GIZVX-NEPrnyXL.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{diagram-CBK3MWTC-B0kHeUdr.js → diagram-CBK3MWTC-Pg1cO5IF.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{diagram-I5XIIV2D-BCRvsLAu.js → diagram-I5XIIV2D-CPc4fLeT.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{diagram-ODIL2UCW-DFOTsSuA.js → diagram-ODIL2UCW-BFAo5sAk.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{diagram-PFBEJUXE-_DT3jk0i.js → diagram-PFBEJUXE-ueA4BuBI.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{diagram-RJA3I4VV-UFrdnTgs.js → diagram-RJA3I4VV-B8Qh64n3.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{diagram-TYUNFSNR-DrbWyZOX.js → diagram-TYUNFSNR-udgAkDbB.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{ebnfDiagram-V4P3TTPT-M-DCWgZM.js → ebnfDiagram-V4P3TTPT-DNNGufNH.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{elk-QONTBCTQ-l6XmbRQj.js → elk-QONTBCTQ-fAnGl2cK.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{erDiagram-KYQIGQAA-CHqbnmEE.js → erDiagram-KYQIGQAA-C2mbNrl5.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{flowDiagram-IUGLLWBU-BzkFyGCL.js → flowDiagram-IUGLLWBU-D7L47nKm.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{ganttDiagram-R7GPNTJY-BcNaSXNv.js → ganttDiagram-R7GPNTJY-CovbGSkl.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{gitGraphDiagram-PDYL7XHY-JaNdSZbv.js → gitGraphDiagram-PDYL7XHY-C6EQlzk2.js} +1 -1
- package/vendor/type-server/editors/docs/assets/index-BvPuZVZu.js +87 -0
- package/vendor/type-server/editors/docs/assets/index-QPklhVMX.css +1 -0
- package/vendor/type-server/editors/docs/assets/{infoDiagram-MVDRKAX5-Cl2Q_Ylf.js → infoDiagram-MVDRKAX5-Bs-D7mTo.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{ishikawaDiagram-HPEHV2GE-umirqIpN.js → ishikawaDiagram-HPEHV2GE-D__AsXXu.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{journeyDiagram-BOSHW7O7-HMtvkXvq.js → journeyDiagram-BOSHW7O7-C_6yyXoB.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{kanban-definition-FNSA4HC5-CYouTBUM.js → kanban-definition-FNSA4HC5-BYfemxGS.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{mermaid.core-BEcbgpI8.js → mermaid.core-DFabEkrU.js} +4 -4
- package/vendor/type-server/editors/docs/assets/{mindmap-definition-6OY57UG3-BnwugHtV.js → mindmap-definition-6OY57UG3-BnLoWczF.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{pegDiagram-ECIUJNBX-DqT6jxo7.js → pegDiagram-ECIUJNBX-eT3tDxZi.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{pieDiagram-GNMPY74T-CBKjnr1W.js → pieDiagram-GNMPY74T-DpwWxanm.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{quadrantDiagram-D57K4MC3-CdTG11Ff.js → quadrantDiagram-D57K4MC3-CASaoK3Z.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{railroadDiagram-Y72NRBL7-BZgG8r2y.js → railroadDiagram-Y72NRBL7-CgI3O5bH.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{requirementDiagram-EQYSW5RA-CutdnAmY.js → requirementDiagram-EQYSW5RA-Bxj0Eaeh.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{sankeyDiagram-SY24JHO5-DBaoPDhR.js → sankeyDiagram-SY24JHO5-BxSCdedw.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{sequenceDiagram-BLEHNHQU-B6YZp-Wu.js → sequenceDiagram-BLEHNHQU-DkF2KRDu.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{sizeCapture-INFHLROL-xATlK6Zl.js → sizeCapture-INFHLROL-cEjHrAFu.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{stateDiagram-v2-A6IESKWZ-C7BND5vv.js → stateDiagram-v2-A6IESKWZ-mbWVZCn4.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{swimlanes-B3ENRKFQ-WYLzM6hb.js → swimlanes-B3ENRKFQ-oOsIo2dg.js} +1 -1
- package/vendor/type-server/editors/docs/assets/swimlanesDiagram-AYQRV4AK-CzluHeRp.js +8 -0
- package/vendor/type-server/editors/docs/assets/{timeline-definition-JXYKGLGB-BXC0F4xE.js → timeline-definition-JXYKGLGB-CiHqWceA.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{usecaseDiagram-WPOLBNNX-Cx58jkEj.js → usecaseDiagram-WPOLBNNX-BJmiiDPK.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{vennDiagram-Q3Y3IDCW-DhdwpApW.js → vennDiagram-Q3Y3IDCW-VoyQedKk.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{wardleyDiagram-IVAIDKWA-CBdbPWVr.js → wardleyDiagram-IVAIDKWA-CZ-NZ6bq.js} +1 -1
- package/vendor/type-server/editors/docs/assets/{xychartDiagram-4URNHDU4-Cb0tcPqs.js → xychartDiagram-4URNHDU4-0-P15J94.js} +1 -1
- package/vendor/type-server/editors/docs/index.html +2 -2
- package/vendor/type-server/editors/motion/assets/{gif-jobs-Bq4rwLBV.js → gif-jobs-BJFbhQfZ.js} +1 -1
- package/vendor/type-server/editors/motion/assets/{index-BDOqtmcc.js → index-bQ-JgltP.js} +20 -25
- package/vendor/type-server/editors/motion/assets/{src-8SKXU1IY.js → src-BJ9yQZbU.js} +1 -1
- package/vendor/type-server/editors/motion/index.html +1 -1
- package/vendor/type-server/editors/sheets/assets/{index-BY38EAff.js → index-BOzYyyQN.js} +10 -15
- package/vendor/type-server/editors/sheets/assets/{workbook-worker-CRtLrZhP.js → workbook-worker-7n7WEEgt.js} +4 -9
- package/vendor/type-server/editors/sheets/index.html +1 -1
- package/vendor/type-server/editors/slides/assets/{index-B51oMclO.js → index-ClAq-wit.js} +10 -15
- package/vendor/type-server/editors/slides/assets/{src-CdsEFSuC.js → src-BizehBWa.js} +1 -1
- package/vendor/type-server/editors/slides/index.html +1 -1
- package/vendor/type-server/editors/whiteboard/assets/{drawing-look-worker-Dd2iYbXC.js → drawing-look-worker-DY5ZQpAe.js} +5 -10
- package/vendor/type-server/editors/whiteboard/assets/{gif-jobs-DmIqT6gk.js → gif-jobs-DM6GuLRR.js} +1 -1
- package/vendor/type-server/editors/whiteboard/assets/{index-CTf9pd4S.js → index-BJfZV8fQ.js} +9 -14
- package/vendor/type-server/editors/whiteboard/assets/{index-B3oRKavi.js → index-DXRE64I0.js} +2 -2
- package/vendor/type-server/editors/whiteboard/index.html +1 -1
- package/vendor/type-server/shell/assets/{browser-models-BzwWAVuE.js → browser-models-DEdnh4xg.js} +4 -4
- package/vendor/type-server/shell/assets/index-BbQPECay.js +47 -0
- package/vendor/type-server/shell/assets/index-Cduee5v6.css +1 -0
- package/vendor/type-server/shell/assets/{node.browser-BvryIsl7.js → node.browser-CzAEKnJQ.js} +1 -1
- package/vendor/type-server/shell/assets/{node.browser-BgqLTfql.js → node.browser-Dt1frvjW.js} +1 -1
- package/vendor/type-server/shell/index.html +2 -2
- package/vendor/home/assets/RuntimeUpdate-BwvJ9sYp.js +0 -43
- package/vendor/home/assets/library-CyeaNaQo.js +0 -226
- package/vendor/home/assets/main-DUyobyFI.js +0 -5
- package/vendor/home/assets/main-DXpv3z2x.css +0 -1
- package/vendor/home/assets/node.browser-Cy4GM7Yl.js +0 -1
- package/vendor/home/assets/node.browser-nUfHL25Z.js +0 -1
- package/vendor/shell/assets/index-BIHLxOO6.js +0 -52
- package/vendor/shell/assets/index-DXpv3z2x.css +0 -1
- package/vendor/type-server/editors/docs/assets/channel-Cgat34ii.js +0 -1
- package/vendor/type-server/editors/docs/assets/index-BMNUnwXE.js +0 -92
- package/vendor/type-server/editors/docs/assets/index-DHqOb_n-.css +0 -1
- package/vendor/type-server/editors/docs/assets/swimlanesDiagram-AYQRV4AK-Bwh1tnzE.js +0 -8
- package/vendor/type-server/shell/assets/index-BIHLxOO6.js +0 -52
- package/vendor/type-server/shell/assets/index-DXpv3z2x.css +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-models-CNChpEzB.js","assets/tokens-B6Dchhk5.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as l,j as f,R as ku,a as Pu,b as ia,s as aa,A as Mn,c as Ou,S as $o,l as xo,t as Iu,d as Mu,e as tt,f as k,g as Au,w as jr,h as Nu,i as ju,k as Du,m as Lu,n as Dr,o as Fu,p as _u,L as ct,q as ca,u as Hu,v as Bu,x as $u,y as $s,z as zu,B as Wu,C as Uu,D as Ku,E as Vu,F as la,G as Lr,H as gt,I as Bt,J as $e,K as yr,M as Yu,N as Gu,O as Xu,P as qu,Q as Zu,T as Ju,U as Qu,V as ed,W as td,X as nd,Y as od,Z as rd,_ as sd,$ as id,a0 as ad,a1 as cd}from"./tokens-B6Dchhk5.js";class ld extends Error{code;fix;status;current;constructor(t,n,o={}){super(n),this.name="OpenArtifactsError",this.code=t,o.fix!==void 0&&(this.fix=o.fix),o.status!==void 0&&(this.status=o.status),o.current!==void 0&&(this.current=o.current)}toJSON(){return{code:this.code,message:this.message,...this.fix?{fix:this.fix}:{},...this.current!==void 0?{current:this.current}:{}}}}const ud="application/zip";function ua(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=ua(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function dd(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=ua(e))&&(o&&(o+=" "),o+=t);return o}function Ae(...e){return dd(e)}const zs={};function ze(e,t){const n=l.useRef(zs);return n.current===zs&&(n.current=e(t)),n}const xr=[];let br;function fd(){return br}function pd(e){xr.push(e)}function bo(e){const t=(n,o)=>{const r=ze(hd).current;let s;try{br=r;for(const i of xr)i.before(r);s=e(n,o);for(const i of xr)i.after(r);r.didInitialize=!0}finally{br=void 0}return s};return t.displayName=e.displayName||e.name,t}function da(e){return l.forwardRef(bo(e))}function hd(){return{didInitialize:!1}}function Fr(){}const bn=Object.freeze([]),je=Object.freeze({}),gd=()=>{},J=typeof document<"u"?l.useLayoutEffect:gd;function md(e,t){return function(o,...r){const s=new URL(e);return s.searchParams.set("code",o.toString()),r.forEach(i=>s.searchParams.append("args[]",i)),`${t} error #${o}; visit ${s} for the full message.`}}const Ye=md("https://base-ui.com/production-error","Base UI"),fa=l.createContext(void 0);function vo(e){const t=l.useContext(fa);if(t===void 0&&!e)throw new Error(Ye(72));return t}function wo(e){l.useEffect(e,bn)}const dn=0;class Ze{static create(){return new Ze}currentId=dn;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=dn,n()},t)}isStarted(){return this.currentId!==dn}clear=()=>{this.currentId!==dn&&(clearTimeout(this.currentId),this.currentId=dn)};disposeEffect=()=>this.clear}function We(){const e=ze(Ze.create).current;return wo(e.disposeEffect),e}function yd(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:xd,platform:bd,maxTouchPoints:vd}=yd(),So=xd.toLowerCase(),vn=bd.toLowerCase(),To=/^i(os$|p)/.test(vn)||vn==="macintel"&&vd>1,Ws="android",vr=vn===Ws||So.includes(Ws),_r=!To&&vn.startsWith("mac");vn.startsWith("win");const wd=_r||To,Dt=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!Dt&&So.includes("firefox");!Dt&&So.includes("chrom");const Sd=wd,Hr=/jsdom|happydom/.test(So);function pt(e){e.preventDefault(),e.stopPropagation()}function Td(e){return"nativeEvent"in e}function Br(e){return e.pointerType===""&&e.isTrusted?!0:vr&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function $r(e){return Hr?!1:!vr&&e.width===0&&e.height===0||vr&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function At(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Ed(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Eo(){return typeof window<"u"}function Be(e){return zr(e)?(e.nodeName||"").toLowerCase():"#document"}function Ie(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ct(e){var t;return(t=(zr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zr(e){return Eo()?e instanceof Node||e instanceof Ie(e).Node:!1}function we(e){return Eo()?e instanceof Element||e instanceof Ie(e).Element:!1}function Pe(e){return Eo()?e instanceof HTMLElement||e instanceof Ie(e).HTMLElement:!1}function en(e){return!Eo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ie(e).ShadowRoot}function An(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Je(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function Rd(e){return/^(table|td|th)$/.test(Be(e))}function Ro(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Cd=/transform|translate|scale|rotate|perspective|filter/,kd=/paint|layout|strict|content/,Ft=e=>!!e&&e!=="none";let zo;function Wr(e){const t=we(e)?Je(e):e;return Ft(t.transform)||Ft(t.translate)||Ft(t.scale)||Ft(t.rotate)||Ft(t.perspective)||!Ur()&&(Ft(t.backdropFilter)||Ft(t.filter))||Cd.test(t.willChange||"")||kd.test(t.contain||"")}function Pd(e){let t=Tt(e);for(;Pe(t)&&!xt(t);){if(Wr(t))return t;if(Ro(t))return null;t=Tt(t)}return null}function Ur(){return zo==null&&(zo=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),zo}function xt(e){return/^(html|body|#document)$/.test(Be(e))}function Je(e){return Ie(e).getComputedStyle(e)}function Co(e){return we(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Tt(e){if(Be(e)==="html")return e;const t=e.assignedSlot||e.parentNode||en(e)&&e.host||Ct(e);return en(t)?t.host:t}function pa(e){const t=Tt(e);return xt(t)?(e.ownerDocument||e).body:Pe(t)&&An(t)?t:pa(t)}function wn(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=pa(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),i=Ie(r);if(s){const a=wr(i);return t.concat(i,i.visualViewport||[],An(r)?r:[],a&&n?wn(a):[])}else return t.concat(r,wn(r,[],n))}function wr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function _e(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function se(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&en(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Ne(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const Sr="data-base-ui-focusable",ha="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",ko="ArrowLeft",Po="ArrowRight",ga="ArrowUp",Kr="ArrowDown",ma="data-starting-style",Od="data-ending-style",Id={[ma]:""},Md={[Od]:""},Vr={transitionStatus(e){return e==="starting"?Id:e==="ending"?Md:null}},Ad="data-open",Nd="data-closed",jd="data-anchor-hidden",ya="data-popup-open",Dd="data-pressed",Ld={[ya]:""},Fd={[ya]:"",[Dd]:""},_d={[Ad]:""},Hd={[Nd]:""},Bd={[jd]:""},$d={open(e){return e?Ld:null}},Us={open(e){return e?Fd:null}},Yr={open(e){return e?_d:Hd},anchorHidden(e){return e?Bd:null}},Gr={...Yr,...Vr},Tr="data-trigger-disabled";function ro(e,t){if(!we(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute(Tr);for(const[,o]of t.entries())if(se(o,n))return!o.hasAttribute(Tr);return!1}function Wo(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function zd(e){return e.matches("html,body")}function Oo(e){return Pe(e)&&e.matches(ha)}function Wd(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${ha}`)!=null}function Er(e){return e?e.getAttribute("role")==="combobox"&&Oo(e):!1}function so(e){if(!e||Hr)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Rr(e){return e?e.hasAttribute(Sr)?e:e.querySelector(`[${Sr}]`)||e:null}function Ud(e,t){return t!=null&&!At(t)?0:typeof e=="function"?e():e}function $t(e,t,n){const o=Ud(e,n);return typeof o=="number"?o:o?.[t]}function Ks(e){return typeof e=="function"?e():e}function xa(e,t){return t||e==="click"||e==="mousedown"}function Kd(e){return e?.includes("mouse")&&e!=="mousedown"}const Xr="none",sn="trigger-press",He="trigger-hover",Zt="trigger-focus",qr="outside-press",ba="item-press",Vd="close-press",tn="focus-out",Io="escape-key",Cr="list-navigation",Yd="cancel-open",gn="sibling-open",Gd="disabled",Zr="imperative-action";function Se(e,t,n,o){let r=!1,s=!1;const i=je;return{reason:e,event:t??new Event("base-ui"),cancel(){r=!0},allowPropagation(){s=!0},get isCanceled(){return r},get isPropagationAllowed(){return s},trigger:n,...i}}const va=l.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Ze,currentIdRef:{current:null},currentContextRef:{current:null}});function Xd(e,t){e.current=t.current}function qd(e){const{children:t,delay:n,timeoutMs:o=0}=e,r=l.useRef(n),s=l.useRef(n),i=l.useRef(null),a=l.useRef(null),c=We();return J(()=>{if(s.current=n,!i.current){r.current=n;return}r.current={open:$t(r.current,"open"),close:$t(n,"close")}},[n,i,r,s]),f.jsx(va.Provider,{value:l.useMemo(()=>({hasProvider:!0,delayRef:r,initialDelayRef:s,currentIdRef:i,timeoutMs:o,currentContextRef:a,timeout:c}),[o,c]),children:t})}function Zd(e,t={open:!1}){const{open:n}=t,o="rootStore"in e?e.rootStore:e,r=o.useState("floatingId"),s=l.useContext(va),{currentIdRef:i,delayRef:a,timeoutMs:c,initialDelayRef:u,currentContextRef:d,hasProvider:h,timeout:p}=s,[m,g]=l.useState(!1),x=l.useRef(n);return J(()=>{x.current=n},[n]),J(()=>{function y(){d.current?.setIsInstantPhase(!1),i.current=null,d.current=null,a.current=u.current,p.clear()}if(i.current&&!n&&i.current===r){if(g(!1),c){const v=r;return p.start(c,()=>{o.select("open")||i.current&&i.current!==v||y()}),()=>{(x.current||i.current!==v)&&p.clear()}}y()}},[n,r,i,a,c,u,d,p,o]),J(()=>{if(!n)return;const y=d.current,v=i.current;p.clear(),d.current={onOpenChange:o.setOpen,setIsInstantPhase:g},i.current=r,a.current={open:0,close:$t(u.current,"close")},v!==null&&v!==r?(g(!0),y?.setIsInstantPhase(!0),y?.onOpenChange(!1,Se(Xr))):(g(!1),y?.setIsInstantPhase(!1))},[n,r,o,i,a,u,d,p]),J(()=>()=>{if(i.current===r){if(d.current=null,!x.current)return;i.current=null,Xd(a,u),p.clear()}},[d,i,a,r,u,p]),l.useMemo(()=>({activeIdRef:i,hasProvider:h,delayRef:a,isInstantPhase:m}),[i,h,a,m])}function me(e,t,n,o){return e.addEventListener(t,n,o),()=>{e.removeEventListener(t,n,o)}}function lt(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function nn(e,t,n,o){const r=ze(wa).current;return Qd(r,e,t,n,o)&&Sa(r,[e,t,n,o]),r.callback}function Jd(e){const t=ze(wa).current;return ef(t,e)&&Sa(t,e),t.callback}function wa(){return{callback:null,cleanup:null,refs:[]}}function Qd(e,t,n,o,r){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==o||e.refs[3]!==r}function ef(e,t){return e.refs.length!==t.length||e.refs.some((n,o)=>n!==t[o])}function Sa(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const o=Array(t.length).fill(null);for(let r=0;r<t.length;r+=1){const s=t[r];if(s!=null)switch(typeof s){case"function":{const i=s(n);typeof i=="function"&&(o[r]=i);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let r=0;r<t.length;r+=1){const s=t[r];if(s!=null)switch(typeof s){case"function":{const i=o[r];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}}}}}}}function Fe(e){const t=ze(tf,e).current;return t.next=e,J(t.effect),t}function tf(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const Jr={...ku},Uo=Jr.useInsertionEffect,nf=Uo&&Uo!==Jr.useLayoutEffect?Uo:e=>e();function le(e){const t=ze(of).current;return t.next=e,nf(t.effect),t.trampoline}function of(){const e={next:void 0,callback:rf,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function rf(){}const Wn=null;class sf{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let r=0;r<n.length;r+=1)n[r]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||this.callbacks[n]!==null&&(this.callbacks[n]=null,this.callbacksCount-=1)}}let Un=new sf;class ht{static create(){return new ht}static request(t){return Un.request(t)}static cancel(t){return Un.cancel(t)}currentId=Wn;request(t){this.cancel(),this.currentId=Un.request(()=>{this.currentId=Wn,t()})}cancel=()=>{this.currentId!==Wn&&(Un.cancel(this.currentId),this.currentId=Wn)};disposeEffect=()=>this.cancel}function Sn(){const e=ze(ht.create).current;return wo(e.disposeEffect),e}function be(e){return e?.ownerDocument||document}const af={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Ta={...af,position:"fixed",top:0,left:0},zt=l.forwardRef(function(t,n){const[o,r]=l.useState();J(()=>{Sd&&Dt&&r("button")},[]);const s={tabIndex:0,role:o};return f.jsx("span",{...t,ref:n,style:Ta,"aria-hidden":o?void 0:!0,...s,"data-base-ui-focus-guard":""})}),on=Math.min,bt=Math.max,io=Math.round,Kn=Math.floor,vt=e=>({x:e,y:e}),cf={left:"right",right:"left",bottom:"top",top:"bottom"};function Ea(e,t,n){return bt(e,on(t,n))}function Nt(e,t){return typeof e=="function"?e(t):e}function ot(e){return e.split("-")[0]}function Et(e){return e.split("-")[1]}function Qr(e){return e==="x"?"y":"x"}function es(e){return e==="y"?"height":"width"}function nt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ts(e){return Qr(nt(e))}function lf(e,t,n){n===void 0&&(n=!1);const o=Et(e),r=ts(e),s=es(r);let i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=ao(i)),[i,ao(i)]}function uf(e){const t=ao(e);return[kr(e),t,kr(t)]}function kr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Vs=["left","right"],Ys=["right","left"],df=["top","bottom"],ff=["bottom","top"];function pf(e,t,n){switch(e){case"top":case"bottom":return n?t?Ys:Vs:t?Vs:Ys;case"left":case"right":return t?df:ff;default:return[]}}function hf(e,t,n,o){const r=Et(e);let s=pf(ot(e),n==="start",o);return r&&(s=s.map(i=>i+"-"+r),t&&(s=s.concat(s.map(kr)))),s}function ao(e){const t=ot(e);return cf[t]+e.slice(t.length)}function gf(e){var t,n,o,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(o=e.bottom)!=null?o:0,left:(r=e.left)!=null?r:0}}function Ra(e){return typeof e!="number"?gf(e):{top:e,right:e,bottom:e,left:e}}function co(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Gs(e,t){return t<0||t>=e.length}function Ko(e,t){return qt(e.current,{disabledIndices:t})}function Xs(e,t){return qt(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function qt(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:o,amount:r=1}={}){let s=t;do s+=n?-r:r;while(s>=0&&s<=e.length-1&&Ca(e,s,o));return s}function Ca(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;const r=e[t];return r?!Mo(r)||r.matches(":disabled")?!0:!n&&(r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"):!1}function mf(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Mo(e,t=e?Je(e):null){return!e||!e.isConnected||!t||mf(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const yf='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function xf(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return en(n)?n.host:null}function Pr(e){for(const t of Array.from(e.children))if(Be(t)==="summary")return t;return null}function bf(e,t){const n=Pr(t);return!!n&&(e===n||se(n,e))}function ka(e){const t=e?Be(e):"";return e!=null&&e.matches(yf)&&(t!=="summary"||e.parentElement!=null&&Be(e.parentElement)==="details"&&Pr(e.parentElement)===e)&&(t!=="details"||Pr(e)==null)&&(t!=="input"||e.type!=="hidden")}function Pa(e){if(!ka(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=xf(t)){const n=t!==e,o=Be(t)==="slot";if(t.hasAttribute("inert")||n&&Be(t)==="details"&&!t.open&&!bf(e,t)||t.hasAttribute("hidden")||!o&&!vf(t,n))return!1}return!0}function vf(e,t){const n=Je(e);return t?n.display!=="none":Mo(e,n)}function Oa(e){const t=e.tabIndex;if(t<0){const n=Be(e);if(n==="details"||n==="audio"||n==="video"||Pe(e)&&e.isContentEditable)return 0}return t}function Vo(e){if(Be(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function wf(e,t){const n=Vo(e);if(!n)return!0;const o=t.find(r=>{const s=Vo(r);return s?.name===n.name&&s.form===n.form&&s.checked});return o?o===n:t.find(r=>{const s=Vo(r);return s?.name===n.name&&s.form===n.form})===n}function Ia(e){if(Pe(e)&&Be(e)==="slot"){const 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 Ma(e,t){Ia(e).forEach(n=>{ka(n)&&t.push(n),Ma(n,t)})}function Aa(e,t,n){Ia(e).forEach(o=>{Pe(o)&&o.matches(t)&&n.push(o),Aa(o,t,n)})}function ns(e){return Pa(e)&&Oa(e)>=0}function Na(e){const t=[];return Ma(e,t),t.filter(Pa)}function Nn(e){const t=Na(e);return t.filter(n=>Oa(n)>=0&&wf(n,t))}function ja(e,t){const n=Nn(e),o=n.length;if(o===0)return;const r=_e(be(e)),s=n.indexOf(r),i=s===-1?t===1?0:o-1:s+t;return n[i]}function os(e){return ja(be(e).body,1)||e}function Da(e){return ja(be(e).body,-1)||e}function La(e,t){if(!e)return null;const n=Nn(be(e).body),o=n.length;if(o===0)return null;const r=n.indexOf(e);if(r===-1)return null;const s=(r+t+o)%o;return n[s]}function Sf(e){return La(e,1)}function Tf(e){return La(e,-1)}function Jt(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!se(n,o)}function Ef(e){Nn(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function qs(e){const t=[];Aa(e,"[data-tabindex]",t),t.forEach(n=>{const o=n.dataset.tabindex;delete n.dataset.tabindex,o?n.setAttribute("tabindex",o):n.removeAttribute("tabindex")})}function jt(e,t,n=!0){return e.filter(r=>r.parentId===t).flatMap(r=>[...!n||r.context?.open?[r]:[],...jt(e,r.id,n)])}function Zs(e,t){let n=[],o=e.find(r=>r.id===t)?.parentId;for(;o;){const r=e.find(s=>s.id===o);o=r?.parentId,r&&(n=n.concat(r))}return n}function Tn(e){return`data-base-ui-${e}`}let Vn=0;function eo(e,t={}){const{preventScroll:n=!1,sync:o=!1,shouldFocus:r}=t;cancelAnimationFrame(Vn);function s(){r&&!r()||e?.focus({preventScroll:n})}if(o)return s(),Fr;const i=requestAnimationFrame(s);return Vn=i,()=>{Vn===i&&(cancelAnimationFrame(i),Vn=0)}}const Yo={inert:new WeakMap,"aria-hidden":new WeakMap},Js="data-base-ui-inert",Or={inert:new WeakSet,"aria-hidden":new WeakSet};let fn=new WeakMap,Go=0;function Rf(e){return Or[e]}function Fa(e){return e?en(e)?e.host:Fa(e.parentNode):null}const Qs=(e,t)=>t.map(n=>{if(e.contains(n))return n;const o=Fa(n);return e.contains(o)?o:null}).filter(n=>n!=null),ei=e=>{const t=new Set;return e.forEach(n=>{let o=n;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},ti=(e,t,n)=>{const o=[],r=s=>{!s||n.has(s)||Array.from(s.children).forEach(i=>{Be(i)!=="script"&&(t.has(i)?r(i):o.push(i))})};return r(e),o};function Cf(e,t,n,o,{mark:r=!0}){let s=null;o?s="inert":n&&(s="aria-hidden");let i=null,a=null;const c=Qs(t,e),u=r?ti(t,ei(c),new Set(c)):[],d=[],h=[];if(s){const p=Yo[s],m=Rf(s);a=m,i=p;const g=Qs(t,Array.from(t.querySelectorAll("[aria-live]"))),x=c.concat(g);ti(t,ei(x),new Set(x)).forEach(v=>{const S=v.getAttribute(s),b=S!==null&&S!=="false",w=(p.get(v)||0)+1;p.set(v,w),d.push(v),w===1&&b&&m.add(v),b||v.setAttribute(s,s==="inert"?"":"true")})}return r&&u.forEach(p=>{const m=(fn.get(p)||0)+1;fn.set(p,m),h.push(p),m===1&&p.setAttribute(Js,"")}),Go+=1,()=>{i&&d.forEach(p=>{const g=(i.get(p)||0)-1;i.set(p,g),g||(!a?.has(p)&&s&&p.removeAttribute(s),a?.delete(p))}),r&&h.forEach(p=>{const m=(fn.get(p)||0)-1;fn.set(p,m),m||p.removeAttribute(Js)}),Go-=1,Go||(Yo.inert=new WeakMap,Yo["aria-hidden"]=new WeakMap,Or.inert=new WeakSet,Or["aria-hidden"]=new WeakSet,fn=new WeakMap)}}function ni(e,t={}){const{ariaHidden:n=!1,inert:o=!1,mark:r=!0}=t,s=be(e[0]).body;return Cf(e,s,n,o,{mark:r})}var rt=Pu();let oi=0;function kf(e,t="mui"){const[n,o]=l.useState(e),r=e||n;return l.useEffect(()=>{n==null&&(oi+=1,o(`${t}-${oi}`))},[n,t]),r}const ri=Jr.useId;function Wt(e,t){if(ri!==void 0){const n=ri();return e??(t?`${t}-${n}`:n)}return kf(e,t)}const Pf=parseInt(l.version,10);function rs(e){return Pf>=e}function si(e){if(!l.isValidElement(e))return null;const t=e,n=t.props;return(rs(19)?n?.ref:t.ref)??null}function Ir(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Of(e,t){const n={};for(const o in e){const r=e[o];if(t?.hasOwnProperty(o)){const s=t[o](r);s!=null&&Object.assign(n,s);continue}r===!0?n[`data-${o.toLowerCase()}`]="":r&&(n[`data-${o.toLowerCase()}`]=r.toString())}return n}function If(e,t){return typeof e=="function"?e(t):e}function Mf(e,t){return typeof e=="function"?e(t):e}const ss={};function wt(e,t,n,o,r){if(!n&&!o&&!r&&!e)return lo(t);let s=lo(e);return t&&(s=mn(s,t)),n&&(s=mn(s,n)),o&&(s=mn(s,o)),r&&(s=mn(s,r)),s}function Af(e){if(e.length===0)return ss;if(e.length===1)return lo(e[0]);let t=lo(e[0]);for(let n=1;n<e.length;n+=1)t=mn(t,e[n]);return t}function lo(e){return is(e)?{...Ha(e,ss)}:Nf(e)}function mn(e,t){return is(t)?Ha(t,e):jf(e,t)}function Nf(e){const t={...e};for(const n in t){const o=t[n];_a(n,o)&&(t[n]=Ba(o))}return t}function jf(e,t){if(!t)return e;for(const n in t){const o=t[n];switch(n){case"style":{e[n]=Ir(e.style,o);break}case"className":{e[n]=$a(e.className,o);break}default:_a(n,o)?e[n]=Df(e[n],o):e[n]=o}}return e}function _a(e,t){const n=e.charCodeAt(0),o=e.charCodeAt(1),r=e.charCodeAt(2);return n===111&&o===110&&r>=65&&r<=90&&(typeof t=="function"||typeof t>"u")}function is(e){return typeof e=="function"}function Ha(e,t){return is(e)?e(t):e??ss}function Df(e,t){return t?e?(...n)=>{const o=n[0];if(za(o)){const s=o;uo(s);const i=t(...n);return s.baseUIHandlerPrevented||e?.(...n),i}const r=t(...n);return e?.(...n),r}:Ba(t):e}function Ba(e){return e&&((...t)=>{const n=t[0];return za(n)&&uo(n),e(...t)})}function uo(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function $a(e,t){return t?e?t+" "+e:t:e}function za(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function De(e,t,n={}){let o=t.render;n.enabled!==!1&&(o=Hf(o));const r=Lf(t,n,o);if(n.enabled===!1)return null;const s=n.state??je;return Bf(e,o,r,s)}function Lf(e,t,n){const{className:o,style:r}=e,{state:s=je,ref:i,props:a,stateAttributesMapping:c,enabled:u=!0}=t,d=u?If(o,s):void 0,h=u?Mf(r,s):void 0,p=u?Of(s,c):je,m=u&&a?Ff(a):void 0,g=u?Ir(p,m)??{}:je;return typeof document<"u"&&(u?Array.isArray(i)?g.ref=Jd([g.ref,si(n),...i]):g.ref=nn(g.ref,si(n),i):nn(null,null)),u?(d!==void 0&&(g.className=$a(g.className,d)),h!==void 0&&(g.style=Ir(g.style,h)),g):je}function Ff(e){return Array.isArray(e)?Af(e):wt(void 0,e)}const _f=Symbol.for("react.lazy");function Hf(e){if(e?.$$typeof!==_f)return e;const t=l.Children.toArray(e)[0];return l.isValidElement(t)?t:e}function Bf(e,t,n,o){if(t){if(typeof t=="function")return t(n,o);const r=wt(n,t.props);return r.ref=n.ref,l.cloneElement(t,r)}if(e&&typeof e=="string")return $f(e,n);throw new Error(Ye(8))}function $f(e,t){return e==="button"?l.createElement("button",{type:"button",...t,key:t.key}):e==="img"?l.createElement("img",{alt:"",...t,key:t.key}):l.createElement(e,t)}const zf=500,Wf=500,Uf={style:{transition:"none"}},Kf="data-base-ui-click-trigger",Vf="data-base-ui-swipe-ignore",Yf="data-swipe-ignore",Gf=`[${Vf}]`,Xf=`[${Yf}]`,qf={fallbackAxisSide:"none"},Wa={fallbackAxisSide:"end"},Zf={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Ua=l.createContext(null),Ka=()=>l.useContext(Ua),Jf=Tn("portal");function Va(e={}){const{ref:t,container:n,componentProps:o=je,elementProps:r}=e,s=Wt(),a=Ka()?.portalNode,[c,u]=l.useState(null),[d,h]=l.useState(null),p=le(y=>{y!==null&&h(y)}),m=l.useRef(null);J(()=>{if(n===null){m.current&&(m.current=null,h(null),u(null));return}const y=(n&&(zr(n)?n:n.current))??a??document.body;if(y==null){m.current&&(m.current=null,h(null),u(null));return}m.current!==y&&(m.current=y,h(null),u(y))},[n,a]);const g=De("div",o,{ref:[t,p],props:[{id:s,[Jf]:""},r]}),x=c&&g?rt.createPortal(g,c):null;return{node:d,nodeId:l.isValidElement(g)?g.props.id:void 0,subtree:x}}const Ya=l.forwardRef(function(t,n){const{render:o,className:r,style:s,children:i,container:a,portalOwnerRole:c,...u}=t,{node:d,nodeId:h,subtree:p}=Va({container:a,ref:n,componentProps:t,elementProps:u}),m=l.useRef(null),g=l.useRef(null),x=l.useRef(null),y=l.useRef(null),[v,S]=l.useState(null),b=l.useRef(!1),w=v?.modal,T=v?.open,E=!!v&&!v.modal&&v.open&&!!d;l.useEffect(()=>{if(!d||w)return;function R(j){d&&j.relatedTarget&&Jt(j)&&(j.type==="focusin"?b.current&&(qs(d),b.current=!1):(Ef(d),b.current=!0))}return lt(me(d,"focusin",R,!0),me(d,"focusout",R,!0))},[d,w]),J(()=>{!d||T!==!0||!b.current||(qs(d),b.current=!1)},[T,d]);const C=l.useMemo(()=>({beforeOutsideRef:m,afterOutsideRef:g,beforeInsideRef:x,afterInsideRef:y,portalNode:d,setFocusManagerState:S}),[d]);return f.jsxs(l.Fragment,{children:[p,f.jsxs(Ua.Provider,{value:C,children:[E&&d&&f.jsx(zt,{"data-type":"outside",ref:m,onFocus:R=>{if(Jt(R,d))x.current?.focus();else{const j=v?v.domReference:null;Da(j)?.focus()}}}),E&&d&&f.jsx("span",{role:c,"aria-owns":h,style:Zf}),d&&rt.createPortal(i,d),E&&d&&f.jsx(zt,{"data-type":"outside",ref:g,onFocus:R=>{if(Jt(R,d))y.current?.focus();else{const j=v?v.domReference:null;os(j)?.focus(),v?.closeOnFocusOut&&v?.onOpenChange(!1,Se(tn,R.nativeEvent))}}})]})]})});function Ga(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class as{nodesRef={current:[]};events=Ga();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(o=>o===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Xa=l.createContext(null),qa=l.createContext(null),Vt=()=>l.useContext(Xa)?.id||null,Lt=e=>{const t=l.useContext(qa);return e??t};function Za(e){const t=Wt(),n=Lt(e),o=Vt();return J(()=>{if(!t)return;const r={id:t,parentId:o};return n?.addNode(r),()=>{n?.removeNode(r)}},[n,t,o]),t}function Qf(e){const{children:t,id:n}=e,o=Vt();return f.jsx(Xa.Provider,{value:l.useMemo(()=>({id:n,parentId:o}),[n,o]),children:t})}function ep(e){const{children:t,externalTree:n}=e,o=ze(()=>n??new as).current;return f.jsx(qa.Provider,{value:o,children:t})}function yt(e){return e==null?e:"current"in e?e.current:e}function tp(e,t){const n=Ie(Ne(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const ii=20;let It=[];function cs(){It=It.filter(e=>e.deref()?.isConnected)}function ai(e){cs(),e&&Be(e)!=="body"&&(It.push(new WeakRef(e)),It.length>ii&&(It=It.slice(-ii)))}function ci(){return cs(),It[It.length-1]?.deref()}function np(e){return e?ns(e)?e:Nn(e)[0]||e:null}function li(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=Na(e).filter(r=>{const s=r.getAttribute("data-tabindex")||"";return ns(r)||r.hasAttribute("data-tabindex")&&!s.startsWith("-")}),o=e.getAttribute("tabindex");n.length===0?o!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Ja(e){const{context:t,children:n,disabled:o=!1,initialFocus:r=!0,returnFocus:s=!0,restoreFocus:i=!1,modal:a=!0,closeOnFocusOut:c=!0,openInteractionType:u="",nextFocusableElement:d,previousFocusableElement:h,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:g}=e,x="rootStore"in t?t.rootStore:t,y=x.useState("open"),v=x.useState("domReferenceElement"),S=x.useState("floatingElement"),{events:b,dataRef:w}=x.context,T=le(()=>w.current.floatingContext?.nodeId),E=r===!1,C=Er(v)&&E,R=Fe(r),j=Fe(s),D=Fe(u),H=Fe(y),P=Lt(m),L=Ka(),F=l.useRef(!1),O=l.useRef(!1),_=l.useRef(!1),N=l.useRef(null),I=l.useRef(""),A=l.useRef(""),U=l.useRef(null),W=l.useRef(null),ne=nn(U,p,L?.beforeInsideRef),oe=nn(W,L?.afterInsideRef),z=We(),Q=We(),K=Sn(),ge=L!=null,Y=Rr(S),ce=le((re=Y)=>re?Nn(re):[]),ue=le(()=>g?.().filter(re=>re!=null)??[]);l.useEffect(()=>{if(o||!a)return;function re(he){he.key==="Tab"&&se(Y,_e(be(Y)))&&ce().length===0&&!C&&pt(he)}const X=be(Y);return me(X,"keydown",re)},[o,Y,a,C,ce]),l.useEffect(()=>{if(o||!y)return;const re=be(Y);function X(){_.current=!1}function he(ve){const q=Ne(ve),de=ue(),Z=se(S,q)||se(v,q)||se(L?.portalNode,q)||de.some(te=>te===q||se(te,q));_.current=!Z,A.current=ve.pointerType||"keyboard",q?.closest(`[${Kf}]`)&&(O.current=!0,Q.start(0,()=>{O.current=!1}))}function fe(){A.current="keyboard"}return lt(me(re,"pointerdown",he,!0),me(re,"pointerup",X,!0),me(re,"pointercancel",X,!0),me(re,"keydown",fe,!0),X)},[o,S,v,Y,y,L,Q,ue]),l.useEffect(()=>{if(o||!c)return;const re=be(Y);function X(){O.current=!0,Q.start(0,()=>{O.current=!1})}function he(de){const Z=Ne(de);ns(Z)&&(N.current=Z)}function fe(de){const Z=de.relatedTarget,te=de.currentTarget,ae=Ne(de);a&&Z==null&&ae!=null&&se(S,ae)&&ai(ae),queueMicrotask(()=>{const Ee=T(),ie=x.context.triggerElements,$=ue(),V=Z?.hasAttribute(Tn("focus-guard"))&&[U.current,W.current,L?.beforeInsideRef.current,L?.afterInsideRef.current,L?.beforeOutsideRef.current,L?.afterOutsideRef.current,yt(h),yt(d)].includes(Z),B=!(se(v,Z)||se(S,Z)||se(Z,S)||se(L?.portalNode,Z)||$.some(M=>M===Z||se(M,Z))||ie.hasMatchingElement(M=>se(M,Z))||V||P&&(jt(P.nodesRef.current,Ee).find(M=>se(M.context?.elements.floating,Z)||se(M.context?.elements.domReference,Z))||Zs(P.nodesRef.current,Ee).find(M=>[M.context?.elements.floating,Rr(M.context?.elements.floating)].includes(Z)||M.context?.elements.domReference===Z)));if(te===v&&Y&&li(Y),i&&te!==v&&!Mo(ae)&&_e(re)===re.body){if(Pe(Y)&&(Y.focus(),i==="popup")){K.request(()=>{Y.focus()});return}const M=ce(),G=N.current,pe=(G&&M.includes(G)?G:null)||M[M.length-1]||Y;Pe(pe)&&pe.focus()}if(w.current.insideReactTree){w.current.insideReactTree=!1;return}(C||!a)&&Z&&B&&!O.current&&(C||Z!==ci())&&(F.current=!0,x.setOpen(!1,Se(tn,de)))})}function ve(){_.current||(w.current.insideReactTree=!0,z.start(0,()=>{w.current.insideReactTree=!1}))}const q=Pe(v)?v:null;if(!(!S&&!q))return lt(q&&me(q,"focusout",fe),q&&me(q,"pointerdown",X),S&&me(S,"focusin",he),S&&me(S,"focusout",fe),S&&L&&me(S,"focusout",ve,!0))},[o,v,S,Y,a,P,L,x,c,i,ce,C,T,w,z,Q,K,d,h,ue]),l.useEffect(()=>{if(o||!S||!y)return;const re=Array.from(L?.portalNode?.querySelectorAll(`[${Tn("portal")}]`)||[]),he=(P?Zs(P.nodesRef.current,T()):[]).find(te=>Er(te.context?.elements.domReference||null))?.context?.elements.domReference,ve=[...[S,...re,U.current,W.current,L?.beforeOutsideRef.current,L?.afterOutsideRef.current,...ue()],he,yt(h),yt(d),C?v:null].filter(te=>te!=null),q=ni(ve,{ariaHidden:a||C,mark:!1}),de=[S,...re].filter(te=>te!=null),Z=ni(de);return()=>{Z(),q()}},[y,o,v,S,a,L,C,P,T,d,h,ue]),J(()=>{if(!y||o||!Pe(Y))return;I.current="",A.current="";const re=be(Y),X=_e(re);queueMicrotask(()=>{const he=R.current,fe=typeof he=="function"?he(D.current||""):he;if(fe===void 0||fe===!1||se(Y,X))return;let q=null;const de=()=>(q==null&&(q=ce(Y)),q[0]||Y);let Z;fe===!0||fe===null?Z=de():Z=yt(fe),Z=Z||de();const te=se(Y,_e(re));eo(Z,{preventScroll:Z===Y,shouldFocus(){if(!H.current)return!1;if(te)return!0;const ae=_e(re);return!(ae!==Z&&se(Y,ae))}})})},[o,y,Y,ce,R,D,H]),J(()=>{if(o||!Y)return;const re=be(Y),X=_e(re),he=D.current==null;ai(X);function fe(q){if(q.open||(I.current=tp(q.nativeEvent,A.current)),q.reason===He&&q.nativeEvent.type==="mouseleave"&&(F.current=!0),q.reason===qr)if(q.nested)F.current=!1;else if(Br(q.nativeEvent)||$r(q.nativeEvent))F.current=!1;else{let de=!1;be(Y).createElement("div").focus({get preventScroll(){return de=!0,!1}}),de?F.current=!1:F.current=!0}}b.on("openchange",fe);function ve(q){const de=j.current;let Z=typeof de=="function"?de(q):de;if(Z===void 0||Z===!1)return null;Z===null&&(Z=!0);const te=v?.isConnected?v:null,ae=X?.isConnected&&Be(X)!=="body"?X:null;let Ee=he?ae||te:te||ae;return Ee||(Ee=ci()||null),typeof Z=="boolean"?Ee:yt(Z)||Ee||null}return()=>{b.off("openchange",fe);const q=_e(re),de=ue(),Z=se(S,q)||de.some(ie=>ie===q||se(ie,q))||P&&jt(P.nodesRef.current,T(),!1).some(ie=>se(ie.context?.elements.floating,q)),te=j.current,ae=I.current,Ee=ve(ae);queueMicrotask(()=>{const ie=np(Ee),$=typeof te!="boolean";if(te&&!F.current&&Pe(ie)&&(!(!$&&ie!==q&&q!==re.body)||Z)){const V={preventScroll:!0};ae==="keyboard"&&(V.focusVisible=!0),ie.focus(V)}F.current=!1})}},[o,S,Y,j,D,b,P,v,T,ue]),J(()=>{if(!Dt||y||!S)return;const re=_e(be(S));!Pe(re)||!Oo(re)||se(S,re)&&re.blur()},[y,S]),J(()=>{if(!(o||!L))return L.setFocusManagerState({modal:a,closeOnFocusOut:c,open:y,onOpenChange:x.setOpen,domReference:v}),()=>{L.setFocusManagerState(null)}},[o,L,a,y,x,c,v]),J(()=>{if(!(o||!Y))return li(Y),()=>{queueMicrotask(cs)}},[o,Y]);const ye=!o&&(a?!C:!0)&&(ge||a);return f.jsxs(l.Fragment,{children:[ye&&f.jsx(zt,{"data-type":"inside",ref:ne,onFocus:re=>{if(a){const X=ce();eo(X[X.length-1])}else L?.portalNode&&(F.current=!1,Jt(re,L.portalNode)?os(v)?.focus():yt(h??L.beforeOutsideRef)?.focus())}}),n,ye&&f.jsx(zt,{"data-type":"inside",ref:oe,onFocus:re=>{a?eo(ce()[0]):L?.portalNode&&(c&&(F.current=!0),Jt(re,L.portalNode)?Da(v)?.focus():yt(d??L.afterOutsideRef)?.focus())}})]})}function op(e,t={}){const{enabled:n=!0,event:o="click",toggle:r=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:a=0,reason:c=sn}=t,u="rootStore"in e?e.rootStore:e,d=u.context.dataRef,h=l.useRef(void 0),p=Sn(),m=We(),g=l.useMemo(()=>{function x(v,S,b,w){const T=Se(c,S,b);v&&w==="touch"&&a>0?m.start(a,()=>{u.setOpen(!0,T)}):u.setOpen(v,T)}function y(v,S,b){const w=d.current.openEvent,T=u.select("domReferenceElement")!==S;return v&&T||!v||!r?!0:w&&i?!b(w.type):!1}return{onPointerDown(v){h.current=At(v.pointerType,!0)&&$r(v.nativeEvent)?"virtual":v.pointerType},onMouseDown(v){const S=h.current,b=v.nativeEvent,w=u.select("open");if(v.button!==0||o==="click"||At(S,!0)&&s)return;const T=y(w,v.currentTarget,R=>R==="click"||R==="mousedown"),E=Ne(b);if(Oo(E)){x(T,b,E,S);return}const C=v.currentTarget;p.request(()=>{x(T,b,C,S)})},onClick(v){if(o==="mousedown-only")return;const S=h.current;if(o==="mousedown"&&S){h.current=void 0;return}if(At(S,!0)&&s)return;const b=u.select("open"),w=y(b,v.currentTarget,T=>T==="click"||T==="mousedown"||T==="keydown"||T==="keyup");x(w,v.nativeEvent,v.currentTarget,S)},onKeyDown(){h.current=void 0}}},[d,o,s,c,u,i,r,p,m,a]);return l.useMemo(()=>n?{reference:g}:je,[n,g])}function rp(e,t){let n=null,o=null,r=!1;return{contextElement:e||void 0,getBoundingClientRect(){const s=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i=t.axis==="x"||t.axis==="both",a=t.axis==="y"||t.axis==="both",c=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let u=s.width,d=s.height,h=s.x,p=s.y;return n==null&&t.x&&i&&(n=s.x-t.x),o==null&&t.y&&a&&(o=s.y-t.y),h-=n||0,p-=o||0,u=0,d=0,!r||c?(u=t.axis==="y"?s.width:0,d=t.axis==="x"?s.height:0,h=i&&t.x!=null?t.x:h,p=a&&t.y!=null?t.y:p):r&&!c&&(d=t.axis==="x"?s.height:d,u=t.axis==="y"?s.width:u),r=!0,{width:u,height:d,x:h,y:p,top:p,right:h+u,bottom:p+d,left:h}}}}function ui(e){return e!=null&&e.clientX!=null}function sp(e,t={}){const{enabled:n=!0,axis:o="both"}=t,r="rootStore"in e?e.rootStore:e,s=r.useState("open"),i=r.useState("floatingElement"),a=r.useState("domReferenceElement"),c=r.context.dataRef,u=l.useRef(!1),d=l.useRef(null),[h,p]=l.useState(),[m,g]=l.useState([]),x=le(w=>{r.set("positionReference",w)}),y=le((w,T,E)=>{u.current||c.current.openEvent&&!ui(c.current.openEvent)||r.set("positionReference",rp(E??a,{x:w,y:T,axis:o,dataRef:c,pointerType:h}))}),v=le(w=>{s?d.current||(y(w.clientX,w.clientY,w.currentTarget),g([])):y(w.clientX,w.clientY,w.currentTarget)}),S=At(h)?i:s;l.useEffect(()=>{if(!n){x(a);return}if(!S)return;function w(){d.current?.(),d.current=null}const T=Ie(i);function E(C){const R=Ne(C);se(i,R)?w():y(C.clientX,C.clientY)}return!c.current.openEvent||ui(c.current.openEvent)?d.current=me(T,"mousemove",E):x(a),w},[S,n,i,c,a,r,y,x,m]),l.useEffect(()=>()=>{r.set("positionReference",null)},[r]),l.useEffect(()=>{n&&!i&&(u.current=!1)},[n,i]),l.useEffect(()=>{!n&&s&&(u.current=!0)},[n,s]);const b=l.useMemo(()=>{function w(T){p(T.pointerType)}return{onPointerDown:w,onPointerEnter:w,onMouseMove:v,onMouseEnter:v}},[v]);return l.useMemo(()=>n?{reference:b,trigger:b}:{},[n,b])}function ip(){return!1}function ap(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function ls(e,t={}){const{enabled:n=!0,escapeKey:o=!0,outsidePress:r=!0,outsidePressEvent:s="sloppy",referencePress:i=ip,bubbles:a,externalTree:c}=t,u="rootStore"in e?e.rootStore:e,d=u.useState("open"),h=u.useState("floatingElement"),{dataRef:p,events:m}=u.context,g=Lt(c),x=le(typeof r=="function"?r:()=>!1),y=typeof r=="function"?x:r,v=y!==!1,S=le(()=>s),{escapeKey:b,outsidePress:w}=ap(a),T=l.useRef(!1),E=l.useRef(!1),C=l.useRef(!1),R=l.useRef(!1),j=l.useRef(!1),D=l.useRef(""),H=l.useRef(null),P=We(),L=We(),F=le(()=>{L.clear(),p.current.insideReactTree=!1}),O=le(z=>{const Q=p.current.floatingContext?.nodeId;return(g?jt(g.nodesRef.current,Q):[]).some(ge=>ge.context?.open&&!ge.context.dataRef.current[z])}),_=le(z=>Wo(z,u.select("floatingElement"))||Wo(z,u.select("domReferenceElement"))),N=le(z=>{i()&&u.setOpen(!1,Se(sn,z.nativeEvent))}),I=le(z=>{if(!d||!n||!o||z.key!=="Escape"||j.current||!b&&O("__escapeKeyBubbles"))return;const Q=Td(z)?z.nativeEvent:z,K=Se(Io,Q);u.setOpen(!1,K),K.isCanceled||z.preventDefault(),!b&&!K.isPropagationAllowed&&z.stopPropagation()}),A=le(()=>{p.current.insideReactTree=!0,L.start(0,F)}),U=le(z=>{if(!d||!n||z.button!==0)return;const Q=Ne(z.nativeEvent);se(u.select("floatingElement"),Q)&&(T.current||(T.current=!0,E.current=!1))}),W=le(z=>{!d||!n||(z.defaultPrevented||z.nativeEvent.defaultPrevented)&&T.current&&(E.current=!0)});l.useEffect(()=>{function z(Q){Q.open||(R.current=!1)}return m.on("openchange",z),()=>{m.off("openchange",z)}},[m]),l.useEffect(()=>{if(!d||!n)return d||(R.current=!1),F;p.current.__escapeKeyBubbles=b,p.current.__outsidePressBubbles=w;const z=new Ze,Q=new Ze,K=be(h);function ge(){z.clear(),j.current=!0}function Y(){z.start(Dt?5:0,()=>{j.current=!1})}function ce(){C.current=!0,Q.start(0,()=>{C.current=!1})}function ue(){T.current=!1,E.current=!1}function ye(){const B=D.current,M=B==="pen"||!B?"mouse":B,G=S(),pe=typeof G=="function"?G():G;return typeof pe=="string"?pe:pe[M]}function re(B){const M=ye();return M==="intentional"&&B.type!=="click"||M==="sloppy"&&B.type==="click"}function X(B){const M=p.current.floatingContext?.nodeId,G=g&&jt(g.nodesRef.current,M).some(pe=>Wo(B,pe.context?.elements.floating));return _(B)||G}function he(B){if(re(B)){B.type!=="click"&&!_(B)&&(Q.clear(),C.current=!1),F();return}if(p.current.insideReactTree){F();return}const M=Ne(B),G=`[${Tn("inert")}]`,pe=we(M)?M.getRootNode():null,Ue=Array.from((en(pe)?pe:be(u.select("floatingElement"))).querySelectorAll(G)),Qe=u.context.triggerElements;if(M&&(Qe.hasElement(M)||Qe.hasMatchingElement(ee=>se(ee,M))))return;let Le=we(M)?M:null;for(;Le&&!xt(Le);){const ee=Tt(Le);if(xt(ee)||!we(ee))break;Le=ee}if(!(Ue.length&&we(M)&&!zd(M)&&!se(M,u.select("floatingElement"))&&Ue.every(ee=>!se(Le,ee)))){if(Pe(M)&&!("touches"in B)){const ee=xt(M),Ce=Je(M),Oe=/auto|scroll/,Xe=ee||Oe.test(Ce.overflowX),dt=ee||Oe.test(Ce.overflowY),mt=Xe&&M.clientWidth>0&&M.scrollWidth>M.clientWidth,ft=dt&&M.clientHeight>0&&M.scrollHeight>M.clientHeight,Ke=Ce.direction==="rtl",Gt=ft&&(Ke?B.offsetX<=M.offsetWidth-M.clientWidth:B.offsetX>M.clientWidth),Re=mt&&B.offsetY>M.clientHeight;if(Gt||Re)return}if(!X(B)){if(ye()==="intentional"){if(B.detail!==0&&!Br(B)&&!R.current)return;if(C.current){Q.clear(),C.current=!1;return}}typeof y=="function"&&!y(B)||O("__outsidePressBubbles")||(u.setOpen(!1,Se(qr,B)),F())}}}function fe(B){ye()!=="sloppy"||B.pointerType==="touch"||!u.select("open")||!n||_(B)||he(B)}function ve(B){if(ye()!=="sloppy"||!u.select("open")||!n||_(B))return;const M=B.touches[0];M&&(H.current={startTime:Date.now(),startX:M.clientX,startY:M.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},P.start(1e3,()=>{H.current&&(H.current.dismissOnTouchEnd=!1,H.current.dismissOnMouseDown=!1)}))}function q(B,M){const G=Ne(B);if(!G)return;const pe=me(G,B.type,()=>{M(B),pe()})}function de(B){D.current="touch",q(B,ve)}function Z(B){P.clear(),B.type==="pointerdown"&&(B.button===0&&(R.current=!0),D.current=B.pointerType),!(B.type==="mousedown"&&H.current&&!H.current.dismissOnMouseDown)&&q(B,M=>{M.type==="pointerdown"?fe(M):he(M)})}function te(B){if(B.type==="pointercancel"&&(R.current=!1),!T.current)return;const M=E.current;if(ue(),ye()==="intentional"){if(B.type==="pointercancel"){M&&ce();return}if(!X(B)){if(M){ce();return}typeof y=="function"&&!y(B)||(Q.clear(),C.current=!0,F())}}}function ae(B){if(ye()!=="sloppy"||!H.current||_(B))return;const M=B.touches[0];if(!M)return;const G=Math.abs(M.clientX-H.current.startX),pe=Math.abs(M.clientY-H.current.startY),Ue=Math.sqrt(G*G+pe*pe);Ue>5&&(H.current.dismissOnTouchEnd=!0),Ue>10&&(he(B),P.clear(),H.current=null)}function Ee(B){q(B,ae)}function ie(B){ye()!=="sloppy"||!H.current||_(B)||(H.current.dismissOnTouchEnd&&he(B),P.clear(),H.current=null)}function $(B){q(B,ie)}const V=lt(o&<(me(K,"keydown",I),me(K,"compositionstart",ge),me(K,"compositionend",Y)),v&<(me(K,"click",Z,!0),me(K,"pointerdown",Z,!0),me(K,"pointerup",te,!0),me(K,"pointercancel",te,!0),me(K,"mousedown",Z,!0),me(K,"mouseup",te,!0),me(K,"touchstart",de,{capture:!0,passive:!0}),me(K,"touchmove",Ee,{capture:!0,passive:!0}),me(K,"touchend",$,{capture:!0,passive:!0})));return()=>{V(),z.clear(),Q.clear(),ue(),C.current=!1,F()}},[p,h,o,v,y,d,n,b,w,I,F,S,O,_,g,u,P]);const ne=l.useMemo(()=>({onKeyDown:I,onPointerDown:N,onClick:N}),[I,N]),oe=l.useMemo(()=>({onKeyDown:I,onPointerDown:W,onMouseDown:W,onClickCapture:A,onMouseDownCapture(z){A(),U(z)},onPointerDownCapture(z){A(),U(z)},onMouseUpCapture:A,onTouchEndCapture:A,onTouchMoveCapture:A}),[I,A,U,W]);return l.useMemo(()=>n?{reference:ne,floating:oe,trigger:ne}:{},[n,ne,oe])}function di(e,t,n){let{reference:o,floating:r}=e;const s=nt(t),i=ts(t),a=es(i),c=ot(t),u=s==="y",d=o.x+o.width/2-r.width/2,h=o.y+o.height/2-r.height/2,p=o[a]/2-r[a]/2;let m;switch(c){case"top":m={x:d,y:o.y-r.height};break;case"bottom":m={x:d,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:h};break;case"left":m={x:o.x-r.width,y:h};break;default:m={x:o.x,y:o.y}}const g=Et(t);return g&&(m[i]+=p*(g==="end"?1:-1)*(n&&u?-1:1)),m}async function cp(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:p=!1,padding:m=0}=Nt(t,e),g=Ra(m),y=a[p?h==="floating"?"reference":"floating":h],v=co(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),S=h==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),w=await(s.isElement==null?void 0:s.isElement(b))&&await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1},T=co(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:S,offsetParent:b,strategy:c}):S);return{top:(v.top-T.top+g.top)/w.y,bottom:(T.bottom-v.bottom+g.bottom)/w.y,left:(v.left-T.left+g.left)/w.x,right:(T.right-v.right+g.right)/w.x}}const lp=50,up=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:cp},c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:h}=di(u,o,c),p=o,m=0;const g={};for(let x=0;x<s.length;x++){const y=s[x];if(!y)continue;const{name:v,fn:S}=y,{x:b,y:w,data:T,reset:E}=await S({x:d,y:h,initialPlacement:o,placement:p,strategy:r,middlewareData:g,rects:u,platform:a,elements:{reference:e,floating:t}});d=b??d,h=w??h,g[v]={...g[v],...T},E&&m<lp&&(m++,typeof E=="object"&&(E.placement&&(p=E.placement),E.rects&&(u=E.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):E.rects),{x:d,y:h}=di(u,p,c)),x=-1)}return{x:d,y:h,placement:p,strategy:r,middlewareData:g}},dp=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:x=!0,...y}=Nt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=ot(r),S=nt(a),b=ot(a)===a,w=await(c.isRTL==null?void 0:c.isRTL(u.floating)),T=p||(b||!x?[ao(a)]:uf(a)),E=g!=="none";!p&&E&&T.push(...hf(a,x,g,w));const C=[a,...T],R=await c.detectOverflow(t,y),j=[];let D=((o=s.flip)==null?void 0:o.overflows)||[];if(d&&j.push(R[v]),h){const F=lf(r,i,w);j.push(R[F[0]],R[F[1]])}if(D=[...D,{placement:r,overflows:j}],!j.every(F=>F<=0)){var H,P;const F=(((H=s.flip)==null?void 0:H.index)||0)+1,O=C[F];if(O&&(!(h==="alignment"?S!==nt(O):!1)||D.every(I=>nt(I.placement)===S?I.overflows[0]>0:!0)))return{data:{index:F,overflows:D},reset:{placement:O}};let _=(P=D.filter(N=>N.overflows[0]<=0).sort((N,I)=>N.overflows[1]-I.overflows[1])[0])==null?void 0:P.placement;if(!_)switch(m){case"bestFit":{var L;const N=(L=D.filter(I=>{if(E){const A=nt(I.placement);return A===S||A==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(A=>A>0).reduce((A,U)=>A+U,0)]).sort((I,A)=>I[1]-A[1])[0])==null?void 0:L[0];N&&(_=N);break}case"initialPlacement":_=a;break}if(r!==_)return{reset:{placement:_}}}return{}}}},Qa=new Set(["left","top"]);async function fp(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=ot(n),a=Et(n),c=nt(n)==="y",u=Qa.has(i)?-1:1,d=s&&c?-1:1,h=Nt(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof g=="number"&&(m=a==="end"?g*-1:g),c?{x:m*d,y:p*u}:{x:p*u,y:m*d}}const pp=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:i,middlewareData:a}=t,c=await fp(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+c.x,y:s+c.y,data:{...c,placement:i}}}}},hp=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:S=>{let{x:b,y:w}=S;return{x:b,y:w}}},...u}=Nt(e,t),d={x:n,y:o},h=await s.detectOverflow(t,u),p=nt(r),m=Qr(p);let g=d[m],x=d[p];const y=(S,b)=>Ea(b+h[S==="y"?"top":"left"],b,b-h[S==="y"?"bottom":"right"]);i&&(g=y(m,g)),a&&(x=y(p,x));const v=c.fn({...t,[m]:g,[p]:x});return{...v,data:{x:v.x-n,y:v.y-o,enabled:{[m]:i,[p]:a}}}}}},gp=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,o;const{x:r,y:s,placement:i,rects:a,middlewareData:c}=t,{offset:u=0,mainAxis:d=!0,crossAxis:h=!0}=Nt(e,t),p={x:r,y:s},m=nt(i),g=Qr(m);let x=p[g],y=p[m];const v=Nt(u,t),S=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:(n=v.mainAxis)!=null?n:0,crossAxis:(o=v.crossAxis)!=null?o:0};if(d){const T=g==="y"?"height":"width",E=a.reference[g]-a.floating[T]+S.mainAxis,C=a.reference[g]+a.reference[T]-S.mainAxis;x<E?x=E:x>C&&(x=C)}if(h){var b,w;const T=g==="y"?"width":"height",E=Qa.has(ot(i)),C=a.reference[m]-a.floating[T]+(E&&((b=c.offset)==null?void 0:b[m])||0)+(E?0:S.crossAxis),R=a.reference[m]+a.reference[T]+(E?0:((w=c.offset)==null?void 0:w[m])||0)-(E?S.crossAxis:0);y<C?y=C:y>R&&(y=R)}return{[g]:x,[m]:y}}}},mp=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:o,platform:r,elements:s}=t,{apply:i=()=>{},...a}=Nt(e,t),c=await r.detectOverflow(t,a),u=ot(n),d=Et(n),h=nt(n)==="y",{width:p,height:m}=o.floating;let g,x;u==="top"||u==="bottom"?(g=u,x=d===(await(r.isRTL==null?void 0:r.isRTL(s.floating))?"start":"end")?"left":"right"):(x=u,g=d==="end"?"top":"bottom");const y=m-c.top-c.bottom,v=p-c.left-c.right,S=on(m-c[g],y),b=on(p-c[x],v),w=t.middlewareData.shift,T=!w;let E=S,C=b;w!=null&&w.enabled.x&&(C=v),w!=null&&w.enabled.y&&(E=y),T&&!d&&(h?C=p-2*bt(c.left,c.right):E=m-2*bt(c.top,c.bottom)),await i({...t,availableWidth:C,availableHeight:E});const R=await r.getDimensions(s.floating);return p!==R.width||m!==R.height?{reset:{rects:!0}}:{}}}};function ec(e){const t=Je(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=Pe(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o,a=io(n)!==s||io(o)!==i;return a&&(n=s,o=i),{width:n,height:o,$:a}}function us(e){return we(e)?e:e.contextElement}function Qt(e){const t=us(e);if(!Pe(t))return vt(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=ec(t);let i=(s?io(n.width):n.width)/o,a=(s?io(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const yp=vt(0);function tc(e){const t=Ie(e);return!Ur()||!t.visualViewport?yp:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xp(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ie(e)}function Ut(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=us(e);let i=vt(1);t&&(o?we(o)&&(i=Qt(o)):i=Qt(e));const a=xp(s,n,o)?tc(s):vt(0);let c=(r.left+a.x)/i.x,u=(r.top+a.y)/i.y,d=r.width/i.x,h=r.height/i.y;if(s&&o){const p=Ie(s),m=we(o)?Ie(o):o;let g=p,x=wr(g);for(;x&&m!==g;){const y=Qt(x),v=x.getBoundingClientRect(),S=Je(x),b=v.left+(x.clientLeft+parseFloat(S.paddingLeft))*y.x,w=v.top+(x.clientTop+parseFloat(S.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,h*=y.y,c+=b,u+=w,g=Ie(x),x=wr(g)}}return co({width:d,height:h,x:c,y:u})}function Ao(e,t){const n=Co(e).scrollLeft;return t?t.left+n:Ut(Ct(e)).left+n}function nc(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Ao(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function bp(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",i=Ct(o),a=t?Ro(t.floating):!1;if(o===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=vt(1);const d=vt(0),h=Pe(o);if((h||!s)&&((Be(o)!=="body"||An(i))&&(c=Co(o)),h)){const m=Ut(o);u=Qt(o),d.x=m.x+o.clientLeft,d.y=m.y+o.clientTop}const p=i&&!h&&!s?nc(i,c):vt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-c.scrollTop*u.y+d.y+p.y}}function vp(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function wp(e){const t=Co(e),n=e.ownerDocument.body,o=bt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=bt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+Ao(e);const i=-t.scrollTop;return Je(n).direction==="rtl"&&(s+=bt(e.clientWidth,n.clientWidth)-o),{width:o,height:r,x:s,y:i}}const Sp=25;function Tp(e,t,n){n===void 0&&(n="viewport");const o=n==="layoutViewport",r=Ie(e),s=Ct(e),i=r.visualViewport;let a=s.clientWidth,c=s.clientHeight,u=0,d=0;if(i){const p=!Ur()||t==="fixed";o?p||(u=-i.offsetLeft,d=-i.offsetTop):(a=i.width,c=i.height,p&&(u=i.offsetLeft,d=i.offsetTop))}if(Ao(s)<=0){const p=s.ownerDocument,m=p.body,g=getComputedStyle(m),x=p.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(s.clientWidth-m.clientWidth-x),v=getComputedStyle(s).scrollbarGutter==="stable both-edges"?y/2:y;v<=Sp&&(a-=v)}return{width:a,height:c,x:u,y:d}}function Ep(e,t){const n=Ut(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=Qt(e),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=r*s.x,u=o*s.y;return{width:i,height:a,x:c,y:u}}function fi(e,t,n){let o;if(t==="viewport"||t==="layoutViewport")o=Tp(e,n,t);else if(t==="document")o=wp(Ct(e));else if(we(t))o=Ep(t,n);else{const r=tc(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return co(o)}function Rp(e,t){const n=t.get(e);if(n)return n;let o=wn(e,[],!1).filter(a=>we(a)&&Be(a)!=="body"),r=null;const s=Je(e).position==="fixed";let i=s?Tt(e):e;for(;we(i)&&!xt(i);){const a=Je(i),c=Wr(i),u=r?r.position:s?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&a.position==="static")?o=o.filter(h=>h!==i):r=a,i=Tt(i)}return t.set(e,o),o}function Cp(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[...n==="clippingAncestors"?Ro(t)?[]:Rp(t,this._c):[].concat(n),o],a=fi(t,i[0],r);let c=a.top,u=a.right,d=a.bottom,h=a.left;for(let p=1;p<i.length;p++){const m=fi(t,i[p],r);c=bt(m.top,c),u=on(m.right,u),d=on(m.bottom,d),h=bt(m.left,h)}return{width:u-h,height:d-c,x:h,y:c}}function kp(e){const{width:t,height:n}=ec(e);return{width:t,height:n}}function Pp(e,t,n){const o=Pe(t),r=Ct(t),s=n==="fixed",i=Ut(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=vt(0);if((o||!s)&&((Be(t)!=="body"||An(r))&&(a=Co(t)),o)){const p=Ut(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}!o&&r&&(c.x=Ao(r));const u=r&&!o&&!s?nc(r,a):vt(0),d=i.left+a.scrollLeft-c.x-u.x,h=i.top+a.scrollTop-c.y-u.y;return{x:d,y:h,width:i.width,height:i.height}}function Xo(e){return Je(e).position==="static"}function pi(e,t){if(!Pe(e)||Je(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ct(e)===n&&(n=n.ownerDocument.body),n}function oc(e,t){const n=Ie(e);if(Ro(e))return n;if(!Pe(e)){let r=Tt(e);for(;r&&!xt(r);){if(we(r)&&!Xo(r))return r;r=Tt(r)}return n}let o=pi(e,t);for(;o&&Rd(o)&&Xo(o);)o=pi(o,t);return o&&xt(o)&&Xo(o)&&!Wr(o)?n:o||Pd(e)||n}const Op=async function(e){const t=this.getOffsetParent||oc,n=this.getDimensions,o=await n(e.floating);return{reference:Pp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Ip(e){return Je(e).direction==="rtl"}const Mp={convertOffsetParentRelativeRectToViewportRelativeRect:bp,getDocumentElement:Ct,getClippingRect:Cp,getOffsetParent:oc,getElementRects:Op,getClientRects:vp,getDimensions:kp,getScale:Qt,isElement:we,isRTL:Ip};function rc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ap(e,t,n){let o=null,r;const s=Ct(e);function i(){var d;clearTimeout(r),(d=o)==null||d.disconnect(),o=null}function a(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),i();const p=e.getBoundingClientRect(),{left:m,top:g,width:x,height:y}=p;if(d||t(),!x||!y)return;const v=Kn(g),S=Kn(s.clientWidth-(m+x)),b=Kn(s.clientHeight-(g+y)),w=Kn(m),E={rootMargin:-v+"px "+-S+"px "+-b+"px "+-w+"px",threshold:bt(0,on(1,h))||1};let C=!0;function R(j){const D=j[0].intersectionRatio;if(!rc(p,e.getBoundingClientRect()))return a();if(D!==h){if(!C)return a();D?a(!1,D):r=setTimeout(()=>{a(!1,1e-7)},1e3)}C=!1}try{o=new IntersectionObserver(R,{...E,root:s.ownerDocument})}catch{o=new IntersectionObserver(R,E)}o.observe(e)}const c=Ie(e),u=()=>a(n);return c.addEventListener("resize",u),a(!0),()=>{c.removeEventListener("resize",u),i()}}function hi(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,u=us(e),d=r||s?[...u?wn(u):[],...t?wn(t):[]]:[];d.forEach(v=>{r&&v.addEventListener("scroll",n),s&&v.addEventListener("resize",n)});const h=u&&a?Ap(u,n,s):null;let p=-1,m=null;i&&(m=new ResizeObserver(v=>{let[S]=v;S&&S.target===u&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var b;(b=m)==null||b.observe(t)})),n()}),u&&!c&&m.observe(u),t&&m.observe(t));let g,x=c?Ut(e):null;c&&y();function y(){const v=Ut(e);x&&!rc(x,v)&&n(),x=v,g=requestAnimationFrame(y)}return n(),()=>{var v;d.forEach(S=>{r&&S.removeEventListener("scroll",n),s&&S.removeEventListener("resize",n)}),h?.(),(v=m)==null||v.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const Np=pp,jp=hp,Dp=dp,Lp=mp,Fp=gp,_p=(e,t,n)=>{const o=new Map,r=n??{},s={...Mp,...r.platform,_c:o};return up(e,t,{...r,platform:s})};var Hp=typeof document<"u",Bp=function(){},to=Hp?l.useLayoutEffect:Bp;function fo(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,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!fo(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!fo(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function sc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gi(e,t){const n=sc(e);return Math.round(t*n)/n}function qo(e){const t=l.useRef(e);return to(()=>{t.current=e}),t}function $p(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[d,h]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=l.useState(o);fo(p,o)||m(o);const[g,x]=l.useState(null),[y,v]=l.useState(null),S=l.useCallback(I=>{I!==E.current&&(E.current=I,x(I))},[]),b=l.useCallback(I=>{I!==C.current&&(C.current=I,v(I))},[]),w=s||g,T=i||y,E=l.useRef(null),C=l.useRef(null),R=l.useRef(d),j=c!=null,D=qo(c),H=qo(r),P=qo(u),L=l.useCallback(()=>{if(!E.current||!C.current)return;const I={placement:t,strategy:n,middleware:p};H.current&&(I.platform=H.current),_p(E.current,C.current,I).then(A=>{const U={...A,isPositioned:P.current!==!1};F.current&&!fo(R.current,U)&&(R.current=U,rt.flushSync(()=>{h(U)}))})},[p,t,n,H,P]);to(()=>{u===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,h(I=>({...I,isPositioned:!1})))},[u]);const F=l.useRef(!1);to(()=>(F.current=!0,()=>{F.current=!1}),[]),to(()=>{if(w&&(E.current=w),T&&(C.current=T),w&&T){if(D.current)return D.current(w,T,L);L()}},[w,T,L,D,j]);const O=l.useMemo(()=>({reference:E,floating:C,setReference:S,setFloating:b}),[S,b]),_=l.useMemo(()=>({reference:w,floating:T}),[w,T]),N=l.useMemo(()=>{const I={position:n,left:0,top:0};if(!_.floating)return I;const A=gi(_.floating,d.x),U=gi(_.floating,d.y);return a?{...I,transform:"translate("+A+"px, "+U+"px)",...sc(_.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:A,top:U}},[n,a,_.floating,d.x,d.y]);return l.useMemo(()=>({...d,update:L,refs:O,elements:_,floatingStyles:N}),[d,L,O,_,N])}const zp=(e,t)=>{const n=Np(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wp=(e,t)=>{const n=jp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Up=(e,t)=>({fn:Fp(e).fn,options:[e,t]}),Kp=(e,t)=>{const n=Dp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vp=(e,t)=>{const n=Lp(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Zo={exports:{}},Jo={};var mi;function Yp(){if(mi)return Jo;mi=1;var e=ia();function t(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(h,p){var m=p(),g=o({inst:{value:m,getSnapshot:p}}),x=g[0].inst,y=g[1];return s(function(){x.value=m,x.getSnapshot=p,c(x)&&y({inst:x})},[h,m,p]),r(function(){return c(x)&&y({inst:x}),h(function(){c(x)&&y({inst:x})})},[h]),i(m),m}function c(h){var p=h.getSnapshot;h=h.value;try{var m=p();return!n(h,m)}catch{return!0}}function u(h,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return Jo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Jo}var yi;function ic(){return yi||(yi=1,Zo.exports=Yp()),Zo.exports}var ds=ic(),Qo={exports:{}},er={};var xi;function Gp(){if(xi)return er;xi=1;var e=ia(),t=ic();function n(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;return er.useSyncExternalStoreWithSelector=function(u,d,h,p,m){var g=s(null);if(g.current===null){var x={hasValue:!1,value:null};g.current=x}else x=g.current;g=a(function(){function v(E){if(!S){if(S=!0,b=E,E=p(E),m!==void 0&&x.hasValue){var C=x.value;if(m(C,E))return w=C}return w=E}if(C=w,o(b,E))return C;var R=p(E);return m!==void 0&&m(C,R)?(b=E,C):(b=E,w=R)}var S=!1,b,w,T=h===void 0?null:h;return[function(){return v(d())},T===null?void 0:function(){return v(T())}]},[d,h,p,m]);var y=r(u,g[0],g[1]);return i(function(){x.hasValue=!0,x.value=y},[y]),c(y),y},er}var bi;function Xp(){return bi||(bi=1,Qo.exports=Gp()),Qo.exports}var qp=Xp();const Zp=rs(19),Jp=Zp?eh:th;function ac(e,t,n,o,r){return Jp(e,t,n,o,r)}function Qp(e,t,n,o,r){const s=l.useCallback(()=>t(e.getSnapshot(),n,o,r),[e,t,n,o,r]);return ds.useSyncExternalStore(e.subscribe,s,s)}pd({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){const o=e.syncHooks[n],r=o.selector(o.store.state,o.a1,o.a2,o.a3);Object.is(o.value,r)||(t=!0,o.value=r)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const r of e.syncHooks)n.add(r.store);const o=[];for(const r of n)o.push(r.subscribe(t));return()=>{for(const r of o)r()}}),ds.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function eh(e,t,n,o,r){const s=fd();if(!s)return Qp(e,t,n,o,r);const i=s.syncIndex;s.syncIndex+=1;let a;return s.didInitialize?(a=s.syncHooks[i],(a.store!==e||a.selector!==t||!Object.is(a.a1,n)||!Object.is(a.a2,o)||!Object.is(a.a3,r))&&(a.store!==e&&(s.didChangeStore=!0),a.store=e,a.selector=t,a.a1=n,a.a2=o,a.a3=r,a.value=t(e.getSnapshot(),n,o,r))):(a={store:e,selector:t,a1:n,a2:o,a3:r,value:t(e.getSnapshot(),n,o,r)},s.syncHooks.push(a)),a.value}function th(e,t,n,o,r){return qp.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,o,r))}class nh{static create(t){return new this(t)}constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const o of this.listeners){if(n!==this.updateTick)return;o(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,o,r){return ac(this,t,n,o,r)}}class jn extends nh{constructor(t,n={},o){super(t),this.context=n,this.selectors=o}useSyncedValue(t,n){l.useDebugValue(t);const o=this;J(()=>{o.state[t]!==n&&o.set(t,n)},[o,t,n])}useSyncedValueWithCleanup(t,n){const o=this;J(()=>(o.state[t]!==n&&o.set(t,n),()=>{o.set(t,void 0)}),[o,t,n])}useSyncedValues(t){const n=this,o=Object.values(t);J(()=>{n.update(t)},[n,...o])}useControlledProp(t,n){l.useDebugValue(t);const o=this,r=n!==void 0;J(()=>{r&&!Object.is(o.state[t],n)&&o.setState({...o.state,[t]:n})},[o,t,n,r])}select(t,n,o,r){const s=this.selectors[t];return s(this.state,n,o,r)}useState(t,n,o,r){return l.useDebugValue(t),ac(this,this.selectors[t],n,o,r)}useContextCallback(t,n){l.useDebugValue(t);const o=le(n??Fr);this.context[t]=o}useStateSetter(t){const n=l.useRef(void 0);return n.current===void 0&&(n.current=o=>{this.set(t,o)}),n.current}observe(t,n){let o;typeof t=="function"?o=t:o=this.selectors[t];let r=o(this.state);return n(r,r,this),this.subscribe(s=>{const i=o(s);if(!Object.is(r,i)){const a=r;r=i,n(i,a,this)}})}}const oh={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};class cc extends jn{constructor(t){const{syncOnly:n,nested:o,onOpenChange:r,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Ga(),nested:o,triggerElements:s},oh),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&Ed(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const o={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",o)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function lc(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:o,floatingId:r,nested:s,onOpenChange:i}=e,a=t.useState("open"),c=t.useState("activeTriggerElement"),u=t.useState(n?"popupElement":"positionerElement"),d=t.context.triggerElements,h=i,p=l.useRef(null);o===void 0&&p.current===null&&(p.current=new cc({open:a,transitionStatus:void 0,referenceElement:c,floatingElement:u,triggerElements:d,onOpenChange:h,floatingId:r,syncOnly:!0,nested:s}));const m=o??p.current;return t.useSyncedValue("floatingId",r),J(()=>{const g={open:a,floatingId:r,referenceElement:c,floatingElement:u};we(c)&&(g.domReferenceElement=c),m.state.positionReference===m.state.referenceElement&&(g.positionReference=c),m.update(g)},[a,r,c,u,m]),m.context.onOpenChange=h,m.context.nested=s,m}function rh(e,t=!1,n=!1,o=!1){const[r,s]=l.useState(e&&t?"idle":void 0),[i,a]=l.useState(e&&!o);return e&&!i&&(a(!0),s("starting")),!e&&i&&r!=="ending"&&!n&&s("ending"),!e&&!i&&r==="ending"&&s(void 0),J(()=>{if(!e&&i&&r!=="ending"&&n){const c=ht.request(()=>{s("ending")});return()=>{ht.cancel(c)}}},[e,i,r,n]),J(()=>{if(!e||t)return;const c=ht.request(()=>{s(void 0)});return()=>{ht.cancel(c)}},[t,e]),J(()=>{if(!e||!t)return;e&&i&&r!=="idle"&&s("starting");const c=ht.request(()=>{s("idle")});return()=>{ht.cancel(c)}},[t,e,i,r]),{mounted:i,setMounted:a,transitionStatus:r}}let Yn=null;function sh(e){if(!Yn){const t=[];Yn=t,queueMicrotask(()=>{Yn=null,rt.flushSync(()=>{for(const n of t)n()})})}Yn.push(e)}function fs(e,t=!1,n=!1){const o=Sn();return le((r,s=null)=>{o.cancel();const i=yt(e);if(i==null)return;const a=i,c=()=>{if(!n){rt.flushSync(r);return}sh(()=>{s?.aborted||r()})};if(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function u(){Promise.all(a.getAnimations().map(d=>d.finished)).then(()=>{s?.aborted||c()},()=>{if(s?.aborted)return;if(a.getAnimations().some(h=>h.pending||h.playState!=="finished")){u();return}c()})}if(t){const d=ma;if(!a.hasAttribute(d)){o.request(u);return}const h=new MutationObserver(()=>{a.hasAttribute(d)||(h.disconnect(),u())});h.observe(a,{attributes:!0,attributeFilter:[d]}),s?.addEventListener("abort",()=>h.disconnect(),{once:!0});return}o.request(u)})}function Dn(e){const{enabled:t=!0,open:n,ref:o,batch:r=!1,onComplete:s}=e,i=le(s),a=fs(o,n,r);l.useEffect(()=>{if(!t)return;const c=new AbortController;return a(i,c.signal),()=>{c.abort()}},[t,n,i,a])}const ps={tabIndex:-1,[Sr]:""};function ih(e){return t=>t==="touch"?e.current:!0}function uc(e,t=!1){const n=Wt(),o=Vt()!=null,r=ze(()=>e(n,o)).current;return lc({popupStore:r,treatPopupAsFloatingElement:t,floatingRootContext:r.state.floatingRootContext,floatingId:n,nested:o,onOpenChange:r.setOpen}),r}function hs({handle:e,store:t}){return J(()=>e.attachStore(t),[e,t]),null}function vi(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function ah(e,t){const n=l.useRef(null);return le(o=>{const r=n.current;if(r!==null){if(r.element===o&&r.store===t&&r.id===e)return;n.current=null;const s=r.store;s.context.triggerElements.getById(r.id)===r.element&&(s.context.triggerElements.delete(r.id),vi(s))}o!==null&&e!==void 0&&(n.current={store:t,id:e,element:o},t.context.triggerElements.add(e,o),vi(t))})}function gs(e,t,n,o=!1){let r=e.preventUnmountingOnClose;t?r=!1:o&&(r=!0);const s=n?.id??null;let i=e.activeTriggerId,a=e.activeTriggerElement;return(s||t)&&(i=s,a=n??null),{open:t,preventUnmountingOnClose:r,activeTriggerId:i,activeTriggerElement:a}}function dc(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function ch(e,t,n,o={}){const r=n.reason,s=r===He,i=t&&r===Zt,a=!t&&(r===sn||r===Io),c=dc(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;o.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);const u=()=>{const d=gs(e.state,t,n.trigger,c()),h={...o.extraState,...d};i?h.instantType="focus":a?h.instantType="dismiss":s&&(h.instantType=void 0),e.update(h)};s?rt.flushSync(u):u()}function fc(e,t,n,o){const r=n.useState("isMountedByTrigger",e),s=ah(e,n),i=le(c=>{const u=n.select("open"),d=n.select("activeTriggerId");if(d===e){const h={activeTriggerElement:c,...u?o:null};n.update(h);return}if(d==null&&u){const h={activeTriggerId:e??null,activeTriggerElement:c,...o};n.update(h)}}),a=le(c=>{s(c),c&&i(c)});return J(()=>(a(t.current),()=>a(null)),[a,t,n,e]),J(()=>{if(r){const c={activeTriggerElement:t.current,...o};n.update(c)}},[r,n,t,...Object.values(o)]),{registerTrigger:a,isMountedByThisTrigger:r}}function ms(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,o=l.useRef(null),r=e.useState("open"),s=e.useState("triggerCount"),i=e.useState("activeTriggerId"),a=e.useState("activeTriggerElement");J(()=>{if(!r){o.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const c=e.context.triggerElements.size,u={};e.state.triggerCount!==c&&(u.triggerCount=c);const d=e.select("activeTriggerId");let h=null;if(d){const p=e.context.triggerElements.getById(d);if(p)o.current=d,p!==e.state.activeTriggerElement&&(u.activeTriggerElement=p);else{for(const[m,g]of e.context.triggerElements.entries())if(g===e.state.activeTriggerElement){u.activeTriggerId=m,u.activeTriggerElement=g,o.current=m;break}u.activeTriggerId===void 0&&(o.current===d?h=d:o.current=null)}}else o.current=null;if(!h&&!d&&c===1){const p=e.context.triggerElements.entries().next();if(!p.done){const[m,g]=p.value;u.activeTriggerId=m,u.activeTriggerElement=g,o.current=m}}(u.triggerCount!==void 0||u.activeTriggerId!==void 0||u.activeTriggerElement!==void 0)&&e.update(u),h&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===h&&!e.context.triggerElements.getById(h)){const p=Se(Xr);e.setOpen(!1,p),p.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,s,i,a,n])}function ys(e,t,n,o){const{mounted:r,setMounted:s,transitionStatus:i}=rh(e,!1,!1,o),a=t.useState("preventUnmountingOnClose"),c=e?!1:a;t.useSyncedValues({mounted:r,transitionStatus:i,preventUnmountingOnClose:c});const u=le(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Dn({enabled:r&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||u()}}),{forceUnmount:u,transitionStatus:i}}function xs(e,t){e.useSyncedValues(t),J(()=>()=>{e.update({activeTriggerProps:je,inactiveTriggerProps:je,popupProps:je})},[e])}function lh(e,t){J(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),J(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class bs{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function vs(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new cc({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,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:je,inactiveTriggerProps:je,popupProps:je}}const xn=e=>e.triggerIdProp??e.activeTriggerId,ws=e=>e.openProp??e.open,wi=e=>(e.popupElement?.id??e.floatingId)||void 0;function pc(e,t){return t!==void 0&&ws(e)&&xn(e)===t}function uh(e,t){return pc(e,t)?!0:t!==void 0&&ws(e)&&xn(e)==null&&e.triggerCount===1}const Ss={open:ws,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:xn,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:wi,isTriggerActive:(e,t)=>t!==void 0&&xn(e)===t,isOpenedByTrigger:(e,t)=>pc(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&xn(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>uh(e,t)?wi(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function hc(e){const t=l.useCallback(o=>e===void 0?Fr:e.subscribeStore(o),[e]),n=l.useCallback(()=>e===void 0?void 0:e.store,[e]);return ds.useSyncExternalStore(t,n,()=>e?.serverStore)}function dh(e){return fh(e,e.rootContext)}function fh(e,t){const{nodeId:n,externalTree:o}=e,r=t.useState("referenceElement"),s=t.useState("floatingElement"),i=t.useState("domReferenceElement"),a=t.useState("open"),c=t.useState("floatingId"),[u,d]=l.useState(null),[h,p]=l.useState(void 0),[m,g]=l.useState(void 0),x=l.useRef(null),y=Lt(o),v=l.useMemo(()=>({reference:r,floating:s,domReference:i}),[r,s,i]),S=$p({...e,elements:{...v,...u&&{reference:u}}}),b=we(h)?h:null,w=m===void 0?t.state.floatingElement:m;t.useSyncedValue("referenceElement",h??null),t.useSyncedValue("domReferenceElement",h===void 0?i:b),t.useSyncedValue("floatingElement",w);const T=l.useCallback(H=>{const P=we(H)?{getBoundingClientRect:()=>H.getBoundingClientRect(),getClientRects:()=>H.getClientRects(),contextElement:H}:H;d(P),S.refs.setReference(P)},[S.refs]),E=l.useCallback(H=>{(we(H)||H===null)&&(x.current=H,p(H)),(we(S.refs.reference.current)||S.refs.reference.current===null||H!==null&&!we(H))&&S.refs.setReference(H)},[S.refs,p]),C=l.useCallback(H=>{g(H),S.refs.setFloating(H)},[S.refs]),R=l.useMemo(()=>({...S.refs,setReference:E,setFloating:C,setPositionReference:T,domReference:x}),[S.refs,E,C,T]),j=l.useMemo(()=>({...S.elements,domReference:i}),[S.elements,i]),D=l.useMemo(()=>({...S,dataRef:t.context.dataRef,open:a,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:R,elements:j,nodeId:n,rootStore:t}),[S,R,j,n,t,a,c]);return J(()=>{i&&(x.current=i)},[i]),J(()=>{t.context.dataRef.current.floatingContext=D;const H=y?.nodesRef.current.find(P=>P.id===n);H&&(H.context=D)}),l.useMemo(()=>({...S,context:D,refs:R,elements:j,rootStore:t}),[S,R,j,D,t])}const tr=_r&&Dt;function gc(e,t={}){const{enabled:n=!0,delay:o}=t,r="rootStore"in e?e.rootStore:e,{events:s,dataRef:i}=r.context,a=l.useRef(!1),c=l.useRef(null),u=l.useRef(!0),d=We();l.useEffect(()=>{const p=r.select("domReferenceElement");if(!n)return;const m=Ie(p);function g(){const v=r.select("domReferenceElement");!r.select("open")&&Pe(v)&&v===_e(be(v))&&(a.current=!0,c.current=v)}function x(){u.current=!0}function y(){u.current=!1}return lt(me(m,"blur",g),tr&&me(m,"keydown",x,!0),tr&&me(m,"pointerdown",y,!0))},[r,n]),l.useEffect(()=>{if(!n)return;function p(m){if(m.reason===sn||m.reason===Io){const g=r.select("domReferenceElement");we(g)&&(c.current=g,a.current=!0)}}return s.on("openchange",p),()=>{s.off("openchange",p)}},[s,n,r]);const h=l.useMemo(()=>{function p(){a.current=!1,c.current=null}return{onMouseLeave(){p()},onFocus(m){const g=m.currentTarget;if(a.current){if(c.current===g)return;p()}const x=Ne(m.nativeEvent);if(we(x)){if(tr&&!m.relatedTarget){if(!u.current&&!Oo(x))return}else if(!so(x))return}const y=ro(m.relatedTarget,r.context.triggerElements),{nativeEvent:v,currentTarget:S}=m,b=typeof o=="function"?o():o;if(r.select("open")&&y||b===0||b===void 0){r.setOpen(!0,Se(Zt,v,S));return}d.start(b,()=>{a.current||r.setOpen(!0,Se(Zt,v,S))})},onBlur(m){p();const g=m.relatedTarget,x=m.nativeEvent,y=we(g)&&g.hasAttribute(Tn("focus-guard"))&&g.getAttribute("data-type")==="outside";d.start(0,()=>{const v=r.select("domReferenceElement"),S=_e(be(v));!g&&S===v||se(i.current.floatingContext?.refs.floating.current,S)||se(v,S)||y||ro(g??S,r.context.triggerElements)||r.setOpen(!1,Se(Zt,x))})}}},[i,o,r,d]);return l.useMemo(()=>n?{reference:h,trigger:h}:{},[n,h])}class Ts{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Ze,this.restTimeout=new Ze,this.handleCloseOptions=void 0}static create(){return new Ts}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const po=new WeakMap;function ho(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&po.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),po.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function mc(e,t){const{scopeElement:n,referenceElement:o,floatingElement:r}=t,s=po.get(n);s&&s!==e&&ho(s),ho(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=r,po.set(n,e),n.style.pointerEvents="none",o.style.pointerEvents="auto",r.style.pointerEvents="auto"}function Es(e){const t=e.context.dataRef.current,n=ze(()=>t.hoverInteractionState??Ts.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),wo(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function yc(e,t={}){const{enabled:n=!0,closeDelay:o=0,nodeId:r}=t,s="rootStore"in e?e.rootStore:e,i=s.useState("open"),a=s.useState("floatingElement"),c=s.useState("domReferenceElement"),{dataRef:u}=s.context,d=Lt(),h=Vt(),p=Es(s),m=We(),g=le(()=>xa(u.current.openEvent?.type,p.interactedInside)),x=le(()=>Kd(u.current.openEvent?.type)),y=le(()=>{ho(p)});J(()=>{i||(p.pointerType=void 0,p.restTimeoutPending=!1,p.interactedInside=!1,y())},[i,p,y]),l.useEffect(()=>y,[y]),J(()=>{if(n&&i&&p.handleCloseOptions?.blockPointerEvents&&x()&&we(c)&&a){const v=c,S=a,b=be(a),w=d?.nodesRef.current.find(R=>R.id===h)?.context?.elements.floating;w&&(w.style.pointerEvents="");const T=p.pointerEventsScopeElement!==S?p.pointerEventsScopeElement:null,E=w!==S?w:null,C=p.handleCloseOptions?.getScope?.()??T??E??v.closest("[data-rootownerid]")??b.body;return mc(p,{scopeElement:C,referenceElement:v,floatingElement:S}),()=>{y()}}},[n,i,c,a,p,x,d,h,y]),l.useEffect(()=>{if(!n)return;function v(){return!!(d&&h&&jt(d.nodesRef.current,h).length>0)}function S(R){const j=$t(o,"close",p.pointerType),D=()=>{s.setOpen(!1,Se(He,R)),d?.events.emit("floating.closed",R)};j?p.openChangeTimeout.start(j,D):(p.openChangeTimeout.clear(),D())}function b(R){const j=Ne(R);if(!Wd(j)){p.interactedInside=!1;return}p.interactedInside=j?.closest("[aria-haspopup]")!=null}function w(){p.openChangeTimeout.clear(),m.clear(),d?.events.off("floating.closed",E),y()}function T(R){if(v()&&d){d.events.on("floating.closed",E);return}if(ro(R.relatedTarget,s.context.triggerElements))return;const j=u.current.floatingContext?.nodeId??r,D=R.relatedTarget;if(!(d&&j&&we(D)&&jt(d.nodesRef.current,j,!1).some(P=>se(P.context?.elements.floating,D)))){if(p.handler){p.handler(R);return}y(),x()&&!g()&&S(R)}}function E(R){!d||!h||v()||m.start(0,()=>{d.events.off("floating.closed",E),s.setOpen(!1,Se(He,R)),d.events.emit("floating.closed",R)})}const C=a;return lt(C&&me(C,"mouseenter",w),C&&me(C,"mouseleave",T),C&&me(C,"pointerdown",b,!0),()=>{d?.events.off("floating.closed",E)})},[n,a,s,u,o,r,x,g,y,p,d,h,m])}const ph={current:null};function xc(e,t={}){const{enabled:n=!0,delay:o=0,handleClose:r=null,mouseOnly:s=!1,restMs:i=0,move:a=!0,triggerElementRef:c=ph,externalTree:u,isActiveTrigger:d=!0,getHandleCloseContext:h,isClosing:p,shouldOpen:m,guardStaleOpen:g=!1}=t,x="rootStore"in e?e.rootStore:e,{dataRef:y,events:v}=x.context,S=Lt(u),b=Es(x),w=l.useRef(!1),T=Fe(r),E=Fe(o),C=Fe(i),R=Fe(n),j=Fe(m),D=Fe(p),H=le(()=>xa(y.current.openEvent?.type,b.interactedInside)),P=le(()=>j.current?.()!==!1),L=le((_,N,I)=>{const A=x.context.triggerElements;if(A.hasElement(N))return!_||!se(_,N);if(!we(I))return!1;const U=I;return A.hasMatchingElement(W=>se(W,U))&&(!_||!se(_,U))}),F=le(()=>{if(!b.handler)return;be(x.select("domReferenceElement")).removeEventListener("mousemove",b.handler),b.handler=void 0}),O=le(()=>{ho(b)});return d&&(b.handleCloseOptions=r?.__options),l.useEffect(()=>F,[F]),l.useEffect(()=>{if(!n)return;function _(N){N.open?w.current=!1:(w.current=N.reason===He,F(),b.openChangeTimeout.clear(),b.restTimeout.clear(),b.blockMouseMove=!0,b.restTimeoutPending=!1)}return v.on("openchange",_),()=>{v.off("openchange",_)}},[n,v,b,F]),l.useEffect(()=>{if(!n)return;function _(ne,oe=!0){const z=$t(E.current,"close",b.pointerType);z?b.openChangeTimeout.start(z,()=>{x.setOpen(!1,Se(He,ne)),S?.events.emit("floating.closed",ne)}):oe&&(b.openChangeTimeout.clear(),x.setOpen(!1,Se(He,ne)),S?.events.emit("floating.closed",ne))}const N=c.current??(d?x.select("domReferenceElement"):null);if(!we(N))return;function I(ne){if(b.openChangeTimeout.clear(),b.blockMouseMove=!1,s&&!At(b.pointerType))return;const oe=Ks(C.current),z=$t(E.current,"open",b.pointerType),Q=Ne(ne),K=ne.currentTarget??null,ge=x.select("domReferenceElement");let Y=K;if(we(Q)&&!x.context.triggerElements.hasElement(Q)){for(const q of x.context.triggerElements.elements())if(se(q,Q)){Y=q;break}}we(K)&&we(ge)&&!x.context.triggerElements.hasElement(K)&&se(K,ge)&&(Y=ge);const ce=Y==null?!1:L(ge,Y,Q),ue=x.select("open"),ye=D.current?.()??x.select("transitionStatus")==="ending",re=!ue&&ye&&w.current,X=!ce&&we(Y)&&we(ge)&&se(ge,Y)&&re,he=oe>0&&!z,fe=ce&&(ue||re)||X,ve=!ue||ce;if(fe){P()&&x.setOpen(!0,Se(He,ne,Y));return}he||(z?b.openChangeTimeout.start(z,()=>{ve&&P()&&x.setOpen(!0,Se(He,ne,Y))}):ve&&P()&&x.setOpen(!0,Se(He,ne,Y)))}function A(ne){if(H()){O();return}F();const oe=x.select("domReferenceElement"),z=be(oe);b.restTimeout.clear(),b.restTimeoutPending=!1;const Q=y.current.floatingContext??h?.();if(ro(ne.relatedTarget,x.context.triggerElements))return;if(T.current&&Q){x.select("open")||b.openChangeTimeout.clear();const ge=c.current;b.handler=T.current({...Q,tree:S,x:ne.clientX,y:ne.clientY,onClose(){O(),F(),R.current&&!H()&&ge===x.select("domReferenceElement")&&_(ne,!0)}}),z.addEventListener("mousemove",b.handler),b.handler(ne);return}(b.pointerType!=="touch"||!se(x.select("floatingElement"),ne.relatedTarget))&&_(ne)}function U(ne){se(N,ne.relatedTarget)||(b.openChangeTimeout.clear(),b.restTimeout.clear(),b.restTimeoutPending=!1)}const W=g?me(N,"mouseout",U):void 0;return a?lt(me(N,"mousemove",I,{once:!0}),me(N,"mouseenter",I),me(N,"mouseleave",A),W):lt(me(N,"mouseenter",I),me(N,"mouseleave",A),W)},[F,O,y,E,x,n,T,b,d,L,H,s,a,C,c,S,R,h,D,P,g]),l.useMemo(()=>{if(!n)return;function _(N){b.pointerType=N.pointerType}return{onPointerDown:_,onPointerEnter:_,onMouseMove(N){const{nativeEvent:I}=N,A=N.currentTarget,U=x.select("domReferenceElement"),W=x.select("open"),ne=L(U,A,N.target);if(s&&!At(b.pointerType))return;if(W&&ne&&b.handleCloseOptions?.blockPointerEvents){const Q=x.select("floatingElement");if(Q){const K=b.handleCloseOptions?.getScope?.()??A.ownerDocument.body;mc(b,{scopeElement:K,referenceElement:A,floatingElement:Q})}}const oe=Ks(C.current);if(W&&!ne||oe===0||!ne&&b.restTimeoutPending&&N.movementX**2+N.movementY**2<2)return;b.restTimeout.clear();function z(){if(b.restTimeoutPending=!1,H())return;const Q=x.select("open");!b.blockMouseMove&&(!Q||ne)&&P()&&x.setOpen(!0,Se(He,I,A))}b.pointerType==="touch"?rt.flushSync(()=>{z()}):ne&&W?z():(b.restTimeoutPending=!0,b.restTimeout.start(oe,z))}}},[n,b,H,L,s,x,C,P])}const hh="Escape";function Si(e){return Dt&&e.movementX===0&&e.movementY===0}function No(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Gn(e,t){return No(t,e===ga||e===Kr,e===ko||e===Po)}function nr(e,t,n){return No(t,e===Kr,n?e===ko:e===Po)||e==="Enter"||e===" "||e===""}function gh(e,t,n){return No(t,n?e===ko:e===Po,e===Kr)}function mh(e,t,n,o){const r=n?e===Po:e===ko,s=e===ga;return t==="both"||t==="horizontal"&&o?e===hh:No(t,r,s)}function yh(e,t){const{listRef:n,activeIndex:o,onNavigate:r=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:a=!1,loopFocus:c=!1,nested:u=!1,rtl:d=!1,virtual:h=!1,focusItemOnOpen:p="auto",focusItemOnHover:m=!0,openOnArrowKeyDown:g=!0,disabledIndices:x=void 0,orientation:y="vertical",parentOrientation:v,id:S,resetOnPointerLeave:b=!0,externalTree:w,grid:T}=t,E=T!=null,C="rootStore"in e?e.rootStore:e,R=C.useState("open"),j=C.useState("floatingElement"),D=C.useState("domReferenceElement"),H=C.context.dataRef,P=Rr(j),L=Er(D),F=Fe(P),O=Vt(),_=Lt(w),N=l.useRef(p),I=l.useRef(i??-1),A=l.useRef(null),U=l.useRef(!0),W=le($=>{r(I.current===-1?null:I.current,$)}),ne=l.useRef(!!j),oe=l.useRef(R),z=l.useRef(!1),Q=l.useRef(!1),K=l.useRef(null),ge=Fe(x),Y=Fe(R),ce=Fe(i),ue=Fe(b),ye=Sn(),re=Sn(),X=le(()=>{function $(G){h?_?.events.emit("virtualfocus",G):K.current=eo(G,{sync:z.current,preventScroll:!0})}const V=n.current[I.current],B=Q.current;V&&$(V),(z.current?G=>G():G=>ye.request(G))(()=>{const G=n.current[I.current]||V;if(!G)return;V||$(G),Z&&(B||!U.current)&&G.scrollIntoView?.({block:"nearest",inline:"nearest"})})});J(()=>{H.current.orientation=y},[H,y]),J(()=>{s&&(R&&j?(I.current=i??-1,N.current&&i!=null&&(Q.current=!0,W())):ne.current&&(I.current=-1,W()))},[s,R,j,i,W]),J(()=>{if(s){if(!R){z.current=!1;return}if(j)if(o==null){if(z.current=!1,ce.current!=null)return;if(ne.current&&(I.current=-1,X()),(!oe.current||!ne.current)&&N.current&&(A.current!=null||N.current===!0&&A.current==null)){let $=0;const V=()=>{n.current[0]==null?($<2&&($?M=>re.request(M):queueMicrotask)(V),$+=1):(I.current=A.current==null||nr(A.current,y,d)||u?Ko(n):Xs(n),A.current=null,W())};V()}}else Gs(n.current,o)||(I.current=o,X(),Q.current=!1)}},[s,R,j,o,ce,u,n,y,d,W,X,re]),J(()=>{if(!s||j||!_||h||!ne.current)return;const $=_.nodesRef.current,V=$.find(G=>G.id===O)?.context?.elements.floating,B=_e(be(D??V??null)),M=$.some(G=>G.context&&se(G.context.elements.floating,B));V&&!M&&U.current&&V.focus({preventScroll:!0})},[s,j,D,_,O,h]),J(()=>{oe.current=R,ne.current=!!j}),J(()=>{R||(A.current=null,N.current=p)},[R,p]);const he=o!=null,fe=le($=>{if(!Y.current)return;const V=n.current.indexOf($.currentTarget);V!==-1&&(I.current!==V||o!==V)&&(I.current=V,W($))}),ve=le(()=>v??_?.nodesRef.current.find($=>$.id===O)?.context?.dataRef?.current.orientation),q=le(()=>Ko(n,ge.current)),de=le($=>{if(U.current=!1,z.current=!0,$.which===229||!Y.current&&$.currentTarget===F.current)return;if(u&&mh($.key,y,d,E)){Gn($.key,ve())||pt($),C.setOpen(!1,Se(Cr,$.nativeEvent)),Pe(D)&&(h?_?.events.emit("virtualfocus",D):D.focus());return}const V=I.current,B=Ko(n,x),M=Xs(n,x);if(L||($.key==="Home"&&(pt($),I.current=B,W($)),$.key==="End"&&(pt($),I.current=M,W($))),T!=null){const G=T($,I.current,n,y,c,d,x,B,M);if(G!=null&&(I.current=G,W($)),y==="both")return}if(Gn($.key,y)){if(pt($),R&&!h&&_e($.currentTarget.ownerDocument)===$.currentTarget){I.current=nr($.key,y,d)?B:M,W($);return}nr($.key,y,d)?c?V>=M?a&&V!==n.current.length?I.current=-1:(z.current=!1,I.current=B):I.current=qt(n.current,{startingIndex:V,disabledIndices:x}):I.current=Math.min(M,qt(n.current,{startingIndex:V,disabledIndices:x})):c?V<=B?a&&V!==-1?I.current=n.current.length:(z.current=!1,I.current=M):I.current=qt(n.current,{startingIndex:V,decrement:!0,disabledIndices:x}):I.current=Math.max(B,qt(n.current,{startingIndex:V,decrement:!0,disabledIndices:x})),Gs(n.current,I.current)&&(I.current=-1),W($)}}),Z=l.useMemo(()=>({onFocus(V){z.current=!0,fe(V)},onClick:({currentTarget:V})=>V.focus({preventScroll:!0}),onMouseMove(V){Si(V)||(z.current=!0,Q.current=!1,m&&fe(V))},onPointerLeave(V){if(!Y.current||!U.current||V.pointerType==="touch")return;z.current=!0;const B=V.relatedTarget;if(!(!m||n.current.includes(B))&&ue.current&&(K.current?.(),K.current=null,I.current=-1,W(V),!h)){const M=F.current,G=_e(be(M));M&&se(M,G)&&M.focus({preventScroll:!0})}}}),[fe,Y,F,m,n,W,ue,h]),te=l.useMemo(()=>h&&R&&he&&{"aria-activedescendant":`${S}-${o}`},[h,R,he,S,o]),ae=l.useMemo(()=>({...L?{}:te,onKeyDown($){if($.key==="Tab"&&$.shiftKey&&R&&!h){const V=Ne($.nativeEvent);if(V&&!se(F.current,V))return;pt($),C.setOpen(!1,Se(tn,$.nativeEvent)),Pe(D)&&D.focus();return}de($)},onPointerMove($){Si($)||(U.current=!0)}}),[te,de,F,L,C,R,h,D]),Ee=l.useMemo(()=>{function $(M){C.setOpen(!0,Se(Cr,M.nativeEvent,M.currentTarget))}function V(M){p==="auto"&&Br(M.nativeEvent)&&(N.current=!h)}function B(M){N.current=p,p==="auto"&&$r(M.nativeEvent)&&(N.current=!0)}return{onKeyDown(M){const G=C.select("open");U.current=!1;const pe=M.key.startsWith("Arrow"),Ue=gh(M.key,ve(),d),Qe=Gn(M.key,y),Le=(u?Ue:Qe)||M.key==="Enter"||M.key.trim()==="";if(h&&G)return de(M);if(!(!G&&!g&&pe)){if(Le){const ee=Gn(M.key,ve());A.current=u&&ee?null:M.key}if(u){Ue&&(pt(M),G?(I.current=q(),W(M)):$(M));return}Qe&&(ce.current!=null&&(I.current=ce.current),pt(M),!G&&g?$(M):de(M),G&&W(M))}},onFocus(M){C.select("open")&&!h&&(I.current=-1,W(M))},onPointerDown:B,onPointerEnter:B,onMouseDown:V,onClick:V}},[de,p,q,u,W,C,g,y,ve,d,ce,h]),ie=l.useMemo(()=>({...te,...Ee}),[te,Ee]);return l.useMemo(()=>s?{reference:ie,floating:ae,item:Z,trigger:Ee}:{},[s,ie,ae,Ee,Z])}function xh(e,t){const{listRef:n,elementsRef:o,activeIndex:r,onMatch:s,disabledIndices:i,onTyping:a,enabled:c=!0,resetMs:u=750,selectedIndex:d=null}=t,h="rootStore"in e?e.rootStore:e,p=h.useState("open"),m=We(),g=l.useRef(""),x=l.useRef(d??r??-1),y=l.useRef(null),v=le(w=>{function T(F){return o?.current[F]}function E(F){const O=T(F);return O&&!Mo(O)||O?.matches(":disabled")?!1:i==null||!Ca(bn,F,i)}function C(F,O,_=0){if(F.length===0)return-1;const N=(_%F.length+F.length)%F.length,I=O.toLowerCase();for(let A=0;A<F.length;A+=1){const U=(N+A)%F.length;if(!(!F[U]?.toLowerCase().startsWith(I)||!E(U)))return U}return-1}const R=n.current;if(g.current.length>0&&w.key===" "&&(pt(w),a?.(!0)),g.current.length>0&&g.current[0]!==" "&&C(R,g.current)===-1&&w.key!==" "&&a?.(!1),R==null||w.key.length!==1||w.ctrlKey||w.metaKey||w.altKey)return;p&&w.key!==" "&&(pt(w),a?.(!0));const j=g.current==="";j&&(x.current=d??r??-1),R.every((F,O)=>F&&E(O)?F[0]?.toLowerCase()!==F[1]?.toLowerCase():!0)&&g.current===w.key&&(g.current="",x.current=y.current),g.current+=w.key,m.start(u,()=>{g.current="",x.current=y.current,a?.(!1)});const P=((j?d??r??-1:x.current)??0)+1,L=C(R,g.current,P);L!==-1?(s?.(L),y.current=L):w.key!==" "&&(g.current="",a?.(!1))}),S=le(w=>{const T=w.relatedTarget,E=h.select("domReferenceElement"),C=h.select("floatingElement");se(E,T)||se(C,T)||(m.clear(),g.current="",x.current=y.current,a?.(!1))});J(()=>{!p&&d!==null||(m.clear(),y.current=null,g.current!==""&&(g.current=""))},[p,d,m]);const b=l.useMemo(()=>({onKeyDown:v,onBlur:S}),[v,S]);return l.useMemo(()=>c?{reference:b,floating:b}:{},[c,b])}const Ti=.1,bh=Ti*Ti,ke=.5;function Xn(e,t,n,o,r,s){return o>=t!=s>=t&&e<=(r-n)*(t-o)/(s-o)+n}function qn(e,t,n,o,r,s,i,a,c,u){let d=!1;return Xn(e,t,n,o,r,s)&&(d=!d),Xn(e,t,r,s,i,a)&&(d=!d),Xn(e,t,i,a,c,u)&&(d=!d),Xn(e,t,c,u,n,o)&&(d=!d),d}function vh(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Zn(e,t,n,o,r,s){const i=Math.min(n,r),a=Math.max(n,r),c=Math.min(o,s),u=Math.max(o,s);return e>=i&&e<=a&&t>=c&&t<=u}function bc(e={}){const{blockPointerEvents:t=!1}=e,n=new Ze,o=({x:r,y:s,placement:i,elements:a,onClose:c,nodeId:u,tree:d})=>{const h=i?.split("-")[0];let p=!1,m=null,g=null,x=typeof performance<"u"?performance.now():0;function y(S,b){const w=performance.now(),T=w-x;if(m===null||g===null||T===0)return m=S,g=b,x=w,!1;const E=S-m,C=b-g,R=E*E+C*C,j=T*T*bh;return m=S,g=b,x=w,R<j}function v(){n.clear(),c()}return function(b){n.clear();const w=a.domReference,T=a.floating;if(!w||!T||h==null||r==null||s==null)return;const{clientX:E,clientY:C}=b,R=Ne(b),j=b.type==="mouseleave",D=se(T,R),H=se(w,R);if(D&&(p=!0,!j))return;if(H&&(p=!1,!j)){p=!0;return}if(j&&we(b.relatedTarget)&&se(T,b.relatedTarget))return;function P(){return!!(d&&jt(d.nodesRef.current,u).length>0)}function L(){P()||v()}if(P())return;const F=w.getBoundingClientRect(),O=T.getBoundingClientRect(),_=r>O.right-O.width/2,N=s>O.bottom-O.height/2,I=O.width>F.width,A=O.height>F.height,U=(I?F:O).left,W=(I?F:O).right,ne=(A?F:O).top,oe=(A?F:O).bottom;if(h==="top"&&s>=F.bottom-1||h==="bottom"&&s<=F.top+1||h==="left"&&r>=F.right-1||h==="right"&&r<=F.left+1){L();return}let z=!1;switch(h){case"top":z=Zn(E,C,U,F.top+1,W,O.bottom-1);break;case"bottom":z=Zn(E,C,U,O.top+1,W,F.bottom-1);break;case"left":z=Zn(E,C,O.right-1,oe,F.left+1,ne);break;case"right":z=Zn(E,C,F.right-1,oe,O.left+1,ne);break}if(z)return;if(p&&!vh(E,C,F)){L();return}if(!j&&y(E,C)){L();return}let Q=!1;switch(h){case"top":{const K=I?ke/2:ke*4,ge=I||_?r+K:r-K,Y=I?r-K:_?r+K:r-K,ce=s+ke+1,ue=_||I?O.bottom-ke:O.top,ye=_?I?O.bottom-ke:O.top:O.bottom-ke;Q=qn(E,C,ge,ce,Y,ce,O.left,ue,O.right,ye);break}case"bottom":{const K=I?ke/2:ke*4,ge=I||_?r+K:r-K,Y=I?r-K:_?r+K:r-K,ce=s-ke,ue=_||I?O.top+ke:O.bottom,ye=_?I?O.top+ke:O.bottom:O.top+ke;Q=qn(E,C,ge,ce,Y,ce,O.left,ue,O.right,ye);break}case"left":{const K=A?ke/2:ke*4,ge=A||N?s+K:s-K,Y=A?s-K:N?s+K:s-K,ce=r+ke+1,ue=N||A?O.right-ke:O.left,ye=N?A?O.right-ke:O.left:O.right-ke;Q=qn(E,C,ue,O.top,ye,O.bottom,ce,ge,ce,Y);break}case"right":{const K=A?ke/2:ke*4,ge=A||N?s+K:s-K,Y=A?s-K:N?s+K:s-K,ce=r-ke,ue=N||A?O.left+ke:O.right,ye=N?A?O.left+ke:O.right:O.left+ke;Q=qn(E,C,ce,ge,ce,Y,ue,O.top,ye,O.bottom);break}}Q?p||n.start(40,L):L()}};return o.__options={...e,blockPointerEvents:t},o}const wh={...Ss,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,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class Sh extends jn{constructor(t,n,o){const r=new bs;super(Th(t,r,n,o),Eh(r),wh)}setOpen=(t,n)=>{ch(this,t,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,Se(sn,t))}}function Th(e,t,n,o=!1){return{...vs(t,n,o),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function Eh(e){return{popupRef:l.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const Rh=bo(function(t){const{disabled:n=!1,defaultOpen:o=!1,open:r,disableHoverablePopup:s=!1,trackCursorAxis:i="none",actionsRef:a,onOpenChange:c,onOpenChangeComplete:u,handle:d,triggerId:h,defaultTriggerId:p=null,children:m}=t,g=uc((H,P)=>new Sh({open:o,openProp:r,activeTriggerId:p,triggerIdProp:h},H,P));g.useControlledProp("openProp",r),g.useControlledProp("triggerIdProp",h),g.useContextCallback("onOpenChange",c),g.useContextCallback("onOpenChangeComplete",u);const x=g.useState("open"),y=!n&&x,v=g.useState("activeTriggerId"),S=g.useState("mounted"),b=g.useState("payload");g.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:s,disabled:n}),ms(g,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:w,transitionStatus:T}=ys(y,g),E=g.useState("isInstantPhase"),C=g.useState("instantType"),R=g.useState("lastOpenChangeReason"),j=l.useRef(null);J(()=>{x&&n&&g.setOpen(!1,Se(Gd))},[x,n,g]),J(()=>{T==="ending"&&R===Xr||T!=="ending"&&E?(C!=="delay"&&(j.current=C),g.set("instantType","delay")):j.current!==null&&(g.set("instantType",j.current),j.current=null)},[T,E,R,C,g]),J(()=>{y&&v==null&&g.set("payload",void 0)},[g,v,y]),l.useImperativeHandle(a,()=>({unmount:w,close:()=>g.setOpen(!1,Se(Zr))}),[w,g]);const D=y||S||!n&&i!=="none";return f.jsxs(fa.Provider,{value:g,children:[d&&f.jsx(hs,{handle:d,store:g}),D&&f.jsx(Ch,{store:g,disabled:n,trackCursorAxis:i}),typeof m=="function"?m({payload:b}):m]})});function Ch({store:e,disabled:t,trackCursorAxis:n}){const o=e.useState("floatingRootContext"),r=ls(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),s=sp(o,{enabled:!t&&n!=="none",axis:n==="none"?void 0:n}),i=l.useMemo(()=>wt(s.reference,r.reference),[s.reference,r.reference]);return xs(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:r.floating??je}),null}function Ln(e){return Wt(e,"base-ui")}const vc=l.createContext(void 0);function kh(){return l.useContext(vc)}const Ph=600,wc="data-base-ui-tooltip-trigger";function Ei(e){if("composedPath"in e){const n=e.composedPath();for(let o=0;o<n.length;o+=1){const r=n[o];if(we(r))return r}}const t=e.target;return we(t)?t:null}function Oh(e){let t=e;for(;t;){const n=t.closest(`[${wc}]`);if(n)return n;const o=t.getRootNode();t="host"in o&&we(o.host)?o.host:null}return null}const Ih=da(function(t,n){const{render:o,className:r,style:s,handle:i,payload:a,disabled:c,delay:u,closeOnClick:d=!0,closeDelay:h,id:p,...m}=t,g=vo(!0),y=hc(i)??g;if(!y)throw new Error(Ye(82));const v=Ln(p),S=y.useState("isTriggerActive",v),b=y.useState("isOpenedByTrigger",v),w=y.useState("floatingRootContext"),T=l.useRef(null),E=h??0,{registerTrigger:C,isMountedByThisTrigger:R}=fc(v,T,y,{payload:a,closeOnClick:d,closeDelay:E}),j=kh(),{activeIdRef:D,delayRef:H,isInstantPhase:P,hasProvider:L}=Zd(w,{open:b}),F=Es(w);y.useSyncedValue("isInstantPhase",P);const O=y.useState("disabled"),_=c??O,N=Fe(_),I=y.useState("trackCursorAxis"),A=y.useState("disableHoverablePopup"),U=l.useRef(!1),W=We(),ne=l.useRef(void 0);function oe(){return L&&D.current!=null?0:u??j??Ph}function z(X){const he=T.current;if(!he||!X)return!1;const fe=Oh(X);return fe!==null&&fe!==he&&se(he,fe)}function Q(X){const he=z(X);return U.current=he,he&&(F.openChangeTimeout.clear(),F.restTimeout.clear(),F.restTimeoutPending=!1,W.clear()),he}const K=xc(w,{enabled:!_,mouseOnly:!0,move:!1,handleClose:!A&&I!=="both"?bc():null,restMs:oe,delay(){return h==null&&L?{close:$t(H.current,"close")}:{close:E}},triggerElementRef:T,isActiveTrigger:S,isClosing:()=>y.select("transitionStatus")==="ending",shouldOpen(){return!U.current}}),ge=gc(w,{enabled:!_}).reference,Y=X=>{const he=U.current,fe=Ei(X),ve=Q(fe),q=T.current,de=q&&fe&&se(q,fe);if(ve&&y.select("open")&&y.select("lastOpenChangeReason")===He){y.setOpen(!1,Se(He,X));return}if(he&&!ve&&de&&!N.current&&!y.select("open")&&q&&At(ne.current)){const Z=()=>{!U.current&&!N.current&&!y.select("open")&&y.setOpen(!0,Se(He,X,q))},te=oe();te===0?(W.clear(),Z()):W.start(te,Z)}},ce=y.useState("triggerProps",R);return De("button",t,{state:{open:b},ref:[n,C,T],props:[K,ge,R||I!=="none"?ce:void 0,{onMouseOver(X){Y(X.nativeEvent)},onFocus(X){z(Ei(X.nativeEvent))&&X.preventBaseUIHandler()},onMouseLeave(){U.current=!1,W.clear(),ne.current=void 0},onPointerEnter(X){ne.current=X.pointerType},onPointerDown(X){ne.current=X.pointerType,y.set("closeOnClick",d),d&&!y.select("open")&&y.cancelPendingOpen(X.nativeEvent)},onClick(X){d&&!y.select("open")&&y.cancelPendingOpen(X.nativeEvent)},id:v,[Tr]:_?"":void 0,[wc]:_?void 0:""},m],stateAttributesMapping:$d})}),Sc=l.createContext(void 0);function Mh(){const e=l.useContext(Sc);if(e===void 0)throw new Error(Ye(70));return e}const Tc=l.forwardRef(function(t,n){const{children:o,container:r,className:s,render:i,style:a,...c}=t,{node:u,subtree:d}=Va({container:r,ref:n,componentProps:t,elementProps:c});return!d&&!u?null:f.jsxs(l.Fragment,{children:[d,u&&rt.createPortal(o,u)]})}),Ah=l.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t;return vo().useState("mounted")||o?f.jsx(Sc.Provider,{value:o,children:f.jsx(Tc,{ref:n,...r})}):null}),Ec=l.createContext(void 0);function Nh(){const e=l.useContext(Ec);if(e===void 0)throw new Error(Ye(71));return e}const jh=l.createContext(void 0);function Rc(){return l.useContext(jh)?.direction??"ltr"}const Dh=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:d=0,offsetParent:h="real"}=Nt(e,t)||{};if(u==null)return{};const p=Ra(d),m={x:n,y:o},g=ts(r),x=es(g),y=await i.getDimensions(u),v=g==="y",S=v?"top":"left",b=v?"bottom":"right",w=v?"clientHeight":"clientWidth",T=s.reference[x]+s.reference[g]-m[g]-s.floating[x],E=m[g]-s.reference[g],C=h==="real"?await i.getOffsetParent?.(u):a.floating;let R=a.floating[w]||s.floating[x];(!R||!await i.isElement?.(C))&&(R=a.floating[w]||s.floating[x]);const j=T/2-E/2,D=R/2-y[x]/2-1,H=Math.min(p[S],D),P=Math.min(p[b],D),L=H,F=R-y[x]-P,O=R/2-y[x]/2+j,_=Ea(L,O,F),N=!c.arrow&&Et(r)!=null&&O!==_&&s.reference[x]/2-(O<L?H:P)-y[x]/2<0,I=N?O<L?O-L:O-F:0;return{[g]:m[g]+I,data:{[g]:_,centerOffset:O-_-I,...N&&{alignmentOffset:I}},reset:N}}}),Lh=(e,t)=>{const{name:n,fn:o}=Dh(e);return{name:n,fn:o,options:[e,t]}},Fh={name:"hide",async fn(e){const{width:t,height:n,x:o,y:r}=e.rects.reference,s=t===0&&n===0&&o===0&&r===0,i=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:i.top-n>=0||i.right-t>=0||i.bottom-n>=0||i.left-t>=0||s}}}},_h={sideX:"left",sideY:"top"},Hh="--available-width",Bh="--available-height",$h="--anchor-width",zh="--anchor-height",Wh="--transform-origin",Ri=Hh,Ci=Bh;function Cc(e,t,n){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function ki(e,t,n){const{rects:o,placement:r}=e;return{side:Cc(t,ot(r),n),align:Et(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function kc(e){return Uh(e,dh)}function Uh(e,t){const{anchor:n,positionMethod:o="absolute",side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,collisionBoundary:c,collisionPadding:u=5,sticky:d=!1,arrowPadding:h=5,disableAnchorTracking:p=!1,inline:m,keepMounted:g=!1,floatingRootContext:x,mounted:y,collisionAvoidance:v,shift:S,nodeId:b,adaptiveOrigin:w,lazyFlip:T=!1,externalTree:E}=e,[C,R]=l.useState(null);!y&&C!==null&&R(null);const j=v.side||"flip",D=v.align||"flip",H=v.fallbackAxisSide||"end",P=S?.crossAxis??!1,L=S?.rootBoundary,F=typeof n=="function"?n:void 0,O=le(F),_=F?O:n,N=Fe(n),I=Fe(y),U=Rc()==="rtl",W=C||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":U?"left":"right","inline-start":U?"right":"left"}[r],ne=i==="center"?W:`${W}-${i}`;let oe=u;typeof oe=="number"?oe={top:oe,right:oe,bottom:oe,left:oe}:oe&&(oe={top:oe.top||0,right:oe.right||0,bottom:oe.bottom||0,left:oe.left||0});const z=1,Q=r==="bottom"?z:0,K=r==="top"?z:0,ge=r==="right"?z:0,Y=r==="left"?z:0,ce={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:oe},ue=l.useRef(null),ye=Fe(s),re=Fe(a),X=typeof s!="function"?s:0,he=typeof a!="function"?a:0,fe=[];m&&fe.push(m),fe.push(zp(Re=>{const Ve=ki(Re,r,U),et=typeof ye.current=="function"?ye.current(Ve):ye.current,Ge=typeof re.current=="function"?re.current(Ve):re.current;return{mainAxis:et,crossAxis:Ge,alignmentAxis:Ge}},[X,he,U,r]));const ve=D==="none"&&j!=="shift",q=!ve&&(d||P||j==="shift"),de=j==="none"?null:Kp({...ce,padding:{top:oe.top+z+Q,right:oe.right+z+Y,bottom:oe.bottom+z+K,left:oe.left+z+ge},mainAxis:!P&&j==="flip",crossAxis:D==="flip"?"alignment":!1,fallbackAxisSideDirection:H}),Z=ve?null:Wp({...ce,rootBoundary:L,mainAxis:D!=="none",crossAxis:q,limiter:d||P?void 0:Up(Re=>{if(!ue.current)return{};const{width:Ve,height:et}=ue.current.getBoundingClientRect(),Ge=nt(ot(Re.placement)),kt=Ge==="y"?Ve:et,it=Ge==="y"?oe.left+oe.right:oe.top+oe.bottom;return{offset:kt/2+it/2}})},[ce,d,P,L,oe,D]);j==="shift"||D==="shift"||i==="center"?fe.push(Z,de):fe.push(de,Z),fe.push(Vp({...ce,apply({elements:{floating:Re},availableWidth:Ve,availableHeight:et,rects:Ge}){if(!I.current)return;const kt=Re.style;kt.setProperty(Ri,`${Ve}px`),kt.setProperty(Ci,`${et}px`);const it=Ie(Re).devicePixelRatio||1,{x:Bn,y:Xt,width:$n,height:Pt}=Ge.reference,ln=(Math.round((Bn+$n)*it)-Math.round(Bn*it))/it,un=(Math.round((Xt+Pt)*it)-Math.round(Xt*it))/it;kt.setProperty($h,`${ln}px`),kt.setProperty(zh,`${un}px`)}}),Lh(Re=>({element:ue.current||be(Re.elements.floating).createElement("div"),padding:ue.current?h:0,offsetParent:"floating"}),[h]),{name:"transformOrigin",fn(Re){const{elements:{floating:Ve},middlewareData:et,placement:Ge,platform:kt,rects:it,y:Bn}=Re,Xt=ot(Ge),$n=Et(Ge),Pt=nt(Xt)==="y",ln=ue.current,un=typeof s=="function"?s(ki(Re,r,U)):s;let zn;if(!ln&&$n&&Math.abs(Pt?et.shift?.x||0:et.shift?.y||0)<=1)zn=$n==="start"===(Pt&&kt.isRTL?.(Ve)===!0)?"100%":"0%";else{const Ru=Pt?et.arrow?.x||0:et.arrow?.y||0,Cu=Pt?ln?.clientWidth||0:ln?.clientHeight||0;zn=`${Ru+Cu/2}px`}let Bo=Xt==="top"||Xt==="left"?`calc(100% + ${un}px)`:`${-un}px`;return q&&Pt&&Math.abs(et.shift?.y||0)>un&&(Bo=`${it.reference.y+it.reference.height/2-Bn}px`),Ve.style.setProperty(Wh,Pt?`${zn} ${Bo}`:`${Bo} ${zn}`),{}}},Fh,w),J(()=>{!y&&x&&x.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,x]);const te=l.useMemo(()=>({ancestorScroll:!p,elementResize:!p&&typeof ResizeObserver<"u",layoutShift:!p&&typeof IntersectionObserver<"u"}),[p]),{refs:ae,elements:Ee,x:ie,y:$,middlewareData:V,update:B,placement:M,context:G,isPositioned:pe,floatingStyles:Ue}=t({rootContext:x,open:g?y:void 0,placement:ne,middleware:fe,strategy:o,whileElementsMounted:g?void 0:(...Re)=>hi(...Re,te),nodeId:b,externalTree:E}),{sideX:Qe,sideY:Le}=V.adaptiveOrigin||_h,ee=pe?o:"fixed",Ce=l.useMemo(()=>{let Re;return pe?w?Re={position:ee,[Qe]:ie,[Le]:$}:Re={...Ue,position:ee}:Re={position:ee,top:0,left:0},Re[Ri]="100vw",Re[Ci]="100vh",pe||(Re.opacity=0),Re},[w,ee,Qe,ie,Le,$,Ue,pe]),Oe=l.useRef(null);J(()=>{if(!y)return;const Re=N.current,Ve=typeof Re=="function"?Re():Re,Ge=(Pi(Ve)?Ve.current:Ve)||null||null;Ge!==Oe.current&&(ae.setPositionReference(Ge),Oe.current=Ge)},[y,ae,_,N]),l.useEffect(()=>{if(!y)return;const Re=N.current;typeof Re!="function"&&Pi(Re)&&Re.current!==Oe.current&&(ae.setPositionReference(Re.current),Oe.current=Re.current)},[y,ae,_,N]),l.useEffect(()=>{if(g&&y&&Ee.reference&&Ee.floating)return hi(Ee.reference,Ee.floating,B,te)},[g,y,Ee,B,te]);const Xe=ot(M),dt=Cc(r,Xe,U),mt=Et(M)||"center",ft=!!V.hide?.referenceHidden;J(()=>{T&&y&&pe&&Xe!==W&&R(Xe)},[T,y,pe,Xe,W]);const Ke=l.useMemo(()=>({position:"absolute",top:V.arrow?.y,left:V.arrow?.x}),[V.arrow]),Gt=V.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:Ce,arrowStyles:Ke,arrowRef:ue,arrowUncentered:Gt,side:dt,align:mt,physicalSide:Xe,anchorHidden:ft,refs:ae,context:G,isPositioned:pe,update:B}),[Ce,Ke,ue,Gt,dt,mt,Xe,ft,ae,G,pe,B])}function Pi(e){return e!=null&&"current"in e}function Rs(e){return e==="starting"?Uf:je}function Pc(e,t,{styles:n,transitionStatus:o,props:r,refs:s,hidden:i,inert:a=!1}){const c={...n};return a&&(c.pointerEvents="none"),De("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:c},Rs(o),r],stateAttributesMapping:Yr})}const Kh=l.forwardRef(function(t,n){const{render:o,className:r,anchor:s,positionMethod:i="absolute",side:a="top",align:c="center",sideOffset:u=0,alignOffset:d=0,collisionBoundary:h="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:x=!1,collisionAvoidance:y=Wa,style:v,...S}=t,b=vo(),w=Mh(),T=b.useState("open"),E=b.useState("mounted"),C=b.useState("trackCursorAxis"),R=b.useState("disableHoverablePopup"),j=b.useState("floatingRootContext"),D=b.useState("instantType"),H=b.useState("transitionStatus"),P=b.useState("adaptiveOrigin"),L=kc({anchor:s,positionMethod:i,floatingRootContext:j,mounted:E,side:a,sideOffset:u,align:c,alignOffset:d,collisionBoundary:h,collisionPadding:p,sticky:g,arrowPadding:m,disableAnchorTracking:x,keepMounted:w,collisionAvoidance:y,adaptiveOrigin:P}),F=l.useMemo(()=>({open:T,side:L.side,align:L.align,anchorHidden:L.anchorHidden,instant:C!=="none"?"tracking-cursor":D}),[T,L.side,L.align,L.anchorHidden,C,D]),O=Pc(t,F,{styles:L.positionerStyles,transitionStatus:H,props:S,refs:[n,b.useStateSetter("positionerElement")],hidden:!E,inert:!T||C==="both"||R});return f.jsx(Ec.Provider,{value:L,children:O})}),Vh=l.forwardRef(function(t,n){const{render:o,className:r,style:s,...i}=t,a=vo(),{side:c,align:u}=Nh(),d=a.useState("open"),h=a.useState("instantType"),p=a.useState("transitionStatus"),m=a.useState("popupProps"),g=a.useState("floatingRootContext"),x=a.useState("disabled"),y=a.useState("closeDelay");Dn({open:d,ref:a.context.popupRef,onComplete(){d&&a.context.onOpenChangeComplete?.(!0)}}),yc(g,{enabled:!x,closeDelay:y});const v=a.useStateSetter("popupElement");return De("div",t,{state:{open:d,side:c,align:u,instant:h,transitionStatus:p},ref:[n,a.context.popupRef,v],props:[ps,m,Rs(p),i],stateAttributesMapping:Gr})}),Yh=function(t){const{delay:n,closeDelay:o,timeout:r=400}=t,s=l.useMemo(()=>({open:n,close:o}),[n,o]);return f.jsx(vc.Provider,{value:n,children:f.jsx(qd,{delay:s,timeoutMs:r,children:t.children})})};function Cs(e){return rs(19)?e:e?"true":void 0}function Oc(){return typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent)}const Te=e=>[e,e],ks={space:{shown:Te("Space"),said:Te("Space"),aria:"Space"},enter:{shown:["Enter","↵"],said:Te("Enter"),aria:"Enter"},escape:{shown:Te("Esc"),said:Te("Esc"),aria:"Escape"},tab:{shown:Te("Tab"),said:Te("Tab"),aria:"Tab"},backspace:{shown:["Backspace","⌫"],said:["Backspace","Delete"],aria:"Backspace"},delete:{shown:["Delete","⌦"],said:Te("Delete"),aria:"Delete"},insert:{shown:Te("Insert"),said:Te("Insert"),aria:"Insert"},home:{shown:Te("Home"),said:Te("Home"),aria:"Home"},end:{shown:Te("End"),said:Te("End"),aria:"End"},pageup:{shown:Te("Page Up"),said:Te("Page Up"),aria:"PageUp"},pagedown:{shown:Te("Page Down"),said:Te("Page Down"),aria:"PageDown"},arrowup:{shown:Te("↑"),said:Te("Up"),aria:"ArrowUp"},arrowdown:{shown:Te("↓"),said:Te("Down"),aria:"ArrowDown"},arrowleft:{shown:Te("←"),said:Te("Left"),aria:"ArrowLeft"},arrowright:{shown:Te("→"),said:Te("Right"),aria:"ArrowRight"}},En=[{held:"ctrl",other:"Ctrl",apple:"⌃",saidApple:"Control",aria:"Control"},{held:"alt",other:"Alt",apple:"⌥",saidApple:"Option",aria:"Alt"},{held:"shift",other:"Shift",apple:"⇧",saidApple:"Shift",aria:"Shift"},{held:"meta",other:"Ctrl",apple:"⌘",saidApple:"Command",aria:"Meta"}],Gh={",":"Comma",".":"Period","/":"Slash",";":"Semicolon","'":"Quote","[":"BracketLeft","]":"BracketRight","\\":"Backslash","-":"Minus","=":"Equal","`":"Backquote"},or=/^[a-z0-9]$/i,Xh=/^F([1-9]|1\d|2[0-4])$/;function Rn(e){const t=e===" "?"space":e.toLowerCase();return Object.hasOwn(ks,t)?t:void 0}function jo(e,t){return{key:e.key===" "?"Space":e.key,meta:t&&e.mod===!0,ctrl:e.ctrl===!0||!t&&e.mod===!0,alt:e.alt===!0,shift:e.shift===!0}}function Ps(e,t,n){const o=Rn(e);return o!==void 0?ks[o][t][n?1:0]:e.length===1?e.toUpperCase():e}function qh(e,t){const n=jo(e,t),o=Ps(n.key,"shown",t);return t?En.filter(s=>n[s.held]).map(s=>s.apple).join("")+o:[...[...new Set(En.filter(s=>n[s.held]).map(s=>s.other))],o].join("+")}function Zh(e,t){const n=jo(e,t);return[...[...new Set(En.filter(r=>n[r.held]).map(r=>t?r.saidApple:r.other))],Ps(n.key,"said",t)].join("+")}function Jh(e,t){const n=jo(e,t),o=Rn(n.key),r=o!==void 0?ks[o].aria:n.key==="+"?"Plus":Ps(n.key,"shown",!1);return[...En.filter(s=>n[s.held]).map(s=>s.aria),r].join("+")}function Qh(e){const t=e.trim().split("+"),n=t.pop();if(n===void 0||n===""||/\s/.test(e.trim()))return null;const o={key:n==="Plus"?"+":n,meta:!1,ctrl:!1,alt:!1,shift:!1};for(const r of t){const s=En.find(i=>i.aria===r);if(s===void 0)return null;o[s.held]=!0}return o}function eg(e,t){const n=Rn(e.key);return n==="enter"||n==="space"?!1:!e.meta&&!e.ctrl&&!e.alt?Xh.test(e.key):t&&e.ctrl&&e.alt?!1:!(e.key.toLowerCase()==="v"&&!e.alt)}function Ic(e){const t=/^(?:Key([A-Z])|Digit([0-9]))$/.exec(e.code??"");if(t)return(t[1]??t[2]??"").toLowerCase();const n=e.keyCode??0;return n>=65&&n<=90||n>=48&&n<=57?String.fromCharCode(n).toLowerCase():""}function tg(e,t){if(t.metaKey!==e.meta||t.ctrlKey!==e.ctrl||t.altKey!==e.alt||t.altGraph===!0&&t.ctrlKey&&t.altKey&&t.key.length===1)return!1;const n=t.key,o=e.key;if(o==="+")return(n==="+"||n==="="||t.code==="NumpadAdd")&&(t.shiftKey||!e.shift);if(or.test(o))return t.shiftKey!==e.shift?!1:n.toLowerCase()===o.toLowerCase()?!0:or.test(n)||t.altGraph===!0&&!t.altKey?!1:Ic(t)===o.toLowerCase();if(o.length>1){const s=Rn(o),i=Rn(n);return(s!==void 0?i===s:n.toLowerCase()===o.toLowerCase())&&t.shiftKey===e.shift}const r=Gh[o];return n===o?t.shiftKey===e.shift?!0:!e.shift&&(r===void 0||t.code!==r):r===void 0||t.code!==r||t.shiftKey!==e.shift||or.test(n)?!1:e.shift||t.altKey||!/^[ -~]$/.test(n)}function ng(e){if(/^(Arrow|Home$|End$|Backspace$|Delete$)/.test(e.key))return!0;if(e.altKey)return!e.metaKey;const t=Ic(e);return e.shiftKey?t==="v"||t==="z":["a","c","v","x","y","z"].includes(t)}const og={"⌘":["Ctrl","Command"],"⌃":["Ctrl","Control"],"⌥":["Alt","Option"],"⇧":Te("Shift"),"↵":Te("Enter"),"⏎":Te("Enter"),"⌫":["Backspace","Delete"],"⌦":Te("Delete"),"⎋":Te("Esc"),"⇥":Te("Tab"),"↑":Te("Up"),"↓":Te("Down"),"←":Te("Left"),"→":Te("Right")};function rg(e,t){const n=[];let o="";for(const r of e){const s=og[r];if(s===void 0){o+=r;continue}o!==""&&n.push(o),o="",n.push(s[t?1:0])}return o!==""&&n.push(o),n.map(r=>r.replace(/^\+|\+$/g,"")).filter(r=>r!=="").join("+")}function sg(e){e.preventDefault()}function Mc({label:e,shortcut:t,side:n="bottom",children:o}){return f.jsxs(Rh,{children:[f.jsx(Ih,{render:o}),f.jsx(Ah,{children:f.jsx(Kh,{side:n,sideOffset:6,className:"z-[1000]",children:f.jsxs(Vh,{onMouseDown:sg,className:"rounded-md bg-fg px-2 py-1 text-xs text-surface shadow-popup data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 transition-opacity",children:[e,t?f.jsxs(f.Fragment,{children:[f.jsx("span",{"aria-hidden":"true",className:"ml-2 opacity-60",children:t}),f.jsx("span",{className:"sr-only",children:rg(t,Oc())})]}):null]})})})]})}function ig({children:e}){return f.jsx(Yh,{delay:500,closeDelay:0,children:e})}function Os(e){return!!e.isComposing||e.keyCode===229}function ag(e){return e.repeat&&(e.key==="Enter"||e.key===" ")}function go(e){ag(e)&&e.target===e.currentTarget&&e.preventDefault()}function Ac(e){return e?t=>{go(t),e(t)}:go}const cg=200,lg=2e3;function Nc(e,t,n){let o=null,r=!1;const s=()=>{r||(r=!0,e.removeEventListener("keydown",i,!0),e.removeEventListener("keyup",i,!0),e.clearTimeout(a),o!==null&&e.clearTimeout(o))},i=c=>{const u=c.key==="Enter"||c.key===" ";if(c.type==="keyup"){c.key===" "&&!n(c.target)&&c.preventDefault(),c.key===t&&o===null&&(o=e.setTimeout(s,cg));return}u&&!n(c.target)&&(c.preventDefault(),c.stopImmediatePropagation())},a=e.setTimeout(s,lg);return e.addEventListener("keydown",i,!0),e.addEventListener("keyup",i,!0),s}function ug(e){const{key:t,code:n}=e;return typeof t!="string"?!1:t.length===1&&t.charCodeAt(0)>=32&&t.charCodeAt(0)<=126?t==="a"||t==="A":(Array.from(t).length===1||t==="Dead"||t==="Unidentified")&&n==="KeyA"}const dg=300,fg=3e3;function pg(e){const t=e.opened+fg;return e.shown===null?t:Math.min(t,Math.max(e.opened,e.shown)+dg)}function hg(e,t,n){return n.key!=="Enter"&&n.key!==" "?!1:n.repeat?!0:n.isTrusted===!1?!1:t<pg(e)}function gg(e,t){return e!==!1?e:t!==void 0&&t!==!1&&t!=="false"?void 0:!1}const mg={primary:"bg-accent text-accent-fg hover:brightness-110 active:brightness-95",secondary:"bg-surface text-fg border border-line hover:bg-hover",ghost:"bg-transparent text-fg hover:bg-hover",danger:"bg-danger text-white hover:brightness-110"},yg={sm:"h-6 px-2 text-xs gap-1",md:"h-7 px-2.5 text-[13px] gap-1.5",lg:"h-8 px-3 text-[13px] gap-2"},Kt=l.forwardRef(function({variant:t="secondary",size:n="md",icon:o,className:r,children:s,type:i="button",onKeyDown:a,...c},u){return f.jsxs("button",{ref:u,type:i,className:Ae("inline-flex shrink-0 select-none items-center justify-center whitespace-nowrap rounded-control font-medium transition-[background,filter]","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-accent","disabled:pointer-events-none disabled:opacity-45",mg[t],yg[n],r),...c,onKeyDown:Ac(a),children:[o,s]})}),xg={sm:"size-6",md:"size-7",lg:"size-8"},Do=l.forwardRef(function({label:t,icon:n,shortcut:o,active:r,size:s="md",noTooltip:i,className:a,type:c="button",onKeyDown:u,...d},h){const p=f.jsx("button",{ref:h,type:c,"aria-label":t,"aria-pressed":gg(r,d["aria-haspopup"]),className:Ae("inline-flex shrink-0 items-center justify-center rounded-control text-fg-muted transition-colors","hover:bg-hover hover:text-fg focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-accent","disabled:pointer-events-none disabled:opacity-40",r&&"bg-accent-soft text-accent hover:bg-accent-soft hover:text-accent",xg[s],a),...d,onKeyDown:Ac(u),children:n});return i?p:f.jsx(Mc,{label:t,shortcut:o,children:p})}),jc=l.createContext(void 0);function Dc(e){const t=l.useContext(jc);if(t===void 0&&!e)throw new Error(Ye(33));return t}const Lc=l.createContext(void 0);function an(e){const t=l.useContext(Lc);if(t===void 0&&!e)throw new Error(Ye(36));return t}const bg=l.createContext(void 0);function Is(e=!0){const t=l.useContext(bg);if(t===void 0&&!e)throw new Error(Ye(25));return t}const vg=l.createContext(void 0);function Ms(e=!1){const t=l.useContext(vg);if(t===void 0&&!e)throw new Error(Ye(16));return t}function wg(e){const{focusableWhenDisabled:t,disabled:n,composite:o=!1,tabIndex:r=0,isNativeButton:s}=e,i=o&&t!==!1,a=o&&t===!1;return{props:l.useMemo(()=>{const u={onKeyDown(d){n&&t&&d.key!=="Tab"&&d.preventDefault()}};return o||(u.tabIndex=r,!s&&n&&(u.tabIndex=t?r:-1)),(s&&(t||i)||!s&&n)&&(u["aria-disabled"]=n),s&&(!t||a)&&(u.disabled=n),u},[o,n,t,i,a,s,r])}}function no(e,t,{detail:n=0}={}){e.dispatchEvent(new(Ie(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Fn(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:o=0,native:r=!0,composite:s}=e,i=l.useRef(null),a=Ms(!0),c=s??a!==void 0,{props:u}=wg({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:o,isNativeButton:r}),d=l.useCallback(()=>{const m=i.current;rr(m)&&c&&t&&u.disabled===void 0&&m.disabled&&(m.disabled=!1)},[t,u.disabled,c]);J(d,[d]);const h=l.useCallback((m={})=>{const{onClick:g,onMouseDown:x,onKeyUp:y,onKeyDown:v,onPointerDown:S,...b}=m;return wt({onClick(w){if(t){w.preventDefault();return}g?.(w)},onMouseDown(w){t||x?.(w)},onKeyDown(w){if(t||(uo(w),v?.(w),w.baseUIHandlerPrevented))return;const T=w.target===w.currentTarget,E=w.currentTarget,C=rr(E),R=!r&&Sg(E),j=T&&(r?C:!R),D=w.key==="Enter",H=w.key===" ",P=E.getAttribute("role"),L=P?.startsWith("menuitem")||P==="option"||P==="gridcell";if(T&&c&&H){if(w.defaultPrevented&&L)return;w.preventDefault(),(!r||C)&&(w.preventBaseUIHandler(),no(E,w));return}if(!j||r||!H&&!D){T&&R&&H&&w.preventDefault();return}w.defaultPrevented||(w.preventDefault(),D&&(w.preventBaseUIHandler(),no(E,w)))},onKeyUp(w){if(!t){if(uo(w),y?.(w),w.target===w.currentTarget&&r&&c&&rr(w.currentTarget)&&w.key===" "){w.preventDefault();return}w.baseUIHandlerPrevented||w.target===w.currentTarget&&!r&&!c&&!w.defaultPrevented&&w.key===" "&&(w.preventBaseUIHandler(),no(w.currentTarget,w))}},onPointerDown(w){if(t){w.preventDefault();return}S?.(w)}},r?{type:"button"}:{role:"button"},u,b)},[t,u,c,r]),p=le(m=>{i.current=m,d()});return{getButtonProps:h,buttonRef:p}}function rr(e){return Pe(e)&&e.tagName==="BUTTON"}function Sg(e){return Pe(e)&&e.tagName==="A"&&!!e.href}function Tg(e){const{closeOnClick:t,highlighted:n,id:o,nodeId:r,store:s,typingRef:i,itemRef:a,itemMetadata:c}=e,{events:u}=s.useState("floatingTreeRoot"),d=s.useState("open"),h=Is(!0),p=h!==void 0;return l.useMemo(()=>({id:o,role:"menuitem",tabIndex:d&&n?0:-1,onKeyDown(m){m.key===" "&&i?.current&&m.preventDefault()},onMouseMove(m){r&&u.emit("itemhover",{nodeId:r,target:m.currentTarget})},onClick(m){t&&u.emit("close",{domEvent:m,reason:ba})},onMouseUp(m){if(h){const g=h.initialCursorPointRef.current;if(h.initialCursorPointRef.current=null,p&&g&&Math.abs(m.clientX-g.x)<=1&&Math.abs(m.clientY-g.y)<=1||p&&!_r&&m.button===2)return}a.current&&s.context.allowMouseUpTriggerRef.current&&(!p||m.button===2)&&c.type==="regular-item"&&no(a.current,m,{detail:1})}}),[t,n,o,u,r,d,s,i,a,h,p,c])}const Eg={type:"regular-item"};function Rg(e){const{closeOnClick:t,disabled:n,highlighted:o,id:r,store:s,typingRef:i=s.context.typingRef,nativeButton:a,itemMetadata:c,nodeId:u}=e,d=l.useRef(null),{getButtonProps:h,buttonRef:p}=Fn({disabled:n,focusableWhenDisabled:!0,native:a,composite:!0}),m=Tg({closeOnClick:t,highlighted:o,id:r,nodeId:u,store:s,typingRef:i,itemRef:d,itemMetadata:c}),g=l.useCallback(y=>wt(m,{onMouseEnter(){c.type==="submenu-trigger"&&c.setActive()}},y,h),[m,h,c]),x=nn(d,p);return l.useMemo(()=>({getItemProps:g,itemRef:x}),[g,x])}const Fc=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Cg(){return l.useContext(Fc)}function _c(e={}){const{guess:t,label:n,metadata:o,textRef:r,index:s}=e,{register:i,unregister:a,subscribeMapChange:c,nextIndexRef:u}=Cg(),d=l.useRef(-1),[h,p]=l.useState(s==null&&t?()=>{if(d.current===-1){const y=u.current;u.current+=1,d.current=y}return d.current}:-1),m=s??h,g=l.useRef(null),x=l.useCallback(y=>{const v=g.current;v&&a(v),g.current=y,y&&i(y,{metadata:o??null,index:s??null,label:n,textRef:r})},[s,i,a,o,n,r]);return J(()=>{if(s==null)return c(y=>{const v=g.current?y.get(g.current)?.index:null;v!=null&&p(v)})},[s,c]),{ref:x,index:m}}const Hc=l.forwardRef(function(t,n){const{render:o,className:r,id:s,label:i,nativeButton:a=!1,disabled:c=!1,closeOnClick:u=!0,style:d,...h}=t,p=_c({guess:!0,label:i}),m=Dc(!0),g=Ln(s),{store:x}=an(),y=x.useState("disabled"),v=c||y,S=x.useState("isActive",p.index),b=x.useState("itemProps"),{getItemProps:w,itemRef:T}=Rg({closeOnClick:u,disabled:v,highlighted:S,id:g,store:x,nativeButton:a,nodeId:m?.context.nodeId,itemMetadata:Eg});return De("div",t,{state:{disabled:v,highlighted:S},props:[b,h,w],ref:[T,n,p.ref]})}),kg=l.createContext(void 0);function Pg(e){return l.useContext(kg)}const Og="ArrowUp",Ig="ArrowDown",Mg="ArrowLeft",Ag="ArrowRight",Ng="Home",jg="End",Bc=new Set([Og,Ig,Mg,Ag,Ng,jg]),$c=l.forwardRef(function(t,n){const{render:o,className:r,style:s,finalFocus:i,...a}=t,{store:c}=an(),{side:u,align:d}=Dc(),h=Pg()!=null,p=c.useState("open"),m=c.useState("transitionStatus"),g=c.useState("popupProps"),x=c.useState("mounted"),y=c.useState("instantType"),v=c.useState("activeTriggerElement"),S=c.useState("parent"),b=c.useState("lastOpenChangeReason"),w=c.useState("rootId"),T=c.useState("floatingRootContext"),E=c.useState("floatingTreeRoot"),C=c.useState("closeDelay"),R=c.useState("hoverEnabled"),j=c.useState("disabled"),D=c.useState("openMethod"),H=S.type==="context-menu";Dn({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),l.useEffect(()=>{function _(N){c.setOpen(!1,Se(N.reason,N.domEvent))}return E.events.on("close",_),()=>{E.events.off("close",_)}},[E.events,c]),yc(T,{enabled:R&&!j&&!H&&S.type!=="menubar",closeDelay:C});const P=c.useStateSetter("popupElement"),L={transitionStatus:m,side:u,align:d,open:p,nested:S.type==="menu",instant:y},F=De("div",t,{state:L,ref:[n,c.context.popupRef,P],stateAttributesMapping:Gr,props:[g,{onKeyDown(_){h&&Bc.has(_.key)&&_.stopPropagation()}},Rs(m),a,{"data-rootownerid":w}]});let O=S.type===void 0||H;return(v||S.type==="menubar"&&b!==qr)&&(O=!0),f.jsx(Ja,{context:T,openInteractionType:D,modal:H,disabled:!x,returnFocus:i===void 0?O:i,initialFocus:S.type!=="menu",restoreFocus:!0,externalTree:S.type!=="menubar"?E:void 0,previousFocusableElement:v,nextFocusableElement:S.type===void 0?c.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:S.type===void 0?c.context.beforeContentFocusGuardRef:void 0,children:F})}),zc=l.createContext(void 0);function Dg(){const e=l.useContext(zc);if(e===void 0)throw new Error(Ye(32));return e}const Wc=l.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,{store:s,parent:i}=an();if(!(s.useState("mounted")||o))return null;const u=i.type==="menu"||i.type==="menubar"?"group":void 0;return f.jsx(zc.Provider,{value:o,children:f.jsx(Ya,{ref:n,...r,portalOwnerRole:u})})});function Lg(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:r}=e,s=le(r),[,i]=l.useState(!1),a=ze(_g).current,c=ze(Fg).current,u=l.useRef(0),d=l.useRef(!0),h=l.useRef(null),p=l.useRef(null),m=le(()=>{d.current||(d.current=!0,i(T=>!T))}),g=le((T,E)=>{c.set(T,E),m()}),x=le(T=>{c.delete(T),m()}),y=le(T=>{const E=new Map;return n.current.length=0,o&&(o.current.length=0),T.forEach(C=>{E.set(C.element,{...C.registration.metadata??{},index:C.index}),n.current[C.index]=C.element,o&&(o.current[C.index]=C.registration.label!==void 0?C.registration.label:C.registration.textRef?.current?.textContent??C.element.textContent)}),u.current=n.current.length,E});function v(T){if(p.current?.disconnect(),p.current=null,typeof MutationObserver!="function"||T.length<2)return;const E=new MutationObserver(R=>{if(!$g(R))return;let j=null;for(const D of T)if(D.isConnected){if(j&&Uc(j,D)>0){E.disconnect(),m();return}j=D}});p.current=E;const C=new Set;for(let R=1;R<T.length;R+=1){const j=Bg(T[R-1],T[R]);j&&C.add(j)}C.forEach(R=>E.observe(R,{childList:!0}))}const S=le(()=>{const[T,E]=Hg(c),C=y(T),R=h.current,j=!R||R.length!==T.length||T.some((D,H)=>{const P=R[H];return D.index!==P.index||D.element!==P.element||D.registration.index!==P.registration.index||D.registration.metadata!==P.registration.metadata});v(E),h.current=T,d.current=!1,j&&(a.forEach(D=>D(C)),s(C))});J(()=>(!d.current&&h.current&&y(h.current),()=>{n.current=[],o&&(o.current=[])}),[n,o,y]),J(()=>{d.current&&S()}),J(()=>()=>{p.current?.disconnect(),d.current=!0},[]);const b=le(T=>(a.add(T),()=>{a.delete(T)})),w=l.useMemo(()=>({register:g,unregister:x,subscribeMapChange:b,nextIndexRef:u}),[g,x,b,u]);return f.jsx(Fc.Provider,{value:w,children:t})}function Fg(){return new Map}function _g(){return new Set}function Hg(e){const t=new Set,n=[],o=[];e.forEach((s,i)=>{if(!i.isConnected)return;const a=s.index,c={index:a??-1,element:i,registration:s};a===null?o.push(c):a>=0&&(t.add(a),n.push(c))});let r=0;return o.sort((s,i)=>Uc(s.element,i.element)),o.forEach(s=>{for(;t.has(r);)r+=1;s.index=r,n.push(s),r+=1}),t.size>0&&n.sort((s,i)=>s.index-i.index),[n,o.map(s=>s.element)]}function Bg(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function $g(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function Uc(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const Kc=l.forwardRef(function(t,n){const{cutout:o,...r}=t;let s;if(o){const i=o.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return f.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});let Oi={},Ii={},Mi="";function Lo(e,t){return An(e)?e:t}function Ai(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Lo(t,n)).overflowY)}function zg(e){if(typeof document>"u")return!1;const t=be(e);return Ie(t).innerWidth-t.documentElement.clientWidth>0}function Wg(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=be(e),o=n.documentElement,r=n.body,s=Lo(o,r),i=s.style.overflowY,a=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",s.style.overflowY="scroll";const c=s.offsetWidth;s.style.overflowY="hidden";const u=s.offsetWidth;return s.style.overflowY=i,o.style.scrollbarGutter=a,c===u}function Ug(e){const t=be(e),n=t.documentElement,o=t.body,r=Lo(n,o),s={overflowY:r.style.overflowY,overflowX:r.style.overflowX};return Object.assign(r.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(r.style,s)}}function Kg(e){const t=be(e),n=t.documentElement,o=t.body,r=Ie(n);let s=0,i=0,a=!1;const c=ht.create();if(Dt&&(r.visualViewport?.scale??1)!==1)return()=>{};function u(){const m=r.getComputedStyle(n),g=r.getComputedStyle(o),v=(m.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,Oi={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Mi=n.style.scrollBehavior,Ii={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const S=n.scrollHeight>n.clientHeight,b=n.scrollWidth>n.clientWidth,w=m.overflowY==="scroll"||g.overflowY==="scroll",T=m.overflowX==="scroll"||g.overflowX==="scroll",E=Math.max(0,r.innerWidth-o.clientWidth),C=Math.max(0,r.innerHeight-o.clientHeight),R=parseFloat(g.marginTop)+parseFloat(g.marginBottom),j=parseFloat(g.marginLeft)+parseFloat(g.marginRight),D=Lo(n,o);if(a=Wg(e),a){n.style.scrollbarGutter=v,D.style.overflowY="hidden",D.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:v,overflowY:"hidden",overflowX:"hidden"}),(S||w)&&(n.style.overflowY="scroll"),(b||T)&&(n.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:R||C?`calc(100dvh - ${R+C}px)`:"100dvh",width:j||E?`calc(100vw - ${j+E}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),o.scrollTop=s,o.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,Oi),Object.assign(o.style,Ii),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Mi)}function h(){d(),c.request(u)}u();const p=me(r,"resize",h);return()=>{c.cancel(),d(),typeof r.removeEventListener=="function"&&p()}}class Vg{lockCount=0;restore=null;timeoutLock=Ze.create();timeoutUnlock=Ze.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const n=be(t),o=n.documentElement,r=n.body,s=Ie(o);if(Ai(s,o,r)){const a=new s.MutationObserver(()=>{Ai(s,o,r)||(a.disconnect(),this.restore=null,this.lock(t))}),c={attributes:!0};a.observe(o,c),a.observe(r,c),this.restore=()=>a.disconnect();return}const i=To||!zg(t);this.restore=i?Ug(t):Kg(t)}}const Yg=new Vg;function Vc(e=!0,t=null){J(()=>{if(e)return Yg.acquire(t)},[e,t])}const Gg=20;function Xg(e,t,n,o){const[r,s]=l.useState(!1);J(()=>{if(!e||!t||n==null){s(!1);return}const i=be(n).documentElement.clientWidth,a=n.offsetWidth;s(i>0&&a>0&&a>=i-Gg)},[e,t,n]),Vc(e&&(!t||r),o)}const Yc=l.forwardRef(function(t,n){const{anchor:o,positionMethod:r="absolute",className:s,render:i,side:a,align:c,sideOffset:u=0,alignOffset:d=0,collisionBoundary:h="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:x=!1,collisionAvoidance:y=qf,style:v,...S}=t,{store:b}=an(),w=Dg(),T=Is(!0),E=b.useState("parent"),C=b.useState("floatingRootContext"),R=b.useState("floatingTreeRoot"),j=b.useState("mounted"),D=b.useState("open"),H=b.useState("modal"),P=b.useState("openMethod"),L=b.useState("activeTriggerElement"),F=b.useState("transitionStatus"),O=b.useState("positionerElement"),_=b.useState("instantType"),N=b.useState("adaptiveOrigin"),I=b.useState("lastOpenChangeReason"),A=b.useState("floatingNodeId"),U=b.useState("floatingParentNodeId"),W=C.useState("domReferenceElement"),ne=l.useRef(null),oe=fs(O);let z=o,Q=u,K=d,ge=c,Y=y;E.type==="context-menu"&&(z=o??E.context?.anchor,ge=ge??"start",!a&&ge!=="center"&&(K=t.alignOffset??2,Q=t.sideOffset??-5));let ce=a,ue=ge;E.type==="menu"?(ce=ce??"inline-end",ue=ue??"start",Y=t.collisionAvoidance??Wa):E.type==="menubar"&&(ce=ce??(E.context.orientation==="vertical"?"inline-end":"bottom"),ue=ue??"start");const ye=E.type==="context-menu",re=kc({anchor:z,floatingRootContext:C,positionMethod:T?"fixed":r,mounted:j,side:ce,sideOffset:Q,align:ue,alignOffset:K,arrowPadding:ye?0:m,collisionBoundary:h,collisionPadding:p,sticky:g,nodeId:A,keepMounted:w,disableAnchorTracking:x,collisionAvoidance:Y,shift:ye?{crossAxis:!("side"in Y&&Y.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:R,adaptiveOrigin:N});l.useEffect(()=>{function te(ae){ae.open&&(ae.parentNodeId===A&&b.set("hoverEnabled",!1),ae.nodeId!==A&&ae.parentNodeId===b.select("floatingParentNodeId")&&b.setOpen(!1,Se(gn)))}return R.events.on("menuopenchange",te),()=>{R.events.off("menuopenchange",te)}},[b,R.events,A]),l.useEffect(()=>{if(b.select("floatingParentNodeId")==null)return;function te(ae){if(ae.open||ae.nodeId!==b.select("floatingParentNodeId"))return;const Ee=ae.reason??gn;b.setOpen(!1,Se(Ee))}return R.events.on("menuopenchange",te),()=>{R.events.off("menuopenchange",te)}},[R.events,b]);const X=We();l.useEffect(()=>{D||X.clear()},[D,X]),l.useEffect(()=>{function te(ae){if(!(!D||ae.nodeId!==b.select("floatingParentNodeId")))if(ae.target&&L&&L!==ae.target){const Ee=b.select("closeDelay");Ee>0?X.isStarted()||X.start(Ee,()=>{b.setOpen(!1,Se(gn))}):b.setOpen(!1,Se(gn))}else X.clear()}return R.events.on("itemhover",te),()=>{R.events.off("itemhover",te)}},[R.events,D,L,b,X]),l.useEffect(()=>{const te={open:D,nodeId:A,parentNodeId:U,reason:b.select("lastOpenChangeReason")};R.events.emit("menuopenchange",te)},[R.events,D,b,A,U]),J(()=>{const te=W,ae=ne.current;if(te&&(ne.current=te),ae&&te&&te!==ae){b.set("instantType",void 0);const Ee=new AbortController;return oe(()=>{b.set("instantType","trigger-change")},Ee.signal),()=>{Ee.abort()}}},[W,oe,b]);const he={open:D,side:re.side,align:re.align,anchorHidden:re.anchorHidden,nested:E.type==="menu",instant:_},fe=E.type==="menubar"&&E.context.modal;Xg(D&&(fe||H&&I!==He),P==="touch",O,L);const q=Pc(t,he,{styles:re.positionerStyles,transitionStatus:F,props:S,refs:[n,b.useStateSetter("positionerElement")],hidden:!j,inert:!D}),de=j&&E.type!=="menu"&&(E.type!=="menubar"&&H&&I!==He||E.type==="menubar"&&E.context.modal);let Z=null;return E.type==="menubar"?Z=E.context.contentElement:E.type===void 0&&(Z=L),f.jsxs(jc.Provider,{value:re,children:[de&&f.jsx(Kc,{ref:E.type==="context-menu"||E.type==="nested-context-menu"?E.context.internalBackdropRef:null,inert:Cs(!D),cutout:Z}),f.jsx(Qf,{id:A,children:f.jsx(Lg,{elementsRef:b.context.itemDomElements,labelsRef:b.context.itemLabels,children:q})})]})}),qg=l.createContext(null);function Gc(e){return l.useContext(qg)}function Zg(e){const t=l.useRef(""),n=l.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:l.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r?e(r,r.pointerType):e(r,t.current),t.current=""},[e]),onPointerDown:n}}function Jg(e,t){const n=l.useRef(e),o=le(t);J(()=>{n.current!==e&&o(n.current),n.current=e},[e,o])}function Qg(e,t){const n=le((s,i)=>{(typeof e=="function"?e():e)||t(i||(To?"touch":""))}),{onClick:o,onPointerDown:r}=Zg(n);return l.useMemo(()=>({onClick:o,onPointerDown:r}),[o,r])}function em(e){const[t,n]=l.useState(null),o=Qg(e,n);return Jg(e,r=>{r&&!e&&n(null)}),l.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}const tm={...Ss,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,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.parent.context.rootId:e.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>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")}};class nm extends jn{constructor(t,n,o=!1){const r=new bs,s=rm(r,n,o,t);super(s,om(r),tm),this.unsubscribeParentListener=this.observe("parent",i=>{if(this.unsubscribeParentListener?.(),i.type==="menu"){let a=i.store.select("rootId"),c=i.store.select("floatingTreeRoot"),u=i.store.select("keyboardEventRelay");this.unsubscribeParentListener=i.store.subscribe(()=>{const d=i.store.select("rootId"),h=i.store.select("floatingTreeRoot"),p=i.store.select("keyboardEventRelay");a===d&&c===h&&u===p||(a=d,c=h,u=p,this.notifyAll())}),this.context.allowMouseUpTriggerRef=i.store.context.allowMouseUpTriggerRef;return}i.type!==void 0&&(this.context.allowMouseUpTriggerRef=i.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}unsubscribeParentListener=null}function om(e){return{positionerRef:l.createRef(),popupRef:l.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:l.createRef(),beforeContentFocusGuardRef:l.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function rm(e,t,n=!1,o){return{...vs(e,t,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new as,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:je,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...o}}const sm=l.createContext(void 0);function im(){return l.useContext(sm)}const Xc=bo(function(t){const{children:n,open:o,onOpenChange:r,onOpenChangeComplete:s,defaultOpen:i=!1,disabled:a=!1,modal:c,loopFocus:u=!0,orientation:d="vertical",actionsRef:h,closeParentOnEsc:p=!1,handle:m,triggerId:g,defaultTriggerId:x=null,highlightItemOnHover:y=!0}=t,v=Is(!0),S=an(!0),b=Gc(!0),w=im(),T=l.useMemo(()=>w&&S?{type:"menu",store:S.store}:b?{type:"menubar",context:b}:v&&!S?{type:"context-menu",context:v}:{type:void 0},[v,S,b,w]),E=Wt(),C=Wt(),R=Vt(),j=T.type==="menu"?T.store:void 0,D=(o??i)&&j?.state.transitionStatus==="starting",H=ze(()=>D?j?.state.instantType:void 0).current,P=am({open:i,openProp:o,activeTriggerId:x,triggerIdProp:g,parent:T,disabled:a,highlightItemOnHover:y,modal:T.type===void 0?c:void 0,rootId:E,instantType:H},C,R!=null);P.useControlledProp("openProp",o),P.useControlledProp("triggerIdProp",g),P.useContextCallback("onOpenChangeComplete",s);const L=P.useState("floatingTreeRoot"),F=Za(L),O=P.useState("open"),_=P.useState("activeTriggerElement"),N=P.useState("positionerElement"),I=P.useState("hoverEnabled"),A=P.useState("disabled"),U=P.useState("lastOpenChangeReason"),W=P.useState("parent"),ne=P.useState("activeIndex"),oe=P.useState("payload"),z=P.useState("floatingParentNodeId"),Q=l.useRef(null),K=l.useRef(W.type!=="context-menu"),ge=We(),Y=l.useRef(!0),ce=We(),ue=z!=null,{openMethod:ye,triggerProps:re}=em(O);P.useSyncedValues({disabled:a,highlightItemOnHover:y,modal:W.type===void 0?c:void 0,openMethod:ye,rootId:E}),ms(P);const{forceUnmount:X,transitionStatus:he}=ys(O,P,()=>{P.set("allowMouseEnter",!1)},D),fe=fs(P.context.popupRef);l.useEffect(()=>{if(H===void 0)return;const ee=()=>{P.state.instantType===H&&P.set("instantType",void 0)};if(!O){ee();return}if(he!==void 0)return;if(P.context.popupRef.current==null){ee();return}const Ce=new AbortController;return fe(ee,Ce.signal),()=>{Ce.abort()}},[H,O,he,fe,P]),J(()=>{v&&!S?P.update({parent:{type:"context-menu",context:v},floatingNodeId:F,floatingParentNodeId:R}):S&&P.update({floatingNodeId:F,floatingParentNodeId:R})},[v,S,F,R,P]),l.useEffect(()=>{if(O||(Q.current=null),W.type==="context-menu"){if(!O){ge.clear(),K.current=!1;return}ge.start(500,()=>{K.current=!0})}},[ge,O,W.type]),J(()=>{!O&&!I&&P.set("hoverEnabled",!0)},[O,I,P]);const ve=le((ee,Ce)=>{const Oe=Ce.reason;if(!ee&&!P.select("open")||O===ee&&Ce.trigger===_&&U===Oe)return;const Xe=dc(Ce);if(!ee&&Ce.trigger==null&&(Ce.trigger=_??void 0),r?.(ee,Ce),Ce.isCanceled)return;P.state.floatingRootContext.dispatchOpenChange(ee,Ce);const dt=Ce.event;if(ee===!1&&dt?.type==="click"&&dt.pointerType==="touch"&&!Y.current)return;ee&&Oe===Zt?(Y.current=!1,ce.start(300,()=>{Y.current=!0})):(Y.current=!0,ce.clear());const mt=(Oe===sn||Oe===ba)&&dt.detail===0,ft=!ee&&(Oe===Io||Oe==null);Q.current=Ce.event;const Ke=gs(P.state,ee,Ce.trigger,Xe());Ke.openChangeReason=Oe,W.type==="menubar"&&(Oe===Zt||Oe===tn||Oe===He||Oe===Cr||Oe===gn)?Ke.instantType="group":mt||ft?Ke.instantType=mt?"click":"dismiss":Ke.instantType=void 0,P.update(Ke)}),q=lc({popupStore:P,floatingRootContext:P.state.floatingRootContext,floatingId:C,nested:R!=null,onOpenChange:ve}),de=q.context.events;J(()=>{const ee=({open:Ce,eventDetails:Oe})=>ve(Ce,Oe);return de.on("setOpen",ee),()=>{de?.off("setOpen",ee)}},[de,ve]);const Z=l.useCallback(()=>{P.setOpen(!1,Se(Zr))},[P]);l.useImperativeHandle(h,()=>({unmount:X,close:Z}),[X,Z]);let te;W.type==="context-menu"&&(te=W.context),l.useImperativeHandle(te?.positionerRef,()=>N,[N]),l.useImperativeHandle(te?.actionsRef,()=>({setOpen:ve}),[ve]);const ae=ls(q,{enabled:!A,bubbles:{escapeKey:p&&W.type==="menu"},outsidePress(){return W.type!=="context-menu"||Q.current?.type==="contextmenu"?!0:K.current},externalTree:ue?L:void 0}),Ee=Rc(),ie=l.useCallback(ee=>{P.select("activeIndex")!==ee&&P.set("activeIndex",ee)},[P]),$=yh(q,{enabled:!A,listRef:P.context.itemDomElements,activeIndex:ne,nested:W.type!==void 0,loopFocus:u,orientation:d,parentOrientation:W.type==="menubar"?W.context.orientation:void 0,rtl:Ee==="rtl",disabledIndices:bn,onNavigate:ie,openOnArrowKeyDown:W.type!=="context-menu",externalTree:ue?L:void 0,focusItemOnHover:y}),V=l.useCallback(ee=>{P.context.typingRef.current=ee},[P]),B=xh(q,{enabled:!A,listRef:P.context.itemLabels,elementsRef:P.context.itemDomElements,activeIndex:ne,resetMs:zf,onMatch:ee=>{O&&ee!==ne&&P.set("activeIndex",ee)},onTyping:V}),M=l.useMemo(()=>{const ee=wt(B.reference,$.reference,ae.reference,{onMouseMove(){P.set("allowMouseEnter",!0)}},re);return ee["aria-haspopup"]="menu",ee["aria-expanded"]=O,ee},[P,B.reference,$.reference,ae.reference,re,O]),G=l.useMemo(()=>{const ee=wt($.trigger,ae.trigger,re);return ee["aria-haspopup"]="menu",ee["aria-expanded"]=!1,ee},[$.trigger,ae.trigger,re]);ze(()=>(P.update({inactiveTriggerProps:G}),null));const pe=l.useMemo(()=>wt(ps,{id:C,role:"menu","aria-orientation":d==="horizontal"?"horizontal":void 0,"aria-labelledby":_?.id,onMouseMove(){P.set("allowMouseEnter",!0),W.type==="menu"&&P.set("hoverEnabled",!1)},onClick(){P.select("hoverEnabled")&&P.set("hoverEnabled",!1)},onKeyDown(ee){const Ce=P.select("keyboardEventRelay");Ce&&!ee.isPropagationStopped()&&Ce(ee)}},B.floating,$.floating,ae.floating),[_,C,d,W.type,P,B.floating,$.floating,ae.floating]),Ue=$.item??je;xs(P,{floatingRootContext:q,activeTriggerProps:M,inactiveTriggerProps:G,popupProps:pe,itemProps:Ue});const Qe=l.useMemo(()=>({store:P,parent:T}),[P,T]),Le=f.jsxs(Lc.Provider,{value:Qe,children:[m&&f.jsx(hs,{handle:m,store:P}),typeof n=="function"?n({payload:oe}):n]});return W.type===void 0||W.type==="context-menu"?f.jsx(ep,{externalTree:L,children:Le}):Le});function am(e,t,n){return ze(()=>new nm(e,t,n)).current}const Jn=5;function cm(e,t){const n=lm(t);return e.clientX>=n.left-Jn&&e.clientX<=n.right+Jn&&e.clientY>=n.top-Jn&&e.clientY<=n.bottom+Jn}function lm(e){const t=e.getBoundingClientRect(),n=Ie(e);if(Hr)return t;const o=n.getComputedStyle(e,"::before"),r=n.getComputedStyle(e,"::after");if(!(o.content!=="none"||r.content!=="none"))return t;const i=parseFloat(o.width)||0,a=parseFloat(o.height)||0,c=parseFloat(r.width)||0,u=parseFloat(r.height)||0,d=Math.max(t.width,i,c),h=Math.max(t.height,a,u),p=d-t.width,m=h-t.height;return{left:t.left-p/2,right:t.right+p/2,top:t.top-m/2,bottom:t.bottom+m/2}}function um(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:o}=Ms(),{ref:r,index:s}=_c(e),i=n===s,a=l.useRef(null),c=nn(r,a);return{compositeProps:{tabIndex:i?0:-1,onFocus(){o(s)},onMouseMove(){const d=a.current;if(!t||!d)return;const h=d.hasAttribute("disabled")||d.ariaDisabled==="true";!i&&!h&&d.focus()}},compositeRef:c,index:s}}function dm(e){const{render:t,className:n,style:o,state:r=je,props:s=bn,refs:i=bn,metadata:a,stateAttributesMapping:c,tag:u="div",...d}=e,{compositeProps:h,compositeRef:p}=um({metadata:a});return De(u,e,{state:r,ref:[p,...i],props:[h,...s,d],stateAttributesMapping:c})}function qc(e){if(Pe(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!xt(e))return qc(Tt(e))}function fm(e,t){const n=l.useRef(null);function o(s){rt.flushSync(()=>{e.setOpen(!1,Se(tn,s.nativeEvent,s.currentTarget))}),Tf(n.current)?.focus()}function r(s){const i=e.select("positionerElement");if(i&&Jt(s,i))e.context.beforeContentFocusGuardRef.current?.focus();else{rt.flushSync(()=>{e.setOpen(!1,Se(tn,s.nativeEvent,s.currentTarget))});let a=Sf(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&se(i,a);){const c=a;if(a=os(a),a===c)break}a?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:o,handleFocusTargetFocus:r}}function pm(e){const{enabled:t=!0,mouseDownAction:n,open:o}=e,r=l.useRef(!1);return l.useMemo(()=>t?{onMouseDown:s=>{(n==="open"&&!o||n==="close"&&o)&&(r.current=!0,be(s.currentTarget).addEventListener("click",()=>{r.current=!1},{once:!0}))},onClick:s=>{r.current&&(r.current=!1,s.preventBaseUIHandler())}}:je,[t,n,o])}const Zc=da(function(t,n){const{render:o,className:r,style:s,disabled:i=!1,nativeButton:a=!0,id:c,openOnHover:u,delay:d=100,closeDelay:h=0,handle:p,payload:m,...g}=t,x=an(!0),v=hc(p)??x?.store;if(!v)throw new Error(Ye(85));const S=Ln(c),b=v.useState("isTriggerActive",S),w=v.useState("floatingRootContext"),T=v.useState("isOpenedByTrigger",S),E=v.useState("triggerPopupId",S),C=l.useRef(null),R=gm(),j=Ms(!0),D=Lt(),H=l.useMemo(()=>D??new as,[D]),P=Za(H),L=Vt(),{registerTrigger:F,isMountedByThisTrigger:O}=fc(S,C,v,{payload:m,closeDelay:h,parent:R,floatingTreeRoot:H,floatingNodeId:P,floatingParentNodeId:L,keyboardEventRelay:j?.relayKeyboardEvent}),_=R.type==="menubar",N=v.useState("disabled"),I=i||N||_&&R.context.disabled,{getButtonProps:A,buttonRef:U}=Fn({disabled:I,native:a});l.useEffect(()=>{!T&&R.type===void 0&&(v.context.allowMouseUpTriggerRef.current=!1)},[v,T,R.type]);const W=l.useRef(null),ne=We(),oe=le(te=>{if(!W.current)return;ne.clear(),v.context.allowMouseUpTriggerRef.current=!1;const ae=te.target;se(W.current,ae)||se(v.select("positionerElement"),ae)||ae===W.current||ae!=null&&qc(ae)===v.select("rootId")||cm(te,W.current)||H.events.emit("close",{domEvent:te,reason:Yd})});l.useEffect(()=>{T&&v.select("lastOpenChangeReason")===He&&be(W.current).addEventListener("mouseup",oe,{once:!0})},[T,oe,v]);const z=_&&R.context.hasSubmenuOpen,K=xc(w,{enabled:(u??z)&&!I&&(!_||z&&!O),handleClose:bc({blockPointerEvents:!_}),mouseOnly:!0,move:!1,restMs:R.type===void 0?d:void 0,delay:{close:h},triggerElementRef:C,externalTree:H,isActiveTrigger:b,isClosing:()=>v.select("transitionStatus")==="ending"}),ge=hm(T,v.select("lastOpenChangeReason")),Y=op(w,{enabled:!I,event:T&&_?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:R.type===void 0?ge:!1}),ce=gc(w,{enabled:!I&&z}),ue=pm({open:T,enabled:_,mouseDownAction:"open"}),ye=l.useMemo(()=>wt(ce.reference,Y.reference),[ce.reference,Y.reference]),re=v.useState("triggerProps",O),{preFocusGuardRef:X,handlePreFocusGuardFocus:he,handleFocusTargetFocus:fe}=fm(v,C),ve={disabled:I,open:T},q=[W,n,U,F,C],de=[ye,K??je,re,{"aria-haspopup":"menu","aria-controls":E,id:S,onMouseDown:te=>{if(v.select("open"))return;ne.start(200,()=>{v.context.allowMouseUpTriggerRef.current=!0}),be(te.currentTarget).addEventListener("mouseup",oe,{once:!0})}},_?{role:"menuitem"}:{},ue,g,A],Z=De("button",t,{enabled:!_,stateAttributesMapping:Us,state:ve,ref:q,props:de});return _?f.jsx(dm,{tag:"button",render:o,className:r,style:s,state:ve,refs:q,props:de,stateAttributesMapping:Us}):T?f.jsxs(l.Fragment,{children:[f.jsx(zt,{ref:X,onFocus:he},`${S}-pre-focus-guard`),f.jsx(l.Fragment,{children:Z},S),f.jsx(zt,{ref:v.context.triggerFocusTargetRef,onFocus:fe},`${S}-post-focus-guard`)]}):f.jsx(l.Fragment,{children:Z},S)});function hm(e,t){const n=We(),[o,r]=l.useState(!1);return J(()=>{e&&t===He?(r(!0),n.start(Wf,()=>{r(!1)})):e||(n.clear(),r(!1))},[e,t,n]),o}function gm(){const e=Gc();return l.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}const mm=l.forwardRef(function(t,n){const{className:o,render:r,orientation:s="horizontal",style:i,...a}=t;return De("div",t,{state:{orientation:s},ref:n,props:[{role:"separator","aria-orientation":s},a]})});const ym=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function xm(e,t,n=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:ym(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}const bm=e=>{let t="",n=!1;for(const o of e){if(o==="-"||o==="_"||o<=" "){n=t.length>0;continue}t.length===0?t+=o.toLowerCase():t+=n?o.toUpperCase():o,n=!1}return t};const vm=e=>{const t=bm(e);return t.charAt(0).toUpperCase()+t.slice(1)};const Mr=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();const _t={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function sr(e){return e!=null}function wm(e,t={}){const n=t.attributeNames??{},o=p=>n[p]??p,r=e.size??e.width??_t.width,s=e.size??e.height??_t.height,i=e.aliases?.filter(p=>typeof p=="string"&&p.trim()!=="").map(p=>`lucide-${p}`)??[],a=[...e.name?[`lucide-${e.name}`]:[],...i],c=t.className?.split(" ").filter(Boolean)??[],u=t.includeDefaultClasses===!1?Mr(...c):Mr("lucide",...a,...c),d=t.absoluteStrokeWidth?Number(t.strokeWidth??_t["stroke-width"])*Number(e.size??e.width??_t.width)/Number(t.size??t.width??_t.width):t.strokeWidth??_t["stroke-width"];return["svg",{...Object.entries(_t).reduce((p,[m,g])=>(p[o(m)]=g,p),{}),..."color"in t&&t.color&&{[o("stroke")]:t.color},..."size"in t&&sr(t.size)&&{[o("width")]:t.size,[o("height")]:t.size},..."width"in t&&sr(t.width)&&{[o("width")]:t.width},..."height"in t&&sr(t.height)&&{[o("height")]:t.height},[o("stroke-width")]:d,...u&&{[o("class")]:u},[o("viewBox")]:`0 0 ${r} ${s}`,...t.hasA11yProp===!1?{[o("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(p=>{const[m,g,x]=p,y=t.nonScalingStroke?{[o("vector-effect")]:"non-scaling-stroke",...g}:g;return x?[m,y,x]:[m,y]})]}function Sm(e,t={}){return wm(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}const Tm=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Em=l.createContext({}),Rm=()=>l.useContext(Em),Cm=l.forwardRef(({color:e,size:t,width:n,height:o,strokeWidth:r,absoluteStrokeWidth:s,nonScalingStroke:i,className:a="",children:c,iconNode:u=[],icon:d={node:u,aliases:[],size:24},...h},p)=>{const{size:m=24,strokeWidth:g=2,absoluteStrokeWidth:x=!1,nonScalingStroke:y=!1,color:v="currentColor",className:S=""}=Rm()??{},b=!!c||Tm(h),[w,T,E=[]]=Sm(d,{color:e??v,width:n??t??m,height:o??t??m,strokeWidth:r??g,absoluteStrokeWidth:s??x,nonScalingStroke:i??y,className:Mr(S,a),hasA11yProp:b,attributes:h});return l.createElement(w,{ref:p,...T},[...E.map(([C,R])=>l.createElement(C,R)),...Array.isArray(c)?c:[c]])});function Me(e,t=[],n=[]){const o=typeof e=="string"?xm(e,t,n):e,r=l.forwardRef(({className:s,...i},a)=>l.createElement(Cm,{ref:a,icon:o,className:s,...i}));return o.name&&(r.displayName=vm(o.name)),r}const Jc={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};Jc.node;const km=Me(Jc);const Qc={name:"building-complex",size:24,node:[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],aliases:["building-2"]};Qc.node;const Pm=Me(Qc);const el={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};el.node;const As=Me(el);const tl={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};tl.node;const Om=Me(tl);const nl={name:"circle-alert",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle"]};nl.node;const Im=Me(nl);const ol={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};ol.node;const Mm=Me(ol);const rl={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};rl.node;const Am=Me(rl);const sl={name:"download",size:24,node:[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]};sl.node;const Nm=Me(sl);const il={name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]};il.node;const jm=Me(il);const al={name:"external-link",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]};al.node;const cl=Me(al);const ll={name:"eye",size:24,node:[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};ll.node;const Dm=Me(ll);const ul={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};ul.node;const Lm=Me(ul);const dl={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]};dl.node;const Fm=Me(dl);const fl={name:"link",size:24,node:[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]};fl.node;const Ns=Me(fl);const pl={name:"log-in",size:24,node:[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]};pl.node;const hl=Me(pl);const gl={name:"lock",size:24,node:[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]};gl.node;const _m=Me(gl);const ml={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};ml.node;const Hm=Me(ml);const yl={name:"message-circle",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]};yl.node;const Bm=Me(yl);const xl={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};xl.node;const $m=Me(xl);const bl={name:"shapes",size:24,node:[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]};bl.node;const zm=Me(bl);const vl={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};vl.node;const js=Me(vl);const wl={name:"triangle-alert",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle"]};wl.node;const Sl=Me(wl);const Tl={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};Tl.node;const El=Me(Tl);const Rl={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};Rl.node;const Wm=Me(Rl);const Cl={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};Cl.node;const Ds=Me(Cl),Ar=500,Um=8;function Km(e,t,n){return n<e.at||n-e.at>Ar?!1:Math.hypot(t.clientX-e.x,t.clientY-e.y)<=Um}const Ni=["pointerdown","mousedown","pointerup","mouseup","click","dblclick"];function Vm(e,t,n=Date.now){let o=!1,r=!1,s=0;const i=()=>{if(!r){r=!0,e.clearTimeout(s);for(const u of Ni)e.removeEventListener(u,c,!0)}},a=()=>{o?s=e.setTimeout(a,Ar):i()},c=u=>{const d=u.type==="pointerdown"||u.type==="mousedown";if(!(o&&!d)&&!Km(t,u,n())){d&&i();return}u.preventDefault(),u.stopImmediatePropagation(),d?o=!0:(u.type==="click"||u.type==="dblclick")&&(o=!1)};for(const u of Ni)e.addEventListener(u,c,!0);return s=e.setTimeout(a,Math.max(0,Ar-(n()-t.at))),i}function Ym(e){e.detail<1||!e.view||Vm(e.view,{x:e.clientX,y:e.clientY,at:Date.now()})}function Gm(){return{meantFor:new WeakMap,inside:new WeakSet,sent:new WeakSet,passedOver:new WeakSet}}const kl=e=>e.hasAttribute("data-open");function Xm(e,t,n){if(!kl(t)){e.passedOver.delete(t);return}n.key!=="Escape"||Os(n)||(t.contains(n.target)?e.inside.add(n):e.passedOver.has(t)||e.meantFor.set(n,t))}function qm(e,t){const n=t.event;if(t.reason!=="escape-key"||!n)return!1;if(e.sent.has(n))return t.cancel(),!0;const o=e.meantFor.get(n),r=o?.ownerDocument.defaultView;if(!o||!r||e.inside.has(n)||n.defaultPrevented)return!1;const s=new r.KeyboardEvent("keydown",{key:"Escape",code:"Escape",repeat:n.repeat??!1,bubbles:!0,cancelable:!0});return e.sent.add(s),t.cancel(),n.preventDefault?.(),o.dispatchEvent(s),r.setTimeout(()=>{kl(o)&&e.passedOver.add(o)},0),!0}const Pl=l.createContext(null);function Zm(){const e=l.useContext(Pl),t=l.useRef(null);return l.useCallback(n=>{if(t.current?.(),t.current=null,!e||!n)return;const o=n,r=o.ownerDocument,s=i=>Xm(e,o,i);r.addEventListener("keydown",s,!0),t.current=()=>r.removeEventListener("keydown",s,!0)},[e])}const yn="data-menu-tree",Ol="data-menu-shortcut",Jm=`[${Ol}][aria-keyshortcuts]:not([aria-disabled="true"]):not([data-disabled])`,Qm='input, textarea, [contenteditable]:not([contenteditable="false"])';function ey(e){return e!==null&&typeof e.closest=="function"?e:null}function ty(e,t,n){const o=t.closest(Qm);return o!==null&&n.contains(o)?o.matches("[contenteditable]")||ng(e):(e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey&&(e.code==="KeyC"||e.keyCode===67)&&t.ownerDocument.getSelection()?.isCollapsed===!1}function ny(e){const t=ey(e.target),n=t?.closest(`[${yn}]`)??null;if(t===null||n===null||e.defaultPrevented||Os({isComposing:e.nativeEvent.isComposing,keyCode:e.keyCode})||ty(e,t,n))return null;const o=n.getAttribute(yn),r=n.getRootNode(),s={...oy(e),altGraph:e.nativeEvent.getModifierState?.("AltGraph")===!0},i=[...r.querySelectorAll(`[${yn}][data-open]`)].filter(a=>a.getAttribute(yn)===o);for(const a of i.reverse())for(const c of a.querySelectorAll(Jm)){const u=Qh(c.getAttribute("aria-keyshortcuts")??"");if(u!==null&&tg(u,s)&&c.checkVisibility?.()!==!1)return c}return null}function oy(e){const{key:t,code:n,keyCode:o,metaKey:r,ctrlKey:s,altKey:i,shiftKey:a}=e;return{key:t,code:n,keyCode:o,metaKey:r,ctrlKey:s,altKey:i,shiftKey:a}}function ry(e,t){if(e===null)return;const n=o=>{const r=o.code===t;if(o.type==="keydown"&&o.repeat){if(!r)return;o.preventDefault(),o.stopImmediatePropagation();return}(o.type==="keydown"||r||o.key==="Meta")&&(e.removeEventListener("keydown",n,!0),e.removeEventListener("keyup",n,!0))};e.addEventListener("keydown",n,!0),e.addEventListener("keyup",n,!0)}function sy(e,t){if(e.isPropagationStopped())return;const n=ny(e);n!==null&&(e.preventDefault(),e.stopPropagation(),e.preventBaseUIHandler?.(),!e.repeat&&(ry(n.ownerDocument.defaultView,e.code),t(()=>n.focus({preventScroll:!0})),n.click()))}const iy="rounded-lg bg-surface p-1 text-[13px] text-fg shadow-popup outline-none origin-[var(--transform-origin)] transition-[opacity,transform] duration-100 data-[starting-style]:opacity-0 data-[starting-style]:scale-95 data-[ending-style]:opacity-0",ay="flex h-7 min-w-40 cursor-default select-none items-center gap-2 rounded-md px-2 outline-none data-[highlighted]:bg-hover data-[disabled]:opacity-40",Il=l.createContext(null);function cy(){const e=l.useContext(Il),t=l.useId(),n=e??t;return{tree:n,popupProps:{[yn]:n,onKeyDown:o=>sy(o,rt.flushSync)}}}const ly=Il.Provider;function uy(e,t=!1){if(e===void 0)return null;const n=Oc(),o={"aria-keyshortcuts":Jh(e,n)};return!t&&eg(jo(e,n),n)&&(o[Ol]=""),{label:qh(e,n),spoken:Zh(e,n),rowProps:o}}function dy(e){return{getBoundingClientRect:()=>new DOMRect(e.x,e.y,0,0)}}function fy({trigger:e,children:t,side:n="bottom",align:o="start",open:r,onOpenChange:s,modal:i,at:a,onPopupWheel:c}){const u=Zm(),{tree:d,popupProps:h}=cy(),p=a?.x,m=a?.y,g=l.useMemo(()=>p===void 0||m===void 0?void 0:dy({x:p,y:m}),[p,m]);return f.jsxs(Xc,{open:r,onOpenChange:s?x=>s(x):void 0,...i===void 0?{}:{modal:i},children:[f.jsx(Zc,{render:e,onKeyDown:go}),f.jsx(Wc,{children:f.jsx(Yc,{side:n,align:o,sideOffset:g===void 0?6:2,className:"z-[1000]",...g===void 0?{}:{anchor:g},children:f.jsx($c,{ref:u,className:iy,...h,...c===void 0?{}:{onWheel:c},children:f.jsx(ly,{value:d,children:t})})})})]})}function ji({children:e,onSelect:t,icon:n,shortcut:o,keys:r,hintOnly:s,disabled:i,danger:a,title:c}){const u=uy(r,s);return f.jsxs(Hc,{className:Ae(ay,a&&"text-danger"),disabled:i,title:c,onClick:d=>{Ym(d.nativeEvent),t?.()},onKeyDown:go,...u?.rowProps,children:[f.jsx("span",{className:"flex size-4 items-center justify-center text-fg-muted",children:n}),f.jsx("span",{className:"min-w-0 flex-1",children:e}),u?f.jsxs("span",{className:"ml-4 text-xs text-fg-subtle",children:[f.jsx("span",{"aria-hidden":"true",children:u.label}),f.jsx("span",{className:"sr-only",children:u.spoken})]}):o?f.jsx("span",{className:"ml-4 text-xs text-fg-subtle",children:o}):null]})}function Di(){return f.jsx(mm,{className:"mx-1 my-1 h-px bg-line"})}function py({children:e}){return f.jsx("div",{className:"px-2 py-1 text-xs text-fg-subtle",children:e})}const Ml=l.createContext(void 0);function Yt(e){const t=l.useContext(Ml);if(!e&&t===void 0)throw new Error(Ye(27));return t}const hy=l.forwardRef(function(t,n){const{render:o,className:r,style:s,forceRender:i=!1,...a}=t,c=Yt(),u=c.useState("open"),d=c.useState("nested"),h=c.useState("mounted"),p=c.useState("transitionStatus");return De("div",t,{state:{open:u,transitionStatus:p},ref:[c.context.backdropRef,n],stateAttributesMapping:Gr,props:[{role:"presentation",hidden:!h,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:i||!d})}),gy=l.forwardRef(function(t,n){const{render:o,className:r,style:s,disabled:i=!1,nativeButton:a=!0,...c}=t,u=Yt(),d=u.useState("open"),{getButtonProps:h,buttonRef:p}=Fn({disabled:i,native:a}),m={disabled:i};function g(x){d&&u.setOpen(!1,Se(Vd,x.nativeEvent))}return De("button",t,{state:m,ref:[n,p],props:[{onClick:g},c,h]})}),my=l.forwardRef(function(t,n){const{render:o,className:r,style:s,id:i,...a}=t,c=Yt(),u=Ln(i);return c.useSyncedValueWithCleanup("descriptionElementId",u),De("p",t,{ref:n,props:[{id:u},a]})}),Al=l.createContext(void 0);function yy(){const e=l.useContext(Al);if(e===void 0)throw new Error(Ye(26));return e}const xy="--nested-dialogs",by="data-nested-dialog-open",vy={...Yr,...Vr,nestedDialogOpen(e){return e?{[by]:""}:null}},wy=l.forwardRef(function(t,n){const{render:o,className:r,style:s,finalFocus:i,initialFocus:a,...c}=t,u=Yt(),d=u.useState("descriptionElementId"),h=u.useState("disablePointerDismissal"),p=u.useState("floatingRootContext"),m=u.useState("popupProps"),g=u.useState("modal"),x=u.useState("mounted"),y=u.useState("nested"),v=u.useState("nestedOpenDialogCount"),S=u.useState("open"),b=u.useState("openMethod"),w=u.useState("titleElementId"),T=u.useState("transitionStatus"),E=u.useState("role"),C=p.useState("floatingId");yy(),Dn({open:S,ref:u.context.popupRef,onComplete(){S&&u.context.onOpenChangeComplete?.(!0)}});const R=a===void 0?ih(u.context.popupRef):a,j=v>0,D=u.useStateSetter("popupElement"),P=De("div",t,{state:{open:S,nested:y,transitionStatus:T,nestedDialogOpen:j},props:[m,{id:C,"aria-labelledby":w,"aria-describedby":d,role:E,...ps,hidden:!x,onKeyDown(L){Bc.has(L.key)&&L.stopPropagation()},style:{[xy]:v}},c],ref:[n,u.context.popupRef,D],stateAttributesMapping:vy});return f.jsx(Ja,{context:p,openInteractionType:b,disabled:!x,closeOnFocusOut:!h,initialFocus:R,returnFocus:i,modal:g!==!1,restoreFocus:"popup",children:P})}),Sy=l.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,s=Yt(),i=s.useState("mounted"),a=s.useState("modal"),c=s.useState("open");return i||o?f.jsx(Al.Provider,{value:o,children:f.jsxs(Ya,{ref:n,...r,children:[i&&a===!0&&f.jsx(Kc,{ref:s.context.internalBackdropRef,inert:Cs(!c)}),t.children]})}):null});function Ty({store:e,parentContext:t,isDrawer:n}){const o=e.useState("open"),r=e.useState("disablePointerDismissal"),s=e.useState("modal"),i=e.useState("popupElement"),a=e.useState("floatingRootContext"),[c,u]=l.useState(0),[d,h]=l.useState(0),p=c===0,m=ls(a,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(g){if(!e.context.outsidePressEnabledRef.current||"button"in g&&g.button!==0)return!1;if("touches"in g){if(g.type==="touchend"){if(g.changedTouches.length!==1||g.touches.length!==0)return!1}else if(g.touches.length!==1)return!1}const x=Ne(g);if(p&&!r){if(s){const y=e.context.internalBackdropRef.current,v=e.context.backdropRef.current;return y||v?y===x||v===x||se(x,i)&&!x?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:p});return Vc(o&&s===!0,i),e.useContextCallback("onNestedDialogOpen",(g,x)=>{u(g),h(x)}),J(()=>(t?.onNestedDialogOpen&&(o?t.onNestedDialogOpen(c+1,d+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(0,0)}),[n,o,c,d,t]),xs(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:d}),null}const Ey={...Ss,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class Ry extends jn{constructor(t,n,o){const r=new bs,s=Cy(t,r,n,o);super(s,ky(r),Ey)}setOpen=(t,n)=>{n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),!n.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(t,n),this.update(gs(this.state,t,n.trigger)))}}function Cy(e,t,n,o=!1){return{...vs(t,n,o),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function ky(e){return{popupRef:l.createRef(),backdropRef:l.createRef(),internalBackdropRef:l.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Py(e,t){const{children:n,open:o,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:i,disablePointerDismissal:a=!1,modal:c=!0,actionsRef:u,handle:d,triggerId:h,defaultTriggerId:p=null}=t,m=e==="drawer",g=c,x=a,y="dialog",v=Yt(!0),S=v!=null,b={modal:g,disablePointerDismissal:x,nested:S,role:y},w=uc((D,H)=>new Ry({open:r,openProp:o,activeTriggerId:p,triggerIdProp:h,...b},D,H),!0);w.useControlledProp("openProp",o),w.useControlledProp("triggerIdProp",h),w.useSyncedValues(b),w.useContextCallback("onOpenChange",s),w.useContextCallback("onOpenChangeComplete",i);const T=w.useState("open"),E=w.useState("mounted"),C=w.useState("payload");lh(w,T),ms(w);const{forceUnmount:R}=ys(T,w);l.useImperativeHandle(u,()=>({unmount:R,close:()=>w.setOpen(!1,Se(Zr))}),[R,w]);const j=T||E;return f.jsxs(Ml.Provider,{value:w,children:[d&&f.jsx(hs,{handle:d,store:w}),j&&f.jsx(Ty,{store:w,parentContext:v?.context,isDrawer:m}),typeof n=="function"?n({payload:C}):n]})}const Oy=bo(function(t){return Py("dialog",t)}),Iy=l.forwardRef(function(t,n){const{render:o,className:r,style:s,id:i,...a}=t,c=Yt(),u=Ln(i);return c.useSyncedValueWithCleanup("titleElementId",u),De("h2",t,{ref:n,props:[{id:u},a]})}),My=["a[href]","button","iframe","input","select","textarea","summary","audio[controls]","video[controls]","[contenteditable]:not([contenteditable='false'])","[tabindex]"].join(", "),Ay="audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function Ny(e){return!(e.tabIndex>=0||!e.hasAttribute("tabindex")&&e.matches(Ay))||e.getAttribute("aria-hidden")==="true"||e.matches(":disabled")?!1:typeof e.checkVisibility!="function"||e.checkVisibility({visibilityProperty:!0})}function jy(e){return Array.from(e.querySelectorAll(My)).filter(Ny)}function Nl(e){const t=n=>!/visible|hidden|clip/.test(n);return e.scrollWidth>e.clientWidth+1&&t(e.overflowX)||e.scrollHeight>e.clientHeight+1&&t(e.overflowY)}function Dy(e){return Nl(e)?e.scrollTop+e.clientHeight>=e.scrollHeight-1?"end":"more":"none"}function Ly(e,t){return e.top>=t.top-.5&&e.bottom<=t.bottom+.5}const Fy="data-select-all";function _y(e,t){l.useEffect(()=>{const n=e.current;if(!t||n===null)return;const o=n.ownerDocument,r=()=>n.isConnected&&n.hasAttribute("data-open")&&!n.hasAttribute("data-nested-dialog-open"),s=a=>{a.target!==o.body||!r()||(a.preventDefault(),o.getSelection()?.selectAllChildren(n.querySelector(`[${Fy}]`)??n))},i=a=>{if(!(a.metaKey||a.ctrlKey)||!ug(a)||!r())return;const c=o.getSelection(),u=c?.anchorNode??null,d=u===null?null:u.nodeType===Node.ELEMENT_NODE?u:u.parentElement;d!==null&&!n.contains(d)&&c?.removeAllRanges()};return o.addEventListener("selectstart",s),o.addEventListener("keydown",i,!0),()=>{o.removeEventListener("selectstart",s),o.removeEventListener("keydown",i,!0)}},[e,t])}function jl({open:e,onOpenChange:t,title:n,description:o,children:r,footer:s,className:i,onOpenChangeComplete:a,onKeyCapture:c,initialFocus:u,finalFocus:d}){const h=l.useRef(!1),p=l.useRef(e),[m]=l.useState(Gm),g=l.useRef(null),[x,y]=l.useState(!1),v=l.useCallback(b=>{g.current=b,y(b!==null)},[]);_y(g,e&&x),l.useEffect(()=>{e!==p.current&&(p.current=e,!e&&h.current&&Nc(window,"Enter",()=>!1),h.current=!1)},[e]);const S=b=>{c?.(b),b.key==="Enter"&&(h.current=b.type==="keydown")};return f.jsx(Pl.Provider,{value:m,children:f.jsx(Oy,{open:e,onOpenChange:(b,w)=>{qm(m,w)||t(b)},onOpenChangeComplete:a,children:f.jsxs(Sy,{children:[f.jsx(hy,{className:"fixed inset-0 z-[900] bg-black/30 transition-opacity data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"}),f.jsxs(wy,{ref:v,className:Ae("fixed left-1/2 top-1/2 z-[901] max-h-[calc(100dvh-2rem)] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto overscroll-contain rounded-xl bg-surface p-5 text-fg shadow-popup outline-none","transition-[opacity,transform] data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",i),onKeyDownCapture:S,onKeyUpCapture:S,initialFocus:u,finalFocus:d,children:[f.jsxs("div",{className:"mb-3 flex items-start gap-3",children:[f.jsxs("div",{className:"flex-1",children:[f.jsx(Iy,{className:"text-[15px] font-semibold",children:n}),o?f.jsx(my,{className:"mt-1 text-fg-muted",children:o}):null]}),f.jsx(gy,{"aria-label":"Close",className:"rounded-md p-1 text-fg-muted hover:bg-hover",children:f.jsx(Ds,{className:"size-4"})})]}),r,s?f.jsx("div",{className:"mt-4 flex justify-end gap-2",children:s}):null]})]})})})}function Hy(e,t){for(let n=e.parentElement;n&&n!==t;n=n.parentElement){const{overflowY:o}=getComputedStyle(n);if((o==="auto"||o==="scroll")&&n.scrollHeight>n.clientHeight)return n}return t}function By(e){const t=e?.closest('[role="dialog"], [role="alertdialog"]');return!e||!t?!0:Ly(e.getBoundingClientRect(),Hy(e,t).getBoundingClientRect())?e:t}function $y({open:e,onOpenChange:t,title:n,description:o,confirmLabel:r="Confirm",cancelLabel:s="Cancel",danger:i,guardEarlyPress:a,initialFocus:c,finalFocus:u,onConfirm:d}){const h=l.useRef(null),p=l.useRef(null),m=l.useRef(null),g=!!(i&&a);return e?g&&!h.current&&(h.current={opened:performance.now(),shown:null}):h.current=null,f.jsx(jl,{open:e,onOpenChange:t,title:n,description:o,initialFocus:c==="cancel"?p:c==="confirm"?()=>By(m.current):c,finalFocus:u,onOpenChangeComplete:g?x=>{x&&h.current&&h.current.shown===null&&(h.current={...h.current,shown:performance.now()})}:void 0,onKeyCapture:g?x=>{h.current&&hg(h.current,performance.now(),{key:x.key,repeat:x.repeat,isTrusted:x.nativeEvent.isTrusted})&&x.preventDefault()}:void 0,footer:f.jsxs(f.Fragment,{children:[f.jsx(Kt,{ref:p,onClick:()=>t(!1),children:s}),f.jsx(Kt,{ref:m,variant:i?"danger":"primary",onClick:()=>{d(),t(!1)},children:r})]})})}const ir="data-ui-wheeling";function zy(e){return/Apple Computer/.test(e.navigator.vendor)}function Wy(e){const t=e.ownerDocument.defaultView;if(!t||e.type!=="number"||zy(t)||!e.matches(":focus")||e.hasAttribute(ir))return;const n=e.scrollLeft;e.setAttribute(ir,"");const o=n-e.scrollLeft;t.requestAnimationFrame(()=>{e.removeAttribute(ir),e.scrollLeft+=o})}const Uy="h-7 w-full min-w-0 rounded-control border border-line bg-surface-2 px-2 text-[13px] text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:bg-surface",Ky=l.forwardRef(function({className:t,onWheel:n,...o},r){return f.jsx("input",{ref:r,"data-ui-field":"",className:Ae(Uy,"[&[data-ui-wheeling]::-webkit-inner-spin-button]:hidden",t),...o,onWheel:s=>{n?.(s),Wy(s.currentTarget)}})}),Vy=[[1424,2303],[64285,65023],[65136,65276],[67584,69631],[124928,126975]],Yy=8206,Gy=8207,Xy=1564;function qy(e){return Vy.some(([t,n])=>e>=t&&e<=n)}function Zy(e){for(const t of e){const n=t.codePointAt(0);if(n===Gy||n===Xy)return"rtl";if(n===Yy)return"ltr";if(/\p{L}/u.test(t))return qy(n)?"rtl":"ltr"}}function Jy(e,t){const n=e.borderBox?e.border:0,o=Math.max(1,t)*e.lineHeight+(e.borderBox?e.padding+e.border:0),r=Math.max(o,e.scrollHeight-(e.borderBox?0:e.padding)+n);return{height:Math.min(r,e.maxHeight),scrolls:r>e.maxHeight}}function Qy(e,t){const n=Number.parseFloat(e);return Number.isFinite(n)?n:1.2*(Number.parseFloat(t)||16)}const ex={xs:"text-[11px] leading-4",sm:"text-xs leading-4",md:"text-[13px] leading-5"};function pn(e){return Number.parseFloat(e)||0}function tx(e,t){const n=e.ownerDocument.defaultView;if(!n)return;const o=n.getComputedStyle(e);e.style.height="auto";const r=Jy({scrollHeight:e.scrollHeight,lineHeight:Qy(o.lineHeight,o.fontSize),padding:pn(o.paddingTop)+pn(o.paddingBottom),border:pn(o.borderTopWidth)+pn(o.borderBottomWidth),borderBox:o.boxSizing==="border-box",maxHeight:o.maxHeight==="none"?1/0:pn(o.maxHeight)},t);e.style.height=`${r.height}px`,e.style.overflowY=r.scrolls?"auto":"hidden"}function nx(e){const t=e.ownerDocument.documentElement.dir==="rtl"?Zy(e.value):void 0;t?e.setAttribute("dir",t):e.removeAttribute("dir")}function Dl(e,t){typeof e=="function"?e(t):e&&(e.current=t)}const ox=l.forwardRef(function({rows:t=3,resize:n,autosize:o=!1,size:r="md",fullWidth:s=!0,bare:i=!1,dir:a,className:c,value:u,onInput:d,...h},p){const m=l.useRef(null),g=l.useCallback(y=>{m.current=y,Dl(p,y)},[p]),x=l.useCallback(()=>{const y=m.current;y&&(a===void 0&&nx(y),o&&tx(y,t))},[o,t,a]);return l.useLayoutEffect(x,[x,u]),l.useEffect(()=>{const y=m.current,v=y?.ownerDocument.defaultView;if(!y||!v)return;let S=0;const b=()=>{v.cancelAnimationFrame(S),S=v.requestAnimationFrame(x)},w=y.form;w?.addEventListener("reset",b);const T=new v.MutationObserver(x);T.observe(y.ownerDocument.documentElement,{attributes:!0,attributeFilter:["dir"]});let E=y.offsetWidth;const C=new v.ResizeObserver(()=>{y.offsetWidth!==E&&(E=y.offsetWidth,b())});o&&C.observe(y);const R=y.ownerDocument.fonts;return o&&(R?.addEventListener("loadingdone",b),R?.ready.then(b)),()=>{v.cancelAnimationFrame(S),w?.removeEventListener("reset",b),T.disconnect(),C.disconnect(),R?.removeEventListener("loadingdone",b)}},[x,o]),f.jsx("textarea",{ref:g,"data-ui-field":"",rows:t,dir:a,value:u,className:Ae("min-w-0 text-fg outline-none placeholder:text-fg-subtle",i?"border-0 bg-transparent p-0":"rounded-control border border-line bg-surface-2 px-2 py-1 focus:border-accent focus:bg-surface",s?"w-full":"w-auto",(n??(o?"none":"y"))==="none"?"resize-none":"resize-y",ex[r],c),onInput:y=>{d?.(y),x()},...h})});l.forwardRef(function({label:t,hint:n,error:o,reserveErrorLines:r=0,busy:s=!1,id:i,disabled:a,onFocus:c,onBlur:u,...d},h){const p=l.useId(),m=i??p,g=`${m}-hint`,x=`${m}-error`,y=l.useRef(null),v=l.useCallback(T=>{y.current=T,Dl(h,T)},[h]),S=l.useRef(!1),b=l.useRef(s);b.current=s,l.useEffect(()=>{const T=y.current;if(s||!T||!S.current)return;const E=T.ownerDocument.activeElement;(E===null||E===T.ownerDocument.body)&&T.focus()},[s]);const w=[n?g:null,o?x:null].filter(Boolean).join(" ");return f.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[f.jsx("label",{htmlFor:m,className:"text-xs text-fg-muted",children:t}),n?f.jsx("p",{id:g,className:"text-xs text-fg-subtle",children:n}):null,f.jsx(ox,{ref:v,id:m,disabled:a||s,"aria-busy":s||void 0,"aria-invalid":o?!0:void 0,"aria-describedby":w||void 0,onFocus:T=>{S.current=!0,c?.(T)},onBlur:T=>{b.current||(S.current=!1),u?.(T)},...d}),o||r>0?f.jsx("p",{id:x,className:"text-xs leading-4 text-danger",style:r>0?{minHeight:`${r}rem`}:void 0,children:o}):null]})});function rx(e,t){const n=Ie(e).getComputedStyle(e).transform;let o=0,r=0,s=1;if(n&&n!=="none"){const i=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(i){const a=i[1].split(", ").map(parseFloat);a.length===6?(o=a[4],r=a[5],s=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(o=a[12],r=a[13],s=a[0])}}return{x:o,y:r,scale:s}}const Ll=l.createContext(void 0);function Fo(){const e=l.useContext(Ll);if(!e)throw new Error(Ye(73));return e}let Li=0;function Fl(e){return Li+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${Li}`}function ar(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const n=e(t);return typeof n=="string"?{description:n}:n}return e}function cr(e){const t=new Map;let n=0,o=0;return e.forEach((r,s)=>{const i=r.transitionStatus==="ending";t.set(r.id,{value:r,domIndex:s,visibleIndex:i?-1:n,offsetY:o}),o+=r.height||0,i||(n+=1)}),t}function lr(e,t){let n=0;return e.map(o=>{if(o.transitionStatus==="ending")return o;const r=n>=t;return n+=1,o.limited===r?o:{...o,limited:r}})}const at={toasts:e=>e.toasts,isEmpty:e=>e.toasts.length===0,toast:(e,t)=>e.toastMetadata.get(t)?.value,toastIndex:(e,t)=>e.toastMetadata.get(t)?.domIndex??-1,toastOffsetY:(e,t)=>e.toastMetadata.get(t)?.offsetY??0,toastVisibleIndex:(e,t)=>e.toastMetadata.get(t)?.visibleIndex??-1,focused:e=>e.focused,expanded:e=>e.hovering||e.focused,expandedOrOutOfFocus:e=>e.hovering||e.focused||!e.isWindowFocused,prevFocusElement:e=>e.prevFocusElement};class sx extends jn{timers=new Map;areTimersPaused=!1;constructor(t){super({...t,toastMetadata:cr(t.toasts)},{},at)}setViewport=t=>{this.set("viewport",t)};syncProviderProps(t,n){const o=this.state.limit!==n;if(this.state.timeout===t&&!o)return;const r={timeout:t,limit:n};if(o){const s=lr(this.state.toasts,n);r.toasts=s,r.toastMetadata=cr(s)}this.update(r)}disposeEffect=()=>()=>{this.timers.forEach(t=>{t.timeout?.clear()}),this.timers.clear()};removeToast(t,n=!1){const o=at.toastIndex(this.state,t);if(o===-1)return;const r=this.state.toasts[o];n||r?.onRemove?.();const s=[...this.state.toasts];s.splice(o,1),this.setToasts(s)}addToast=t=>{const{timeout:n,limit:o}=this.state,r=t.id||Fl("toast");if(t.id){const c=at.toast(this.state,t.id);if(c)if(c.transitionStatus==="ending")this.removeToast(t.id,!0);else{const{id:u,transitionStatus:d,...h}=t;return this.updateToastInternal(t.id,h,!0,!0),t.id}}const s={...t,id:r,updateKey:0,transitionStatus:"starting"},i=[s,...this.state.toasts];this.setToasts(lr(i,o));const a=s.timeout??n;return s.type!=="loading"&&a>0&&this.scheduleTimer(r,a,()=>this.closeToast(r)),at.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),r};updateToast=(t,n)=>{const o=at.toast(this.state,t);!o||o.transitionStatus==="ending"||this.updateToastInternal(t,typeof n=="function"?n(o):n,!1,!0)};updateToastInternal=(t,n,o=!1,r=!1)=>{const{timeout:s,toasts:i}=this.state,a=at.toast(this.state,t);if(!a||a.transitionStatus==="ending")return;const c={...a,...n,...r&&{updateKey:a.updateKey+1}};this.setToasts(i.map(y=>y.id===t?c:y));const u=c.timeout??s,d=a.timeout??s,h=Object.hasOwn(n,"timeout"),p=c.transitionStatus!=="ending"&&c.type!=="loading"&&u>0,m=this.timers.has(t),g=d!==u,x=a.type==="loading";if(!p&&m){this.clearTimer(t);return}p&&(!m||g||h||x||o)&&(this.clearTimer(t),this.scheduleTimer(t,u,()=>this.closeToast(t)),at.expandedOrOutOfFocus(this.state)&&this.pauseTimers())};closeToast=t=>{const n=t===void 0,{limit:o,toasts:r}=this.state;let s;if(n)s=r,this.clearTimers();else{const c=at.toast(this.state,t);if(!c)return;s=[c],this.clearTimer(t)}const i=r.map(c=>n||c.id===t?{...c,transitionStatus:"ending",height:0}:c),a=lr(i,o);this.setToasts(a,!a.some(c=>c.transitionStatus!=="ending")),s.forEach(c=>{c.transitionStatus!=="ending"&&c.onClose?.()}),this.handleFocusManagement(t)};promiseToast=(t,n)=>{const o=ar(n.loading),r=this.addToast({...o,type:"loading"}),s=t.then(i=>{const a=ar(n.success,i);return this.updateToast(r,{...a,type:"success",timeout:a.timeout}),i}).catch(i=>{const a=ar(n.error,i);return this.updateToast(r,{...a,type:"error",timeout:a.timeout}),Promise.reject(i)});return{}.hasOwnProperty.call(n,"setPromise")&&n.setPromise(s),s};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(t=>{t.timeout&&(t.timeout.clear(),t.remaining=Math.max(t.remaining-(Date.now()-t.start),0))}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((t,n)=>{t.remaining=t.remaining>0?t.remaining:t.delay,t.timeout??=Ze.create(),t.timeout.start(t.remaining,()=>{this.handleTimerFired(n),t.callback()}),t.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=t=>{if(t.pointerType!=="touch")return;const n=Ne(t);se(this.state.viewport,n)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(t,n,o){const r=Date.now(),i=!at.expandedOrOutOfFocus(this.state)?Ze.create():void 0;i?.start(n,()=>{this.handleTimerFired(t),o()}),this.timers.set(t,{timeout:i,start:r,delay:n,remaining:n,callback:o})}clearTimers(){this.timers.forEach(t=>{t.timeout?.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer(t){this.timers.get(t)?.timeout?.clear(),this.timers.delete(t),this.resetPausedStateIfNoTimersRemain()}handleTimerFired(t){this.timers.delete(t),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){this.timers.size===0&&(this.areTimersPaused=!1)}setToasts(t,n=t.length===0){const o={toasts:t,toastMetadata:cr(t)};n&&(o.hovering=!1,o.focused=!1),this.update(o)}handleFocusManagement(t){const n=_e(be(this.state.viewport));if(!this.state.viewport||!se(this.state.viewport,n)||!so(n))return;if(t===void 0){this.restoreFocusToPrevElement();return}const o=at.toasts(this.state),r=at.toastIndex(this.state,t),s=(a,c)=>{for(let u=a;u>=0&&u<o.length;u+=c)if(o[u].transitionStatus!=="ending")return o[u];return null},i=s(r+1,1)??s(r-1,-1);i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}}const ix=function(t){const{children:n,timeout:o=5e3,limit:r=3,toastManager:s}=t,i=ze(()=>new sx({timeout:o,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return wo(i.disposeEffect),l.useEffect(function(){return s?s[" subscribe"](({action:u,options:d})=>{const h=d.id;u==="promise"&&d.promise?i.promiseToast(d.promise,d):u==="update"&&h?i.updateToast(h,d.updates):u==="close"?i.closeToast(h):i.addToast(d)}):void 0},[i,s]),f.jsxs(Ll.Provider,{value:i,children:[f.jsx(ax,{store:i,timeout:o,limit:r}),n]})};function ax(e){const{store:t,timeout:n,limit:o}=e;return J(()=>{t.syncProviderProps(n,o)},[t,n,o]),null}const cx="--toast-frontmost-height",lx=l.forwardRef(function(t,n){const{render:o,className:r,style:s,children:i,...a}=t,c=Fo(),u=We(),d=l.useRef(!1),h=l.useRef(!1),p=l.useRef(!1),m=c.useState("isEmpty"),g=c.useState("toasts"),x=c.useState("focused"),y=c.useState("expanded"),v=c.useState("prevFocusElement"),S=g[0]?.height,b=g.some(A=>A.transitionStatus==="ending"),w=g.filter(A=>A.priority==="high");l.useEffect(()=>{const A=c.state.viewport;if(!A||m)return;const U=Ie(A),W=be(A);function ne(Q){Q.key==="F6"&&Ne(Q)!==A&&(Q.preventDefault(),c.set("prevFocusElement",_e(W)),A?.focus({preventScroll:!0}),c.pauseTimers(),c.set("focused",!0))}function oe(Q){Ne(Q)===U&&(c.set("isWindowFocused",!1),c.pauseTimers())}function z(Q){if(Q.relatedTarget)return;const K=Ne(Q),ge=_e(be(A));(K===U||!se(A,K)||!so(ge))&&c.resumeTimers(),u.start(0,()=>c.set("isWindowFocused",!0))}return lt(me(U,"keydown",ne),me(U,"blur",oe,!0),me(U,"focus",z,!0),me(W,"pointerdown",c.handleDocumentPointerDown,!0))},[c,u,m]);function T(A){d.current=!0;const U=A.relatedTarget===c.state.viewport?g.find(W=>W.transitionStatus!=="ending"&&!W.limited):void 0;U?U.ref?.current?.focus():c.restoreFocusToPrevElement()}function E(A){A.key==="Tab"&&A.shiftKey&&Ne(A.nativeEvent)===c.state.viewport&&(A.preventDefault(),c.restoreFocusToPrevElement())}function C(){c.state.toasts.some(U=>U.transitionStatus==="ending")||p.current||!h.current||(c.state.isWindowFocused&&c.resumeTimers(),c.set("hovering",!1),h.current=!1)}l.useEffect(C,[b,c]);function R(){c.pauseTimers(),c.set("hovering",!0),h.current=!1}function j(){c.state.isWindowFocused&&c.resumeTimers()}function D(){h.current=!0,C()}function H(A){A.pointerType==="touch"&&(p.current=!0)}function P(A){A.pointerType==="touch"&&(p.current=!1,C())}function L(){if(d.current){d.current=!1;return}x||so(_e(be(c.state.viewport)))&&(c.set("focused",!0),c.pauseTimers())}function F(A){!x||se(c.state.viewport,A.relatedTarget)||(c.set("focused",!1),j())}const O={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:R,onMouseMove:R,onMouseLeave:D,onFocus:L,onBlur:F,onKeyDown:E,onClick:L,onPointerDown:H,onPointerUp:P,onPointerCancel:P,style:{[cx]:S?`${S}px`:void 0}},_={expanded:y},N=!m&&v&&f.jsx(zt,{onFocus:T}),I=De("div",t,{ref:[n,c.setViewport],state:_,props:[O,a,{children:f.jsxs(l.Fragment,{children:[N,i,N]})}]});return f.jsxs(l.Fragment,{children:[N,I,!x&&w.length>0&&f.jsx("div",{style:Ta,children:w.map(A=>f.jsxs("div",{role:"alert","aria-atomic":!0,children:[f.jsx("div",{children:A.title}),f.jsx("div",{children:A.description})]},A.id))})]})}),_l=l.createContext(void 0);function _o(){const e=l.useContext(_l);if(!e)throw new Error(Ye(66));return e}function ur(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}const ux="--toast-index",dx="--toast-offset-y",fx="--toast-height",px="--toast-swipe-movement-x",hx="--toast-swipe-movement-y",gx="data-swipe-direction",mx={...Vr,swipeDirection(e){return e?{[gx]:e}:null}},Fi=40,yx=10,_i=.5,xx=1,bx=`${Gf},${Xf}`,vx=l.forwardRef(function(t,n){const{toast:o,render:r,className:s,swipeDirection:i=["down","right"],style:a,...c}=t,u=o.positionerProps?.anchor!==void 0;let d=[];u||(d=Array.isArray(i)?i:[i]);const h=d.length>0,p=Fo(),[m,g]=l.useState(void 0),[x,y]=l.useState(!1),[v,S]=l.useState(!1),[b,w]=l.useState({x:0,y:0}),[T,E]=l.useState({x:0,y:0,scale:1}),[C,R]=l.useState(),[j,D]=l.useState(),[H,P]=l.useState(null),L=l.useRef(null),F=l.useRef(void 0),O=l.useRef({x:0,y:0}),_=l.useRef({x:0,y:0,scale:1}),N=l.useRef(void 0),I=l.useRef(0),A=l.useRef(!1),U=l.useRef({x:0,y:0}),W=l.useRef(!1),ne=l.useRef({x:0,y:0}),oe=l.useRef(null),z=l.useRef(null),Q=p.useState("toastIndex",o.id),K=p.useState("toastVisibleIndex",o.id),ge=p.useState("toastOffsetY",o.id),Y=p.useState("focused"),ce=p.useState("expanded");Dn({open:o.transitionStatus!=="ending",ref:L,onComplete(){o.transitionStatus==="ending"&&p.removeToast(o.id)}});const ue=le((ie=!1)=>{const $=L.current;if(!$)return;const V=$.style.height;$.style.height="auto";const B=$.offsetHeight;$.style.height=V;function M(){p.updateToastInternal(o.id,{ref:L,height:B,transitionStatus:void 0})}ie?rt.flushSync(M):M()});J(()=>{const ie=F.current;o.transitionStatus!=="starting"&&ie===o.id||(ie!==void 0&&(g(void 0),E({x:0,y:0,scale:1}),ye({x:0,y:0})),F.current=o.id,ue())},[ue,o.id,o.transitionStatus]);function ye(ie){ne.current=ie,w(ie)}J(()=>()=>{z.current?.abort()},[]);function re(ie,$){const V=G=>G>0?G**_i:-(Math.abs(G)**_i),B=ie>0&&!d.includes("right")||ie<0&&!d.includes("left"),M=$>0&&!d.includes("down")||$<0&&!d.includes("up");return{x:B?V(ie):ie,y:M?V($):$}}const X=le(ie=>{if(ie.pointerId!==oe.current)return;oe.current=null,z.current?.abort(),z.current=null,y(!1),S(!1),P(null);const $=_.current;if(ie.type==="pointercancel"||A.current){ye({x:$.x,y:$.y}),g(void 0);return}const V=ne.current,B=V.x-$.x,M=V.y-$.y;let G;for(const pe of d)if(ur(pe,B,M)>Fi){G=pe;break}G?(g(G),p.closeToast(o.id)):(ye({x:$.x,y:$.y}),g(void 0))});function he(ie){if(ie.button!==0||(ie.pointerType==="touch"&&p.pauseTimers(),Ne(ie.nativeEvent)?.closest(`button,a,input,textarea,[role="button"],${bx}`)))return;A.current=!1,N.current=void 0,I.current=0,oe.current=ie.pointerId,O.current={x:ie.clientX,y:ie.clientY},U.current=O.current;const B=ie.currentTarget,M=rx(B);_.current=M,E(M),ye({x:M.x,y:M.y}),p.set("hovering",!0),y(!0),S(!1),P(null),W.current=!0,z.current?.abort();const G=new AbortController;z.current=G;const pe=be(B);pe.addEventListener("pointerup",X,{signal:G.signal}),pe.addEventListener("pointercancel",X,{signal:G.signal}),B.setPointerCapture?.(ie.pointerId)}function fe(ie){if(ie.pointerId!==oe.current)return;ie.preventDefault(),W.current&&(O.current={x:ie.clientX,y:ie.clientY},W.current=!1);const{clientY:$,clientX:V,movementX:B,movementY:M}=ie;(M<0&&$>U.current.y||M>0&&$<U.current.y)&&(U.current={x:U.current.x,y:$}),(B<0&&V>U.current.x||B>0&&V<U.current.x)&&(U.current={x:V,y:U.current.y});const G=V-O.current.x,pe=$-O.current.y,Ue=$-U.current.y,Qe=V-U.current.x;let Le=H;if(!v&&Math.sqrt(G*G+pe*pe)>=xx){S(!0);const Ke=d.includes("left")||d.includes("right"),Gt=d.includes("up")||d.includes("down");if(Ke&&Gt){const Re=Math.abs(G),Ve=Math.abs(pe);Le=Re>Ve?"horizontal":"vertical",P(Le)}}let ee;if(!N.current)Le==="vertical"?pe>0?ee="down":pe<0&&(ee="up"):Le==="horizontal"?G>0?ee="right":G<0&&(ee="left"):Math.abs(G)>=Math.abs(pe)?ee=G>0?"right":"left":ee=pe>0?"down":"up",ee&&d.includes(ee)&&(N.current=ee,I.current=ur(ee,G,pe),g(ee));else{const ft=N.current,Ke=ur(ft,Qe,Ue);Ke>Fi?(A.current=!1,g(ft)):!(d.includes("left")&&d.includes("right"))&&!(d.includes("up")&&d.includes("down"))&&I.current-Ke>=yx&&(A.current=!0)}const Ce=re(G,pe);let Oe=_.current.x,Xe=_.current.y;const dt=d.includes("left")||d.includes("right"),mt=d.includes("up")||d.includes("down");Le!=="vertical"&&dt&&(Oe+=Ce.x),Le!=="horizontal"&&mt&&(Xe+=Ce.y),ye({x:Oe,y:Xe})}function ve(ie){if(ie.key==="Escape"){if(!L.current||!se(L.current,_e(be(L.current))))return;p.closeToast(o.id)}}l.useEffect(()=>{const ie=L.current;if(!h||!ie)return;function $(V){oe.current===null||!se(ie,Ne(V))||V.preventDefault()}return me(ie,"touchmove",$,{passive:!1})},[h]);function q(){const ie=b.x-T.x,$=b.y-T.y;return{transition:x?"none":void 0,transform:x?`translateX(${b.x}px) translateY(${b.y}px) scale(${T.scale})`:void 0,[px]:`${ie}px`,[hx]:`${$}px`}}const de=o.priority==="high",Z={role:de?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":C,"aria-describedby":j,"aria-hidden":de&&!Y?!0:void 0,onPointerDown:h?he:void 0,onPointerMove:h?fe:void 0,onPointerUp:h?X:void 0,onPointerCancel:h?X:void 0,onKeyDown:ve,inert:Cs(o.limited),style:{...q(),[ux]:o.transitionStatus==="ending"?Q:K,[dx]:`${ge}px`,[fx]:o.height?`${o.height}px`:void 0}},te=l.useMemo(()=>({toast:o,setTitleId:R,setDescriptionId:D,recalculateHeight:ue,visibleIndex:K,expanded:ce}),[o,R,D,ue,K,ce]),ae={transitionStatus:o.transitionStatus,expanded:ce,limited:o.limited||!1,type:o.type,swiping:x,swipeDirection:m},Ee=De("div",t,{ref:[n,L],state:ae,stateAttributesMapping:mx,props:[Z,c]});return f.jsx(_l.Provider,{value:te,children:Ee})}),wx=l.forwardRef(function(t,n){const{render:o,className:r,style:s,...i}=t,{visibleIndex:a,expanded:c,recalculateHeight:u}=_o(),d=l.useRef(null);J(()=>{u();const m=d.current;if(!m||typeof ResizeObserver!="function"||typeof MutationObserver!="function")return;const g=new ResizeObserver(()=>u(!0)),x=new MutationObserver(()=>u(!0));return g.observe(m),x.observe(m,{childList:!0,subtree:!0,characterData:!0}),()=>{g.disconnect(),x.disconnect()}},[u]);const h=a>0;return De("div",t,{ref:[n,d],state:{expanded:c,behind:h},props:i})});function Hl(e){return e==null||typeof e=="boolean"||e===""?!1:Array.isArray(e)?e.some(Hl):!0}function Bl(e){return l.isValidElement(e)&&Hl(e.props.children)}function $l(e,t,n){const{toast:o,setTitleId:r,setDescriptionId:s}=_o(),i=n==="title"?r:s,a=t??(n==="title"?o.title:o.description);return{id:Wt(e),children:a,type:o.type,setId:i}}function zl(e,t,n){const o=Bl(e);return J(()=>{if(o)return n(t),()=>{n(r=>r===t?void 0:r)}},[o,t,n]),o?e:null}const Sx=l.forwardRef(function(t,n){const{render:o,className:r,style:s,id:i,children:a,...c}=t,{id:u,children:d,type:h,setId:p}=$l(i,a,"description"),g=De("p",t,{ref:n,state:{type:h},props:{...c,id:u,children:d}});return zl(g,u,p)}),Tx=l.forwardRef(function(t,n){const{render:o,className:r,style:s,id:i,children:a,...c}=t,{id:u,children:d,type:h,setId:p}=$l(i,a,"title"),g=De("h2",t,{ref:n,state:{type:h},props:{...c,id:u,children:d}});return zl(g,u,p)}),Ex=l.forwardRef(function(t,n){const{render:o,className:r,style:s,disabled:i,nativeButton:a=!0,...c}=t,u=Fo(),{toast:d,expanded:h}=_o(),[p,m]=l.useState(!1),{getButtonProps:g,buttonRef:x}=Fn({disabled:i,native:a}),y={type:d.type};return De("button",t,{ref:[n,x],state:y,props:[{"aria-hidden":!h&&!p,onClick(){u.closeToast(d.id)},onFocus(){m(!0)},onBlur(){m(!1)}},c,g]})}),Rx=l.forwardRef(function(t,n){const{render:o,className:r,style:s,disabled:i,nativeButton:a=!0,...c}=t,{toast:u}=_o(),d=u.actionProps?.children??c.children,{getButtonProps:h,buttonRef:p}=Fn({disabled:i,native:a}),m={type:u.type},g=De("button",t,{ref:[n,p],state:m,props:[c,u.actionProps,h,{children:d}]});return Bl(g)?g:null}),Cx=l.forwardRef(function(t,n){return f.jsx(Tc,{ref:n,...t})});function kx(){const e=Fo(),t=e.useState("toasts");return l.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function Px(){const e=new Set;function t(n){e.forEach(o=>o(n))}return{" subscribe":function(o){return e.add(o),()=>{e.delete(o)}},add(n){const o=n.id||Fl("toast"),r={...n,id:o,transitionStatus:"starting"};return t({action:"add",options:r}),o},close(n){t({action:"close",options:{id:n}})},update(n,o){t({action:"update",options:{id:n,updates:o}})},promise(n,o){let r=n;return t({action:"promise",options:{...o,promise:n,setPromise(s){r=s}}}),r}}}const Ox=8,Ix=48;function Mx(e,t,n,o=Ix){if(e.length===0)return null;let r=t-n*(e.length-1);for(const a of e)r-=a.chrome;const s=e.map(a=>a.content).sort((a,c)=>a-c);let i=s.length;for(const a of s){const c=r/i;if(a>c)return Math.max(o,Math.floor(c));r-=a,i-=1}return null}const Wl=Px();function Ax(e){if(e.repeat||e.key!=="Enter"&&e.key!==" ")return;const t=e.currentTarget.closest("[data-toast]")??e.currentTarget,n=t.ownerDocument.defaultView;n&&Nc(n,e.key,o=>o instanceof n.Node&&t.contains(o))}function Nx({children:e}){const t=l.useRef(null),[n,o]=l.useState("none");return l.useEffect(()=>{const r=t.current;if(!r)return;const s=()=>{const a=getComputedStyle(r),{scrollWidth:c,clientWidth:u,scrollHeight:d,clientHeight:h,scrollTop:p}=r;o(Dy({scrollWidth:c,clientWidth:u,scrollHeight:d,clientHeight:h,scrollTop:p,overflowX:a.overflowX,overflowY:a.overflowY}))};s();const i=new ResizeObserver(s);i.observe(r);for(const a of r.children)i.observe(a);return r.addEventListener("scroll",s,{passive:!0}),()=>{i.disconnect(),r.removeEventListener("scroll",s)}},[]),f.jsx(wx,{ref:t,role:n==="none"?void 0:"group",tabIndex:n==="none"?void 0:0,"data-overflow":n==="none"?void 0:n,"data-toast-body":"",className:"flex max-h-[var(--toast-fit,none)] min-w-0 flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent data-[overflow=more]:[mask-image:linear-gradient(to_bottom,black_calc(100%-1.5rem),transparent)]",children:e})}function jx(e,t){l.useLayoutEffect(()=>{const n=e?.ownerDocument.defaultView;if(!e||!n)return;const o=()=>Array.from(e.querySelectorAll("[data-toast]")),r=()=>{const i=[];for(const d of o()){const h=d.querySelector("[data-toast-body]");h&&i.push({chrome:d.offsetHeight-h.offsetHeight,content:h.scrollHeight})}const a=e.getBoundingClientRect().bottom-Ox,c=Mx(i,a,parseFloat(n.getComputedStyle(e).rowGap)||0),u=c===null?"none":`${c}px`;e.style.getPropertyValue("--toast-fit")!==u&&e.style.setProperty("--toast-fit",u)};r();const s=new ResizeObserver(r);for(const i of o()){s.observe(i);const a=i.querySelector("[data-toast-body]");if(a)for(const c of a.children)s.observe(c)}return n.addEventListener("resize",r),()=>{s.disconnect(),n.removeEventListener("resize",r)}},[e,t])}function Dx({type:e}){return e==="success"?f.jsx(Mm,{"aria-hidden":"true",className:"mt-px size-4 shrink-0 fill-success text-surface"}):e==="error"?f.jsx(Im,{"aria-hidden":"true",className:"mt-px size-4 shrink-0 fill-danger text-surface"}):e==="warning"?f.jsx(Sl,{"aria-hidden":"true",className:"mt-px size-4 shrink-0 fill-warning text-surface"}):f.jsx(Fm,{"aria-hidden":"true",className:"mt-px size-4 shrink-0 text-fg-muted"})}function Lx({viewport:e}){const{toasts:t}=kx();return jx(e,t),t.map(n=>f.jsxs(vx,{toast:n,"data-toast":"",className:"pointer-events-auto flex w-80 items-start gap-3 rounded-lg bg-surface p-3 text-fg shadow-popup transition-[opacity,transform] data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",children:[f.jsx(Dx,{type:n.type}),f.jsxs(Nx,{children:[f.jsx(Tx,{className:"text-[13px] font-semibold"}),f.jsx(Sx,{className:"text-xs text-fg-muted"}),n.actionProps?f.jsx(Rx,{className:"mt-1 self-start rounded px-2 py-0.5 text-xs font-medium text-accent hover:bg-hover"}):null]}),f.jsx(Ex,{"aria-label":"Dismiss",onKeyDown:Ax,className:"rounded p-0.5 text-fg-muted hover:bg-hover",children:f.jsx(Ds,{className:"size-3.5"})})]},n.id))}function Fx({children:e}){const[t,n]=l.useState(null);return f.jsxs(ix,{toastManager:Wl,timeout:4e3,children:[e,f.jsx(Cx,{children:f.jsx(lx,{ref:n,"aria-label":"Notifications",className:"pointer-events-none fixed bottom-[var(--toast-foot,1rem)] right-4 z-[1100] flex flex-col gap-2",children:f.jsx(Lx,{viewport:t})})})]})}function _x(e){const[t,n]=l.useState(!1);return l.useLayoutEffect(()=>{const o=e.current,r=o?.ownerDocument.defaultView;if(!o||!r)return;const s=()=>{const d=r.getComputedStyle(o);n(Nl({scrollWidth:o.scrollWidth,clientWidth:o.clientWidth,scrollHeight:o.scrollHeight,clientHeight:o.clientHeight,overflowX:d.overflowX,overflowY:d.overflowY}))};if(s(),typeof r.ResizeObserver!="function")return;const i=new r.ResizeObserver(s),a=new Set,c=d=>{if(d.nodeType!==1)return;const h=d;if(r.getComputedStyle(h).display==="contents"){h.childNodes.forEach(c);return}a.has(h)||(a.add(h),i.observe(h))};i.observe(o),o.childNodes.forEach(c);const u=new r.MutationObserver(d=>{for(const h of d)h.addedNodes.forEach(c);for(const h of a)o.contains(h)||(i.unobserve(h),a.delete(h));s()});return u.observe(o,{childList:!0,subtree:!0,characterData:!0}),()=>{i.disconnect(),u.disconnect()}},[e]),t}l.forwardRef(function({label:t,className:n,...o},r){const s=l.useRef(null),i=l.useCallback(m=>{s.current=m,typeof r=="function"?r(m):r&&(r.current=m)},[r]),a=_x(s),[c,u]=l.useState(!1),[d,h]=l.useState(null);l.useLayoutEffect(()=>{const m=s.current,g=m?.ownerDocument.defaultView;if(!a||!m||!g)return;const x=()=>{u(jy(m).length===0),h(m.closest('[role="dialog"], [role="alertdialog"]')?.getAttribute("aria-labelledby")??null)};x();const y=new g.MutationObserver(x);return y.observe(m,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["tabindex","disabled","hidden","href","contenteditable"]}),()=>y.disconnect()},[a]);const p=a&&c;return f.jsx("div",{ref:i,...p?{role:"group",tabIndex:0,"aria-labelledby":t===void 0?d??void 0:void 0,"aria-label":t??(d===null?"Panel content":void 0)}:{},className:Ae(p&&"focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent",n),...o})});const Hx=250,Bx=1500,oo=300;function $x(e){try{return["http:","https:","mailto:"].includes(new URL(e).protocol)}catch{return!1}}function dr(e,t){const n=[...e];return n.length<=t?e:`${n.slice(0,t-1).join("")}…`}const zx=/[\p{Cc}\p{Cf}]/gu;function Wx(e,t={}){const n=r=>r.replace(zx,t.dropControls?"":"�"),o=dr(n(e),oo);try{const r=new URL(e);if(r.protocol==="http:"||r.protocol==="https:"){const s=`${r.pathname==="/"?"":r.pathname}${r.search}${r.hash}`;return{host:t.trimWww?r.host.replace(/^www\./i,""):r.host,path:dr(n(s),oo),full:dr(n(`${r.protocol}//${r.host}${s}`),oo)}}}catch{}return{host:o,path:"",full:o}}const Qn=6,Ux=8;function Hi(e,t){return!(e.x+e.w<=t.x||t.x+t.w<=e.x||e.y+e.h<=t.y||t.y+t.h<=e.y)}function Bi(e,t,n,o=null,r=0){const s=Ux,i=Math.max(s,Math.min(e.x+r,n.w-t.w-s)),a=e.y-Qn-t.h,c={x:i,y:a,w:t.w,h:t.h};if(a>=s&&(o===null||!Hi(c,o)))return{x:i,y:a,side:"above"};let u=e.y+e.h+Qn;if(o!==null&&Hi({x:i,y:u,w:t.w,h:t.h},o)&&(u=o.y+o.h+Qn),o!==null&&u+t.h>n.h-s){const d=Math.min(a,o.y-Qn-t.h);if(d>=s)return{x:i,y:d,side:"above"}}return{x:i,y:Math.max(s,u),side:"below"}}const Kx="This link can’t be opened from here.",$i="Opens in a new tab",Vx={w:500,h:44},zi=-8;function Yx(e){return[...e.querySelectorAll('a[href], button:not([disabled]), [tabindex="0"]')]}l.forwardRef(function({href:t,anchor:n,avoid:o=null,openable:r=$x(t),onOpen:s,onCopy:i,onClose:a,onTabOut:c,className:u,style:d,onKeyDown:h,...p},m){const g=l.useRef(null),x=l.useRef(null),[y,v]=l.useState(()=>Bi(n,Vx,{w:window.innerWidth,h:window.innerHeight},o,zi)),[S,b]=l.useState(!0),[w,T]=l.useState(!1),[E,C]=l.useState(!1),R=Wx(t,{trimWww:!0,dropControls:!0}),j=t.replace(/[\p{Cc}\p{Cf}]/gu,"");l.useLayoutEffect(()=>{const N=g.current;if(!N)return;v(Bi(n,{w:N.offsetWidth,h:N.offsetHeight},{w:window.innerWidth,h:window.innerHeight},o,zi));const I=x.current;C([...j].length>oo||I!==null&&[...I.querySelectorAll("[data-link-part]")].some(A=>A.scrollWidth>A.clientWidth))},[n.x,n.y,n.w,n.h,o?.x,o?.y,o?.w,o?.h,t]),l.useEffect(()=>{b(!0);const N=setTimeout(()=>b(!1),Hx);return()=>clearTimeout(N)},[y.x,y.y]),l.useEffect(()=>{if(!w)return;const N=setTimeout(()=>T(!1),Bx);return()=>clearTimeout(N)},[w]);const D=N=>{if(h?.(N),!(N.defaultPrevented||Os(N.nativeEvent))){if(N.key==="Escape"&&a)N.preventDefault(),N.stopPropagation(),a();else if(N.key==="Tab"&&c&&g.current){const I=Yx(g.current),A=I.findIndex(W=>W===N.target||W.contains(N.target));(N.shiftKey?A<=0:A===I.length-1)&&c(N.shiftKey)&&N.preventDefault()}}},H=async()=>{await i(t)&&T(!0)},P=f.jsx("span",{"data-link-part":"",dir:"rtl",className:"min-w-0 shrink truncate text-left font-medium text-fg",children:f.jsx("bdi",{dir:"ltr",children:R.host})}),L=R.path!==""?f.jsx("span",{"data-link-part":"",className:"min-w-[1.3em] truncate text-fg-subtle",style:{flex:"0 1000 auto"},children:R.path}):null,F="flex min-w-0 flex-1 items-baseline rounded-control px-1.5 py-0.5 text-[13px] leading-5 outline-none focus-visible:outline-2 focus-visible:outline-accent",O=r?s?f.jsxs("button",{ref:N=>{x.current=N},type:"button","aria-label":j,"aria-description":$i,className:Ae(F,"text-left hover:bg-hover"),onClick:()=>s(t),children:[P,L]}):f.jsxs("a",{ref:N=>{x.current=N},href:t,target:"_blank",rel:"noopener noreferrer","aria-label":j,"aria-description":$i,className:Ae(F,"hover:bg-hover"),children:[P,L]}):f.jsxs("span",{ref:x,role:"link","aria-disabled":"true",tabIndex:0,"aria-label":j,className:Ae(F,"opacity-50"),children:[P,L]}),_={...d,top:y.y,left:y.x,pointerEvents:S?"none":d?.pointerEvents};return f.jsxs("div",{ref:N=>{g.current=N,typeof m=="function"?m(N):m&&(m.current=N)},role:"group","aria-label":"Link details","data-link-details":"","data-side":y.side,className:Ae("fixed z-50 flex max-w-[min(500px,calc(100vw-16px))] flex-col rounded-control border border-line bg-surface p-1 shadow-lg",u),style:_,onKeyDown:D,...p,children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[E?f.jsx(Mc,{label:j,children:O}):O,f.jsx("span",{"aria-hidden":"true",className:"mx-0.5 h-4 w-px shrink-0 bg-line"}),f.jsx(Do,{size:"sm",label:"Copy link",icon:w?f.jsx(As,{className:"size-3.5"}):f.jsx(Am,{className:"size-3.5"}),onClick:()=>{H()}})]}),r?null:f.jsx("p",{className:"px-1.5 pb-0.5 text-[12px] text-fg-subtle",children:Kx})]})});const Gx={blur:{label:"Blur",unit:"px",min:0,max:200,step:1,identity:0,initial:4},brightness:{label:"Brightness",unit:"%",min:0,max:500,step:1,identity:100,initial:120},contrast:{label:"Contrast",unit:"%",min:0,max:500,step:1,identity:100,initial:120},grayscale:{label:"Grayscale",unit:"%",min:0,max:100,step:1,identity:0,initial:100},saturate:{label:"Saturate",unit:"%",min:0,max:500,step:1,identity:100,initial:150},"hue-rotate":{label:"Hue rotate",unit:"deg",min:-360,max:360,step:1,identity:0,initial:90},invert:{label:"Invert",unit:"%",min:0,max:100,step:1,identity:0,initial:100},sepia:{label:"Sepia",unit:"%",min:0,max:100,step:1,identity:0,initial:100},opacity:{label:"Opacity",unit:"%",min:0,max:100,step:1,identity:100,initial:50}};[...Object.keys(Gx)];const Xx="modulepreload",qx=function(e){return"/_open-artifacts/home/"+e},Wi={},Zx=function(t,n,o){let r=Promise.resolve();if(n&&n.length>0){let c=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=i?.nonce||i?.getAttribute("nonce");r=c(n.map(u=>{if(u=qx(u),u in Wi)return;Wi[u]=!0;const d=u.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${h}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":Xx,d||(p.as="script"),p.crossOrigin="",p.href=u,a&&p.setAttribute("nonce",a),document.head.appendChild(p),d)return new Promise((m,g)=>{p.addEventListener("load",m),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return r.then(i=>{for(const a of i||[])a.status==="rejected"&&s(a.reason);return t().catch(s)})},Ht=e=>typeof e=="string";function Ul(e){const t=aa(e);if(!t)return null;const n=e;return!Ht(n.pageUrl)||!Ht(n.packageUrl)||!Ht(n.install)?null:{...t,skill:Ht(n.skill)?n.skill:null,manages:n.manages===!0,pageUrl:n.pageUrl,packageUrl:n.packageUrl,install:n.install,notice:Ht(n.notice)?n.notice:""}}function Jx(e){if(!(!e||typeof e!="object"))return Ul(e.typePage)??void 0}const fr=e=>`/api/open-artifacts.${e}`;async function pr(e,t,n){let o;try{o=await e(t,n)}catch(r){throw new Mn("connect_failed",r instanceof Error?r.message:String(r),0)}return Ou(o)}const Ui=e=>({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});function Kl(e=(t,n)=>fetch(t,n)){return{async list(){const t=await pr(e,fr($o.list),{cache:"no-store"}),n=Array.isArray(t.types)?t.types.map(aa).filter(r=>!!r):[],o=t.publish&&typeof t.publish=="object"?t.publish:{allowed:!1,refusal:null};return{types:n,notice:Ht(t.notice)?t.notice:"",publish:{allowed:o.allowed===!0,refusal:Ht(o.refusal)?o.refusal:null}}},async setVisibility(t,n){const o=Ul(await pr(e,fr($o.update),Ui({id:t,visibility:n})));if(!o)throw new Mn("server_failed","The site answered without the type.",0);return o},unpublish:t=>pr(e,fr($o.unpublish),Ui({id:t}))}}const Qx=e=>`/t/${encodeURIComponent(e)}`,Vl=Object.freeze({models:"oa.models.v1:",grants:"oa.grants.v1:",usage:"oa.usage.v1:"}),eb="anon";function Yl(e){if(!e||typeof e!="object")return null;const t=e;if(t.mode!=="viewer-key")return null;const n=Array.isArray(t.endpoints)?t.endpoints.filter(o=>typeof o=="string"&&/^https?:\/\/[^/]+$/i.test(o)):null;return n?.length?{mode:"viewer-key",endpoints:n}:{mode:"viewer-key"}}function Gl(e){return e&&typeof e.id=="string"&&e.id?e.id:eb}function tb(e,t){const n=e?Yl(e.sample):null;return n?{account:Gl(e?.user??null),config:n,origin:t}:null}function Ls(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function nb(e,t=Ls()){try{t?.removeItem(Vl.models+e)}catch{}}function Xl(e){const t=e.toLowerCase().replace(/^\[|\]$/g,"");return t==="localhost"||t.endsWith(".localhost")||t==="::1"||/^127(\.\d{1,3}){3}$/.test(t)}function Ki(e){if(Xl(e))return!0;const t=e.toLowerCase().replace(/^\[|\]$/g,"");if(t.endsWith(".local")||t.endsWith(".internal")||t.endsWith(".lan"))return!0;const n=/^(\d{1,3})\.(\d{1,3})\.\d{1,3}\.\d{1,3}$/.exec(t);if(n){const o=Number(n[1]),r=Number(n[2]);return o===10||o===172&&r>=16&&r<=31||o===192&&r===168||o===169&&r===254||o===0}return/^f[cd][0-9a-f]{2}:/.test(t)||/^fe80:/.test(t)}function Kv(e,t,n){let o;try{o=new URL(e.trim())}catch{return"endpoint_bad"}return o.protocol!=="https:"&&o.protocol!=="http:"?"endpoint_bad":t.endpoints?.length?t.endpoints.includes(o.origin)?null:"endpoint_not_allowed":o.protocol==="https:"||Xl(o.hostname)||n.startsWith("http:")?null:"endpoint_needs_https"}function Vv(e,t){try{const n=new URL(e).hostname,o=new URL(t).hostname;return Ki(n)&&!Ki(o)?"private":"blocked"}catch{return"blocked"}}const ob="__OPEN_ARTIFACTS_HOME__";function rb(e){if(!e||typeof e!="object")return{};const t=e.cloud;if(!t||typeof t!="object")return{};const n=t;if(typeof n.signInUrl!="string"||typeof n.signOutUrl!="string"||typeof n.appOrigin!="string")return{};const o=n.user&&typeof n.user=="object"&&typeof n.user.id=="string"&&typeof n.user.name=="string"?n.user:null,r=typeof n.trashDays=="number"&&Number.isInteger(n.trashDays)&&n.trashDays>=0?n.trashDays:void 0,s=n.limits&&typeof n.limits=="object"?n.limits.importBytes:void 0,i=typeof s=="number"&&Number.isInteger(s)&&s>0?{importBytes:s}:void 0,a=ql(n.site),c=Yl(n.sample),u=Jx(e),d=e.folderPage;return{...u?{typePage:u}:{},...d&&typeof d=="object"&&typeof d.id=="string"&&d.id?{folderPage:{id:d.id}}:{},cloud:{user:o,appOrigin:n.appOrigin,signInUrl:n.signInUrl,signOutUrl:n.signOutUrl,...r!==void 0?{trashDays:r}:{},...i?{limits:i}:{},...a?{site:a}:{},...n.siteTypes===!0?{siteTypes:!0}:{},...c?{sample:c}:{}}}}function hr(e){return typeof e!="string"||e.length===0||e.length>2048||/[\u0000-\u001f\u007f]/.test(e)?!1:e.startsWith("/")?!e.startsWith("//")&&!e.includes("\\"):/^https?:\/\//i.test(e)}function Vi(e,t){if(typeof e!="string")return null;const n=e.trim();return n.length>0&&n.length<=t?n:null}function ql(e){if(!e||typeof e!="object")return;const t=e,n=[];if(Array.isArray(t.links))for(const r of t.links){if(!r||typeof r!="object")continue;const{label:s,href:i,where:a}=r,c=Vi(s,80);c&&hr(i)&&(a==="account-menu"||a==="home")&&n.push({label:c,href:i,where:a})}let o;if(t.brand&&typeof t.brand=="object"){const{name:r,logoUrl:s}=t.brand,i=Vi(r,80);(i||hr(s))&&(o={...i?{name:i}:{},...hr(s)?{logoUrl:s}:{}})}if(!(n.length===0&&!o))return{...n.length>0?{links:n}:{},...o?{brand:o}:{}}}function Zl(e,t){return(ql(e)?.links??[]).filter(n=>n.where===t).map(({label:n,href:o})=>({label:n,href:o}))}function Jl(e,t){if(e.startsWith("/"))return!1;try{return new URL(e).origin!==t}catch{return!0}}function Ql(e,t,n){let o;try{o=new URL(e,n)}catch{return e}return!o.searchParams.has("return_to")&&t.startsWith("/")&&!t.startsWith("//")&&o.searchParams.set("return_to",t),o.origin===n?`${o.pathname}${o.search}${o.hash}`:o.href}function eu(e){if(!e||typeof e!="object")return null;const t=e.accessLogoutUrl;if(typeof t!="string")return null;try{const n=new URL(t);return n.protocol==="https:"||n.protocol==="http:"?n.href:null}catch{return null}}function sb(e){if(!e||typeof e!="object")return!1;if(tu(e))return!0;const t=e.providers;return Array.isArray(t)&&t.some(n=>!!n&&typeof n=="object"&&n.id==="cloudflare-access")}function tu(e){return eu(e)}const ib=/^[^\s@,;<>()"]+@([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+)$/i,ab=/^@([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+)$/i;function cb(e){const t=e.trim().replace(/^<|>$/g,"").toLowerCase();if(ab.test(t)){const n=t.slice(1);return{id:`domain:${n}`,kind:"domain",label:`@${n}`}}return ib.test(t)?{id:`email:${t}`,kind:"email",label:t}:null}const Cn=["email","domain","group"];function lb(e){return Array.isArray(e)?Cn.filter(t=>e.includes(t)):[...Cn]}function ub(e,t=Cn){const n=[],o=[],r=[],s=new Set;for(const i of e.split(/[\s,;]+/)){if(!i)continue;const a=cb(i);a?t.includes(a.kind)?s.has(a.id)||(s.add(a.id),n.push(a)):r.push(a.label):o.push(i)}return{members:n,invalid:o,refused:r}}function db(e){const t=e.includes("email"),n=e.includes("domain");return t&&n?"both":t?"email":n?"domain":"none"}function fb(e){switch(e){case"email":return{placeholder:"addPeoplePlaceholderEmail",hint:"peopleOnlyEmail",invalid:"addInvalidEmail",refused:"addRefusedEmailOnly"};case"domain":return{placeholder:"addPeoplePlaceholderDomain",hint:"peopleOnlyDomain",invalid:"addInvalidDomain",refused:"addRefusedDomainOnly"};default:return{placeholder:"addPeoplePlaceholder",hint:null,invalid:"addInvalid",refused:"addInvalid"}}}function pb(e){return e.kind==="user"?"email":e.kind}function hb(e,t){const n=pb(e);return t.includes(n)?null:n==="email"?"memberOffEmail":n==="domain"?"memberOffDomain":"memberOffGroup"}function gb(e){const t=e.indexOf(":");if(t<=0||t===e.length-1)return null;const n=e.slice(0,t),o=e.slice(t+1);return n==="group"?o.includes(":")&&!o.startsWith(":")&&!o.endsWith(":")?{kind:n,value:o}:null:n==="user"||n==="email"||n==="domain"?{kind:n,value:o}:null}function mb(e,t){return{members:Object.fromEntries(e.map(n=>[n.id,t]))}}function Yi(e,t){return{members:{[e]:t}}}function yb(e){return{access:e}}function xb(e,t){const n=e.cloud;if(!n)return e;let o=n.members;for(const[s,i]of Object.entries(t.members??{}))if(i===null)o=o.filter(a=>a.id!==s);else if(o.some(a=>a.id===s))o=o.map(a=>a.id===s?{...a,role:i}:a);else{const a=gb(s);if(!a||a.kind!=="email"&&a.kind!=="domain")continue;o=[...o,{id:s,kind:a.kind,label:a.kind==="domain"?`@${a.value}`:a.value,role:i,pending:a.kind==="email"}]}const r={...e.links};for(const[s,i]of Object.entries(t.links??{})){const a=r[s];a&&(r[s]={...a,on:i})}return{...e,links:r,cloud:{...n,members:o,access:t.access??n.access,settings:{...n.settings,...t.settings}}}}function kn(e,t=Date.now(),n=xo){if(!e)return"";const o=Date.parse(e);if(!Number.isFinite(o))return"";const r=Math.max(0,(t-o)/1e3);if(r<60)return Iu(Mu(n),"justNow");const s=new Intl.RelativeTimeFormat(n,{numeric:"auto"});return r<3600?s.format(-Math.round(r/60),"minute"):r<86400?s.format(-Math.round(r/3600),"hour"):r<86400*30?s.format(-Math.round(r/86400),"day"):new Date(o).toLocaleDateString(n)}function nu(e){const t=String(e??"").trim();if(!t)return"?";if(/^[-ヿ㐀-鿿가-]/.test(t))return[...t][0];const n=t.split(/\s+/);return((n[0]?.[0]??"")+(n[1]?.[0]??"")).toUpperCase()||"?"}const Gi=["#0f766e","#4f46e5","#b45309","#7c3aed","#be185d","#0369a1","#4d7c0f","#9f1239"];function ou(e){let t=0;for(const n of e)t=t*31+n.charCodeAt(0)|0;return Gi[Math.abs(t)%Gi.length]}async function ru(e){try{await navigator.clipboard.writeText(e)}catch{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.append(t),t.select(),document.execCommand("copy"),t.remove()}}let qe=null,Pn=null,Fs=!1;const bb=new Map,vb=new Set;function wb(e){qe=e,Pn=null,Fs=!1}function Sb(){const e=qe;return e?(Pn??=Zx(async()=>{const{BrowserModels:t}=await import("./browser-models-CNChpEzB.js").then(n=>n.b);return{BrowserModels:t}},__vite__mapDeps([0,1])).then(({BrowserModels:t})=>{const n=new t({account:e.account,config:e.config,origin:e.origin,storage:Ls(),events:typeof window>"u"?null:window});n.on(o=>{for(const r of[...vb])r(o)});for(const o of bb.values())n.noteArtifact(o);return Fs=!0,n}),Pn):Promise.reject(new Mn("unsupported","No model service here.",0))}function Tb(e){return e instanceof ld?new Mn(e.code,e.message,400):e}async function Ot(e){const t=await Sb();try{return await e(t)}catch(n){throw Tb(n)}}const Eb={modelsList:()=>qe?Ot(e=>e.modelsList()):tt.modelsList(),modelsSet:e=>qe?Ot(t=>t.modelsSet(e)):tt.modelsSet(e),modelsRemove:e=>qe?Ot(t=>t.modelsRemove(e)):tt.modelsRemove(e),modelsTest:e=>qe?Ot(t=>t.modelsTest(e)):tt.modelsTest(e),modelsCatalog:(e,t)=>qe?Promise.resolve({provider:e,models:[],error:"There are no agent apps here."}):tt.modelsCatalog(e,t),grantsList:e=>qe?Ot(t=>t.grantsList(e)):tt.grantsList(e),grantsAnswer:e=>qe?Ot(t=>t.grantsAnswer(e)):tt.grantsAnswer(e),grantsRevoke:e=>qe?Ot(t=>t.grantsRevoke(e)):tt.grantsRevoke(e),usageSummary:e=>qe?!Fs&&!Rb(qe.account)?Promise.resolve({artifacts:[]}):Ot(t=>t.usageSummary(e)):tt.usageSummary(e)};function Rb(e){try{return!!Ls()?.getItem(Vl.usage+e)}catch{return!1}}async function Cb(e){if(nb(e),qe?.account===e&&Pn)try{(await Pn).forgetKeys()}catch{}}async function kb(e,t,n){if(t)try{await n.forgetKeys(t)}catch{}try{const o=await n.fetch(e,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json",accept:"application/json"},body:"{}"});if(!o.ok&&o.status!==401)throw new Error(`HTTP ${o.status}`);n.go(eu(await o.json().catch(()=>null))??await n.accessLogout())}catch(o){n.failed(o instanceof Error?o.message:String(o))}}async function Pb(e,t){await kb(e,t,{forgetKeys:Cb,fetch:(n,o)=>fetch(n,o),accessLogout:async()=>(await su()).accessLogout,go:n=>{n?location.href=n:location.reload()},failed:n=>Wl.add({title:k("signOutFailed",{error:n})})})}let Xi=null;function su(){return Xi??=fetch("/api/open-artifacts.auth.me",{credentials:"same-origin",cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>({access:sb(e),accessLogout:tu(e)}),()=>({access:!1,accessLogout:null})),Xi}function mo({id:e,name:t,avatar:n,size:o=28}){const[r,s]=l.useState(!1),i={width:o,height:o,fontSize:Math.round(o*.4)};return n&&!r?f.jsx("img",{src:n,alt:"",referrerPolicy:"no-referrer",className:"shrink-0 rounded-full bg-surface-2 object-cover",style:i,onError:()=>s(!0)}):f.jsx("span",{"aria-hidden":!0,className:"grid shrink-0 place-items-center rounded-full font-semibold text-white",style:{...i,background:ou(`user${e}`)},children:nu(t)})}function Ob(e){Jl(e,location.origin)?window.open(e,"_blank","noopener,noreferrer"):location.href=e}function iu({cloud:e}){const t=e.user,n=Zl(e.site,"account-menu"),[o,r]=l.useState(!1);if(l.useEffect(()=>{if(!t)return;let s=!0;return su().then(i=>s&&r(i.access)),()=>{s=!1}},[t]),!t){const s=`${location.pathname}${location.search}`;return f.jsx(Kt,{size:"lg",variant:"ghost",className:"gap-1.5 px-2 font-normal",icon:f.jsx(hl,{className:"size-4"}),onClick:()=>location.href=Ql(e.signInUrl,s,location.origin),children:f.jsx("span",{className:"max-sm:hidden",children:k("signIn")})})}return f.jsxs(fy,{align:"end",trigger:f.jsx("button",{type:"button","aria-label":k("accountOf",{name:t.name}),title:t.email?`${t.name} · ${t.email}`:t.name,className:"inline-flex size-8 shrink-0 items-center justify-center rounded-full outline-none hover:bg-hover focus-visible:outline-2 focus-visible:outline-accent data-[popup-open]:bg-hover",children:f.jsx(mo,{id:t.id,name:t.name,avatar:t.avatar,size:26})}),children:[f.jsx(py,{children:f.jsxs("span",{className:"flex max-w-64 items-center gap-2.5 py-0.5",children:[f.jsx(mo,{id:t.id,name:t.name,avatar:t.avatar,size:32}),f.jsxs("span",{className:"min-w-0",children:[f.jsx("span",{className:"block truncate text-[13px] font-medium text-fg",children:t.name}),t.email?f.jsx("span",{className:"block truncate text-xs",children:t.email}):null]})]})}),f.jsx(Di,{}),n.map(s=>f.jsx(ji,{icon:f.jsx(cl,{className:"size-3.5"}),onSelect:()=>Ob(s.href),children:s.label},`${s.label} ${s.href}`)),n.length>0?f.jsx(Di,{}):null,f.jsx(ji,{icon:f.jsx(Hm,{className:"size-3.5"}),onSelect:()=>{Pb(e.signOutUrl,Gl(e.user))},children:o?k("signOutAccess"):k("signOut")})]})}function Ib(e,t){switch(t.type){case"start":return e.kind==="sending"||e.kind==="checking"?e:{kind:"sending",name:t.name,loaded:0,total:t.size};case"progress":return e.kind!=="sending"?e:{...e,loaded:Math.max(e.loaded,t.loaded),total:t.total||e.total};case"sent":return e.kind==="sending"?{kind:"checking",name:e.name}:e;case"done":return e.kind==="sending"||e.kind==="checking"?{kind:"done",name:e.name,id:t.id}:e;case"failed":return e.kind==="idle"||e.kind==="done"?e:{kind:"failed",name:e.name,said:t.said};case"dismiss":return e.kind==="failed"?{kind:"idle"}:e}}function au(e){return e.kind==="sending"||e.kind==="checking"||e.kind==="done"}function Mb(e){return e.kind==="checking"||e.kind==="done"?100:e.kind!=="sending"||e.total<=0?null:Math.min(100,Math.floor(e.loaded/e.total*100))}function Ab(e){const t=e.type.toLowerCase();return/\.zip$/i.test(e.name)||t==="application/zip"||t==="application/x-zip-compressed"}function Nb(e){if(!e.length)return null;const t=e.find(Ab);return t?{file:t}:{said:{key:"uploadNotZip"}}}function jb(e,t){return t===void 0||!(t>0)||e<=t?null:{key:"uploadTooLargeLimit",vars:{limit:cu(t)}}}function Db(e){return!!e&&e.includes("Files")}function cu(e){if(e<1024)return`${e} B`;const t=["KB","MB","GB"];let n=e/1024,o=0;for(;n>=1024&&o<t.length-1;)n/=1024,o++;return`${n>=10||Number.isInteger(n)?Math.round(n):n.toFixed(1)} ${t[o]}`}function Lb(e){const t=/(\d{4,})\s*bytes/i.exec(e);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)&&n>0?cu(n):null}function qi(e){const{status:t,code:n,message:o}=e;if(t===0)return{key:"uploadNoAnswer"};if(t===401)return{key:"uploadSignedOut"};if(t===403)return{key:"uploadNotAllowed"};if(t===413||n==="too_large"){const r=Lb(o);return r?{key:"uploadTooLargeLimit",vars:{limit:r}}:o?{key:"uploadTooLargeSaid",vars:{error:o}}:{key:"uploadTooLarge"}}if(t===415)return{key:"uploadNotZip"};if(t===409)return{key:"uploadConflict"};if(t===400){const r=/The (\S+) type is not installed/.exec(o)?.[1];return n==="unsupported"||r?r?{key:"uploadTypeMissing",vars:{type:r}}:{key:"uploadFailed",vars:{error:o}}:{key:"uploadNotArtifact"}}return t===429?{key:"uploadBusy"}:{key:"uploadFailed",vars:{error:o||`HTTP ${t}`}}}function Fb(e,t){let n="error",o="";try{const r=JSON.parse(t);if(r&&typeof r=="object"){const s=r;typeof s.code=="string"&&(n=s.code),typeof s.message=="string"&&(o=s.message)}}catch{}return{status:e,code:n,message:o}}function _b(e){try{const t=JSON.parse(e),n=t&&typeof t=="object"?t.id:void 0;return typeof n=="string"&&n?n:null}catch{return null}}const xe=Au()(e=>({host:null,trash:null,trashError:"",trashNote:null,purgeUnsupported:!1,purging:null,upload:{kind:"idle"},sharingFolder:null,setHost:t=>e({host:t}),setTrash:t=>e({trash:t,trashError:""}),setTrashError:t=>e({trashError:t}),setTrashNote:t=>e({trashNote:t}),setPurgeUnsupported:()=>e({purgeUnsupported:!0}),setPurging:t=>e({purging:t}),uploadEvent:t=>e(n=>({upload:Ib(n.upload,t)})),setSharingFolder:t=>e({sharingFolder:t})})),ut=rb(window[ob]);wb(tb(ut.cloud,location.origin));const lu=window.parent!==window,Hb=Lu();function Bb(e){const t=xe.getState().host;t&&window.parent.postMessage(jr(e),t.origin)}function Zi(e){const t=Nu(e.data);if(!lu||e.source!==window.parent||!ju(t)||t.openArtifacts!=="host_hello")return;const n=e.origin;Hb().then(({hosts:o,latest:r})=>{if(!r)return;const s=!!o?.length&&o.includes(n);if(o?.length&&!s){xe.getState().host?.origin===n&&xe.getState().setHost(null);return}const i=Du(t,n,s);i&&(xe.getState().setHost(i),window.parent.postMessage(jr({openArtifacts:"home_ready"}),n))})}function $b(){return window.addEventListener("message",Zi),lu&&window.parent.postMessage(jr({openArtifacts:"home_hello"}),"*"),()=>window.removeEventListener("message",Zi)}function zb(e){return e.map(t=>({id:t.id,title:t.title,typeTitle:t.typeTitle,when:typeof t.trashedAt=="string"&&t.trashedAt?{kind:"trashed",at:t.trashedAt}:{kind:"changed",at:t.updatedAt},mine:t.role===void 0||t.role==="owner"})).sort((t,n)=>(Date.parse(n.when.at)||0)-(Date.parse(t.when.at)||0))}function Wb(e){return e===void 0||!Number.isInteger(e)||e<0?null:e===0?{key:"trashKeptForever"}:e===1?{key:"trashKeptOneDay"}:{key:"trashKeptDays",vars:{days:e}}}function Ub(e,t){return e.mine&&!t}function Kb(e,t){return e===501?{unsupported:!0}:e===409?{unsupported:!1,said:{key:"purgeNotTrashed"}}:e===404?{unsupported:!1,said:{key:"purgeGone"}}:{unsupported:!1,said:{key:"couldNotPurge",vars:{error:t||`HTTP ${e}`}}}}const Vb=e=>`/a/${encodeURIComponent(e)}`,Yb=Fu();async function _s(){await Yb.run(()=>tt.trashed(),e=>xe.getState().setTrash(e),e=>xe.getState().setTrashError(Dr(e)))}async function Gb(e,t){const n=xe.getState(),o=n.trash;o&&n.setTrash(o.filter(r=>r.id!==e.id)),n.setTrashNote(null);try{await tt.restore(e.id),xe.getState().setTrashNote({tone:"success",said:{key:"restoredTitle",vars:{title:e.title}}}),t(),await _s()}catch(r){o&&xe.getState().setTrash(o),xe.getState().setTrashNote({tone:"danger",said:{key:"couldNotRestore",vars:{error:Dr(r)}}})}}async function Xb(e){xe.getState().setTrashNote(null);try{await tt.purge(e.id);const t=xe.getState().trash;t&&xe.getState().setTrash(t.filter(n=>n.id!==e.id)),xe.getState().setTrashNote({tone:"success",said:{key:"purged",vars:{title:e.title}}})}catch(t){const n=t instanceof Mn?t.status:0,o=Kb(n,Dr(t));o.unsupported?xe.getState().setPurgeUnsupported():xe.getState().setTrashNote({tone:"danger",said:o.said}),_s()}}const qb="/api/open-artifacts.artifacts.import";function uu(e){const t=xe.getState();if(au(t.upload))return;const n=Nb(e);if(!n)return;if("said"in n){const i=e[0]?.name??"";t.uploadEvent({type:"start",name:i,size:0}),t.uploadEvent({type:"failed",said:n.said});return}const o=n.file;t.uploadEvent({type:"start",name:o.name,size:o.size});const r=jb(o.size,ut.cloud?.limits?.importBytes);if(r){t.uploadEvent({type:"failed",said:r});return}const s=new XMLHttpRequest;s.open("POST",qb),s.setRequestHeader("Content-Type",ud),s.upload.onprogress=i=>xe.getState().uploadEvent({type:"progress",loaded:i.loaded,total:i.lengthComputable?i.total:0}),s.upload.onload=()=>xe.getState().uploadEvent({type:"sent"}),s.onload=()=>{const i=s.status===201||s.status===200?_b(s.responseText):null;if(i){xe.getState().uploadEvent({type:"done",id:i}),location.href=Vb(i);return}xe.getState().uploadEvent({type:"failed",said:qi(Fb(s.status,s.responseText))})},s.onerror=()=>xe.getState().uploadEvent({type:"failed",said:qi({status:0,code:"connect_failed",message:""})}),s.send(o)}function gr(e){return Wu({...e,openedAt:e.openedAt??e.contentAt??e.updatedAt??e.createdAt??null},"")}const Zb=new Set(["artifacts/changed","folders/changed"]);function Ji(e){const t=ca({folders:e.folder?[e.folder]:[]}).folders[0];if(!t)throw new zu("The site answered no folder.");return t}function Jb(e){const t=e.fetcher??((...s)=>fetch(...s)),n=(s,i)=>$s(t,s,void 0),o=(s,i)=>$s(t,s,{body:i});let r=new Map;return{async list(){const s=await n(ct.artifacts),i=$u(s.artifacts??[],e.app?.()?.library??null).map(gr);return r=new Map(i.map(a=>[a.id,a])),{artifacts:i,types:[]}},async open(s){const i=r.get(s);return{url:`/a/${encodeURIComponent(s)}`,sessionId:"",title:i?.title??""}},preview:async()=>null,update:async(s,i)=>gr(await o(ct.update,{id:s,...i})),remove:async s=>Bu(await o(ct.delete,{id:s}),s),restore:async s=>gr(await o(ct.restore,{id:s})),saveThumbnail:async()=>null,thumbnailUrl:(s,i)=>Hu(ct.thumbnail,{id:s,v:i}),...e.folders?{folders:{list:async()=>ca(await n(ct.folders)),create:async(s,i)=>Ji(await o(ct.foldersCreate,{name:s,parentId:i})),update:async(s,i,a)=>Ji(await o(ct.foldersUpdate,{id:s,...i,...a?{etag:a}:{}})),async remove(s,i){await o(ct.foldersDelete,{id:s,...i?.etag?{etag:i.etag}:{},...i?.contents?{contents:i.contents}:{}})},async move(s,i,a,c){await o(ct.foldersMove,{kind:s.kind,id:s.id,to:i,...a!==void 0?{from:a}:{},...c?.confirm?{confirm:c.confirm}:{}})}}}:{},events(s){return e.events?e.events(i=>{Zb.has(i.type)&&s()}):null}}}function Qb(e){return{canCreate:()=>!1,create:()=>{},folderLink:t=>`${e.appOrigin}${_u(t)}`,...e.shareFolder?{shareFolder:t=>e.shareFolder(t)}:{},away:()=>!1,pendingWindow:()=>null,async show(t){const n=e.app(),o=/\/a\/([^/?#]+)/.exec(t.url)?.[1];if(n?.caps.artifacts&&o){const r=decodeURIComponent(o);e.toApp({openArtifacts:"open_artifact",url:new URL(t.url,e.appOrigin).href,id:r,title:t.title,type:e.typeOf(r)})}else e.navigate(t.url);return{sessionGone:!1}},copy:t=>e.copy(t),visible:()=>e.visible(),storage:e.storage}}const ev=Object.freeze({"action.delete":"moveToTrash","delete.title":"siteTrashTitle","delete.moves":"siteTrashBody","delete.confirm":"moveToTrash","toast.deleted":"movedToTrash","empty.body":"noArtifactsCloud"});function tv(e,t,n){const o=e?Uu:Ku;return(r,s)=>{if(r==="title"&&n)return n;const i=ev[r];if(i)return t(i,s);const a=o[r];return a===void 0?r:Vu(a,s)}}function nv(e,t){const n=o=>Promise.reject(new Error(`${o} is not offered on a site.`));return{...e?{browserKeys:t?.length?{endpoints:t}:{}}:{},call(o,r){if(!e)return n(o);const s=r?.body??{},i=r?.query?.id;return(()=>{switch(o){case"models.list":return e.modelsList();case"models.set":return e.modelsSet(s);case"models.remove":return e.modelsRemove(typeof s.name=="string"?s.name:"");case"models.test":return e.modelsTest(s);case"grants.list":return e.grantsList(i);case"grants.revoke":return e.grantsRevoke(s);case"usage.summary":return e.usageSummary(i);case"types":return Promise.resolve({types:[]});default:return null}})()??n(o)}}}function ov(e){return e.signedIn?[...e.types?["types"]:[],...e.models?["models","access","usage"]:[],"trash"]:[]}function rv(e){return e==="#types"?"#settings/types":e==="#trash"?"#settings/trash":null}const On=["editor","commenter","viewer"],St={editor:"roleEditor",commenter:"roleCommenter",viewer:"roleViewer"},mr={editor:"linkEditor",commenter:"linkCommenter",viewer:"linkViewer"},Hs={editor:"noteEditor",commenter:"noteCommenter",viewer:"noteViewer"},sv={editor:f.jsx($m,{className:"size-4"}),commenter:f.jsx(Bm,{className:"size-4"}),viewer:f.jsx(Dm,{className:"size-4"})},_n=l.createContext({menu:()=>{},ask:e=>e.run()});function Hn({trigger:e,items:t,align:n="end"}){const o=l.useContext(_n),r=l.useId(),[s,i]=l.useState(!1),a=l.useRef(s);a.current=s;const c=l.useRef(null),u=l.useRef(null);l.useEffect(()=>()=>o.menu(r,!1),[o,r]);const d=t.some(p=>p.checked!==void 0),h=(p,m)=>{i(p),o.menu(r,p,m)};return f.jsxs(Xc,{open:s,modal:!1,onOpenChange:(p,m)=>{p&&m.event&&m.event===u.current||h(p,m.reason)},children:[f.jsx(Zc,{render:e,onMouseDown:p=>{c.current=p.button===0&&!a.current?p.nativeEvent:null},onClick:p=>{const m=c.current;c.current=null,!(!m||p.detail===0||a.current)&&(u.current=m,h(!0,"trigger-press"))}}),f.jsx(Wc,{children:f.jsx(Yc,{side:"bottom",align:n,sideOffset:6,collisionPadding:12,className:"z-[1001]",children:f.jsx($c,{"data-share-menu":"",className:"min-w-[200px] max-w-[min(340px,calc(100vw-24px))] rounded-xl bg-surface p-1.5 text-[13px] text-fg shadow-popup outline-none transition-opacity duration-100 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",children:t.map(p=>f.jsxs(Hc,{disabled:p.disabled,onClick:p.run,...d?{role:"menuitemradio","aria-checked":!!p.checked}:{},className:"flex w-full cursor-default select-none items-center gap-4 rounded-lg py-2 pl-3 pr-2.5 text-left outline-none data-[highlighted]:bg-hover data-[disabled]:opacity-45",children:[f.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[f.jsx("span",{className:Ae("truncate",p.danger&&"text-danger"),children:p.label}),p.sub?f.jsx("span",{className:"text-xs text-fg-muted",children:p.sub}):null]}),d?f.jsx("span",{className:"flex w-[18px] shrink-0 justify-center text-accent",children:p.checked?f.jsx(As,{className:"size-4"}):null}):null]},p.key))})})})]})}function hn({children:e}){return f.jsx("div",{className:"mb-2 mt-[18px] text-[13px] text-fg-muted",children:e})}function In({children:e,dim:t}){return f.jsx("div",{className:Ae("grid size-9 shrink-0 place-items-center rounded-full bg-surface-2 text-fg",t&&"opacity-50"),children:e})}const cn="flex min-h-12 items-center gap-3 py-1",du="border-transparent bg-surface-2 px-3 text-[13px] hover:bg-hover";function fu({which:e,url:t,share:n}){const o=n.copied===e;return f.jsx(Kt,{size:"lg",variant:"ghost",icon:o?f.jsx(As,{className:"size-3.5"}):f.jsx(Ns,{className:"size-3.5"}),className:Ae(du,o&&"text-success"),disabled:!t,onClick:()=>n.copy(e,t),children:o?k("copied"):k("copyLink")})}function Ho(e,t={},n=!1){return f.jsxs(Kt,{size:"lg",variant:"ghost",className:Ae("gap-1.5 px-2.5 font-normal data-[popup-open]:bg-hover",n&&"-ml-2.5 max-w-full font-medium"),...t,children:[f.jsx("span",{className:"truncate",children:e}),f.jsx(Om,{className:"size-3.5 shrink-0 text-fg-muted"})]})}function iv({role:e,view:t,share:n,manage:o=!0}){const r=l.useContext(_n),s=t.links[e];if(!s)return null;const i=t.lan&&t.tailnet?t.tailnet.links[e]:void 0,a=[...s.on&&i?[{key:"tailnet",label:k("copyTailnet"),sub:k("copyTailnetNote",{address:t.tailnet.address}),run:()=>n.copy(e,i)}]:[],s.on?{key:"off",label:k("turnOffLink"),sub:k("turnOffNote"),run:()=>{n.send({links:{[e]:!1}})}}:{key:"on",label:k("turnOnLink"),run:()=>{n.send({links:{[e]:!0}})}},{key:"reset",label:k("resetLink"),sub:k("resetNote"),danger:!0,run:()=>r.ask({title:k("resetTitle",{role:k(mr[e])}),body:k("resetBody"),ok:k("resetLink"),run:()=>{n.send({reset:[e]})}})}];return f.jsxs("div",{className:cn,title:s.on?s.url:void 0,"data-share-link":e,children:[f.jsx(In,{dim:!s.on,children:sv[e]}),f.jsxs("div",{className:Ae("min-w-0 flex-1",!s.on&&"opacity-50"),children:[f.jsx("div",{className:"truncate",children:k(mr[e])}),f.jsx("div",{className:"truncate text-xs text-fg-muted",children:s.on?k(Hs[e]):k("linkOff")})]}),s.on?f.jsx(fu,{which:e,url:s.url??"",share:n}):o?f.jsx(Kt,{size:"lg",variant:"ghost",className:du,onClick:()=>{n.send({links:{[e]:!0}})},children:k("turnOn")}):null,o?f.jsx(Hn,{items:a,trigger:f.jsx(Do,{label:k("moreFor",{role:k(mr[e])}),title:k("more"),noTooltip:!0,size:"lg",icon:f.jsx(jm,{className:"size-4"})})}):null]})}const av={restricted:"accessRestricted",link:"accessLink",public:"accessPublic"},cv={restricted:"accessRestrictedSub",link:"accessLinkSub",public:"accessPublicSub"},lv={restricted:f.jsx(_m,{className:"size-4"}),link:f.jsx(Ns,{className:"size-4"}),public:f.jsx(Lm,{className:"size-4"})};function uv({cloud:e,share:t}){const n=e.owner;return f.jsxs("div",{className:cn,"data-share-owner":"",children:[f.jsx(mo,{id:n.id,name:n.name,avatar:n.avatar,size:36}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsxs("div",{className:"truncate",children:[n.name,t.me===n.id?f.jsxs("span",{className:"text-fg-muted",children:[" ",k("you")]}):null]}),n.email?f.jsx("div",{className:"truncate text-xs text-fg-muted",children:n.email}):null]}),f.jsx("span",{className:"inline-flex h-8 items-center px-2.5 text-fg-subtle",children:k("owner")})]})}function Qi({member:e,canManage:t,share:n,removeBody:o,kinds:r=Cn}){const s=l.useContext(_n),i=e.kind==="domain"?k("memberDomain",{domain:e.label.replace(/^@/,"")}):e.label,a=hb(e,r),c=a?k(a):e.pending?k("memberPending"):e.kind==="group"?k("memberGroup"):e.email&&e.email!==e.label?e.email:"",u=e.kind==="domain"?f.jsx(In,{dim:!!a,children:f.jsx(Pm,{className:"size-4"})}):e.kind==="group"?f.jsx(In,{dim:!!a,children:f.jsx(Wm,{className:"size-4"})}):f.jsx("span",{className:Ae((e.pending||a)&&"opacity-55 grayscale"),children:f.jsx(mo,{id:e.id,name:e.label,avatar:e.avatar,size:36})}),d=()=>s.ask({title:k("removeTitle",{name:i}),body:o??k("removeMemberBody"),ok:k("remove"),run:()=>{n.change(Yi(e.id,null))}});return f.jsxs("div",{className:cn,"data-share-member":e.id,"data-share-member-off":a?"true":void 0,children:[u,f.jsxs("div",{className:Ae("min-w-0 flex-1",a&&"text-fg-muted"),children:[f.jsxs("div",{className:Ae("truncate",a&&"line-through decoration-fg-subtle"),children:[i,n.me&&e.id===`user:${n.me}`?f.jsxs("span",{className:"text-fg-muted",children:[" ",k("you")]}):null]}),c?f.jsx("div",{className:Ae("text-xs",a?"text-warning":"truncate text-fg-muted"),"data-share-member-sub":"",children:c}):null]}),a&&t?f.jsx(Do,{label:k("removeGuest",{name:i}),title:k("remove"),noTooltip:!0,size:"lg",icon:f.jsx(js,{className:"size-4"}),"data-share-member-remove":e.id,onClick:d}):a?null:t?f.jsx(Hn,{trigger:Ho(k(St[e.role]),{"aria-label":k("changeRole",{name:i})}),items:[...On.map(h=>({key:h,label:k(St[h]),sub:k(Hs[h]),checked:h===e.role,run:()=>{h!==e.role&&n.change(Yi(e.id,h))}})),{key:"remove",label:k("removeAccess"),danger:!0,run:d}]}):f.jsx("span",{className:"inline-flex h-8 items-center px-2.5 text-fg-subtle",children:k(St[e.role])})]})}function dv({guest:e,remove:t,removeBody:n,links:o,pick:r}){const s=l.useContext(_n),i=e.online?k("online"):e.active?k("seenAgo",{when:kn(e.seen??e.joined)}):k("guestPaused");return f.jsxs("div",{className:cn,"data-share-guest":e.id,children:[f.jsxs("div",{className:Ae("relative grid size-9 shrink-0 place-items-center rounded-full text-[13px] font-semibold text-white",!e.active&&"opacity-55 grayscale"),style:{background:ou(e.id)},children:[nu(e.name),e.online?f.jsx("span",{"aria-hidden":!0,className:"absolute -bottom-px -right-px size-2.5 rounded-full border-2 border-surface bg-success"}):null]}),f.jsxs("div",{className:Ae("min-w-0 flex-1",!e.active&&"opacity-70"),children:[f.jsx("div",{className:"truncate",children:e.name}),f.jsx("div",{className:Ae("truncate text-xs",e.online?"text-success":"text-fg-muted"),children:i})]}),o&&r?f.jsx(Hn,{trigger:Ho(k(St[e.role]),{"aria-label":k("changeRole",{name:e.name})}),items:On.map(a=>{const c=!!o[a]?.on;return{key:a,label:k(St[a]),...c?{}:{sub:k("roleLinkOff")},checked:a===e.role,disabled:!c,run:()=>{a!==e.role&&r(a)}}})}):f.jsx("span",{className:"inline-flex h-8 items-center px-2.5 text-fg-subtle",children:k(St[e.role])}),f.jsx(Do,{label:k("removeGuest",{name:e.name}),title:k("remove"),noTooltip:!0,size:"lg",icon:f.jsx(js,{className:"size-4"}),"data-share-guest-remove":e.id,onClick:()=>s.ask({title:k("removeTitle",{name:e.name}),body:n,ok:k("remove"),run:t})})]})}function fv({share:e,roles:t=On,kinds:n=Cn}){const[o,r]=l.useState(""),[s,i]=l.useState(t[0]??"viewer"),[a,c]=l.useState(""),[u,d]=l.useState(!1),h=db(n),p=fb(h);if(h==="none")return f.jsx("p",{"data-share-people-none":"",className:"mb-0 mt-3 text-xs text-fg-muted",children:k("peopleNone")});const m=async()=>{const{members:g,invalid:x,refused:y}=ub(o,n);if(x.length)return c(k(p.invalid,{entries:x.join(", ")}));if(y.length)return c(k(p.refused,{entries:y.join(", ")}));if(!g.length||u)return;c(""),d(!0);const v=await e.change(mb(g,s));d(!1),v&&r("")};return f.jsxs("form",{className:"mt-3",onSubmit:g=>{g.preventDefault(),m()},children:[f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Ky,{value:o,type:"text",inputMode:"email",autoComplete:"off",spellCheck:!1,"aria-label":k("addPeople"),"data-share-add-people":h,placeholder:k(p.placeholder),className:"h-8 min-w-0 flex-1 text-[13px]",onChange:g=>{r(g.target.value),a&&c("")}}),f.jsx(Hn,{trigger:Ho(k(St[s]),{"aria-label":k("roleFor")}),items:t.map(g=>({key:g,label:k(St[g]),sub:k(Hs[g]),checked:g===s,run:()=>i(g)}))}),f.jsx(Kt,{type:"submit",size:"lg",variant:"primary",disabled:u||!o.trim(),children:k("add")})]}),a?f.jsx("div",{role:"alert","data-share-add-error":"",className:"mt-1.5 text-xs text-danger",children:a}):p.hint?f.jsx("div",{"data-share-add-hint":"",className:"mt-1.5 text-xs text-fg-muted",children:k(p.hint)}):null]})}function pv({access:e,options:t,share:n,canManage:o=!0,names:r={},notes:s={}}){const i=c=>k(s[c]??cv[c]),a=c=>k(r[c]??av[c]);return f.jsxs("div",{className:Ae(cn,"items-start"),"data-share-access":e,children:[f.jsx(In,{children:lv[e]}),f.jsxs("div",{className:"min-w-0 flex-1",children:[o?f.jsx(Hn,{align:"start",trigger:Ho(a(e),{"aria-label":k("generalAccess")},!0),items:t.map(c=>({key:c,label:a(c),sub:i(c),checked:c===e,run:()=>{c!==e&&n.change(yb(c))}}))}):f.jsx("div",{className:"flex min-h-8 items-center font-medium",children:a(e)}),f.jsx("div",{className:"break-words text-xs text-fg-muted",children:i(e)})]})]})}const hv=["restricted","link"];function pu(e){return{lan:!1,links:e.links,cloud:{...e.cloud,settings:{viewersCanExport:!1,editorsCanAskAgent:!1}}}}function ea(e){const t=Object.entries(e.guests??{}).filter(([,n])=>n===null);return{...e.access==="restricted"||e.access==="link"?{access:e.access}:{},...e.members?{members:e.members}:{},...e.links?{links:e.links}:{},...e.reset?.length?{reset:e.reset}:{},...t.length?{guests:Object.fromEntries(t.map(([n])=>[n,null]))}:{}}}function gv(e){return[...e.guests??[]].sort((t,n)=>Number(n.online)-Number(t.online)||(n.seen??n.joined).localeCompare(t.seen??t.joined))}function mv(e,t){const n=xb(pu(e),t),o=n.cloud;return{...e,links:n.links,cloud:{...e.cloud,members:o.members,access:o.access==="link"?"link":"restricted"}}}function yv(e){return e.map(t=>({id:t.id,name:t.name,link:t.access==="link",members:t.members})).filter(t=>t.link||t.members.length>0)}function hu(e){const t=e;return!t||typeof t!="object"||typeof t.id!="string"||!t.cloud||typeof t.cloud!="object"||!Array.isArray(t.cloud.members)?null:{id:t.id,name:typeof t.name=="string"?t.name:"",links:t.links&&typeof t.links=="object"?t.links:{},cloud:{...t.cloud,access:t.cloud.access==="link"?"link":"restricted"},inherited:Array.isArray(t.inherited)?t.inherited:[],...Array.isArray(t.guests)?{guests:t.guests.filter(n=>!!n&&typeof n.id=="string"&&typeof n.name=="string")}:{},...t.signIn===!0?{signIn:!0}:{},...Array.isArray(t.people)?{people:t.people}:{}}}async function gu(e){const t=await e.json().catch(()=>({}));return new Error(typeof t.message=="string"&&t.message?t.message:`HTTP ${e.status}`)}const mu=e=>`/api/open-artifacts.${ct.folderShare}${e===void 0?"":`?${new URLSearchParams({id:e})}`}`;async function xv(e,t=(...n)=>fetch(...n)){const n=await t(mu(e),{cache:"no-store"});if(!n.ok)throw await gu(n);const o=hu(await n.json());if(!o)throw new Error("The site answered no folder share.");return o}async function bv(e,t,n=(...o)=>fetch(...o)){const o={id:e,...t},r=await n(mu(),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)});if(!r.ok)throw await gu(r);const s=hu(await r.json());if(!s)throw new Error("The site answered no folder share.");return s}const ta=e=>e instanceof Error?e.message:String(e);function vv(){const e=xe(u=>u.sharingFolder),t=()=>xe.getState().setSharingFolder(null),[n,o]=l.useState(e);l.useEffect(()=>{e&&o(e)},[e]);const r=l.useRef(new Set),s=l.useRef(0),[i,a]=l.useState(null),c=l.useMemo(()=>({menu(u,d,h){d?r.current.add(u):r.current.delete(u),!d&&h==="escape-key"&&(s.current=performance.now())},ask:u=>a(u)}),[]);return f.jsxs(jl,{open:!!e,onOpenChange:u=>{u||i||r.current.size||performance.now()-s.current<250||t()},onOpenChangeComplete:u=>{u||(o(null),a(null))},title:n?k("folderShareTitle",{name:n.name}):"",className:"w-[min(460px,calc(100vw-2rem))] text-[13px]",children:[f.jsx("div",{"data-folder-share-dialog":n?.id??"",children:f.jsx(_n.Provider,{value:c,children:n?f.jsx(wv,{folder:n},n.id):null})}),f.jsx($y,{open:!!i,onOpenChange:u=>!u&&a(null),title:i?.title??"",description:i?.body,confirmLabel:i?.ok,cancelLabel:k("cancel"),danger:!0,initialFocus:"cancel",onConfirm:()=>{const u=i;a(null),u?.run()}})]})}function wv({folder:e}){const[t,n]=l.useState(null),[o,r]=l.useState(null),[s,i]=l.useState(null),a=l.useRef(null);a.current=t,l.useEffect(()=>{let S=!0;return xv(e.id).then(b=>S&&n(b),b=>S&&r(k("folderShareLoadFailed",{error:ta(b)}))),()=>{S=!1}},[e.id]);const c=l.useMemo(()=>{let S;const b=async(w,T)=>{r(null);try{return n(await bv(e.id,ea(w))),Mt.getState().reload(),!0}catch(E){return T&&n(T),r(k("folderShareFailed",{error:ta(E)})),!1}};return{me:ut.cloud?.user?.id,copied:s,copy(w,T){ru(T).then(()=>{i(w),clearTimeout(S),S=setTimeout(()=>i(null),1600)})},async change(w){const T=a.current;return T&&n(mv(T,ea(w))),b(w,T)},send:w=>b(w,null)}},[e.id,s]);if(!t)return o?f.jsx("div",{role:"alert",className:"text-xs text-danger",children:o}):f.jsx("div",{className:"py-2 text-xs text-fg-muted",children:k("loading")});const u=t.cloud,d=pu(t),h=u.canManage,p=e.role??"viewer",m=yv(t.inherited),g=lb(t.people),x=u.access==="link"&&On.some(S=>d.links[S]),y=h?gv(t):[],v=t.signIn===!0;return f.jsxs("div",{"data-folder-share":h?"manage":"read",children:[h?f.jsx(fv,{share:c,kinds:g}):null,f.jsx(hn,{children:k("peopleWithAccess")}),f.jsx(uv,{cloud:u,share:c}),u.members.map(S=>f.jsx(Qi,{member:S,canManage:h,share:c,removeBody:k("folderRemoveMemberBody"),kinds:g},S.id)),h&&!u.members.length?f.jsx("div",{className:"pb-0.5 pt-1.5 text-xs text-fg-muted",children:k("noMembers")}):null,y.length?f.jsxs("section",{"data-folder-guests":"",children:[f.jsx(hn,{children:k("joinedPeople")}),y.map(S=>f.jsx(dv,{guest:S,removeBody:k("folderRemoveGuestBody"),remove:()=>{c.send({guests:{[S.id]:null}})}},S.id))]}):null,m.length?f.jsxs("section",{"data-folder-inherited":"",children:[f.jsx(hn,{children:k("folderInherited")}),m.map(S=>f.jsxs("div",{"data-folder-inherited-from":S.id,children:[f.jsx("div",{className:"mb-0.5 text-xs font-medium text-fg-muted",children:k("folderInheritedFrom",{name:S.name})}),S.members.map(b=>f.jsx(Qi,{member:b,canManage:!1,share:c,kinds:g},b.id)),S.link?f.jsxs("div",{className:cn,children:[f.jsx(In,{children:f.jsx(Ns,{className:"size-4"})}),f.jsx("div",{className:"min-w-0 flex-1 truncate",children:k("folderInheritedLink",{name:S.name})})]}):null]},S.id)),f.jsx("p",{className:"mb-0 mt-1 text-xs text-fg-muted",children:k("folderInheritedNote")})]}):null,f.jsx(hn,{children:k("generalAccess")}),f.jsx(pv,{access:u.access,options:hv,share:c,canManage:h,names:v?{link:"accessLinkSignedIn"}:{},notes:{restricted:"folderAccessRestrictedSub",link:v?"folderAccessLinkSignedInSub":"folderAccessLinkSub"}}),x?f.jsxs(f.Fragment,{children:[f.jsx(hn,{children:k("inviteLinks")}),On.map(S=>f.jsx(iv,{role:S,view:d,share:c,manage:h},S))]}):null,h?null:f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"mb-0 mt-3 text-fg-muted",children:k("folderYourRole",{role:p==="owner"?k("owner"):k(St[p])})}),f.jsx("p",{className:"mb-0 mt-1 text-xs text-fg-muted",children:k("onlyOwnerShares")})]}),o?f.jsx("div",{role:"alert",className:"mt-3 text-xs text-danger",children:o}):null,f.jsx("div",{className:"mt-4 flex justify-end",children:f.jsx(fu,{which:"folder",url:u.url,share:c})})]})}const Sv=Kl(),Bs={private:"siteTypePrivate",link:"siteTypeLink",site:"siteTypeSite"},Tv=e=>e instanceof Error?e.message:String(e),yu=(...e)=>e.filter(Boolean).join(xo.startsWith("zh")?"":" "),xu=e=>e.publisher.name??k("siteTypeUnnamedPublisher");function Ev({type:e}){return f.jsx($e,{"data-site-type-row":e.id,label:f.jsxs(f.Fragment,{children:[f.jsx("a",{href:Qx(e.id),"data-site-type":e.id,className:"oa-set-link",children:e.name})," ",f.jsxs("span",{className:"oa-set-tag",children:["v",e.version]})," ",f.jsx("span",{className:"oa-set-tag",children:k(Bs[e.visibility])}),e.unpublished&&f.jsxs(f.Fragment,{children:[" ",f.jsx("span",{className:"oa-set-tag","data-tone":"warning",children:k("siteTypeDelisted")})]})]}),hint:e.description||void 0,detail:f.jsx("span",{className:"oa-set-hint",children:k("siteTypeBy",{name:xu(e),when:e.updatedAt?kn(e.updatedAt):""})})})}function Rv(){const[e,t]=l.useState(null),[n,o]=l.useState("");return l.useEffect(()=>{Sv.list().then(t,r=>o(Tv(r)))},[]),n?f.jsx(gt,{tone:"danger",children:n}):e?f.jsxs("div",{"data-home-site-types":"",className:"oa-set-stack",children:[f.jsx(gt,{children:yu(k("siteTypesNote"),e.publish.allowed?k("siteTypesYouMayPublish"):e.publish.refusal?k("siteTypesNoPublish",{why:e.publish.refusal}):null)}),f.jsx(Bt,{children:e.types.length?e.types.map(r=>f.jsx(Ev,{type:r},r.uid)):f.jsx($e,{label:k("siteTypesEmptyTitle"),hint:k("siteTypesEmpty")})})]}):f.jsx(gt,{children:k("loading")})}function Cv({row:e}){const t=xe(n=>n.purgeUnsupported);return f.jsx($e,{"data-home-trashed":e.id,label:e.title,hint:f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"oa-set-tag",children:e.typeTitle})," ",e.when.kind==="trashed"?k("trashedWhen",{when:kn(e.when.at)}):k("updated",{when:kn(e.when.at)})]}),children:e.mine&&f.jsxs(f.Fragment,{children:[f.jsx(yr,{onClick:()=>{Gb(e,()=>{Mt.getState().reload()})},children:k("restore")}),Ub(e,t)&&f.jsx(yr,{variant:"danger",onClick:()=>xe.getState().setPurging({id:e.id,title:e.title}),children:k("deleteForever")})]})})}function kv(){const e=xe(i=>i.trash),t=xe(i=>i.trashError),n=xe(i=>i.trashNote),o=Lr(i=>i.changes);l.useEffect(()=>{_s()},[o]),l.useEffect(()=>()=>xe.getState().setTrashNote(null),[]);const r=Wb(ut.cloud?.trashDays),s=e===null?null:zb(e);return f.jsxs("div",{"data-home-trash":"",className:"oa-set-stack",children:[f.jsx(gt,{children:yu(k("trashNote"),r&&k(r.key,r.vars))}),n&&f.jsx(gt,{tone:n.tone,...n.tone==="success"?{role:"status"}:{},children:k(n.said.key,n.said.vars)}),t&&f.jsx(gt,{tone:"danger",children:k("couldNotLoad",{error:t})}),s===null?t?null:f.jsx(gt,{children:k("loading")}):f.jsx(Bt,{children:s.length?s.map(i=>f.jsx(Cv,{row:i},i.id)):f.jsx($e,{hint:k("trashEmpty")})})]})}function Pv(){const e=xe(o=>o.purging);if(!e)return null;const t=()=>xe.getState().setPurging(null),n=k("purgeTitle",{title:e.title});return f.jsxs(la,{label:n,onClose:t,children:[f.jsx("h2",{children:n}),f.jsx("p",{children:k("purgeBody")}),f.jsxs("div",{className:"oa-dialog-actions",children:[f.jsx("button",{type:"button",className:"oa-btn",onClick:t,children:k("cancel")}),f.jsx("button",{type:"button",className:"oa-btn","data-danger":"true",onClick:()=>{Xb(e),t()},children:k("deleteForever")})]})]})}const na={size:16,strokeWidth:1.6,"aria-hidden":!0};function Ov(e){return e.map(t=>{switch(t){case"types":return{id:"types",label:k("types"),icon:f.jsx(zm,{...na}),description:k("siteTypesSub"),render:()=>f.jsx(Rv,{})};case"trash":return{id:"trash",label:k("trash"),icon:f.jsx(js,{...na}),description:k("trashSub"),render:()=>f.jsx(kv,{})};default:return t}})}const st=ut.cloud,Rt=!!st?.user,yo=st?.site?.brand?.name??"",bu=ed(tv(xo==="zh-CN",k,yo||void 0));let vu=null;try{vu=typeof localStorage>"u"?null:localStorage}catch{}const wu=Jb({folders:Rt,app:()=>xe.getState().host,events:e=>td(e)}),Mt=Yu({api:wu,t:bu,host:Qb({appOrigin:st?.appOrigin||location.origin,app:()=>xe.getState().host,toApp:Bb,navigate:e=>location.assign(e),copy:ru,visible:()=>document.visibilityState==="visible",storage:vu,typeOf:e=>Mt.getState().artifacts.find(t=>t.id===e)?.type??"",...Rt?{shareFolder:e=>xe.getState().setSharingFolder({id:e.id,name:e.name,...e.role?{role:e.role}:{}})}:{}})}),rn=ov({signedIn:Rt,types:!!st?.siteTypes,models:!!st?.sample}),Iv={t:bu,api:wu,sessions:Zu,...rn.length?{settings:nv(st?.sample?Eb:null,st?.sample?.endpoints)}:{}},Nr=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null,Mv=e=>(Nr?.addEventListener("change",e),()=>Nr?.removeEventListener("change",e)),oa=()=>Nr?.matches?"dark":"light";function Su(){const e=l.useSyncExternalStore(Mv,oa,oa);return document.documentElement.dataset.theme=e,e}function Av(){const e=[];if(rn.length){const t=()=>{const n=rv(location.hash);n!==null&&history.replaceState(history.state,"",`${location.pathname}${location.search}${n}`)};t(),window.addEventListener("hashchange",t),e.push(()=>window.removeEventListener("hashchange",t)),e.push(Gu(Mt,nd(window)))}if(Rt){const t=ut.folderPage?.id;t&&Mt.getState().openFolder(t),e.push(Xu(Mt,od(window)))}return e.push(xe.subscribe((t,n)=>{JSON.stringify(t.host?.library??null)!==JSON.stringify(n.host?.library??null)&&Mt.getState().reload()})),()=>{for(const t of e)t()}}function Nv(){const e=l.useRef(null),t=xe(n=>au(n.upload));return f.jsxs(f.Fragment,{children:[f.jsxs("button",{type:"button",className:"oa-tool","data-label":"true",disabled:t,title:k("uploadHint"),onClick:()=>e.current?.click(),children:[f.jsx(El,{size:16,strokeWidth:1.75,"aria-hidden":"true"}),f.jsx("span",{className:"oa-tool-text",children:k("upload")})]}),f.jsx("input",{ref:e,type:"file",accept:".zip,application/zip,application/x-zip-compressed","data-home-upload":"",hidden:!0,onChange:n=>{const o=[...n.target.files??[]];n.target.value="",uu(o)}})]})}function Tu(){return st?f.jsxs("a",{className:"oa-tool oa-site-signin","data-label":"true",href:Ql(st.signInUrl,`${location.pathname}${location.search}`,location.origin),children:[f.jsx(hl,{size:16,strokeWidth:1.75,"aria-hidden":"true"}),f.jsx("span",{className:"oa-tool-text",children:k("signIn")})]}):null}function jv(){const e=Lr(t=>t.settings!==null)&&rn.length>0;return st?f.jsxs(f.Fragment,{children:[Rt&&!e&&f.jsx(Nv,{}),Rt?f.jsx(iu,{cloud:st}):f.jsx(Tu,{})]}):null}function Dv(){const e=xe(o=>o.upload);if(e.kind==="idle")return null;if(e.kind==="failed")return f.jsxs("div",{role:"alert","data-home-upload-error":"",className:"oa-site-status","data-kind":"error",children:[f.jsx(Sl,{size:16,"aria-hidden":"true"}),f.jsx("span",{className:"oa-site-status-text",children:k(e.said.key,e.said.vars)}),f.jsx("button",{type:"button",className:"oa-tool","aria-label":k("dismiss"),onClick:()=>xe.getState().uploadEvent({type:"dismiss"}),children:f.jsx(Ds,{size:14,"aria-hidden":"true"})})]});const t=Mb(e),n=e.kind==="done"?k("uploadOpening",{name:e.name}):e.kind==="checking"?k("uploadChecking",{name:e.name}):t===null?k("uploadSendingSize",{name:e.name}):k("uploadSending",{name:e.name,percent:t});return f.jsxs("div",{role:"status","data-home-upload-state":e.kind,className:"oa-site-status",children:[f.jsx("span",{className:"oa-site-status-text",children:n}),f.jsx("span",{className:"oa-site-bar","aria-hidden":"true",children:f.jsx("span",{style:{width:`${t??5}%`}})})]})}function Lv({children:e}){const[t,n]=l.useState(!1),o=l.useRef(0),r=Lr(i=>i.settings!==null)&&rn.length>0,s=i=>Rt&&!r&&Db([...i.dataTransfer.types]);return f.jsxs("div",{className:"oa-site-main","data-home-drop":t?"over":"",onDragEnter:i=>{s(i)&&(i.preventDefault(),o.current++,n(!0))},onDragOver:i=>{s(i)&&(i.preventDefault(),i.dataTransfer.dropEffect="copy")},onDragLeave:i=>{s(i)&&(o.current=Math.max(0,o.current-1),o.current||n(!1))},onDrop:i=>{s(i)&&(i.preventDefault(),o.current=0,n(!1),uu([...i.dataTransfer.files]))},children:[e,t&&f.jsx("div",{className:"oa-site-drop",children:f.jsxs("span",{children:[f.jsx(El,{size:16,"aria-hidden":"true"}),k("uploadDrop")]})})]})}function Eu(){const e=Zl(st?.site,"home");return e.length===0?null:f.jsx("nav",{"aria-label":"Site links",className:"oa-site-links",children:e.map(t=>{const n=Jl(t.href,location.origin);return f.jsxs("a",{href:t.href,...n?{target:"_blank",rel:"noopener noreferrer"}:{},children:[t.label,n&&f.jsx(cl,{size:11,"aria-hidden":"true"})]},`${t.label} ${t.href}`)})})}function Fv(){const e=Su();return f.jsxs("div",{className:"oa-site","data-site-library":"",children:[f.jsx(qu,{env:Iv,children:f.jsxs(Ju,{store:Mt,children:[f.jsx(Lv,{children:f.jsx(Qu,{canCreate:!1,createSession:!1,theme:e,headingTools:f.jsx(jv,{}),...rn.length?{settingsSections:Ov(rn)}:{}})}),f.jsx(Dv,{}),f.jsx(Eu,{}),Rt&&f.jsx(Pv,{})]})}),Rt&&f.jsx(vv,{})]})}const _v=`
|
|
3
|
+
.oa-site{display:flex;flex-direction:column;height:100%;min-height:0;background:var(--oa-page-bg)}
|
|
4
|
+
.oa-site-main{position:relative;flex:1;min-height:0;display:flex;flex-direction:column}
|
|
5
|
+
.oa-site-main>.oa-page{flex:1}
|
|
6
|
+
.oa-site .oa-tool:disabled{opacity:.5;cursor:default}
|
|
7
|
+
.oa-site-signin{text-decoration:none}
|
|
8
|
+
.oa-site-status{position:fixed;left:50%;bottom:24px;z-index:900;display:flex;flex-direction:column;gap:8px;width:min(480px,calc(100% - 32px));padding:10px 14px;border:.5px solid var(--oa-page-border);border-radius:12px;background:var(--oa-page-bg);box-shadow:0 8px 28px -6px rgba(0,0,0,.28);transform:translateX(-50%);color:var(--oa-page-text-primary);font-size:14px;line-height:20px}
|
|
9
|
+
.oa-site-status[data-kind=error]{flex-direction:row;align-items:flex-start;gap:10px;padding-right:6px;color:var(--oa-page-danger)}
|
|
10
|
+
.oa-site-status[data-kind=error]>svg{flex:none;margin-top:2px}
|
|
11
|
+
.oa-site-status[data-kind=error] .oa-tool{flex:none;width:28px;height:28px;margin:-4px 0}
|
|
12
|
+
.oa-site-status-text{flex:1;min-width:0;overflow-wrap:anywhere}
|
|
13
|
+
.oa-site-status:not([data-kind]) .oa-site-status-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
14
|
+
.oa-site-bar{display:block;height:6px;overflow:hidden;border-radius:3px;background:var(--oa-page-hover-bg)}
|
|
15
|
+
.oa-site-bar>span{display:block;height:100%;border-radius:3px;background:var(--oa-page-accent);transition:width .15s}
|
|
16
|
+
.oa-site-drop{position:absolute;inset:12px;z-index:20;display:grid;place-items:center;border:2px dashed var(--oa-page-accent);border-radius:16px;background:color-mix(in srgb,var(--oa-page-bg) 85%,transparent);color:var(--oa-page-accent);font-size:14px;font-weight:500;pointer-events:none}
|
|
17
|
+
.oa-site-drop>span{display:flex;align-items:center;gap:8px}
|
|
18
|
+
.oa-site-links{display:flex;flex-wrap:wrap;justify-content:center;gap:2px 16px;padding:6px 16px 8px;border-top:.5px solid var(--oa-page-border);color:var(--oa-page-text-caption);font-size:12px;line-height:18px}
|
|
19
|
+
.oa-site-links a{display:inline-flex;align-items:center;gap:3px;color:var(--oa-page-text-tertiary);text-decoration:none}
|
|
20
|
+
.oa-site-links a:hover{color:var(--oa-page-text-primary);text-decoration:underline}
|
|
21
|
+
@media (prefers-reduced-motion:reduce){.oa-site-bar>span{transition:none}}
|
|
22
|
+
`,ra=Kl(),sa=e=>e instanceof Error?e.message:String(e);function Hv({type:e,onChange:t}){const[n,o]=l.useState(!1),[r,s]=l.useState(!1),[i,a]=l.useState(null),c=async d=>{o(!0),a(null);try{t(await ra.setVisibility(e.id,d),"")}catch(h){a({tone:"danger",text:k("siteTypeCouldNot",{error:sa(h)})})}finally{o(!1)}},u=async()=>{s(!1),o(!0),a(null);try{const d=await ra.unpublish(e.id),h=d.removed?k("siteTypeRemoved",{name:e.name}):k("siteTypeDelistedNow",{name:e.name,count:d.artifacts});t(d.removed?null:{...e,unpublished:!0},h),a({tone:"success",text:h})}catch(d){a({tone:"danger",text:k("siteTypeCouldNot",{error:sa(d)})})}finally{o(!1)}};return f.jsxs(Bt,{title:k("siteTypeManage"),"data-site-type-manage":"",children:[e.unpublished?f.jsx($e,{hint:k("siteTypeDelistedManage",{id:e.id})}):f.jsxs(f.Fragment,{children:[f.jsx($e,{label:k("siteTypeWhoSees"),hint:k("siteTypeVisibilityNote"),children:f.jsx(rd,{"aria-label":k("siteTypeWhoSees"),value:e.visibility,disabled:n,options:["private","link","site"].map(d=>({value:d,label:k(Bs[d])})),onChange:d=>d!==e.visibility&&void c(d)})}),f.jsx($e,{label:k("siteTypeUnpublish"),hint:k("siteTypeUnpublishBody"),children:f.jsx(yr,{variant:"danger",disabled:n,onClick:()=>s(!0),children:k("siteTypeUnpublish")})})]}),i&&f.jsx($e,{detail:f.jsx(gt,{tone:i.tone,...i.tone==="success"?{role:"status"}:{},children:i.text})}),r&&f.jsxs(la,{label:k("siteTypeUnpublishTitle",{name:e.name}),onClose:()=>s(!1),children:[f.jsx("h2",{children:k("siteTypeUnpublishTitle",{name:e.name})}),f.jsx("p",{children:k("siteTypeUnpublishBody")}),f.jsxs("div",{className:"oa-dialog-actions",children:[f.jsx("button",{type:"button",className:"oa-btn",onClick:()=>s(!1),children:k("cancel")}),f.jsx("button",{type:"button",className:"oa-btn","data-danger":"true",onClick:()=>{u()},children:k("siteTypeUnpublish")})]})]})]})}function Bv({detail:e}){const[t,n]=l.useState(e),[o,r]=l.useState("");return t?f.jsxs("div",{"data-type-page":t.id,className:"oa-set-stack oa-site-type",children:[f.jsxs("header",{className:"oa-site-type-head",children:[f.jsxs("h2",{children:[f.jsx("span",{"data-testid":"type-page-name",children:t.name})," ",f.jsxs("span",{className:"oa-set-tag",children:["v",t.version]})," ",f.jsx("span",{className:"oa-set-tag",children:k(Bs[t.visibility])})]}),t.description&&f.jsx("p",{className:"oa-site-type-description","data-testid":"type-page-description",children:t.description})]}),t.unpublished&&f.jsx(gt,{tone:"warning",role:"status","data-testid":"type-page-delisted",children:k("siteTypeDelistedNote")}),f.jsxs(Bt,{children:[f.jsx($e,{label:k("siteTypePublisher"),children:f.jsx("span",{"data-testid":"type-page-publisher",children:xu(t)})}),f.jsx($e,{label:k("siteTypeUpdated"),children:t.updatedAt?kn(t.updatedAt):"—"}),f.jsx($e,{label:k("packageCapabilities"),children:f.jsx("span",{"data-testid":"type-page-capabilities",className:"oa-site-fact",children:t.capabilities.length?t.capabilities.join(", "):k("noCapabilities")})}),f.jsx($e,{label:k("packageNetwork"),children:f.jsx("span",{"data-testid":"type-page-network",className:"oa-site-fact",children:t.network.length?t.network.join(", "):k("noNetwork")})}),f.jsx($e,{label:"sha256",detail:f.jsx("code",{className:"oa-set-code oa-site-fact",children:t.sha256})})]}),f.jsx(gt,{children:k("packageThirdParty")}),!t.unpublished&&f.jsx(Bt,{title:k("siteTypeInstall"),children:f.jsx($e,{hint:k("siteTypeInstallNote"),detail:f.jsxs(f.Fragment,{children:[f.jsx("pre",{"data-testid":"type-page-install",className:"oa-set-pre",children:t.install}),f.jsxs("a",{href:t.packageUrl,download:!0,className:"oa-set-ext",children:[f.jsx(Nm,{size:12,"aria-hidden":"true"}),k("siteTypeDownload")]})]})})}),f.jsx(Bt,{title:"SKILL.md",children:f.jsx($e,{hint:k("siteTypeSkillNote"),detail:t.skill?f.jsx("pre",{"data-testid":"type-page-skill",className:"oa-set-pre oa-site-skill",children:t.skill}):f.jsx("span",{className:"oa-set-hint",children:k("siteTypeNoSkill")})})}),t.manages&&f.jsx(Hv,{type:t,onChange:(s,i)=>{r(i),n(s)}})]}):f.jsx("div",{"data-type-page":"",className:"oa-set-stack",children:f.jsx(Bt,{children:f.jsx($e,{label:k("siteTypeGoneTitle"),hint:o||k("siteTypeGone")})})})}function $v({detail:e}){const t=Su(),n=ut.cloud;return l.useEffect(()=>{document.title=e.name},[e.name]),f.jsxs("div",{className:"oa-site",children:[f.jsx("section",{className:"oa-page","data-theme":t,"aria-label":e.name,children:f.jsx("div",{className:"oa-scroll",children:f.jsxs("div",{className:"oa-content",children:[f.jsxs("div",{className:"oa-heading",children:[f.jsx("div",{className:"oa-title",children:f.jsx("h1",{children:f.jsx("a",{href:"/",className:"oa-site-home",children:yo||k("homeTitle")})})}),f.jsx("div",{className:"oa-tools",children:n?n.user?f.jsx(iu,{cloud:n}):f.jsx(Tu,{}):null})]}),n?.user&&n.siteTypes&&f.jsxs("a",{href:"/#settings/types",className:"oa-set-ext oa-site-back",children:[f.jsx(km,{size:12,"aria-hidden":"true"}),k("siteTypesBack")]}),f.jsx(Bv,{detail:e})]})})}),f.jsx(Eu,{})]})}const zv=`
|
|
23
|
+
.oa-site-home{color:inherit;text-decoration:none}
|
|
24
|
+
.oa-site-home:hover{text-decoration:underline}
|
|
25
|
+
.oa-site-back{display:inline-flex;margin:-8px 0 16px}
|
|
26
|
+
.oa-site-type-head h2{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;margin:0;font-size:20px;font-weight:600;line-height:28px;overflow-wrap:anywhere}
|
|
27
|
+
.oa-site-type-description{margin:6px 0 0;color:var(--oa-page-text-secondary);overflow-wrap:anywhere}
|
|
28
|
+
.oa-site-fact{overflow-wrap:anywhere}
|
|
29
|
+
.oa-site .oa-set-row-control{min-width:0}
|
|
30
|
+
.oa-site-type code.oa-site-fact{display:block;margin-top:4px;padding:4px 6px;word-break:break-all}
|
|
31
|
+
.oa-site-skill{max-height:60vh}
|
|
32
|
+
`;document.documentElement.lang=xo;yo&&(document.title=yo);ut.typePage||Av();function Wv(){return l.useEffect(()=>$b(),[]),ut.cloud&&ut.typePage?f.jsx($v,{detail:ut.typePage}):f.jsx(Fv,{})}sd("open-artifacts-site/page.css",ad+cd+_v+zv);id.createRoot(document.getElementById("root")).render(f.jsx(l.StrictMode,{children:f.jsx(ig,{children:f.jsx(Fx,{children:f.jsx(Wv,{})})})}));export{ld as O,Vl as S,Zx as _,Vv as r,Kv as s};
|