create-opentray 0.22.0 → 0.24.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.
Files changed (66) hide show
  1. package/assets/create-openspec-template-iOS-Dark-1024@1x.png +0 -0
  2. package/assets/create-openspec-template-iOS-Default-1024@1x.png +0 -0
  3. package/assets/inter-glyph.OFL.txt +93 -0
  4. package/assets/inter-glyph.ttf +0 -0
  5. package/dist/{bin-Dyfucd3C.mjs → bin-BQb2Bjcu.mjs} +449 -2787
  6. package/dist/bin-BQb2Bjcu.mjs.map +1 -0
  7. package/dist/bin.mjs +1 -1
  8. package/dist/{decode-ico-D3SL2BXi.mjs → decode-ico-BHd2POHf.mjs} +2 -2
  9. package/dist/{decode-ico-D3SL2BXi.mjs.map → decode-ico-BHd2POHf.mjs.map} +1 -1
  10. package/dist/index.d.mts +40 -6
  11. package/dist/index.d.mts.map +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/{raster-BQ07mKLu.mjs → raster-DeMbA2zI.mjs} +15 -16
  14. package/dist/{raster-BQ07mKLu.mjs.map → raster-DeMbA2zI.mjs.map} +1 -1
  15. package/dist/shell/assets/browse.js +1 -1
  16. package/dist/shell/assets/index.css +1 -1
  17. package/dist/shell/assets/index.js +9 -9
  18. package/dist/shell/assets/index2.js +2 -0
  19. package/dist/shell/assets/input.js +1 -1
  20. package/dist/shell/assets/main.js +20 -19
  21. package/dist/shell/assets/ort.bundle.min.js +2763 -0
  22. package/dist/shell/assets/ort.bundle.min.mjs +2817 -0
  23. package/dist/shell/assets/ort.webgpu.bundle.min.js +2763 -0
  24. package/dist/shell/assets/ort.webgpu.bundle.min.mjs +2817 -0
  25. package/dist/shell/assets/terminal-pane.js +1 -1
  26. package/dist/shell/assets/terminal.js +1 -1
  27. package/dist/shell/browse.html +1 -1
  28. package/dist/shell/index.html +1 -1
  29. package/dist/shell/terminal.html +1 -1
  30. package/dist/webui/assets/browse.js +1 -1
  31. package/dist/webui/assets/index.css +1 -1
  32. package/dist/webui/assets/index.js +9 -9
  33. package/dist/webui/assets/index2.js +2 -0
  34. package/dist/webui/assets/input.js +1 -1
  35. package/dist/webui/assets/main.js +20 -19
  36. package/dist/webui/assets/ort.bundle.min.js +2763 -0
  37. package/dist/webui/assets/ort.bundle.min.mjs +2817 -0
  38. package/dist/webui/assets/ort.webgpu.bundle.min.js +2763 -0
  39. package/dist/webui/assets/ort.webgpu.bundle.min.mjs +2817 -0
  40. package/dist/webui/assets/terminal-pane.js +1 -1
  41. package/dist/webui/assets/terminal.js +1 -1
  42. package/dist/webui/browse.html +1 -1
  43. package/dist/webui/index.html +1 -1
  44. package/dist/webui/terminal.html +1 -1
  45. package/package.json +15 -6
  46. package/dist/avif-DCXcyYJR.mjs +0 -2
  47. package/dist/bin-Dyfucd3C.mjs.map +0 -1
  48. package/dist/decode-C4b5NXc_.mjs +0 -1236
  49. package/dist/decode-C4b5NXc_.mjs.map +0 -1
  50. package/dist/decode-Dsj9J0OD.mjs +0 -1214
  51. package/dist/decode-Dsj9J0OD.mjs.map +0 -1
  52. package/dist/decode-FysWS28R.mjs +0 -254
  53. package/dist/decode-FysWS28R.mjs.map +0 -1
  54. package/dist/decode-Xr7mARKr.mjs +0 -1262
  55. package/dist/decode-Xr7mARKr.mjs.map +0 -1
  56. package/dist/full.umd-oM1VUBRH.mjs +0 -3055
  57. package/dist/full.umd-oM1VUBRH.mjs.map +0 -1
  58. package/dist/jpeg-B4tsxG5f.mjs +0 -2
  59. package/dist/png-rD0XEazj.mjs +0 -35
  60. package/dist/png-rD0XEazj.mjs.map +0 -1
  61. package/dist/resize-B47sgoOb.mjs +0 -489
  62. package/dist/resize-B47sgoOb.mjs.map +0 -1
  63. package/dist/resvg-wasm-fcJTLpJs.mjs +0 -522
  64. package/dist/resvg-wasm-fcJTLpJs.mjs.map +0 -1
  65. package/dist/rolldown-runtime-JspESFgx.mjs +0 -35
  66. package/dist/webp-CcbaCrQ7.mjs +0 -2
@@ -1,24 +1,25 @@
1
- import{c as He,r as d,E as Nt,u as Dt,b as Fp,d as lu,f as ot,e as je,j as l,N as Er,g as ct,h as Qt,i as cu,k as fe,m as Bt,l as ki,n as Bp,o as jp,R as Mp,a as Pp}from"./index.js";import{u as It,b as ie,i as Xe,c as Pe,d as ve,g as _t,o as Be,e as vt,f as wt,h as Ei,j as de,k as Gt,l as Ce,m as Tp,n as Mt,p as Bn,q as Jn,r as Np,t as at,s as Lo,v as rt,w as At,x as Pn,y as Ko,z as Dn,C as $n,D as Zs,E as yn,F as Si,H as _p,J as uu,K as Op,L as Ri,M as Wo,N as du,O as sl,P as Yn,Q as Js,S as Di,B as Oe,T as fu,U as Fi,V as Cr,W as xr,X as Bi,Y as pu,Z as ji,_ as Mi,$ as Qo,a0 as Pi,a1 as on,a2 as Ti,a3 as Hp,I as qe,a4 as Ni,a5 as Lp,G as $s,a6 as il,a7 as al,A as Kp,a as Wp,R as Qp}from"./input.js";import{u as hu,B as bo,T as Sr,p as Gp,c as Yp}from"./terminal-pane.js";const zp=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],_i=He("check",zp);const Up=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Tn=He("chevron-down",Up);const Vp=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Oi=He("chevron-up",Vp);const Zp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Jp=He("circle-check",Zp);const $p=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Xp=He("circle-question-mark",$p);const qp=[["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"}]],eh=He("copy",qp);const th=[["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"}]],nh=He("download",th);const rh=[["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"}]],Au=He("external-link",rh);const oh=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],sh=He("file-text",oh);const ih=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],ah=He("folder-open",ih);const lh=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ch=He("folder",lh);const uh=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],dh=He("link-2",uh);const fh=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],ph=He("list",fh);const hh=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ah=He("loader-circle",hh);const gh=[["path",{d:"M5 12h14",key:"1ays0h"}]],mh=He("minus",gh);const xh=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],bh=He("monitor",xh);const vh=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],yh=He("moon",vh);const Ch=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],ll=He("panel-left",Ch);const Ih=[["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"}]],gu=He("pencil",Ih);const wh=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],kh=He("play",wh);const Eh=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],mu=He("plus",Eh);const Sh=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Rh=He("refresh-cw",Sh);const Dh=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Fh=He("settings-2",Dh);const Bh=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],jh=He("share-2",Bh);const Mh=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Ph=He("square",Mh);const Th=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Nh=He("sun",Th);const _h=[["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"}]],Oh=He("trash-2",_h);const Hh=[["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"}]],Lh=He("triangle-alert",Hh);const Kh=[["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"}]],xu=He("upload",Kh);const Wh=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Hi=He("x",Wh);function bu(e,t,n,r=!0,o){const[s,i]=d.useState(),a=It(o?`${o}-label`:void 0),c=e??t??s;return ie(()=>{const u=e||t||!r?void 0:Qh(n.current,a);s!==u&&i(u)}),c}function Qh(e,t){const n=Gh(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Gh(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const n=e.id;if(n){const o=e.nextElementSibling;if(o&&o.htmlFor===n)return o}const r=e.labels;return r&&r[0]}function Yh(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:zh,platform:Uh,maxTouchPoints:Vh}=Yh(),Go=zh.toLowerCase(),Rr=Uh.toLowerCase(),Yo=/^i(os$|p)/.test(Rr)||Rr==="macintel"&&Vh>1,cl="android",Xs=Rr===cl||Go.includes(cl),Li=!Yo&&Rr.startsWith("mac");Rr.startsWith("win");const Zh=Li||Yo,an=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!an&&Go.includes("firefox");!an&&Go.includes("chrom");const Jh=Zh,Ki=/jsdom|happydom/.test(Go),qs="data-base-ui-focusable",vu="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",zo="ArrowLeft",Uo="ArrowRight",yu="ArrowUp",Wi="ArrowDown";function vo(e,t){if(!Pe(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(ve(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function vs(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 $h(e){return e.matches("html,body")}function Vo(e){return Xe(e)&&e.matches(vu)}function Xh(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${vu}`)!=null}function ei(e){return e?e.getAttribute("role")==="combobox"&&Vo(e):!1}function qh(e){if(!e||Ki)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function yo(e){return e?e.hasAttribute(qs)?e:e.querySelector(`[${qs}]`)||e:null}function xn(e,t,n=!0){return e.filter(o=>o.parentId===t).flatMap(o=>[...!n||o.context?.open?[o]:[],...xn(e,o.id,n)])}function ul(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(s=>s.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function Ht(e){e.preventDefault(),e.stopPropagation()}function eA(e){return"nativeEvent"in e}function Qi(e){return e.pointerType===""&&e.isTrusted?!0:Xs&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Gi(e){return Ki?!1:!Xs&&e.width===0&&e.height===0||Xs&&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 mn(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function tA(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const Xn=Math.min,nn=Math.max,Co=Math.round,Zr=Math.floor,rn=e=>({x:e,y:e}),nA={left:"right",right:"left",bottom:"top",top:"bottom"};function Cu(e,t,n){return nn(e,Xn(t,n))}function bn(e,t){return typeof e=="function"?e(t):e}function jt(e){return e.split("-")[0]}function Cn(e){return e.split("-")[1]}function Yi(e){return e==="x"?"y":"x"}function zi(e){return e==="y"?"height":"width"}function Ft(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ui(e){return Yi(Ft(e))}function rA(e,t,n){n===void 0&&(n=!1);const r=Cn(e),o=Ui(e),s=zi(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Io(i)),[i,Io(i)]}function oA(e){const t=Io(e);return[ti(e),t,ti(t)]}function ti(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const dl=["left","right"],fl=["right","left"],sA=["top","bottom"],iA=["bottom","top"];function aA(e,t,n){switch(e){case"top":case"bottom":return n?t?fl:dl:t?dl:fl;case"left":case"right":return t?sA:iA;default:return[]}}function lA(e,t,n,r){const o=Cn(e);let s=aA(jt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ti)))),s}function Io(e){const t=jt(e);return nA[t]+e.slice(t.length)}function cA(e){var t,n,r,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(o=e.left)!=null?o:0}}function Iu(e){return typeof e!="number"?cA(e):{top:e,right:e,bottom:e,left:e}}function Dr(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Ir(e,t){return t<0||t>=e.length}function Ao(e,t){return tn(e.current,{disabledIndices:t})}function ni(e,t){return tn(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function tn(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=t;do s+=n?-o:o;while(s>=0&&s<=e.length-1&&wo(e,s,r));return s}function wo(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;const o=e[t];return o?!Zo(o)||o.matches(":disabled")?!0:!n&&(o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true"):!1}function uA(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Zo(e,t=e?_t(e):null){return!e||!e.isConnected||!t||uA(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const dA='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function fA(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return Ei(n)?n.host:null}function ri(e){for(const t of Array.from(e.children))if(wt(t)==="summary")return t;return null}function pA(e,t){const n=ri(t);return!!n&&(e===n||ve(n,e))}function wu(e){const t=e?wt(e):"";return e!=null&&e.matches(dA)&&(t!=="summary"||e.parentElement!=null&&wt(e.parentElement)==="details"&&ri(e.parentElement)===e)&&(t!=="details"||ri(e)==null)&&(t!=="input"||e.type!=="hidden")}function ku(e){if(!wu(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=fA(t)){const n=t!==e,r=wt(t)==="slot";if(t.hasAttribute("inert")||n&&wt(t)==="details"&&!t.open&&!pA(e,t)||t.hasAttribute("hidden")||!r&&!hA(t,n))return!1}return!0}function hA(e,t){const n=_t(e);return t?n.display!=="none":Zo(e,n)}function Eu(e){const t=e.tabIndex;if(t<0){const n=wt(e);if(n==="details"||n==="audio"||n==="video"||Xe(e)&&e.isContentEditable)return 0}return t}function ys(e){if(wt(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function AA(e,t){const n=ys(e);if(!n)return!0;const r=t.find(o=>{const s=ys(o);return s?.name===n.name&&s.form===n.form&&s.checked});return r?r===n:t.find(o=>{const s=ys(o);return s?.name===n.name&&s.form===n.form})===n}function Su(e){if(Xe(e)&&wt(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Xe(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Ru(e,t){Su(e).forEach(n=>{wu(n)&&t.push(n),Ru(n,t)})}function Du(e,t,n){Su(e).forEach(r=>{Xe(r)&&r.matches(t)&&n.push(r),Du(r,t,n)})}function Vi(e){return ku(e)&&Eu(e)>=0}function Fu(e){const t=[];return Ru(e,t),t.filter(ku)}function Kr(e){const t=Fu(e);return t.filter(n=>Eu(n)>=0&&AA(n,t))}function Bu(e,t){const n=Kr(e),r=n.length;if(r===0)return;const o=vt(Be(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function Zi(e){return Bu(Be(e).body,1)||e}function ju(e){return Bu(Be(e).body,-1)||e}function Mu(e,t){if(!e)return null;const n=Kr(Be(e).body),r=n.length;if(r===0)return null;const o=n.indexOf(e);if(o===-1)return null;const s=(o+t+r)%r;return n[s]}function gA(e){return Mu(e,1)}function mA(e){return Mu(e,-1)}function zn(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!ve(n,r)}function xA(e){Kr(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function pl(e){const t=[];Du(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Ji(e){d.useEffect(e,Nt)}const ar=0;class Ot{static create(){return new Ot}currentId=ar;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=ar,n()},t)}isStarted(){return this.currentId!==ar}clear=()=>{this.currentId!==ar&&(clearTimeout(this.currentId),this.currentId=ar)};disposeEffect=()=>this.clear}function pt(){const e=Dt(Ot.create).current;return Ji(e.disposeEffect),e}const bA=d.createContext({disabled:!1});function vA(){return d.useContext(bA)}var sn=Fp();const Jr=null;class yA{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}let $r=new yA;class Ct{static create(){return new Ct}static request(t){return $r.request(t)}static cancel(t){return $r.cancel(t)}currentId=Jr;request(t){this.cancel(),this.currentId=$r.request(()=>{this.currentId=Jr,t()})}cancel=()=>{this.currentId!==Jr&&($r.cancel(this.currentId),this.currentId=Jr)};disposeEffect=()=>this.cancel}function qn(){const e=Dt(Ct.create).current;return Ji(e.disposeEffect),e}function Xt(e){return e==null?e:"current"in e?e.current:e}function $i(e,t=!1){const n=qn();return de((r,o=null)=>{n.cancel();const s=Xt(e);if(s==null)return;const i=s,a=()=>{sn.flushSync(r)};if(typeof i.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function c(){Promise.all(i.getAnimations().map(u=>u.finished)).then(()=>{o?.aborted||a()},()=>{if(o?.aborted)return;if(i.getAnimations().some(f=>f.pending||f.playState!=="finished")){c();return}a()})}if(t){const u="data-starting-style";if(!i.hasAttribute(u)){n.request(c);return}const f=new MutationObserver(()=>{i.hasAttribute(u)||(f.disconnect(),c())});f.observe(i,{attributes:!0,attributeFilter:[u]}),o?.addEventListener("abort",()=>f.disconnect(),{once:!0});return}n.request(c)})}function Yt(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=de(o),i=$i(r,n);d.useEffect(()=>{if(!t)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[t,n,s,i])}let ko=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const CA={"data-starting-style":""},IA={"data-ending-style":""},Nn={transitionStatus(e){return e==="starting"?CA:e==="ending"?IA:null}};function sr(e,t=!1,n=!1){const[r,o]=d.useState(e&&t?"idle":void 0),[s,i]=d.useState(e);return e&&!s&&(i(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),ie(()=>{if(!e&&s&&r!=="ending"&&n){const a=Ct.request(()=>{o("ending")});return()=>{Ct.cancel(a)}}},[e,s,r,n]),ie(()=>{if(!e||t)return;const a=Ct.request(()=>{o(void 0)});return()=>{Ct.cancel(a)}},[t,e]),ie(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const a=Ct.request(()=>{o("idle")});return()=>{Ct.cancel(a)}},[t,e,s,r]),{mounted:s,setMounted:i,transitionStatus:r}}var Cs={exports:{}},Is={};var hl;function wA(){if(hl)return Is;hl=1;var e=lu();function t(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(h,g){var A=g(),p=r({inst:{value:A,getSnapshot:g}}),m=p[0].inst,x=p[1];return s(function(){m.value=A,m.getSnapshot=g,c(m)&&x({inst:m})},[h,A,g]),o(function(){return c(m)&&x({inst:m}),h(function(){c(m)&&x({inst:m})})},[h]),i(A),A}function c(h){var g=h.getSnapshot;h=h.value;try{var A=g();return!n(h,A)}catch{return!0}}function u(h,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return Is.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Is}var Al;function Pu(){return Al||(Al=1,Cs.exports=wA()),Cs.exports}var Jo=Pu();const br={v:[]},gl=()=>br.v.forEach(e=>e()),kA=e=>(br.v.push(e)===1&&addEventListener("hashchange",gl),()=>{br.v=br.v.filter(t=>t!==e),br.v.length||removeEventListener("hashchange",gl)}),EA=()=>"/"+location.hash.replace(/^#?\/?/,""),SA=(e,{state:t=null,replace:n=!1}={})=>{const r=location.href,[o,s]=e.replace(/^#?\/?/,"").split("?"),i=new URL(location.href);i.hash=`/${o}`,s&&(i.search=s);const a=i.href;n?history.replaceState(t,"",a):history.pushState(t,"",a);const c=typeof HashChangeEvent<"u"?new HashChangeEvent("hashchange",{oldURL:r,newURL:a}):new Event("hashchange",{detail:{oldURL:r,newURL:a}});dispatchEvent(c)},Tu=({ssrPath:e="/"}={})=>[Jo.useSyncExternalStore(kA,EA,()=>e),SA];Tu.hrefs=e=>"#"+e;const ws=768;function RA(){const[e,t]=d.useState(void 0);return d.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ws-1}px)`),r=()=>t(window.innerWidth<ws);return n.addEventListener("change",r),t(window.innerWidth<ws),()=>n.removeEventListener("change",r)},[]),!!e}const Nu=d.createContext(void 0);function _n(e){const t=d.useContext(Nu);if(!e&&t===void 0)throw new Error(ot(27));return t}(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=ko.startingStyle]="startingStyle",e[e.endingStyle=ko.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const DA={"data-popup-open":""},FA={"data-popup-open":"","data-pressed":""},BA={"data-open":""},jA={"data-closed":""},MA={"data-anchor-hidden":""},_u={open(e){return e?DA:null}},oi={open(e){return e?FA:null}},Wr={open(e){return e?BA:jA},anchorHidden(e){return e?MA:null}},Xi={...Wr,...Nn},qi=d.forwardRef(function(t,n){const{render:r,className:o,style:s,forceRender:i=!1,...a}=t,c=_n(),u=c.useState("open"),f=c.useState("nested"),h=c.useState("mounted"),g=c.useState("transitionStatus");return je("div",t,{state:{open:u,transitionStatus:g},ref:[c.context.backdropRef,n],stateAttributesMapping:Xi,props:[{role:"presentation",hidden:!h,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:i||!f})}),Qr=d.forwardRef(function(t,n){const{render:r,className:o,style:s,disabled:i=!1,nativeButton:a=!0,...c}=t,u=_n(),f=u.useState("open"),{getButtonProps:h,buttonRef:g}=Gt({disabled:i,native:a}),A={disabled:i};function p(m){f&&u.setOpen(!1,Ce(Tp,m.nativeEvent))}return je("button",t,{state:A,ref:[n,g],props:[{onClick:p},c,h]})}),ea=d.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,c=_n(),u=It(i);return c.useSyncedValueWithCleanup("descriptionElementId",u),je("p",t,{ref:n,props:[{id:u},a]})});function PA(e,t){return t!=null&&!mn(t)?0:typeof e=="function"?e():e}function er(e,t,n){const r=PA(e,n);return typeof r=="number"?r:r?.[t]}function ml(e){return typeof e=="function"?e():e}function Ou(e,t){return t||e==="click"||e==="mousedown"}function TA(e){return e?.includes("mouse")&&e!=="mousedown"}const NA=d.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Ot,currentIdRef:{current:null},currentContextRef:{current:null}});function _A(e,t){e.current=t.current}function OA(e,t={open:!1}){const{open:n}=t,r="rootStore"in e?e.rootStore:e,o=r.useState("floatingId"),s=d.useContext(NA),{currentIdRef:i,delayRef:a,timeoutMs:c,initialDelayRef:u,currentContextRef:f,hasProvider:h,timeout:g}=s,[A,p]=d.useState(!1),m=d.useRef(n);return ie(()=>{m.current=n},[n]),ie(()=>{function x(){f.current?.setIsInstantPhase(!1),i.current=null,f.current=null,a.current=u.current,g.clear()}if(i.current&&!n&&i.current===o){if(p(!1),c){const v=o;return g.start(c,()=>{r.select("open")||i.current&&i.current!==v||x()}),()=>{(m.current||i.current!==v)&&g.clear()}}x()}},[n,o,i,a,c,u,f,g,r]),ie(()=>{if(!n)return;const x=f.current,v=i.current;g.clear(),f.current={onOpenChange:r.setOpen,setIsInstantPhase:p},i.current=o,a.current={open:0,close:er(u.current,"close")},v!==null&&v!==o?(p(!0),x?.setIsInstantPhase(!0),x?.onOpenChange(!1,Ce(Mt))):(p(!1),x?.setIsInstantPhase(!1))},[n,o,r,i,a,u,f,g]),ie(()=>()=>{if(i.current===o){if(f.current=null,!m.current)return;i.current=null,_A(a,u),g.clear()}},[f,i,a,o,u,g]),d.useMemo(()=>({hasProvider:h,delayRef:a,isInstantPhase:A}),[h,a,A])}function De(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Wt(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function tt(e){const t=Dt(HA,e).current;return t.next=e,ie(t.effect),t}function HA(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const Hu={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},$o={...Hu,position:"fixed",top:0,left:0},ta={...Hu,position:"absolute"},tr=d.forwardRef(function(t,n){const[r,o]=d.useState();ie(()=>{Jh&&an&&o("button")},[]);const s={tabIndex:0,role:r};return l.jsx("span",{...t,ref:n,style:$o,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});function Fr(e){return`data-base-ui-${e}`}let Xr=0;function go(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:o}=t;cancelAnimationFrame(Xr);function s(){o&&!o()||e?.focus({preventScroll:n})}if(r)return s(),Er;const i=requestAnimationFrame(s);return Xr=i,()=>{Xr===i&&(cancelAnimationFrame(i),Xr=0)}}const ks={inert:new WeakMap,"aria-hidden":new WeakMap},xl="data-base-ui-inert",si={inert:new WeakSet,"aria-hidden":new WeakSet};let lr=new WeakMap,Es=0;function LA(e){return si[e]}function Lu(e){return e?Ei(e)?e.host:Lu(e.parentNode):null}const bl=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=Lu(n);return e.contains(r)?r:null}).filter(n=>n!=null),vl=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},yl=(e,t,n)=>{const r=[],o=s=>{!s||n.has(s)||Array.from(s.children).forEach(i=>{wt(i)!=="script"&&(t.has(i)?o(i):r.push(i))})};return o(e),r};function KA(e,t,n,r,{mark:o=!0}){let s=null;r?s="inert":n&&(s="aria-hidden");let i=null,a=null;const c=bl(t,e),u=o?yl(t,vl(c),new Set(c)):[],f=[],h=[];if(s){const g=ks[s],A=LA(s);a=A,i=g;const p=bl(t,Array.from(t.querySelectorAll("[aria-live]"))),m=c.concat(p);yl(t,vl(m),new Set(m)).forEach(v=>{const b=v.getAttribute(s),y=b!==null&&b!=="false",C=(g.get(v)||0)+1;g.set(v,C),f.push(v),C===1&&y&&A.add(v),y||v.setAttribute(s,s==="inert"?"":"true")})}return o&&u.forEach(g=>{const A=(lr.get(g)||0)+1;lr.set(g,A),h.push(g),A===1&&g.setAttribute(xl,"")}),Es+=1,()=>{i&&f.forEach(g=>{const p=(i.get(g)||0)-1;i.set(g,p),p||(!a?.has(g)&&s&&g.removeAttribute(s),a?.delete(g))}),o&&h.forEach(g=>{const A=(lr.get(g)||0)-1;lr.set(g,A),A||g.removeAttribute(xl)}),Es-=1,Es||(ks.inert=new WeakMap,ks["aria-hidden"]=new WeakMap,si.inert=new WeakSet,si["aria-hidden"]=new WeakSet,lr=new WeakMap)}}function Cl(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0}=t,s=Be(e[0]).body;return KA(e,s,n,r,{mark:o})}const WA=500,QA=500,GA={style:{transition:"none"}},YA="data-base-ui-click-trigger",Ku={fallbackAxisSide:"none"},Wu={fallbackAxisSide:"end"},zA={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Qu=d.createContext(null),Gu=()=>d.useContext(Qu),UA=Fr("portal");function Yu(e={}){const{ref:t,container:n,componentProps:r=ct,elementProps:o}=e,s=Jn(),a=Gu()?.portalNode,[c,u]=d.useState(null),[f,h]=d.useState(null),g=de(x=>{x!==null&&h(x)}),A=d.useRef(null);ie(()=>{if(n===null){A.current&&(A.current=null,h(null),u(null));return}const x=(n&&(Np(n)?n:n.current))??a??document.body;if(x==null){A.current&&(A.current=null,h(null),u(null));return}A.current!==x&&(A.current=x,h(null),u(x))},[n,a]);const p=je("div",r,{ref:[t,g],props:[{id:s,[UA]:""},o]}),m=c&&p?sn.createPortal(p,c):null;return{node:f,nodeId:d.isValidElement(p)?p.props.id:void 0,subtree:m}}const na=d.forwardRef(function(t,n){const{render:r,className:o,style:s,children:i,container:a,...c}=t,{node:u,nodeId:f,subtree:h}=Yu({container:a,ref:n,componentProps:t,elementProps:c}),g=d.useRef(null),A=d.useRef(null),p=d.useRef(null),m=d.useRef(null),[x,v]=d.useState(null),b=d.useRef(!1),y=x?.modal,C=x?.open,w=!!x&&!x.modal&&x.open&&!!u;d.useEffect(()=>{if(!u||y)return;function S(R){u&&R.relatedTarget&&zn(R)&&(R.type==="focusin"?b.current&&(pl(u),b.current=!1):(xA(u),b.current=!0))}return Wt(De(u,"focusin",S,!0),De(u,"focusout",S,!0))},[u,y]),ie(()=>{!u||C!==!0||!b.current||(pl(u),b.current=!1)},[C,u]);const I=d.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:A,beforeInsideRef:p,afterInsideRef:m,portalNode:u,setFocusManagerState:v}),[u]);return l.jsxs(d.Fragment,{children:[h,l.jsxs(Qu.Provider,{value:I,children:[w&&u&&l.jsx(tr,{"data-type":"outside",ref:g,onFocus:S=>{if(zn(S,u))p.current?.focus();else{const R=x?x.domReference:null;ju(R)?.focus()}}}),w&&u&&l.jsx("span",{"aria-owns":f,style:zA}),u&&sn.createPortal(i,u),w&&u&&l.jsx(tr,{"data-type":"outside",ref:A,onFocus:S=>{if(zn(S,u))m.current?.focus();else{const R=x?x.domReference:null;Zi(R)?.focus(),x?.closeOnFocusOut&&x?.onOpenChange(!1,Ce(Bn,S.nativeEvent))}}})]})]})});function zu(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(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 ra{nodesRef={current:[]};events=zu();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Uu=d.createContext(null),Vu=d.createContext(null),In=()=>d.useContext(Uu)?.id||null,wn=e=>{const t=d.useContext(Vu);return e??t};function Zu(e){const t=Jn(),n=wn(e),r=In();return ie(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function VA(e){const{children:t,id:n}=e,r=In();return l.jsx(Uu.Provider,{value:d.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function ZA(e){const{children:t,externalTree:n}=e,r=Dt(()=>n??new ra).current;return l.jsx(Vu.Provider,{value:r,children:t})}function JA(e,t){const n=rt(At(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 Il=20;let gn=[];function oa(){gn=gn.filter(e=>e.deref()?.isConnected)}function wl(e){oa(),e&&wt(e)!=="body"&&(gn.push(new WeakRef(e)),gn.length>Il&&(gn=gn.slice(-Il)))}function kl(){return oa(),gn[gn.length-1]?.deref()}function $A(e){return e?Vi(e)?e:Kr(e)[0]||e:null}function El(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=Fu(e).filter(o=>{const s=o.getAttribute("data-tabindex")||"";return Vi(o)||o.hasAttribute("data-tabindex")&&!s.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function sa(e){const{context:t,children:n,disabled:r=!1,initialFocus:o=!0,returnFocus:s=!0,restoreFocus:i=!1,modal:a=!0,closeOnFocusOut:c=!0,openInteractionType:u="",nextFocusableElement:f,previousFocusableElement:h,beforeContentFocusGuardRef:g,externalTree:A,getInsideElements:p}=e,m="rootStore"in t?t.rootStore:t,x=m.useState("open"),v=m.useState("domReferenceElement"),b=m.useState("floatingElement"),{events:y,dataRef:C}=m.context,w=de(()=>C.current.floatingContext?.nodeId),I=o===!1,S=ei(v)&&I,R=tt(o),E=tt(s),k=tt(u),F=tt(x),T=wn(A),N=Gu(),M=d.useRef(!1),D=d.useRef(!1),L=d.useRef(!1),_=d.useRef(null),j=d.useRef(""),H=d.useRef(""),P=d.useRef(null),B=d.useRef(null),O=Qt(P,g,N?.beforeInsideRef),G=Qt(B,N?.afterInsideRef),z=pt(),U=pt(),Q=qn(),Z=N!=null,K=yo(b),te=de((ee=K)=>ee?Kr(ee):[]),le=de(()=>p?.().filter(ee=>ee!=null)??[]);d.useEffect(()=>{if(r||!a)return;function ee(ce){ce.key==="Tab"&&ve(K,vt(Be(K)))&&te().length===0&&!S&&Ht(ce)}const J=Be(K);return De(J,"keydown",ee)},[r,K,a,S,te]),d.useEffect(()=>{if(r||!x)return;const ee=Be(K);function J(){L.current=!1}function ce(ge){const ae=At(ge),pe=le(),oe=ve(b,ae)||ve(v,ae)||ve(N?.portalNode,ae)||pe.some(re=>re===ae||ve(re,ae));L.current=!oe,H.current=ge.pointerType||"keyboard",ae?.closest(`[${YA}]`)&&(D.current=!0,U.start(0,()=>{D.current=!1}))}function ue(){H.current="keyboard"}return Wt(De(ee,"pointerdown",ce,!0),De(ee,"pointerup",J,!0),De(ee,"pointercancel",J,!0),De(ee,"keydown",ue,!0),J)},[r,b,v,K,x,N,U,le]),d.useEffect(()=>{if(r||!c)return;const ee=Be(K);function J(){D.current=!0,U.start(0,()=>{D.current=!1})}function ce(pe){const oe=At(pe);Vi(oe)&&(_.current=oe)}function ue(pe){const oe=pe.relatedTarget,re=pe.currentTarget,se=At(pe);a&&oe==null&&se!=null&&ve(b,se)&&wl(se),queueMicrotask(()=>{const he=w(),me=m.context.triggerElements,W=le(),Y=oe?.hasAttribute(Fr("focus-guard"))&&[P.current,B.current,N?.beforeInsideRef.current,N?.afterInsideRef.current,N?.beforeOutsideRef.current,N?.afterOutsideRef.current,Xt(h),Xt(f)].includes(oe),ye=!(ve(v,oe)||ve(b,oe)||ve(oe,b)||ve(N?.portalNode,oe)||W.some(q=>q===oe||ve(q,oe))||me.hasMatchingElement(q=>ve(q,oe))||Y||T&&(xn(T.nodesRef.current,he).find(q=>ve(q.context?.elements.floating,oe)||ve(q.context?.elements.domReference,oe))||ul(T.nodesRef.current,he).find(q=>[q.context?.elements.floating,yo(q.context?.elements.floating)].includes(oe)||q.context?.elements.domReference===oe)));if(re===v&&K&&El(K),i&&re!==v&&!Zo(se)&&vt(ee)===ee.body){if(Xe(K)&&(K.focus(),i==="popup")){Q.request(()=>{K.focus()});return}const q=te(),ne=_.current,Ee=(ne&&q.includes(ne)?ne:null)||q[q.length-1]||K;Xe(Ee)&&Ee.focus()}if(C.current.insideReactTree){C.current.insideReactTree=!1;return}(S||!a)&&oe&&ye&&!D.current&&(S||oe!==kl())&&(M.current=!0,m.setOpen(!1,Ce(Bn,pe)))})}function ge(){L.current||(C.current.insideReactTree=!0,z.start(0,()=>{C.current.insideReactTree=!1}))}const ae=Xe(v)?v:null;if(!(!b&&!ae))return Wt(ae&&De(ae,"focusout",ue),ae&&De(ae,"pointerdown",J),b&&De(b,"focusin",ce),b&&De(b,"focusout",ue),b&&N&&De(b,"focusout",ge,!0))},[r,v,b,K,a,T,N,m,c,i,te,S,w,C,z,U,Q,f,h,le]),d.useEffect(()=>{if(r||!b||!x)return;const ee=Array.from(N?.portalNode?.querySelectorAll(`[${Fr("portal")}]`)||[]),ce=(T?ul(T.nodesRef.current,w()):[]).find(re=>ei(re.context?.elements.domReference||null))?.context?.elements.domReference,ge=[...[b,...ee,P.current,B.current,N?.beforeOutsideRef.current,N?.afterOutsideRef.current,...le()],ce,Xt(h),Xt(f),S?v:null].filter(re=>re!=null),ae=Cl(ge,{ariaHidden:a||S,mark:!1}),pe=[b,...ee].filter(re=>re!=null),oe=Cl(pe);return()=>{oe(),ae()}},[x,r,v,b,a,N,S,T,w,f,h,le]),ie(()=>{if(!x||r||!Xe(K))return;j.current="",H.current="";const ee=Be(K),J=vt(ee);queueMicrotask(()=>{const ce=R.current,ue=typeof ce=="function"?ce(k.current||""):ce;if(ue===void 0||ue===!1||ve(K,J))return;let ae=null;const pe=()=>(ae==null&&(ae=te(K)),ae[0]||K);let oe;ue===!0||ue===null?oe=pe():oe=Xt(ue),oe=oe||pe();const re=ve(K,vt(ee));go(oe,{preventScroll:oe===K,shouldFocus(){if(!F.current)return!1;if(re)return!0;const se=vt(ee);return!(se!==oe&&ve(K,se))}})})},[r,x,K,te,R,k,F]),ie(()=>{if(r||!K)return;const ee=Be(K),J=vt(ee),ce=k.current==null;wl(J);function ue(ae){if(ae.open||(j.current=JA(ae.nativeEvent,H.current)),ae.reason===at&&ae.nativeEvent.type==="mouseleave"&&(M.current=!0),ae.reason===Lo)if(ae.nested)M.current=!1;else if(Qi(ae.nativeEvent)||Gi(ae.nativeEvent))M.current=!1;else{let pe=!1;Be(K).createElement("div").focus({get preventScroll(){return pe=!0,!1}}),pe?M.current=!1:M.current=!0}}y.on("openchange",ue);function ge(ae){const pe=E.current;let oe=typeof pe=="function"?pe(ae):pe;if(oe===void 0||oe===!1)return null;oe===null&&(oe=!0);const re=v?.isConnected?v:null,se=J?.isConnected&&wt(J)!=="body"?J:null;let he=ce?se||re:re||se;return he||(he=kl()||null),typeof oe=="boolean"?he:Xt(oe)||he||null}return()=>{y.off("openchange",ue);const ae=vt(ee),pe=le(),oe=ve(b,ae)||pe.some(me=>me===ae||ve(me,ae))||T&&xn(T.nodesRef.current,w(),!1).some(me=>ve(me.context?.elements.floating,ae)),re=E.current,se=j.current,he=ge(se);queueMicrotask(()=>{const me=$A(he),W=typeof re!="boolean";if(re&&!M.current&&Xe(me)&&(!(!W&&me!==ae&&ae!==ee.body)||oe)){const Y={preventScroll:!0};se==="keyboard"&&(Y.focusVisible=!0),me.focus(Y)}M.current=!1})}},[r,b,K,E,k,y,T,v,w,le]),ie(()=>{if(!an||x||!b)return;const ee=vt(Be(b));!Xe(ee)||!Vo(ee)||ve(b,ee)&&ee.blur()},[x,b]),ie(()=>{if(!(r||!N))return N.setFocusManagerState({modal:a,closeOnFocusOut:c,open:x,onOpenChange:m.setOpen,domReference:v}),()=>{N.setFocusManagerState(null)}},[r,N,a,x,m,c,v]),ie(()=>{if(!(r||!K))return El(K),()=>{queueMicrotask(oa)}},[r,K]);const X=!r&&(a?!S:!0)&&(Z||a);return l.jsxs(d.Fragment,{children:[X&&l.jsx(tr,{"data-type":"inside",ref:O,onFocus:ee=>{if(a){const J=te();go(J[J.length-1])}else N?.portalNode&&(M.current=!1,zn(ee,N.portalNode)?Zi(v)?.focus():Xt(h??N.beforeOutsideRef)?.focus())}}),n,X&&l.jsx(tr,{"data-type":"inside",ref:G,onFocus:ee=>{a?go(te()[0]):N?.portalNode&&(c&&(M.current=!0),zn(ee,N.portalNode)?ju(v)?.focus():Xt(f??N.afterOutsideRef)?.focus())}})]})}function Ju(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:a=0,reason:c=Pn}=t,u="rootStore"in e?e.rootStore:e,f=u.context.dataRef,h=d.useRef(void 0),g=qn(),A=pt(),p=d.useMemo(()=>{function m(v,b,y,C){const w=Ce(c,b,y);v&&C==="touch"&&a>0?A.start(a,()=>{u.setOpen(!0,w)}):u.setOpen(v,w)}function x(v,b,y){const C=f.current.openEvent,w=u.select("domReferenceElement")!==b;return v&&w||!v||!o?!0:C&&i?!y(C.type):!1}return{onPointerDown(v){h.current=mn(v.pointerType,!0)&&Gi(v.nativeEvent)?"virtual":v.pointerType},onMouseDown(v){const b=h.current,y=v.nativeEvent,C=u.select("open");if(v.button!==0||r==="click"||mn(b,!0)&&s)return;const w=x(C,v.currentTarget,R=>R==="click"||R==="mousedown"),I=At(y);if(Vo(I)){m(w,y,I,b);return}const S=v.currentTarget;g.request(()=>{m(w,y,S,b)})},onClick(v){if(r==="mousedown-only")return;const b=h.current;if(r==="mousedown"&&b){h.current=void 0;return}if(mn(b,!0)&&s)return;const y=u.select("open"),C=x(y,v.currentTarget,w=>w==="click"||w==="mousedown"||w==="keydown"||w==="keyup");m(C,v.nativeEvent,v.currentTarget,b)},onKeyDown(){h.current=void 0}}},[f,r,s,c,u,i,o,g,A,a]);return d.useMemo(()=>n?{reference:p}:ct,[n,p])}function XA(e,t){let n=null,r=null,o=!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,f=s.height,h=s.x,g=s.y;return n==null&&t.x&&i&&(n=s.x-t.x),r==null&&t.y&&a&&(r=s.y-t.y),h-=n||0,g-=r||0,u=0,f=0,!o||c?(u=t.axis==="y"?s.width:0,f=t.axis==="x"?s.height:0,h=i&&t.x!=null?t.x:h,g=a&&t.y!=null?t.y:g):o&&!c&&(f=t.axis==="x"?s.height:f,u=t.axis==="y"?s.width:u),o=!0,{width:u,height:f,x:h,y:g,top:g,right:h+u,bottom:g+f,left:h}}}}function Sl(e){return e!=null&&e.clientX!=null}function qA(e,t={}){const{enabled:n=!0,axis:r="both"}=t,o="rootStore"in e?e.rootStore:e,s=o.useState("open"),i=o.useState("floatingElement"),a=o.useState("domReferenceElement"),c=o.context.dataRef,u=d.useRef(!1),f=d.useRef(null),[h,g]=d.useState(),[A,p]=d.useState([]),m=de(C=>{o.set("positionReference",C)}),x=de((C,w,I)=>{u.current||c.current.openEvent&&!Sl(c.current.openEvent)||o.set("positionReference",XA(I??a,{x:C,y:w,axis:r,dataRef:c,pointerType:h}))}),v=de(C=>{s?f.current||(x(C.clientX,C.clientY,C.currentTarget),p([])):x(C.clientX,C.clientY,C.currentTarget)}),b=mn(h)?i:s;d.useEffect(()=>{if(!n){m(a);return}if(!b)return;function C(){f.current?.(),f.current=null}const w=rt(i);function I(S){const R=At(S);ve(i,R)?C():x(S.clientX,S.clientY)}return!c.current.openEvent||Sl(c.current.openEvent)?f.current=De(w,"mousemove",I):m(a),C},[b,n,i,c,a,o,x,m,A]),d.useEffect(()=>()=>{o.set("positionReference",null)},[o]),d.useEffect(()=>{n&&!i&&(u.current=!1)},[n,i]),d.useEffect(()=>{!n&&s&&(u.current=!0)},[n,s]);const y=d.useMemo(()=>{function C(w){g(w.pointerType)}return{onPointerDown:C,onPointerEnter:C,onMouseMove:v,onMouseEnter:v}},[v]);return d.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function eg(){return!1}function tg(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Xo(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:o=!0,outsidePressEvent:s="sloppy",referencePress:i=eg,bubbles:a,externalTree:c}=t,u="rootStore"in e?e.rootStore:e,f=u.useState("open"),h=u.useState("floatingElement"),{dataRef:g}=u.context,A=wn(c),p=de(typeof o=="function"?o:()=>!1),m=typeof o=="function"?p:o,x=m!==!1,v=de(()=>s),{escapeKey:b,outsidePress:y}=tg(a),C=d.useRef(!1),w=d.useRef(!1),I=d.useRef(!1),S=d.useRef(!1),R=d.useRef(""),E=d.useRef(null),k=pt(),F=pt(),T=de(()=>{F.clear(),g.current.insideReactTree=!1}),N=de(O=>{const G=g.current.floatingContext?.nodeId;return(A?xn(A.nodesRef.current,G):[]).some(U=>U.context?.open&&!U.context.dataRef.current[O])}),M=de(O=>vs(O,u.select("floatingElement"))||vs(O,u.select("domReferenceElement"))),D=de(O=>{i()&&u.setOpen(!1,Ce(Pn,O.nativeEvent))}),L=de(O=>{if(!f||!n||!r||O.key!=="Escape"||S.current||!b&&N("__escapeKeyBubbles"))return;const G=eA(O)?O.nativeEvent:O,z=Ce(Ko,G);u.setOpen(!1,z),z.isCanceled||O.preventDefault(),!b&&!z.isPropagationAllowed&&O.stopPropagation()}),_=de(()=>{g.current.insideReactTree=!0,F.start(0,T)}),j=de(O=>{if(!f||!n||O.button!==0)return;const G=At(O.nativeEvent);ve(u.select("floatingElement"),G)&&(C.current||(C.current=!0,w.current=!1))}),H=de(O=>{!f||!n||(O.defaultPrevented||O.nativeEvent.defaultPrevented)&&C.current&&(w.current=!0)});d.useEffect(()=>{if(!f||!n)return T;g.current.__escapeKeyBubbles=b,g.current.__outsidePressBubbles=y;const O=new Ot,G=new Ot;function z(){O.clear(),S.current=!0}function U(){O.start(an?5:0,()=>{S.current=!1})}function Q(){I.current=!0,G.start(0,()=>{I.current=!1})}function Z(){C.current=!1,w.current=!1}function K(){const W=R.current,Y=W==="pen"||!W?"mouse":W,ye=v(),q=typeof ye=="function"?ye():ye;return typeof q=="string"?q:q[Y]}function te(W){const Y=K();return Y==="intentional"&&W.type!=="click"||Y==="sloppy"&&W.type==="click"}function le(W){const Y=g.current.floatingContext?.nodeId,ye=A&&xn(A.nodesRef.current,Y).some(q=>vs(W,q.context?.elements.floating));return M(W)||ye}function X(W){if(te(W)){W.type!=="click"&&!M(W)&&(G.clear(),I.current=!1),T();return}if(g.current.insideReactTree){T();return}const Y=At(W),ye=`[${Fr("inert")}]`,q=Pe(Y)?Y.getRootNode():null,ne=Array.from((Ei(q)?q:Be(u.select("floatingElement"))).querySelectorAll(ye)),Ee=u.context.triggerElements;if(Y&&(Ee.hasElement(Y)||Ee.hasMatchingElement(Le=>ve(Le,Y))))return;let Se=Pe(Y)?Y:null;for(;Se&&!Dn(Se);){const Le=$n(Se);if(Dn(Le)||!Pe(Le))break;Se=Le}if(!(ne.length&&Pe(Y)&&!$h(Y)&&!ve(Y,u.select("floatingElement"))&&ne.every(Le=>!ve(Se,Le)))){if(Xe(Y)&&!("touches"in W)){const Le=Dn(Y),Je=_t(Y),We=/auto|scroll/,ut=Le||We.test(Je.overflowX),$e=Le||We.test(Je.overflowY),Ye=ut&&Y.clientWidth>0&&Y.scrollWidth>Y.clientWidth,mt=$e&&Y.clientHeight>0&&Y.scrollHeight>Y.clientHeight,Ie=Je.direction==="rtl",ze=mt&&(Ie?W.offsetX<=Y.offsetWidth-Y.clientWidth:W.offsetX>Y.clientWidth),Ne=Ye&&W.offsetY>Y.clientHeight;if(ze||Ne)return}if(!le(W)){if(K()==="intentional"&&I.current){G.clear(),I.current=!1;return}typeof m=="function"&&!m(W)||N("__outsidePressBubbles")||(u.setOpen(!1,Ce(Lo,W)),T())}}}function ee(W){K()!=="sloppy"||W.pointerType==="touch"||!u.select("open")||!n||M(W)||X(W)}function J(W){if(K()!=="sloppy"||!u.select("open")||!n||M(W))return;const Y=W.touches[0];Y&&(E.current={startTime:Date.now(),startX:Y.clientX,startY:Y.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},k.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function ce(W,Y){const ye=At(W);if(!ye)return;const q=De(ye,W.type,()=>{Y(W),q()})}function ue(W){R.current="touch",ce(W,J)}function ge(W){k.clear(),W.type==="pointerdown"&&(R.current=W.pointerType),!(W.type==="mousedown"&&E.current&&!E.current.dismissOnMouseDown)&&ce(W,Y=>{Y.type==="pointerdown"?ee(Y):X(Y)})}function ae(W){if(!C.current)return;const Y=w.current;if(Z(),K()==="intentional"){if(W.type==="pointercancel"){Y&&Q();return}if(!le(W)){if(Y){Q();return}typeof m=="function"&&!m(W)||(G.clear(),I.current=!0,T())}}}function pe(W){if(K()!=="sloppy"||!E.current||M(W))return;const Y=W.touches[0];if(!Y)return;const ye=Math.abs(Y.clientX-E.current.startX),q=Math.abs(Y.clientY-E.current.startY),ne=Math.sqrt(ye*ye+q*q);ne>5&&(E.current.dismissOnTouchEnd=!0),ne>10&&(X(W),k.clear(),E.current=null)}function oe(W){ce(W,pe)}function re(W){K()!=="sloppy"||!E.current||M(W)||(E.current.dismissOnTouchEnd&&X(W),k.clear(),E.current=null)}function se(W){ce(W,re)}const he=Be(h),me=Wt(r&&Wt(De(he,"keydown",L),De(he,"compositionstart",z),De(he,"compositionend",U)),x&&Wt(De(he,"click",ge,!0),De(he,"pointerdown",ge,!0),De(he,"pointerup",ae,!0),De(he,"pointercancel",ae,!0),De(he,"mousedown",ge,!0),De(he,"mouseup",ae,!0),De(he,"touchstart",ue,!0),De(he,"touchmove",oe,!0),De(he,"touchend",se,!0)));return()=>{me(),O.clear(),G.clear(),Z(),I.current=!1,T()}},[g,h,r,x,m,f,n,b,y,L,T,v,N,M,A,u,k]);const P=d.useMemo(()=>({onKeyDown:L,onPointerDown:D,onClick:D}),[L,D]),B=d.useMemo(()=>({onKeyDown:L,onPointerDown:H,onMouseDown:H,onClickCapture:_,onMouseDownCapture(O){_(),j(O)},onPointerDownCapture(O){_(),j(O)},onMouseUpCapture:_,onTouchEndCapture:_,onTouchMoveCapture:_}),[L,_,j,H]);return d.useMemo(()=>n?{reference:P,floating:B,trigger:P}:{},[n,P,B])}function Rl(e,t,n){let{reference:r,floating:o}=e;const s=Ft(t),i=Ui(t),a=zi(i),c=jt(t),u=s==="y",f=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,g=r[a]/2-o[a]/2;let A;switch(c){case"top":A={x:f,y:r.y-o.height};break;case"bottom":A={x:f,y:r.y+r.height};break;case"right":A={x:r.x+r.width,y:h};break;case"left":A={x:r.x-o.width,y:h};break;default:A={x:r.x,y:r.y}}const p=Cn(t);return p&&(A[i]+=g*(p==="end"?1:-1)*(n&&u?-1:1)),A}async function ng(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:g=!1,padding:A=0}=bn(t,e),p=Iu(A),x=a[g?h==="floating"?"reference":"floating":h],v=Dr(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:f,strategy:c})),b=h==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),C=await(s.isElement==null?void 0:s.isElement(y))&&await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1},w=Dr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:y,strategy:c}):b);return{top:(v.top-w.top+p.top)/C.y,bottom:(w.bottom-v.bottom+p.bottom)/C.y,left:(v.left-w.left+p.left)/C.x,right:(w.right-v.right+p.right)/C.x}}const rg=50,og=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:ng},c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:h}=Rl(u,r,c),g=r,A=0;const p={};for(let m=0;m<s.length;m++){const x=s[m];if(!x)continue;const{name:v,fn:b}=x,{x:y,y:C,data:w,reset:I}=await b({x:f,y:h,initialPlacement:r,placement:g,strategy:o,middlewareData:p,rects:u,platform:a,elements:{reference:e,floating:t}});f=y??f,h=C??h,p[v]={...p[v],...w},I&&A<rg&&(A++,typeof I=="object"&&(I.placement&&(g=I.placement),I.rects&&(u=I.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):I.rects),{x:f,y:h}=Rl(u,g,c)),m=-1)}return{x:f,y:h,placement:g,strategy:o,middlewareData:p}},sg=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:A="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...x}=bn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=jt(o),b=Ft(a),y=jt(a)===a,C=await(c.isRTL==null?void 0:c.isRTL(u.floating)),w=g||(y||!m?[Io(a)]:oA(a)),I=p!=="none";!g&&I&&w.push(...lA(a,m,p,C));const S=[a,...w],R=await c.detectOverflow(t,x),E=[];let k=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&E.push(R[v]),h){const M=rA(o,i,C);E.push(R[M[0]],R[M[1]])}if(k=[...k,{placement:o,overflows:E}],!E.every(M=>M<=0)){var F,T;const M=(((F=s.flip)==null?void 0:F.index)||0)+1,D=S[M];if(D&&(!(h==="alignment"?b!==Ft(D):!1)||k.every(j=>Ft(j.placement)===b?j.overflows[0]>0:!0)))return{data:{index:M,overflows:k},reset:{placement:D}};let L=(T=k.filter(_=>_.overflows[0]<=0).sort((_,j)=>_.overflows[1]-j.overflows[1])[0])==null?void 0:T.placement;if(!L)switch(A){case"bestFit":{var N;const _=(N=k.filter(j=>{if(I){const H=Ft(j.placement);return H===b||H==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(H=>H>0).reduce((H,P)=>H+P,0)]).sort((j,H)=>j[1]-H[1])[0])==null?void 0:N[0];_&&(L=_);break}case"initialPlacement":L=a;break}if(o!==L)return{reset:{placement:L}}}return{}}}},$u=new Set(["left","top"]);async function ig(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=jt(n),a=Cn(n),c=Ft(n)==="y",u=$u.has(i)?-1:1,f=s&&c?-1:1,h=bn(t,e);let{mainAxis:g,crossAxis:A,alignmentAxis:p}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof p=="number"&&(A=a==="end"?p*-1:p),c?{x:A*f,y:g*u}:{x:g*u,y:A*f}}const ag=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,c=await ig(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},lg=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:b=>{let{x:y,y:C}=b;return{x:y,y:C}}},...u}=bn(e,t),f={x:n,y:r},h=await s.detectOverflow(t,u),g=Ft(o),A=Yi(g);let p=f[A],m=f[g];const x=(b,y)=>Cu(y+h[b==="y"?"top":"left"],y,y-h[b==="y"?"bottom":"right"]);i&&(p=x(A,p)),a&&(m=x(g,m));const v=c.fn({...t,[A]:p,[g]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[A]:i,[g]:a}}}}}},cg=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:s,placement:i,rects:a,middlewareData:c}=t,{offset:u=0,mainAxis:f=!0,crossAxis:h=!0}=bn(e,t),g={x:o,y:s},A=Ft(i),p=Yi(A);let m=g[p],x=g[A];const v=bn(u,t),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:(n=v.mainAxis)!=null?n:0,crossAxis:(r=v.crossAxis)!=null?r:0};if(f){const w=p==="y"?"height":"width",I=a.reference[p]-a.floating[w]+b.mainAxis,S=a.reference[p]+a.reference[w]-b.mainAxis;m<I?m=I:m>S&&(m=S)}if(h){var y,C;const w=p==="y"?"width":"height",I=$u.has(jt(i)),S=a.reference[A]-a.floating[w]+(I&&((y=c.offset)==null?void 0:y[A])||0)+(I?0:b.crossAxis),R=a.reference[A]+a.reference[w]+(I?0:((C=c.offset)==null?void 0:C[A])||0)-(I?b.crossAxis:0);x<S?x=S:x>R&&(x=R)}return{[p]:m,[A]:x}}}},ug=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...a}=bn(e,t),c=await o.detectOverflow(t,a),u=jt(n),f=Cn(n),h=Ft(n)==="y",{width:g,height:A}=r.floating;let p,m;u==="top"||u==="bottom"?(p=u,m=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(m=u,p=f==="end"?"top":"bottom");const x=A-c.top-c.bottom,v=g-c.left-c.right,b=Xn(A-c[p],x),y=Xn(g-c[m],v),C=t.middlewareData.shift,w=!C;let I=b,S=y;C!=null&&C.enabled.x&&(S=v),C!=null&&C.enabled.y&&(I=x),w&&!f&&(h?S=g-2*nn(c.left,c.right):I=A-2*nn(c.top,c.bottom)),await i({...t,availableWidth:S,availableHeight:I});const R=await o.getDimensions(s.floating);return g!==R.width||A!==R.height?{reset:{rects:!0}}:{}}}};function Xu(e){const t=_t(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Xe(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Co(n)!==s||Co(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function ia(e){return Pe(e)?e:e.contextElement}function Un(e){const t=ia(e);if(!Xe(t))return rn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Xu(t);let i=(s?Co(n.width):n.width)/r,a=(s?Co(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const dg=rn(0);function qu(e){const t=rt(e);return!du()||!t.visualViewport?dg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function fg(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===rt(e)}function jn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ia(e);let i=rn(1);t&&(r?Pe(r)&&(i=Un(r)):i=Un(e));const a=fg(s,n,r)?qu(s):rn(0);let c=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,f=o.width/i.x,h=o.height/i.y;if(s&&r){const g=rt(s),A=Pe(r)?rt(r):r;let p=g,m=sl(p);for(;m&&A!==p;){const x=Un(m),v=m.getBoundingClientRect(),b=_t(m),y=v.left+(m.clientLeft+parseFloat(b.paddingLeft))*x.x,C=v.top+(m.clientTop+parseFloat(b.paddingTop))*x.y;c*=x.x,u*=x.y,f*=x.x,h*=x.y,c+=y,u+=C,p=rt(m),m=sl(p)}}return Dr({width:f,height:h,x:c,y:u})}function qo(e,t){const n=Wo(e).scrollLeft;return t?t.left+n:jn(yn(e)).left+n}function ed(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-qo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function pg(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=yn(r),a=t?Si(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=rn(1);const f=rn(0),h=Xe(r);if((h||!s)&&((wt(r)!=="body"||Ri(i))&&(c=Wo(r)),h)){const A=jn(r);u=Un(r),f.x=A.x+r.clientLeft,f.y=A.y+r.clientTop}const g=i&&!h&&!s?ed(i,c):rn(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x+g.x,y:n.y*u.y-c.scrollTop*u.y+f.y+g.y}}function hg(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ag(e){const t=Wo(e),n=e.ownerDocument.body,r=nn(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=nn(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+qo(e);const i=-t.scrollTop;return _t(n).direction==="rtl"&&(s+=nn(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:s,y:i}}const gg=25;function mg(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=rt(e),s=yn(e),i=o.visualViewport;let a=s.clientWidth,c=s.clientHeight,u=0,f=0;if(i){const g=!du()||t==="fixed";r?g||(u=-i.offsetLeft,f=-i.offsetTop):(a=i.width,c=i.height,g&&(u=i.offsetLeft,f=i.offsetTop))}if(qo(s)<=0){const g=s.ownerDocument,A=g.body,p=getComputedStyle(A),m=g.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,x=Math.abs(s.clientWidth-A.clientWidth-m),v=getComputedStyle(s).scrollbarGutter==="stable both-edges"?x/2:x;v<=gg&&(a-=v)}return{width:a,height:c,x:u,y:f}}function xg(e,t){const n=jn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Un(e),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:a,x:c,y:u}}function Dl(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=mg(e,n,t);else if(t==="document")r=Ag(yn(e));else if(Pe(t))r=xg(t,n);else{const o=qu(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Dr(r)}function bg(e,t){const n=t.get(e);if(n)return n;let r=Zs(e,[],!1).filter(a=>Pe(a)&&wt(a)!=="body"),o=null;const s=_t(e).position==="fixed";let i=s?$n(e):e;for(;Pe(i)&&!Dn(i);){const a=_t(i),c=uu(i),u=o?o.position:s?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&a.position==="static")?r=r.filter(h=>h!==i):o=a,i=$n(i)}return t.set(e,r),r}function vg(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Si(t)?[]:bg(t,this._c):[].concat(n),r],a=Dl(t,i[0],o);let c=a.top,u=a.right,f=a.bottom,h=a.left;for(let g=1;g<i.length;g++){const A=Dl(t,i[g],o);c=nn(A.top,c),u=Xn(A.right,u),f=Xn(A.bottom,f),h=nn(A.left,h)}return{width:u-h,height:f-c,x:h,y:c}}function yg(e){const{width:t,height:n}=Xu(e);return{width:t,height:n}}function Cg(e,t,n){const r=Xe(t),o=yn(t),s=n==="fixed",i=jn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=rn(0);if((r||!s)&&((wt(t)!=="body"||Ri(o))&&(a=Wo(t)),r)){const g=jn(t,!0,s,t);c.x=g.x+t.clientLeft,c.y=g.y+t.clientTop}!r&&o&&(c.x=qo(o));const u=o&&!r&&!s?ed(o,a):rn(0),f=i.left+a.scrollLeft-c.x-u.x,h=i.top+a.scrollTop-c.y-u.y;return{x:f,y:h,width:i.width,height:i.height}}function Ss(e){return _t(e).position==="static"}function Fl(e,t){if(!Xe(e)||_t(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return yn(e)===n&&(n=n.ownerDocument.body),n}function td(e,t){const n=rt(e);if(Si(e))return n;if(!Xe(e)){let o=$n(e);for(;o&&!Dn(o);){if(Pe(o)&&!Ss(o))return o;o=$n(o)}return n}let r=Fl(e,t);for(;r&&_p(r)&&Ss(r);)r=Fl(r,t);return r&&Dn(r)&&Ss(r)&&!uu(r)?n:r||Op(e)||n}const Ig=async function(e){const t=this.getOffsetParent||td,n=this.getDimensions,r=await n(e.floating);return{reference:Cg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wg(e){return _t(e).direction==="rtl"}const nd={convertOffsetParentRelativeRectToViewportRelativeRect:pg,getDocumentElement:yn,getClippingRect:vg,getOffsetParent:td,getElementRects:Ig,getClientRects:hg,getDimensions:yg,getScale:Un,isElement:Pe,isRTL:wg};function rd(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function kg(e,t,n){let r=null,o;const s=yn(e);function i(){var f;clearTimeout(o),(f=r)==null||f.disconnect(),r=null}function a(f,h){f===void 0&&(f=!1),h===void 0&&(h=1),i();const g=e.getBoundingClientRect(),{left:A,top:p,width:m,height:x}=g;if(f||t(),!m||!x)return;const v=Zr(p),b=Zr(s.clientWidth-(A+m)),y=Zr(s.clientHeight-(p+x)),C=Zr(A),I={rootMargin:-v+"px "+-b+"px "+-y+"px "+-C+"px",threshold:nn(0,Xn(1,h))||1};let S=!0;function R(E){const k=E[0].intersectionRatio;if(!rd(g,e.getBoundingClientRect()))return a();if(k!==h){if(!S)return a();k?a(!1,k):o=setTimeout(()=>{a(!1,1e-7)},1e3)}S=!1}try{r=new IntersectionObserver(R,{...I,root:s.ownerDocument})}catch{r=new IntersectionObserver(R,I)}r.observe(e)}const c=rt(e),u=()=>a(n);return c.addEventListener("resize",u),a(!0),()=>{c.removeEventListener("resize",u),i()}}function Bl(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=ia(e),f=o||s?[...u?Zs(u):[],...t?Zs(t):[]]:[];f.forEach(v=>{o&&v.addEventListener("scroll",n),s&&v.addEventListener("resize",n)});const h=u&&a?kg(u,n,s):null;let g=-1,A=null;i&&(A=new ResizeObserver(v=>{let[b]=v;b&&b.target===u&&A&&t&&(A.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var y;(y=A)==null||y.observe(t)})),n()}),u&&!c&&A.observe(u),t&&A.observe(t));let p,m=c?jn(e):null;c&&x();function x(){const v=jn(e);m&&!rd(m,v)&&n(),m=v,p=requestAnimationFrame(x)}return n(),()=>{var v;f.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),h?.(),(v=A)==null||v.disconnect(),A=null,c&&cancelAnimationFrame(p)}}const Eg=ag,Sg=lg,Rg=sg,Dg=ug,Fg=cg,Bg=(e,t,n)=>{const r=new Map,o=n??{},s={...nd,...o.platform,_c:r};return og(e,t,{...o,platform:s})};var jg=typeof document<"u",Mg=function(){},mo=jg?d.useLayoutEffect:Mg;function Eo(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Eo(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Eo(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function od(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function jl(e,t){const n=od(e);return Math.round(t*n)/n}function Rs(e){const t=d.useRef(e);return mo(()=>{t.current=e}),t}function Pg(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[f,h]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,A]=d.useState(r);Eo(g,r)||A(r);const[p,m]=d.useState(null),[x,v]=d.useState(null),b=d.useCallback(j=>{j!==I.current&&(I.current=j,m(j))},[]),y=d.useCallback(j=>{j!==S.current&&(S.current=j,v(j))},[]),C=s||p,w=i||x,I=d.useRef(null),S=d.useRef(null),R=d.useRef(f),E=c!=null,k=Rs(c),F=Rs(o),T=Rs(u),N=d.useCallback(()=>{if(!I.current||!S.current)return;const j={placement:t,strategy:n,middleware:g};F.current&&(j.platform=F.current),Bg(I.current,S.current,j).then(H=>{const P={...H,isPositioned:T.current!==!1};M.current&&!Eo(R.current,P)&&(R.current=P,sn.flushSync(()=>{h(P)}))})},[g,t,n,F,T]);mo(()=>{u===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,h(j=>({...j,isPositioned:!1})))},[u]);const M=d.useRef(!1);mo(()=>(M.current=!0,()=>{M.current=!1}),[]),mo(()=>{if(C&&(I.current=C),w&&(S.current=w),C&&w){if(k.current)return k.current(C,w,N);N()}},[C,w,N,k,E]);const D=d.useMemo(()=>({reference:I,floating:S,setReference:b,setFloating:y}),[b,y]),L=d.useMemo(()=>({reference:C,floating:w}),[C,w]),_=d.useMemo(()=>{const j={position:n,left:0,top:0};if(!L.floating)return j;const H=jl(L.floating,f.x),P=jl(L.floating,f.y);return a?{...j,transform:"translate("+H+"px, "+P+"px)",...od(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:P}},[n,a,L.floating,f.x,f.y]);return d.useMemo(()=>({...f,update:N,refs:D,elements:L,floatingStyles:_}),[f,N,D,L,_])}const Tg=(e,t)=>{const n=Eg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ng=(e,t)=>{const n=Sg(e);return{name:n.name,fn:n.fn,options:[e,t]}},_g=(e,t)=>({fn:Fg(e).fn,options:[e,t]}),Og=(e,t)=>{const n=Rg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hg=(e,t)=>{const n=Dg(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Ds={exports:{}},Fs={};var Ml;function Lg(){if(Ml)return Fs;Ml=1;var e=lu(),t=Pu();function n(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Fs.useSyncExternalStoreWithSelector=function(u,f,h,g,A){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function v(I){if(!b){if(b=!0,y=I,I=g(I),A!==void 0&&m.hasValue){var S=m.value;if(A(S,I))return C=S}return C=I}if(S=C,r(y,I))return S;var R=g(I);return A!==void 0&&A(S,R)?(y=I,S):(y=I,C=R)}var b=!1,y,C,w=h===void 0?null:h;return[function(){return v(f())},w===null?void 0:function(){return v(w())}]},[f,h,g,A]);var x=o(u,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=x},[x]),c(x),x},Fs}var Pl;function Kg(){return Pl||(Pl=1,Ds.exports=Lg()),Ds.exports}var Wg=Kg();const ii=[];let ai;function Qg(){return ai}function Gg(e){ii.push(e)}function aa(e){const t=(n,r)=>{const o=Dt(Yg).current;let s;try{ai=o;for(const i of ii)i.before(o);s=e(n,r);for(const i of ii)i.after(o);o.didInitialize=!0}finally{ai=void 0}return s};return t.displayName=e.displayName||e.name,t}function sd(e){return d.forwardRef(aa(e))}function Yg(){return{didInitialize:!1}}const zg=cu(19),Ug=zg?Zg:Jg;function we(e,t,n,r,o){return Ug(e,t,n,r,o)}function Vg(e,t,n,r,o){const s=d.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return Jo.useSyncExternalStore(e.subscribe,s,s)}Gg({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 r=e.syncHooks[n],o=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,o)||(t=!0,r.value=o)}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 o of e.syncHooks)n.add(o.store);const r=[];for(const o of n)r.push(o.subscribe(t));return()=>{for(const o of r)o()}}),Jo.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Zg(e,t,n,r,o){const s=Qg();if(!s)return Vg(e,t,n,r,o);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,r)||!Object.is(a.a3,o))&&(a.store!==e&&(s.didChangeStore=!0),a.store=e,a.selector=t,a.a1=n,a.a2=r,a.a3=o,a.value=t(e.getSnapshot(),n,r,o))):(a={store:e,selector:t,a1:n,a2:r,a3:o,value:t(e.getSnapshot(),n,r,o)},s.syncHooks.push(a)),a.value}function Jg(e,t,n,r,o){return Wg.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class $g{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 r of this.listeners){if(n!==this.updateTick)return;r(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,r,o){return we(this,t,n,r,o)}}class Gr extends $g{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){d.useDebugValue(t);const r=this;ie(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){const r=this;ie(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);ie(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){d.useDebugValue(t);const r=this,o=n!==void 0;ie(()=>{o&&!Object.is(r.state[t],n)&&r.setState({...r.state,[t]:n})},[r,t,n,o])}select(t,n,r,o){const s=this.selectors[t];return s(this.state,n,r,o)}useState(t,n,r,o){return d.useDebugValue(t),we(this,this.selectors[t],n,r,o)}useContextCallback(t,n){d.useDebugValue(t);const r=de(n??Er);this.context[t]=r}useStateSetter(t){const n=d.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const a=o;o=i,n(i,a,this)}})}}const Xg={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 es extends Gr{constructor(t){const{syncOnly:n,nested:r,onOpenChange:o,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:zu(),nested:r,triggerElements:s},Xg),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&tA(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function id(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:o,nested:s,onOpenChange:i}=e,a=t.useState("open"),c=t.useState("activeTriggerElement"),u=t.useState(n?"popupElement":"positionerElement"),f=t.context.triggerElements,h=i,g=d.useRef(null);r===void 0&&g.current===null&&(g.current=new es({open:a,transitionStatus:void 0,referenceElement:c,floatingElement:u,triggerElements:f,onOpenChange:h,floatingId:o,syncOnly:!0,nested:s}));const A=r??g.current;return t.useSyncedValue("floatingId",o),ie(()=>{const p={open:a,floatingId:o,referenceElement:c,floatingElement:u};Pe(c)&&(p.domReferenceElement=c),A.state.positionReference===A.state.referenceElement&&(p.positionReference=c),A.update(p)},[a,o,c,u,A]),A.context.onOpenChange=h,A.context.nested=s,A}const ts={tabIndex:-1,[qs]:""};function qg(e){return t=>t==="touch"?e.current:!0}function ad(e,t=!1){const n=Jn(),r=In()!=null,o=Dt(()=>e(n,r)).current;return id({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:o.setOpen}),o}function la({handle:e,store:t}){return ie(()=>e.attachStore(t),[e,t]),null}function em(e,t){const n=d.useRef(null),r=d.useRef(null);return d.useCallback(o=>{if(e===void 0)return;let s=!1;if(n.current!==null){const i=n.current,a=r.current,c=t.context.triggerElements.getById(i);a&&c===a&&(t.context.triggerElements.delete(i),s=!0),n.current=null,r.current=null}if(o!==null&&(n.current=e,r.current=o,t.context.triggerElements.add(e,o),s=!0),s){const i=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==i&&t.set("triggerCount",i)}},[t,e])}function ca(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const o=n?.id??null;(o||t)&&(e.activeTriggerId=o,e.activeTriggerElement=n??null)}function ld(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function tm(e,t,n,r={}){const o=n.reason,s=o===at,i=t&&o===Yn,a=!t&&(o===Pn||o===Ko),c=ld(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);const u=()=>{const f={...r.extraState,open:t};i?f.instantType="focus":a?f.instantType="dismiss":s&&(f.instantType=void 0),ca(f,t,n.trigger,c()),e.update(f)};s?sn.flushSync(u):u()}function cd(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=em(e,n),i=de(c=>{const u=n.select("open"),f=n.select("activeTriggerId");if(f===e){n.update({activeTriggerElement:c,...u?r:null});return}f==null&&u&&n.update({activeTriggerId:e,activeTriggerElement:c,...r})}),a=d.useCallback(c=>{s(c),c&&i(c)},[s,i]);return ie(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:a,isMountedByThisTrigger:o}}function ua(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=d.useRef(null),o=e.useState("open"),s=e.useState("triggerCount"),i=e.useState("activeTriggerId"),a=e.useState("activeTriggerElement");ie(()=>{if(!o){r.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 f=e.select("activeTriggerId");let h=null;if(f){const g=e.context.triggerElements.getById(f);if(g)r.current=f,g!==e.state.activeTriggerElement&&(u.activeTriggerElement=g);else{for(const[A,p]of e.context.triggerElements.entries())if(p===e.state.activeTriggerElement){u.activeTriggerId=A,u.activeTriggerElement=p,r.current=A;break}u.activeTriggerId===void 0&&(r.current===f?h=f:r.current=null)}}else r.current=null;if(!h&&!f&&c===1){const g=e.context.triggerElements.entries().next();if(!g.done){const[A,p]=g.value;u.activeTriggerId=A,u.activeTriggerElement=p,r.current=A}}(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 g=Ce(Mt);e.setOpen(!1,g),g.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,s,i,a,n])}function da(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=sr(e),i=t.useState("preventUnmountingOnClose"),a=e?!1:i;t.useSyncedValues({mounted:r,transitionStatus:s,preventUnmountingOnClose:a});const c=de(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Yt({enabled:r&&!e&&!a,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:s}}function fa(e,t){e.useSyncedValues(t),ie(()=>()=>{e.update({activeTriggerProps:ct,inactiveTriggerProps:ct,popupProps:ct})},[e])}function nm(e,t){ie(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),ie(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Yr{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 rm(){return new es({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Yr,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function pa(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:rm(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:ct,inactiveTriggerProps:ct,popupProps:ct}}function ud(e,t,n=!1){return new es({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}const wr=e=>e.triggerIdProp??e.activeTriggerId,ha=e=>e.openProp??e.open,Tl=e=>(e.popupElement?.id??e.floatingId)||void 0;function dd(e,t){return t!==void 0&&ha(e)&&wr(e)===t}function om(e,t){return dd(e,t)?!0:t!==void 0&&ha(e)&&wr(e)==null&&e.triggerCount===1}const Aa={open:ha,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:wr,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Tl,isTriggerActive:(e,t)=>t!==void 0&&wr(e)===t,isOpenedByTrigger:(e,t)=>dd(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&wr(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>om(e,t)?Tl(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function fd(e){const t=d.useCallback(r=>e===void 0?Er:e.subscribeStore(r),[e]),n=d.useCallback(()=>e===void 0?void 0:e.store,[e]);return Jo.useSyncExternalStore(t,n,()=>e?.serverStore)}function sm(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Jn(),s=In()!=null,i=Dt(()=>new es({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Yr,floatingId:o,syncOnly:!1,nested:s})).current;return ie(()=>{const a={open:t,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=Pe(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),i.update(a)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function im(e){return am(e,e.rootContext)}function am(e,t){const{nodeId:n,externalTree:r}=e,o=t.useState("referenceElement"),s=t.useState("floatingElement"),i=t.useState("domReferenceElement"),a=t.useState("open"),c=t.useState("floatingId"),[u,f]=d.useState(null),[h,g]=d.useState(void 0),[A,p]=d.useState(void 0),m=d.useRef(null),x=wn(r),v=d.useMemo(()=>({reference:o,floating:s,domReference:i}),[o,s,i]),b=Pg({...e,elements:{...v,...u&&{reference:u}}}),y=Pe(h)?h:null,C=A===void 0?t.state.floatingElement:A;t.useSyncedValue("referenceElement",h??null),t.useSyncedValue("domReferenceElement",h===void 0?i:y),t.useSyncedValue("floatingElement",C);const w=d.useCallback(F=>{const T=Pe(F)?{getBoundingClientRect:()=>F.getBoundingClientRect(),getClientRects:()=>F.getClientRects(),contextElement:F}:F;f(T),b.refs.setReference(T)},[b.refs]),I=d.useCallback(F=>{(Pe(F)||F===null)&&(m.current=F,g(F)),(Pe(b.refs.reference.current)||b.refs.reference.current===null||F!==null&&!Pe(F))&&b.refs.setReference(F)},[b.refs,g]),S=d.useCallback(F=>{p(F),b.refs.setFloating(F)},[b.refs]),R=d.useMemo(()=>({...b.refs,setReference:I,setFloating:S,setPositionReference:w,domReference:m}),[b.refs,I,S,w]),E=d.useMemo(()=>({...b.elements,domReference:i}),[b.elements,i]),k=d.useMemo(()=>({...b,dataRef:t.context.dataRef,open:a,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:R,elements:E,nodeId:n,rootStore:t}),[b,R,E,n,t,a,c]);return ie(()=>{i&&(m.current=i)},[i]),ie(()=>{t.context.dataRef.current.floatingContext=k;const F=x?.nodesRef.current.find(T=>T.id===n);F&&(F.context=k)}),d.useMemo(()=>({...b,context:k,refs:R,elements:E,rootStore:t}),[b,R,E,k,t])}const Bs=Li&&an;function pd(e,t={}){const{enabled:n=!0,delay:r}=t,o="rootStore"in e?e.rootStore:e,{events:s,dataRef:i}=o.context,a=d.useRef(!1),c=d.useRef(null),u=d.useRef(!0),f=pt();d.useEffect(()=>{const g=o.select("domReferenceElement");if(!n)return;const A=rt(g);function p(){const v=o.select("domReferenceElement");!o.select("open")&&Xe(v)&&v===vt(Be(v))&&(a.current=!0)}function m(){u.current=!0}function x(){u.current=!1}return Wt(De(A,"blur",p),Bs&&De(A,"keydown",m,!0),Bs&&De(A,"pointerdown",x,!0))},[o,n]),d.useEffect(()=>{if(!n)return;function g(A){if(A.reason===Pn||A.reason===Ko){const p=o.select("domReferenceElement");Pe(p)&&(c.current=p,a.current=!0)}}return s.on("openchange",g),()=>{s.off("openchange",g)}},[s,n,o]);const h=d.useMemo(()=>{function g(){a.current=!1,c.current=null}return{onMouseLeave(){g()},onFocus(A){const p=A.currentTarget;if(a.current){if(c.current===p)return;g()}const m=At(A.nativeEvent);if(Pe(m)){if(Bs&&!A.relatedTarget){if(!u.current&&!Vo(m))return}else if(!qh(m))return}const x=vo(A.relatedTarget,o.context.triggerElements),{nativeEvent:v,currentTarget:b}=A,y=typeof r=="function"?r():r;if(o.select("open")&&x||y===0||y===void 0){o.setOpen(!0,Ce(Yn,v,b));return}f.start(y,()=>{a.current||o.setOpen(!0,Ce(Yn,v,b))})},onBlur(A){g();const p=A.relatedTarget,m=A.nativeEvent,x=Pe(p)&&p.hasAttribute(Fr("focus-guard"))&&p.getAttribute("data-type")==="outside";f.start(0,()=>{const v=o.select("domReferenceElement"),b=vt(Be(v));!p&&b===v||ve(i.current.floatingContext?.refs.floating.current,b)||ve(v,b)||x||vo(p??b,o.context.triggerElements)||o.setOpen(!1,Ce(Yn,m))})}}},[i,r,o,f]);return d.useMemo(()=>n?{reference:h,trigger:h}:{},[n,h])}class ga{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 Ot,this.restTimeout=new Ot,this.handleCloseOptions=void 0}static create(){return new ga}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const So=new WeakMap;function Ro(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&So.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),So.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function hd(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,s=So.get(n);s&&s!==e&&Ro(s),Ro(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,So.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function ma(e){const t=e.context.dataRef.current,n=Dt(()=>t.hoverInteractionState??ga.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),Ji(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Ad(e,t={}){const{enabled:n=!0,closeDelay:r=0,nodeId:o}=t,s="rootStore"in e?e.rootStore:e,i=s.useState("open"),a=s.useState("floatingElement"),c=s.useState("domReferenceElement"),{dataRef:u}=s.context,f=wn(),h=In(),g=ma(s),A=pt(),p=de(()=>Ou(u.current.openEvent?.type,g.interactedInside)),m=de(()=>TA(u.current.openEvent?.type)),x=de(()=>{Ro(g)});ie(()=>{i||(g.pointerType=void 0,g.restTimeoutPending=!1,g.interactedInside=!1,x())},[i,g,x]),d.useEffect(()=>x,[x]),ie(()=>{if(n&&i&&g.handleCloseOptions?.blockPointerEvents&&m()&&Pe(c)&&a){const v=c,b=a,y=Be(a),C=f?.nodesRef.current.find(R=>R.id===h)?.context?.elements.floating;C&&(C.style.pointerEvents="");const w=g.pointerEventsScopeElement!==b?g.pointerEventsScopeElement:null,I=C!==b?C:null,S=g.handleCloseOptions?.getScope?.()??w??I??v.closest("[data-rootownerid]")??y.body;return hd(g,{scopeElement:S,referenceElement:v,floatingElement:b}),()=>{x()}}},[n,i,c,a,g,m,f,h,x]),d.useEffect(()=>{if(!n)return;function v(){return!!(f&&h&&xn(f.nodesRef.current,h).length>0)}function b(R){const E=er(r,"close",g.pointerType),k=()=>{s.setOpen(!1,Ce(at,R)),f?.events.emit("floating.closed",R)};E?g.openChangeTimeout.start(E,k):(g.openChangeTimeout.clear(),k())}function y(R){const E=At(R);if(!Xh(E)){g.interactedInside=!1;return}g.interactedInside=E?.closest("[aria-haspopup]")!=null}function C(){g.openChangeTimeout.clear(),A.clear(),f?.events.off("floating.closed",I),x()}function w(R){if(v()&&f){f.events.on("floating.closed",I);return}if(vo(R.relatedTarget,s.context.triggerElements))return;const E=u.current.floatingContext?.nodeId??o,k=R.relatedTarget;if(!(f&&E&&Pe(k)&&xn(f.nodesRef.current,E,!1).some(T=>ve(T.context?.elements.floating,k)))){if(g.handler){g.handler(R);return}x(),m()&&!p()&&b(R)}}function I(R){!f||!h||v()||A.start(0,()=>{f.events.off("floating.closed",I),s.setOpen(!1,Ce(at,R)),f.events.emit("floating.closed",R)})}const S=a;return Wt(S&&De(S,"mouseenter",C),S&&De(S,"mouseleave",w),S&&De(S,"pointerdown",y,!0),()=>{f?.events.off("floating.closed",I)})},[n,a,s,u,r,o,m,p,x,g,f,h,A])}const lm={current:null};function gd(e,t={}){const{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:s=!1,restMs:i=0,move:a=!0,triggerElementRef:c=lm,externalTree:u,isActiveTrigger:f=!0,getHandleCloseContext:h,isClosing:g,shouldOpen:A,guardStaleOpen:p=!1}=t,m="rootStore"in e?e.rootStore:e,{dataRef:x,events:v}=m.context,b=wn(u),y=ma(m),C=d.useRef(!1),w=tt(o),I=tt(r),S=tt(i),R=tt(n),E=tt(A),k=tt(g),F=de(()=>Ou(x.current.openEvent?.type,y.interactedInside)),T=de(()=>E.current?.()!==!1),N=de((L,_,j)=>{const H=m.context.triggerElements;if(H.hasElement(_))return!L||!ve(L,_);if(!Pe(j))return!1;const P=j;return H.hasMatchingElement(B=>ve(B,P))&&(!L||!ve(L,P))}),M=de(()=>{if(!y.handler)return;Be(m.select("domReferenceElement")).removeEventListener("mousemove",y.handler),y.handler=void 0}),D=de(()=>{Ro(y)});return f&&(y.handleCloseOptions=w.current?.__options),d.useEffect(()=>M,[M]),d.useEffect(()=>{if(!n)return;function L(_){_.open?C.current=!1:(C.current=_.reason===at,M(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return v.on("openchange",L),()=>{v.off("openchange",L)}},[n,v,y,M]),d.useEffect(()=>{if(!n)return;function L(O,G=!0){const z=er(I.current,"close",y.pointerType);z?y.openChangeTimeout.start(z,()=>{m.setOpen(!1,Ce(at,O)),b?.events.emit("floating.closed",O)}):G&&(y.openChangeTimeout.clear(),m.setOpen(!1,Ce(at,O)),b?.events.emit("floating.closed",O))}const _=c.current??(f?m.select("domReferenceElement"):null);if(!Pe(_))return;function j(O){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,s&&!mn(y.pointerType))return;const G=ml(S.current),z=er(I.current,"open",y.pointerType),U=At(O),Q=O.currentTarget??null,Z=m.select("domReferenceElement");let K=Q;if(Pe(U)&&!m.context.triggerElements.hasElement(U)){for(const ae of m.context.triggerElements.elements())if(ve(ae,U)){K=ae;break}}Pe(Q)&&Pe(Z)&&!m.context.triggerElements.hasElement(Q)&&ve(Q,Z)&&(K=Z);const te=K==null?!1:N(Z,K,U),le=m.select("open"),X=k.current?.()??m.select("transitionStatus")==="ending",ee=!le&&X&&C.current,J=!te&&Pe(K)&&Pe(Z)&&ve(Z,K)&&ee,ce=G>0&&!z,ue=te&&(le||ee)||J,ge=!le||te;if(ue){T()&&m.setOpen(!0,Ce(at,O,K));return}ce||(z?y.openChangeTimeout.start(z,()=>{ge&&T()&&m.setOpen(!0,Ce(at,O,K))}):ge&&T()&&m.setOpen(!0,Ce(at,O,K)))}function H(O){if(F()){D();return}M();const G=m.select("domReferenceElement"),z=Be(G);y.restTimeout.clear(),y.restTimeoutPending=!1;const U=x.current.floatingContext??h?.();if(vo(O.relatedTarget,m.context.triggerElements))return;if(w.current&&U){m.select("open")||y.openChangeTimeout.clear();const Z=c.current;y.handler=w.current({...U,tree:b,x:O.clientX,y:O.clientY,onClose(){D(),M(),R.current&&!F()&&Z===m.select("domReferenceElement")&&L(O,!0)}}),z.addEventListener("mousemove",y.handler),y.handler(O);return}(y.pointerType!=="touch"||!ve(m.select("floatingElement"),O.relatedTarget))&&L(O)}function P(O){ve(_,O.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}const B=p?De(_,"mouseout",P):void 0;return a?Wt(De(_,"mousemove",j,{once:!0}),De(_,"mouseenter",j),De(_,"mouseleave",H),B):Wt(De(_,"mouseenter",j),De(_,"mouseleave",H),B)},[M,D,x,I,m,n,w,y,f,N,F,s,a,S,c,b,R,h,k,T,p]),d.useMemo(()=>{if(!n)return;function L(_){y.pointerType=_.pointerType}return{onPointerDown:L,onPointerEnter:L,onMouseMove(_){const{nativeEvent:j}=_,H=_.currentTarget,P=m.select("domReferenceElement"),B=m.select("open"),O=N(P,H,_.target);if(s&&!mn(y.pointerType))return;if(B&&O&&y.handleCloseOptions?.blockPointerEvents){const U=m.select("floatingElement");if(U){const Q=y.handleCloseOptions?.getScope?.()??H.ownerDocument.body;hd(y,{scopeElement:Q,referenceElement:H,floatingElement:U})}}const G=ml(S.current);if(B&&!O||G===0||!O&&y.restTimeoutPending&&_.movementX**2+_.movementY**2<2)return;y.restTimeout.clear();function z(){if(y.restTimeoutPending=!1,F())return;const U=m.select("open");!y.blockMouseMove&&(!U||O)&&T()&&m.setOpen(!0,Ce(at,j,H))}y.pointerType==="touch"?sn.flushSync(()=>{z()}):O&&B?z():(y.restTimeoutPending=!0,y.restTimeout.start(G,z))}}},[n,y,F,N,s,m,S,T])}const cm="Escape";function Nl(e){return an&&e.movementX===0&&e.movementY===0}function ns(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function qr(e,t){return ns(t,e===yu||e===Wi,e===zo||e===Uo)}function js(e,t,n){return ns(t,e===Wi,n?e===zo:e===Uo)||e==="Enter"||e===" "||e===""}function um(e,t,n){return ns(t,n?e===zo:e===Uo,e===Wi)}function dm(e,t,n,r){const o=n?e===Uo:e===zo,s=e===yu;return t==="both"||t==="horizontal"&&r?e===cm:ns(t,o,s)}function md(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:a=!1,loopFocus:c=!1,nested:u=!1,rtl:f=!1,virtual:h=!1,focusItemOnOpen:g="auto",focusItemOnHover:A=!0,openOnArrowKeyDown:p=!0,disabledIndices:m=void 0,orientation:x="vertical",parentOrientation:v,id:b,resetOnPointerLeave:y=!0,externalTree:C,grid:w}=t,I=w!=null,S="rootStore"in e?e.rootStore:e,R=S.useState("open"),E=S.useState("floatingElement"),k=S.useState("domReferenceElement"),F=S.context.dataRef,T=yo(E),N=ei(k),M=tt(T),D=In(),L=wn(C),_=d.useRef(g),j=d.useRef(i??-1),H=d.useRef(null),P=d.useRef(!0),B=de(W=>{o(j.current===-1?null:j.current,W)}),O=d.useRef(!!E),G=d.useRef(R),z=d.useRef(!1),U=d.useRef(!1),Q=d.useRef(null),Z=tt(m),K=tt(R),te=tt(i),le=tt(y),X=qn(),ee=qn(),J=de(()=>{function W(ne){h?L?.events.emit("virtualfocus",ne):Q.current=go(ne,{sync:z.current,preventScroll:!0})}const Y=n.current[j.current],ye=U.current;Y&&W(Y),(z.current?ne=>ne():ne=>X.request(ne))(()=>{const ne=n.current[j.current]||Y;if(!ne)return;Y||W(ne),oe&&(ye||!P.current)&&ne.scrollIntoView?.({block:"nearest",inline:"nearest"})})});ie(()=>{F.current.orientation=x},[F,x]),ie(()=>{s&&(R&&E?(j.current=i??-1,_.current&&i!=null&&(U.current=!0,B())):O.current&&(j.current=-1,B()))},[s,R,E,i,B]),ie(()=>{if(s){if(!R){z.current=!1;return}if(E)if(r==null){if(z.current=!1,te.current!=null)return;if(O.current&&(j.current=-1,J()),(!G.current||!O.current)&&_.current&&(H.current!=null||_.current===!0&&H.current==null)){let W=0;const Y=()=>{n.current[0]==null?(W<2&&(W?q=>ee.request(q):queueMicrotask)(Y),W+=1):(j.current=H.current==null||js(H.current,x,f)||u?Ao(n):ni(n),H.current=null,B())};Y()}}else Ir(n.current,r)||(j.current=r,J(),U.current=!1)}},[s,R,E,r,te,u,n,x,f,B,J,ee]),ie(()=>{if(!s||E||!L||h||!O.current)return;const W=L.nodesRef.current,Y=W.find(ne=>ne.id===D)?.context?.elements.floating,ye=vt(Be(k??Y??null)),q=W.some(ne=>ne.context&&ve(ne.context.elements.floating,ye));Y&&!q&&P.current&&Y.focus({preventScroll:!0})},[s,E,k,L,D,h]),ie(()=>{G.current=R,O.current=!!E}),ie(()=>{R||(H.current=null,_.current=g)},[R,g]);const ce=r!=null,ue=de(W=>{if(!K.current)return;const Y=n.current.indexOf(W.currentTarget);Y!==-1&&(j.current!==Y||r!==Y)&&(j.current=Y,B(W))}),ge=de(()=>v??L?.nodesRef.current.find(W=>W.id===D)?.context?.dataRef?.current.orientation),ae=de(()=>Ao(n,Z.current)),pe=de(W=>{if(P.current=!1,z.current=!0,W.which===229||!K.current&&W.currentTarget===M.current)return;if(u&&dm(W.key,x,f,I)){qr(W.key,ge())||Ht(W),S.setOpen(!1,Ce(Js,W.nativeEvent)),Xe(k)&&(h?L?.events.emit("virtualfocus",k):k.focus());return}const Y=j.current,ye=Ao(n,m),q=ni(n,m);if(N||(W.key==="Home"&&(Ht(W),j.current=ye,B(W)),W.key==="End"&&(Ht(W),j.current=q,B(W))),w!=null){const ne=w(W,j.current,n,x,c,f,m,ye,q);if(ne!=null&&(j.current=ne,B(W)),x==="both")return}if(qr(W.key,x)){if(Ht(W),R&&!h&&vt(W.currentTarget.ownerDocument)===W.currentTarget){j.current=js(W.key,x,f)?ye:q,B(W);return}js(W.key,x,f)?c?Y>=q?a&&Y!==n.current.length?j.current=-1:(z.current=!1,j.current=ye):j.current=tn(n.current,{startingIndex:Y,disabledIndices:m}):j.current=Math.min(q,tn(n.current,{startingIndex:Y,disabledIndices:m})):c?Y<=ye?a&&Y!==-1?j.current=n.current.length:(z.current=!1,j.current=q):j.current=tn(n.current,{startingIndex:Y,decrement:!0,disabledIndices:m}):j.current=Math.max(ye,tn(n.current,{startingIndex:Y,decrement:!0,disabledIndices:m})),Ir(n.current,j.current)&&(j.current=-1),B(W)}}),oe=d.useMemo(()=>({onFocus(Y){z.current=!0,ue(Y)},onClick:({currentTarget:Y})=>Y.focus({preventScroll:!0}),onMouseMove(Y){Nl(Y)||(z.current=!0,U.current=!1,A&&ue(Y))},onPointerLeave(Y){if(!K.current||!P.current||Y.pointerType==="touch")return;z.current=!0;const ye=Y.relatedTarget;if(!(!A||n.current.includes(ye))&&le.current&&(Q.current?.(),Q.current=null,j.current=-1,B(Y),!h)){const q=M.current,ne=vt(Be(q));q&&ve(q,ne)&&q.focus({preventScroll:!0})}}}),[ue,K,M,A,n,B,le,h]),re=d.useMemo(()=>h&&R&&ce&&{"aria-activedescendant":`${b}-${r}`},[h,R,ce,b,r]),se=d.useMemo(()=>({"aria-orientation":x==="both"?void 0:x,...N?{}:re,onKeyDown(W){if(W.key==="Tab"&&W.shiftKey&&R&&!h){const Y=At(W.nativeEvent);if(Y&&!ve(M.current,Y))return;Ht(W),S.setOpen(!1,Ce(Bn,W.nativeEvent)),Xe(k)&&k.focus();return}pe(W)},onPointerMove(W){Nl(W)||(P.current=!0)}}),[re,pe,M,x,N,S,R,h,k]),he=d.useMemo(()=>{function W(q){S.setOpen(!0,Ce(Js,q.nativeEvent,q.currentTarget))}function Y(q){g==="auto"&&Qi(q.nativeEvent)&&(_.current=!h)}function ye(q){_.current=g,g==="auto"&&Gi(q.nativeEvent)&&(_.current=!0)}return{onKeyDown(q){const ne=S.select("open");P.current=!1;const Ee=q.key.startsWith("Arrow"),Se=um(q.key,ge(),f),Le=qr(q.key,x),Je=(u?Se:Le)||q.key==="Enter"||q.key.trim()==="";if(h&&ne)return pe(q);if(!(!ne&&!p&&Ee)){if(Je){const We=qr(q.key,ge());H.current=u&&We?null:q.key}if(u){Se&&(Ht(q),ne?(j.current=ae(),B(q)):W(q));return}Le&&(te.current!=null&&(j.current=te.current),Ht(q),!ne&&p?W(q):pe(q),ne&&B(q))}},onFocus(q){S.select("open")&&!h&&(j.current=-1,B(q))},onPointerDown:ye,onPointerEnter:ye,onMouseDown:Y,onClick:Y}},[pe,g,ae,u,B,S,p,x,ge,f,te,h]),me=d.useMemo(()=>({...re,...he}),[re,he]);return d.useMemo(()=>s?{reference:me,floating:se,item:oe,trigger:he}:{},[s,me,se,he,oe])}function xd(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:s,disabledIndices:i,onTyping:a,enabled:c=!0,resetMs:u=750,selectedIndex:f=null}=t,h="rootStore"in e?e.rootStore:e,g=h.useState("open"),A=pt(),p=d.useRef(""),m=d.useRef(f??o??-1),x=d.useRef(null),v=de(C=>{function w(M){return r?.current[M]}function I(M){const D=w(M);return D&&!Zo(D)||D?.matches(":disabled")?!1:i==null||!wo(Nt,M,i)}function S(M,D,L=0){if(M.length===0)return-1;const _=(L%M.length+M.length)%M.length,j=D.toLowerCase();for(let H=0;H<M.length;H+=1){const P=(_+H)%M.length;if(!(!M[P]?.toLowerCase().startsWith(j)||!I(P)))return P}return-1}const R=n.current;if(p.current.length>0&&C.key===" "&&(Ht(C),a?.(!0)),p.current.length>0&&p.current[0]!==" "&&S(R,p.current)===-1&&C.key!==" "&&a?.(!1),R==null||C.key.length!==1||C.ctrlKey||C.metaKey||C.altKey)return;g&&C.key!==" "&&(Ht(C),a?.(!0));const E=p.current==="";E&&(m.current=f??o??-1),R.every((M,D)=>M&&I(D)?M[0]?.toLowerCase()!==M[1]?.toLowerCase():!0)&&p.current===C.key&&(p.current="",m.current=x.current),p.current+=C.key,A.start(u,()=>{p.current="",m.current=x.current,a?.(!1)});const T=((E?f??o??-1:m.current)??0)+1,N=S(R,p.current,T);N!==-1?(s?.(N),x.current=N):C.key!==" "&&(p.current="",a?.(!1))}),b=de(C=>{const w=C.relatedTarget,I=h.select("domReferenceElement"),S=h.select("floatingElement");ve(I,w)||ve(S,w)||(A.clear(),p.current="",m.current=x.current,a?.(!1))});ie(()=>{!g&&f!==null||(A.clear(),x.current=null,p.current!==""&&(p.current=""))},[g,f,A]);const y=d.useMemo(()=>({onKeyDown:v,onBlur:b}),[v,b]);return d.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}const _l=.1,fm=_l*_l,Qe=.5;function eo(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function to(e,t,n,r,o,s,i,a,c,u){let f=!1;return eo(e,t,n,r,o,s)&&(f=!f),eo(e,t,o,s,i,a)&&(f=!f),eo(e,t,i,a,c,u)&&(f=!f),eo(e,t,c,u,n,r)&&(f=!f),f}function pm(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function no(e,t,n,r,o,s){const i=Math.min(n,o),a=Math.max(n,o),c=Math.min(r,s),u=Math.max(r,s);return e>=i&&e<=a&&t>=c&&t<=u}function bd(e={}){const{blockPointerEvents:t=!1}=e,n=new Ot,r=({x:o,y:s,placement:i,elements:a,onClose:c,nodeId:u,tree:f})=>{const h=i?.split("-")[0];let g=!1,A=null,p=null,m=typeof performance<"u"?performance.now():0;function x(b,y){const C=performance.now(),w=C-m;if(A===null||p===null||w===0)return A=b,p=y,m=C,!1;const I=b-A,S=y-p,R=I*I+S*S,E=w*w*fm;return A=b,p=y,m=C,R<E}function v(){n.clear(),c()}return function(y){n.clear();const C=a.domReference,w=a.floating;if(!C||!w||h==null||o==null||s==null)return;const{clientX:I,clientY:S}=y,R=At(y),E=y.type==="mouseleave",k=ve(w,R),F=ve(C,R);if(k&&(g=!0,!E))return;if(F&&(g=!1,!E)){g=!0;return}if(E&&Pe(y.relatedTarget)&&ve(w,y.relatedTarget))return;function T(){return!!(f&&xn(f.nodesRef.current,u).length>0)}function N(){T()||v()}if(T())return;const M=C.getBoundingClientRect(),D=w.getBoundingClientRect(),L=o>D.right-D.width/2,_=s>D.bottom-D.height/2,j=D.width>M.width,H=D.height>M.height,P=(j?M:D).left,B=(j?M:D).right,O=(H?M:D).top,G=(H?M:D).bottom;if(h==="top"&&s>=M.bottom-1||h==="bottom"&&s<=M.top+1||h==="left"&&o>=M.right-1||h==="right"&&o<=M.left+1){N();return}let z=!1;switch(h){case"top":z=no(I,S,P,M.top+1,B,D.bottom-1);break;case"bottom":z=no(I,S,P,D.top+1,B,M.bottom-1);break;case"left":z=no(I,S,D.right-1,G,M.left+1,O);break;case"right":z=no(I,S,M.right-1,G,D.left+1,O);break}if(z)return;if(g&&!pm(I,S,M)){N();return}if(!E&&x(I,S)){N();return}let U=!1;switch(h){case"top":{const Q=j?Qe/2:Qe*4,Z=j||L?o+Q:o-Q,K=j?o-Q:L?o+Q:o-Q,te=s+Qe+1,le=L||j?D.bottom-Qe:D.top,X=L?j?D.bottom-Qe:D.top:D.bottom-Qe;U=to(I,S,Z,te,K,te,D.left,le,D.right,X);break}case"bottom":{const Q=j?Qe/2:Qe*4,Z=j||L?o+Q:o-Q,K=j?o-Q:L?o+Q:o-Q,te=s-Qe,le=L||j?D.top+Qe:D.bottom,X=L?j?D.top+Qe:D.bottom:D.top+Qe;U=to(I,S,Z,te,K,te,D.left,le,D.right,X);break}case"left":{const Q=H?Qe/2:Qe*4,Z=H||_?s+Q:s-Q,K=H?s-Q:_?s+Q:s-Q,te=o+Qe+1,le=_||H?D.right-Qe:D.left,X=_?H?D.right-Qe:D.left:D.right-Qe;U=to(I,S,le,D.top,X,D.bottom,te,Z,te,K);break}case"right":{const Q=H?Qe/2:Qe*4,Z=H||_?s+Q:s-Q,K=H?s-Q:_?s+Q:s-Q,te=o-Qe,le=_||H?D.left+Qe:D.right,X=_?H?D.left+Qe:D.right:D.left+Qe;U=to(I,S,te,Z,te,K,le,D.top,X,D.bottom);break}}U?g||n.start(40,N):N()}};return r.__options={...e,blockPointerEvents:t},r}const vd=d.createContext(void 0);function hm(){const e=d.useContext(vd);if(e===void 0)throw new Error(ot(26));return e}const li="ArrowUp",ci="ArrowDown",ui="ArrowLeft",di="ArrowRight",fi="Home",pi="End",rs=new Set([li,ci,ui,di,fi,pi]),Am="Shift",gm=[Am,"Control","Alt","Meta"];function mm(e){return Xe(e)&&e.tagName==="INPUT"}function Ol(e){return!!(mm(e)&&e.selectionStart!=null||Xe(e)&&e.tagName==="TEXTAREA")}function Hl(e,t,n,r){if(!e||!t||!t.scrollTo)return;let o=e.scrollLeft,s=e.scrollTop;const i=e.clientWidth<e.scrollWidth,a=e.clientHeight<e.scrollHeight;if(i&&r!=="vertical"){const c=Ll(e,t,"left"),u=ro(e),f=ro(t);n==="ltr"&&(c+t.offsetWidth+f.scrollMarginRight>e.scrollLeft+e.clientWidth-u.scrollPaddingRight?o=c+t.offsetWidth+f.scrollMarginRight-e.clientWidth+u.scrollPaddingRight:c-f.scrollMarginLeft<e.scrollLeft+u.scrollPaddingLeft&&(o=c-f.scrollMarginLeft-u.scrollPaddingLeft)),n==="rtl"&&(c-f.scrollMarginLeft<e.scrollLeft+u.scrollPaddingLeft?o=c-f.scrollMarginLeft-u.scrollPaddingLeft:c+t.offsetWidth+f.scrollMarginRight>e.scrollLeft+e.clientWidth-u.scrollPaddingRight&&(o=c+t.offsetWidth+f.scrollMarginRight-e.clientWidth+u.scrollPaddingRight))}if(a&&r!=="horizontal"){const c=Ll(e,t,"top"),u=ro(e),f=ro(t);c-f.scrollMarginTop<e.scrollTop+u.scrollPaddingTop?s=c-f.scrollMarginTop-u.scrollPaddingTop:c+t.offsetHeight+f.scrollMarginBottom>e.scrollTop+e.clientHeight-u.scrollPaddingBottom&&(s=c+t.offsetHeight+f.scrollMarginBottom-e.clientHeight+u.scrollPaddingBottom)}e.scrollTo({left:o,top:s,behavior:"auto"})}function Ll(e,t,n){const r=n==="left"?"offsetLeft":"offsetTop";let o=0;for(;t.offsetParent&&(o+=t[r],t.offsetParent!==e);)t=t.offsetParent;return o}function ro(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const xm={...Wr,...Nn,nestedDialogOpen(e){return e?{"data-nested-dialog-open":""}:null}},xa=d.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,initialFocus:a,...c}=t,u=_n(),f=u.useState("descriptionElementId"),h=u.useState("disablePointerDismissal"),g=u.useState("floatingRootContext"),A=u.useState("popupProps"),p=u.useState("modal"),m=u.useState("mounted"),x=u.useState("nested"),v=u.useState("nestedOpenDialogCount"),b=u.useState("open"),y=u.useState("openMethod"),C=u.useState("titleElementId"),w=u.useState("transitionStatus"),I=u.useState("role"),S=g.useState("floatingId");hm(),Yt({open:b,ref:u.context.popupRef,onComplete(){b&&u.context.onOpenChangeComplete?.(!0)}});const R=a===void 0?qg(u.context.popupRef):a,E=v>0,k=u.useStateSetter("popupElement"),T=je("div",t,{state:{open:b,nested:x,transitionStatus:w,nestedDialogOpen:E},props:[A,{id:S,"aria-labelledby":C,"aria-describedby":f,role:I,...ts,hidden:!m,onKeyDown(N){rs.has(N.key)&&N.stopPropagation()},style:{"--nested-dialogs":v}},c],ref:[n,u.context.popupRef,k],stateAttributesMapping:xm});return l.jsx(sa,{context:g,openInteractionType:y,disabled:!m,closeOnFocusOut:!h,initialFocus:R,returnFocus:i,modal:p!==!1,restoreFocus:"popup",children:T})});function ba(e){return cu(19)?e:e?"true":void 0}const va=d.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const i=r.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 l.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),ya=d.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,s=_n(),i=s.useState("mounted"),a=s.useState("modal"),c=s.useState("open");return i||r?l.jsx(vd.Provider,{value:r,children:l.jsxs(na,{ref:n,...o,children:[i&&a===!0&&l.jsx(va,{ref:s.context.internalBackdropRef,inert:ba(!c)}),t.children]})}):null});let Kl={},Wl={},Ql="";function os(e,t){return Ri(e)?e:t}function Gl(e,t,n){return/hidden|clip/.test(e.getComputedStyle(os(t,n)).overflowY)}function bm(e){if(typeof document>"u")return!1;const t=Be(e);return rt(t).innerWidth-t.documentElement.clientWidth>0}function vm(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Be(e),r=n.documentElement,o=n.body,s=os(r,o),i=s.style.overflowY,a=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",s.style.overflowY="scroll";const c=s.offsetWidth;s.style.overflowY="hidden";const u=s.offsetWidth;return s.style.overflowY=i,r.style.scrollbarGutter=a,c===u}function ym(e){const t=Be(e),n=t.documentElement,r=t.body,o=os(n,r),s={overflowY:o.style.overflowY,overflowX:o.style.overflowX};return Object.assign(o.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(o.style,s)}}function Cm(e){const t=Be(e),n=t.documentElement,r=t.body,o=rt(n);let s=0,i=0,a=!1;const c=Ct.create();if(an&&(o.visualViewport?.scale??1)!==1)return()=>{};function u(){const A=o.getComputedStyle(n),p=o.getComputedStyle(r),v=(A.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,Kl={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Ql=n.style.scrollBehavior,Wl={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const b=n.scrollHeight>n.clientHeight,y=n.scrollWidth>n.clientWidth,C=A.overflowY==="scroll"||p.overflowY==="scroll",w=A.overflowX==="scroll"||p.overflowX==="scroll",I=Math.max(0,o.innerWidth-r.clientWidth),S=Math.max(0,o.innerHeight-r.clientHeight),R=parseFloat(p.marginTop)+parseFloat(p.marginBottom),E=parseFloat(p.marginLeft)+parseFloat(p.marginRight),k=os(n,r);if(a=vm(e),a){n.style.scrollbarGutter=v,k.style.overflowY="hidden",k.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:v,overflowY:"hidden",overflowX:"hidden"}),(b||C)&&(n.style.overflowY="scroll"),(y||w)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:R||S?`calc(100dvh - ${R+S}px)`:"100dvh",width:E||I?`calc(100vw - ${E+I}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function f(){Object.assign(n.style,Kl),Object.assign(r.style,Wl),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Ql)}function h(){f(),c.request(u)}u();const g=De(o,"resize",h);return()=>{c.cancel(),f(),typeof o.removeEventListener=="function"&&g()}}class Im{lockCount=0;restore=null;timeoutLock=Ot.create();timeoutUnlock=Ot.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),r=n.documentElement,o=n.body,s=rt(r);if(Gl(s,r,o)){const a=new s.MutationObserver(()=>{Gl(s,r,o)||(a.disconnect(),this.restore=null,this.lock(t))}),c={attributes:!0};a.observe(r,c),a.observe(o,c),this.restore=()=>a.disconnect();return}const i=Yo||!bm(t);this.restore=i?ym(t):Cm(t)}}const wm=new Im;function yd(e=!0,t=null){ie(()=>{if(e)return wm.acquire(t)},[e,t])}function km({store:e,parentContext:t,isDrawer:n}){const r=e.useState("open"),o=e.useState("disablePointerDismissal"),s=e.useState("modal"),i=e.useState("popupElement"),a=e.useState("floatingRootContext"),[c,u]=d.useState(0),[f,h]=d.useState(0),g=c===0,A=Xo(a,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(p){if(!e.context.outsidePressEnabledRef.current||"button"in p&&p.button!==0)return!1;if("touches"in p){if(p.type==="touchend"){if(p.changedTouches.length!==1||p.touches.length!==0)return!1}else if(p.touches.length!==1)return!1}const m=At(p);if(g&&!o){if(s){const x=e.context.internalBackdropRef.current,v=e.context.backdropRef.current;return x||v?x===m||v===m||ve(m,i)&&!m?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:g});return yd(r&&s===!0,i),e.useContextCallback("onNestedDialogOpen",(p,m)=>{u(p),h(m)}),ie(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,f+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,f,t]),fa(e,{activeTriggerProps:A.reference,inactiveTriggerProps:A.trigger,popupProps:A.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:f}),null}const Em={...Aa,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 Sm extends Gr{constructor(t,n,r){const o=new Yr,s=Rm(t,o,n,r);super(s,Dm(o),Em)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const r={open:t};ca(r,t,n.trigger),this.update(r)}}function Rm(e,t,n,r=!1){const o={...pa(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e};return o.floatingRootContext=ud(t,n,r),o}function Dm(e){return{popupRef:d.createRef(),backdropRef:d.createRef(),internalBackdropRef:d.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Cd(e,t){const{children:n,open:r,defaultOpen:o=!1,onOpenChange:s,onOpenChangeComplete:i,disablePointerDismissal:a=!1,modal:c=!0,actionsRef:u,handle:f,triggerId:h,defaultTriggerId:g=null}=t,A=e==="drawer",p=e==="alert-dialog",m=p?!0:c,x=p||a,v=p?"alertdialog":"dialog",b=_n(!0),y=b!=null,C={modal:m,disablePointerDismissal:x,nested:y,role:v},w=ad((F,T)=>new Sm({open:o,openProp:r,activeTriggerId:g,triggerIdProp:h,...C},F,T),!0);w.useControlledProp("openProp",r),w.useControlledProp("triggerIdProp",h),w.useSyncedValues(C),w.useContextCallback("onOpenChange",s),w.useContextCallback("onOpenChangeComplete",i);const I=w.useState("open"),S=w.useState("mounted"),R=w.useState("payload");nm(w,I),ua(w);const{forceUnmount:E}=da(I,w);d.useImperativeHandle(u,()=>({unmount:E,close:()=>w.setOpen(!1,Ce(Di))}),[E,w]);const k=I||S;return l.jsxs(Nu.Provider,{value:w,children:[f&&l.jsx(la,{handle:f,store:w}),k&&l.jsx(km,{store:w,parentContext:b?.context,isDrawer:A}),typeof n=="function"?n({payload:R}):n]})}function Id(e){return Cd("dialog",e)}const Ca=d.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,c=_n(),u=It(i);return c.useSyncedValueWithCleanup("titleElementId",u),je("h2",t,{ref:n,props:[{id:u},a]})});function Fm(e){const t=d.useRef(""),n=d.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:d.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function ss(e,t){const n=d.useRef(e),r=de(t);ie(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Bm(e,t){const n=de((s,i)=>{(typeof e=="function"?e():e)||t(i||(Yo?"touch":""))}),{onClick:r,onPointerDown:o}=Fm(n);return d.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function wd(e){const[t,n]=d.useState(null),r=Bm(e,n);return ss(e,o=>{o&&!e&&n(null)}),d.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function jm({...e}){return l.jsx(Id,{"data-slot":"sheet",...e})}function Mm({...e}){return l.jsx(ya,{"data-slot":"sheet-portal",...e})}function Pm({className:e,...t}){return l.jsx(qi,{"data-slot":"sheet-overlay",className:fe("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...t})}function Tm({className:e,children:t,side:n="right",showCloseButton:r=!0,...o}){return l.jsxs(Mm,{children:[l.jsx(Pm,{}),l.jsxs(xa,{"data-slot":"sheet-content","data-side":n,className:fe("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...o,children:[t,r&&l.jsxs(Qr,{"data-slot":"sheet-close",render:l.jsx(Oe,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[l.jsx(Hi,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Nm({className:e,...t}){return l.jsx("div",{"data-slot":"sheet-header",className:fe("flex flex-col gap-0.5 p-4",e),...t})}function _m({className:e,...t}){return l.jsx(Ca,{"data-slot":"sheet-title",className:fe("cn-font-heading text-base font-medium text-foreground",e),...t})}function Om({className:e,...t}){return l.jsx(ea,{"data-slot":"sheet-description",className:fe("text-sm text-muted-foreground",e),...t})}function qt({className:e,...t}){return l.jsx("div",{"data-slot":"skeleton",className:fe("animate-pulse rounded-md bg-muted",e),...t})}const kd=d.createContext(void 0);function zr(e){const t=d.useContext(kd);if(t===void 0&&!e)throw new Error(ot(72));return t}const Hm={...Aa,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 Lm extends Gr{constructor(t,n,r){const o=new Yr;super(Km(t,o,n,r),Wm(o),Hm)}setOpen=(t,n)=>{tm(this,t,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,Ce(Pn,t))}}function Km(e,t,n,r=!1){const o={...pa(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return o.floatingRootContext=ud(t,n,r),o}function Wm(e){return{popupRef:d.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const Qm=aa(function(t){const{disabled:n=!1,defaultOpen:r=!1,open:o,disableHoverablePopup:s=!1,trackCursorAxis:i="none",actionsRef:a,onOpenChange:c,onOpenChangeComplete:u,handle:f,triggerId:h,defaultTriggerId:g=null,children:A}=t,p=ad((F,T)=>new Lm({open:r,openProp:o,activeTriggerId:g,triggerIdProp:h},F,T));p.useControlledProp("openProp",o),p.useControlledProp("triggerIdProp",h),p.useContextCallback("onOpenChange",c),p.useContextCallback("onOpenChangeComplete",u);const m=p.useState("open"),x=!n&&m,v=p.useState("activeTriggerId"),b=p.useState("mounted"),y=p.useState("payload");p.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:s,disabled:n}),ua(p,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:C,transitionStatus:w}=da(x,p),I=p.useState("isInstantPhase"),S=p.useState("instantType"),R=p.useState("lastOpenChangeReason"),E=d.useRef(null);ie(()=>{m&&n&&p.setOpen(!1,Ce(fu))},[m,n,p]),ie(()=>{w==="ending"&&R===Mt||w!=="ending"&&I?(S!=="delay"&&(E.current=S),p.set("instantType","delay")):E.current!==null&&(p.set("instantType",E.current),E.current=null)},[w,I,R,S,p]),ie(()=>{x&&v==null&&p.set("payload",void 0)},[p,v,x]),d.useImperativeHandle(a,()=>({unmount:C,close:()=>p.setOpen(!1,Ce(Di))}),[C,p]);const k=x||b||!n&&i!=="none";return l.jsxs(kd.Provider,{value:p,children:[f&&l.jsx(la,{handle:f,store:p}),k&&l.jsx(Gm,{store:p,disabled:n,trackCursorAxis:i}),typeof A=="function"?A({payload:y}):A]})});function Gm({store:e,disabled:t,trackCursorAxis:n}){const r=e.useState("floatingRootContext"),o=Xo(r,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),s=qA(r,{enabled:!t&&n!=="none",axis:n==="none"?void 0:n}),i=d.useMemo(()=>Bt(s.reference,o.reference),[s.reference,o.reference]);return fa(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:o.floating??ct}),null}const Ym=d.createContext(void 0);function zm(){return d.useContext(Ym)}const Yl=600,Ed="data-base-ui-tooltip-trigger";function zl(e){if("composedPath"in e){const n=e.composedPath();for(let r=0;r<n.length;r+=1){const o=n[r];if(Pe(o))return o}}const t=e.target;return Pe(t)?t:null}function Um(e){let t=e;for(;t;){const n=t.closest(`[${Ed}]`);if(n)return n;const r=t.getRootNode();t="host"in r&&Pe(r.host)?r.host:null}return null}const Vm=sd(function(t,n){const{render:r,className:o,style:s,handle:i,payload:a,disabled:c,delay:u,closeOnClick:f=!0,closeDelay:h,id:g,...A}=t,p=zr(!0),x=fd(i)??p;if(!x)throw new Error(ot(82));const v=It(g),b=x.useState("isTriggerActive",v),y=x.useState("isOpenedByTrigger",v),C=x.useState("floatingRootContext"),w=d.useRef(null),I=u??Yl,S=h??0,{registerTrigger:R,isMountedByThisTrigger:E}=cd(v,w,x,{payload:a,closeOnClick:f,closeDelay:S}),k=zm(),{delayRef:F,isInstantPhase:T,hasProvider:N}=OA(C,{open:y}),M=ma(C);x.useSyncedValue("isInstantPhase",T);const D=x.useState("disabled"),L=c??D,_=tt(L),j=x.useState("trackCursorAxis"),H=x.useState("disableHoverablePopup"),P=d.useRef(!1),B=pt(),O=d.useRef(void 0);function G(){return N?er(F.current,"open")===0?0:u??k??Yl:I}function z(J){const ce=w.current;if(!ce||!J)return!1;const ue=Um(J);return ue!==null&&ue!==ce&&ve(ce,ue)}function U(J){const ce=z(J);return P.current=ce,ce&&(M.openChangeTimeout.clear(),M.restTimeout.clear(),M.restTimeoutPending=!1,B.clear()),ce}const Q=gd(C,{enabled:!L,mouseOnly:!0,move:!1,handleClose:!H&&j!=="both"?bd():null,restMs:G,delay(){return h==null&&N?{close:er(F.current,"close")}:{close:S}},triggerElementRef:w,isActiveTrigger:b,isClosing:()=>x.select("transitionStatus")==="ending",shouldOpen(){return!P.current}}),Z=pd(C,{enabled:!L}).reference,K=J=>{const ce=P.current,ue=zl(J),ge=U(ue),ae=w.current,pe=ae&&ue&&ve(ae,ue);if(ge&&x.select("open")&&x.select("lastOpenChangeReason")===at){x.setOpen(!1,Ce(at,J));return}if(ce&&!ge&&pe&&!_.current&&!x.select("open")&&ae&&mn(O.current)){const oe=()=>{!P.current&&!_.current&&!x.select("open")&&x.setOpen(!0,Ce(at,J,ae))},re=G();re===0?(B.clear(),oe()):B.start(re,oe)}},te=x.useState("triggerProps",E);return je("button",t,{state:{open:y},ref:[n,R,w],props:[Q,Z,E||j!=="none"?te:void 0,{onMouseOver(J){K(J.nativeEvent)},onFocus(J){z(zl(J.nativeEvent))&&J.preventBaseUIHandler()},onMouseLeave(){P.current=!1,B.clear(),O.current=void 0},onPointerEnter(J){O.current=J.pointerType},onPointerDown(J){O.current=J.pointerType,x.set("closeOnClick",f),f&&!x.select("open")&&x.cancelPendingOpen(J.nativeEvent)},onClick(J){f&&!x.select("open")&&x.cancelPendingOpen(J.nativeEvent)},id:v,"data-trigger-disabled":L?"":void 0,[Ed]:L?void 0:""},A],stateAttributesMapping:_u})}),Sd=d.createContext(void 0);function Zm(){const e=d.useContext(Sd);if(e===void 0)throw new Error(ot(70));return e}const Jm=d.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,style:a,...c}=t,{node:u,subtree:f}=Yu({container:o,ref:n,componentProps:t,elementProps:c});return!f&&!u?null:l.jsxs(d.Fragment,{children:[f,u&&sn.createPortal(r,u)]})}),$m=d.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return zr().useState("mounted")||r?l.jsx(Sd.Provider,{value:r,children:l.jsx(Jm,{ref:n,...o})}):null}),Rd=d.createContext(void 0);function Dd(){const e=d.useContext(Rd);if(e===void 0)throw new Error(ot(71));return e}const Xm=d.createContext(void 0);function is(){return d.useContext(Xm)?.direction??"ltr"}const qm=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:f=0,offsetParent:h="real"}=bn(e,t)||{};if(u==null)return{};const g=Iu(f),A={x:n,y:r},p=Ui(o),m=zi(p),x=await i.getDimensions(u),v=p==="y",b=v?"top":"left",y=v?"bottom":"right",C=v?"clientHeight":"clientWidth",w=s.reference[m]+s.reference[p]-A[p]-s.floating[m],I=A[p]-s.reference[p],S=h==="real"?await i.getOffsetParent?.(u):a.floating;let R=a.floating[C]||s.floating[m];(!R||!await i.isElement?.(S))&&(R=a.floating[C]||s.floating[m]);const E=w/2-I/2,k=R/2-x[m]/2-1,F=Math.min(g[b],k),T=Math.min(g[y],k),N=F,M=R-x[m]-T,D=R/2-x[m]/2+E,L=Cu(N,D,M),_=!c.arrow&&Cn(o)!=null&&D!==L&&s.reference[m]/2-(D<N?F:T)-x[m]/2<0,j=_?D<N?D-N:D-M:0;return{[p]:A[p]+j,data:{[p]:L,centerOffset:D-L-j,..._&&{alignmentOffset:j}},reset:_}}}),e0=(e,t)=>({...qm(e),options:[e,t]}),t0={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===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}}}},n0={sideX:"left",sideY:"top"},Ul="--available-width",Vl="--available-height";function Fd(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function Zl(e,t,n){const{rects:r,placement:o}=e;return{side:Fd(t,jt(o),n),align:Cn(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Ia(e){return r0(e,im)}function r0(e,t){const{anchor:n,positionMethod:r="absolute",side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,collisionBoundary:c,collisionPadding:u=5,sticky:f=!1,arrowPadding:h=5,disableAnchorTracking:g=!1,inline:A,keepMounted:p=!1,floatingRootContext:m,mounted:x,collisionAvoidance:v,shift:b,nodeId:y,adaptiveOrigin:C,lazyFlip:w=!1,externalTree:I}=e,[S,R]=d.useState(null);!x&&S!==null&&R(null);const E=v.side||"flip",k=v.align||"flip",F=v.fallbackAxisSide||"end",T=b?.crossAxis??!1,N=b?.rootBoundary,M=typeof n=="function"?n:void 0,D=de(M),L=M?D:n,_=tt(n),j=tt(x),P=is()==="rtl",B=S||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":P?"left":"right","inline-start":P?"right":"left"}[o],O=i==="center"?B:`${B}-${i}`;let G=u;typeof G=="number"?G={top:G,right:G,bottom:G,left:G}:G&&(G={top:G.top||0,right:G.right||0,bottom:G.bottom||0,left:G.left||0});const z=1,U=o==="bottom"?z:0,Q=o==="top"?z:0,Z=o==="right"?z:0,K=o==="left"?z:0,te={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:G},le=d.useRef(null),X=tt(s),ee=tt(a),J=typeof s!="function"?s:0,ce=typeof a!="function"?a:0,ue=[];A&&ue.push(A),ue.push(Tg(Re=>{const Ge=Zl(Re,o,P),_e=typeof X.current=="function"?X.current(Ge):X.current,Ze=typeof ee.current=="function"?ee.current(Ge):ee.current;return{mainAxis:_e,crossAxis:Ze,alignmentAxis:Ze}},[J,ce,P,o]));const ge=k==="none"&&E!=="shift",ae=!ge&&(f||T||E==="shift"),pe=E==="none"?null:Og({...te,padding:{top:G.top+z+U,right:G.right+z+K,bottom:G.bottom+z+Q,left:G.left+z+Z},mainAxis:!T&&E==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:F}),oe=ge?null:Ng({...te,rootBoundary:N,mainAxis:k!=="none",crossAxis:ae,limiter:f||T?void 0:_g(Re=>{if(!le.current)return{};const{width:Ge,height:_e}=le.current.getBoundingClientRect(),Ze=Ft(jt(Re.placement)),st=Ze==="y"?Ge:_e,ht=Ze==="y"?G.left+G.right:G.top+G.bottom;return{offset:st/2+ht/2}})},[te,f,T,N,G,k]);E==="shift"||k==="shift"||i==="center"?ue.push(oe,pe):ue.push(pe,oe),ue.push(Hg({...te,apply({elements:{floating:Re},availableWidth:Ge,availableHeight:_e,rects:Ze}){if(!j.current)return;const st=Re.style;st.setProperty(Ul,`${Ge}px`),st.setProperty(Vl,`${_e}px`);const ht=rt(Re).devicePixelRatio||1,{x:yt,y:dt,width:kt,height:Pt}=Ze.reference,Zt=(Math.round((yt+kt)*ht)-Math.round(yt*ht))/ht,Fe=(Math.round((dt+Pt)*ht)-Math.round(dt*ht))/ht;st.setProperty("--anchor-width",`${Zt}px`),st.setProperty("--anchor-height",`${Fe}px`)}}),e0(Re=>({element:le.current||Be(Re.elements.floating).createElement("div"),padding:h,offsetParent:"floating"}),[h]),{name:"transformOrigin",fn(Re){const{elements:Ge,middlewareData:_e,placement:Ze,rects:st,y:ht}=Re,yt=jt(Ze),dt=Ft(yt),kt=le.current,Pt=_e.arrow?.x||0,Zt=_e.arrow?.y||0,Fe=kt?.clientWidth||0,Ue=kt?.clientHeight||0,gt=Pt+Fe/2,Et=Zt+Ue/2,St=Math.abs(_e.shift?.y||0),it=st.reference.height/2,Rt=typeof s=="function"?s(Zl(Re,o,P)):s,cn=St>Rt,On={top:`${gt}px calc(100% + ${Rt}px)`,bottom:`${gt}px ${-Rt}px`,left:`calc(100% + ${Rt}px) ${Et}px`,right:`${-Rt}px ${Et}px`}[yt],kn=`${gt}px ${st.reference.y+it-ht}px`;return Ge.floating.style.setProperty("--transform-origin",ae&&dt==="y"&&cn?kn:On),{}}},t0,C),ie(()=>{!x&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[x,m]);const re=d.useMemo(()=>({elementResize:!g&&typeof ResizeObserver<"u",layoutShift:!g&&typeof IntersectionObserver<"u"}),[g]),{refs:se,elements:he,x:me,y:W,middlewareData:Y,update:ye,placement:q,context:ne,isPositioned:Ee,floatingStyles:Se}=t({rootContext:m,open:p?x:void 0,placement:O,middleware:ue,strategy:r,whileElementsMounted:p?void 0:(...Re)=>Bl(...Re,re),nodeId:y,externalTree:I}),{sideX:Le,sideY:Je}=Y.adaptiveOrigin||n0,We=Ee?r:"fixed",ut=d.useMemo(()=>{let Re;return Ee?C?Re={position:We,[Le]:me,[Je]:W}:Re={...Se,position:We}:Re={position:We,top:0,left:0},Re[Ul]="100vw",Re[Vl]="100vh",Ee||(Re.opacity=0),Re},[C,We,Le,me,Je,W,Se,Ee]),$e=d.useRef(null);ie(()=>{if(!x)return;const Re=_.current,Ge=typeof Re=="function"?Re():Re,Ze=(Jl(Ge)?Ge.current:Ge)||null||null;Ze!==$e.current&&(se.setPositionReference(Ze),$e.current=Ze)},[x,se,L,_]),d.useEffect(()=>{if(!x)return;const Re=_.current;typeof Re!="function"&&Jl(Re)&&Re.current!==$e.current&&(se.setPositionReference(Re.current),$e.current=Re.current)},[x,se,L,_]),d.useEffect(()=>{if(p&&x&&he.reference&&he.floating)return Bl(he.reference,he.floating,ye,re)},[p,x,he,ye,re]);const Ye=jt(q),mt=Fd(o,Ye,P),Ie=Cn(q)||"center",ze=!!Y.hide?.referenceHidden;ie(()=>{w&&x&&Ee&&Ye!==B&&R(Ye)},[w,x,Ee,Ye,B]);const Ne=d.useMemo(()=>({position:"absolute",top:Y.arrow?.y,left:Y.arrow?.x}),[Y.arrow]),nt=Y.arrow?.centerOffset!==0;return d.useMemo(()=>({positionerStyles:ut,arrowStyles:Ne,arrowRef:le,arrowUncentered:nt,side:mt,align:Ie,physicalSide:Ye,anchorHidden:ze,refs:se,context:ne,isPositioned:Ee,update:ye}),[ut,Ne,le,nt,mt,Ie,Ye,ze,se,ne,Ee,ye])}function Jl(e){return e!=null&&"current"in e}function as(e){return e==="starting"?GA:ct}function wa(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:a=!1}){const c={...n};return a&&(c.pointerEvents="none"),je("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:c},as(r),o],stateAttributesMapping:Wr})}const o0=d.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:a="top",align:c="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:h="clipping-ancestors",collisionPadding:g=5,arrowPadding:A=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:x=Wu,style:v,...b}=t,y=zr(),C=Zm(),w=y.useState("open"),I=y.useState("mounted"),S=y.useState("trackCursorAxis"),R=y.useState("disableHoverablePopup"),E=y.useState("floatingRootContext"),k=y.useState("instantType"),F=y.useState("transitionStatus"),T=y.useState("adaptiveOrigin"),N=Ia({anchor:s,positionMethod:i,floatingRootContext:E,mounted:I,side:a,sideOffset:u,align:c,alignOffset:f,collisionBoundary:h,collisionPadding:g,sticky:p,arrowPadding:A,disableAnchorTracking:m,keepMounted:C,collisionAvoidance:x,adaptiveOrigin:T}),M=d.useMemo(()=>({open:w,side:N.side,align:N.align,anchorHidden:N.anchorHidden,instant:S!=="none"?"tracking-cursor":k}),[w,N.side,N.align,N.anchorHidden,S,k]),D=wa(t,M,{styles:N.positionerStyles,transitionStatus:F,props:b,refs:[n,y.useStateSetter("positionerElement")],hidden:!I,inert:!w||S==="both"||R});return l.jsx(Rd.Provider,{value:N,children:D})}),s0=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=zr(),{side:c,align:u}=Dd(),f=a.useState("open"),h=a.useState("instantType"),g=a.useState("transitionStatus"),A=a.useState("popupProps"),p=a.useState("floatingRootContext"),m=a.useState("disabled"),x=a.useState("closeDelay");Yt({open:f,ref:a.context.popupRef,onComplete(){f&&a.context.onOpenChangeComplete?.(!0)}}),Ad(p,{enabled:!m,closeDelay:x});const v=a.useStateSetter("popupElement");return je("div",t,{state:{open:f,side:c,align:u,instant:h,transitionStatus:g},ref:[n,a.context.popupRef,v],props:[ts,A,as(g),i],stateAttributesMapping:Xi})}),i0=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=zr(),{arrowRef:c,side:u,align:f,arrowUncentered:h,arrowStyles:g}=Dd(),A=a.useState("open"),p=a.useState("instantType");return je("div",t,{state:{open:A,side:u,align:f,uncentered:h,instant:p},ref:[n,c],props:[{style:g,"aria-hidden":!0},i],stateAttributesMapping:Wr})});function a0(e){const[t,n]=d.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function ls({...e}){return l.jsx(Qm,{"data-slot":"tooltip",...e})}function cs({...e}){return l.jsx(Vm,{"data-slot":"tooltip-trigger",...e})}function us({className:e,side:t="top",sideOffset:n=4,align:r="center",alignOffset:o=0,children:s,...i}){return l.jsx($m,{children:l.jsx(o0,{align:r,alignOffset:o,side:t,sideOffset:n,className:"isolate z-50",children:l.jsxs(s0,{"data-slot":"tooltip-content",className:fe("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...i,children:[s,l.jsx(i0,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const l0="sidebar_state",c0=3600*24*7,u0="16rem",d0="18rem",f0="3rem",p0="b",Bd=d.createContext(null);function ds(){const e=d.useContext(Bd);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function h0({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:o,children:s,...i}){const a=RA(),[c,u]=d.useState(!1),[f,h]=d.useState(e),g=t??f,A=d.useCallback(v=>{const b=typeof v=="function"?v(g):v;n?n(b):h(b),document.cookie=`${l0}=${b}; path=/; max-age=${c0}`},[n,g]),p=d.useCallback(()=>a?u(v=>!v):A(v=>!v),[a,A,u]);d.useEffect(()=>{const v=b=>{b.key===p0&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),p())};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[p]);const m=g?"expanded":"collapsed",x=d.useMemo(()=>({state:m,open:g,setOpen:A,isMobile:a,openMobile:c,setOpenMobile:u,toggleSidebar:p}),[m,g,A,a,c,u,p]);return l.jsx(Bd.Provider,{value:x,children:l.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":u0,"--sidebar-width-icon":f0,...o},className:fe("group/sidebar-wrapper flex h-svh w-full has-data-[variant=inset]:bg-sidebar",r),...i,children:s})})}function A0({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:o,dir:s,...i}){const{isMobile:a,state:c,openMobile:u,setOpenMobile:f}=ds();return n==="none"?l.jsx("div",{"data-slot":"sidebar",className:fe("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",r),...i,children:o}):a?l.jsx(jm,{open:u,onOpenChange:f,...i,children:l.jsxs(Tm,{dir:s,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":d0},side:e,children:[l.jsxs(Nm,{className:"sr-only",children:[l.jsx(_m,{children:"Sidebar"}),l.jsx(Om,{children:"Displays the mobile sidebar."})]}),l.jsx("div",{className:"flex h-full w-full flex-col",children:o})]})}):l.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":c,"data-collapsible":c==="collapsed"?n:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[l.jsx("div",{"data-slot":"sidebar-gap",className:fe("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),l.jsx("div",{"data-slot":"sidebar-container","data-side":e,className:fe("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...i,children:l.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:o})})]})}function g0({className:e,...t}){const{toggleSidebar:n}=ds();return l.jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:n,title:"Toggle Sidebar",className:fe("absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})}function m0({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:fe("flex flex-col gap-2 p-2",e),...t})}function x0({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:fe("flex flex-col gap-2 p-2",e),...t})}function b0({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:fe("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function v0({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:fe("relative flex w-full min-w-0 flex-col p-2",e),...t})}function y0({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:fe("w-full text-sm",e),...t})}function Ms({className:e,...t}){return l.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:fe("flex w-full min-w-0 flex-col gap-0",e),...t})}function oo({className:e,...t}){return l.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:fe("group/menu-item relative",e),...t})}const C0=ki("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function kr({render:e,isActive:t=!1,variant:n="default",size:r="default",tooltip:o,className:s,...i}){const{isMobile:a,state:c}=ds(),u=hu({defaultTagName:"button",props:Bt({className:fe(C0({variant:n,size:r}),s)},i),render:o?l.jsx(cs,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:r,active:t}});return o?(typeof o=="string"&&(o={children:o}),l.jsxs(ls,{children:[u,l.jsx(us,{side:"right",align:"center",hidden:c!=="collapsed"||a,...o})]})):u}const jd=d.createContext(void 0);function Md(e){const t=d.useContext(jd);if(t===void 0&&!e)throw new Error(ot(33));return t}const Pd=d.createContext(void 0);function ir(e){const t=d.useContext(Pd);if(t===void 0&&!e)throw new Error(ot(36));return t}const I0=d.createContext(void 0);function ka(e=!0){const t=d.useContext(I0);if(t===void 0&&!e)throw new Error(ot(25));return t}function w0(e){const{closeOnClick:t,highlighted:n,id:r,nodeId:o,store:s,typingRef:i,itemRef:a,itemMetadata:c}=e,{events:u}=s.useState("floatingTreeRoot"),f=s.useState("open"),h=ka(!0),g=h!==void 0;return d.useMemo(()=>({id:r,role:"menuitem",tabIndex:f&&n?0:-1,onKeyDown(A){A.key===" "&&i?.current&&A.preventDefault()},onMouseMove(A){o&&u.emit("itemhover",{nodeId:o,target:A.currentTarget})},onClick(A){t&&u.emit("close",{domEvent:A,reason:Cr})},onMouseUp(A){if(h){const p=h.initialCursorPointRef.current;if(h.initialCursorPointRef.current=null,g&&p&&Math.abs(A.clientX-p.x)<=1&&Math.abs(A.clientY-p.y)<=1||g&&!Li&&A.button===2)return}a.current&&s.context.allowMouseUpTriggerRef.current&&(!g||A.button===2)&&c.type==="regular-item"&&Fi(a.current,A,{detail:1})}}),[t,n,r,u,o,f,s,i,a,h,g,c])}const k0={type:"regular-item"};function E0(e){const{closeOnClick:t,disabled:n,highlighted:r,id:o,store:s,typingRef:i=s.context.typingRef,nativeButton:a,itemMetadata:c,nodeId:u}=e,f=d.useRef(null),{getButtonProps:h,buttonRef:g}=Gt({disabled:n,focusableWhenDisabled:!0,native:a,composite:!0}),A=w0({closeOnClick:t,highlighted:r,id:o,nodeId:u,store:s,typingRef:i,itemRef:f,itemMetadata:c}),p=d.useCallback(x=>Bt(A,{onMouseEnter(){c.type==="submenu-trigger"&&c.setActive()}},x,h),[A,h,c]),m=Qt(f,g);return d.useMemo(()=>({getItemProps:p,itemRef:m}),[p,m])}const Td=d.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function S0(){return d.useContext(Td)}function fs(e={}){const{guess:t,label:n,metadata:r,textRef:o,index:s}=e,{register:i,unregister:a,subscribeMapChange:c,nextIndexRef:u}=S0(),f=d.useRef(-1),[h,g]=d.useState(s==null&&t?()=>{if(f.current===-1){const x=u.current;u.current+=1,f.current=x}return f.current}:-1),A=s??h,p=d.useRef(null),m=d.useCallback(x=>{const v=p.current;v&&a(v),p.current=x,x&&i(x,{metadata:r??null,index:s??null,label:n,textRef:o})},[s,i,a,r,n,o]);return ie(()=>{if(s==null)return c(x=>{const v=p.current?x.get(p.current)?.index:null;v!=null&&g(v)})},[s,c]),{ref:m,index:A}}const R0=d.forwardRef(function(t,n){const{render:r,className:o,id:s,label:i,nativeButton:a=!1,disabled:c=!1,closeOnClick:u=!0,style:f,...h}=t,g=fs({guess:!0,label:i}),A=Md(!0),p=It(s),{store:m}=ir(),x=m.useState("disabled"),v=c||x,b=m.useState("isActive",g.index),y=m.useState("itemProps"),{getItemProps:C,itemRef:w}=E0({closeOnClick:u,disabled:v,highlighted:b,id:p,store:m,nativeButton:a,nodeId:A?.context.nodeId,itemMetadata:k0});return je("div",t,{state:{disabled:v,highlighted:b},props:[y,h,C],ref:[w,n,g.ref]})}),D0=d.createContext(void 0);function Ea(e){return d.useContext(D0)}const F0=d.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...a}=t,{store:c}=ir(),{side:u,align:f}=Md(),h=Ea()!=null,g=c.useState("open"),A=c.useState("transitionStatus"),p=c.useState("popupProps"),m=c.useState("mounted"),x=c.useState("instantType"),v=c.useState("activeTriggerElement"),b=c.useState("parent"),y=c.useState("lastOpenChangeReason"),C=c.useState("rootId"),w=c.useState("floatingRootContext"),I=c.useState("floatingTreeRoot"),S=c.useState("closeDelay"),R=c.useState("hoverEnabled"),E=c.useState("disabled"),k=c.useState("openMethod"),F=b.type==="context-menu";Yt({open:g,ref:c.context.popupRef,onComplete(){g&&c.context.onOpenChangeComplete?.(!0)}}),d.useEffect(()=>{function L(_){c.setOpen(!1,Ce(_.reason,_.domEvent))}return I.events.on("close",L),()=>{I.events.off("close",L)}},[I.events,c]),Ad(w,{enabled:R&&!E&&!F&&b.type!=="menubar",closeDelay:S});const T=c.useStateSetter("popupElement"),N={transitionStatus:A,side:u,align:f,open:g,nested:b.type==="menu",instant:x},M=je("div",t,{state:N,ref:[n,c.context.popupRef,T],stateAttributesMapping:Xi,props:[p,{onKeyDown(L){h&&rs.has(L.key)&&L.stopPropagation()}},as(A),a,{"data-rootownerid":C}]});let D=b.type===void 0||F;return(v||b.type==="menubar"&&y!==Lo)&&(D=!0),l.jsx(sa,{context:w,openInteractionType:k,modal:F,disabled:!m,returnFocus:i===void 0?D:i,initialFocus:b.type!=="menu",restoreFocus:!0,externalTree:b.type!=="menubar"?I:void 0,previousFocusableElement:v,nextFocusableElement:b.type===void 0?c.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:b.type===void 0?c.context.beforeContentFocusGuardRef:void 0,children:M})}),Nd=d.createContext(void 0);function B0(){const e=d.useContext(Nd);if(e===void 0)throw new Error(ot(32));return e}const j0=d.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=ir();return s.useState("mounted")||r?l.jsx(Nd.Provider,{value:r,children:l.jsx(na,{ref:n,...o})}):null});function Ur(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=de(o),[,i]=d.useState(!1),a=Dt(P0).current,c=Dt(M0).current,u=d.useRef(0),f=d.useRef(!0),h=d.useRef([]),g=d.useRef(null),A=de(()=>{f.current||(f.current=!0,i(w=>!w))}),p=de((w,I)=>{c.set(w,I),A()}),m=de(w=>{c.delete(w),A()}),x=de(w=>{const I=new Map;return n.current.length=0,r&&(r.current.length=0),w.forEach(S=>{I.set(S.element,{...S.registration.metadata??{},index:S.index}),n.current[S.index]=S.element,r&&(r.current[S.index]=S.registration.label!==void 0?S.registration.label:S.registration.textRef?.current?.textContent??S.element.textContent)}),u.current=n.current.length,I});function v(w){if(g.current?.disconnect(),g.current=null,typeof MutationObserver!="function"||w.length<2)return;const I=new MutationObserver(R=>{if(!_0(R))return;let E=null;for(const k of w)if(k.isConnected){if(E&&_d(E,k)>0){I.disconnect(),A();return}E=k}});g.current=I;const S=new Set;for(let R=1;R<w.length;R+=1){const E=N0(w[R-1],w[R]);E&&S.add(E)}S.forEach(R=>I.observe(R,{childList:!0}))}const b=de(()=>{const[w,I]=T0(c),S=x(w);v(I),h.current=w,f.current=!1,a.forEach(R=>R(S)),s(S)});ie(()=>(f.current||x(h.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,x]),ie(()=>{f.current&&b()}),ie(()=>()=>{g.current?.disconnect(),f.current=!0},[]);const y=de(w=>(a.add(w),()=>{a.delete(w)})),C=d.useMemo(()=>({register:p,unregister:m,subscribeMapChange:y,nextIndexRef:u}),[p,m,y,u]);return l.jsx(Td.Provider,{value:C,children:t})}function M0(){return new Map}function P0(){return new Set}function T0(e){const t=new Set,n=[],r=[];e.forEach((s,i)=>{if(!i.isConnected)return;const a=s.index,c={index:a??-1,element:i,registration:s};a===null?r.push(c):a>=0&&(t.add(a),n.push(c))});let o=0;return r.sort((s,i)=>_d(s.element,i.element)),r.forEach(s=>{for(;t.has(o);)o+=1;s.index=o,n.push(s),o+=1}),t.size>0&&n.sort((s,i)=>s.index-i.index),[n,r.map(s=>s.element)]}function N0(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function _0(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 _d(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const O0=20;function Od(e,t,n,r){const[o,s]=d.useState(!1);ie(()=>{if(!e||!t||n==null){s(!1);return}const i=Be(n).documentElement.clientWidth,a=n.offsetWidth;s(i>0&&a>0&&a>=i-O0)},[e,t,n]),yd(e&&(!t||o),r)}const H0=d.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:a,align:c,sideOffset:u=0,alignOffset:f=0,collisionBoundary:h="clipping-ancestors",collisionPadding:g=5,arrowPadding:A=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:x=Ku,style:v,...b}=t,{store:y}=ir(),C=B0(),w=ka(!0),I=y.useState("parent"),S=y.useState("floatingRootContext"),R=y.useState("floatingTreeRoot"),E=y.useState("mounted"),k=y.useState("open"),F=y.useState("modal"),T=y.useState("openMethod"),N=y.useState("activeTriggerElement"),M=y.useState("transitionStatus"),D=y.useState("positionerElement"),L=y.useState("instantType"),_=y.useState("adaptiveOrigin"),j=y.useState("lastOpenChangeReason"),H=y.useState("floatingNodeId"),P=y.useState("floatingParentNodeId"),B=S.useState("domReferenceElement"),O=d.useRef(null),G=$i(D);let z=r,U=u,Q=f,Z=c,K=x;I.type==="context-menu"&&(z=r??I.context?.anchor,Z=Z??"start",!a&&Z!=="center"&&(Q=t.alignOffset??2,U=t.sideOffset??-5));let te=a,le=Z;I.type==="menu"?(te=te??"inline-end",le=le??"start",K=t.collisionAvoidance??Wu):I.type==="menubar"&&(te=te??(I.context.orientation==="vertical"?"inline-end":"bottom"),le=le??"start");const X=I.type==="context-menu",ee=Ia({anchor:z,floatingRootContext:S,positionMethod:w?"fixed":o,mounted:E,side:te,sideOffset:U,align:le,alignOffset:Q,arrowPadding:X?0:A,collisionBoundary:h,collisionPadding:g,sticky:p,nodeId:H,keepMounted:C,disableAnchorTracking:m,collisionAvoidance:K,shift:X?{crossAxis:!("side"in K&&K.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:R,adaptiveOrigin:_});d.useEffect(()=>{function re(se){se.open&&(se.parentNodeId===H&&y.set("hoverEnabled",!1),se.nodeId!==H&&se.parentNodeId===y.select("floatingParentNodeId")&&y.setOpen(!1,Ce(xr)))}return R.events.on("menuopenchange",re),()=>{R.events.off("menuopenchange",re)}},[y,R.events,H]),d.useEffect(()=>{if(y.select("floatingParentNodeId")==null)return;function re(se){if(se.open||se.nodeId!==y.select("floatingParentNodeId"))return;const he=se.reason??xr;y.setOpen(!1,Ce(he))}return R.events.on("menuopenchange",re),()=>{R.events.off("menuopenchange",re)}},[R.events,y]);const J=pt();d.useEffect(()=>{k||J.clear()},[k,J]),d.useEffect(()=>{function re(se){if(!(!k||se.nodeId!==y.select("floatingParentNodeId")))if(se.target&&N&&N!==se.target){const he=y.select("closeDelay");he>0?J.isStarted()||J.start(he,()=>{y.setOpen(!1,Ce(xr))}):y.setOpen(!1,Ce(xr))}else J.clear()}return R.events.on("itemhover",re),()=>{R.events.off("itemhover",re)}},[R.events,k,N,y,J]),d.useEffect(()=>{const re={open:k,nodeId:H,parentNodeId:P,reason:y.select("lastOpenChangeReason")};R.events.emit("menuopenchange",re)},[R.events,k,y,H,P]),ie(()=>{const re=B,se=O.current;if(re&&(O.current=re),se&&re&&re!==se){y.set("instantType",void 0);const he=new AbortController;return G(()=>{y.set("instantType","trigger-change")},he.signal),()=>{he.abort()}}},[B,G,y]);const ce={open:k,side:ee.side,align:ee.align,anchorHidden:ee.anchorHidden,nested:I.type==="menu",instant:L},ue=I.type==="menubar"&&I.context.modal;Od(k&&(ue||F&&j!==at),T==="touch",D,N);const ae=wa(t,ce,{styles:ee.positionerStyles,transitionStatus:M,props:b,refs:[n,y.useStateSetter("positionerElement")],hidden:!E,inert:!k}),pe=E&&I.type!=="menu"&&(I.type!=="menubar"&&F&&j!==at||I.type==="menubar"&&I.context.modal);let oe=null;return I.type==="menubar"?oe=I.context.contentElement:I.type===void 0&&(oe=N),l.jsxs(jd.Provider,{value:ee,children:[pe&&l.jsx(va,{ref:I.type==="context-menu"||I.type==="nested-context-menu"?I.context.internalBackdropRef:null,inert:ba(!k),cutout:oe}),l.jsx(VA,{id:H,children:l.jsx(Ur,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,children:ae})})]})}),L0=d.createContext(null);function Hd(e){return d.useContext(L0)}const K0={...Aa,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 W0 extends Gr{constructor(t){super({...G0(),...t},Q0(),K0),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){let r=n.store.select("rootId"),o=n.store.select("floatingTreeRoot"),s=n.store.select("keyboardEventRelay");this.unsubscribeParentListener=n.store.subscribe(()=>{const i=n.store.select("rootId"),a=n.store.select("floatingTreeRoot"),c=n.store.select("keyboardEventRelay");r===i&&o===a&&s===c||(r=i,o=a,s=c,this.notifyAll())}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}unsubscribeParentListener=null}function Q0(){return{positionerRef:d.createRef(),popupRef:d.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:d.createRef(),beforeContentFocusGuardRef:d.createRef(),onOpenChangeComplete:void 0,triggerElements:new Yr}}function G0(){return{...pa(),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 ra,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:ct,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}const Y0=d.createContext(void 0);function z0(){return d.useContext(Y0)}const U0=aa(function(t){const{children:n,open:r,onOpenChange:o,onOpenChangeComplete:s,defaultOpen:i=!1,disabled:a=!1,modal:c,loopFocus:u=!0,orientation:f="vertical",actionsRef:h,closeParentOnEsc:g=!1,handle:A,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:x=!0}=t,v=ka(!0),b=ir(!0),y=Hd(!0),C=z0(),w=d.useMemo(()=>C&&b?{type:"menu",store:b.store}:y?{type:"menubar",context:y}:v&&!b?{type:"context-menu",context:v}:{type:void 0},[v,b,y,C]),I=V0({open:i,openProp:r,activeTriggerId:m,triggerIdProp:p,parent:w});I.useControlledProp("openProp",r),I.useControlledProp("triggerIdProp",p),I.useContextCallback("onOpenChangeComplete",s);const S=Jn(),R=Jn(),E=I.useState("floatingTreeRoot"),k=Zu(E),F=In(),T=I.useState("open"),N=I.useState("activeTriggerElement"),M=I.useState("positionerElement"),D=I.useState("hoverEnabled"),L=I.useState("disabled"),_=I.useState("lastOpenChangeReason"),j=I.useState("parent"),H=I.useState("activeIndex"),P=I.useState("payload"),B=I.useState("floatingParentNodeId"),O=d.useRef(null),G=d.useRef(j.type!=="context-menu"),z=pt(),U=d.useRef(!0),Q=pt(),Z=B!=null,{openMethod:K,triggerProps:te}=wd(T);I.useSyncedValues({disabled:a,highlightItemOnHover:x,modal:j.type===void 0?c:void 0,openMethod:K,rootId:S}),ua(I);const{forceUnmount:le}=da(T,I,()=>{I.set("allowMouseEnter",!1)});ie(()=>{v&&!b?I.update({parent:{type:"context-menu",context:v},floatingNodeId:k,floatingParentNodeId:F}):b&&I.update({floatingNodeId:k,floatingParentNodeId:F})},[v,b,k,F,I]),d.useEffect(()=>{if(T||(O.current=null),j.type==="context-menu"){if(!T){z.clear(),G.current=!1;return}z.start(500,()=>{G.current=!0})}},[z,T,j.type]),ie(()=>{!T&&!D&&I.set("hoverEnabled",!0)},[T,D,I]);const X=de((ne,Ee)=>{const Se=Ee.reason;if(!ne&&!I.select("open")||T===ne&&Ee.trigger===N&&_===Se)return;const Le=ld(Ee);if(!ne&&Ee.trigger==null&&(Ee.trigger=N??void 0),o?.(ne,Ee),Ee.isCanceled)return;I.state.floatingRootContext.dispatchOpenChange(ne,Ee);const Je=Ee.event;if(ne===!1&&Je?.type==="click"&&Je.pointerType==="touch"&&!U.current)return;ne&&Se===Yn?(U.current=!1,Q.start(300,()=>{U.current=!0})):(U.current=!0,Q.clear());const We=(Se===Pn||Se===Cr)&&Je.detail===0,ut=!ne&&(Se===Ko||Se==null),$e={open:ne,openChangeReason:Se};O.current=Ee.event,ca($e,ne,Ee.trigger,Le()),I.update($e),j.type==="menubar"&&(Se===Yn||Se===Bn||Se===at||Se===Js||Se===xr)?I.set("instantType","group"):We||ut?I.set("instantType",We?"click":"dismiss"):I.set("instantType",void 0)}),ee=id({popupStore:I,floatingId:R,nested:F!=null,onOpenChange:X}),J=ee.context.events;ie(()=>{const ne=({open:Ee,eventDetails:Se})=>X(Ee,Se);return J.on("setOpen",ne),()=>{J?.off("setOpen",ne)}},[J,X]);const ce=d.useCallback(()=>{I.setOpen(!1,Ce(Di))},[I]);d.useImperativeHandle(h,()=>({unmount:le,close:ce}),[le,ce]);let ue;j.type==="context-menu"&&(ue=j.context),d.useImperativeHandle(ue?.positionerRef,()=>M,[M]),d.useImperativeHandle(ue?.actionsRef,()=>({setOpen:X}),[X]);const ge=Xo(ee,{enabled:!L,bubbles:{escapeKey:g&&j.type==="menu"},outsidePress(){return j.type!=="context-menu"||O.current?.type==="contextmenu"?!0:G.current},externalTree:Z?E:void 0}),ae=is(),pe=d.useCallback(ne=>{I.select("activeIndex")!==ne&&I.set("activeIndex",ne)},[I]),oe=md(ee,{enabled:!L,listRef:I.context.itemDomElements,activeIndex:H,nested:j.type!==void 0,loopFocus:u,orientation:f,parentOrientation:j.type==="menubar"?j.context.orientation:void 0,rtl:ae==="rtl",disabledIndices:Nt,onNavigate:pe,openOnArrowKeyDown:j.type!=="context-menu",externalTree:Z?E:void 0,focusItemOnHover:x}),re=d.useCallback(ne=>{I.context.typingRef.current=ne},[I]),se=xd(ee,{enabled:!L,listRef:I.context.itemLabels,elementsRef:I.context.itemDomElements,activeIndex:H,resetMs:WA,onMatch:ne=>{T&&ne!==H&&I.set("activeIndex",ne)},onTyping:re}),he=d.useMemo(()=>{const ne=Bt(se.reference,oe.reference,ge.reference,{onMouseMove(){I.set("allowMouseEnter",!0)}},te);return ne["aria-haspopup"]="menu",ne["aria-expanded"]=T,ne},[I,se.reference,oe.reference,ge.reference,te,T]),me=d.useMemo(()=>{const ne=Bt(oe.trigger,ge.trigger,te);return ne["aria-haspopup"]="menu",ne["aria-expanded"]=!1,ne},[oe.trigger,ge.trigger,te]),W=d.useMemo(()=>Bt(ts,{id:R,role:"menu","aria-labelledby":N?.id,onMouseMove(){I.set("allowMouseEnter",!0),j.type==="menu"&&I.set("hoverEnabled",!1)},onClick(){I.select("hoverEnabled")&&I.set("hoverEnabled",!1)},onKeyDown(ne){const Ee=I.select("keyboardEventRelay");Ee&&!ne.isPropagationStopped()&&Ee(ne)}},se.floating,oe.floating,ge.floating),[N,R,j.type,I,se.floating,oe.floating,ge.floating]),Y=oe.item??ct;fa(I,{floatingRootContext:ee,activeTriggerProps:he,inactiveTriggerProps:me,popupProps:W,itemProps:Y});const ye=d.useMemo(()=>({store:I,parent:w}),[I,w]),q=l.jsxs(Pd.Provider,{value:ye,children:[A&&l.jsx(la,{handle:A,store:I}),typeof n=="function"?n({payload:P}):n]});return j.type===void 0||j.type==="context-menu"?l.jsx(ZA,{externalTree:E,children:q}):q});function V0(e){return Dt(()=>new W0(e)).current}const so=5;function Ld(e,t){const n=Z0(t);return e.clientX>=n.left-so&&e.clientX<=n.right+so&&e.clientY>=n.top-so&&e.clientY<=n.bottom+so}function Z0(e){const t=e.getBoundingClientRect(),n=rt(e);if(Ki)return t;const r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const i=parseFloat(r.width)||0,a=parseFloat(r.height)||0,c=parseFloat(o.width)||0,u=parseFloat(o.height)||0,f=Math.max(t.width,i,c),h=Math.max(t.height,a,u),g=f-t.width,A=h-t.height;return{left:t.left-g/2,right:t.right+g/2,top:t.top-A/2,bottom:t.bottom+A/2}}function Kd(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Bi(),{ref:o,index:s}=fs(e),i=n===s,a=d.useRef(null),c=Qt(o,a);return{compositeProps:{tabIndex:i?0:-1,onFocus(){r(s)},onMouseMove(){const f=a.current;if(!t||!f)return;const h=f.hasAttribute("disabled")||f.ariaDisabled==="true";!i&&!h&&f.focus()}},compositeRef:c,index:s}}function Wd(e){const{render:t,className:n,style:r,state:o=ct,props:s=Nt,refs:i=Nt,metadata:a,stateAttributesMapping:c,tag:u="div",...f}=e,{compositeProps:h,compositeRef:g}=Kd({metadata:a});return je(u,e,{state:o,ref:[g,...i],props:[h,...s,f],stateAttributesMapping:c})}function Qd(e){if(Xe(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!Dn(e))return Qd($n(e))}function J0(e,t){const n=d.useRef(null);function r(s){sn.flushSync(()=>{e.setOpen(!1,Ce(Bn,s.nativeEvent,s.currentTarget))}),mA(n.current)?.focus()}function o(s){const i=e.select("positionerElement");if(i&&zn(s,i))e.context.beforeContentFocusGuardRef.current?.focus();else{sn.flushSync(()=>{e.setOpen(!1,Ce(Bn,s.nativeEvent,s.currentTarget))});let a=gA(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&ve(i,a);){const c=a;if(a=Zi(a),a===c)break}a?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:o}}function $0(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,o=d.useRef(!1);return d.useMemo(()=>t?{onMouseDown:s=>{(n==="open"&&!r||n==="close"&&r)&&(o.current=!0,Be(s.currentTarget).addEventListener("click",()=>{o.current=!1},{once:!0}))},onClick:s=>{o.current&&(o.current=!1,s.preventBaseUIHandler())}}:ct,[t,n,r])}const X0=sd(function(t,n){const{render:r,className:o,style:s,disabled:i=!1,nativeButton:a=!0,id:c,openOnHover:u,delay:f=100,closeDelay:h=0,handle:g,payload:A,...p}=t,m=ir(!0),v=fd(g)??m?.store;if(!v)throw new Error(ot(85));const b=It(c),y=v.useState("isTriggerActive",b),C=v.useState("floatingRootContext"),w=v.useState("isOpenedByTrigger",b),I=v.useState("triggerPopupId",b),S=d.useRef(null),R=ex(),E=Bi(!0),k=wn(),F=d.useMemo(()=>k??new ra,[k]),T=Zu(F),N=In(),{registerTrigger:M,isMountedByThisTrigger:D}=cd(b,S,v,{payload:A,closeDelay:h,parent:R,floatingTreeRoot:F,floatingNodeId:T,floatingParentNodeId:N,keyboardEventRelay:E?.relayKeyboardEvent}),L=R.type==="menubar",_=v.useState("disabled"),j=i||_||L&&R.context.disabled,{getButtonProps:H,buttonRef:P}=Gt({disabled:j,native:a});d.useEffect(()=>{!w&&R.type===void 0&&(v.context.allowMouseUpTriggerRef.current=!1)},[v,w,R.type]);const B=d.useRef(null),O=pt(),G=de(re=>{if(!B.current)return;O.clear(),v.context.allowMouseUpTriggerRef.current=!1;const se=re.target;ve(B.current,se)||ve(v.select("positionerElement"),se)||se===B.current||se!=null&&Qd(se)===v.select("rootId")||Ld(re,B.current)||F.events.emit("close",{domEvent:re,reason:pu})});d.useEffect(()=>{w&&v.select("lastOpenChangeReason")===at&&Be(B.current).addEventListener("mouseup",G,{once:!0})},[w,G,v]);const z=L&&R.context.hasSubmenuOpen,Q=gd(C,{enabled:(u??z)&&!j&&(!L||z&&!D),handleClose:bd({blockPointerEvents:!L}),mouseOnly:!0,move:!1,restMs:R.type===void 0?f:void 0,delay:{close:h},triggerElementRef:S,externalTree:F,isActiveTrigger:y,isClosing:()=>v.select("transitionStatus")==="ending"}),Z=q0(w,v.select("lastOpenChangeReason")),K=Ju(C,{enabled:!j,event:w&&L?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:R.type===void 0?Z:!1}),te=pd(C,{enabled:!j&&z}),le=$0({open:w,enabled:L,mouseDownAction:"open"}),X=d.useMemo(()=>Bt(te.reference,K.reference),[te.reference,K.reference]),ee=v.useState("triggerProps",D),{preFocusGuardRef:J,handlePreFocusGuardFocus:ce,handleFocusTargetFocus:ue}=J0(v,S),ge={disabled:j,open:w},ae=[B,n,P,M,S],pe=[X,Q??ct,ee,{"aria-haspopup":"menu","aria-controls":I,id:b,onMouseDown:re=>{if(v.select("open"))return;O.start(200,()=>{v.context.allowMouseUpTriggerRef.current=!0}),Be(re.currentTarget).addEventListener("mouseup",G,{once:!0})}},L?{role:"menuitem"}:{},le,p,H],oe=je("button",t,{enabled:!L,stateAttributesMapping:oi,state:ge,ref:ae,props:pe});return L?l.jsx(Wd,{tag:"button",render:r,className:o,style:s,state:ge,refs:ae,props:pe,stateAttributesMapping:oi}):w?l.jsxs(d.Fragment,{children:[l.jsx(tr,{ref:J,onFocus:ce},`${b}-pre-focus-guard`),l.jsx(d.Fragment,{children:oe},b),l.jsx(tr,{ref:v.context.triggerFocusTargetRef,onFocus:ue},`${b}-post-focus-guard`)]}):l.jsx(d.Fragment,{children:oe},b)});function q0(e,t){const n=pt(),[r,o]=d.useState(!1);return ie(()=>{e&&t===at?(o(!0),n.start(QA,()=>{o(!1)})):e||(n.clear(),o(!1))},[e,t,n]),r}function ex(){const e=Hd();return d.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}function Gd(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Do({...e}){return l.jsx(U0,{"data-slot":"dropdown-menu",...e})}function Fo({...e}){return l.jsx(X0,{"data-slot":"dropdown-menu-trigger",...e})}function Bo({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:o,...s}){return l.jsx(j0,{children:l.jsx(H0,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:l.jsx(F0,{"data-slot":"dropdown-menu-content",className:fe("cn-menu-target cn-menu-translucent z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",o),...s})})})}function jo({className:e,inset:t,variant:n="default",...r}){return l.jsx(R0,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:fe("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}const Mo=["zh-CN","ja","ko","en","ar","fr","es","de","ru"],tx=["ar"],Yd=e=>tx.includes(e)?"rtl":"ltr",nx=e=>({"zh-CN":"简体中文",ja:"日本語",ko:"한국어",en:"English",ar:"العربية",fr:"Français",es:"Español",de:"Deutsch",ru:"Русский"})[e],rx=e=>{for(const t of e){const n=t.toLowerCase(),r=Mo.find(i=>i.toLowerCase()===n);if(r!==void 0)return r;const o=n.split("-")[0],s=Mo.find(i=>i.toLowerCase().split("-")[0]===o);if(s!==void 0)return s;if(o==="zh")return"zh-CN"}return"en"},$t={nav:{add:"Add",applications:"Applications",help:"Help Center"},shell:{product:"create-opentray",toggleSidebar:"Toggle Sidebar"},common:{loading:"Loading…",error:"Something went wrong.",retry:"Retry",cancel:"Cancel",confirm:"Confirm",close:"Close",copy:"Copy",copied:"Copied",download:"Download",refresh:"Refresh",empty:"Nothing here yet."},theme:{title:"Theme",system:"System",light:"Light",dark:"Dark"},language:{title:"Language"},applications:{title:"Applications",statusHealthy:"Healthy",statusInvalidConfig:"Invalid config",statusIncompatible:"Incompatible version",statusMissingPayload:"Missing payload",statusBrokenLink:"Broken link",statusRunning:"Running",edit:"Edit",open:"Open",share:"Share",details:"Details",source:"Source",sourceWizard:"Wizard",sourceRegistered:"Registered",detailsCommand:"Command",detailsCwd:"Working directory",detailsEnv:"Environment keys",detailsPm:"Package manager",detailsWindow:"Window",detailsDevMode:"Developer mode",detailsProjectDir:"Project directory",detailsServiceHint:"Service port hint",uninstall:"Uninstall",uninstallTitle:"Uninstall application?",uninstallDescription:"The registration and its payload link are removed. Dock/taskbar pins must be removed manually.",uninstallWizardDescription:"The wizard project directory and its materialized app bundle are removed after stopping a running entry when authorized. Dock/taskbar pins must be removed manually.",stopRunningTitle:"Force stop and uninstall?",stopRunningDescription:"The application is still running (likely a leftover from an earlier session). Continuing terminates its process tree first, then removes the project.",stopRunningConfirm:"Force stop and uninstall",stopRunningPids:"Running pids",uninstallPurge:"Also delete the linked external target",uninstallPurgeHint:"Deletes the external directory itself after identity revalidation. This cannot be undone.",uninstallPinHint:"macOS Dock pins and Windows taskbar pins are user-managed; remove them manually if present.",emptyHint:"No applications yet — create one from Add.",payload:"Payload",registration:"Registration",linked:"Linked",uninstallRetained:"External target retained:",uninstallDeleted:"External target deleted:"},help:{title:"Help Center",listTitle:"Documents",empty:"No documents available.",readError:"This document could not be read."},export:{title:"Export",shareTitle:"Share application",shareSubtitle:"Built from the current wizard parameters — nothing runs, nothing is written.",command:"Direct command",scriptSh:"Shell script (.sh)",scriptPs1:"PowerShell script (.ps1)",copyCommand:"Copy command",downloadScript:"Download script",downloadFile:"Download file",viewFull:"View full content",building:"Building…",inlineIcon:"Inline icon bytes",inlineIconHint:"Web-scraped icons share as their original URL by default and local icons embed their bytes; toggle to switch between embedding and sharing by reference.",forceCopy:"Force direct copy with embedded icon",forceCopyHint:"Uploaded icons embed as very long data URLs. Scripts are the default; check this only if you accept the length.",envAck:"I reviewed the environment values and accept exporting them",envAckHint:"This application defines environment entries. Complete export includes their values.",envReview:"Environment values (editable before export)",blocked:"Export blocked:"}},un=(e,t)=>{const n=(r,o)=>{if(typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof o=="object"&&o!==null){const s={...r};for(const[i,a]of Object.entries(o))a!==void 0&&(s[i]=n(r[i],a));return s}return o===void 0?r:o};return n(e,t)},ox={shell:{product:"create-opentray",toggleSidebar:"切换侧边栏"},nav:{add:"新增",applications:"应用列表",help:"帮助中心"},common:{loading:"加载中…",error:"出错了。",retry:"重试",cancel:"取消",confirm:"确认",close:"关闭",copy:"复制",copied:"已复制",download:"下载",refresh:"刷新",empty:"暂无内容。"},theme:{title:"主题",system:"跟随系统",light:"浅色",dark:"深色"},language:{title:"语言"},applications:{title:"应用列表",statusHealthy:"正常",statusInvalidConfig:"配置无效",statusIncompatible:"版本不兼容",statusMissingPayload:"负载缺失",statusBrokenLink:"链接失效",statusRunning:"运行中",edit:"编辑",open:"打开应用",share:"分享",details:"详情",source:"来源",sourceWizard:"向导",sourceRegistered:"注册",detailsCommand:"命令",detailsCwd:"工作目录",detailsEnv:"环境变量键",detailsPm:"包管理器",detailsWindow:"窗口",detailsDevMode:"开发者模式",detailsProjectDir:"项目目录",detailsServiceHint:"服务端口提示",uninstall:"卸载",uninstallTitle:"卸载应用?",uninstallDescription:"将删除注册信息与负载链接。Dock/任务栏图标需手动移除。",uninstallWizardDescription:"将停止运行中的应用(如已授权)并删除项目目录与已物化的应用 Bundle。Dock/任务栏图标需手动移除。",stopRunningTitle:"强制停止并卸载?",stopRunningDescription:"应用仍在运行(可能是上次会话的残留)。继续将先终止其进程树,再删除项目目录与已物化的 Bundle。",stopRunningConfirm:"强制停止并卸载",stopRunningPids:"运行中的进程",uninstallPurge:"同时删除链接的外部目录",uninstallPurgeHint:"重新校验身份后删除外部目录本身,此操作不可撤销。",uninstallPinHint:"macOS Dock 与 Windows 任务栏图标由系统管理,请手动移除。",emptyHint:"还没有应用——去「新增」创建一个。",payload:"负载",registration:"注册",linked:"链接",uninstallRetained:"外部目录已保留:",uninstallDeleted:"外部目录已删除:"},help:{title:"帮助中心",listTitle:"文档",empty:"暂无文档。",readError:"无法读取该文档。"},export:{title:"导出",shareTitle:"分享应用",shareSubtitle:"基于当前向导参数构建——不运行命令、不写入任何内容。",command:"直接命令",scriptSh:"Shell 脚本(.sh)",scriptPs1:"PowerShell 脚本(.ps1)",copyCommand:"复制命令",downloadScript:"下载脚本",downloadFile:"下载文件",viewFull:"查看完整内容",building:"生成中…",inlineIcon:"内联图标字节",inlineIconHint:"网页抓取的图标默认以原始链接分享、本地图标默认内嵌字节;勾选状态即在内嵌与按引用分享之间切换。",forceCopy:"强制直接复制(内嵌图标)",forceCopyHint:"上传的图标会以很长的 data URL 内嵌,默认导出脚本;仅在你接受长度时勾选。",envAck:"我已检查环境变量并接受导出",envAckHint:"该应用定义了环境变量,完整导出将包含其值。",envReview:"环境变量(导出前可编辑)",blocked:"导出被阻止:"}},sx={shell:{product:"create-opentray",toggleSidebar:"サイドバー切替"},nav:{add:"追加",applications:"アプリ一覧",help:"ヘルプセンター"},common:{loading:"読み込み中…",error:"エラーが発生しました。",retry:"再試行",cancel:"キャンセル",confirm:"確認",close:"閉じる",copy:"コピー",copied:"コピーしました",download:"ダウンロード",refresh:"更新",empty:"まだ何もありません。"},theme:{title:"テーマ",system:"システム",light:"ライト",dark:"ダーク"},language:{title:"言語"},applications:{title:"アプリ一覧",statusHealthy:"正常",statusInvalidConfig:"設定が無効",statusIncompatible:"バージョン非対応",statusMissingPayload:"ペイロード欠落",statusBrokenLink:"リンク切れ",statusRunning:"実行中",edit:"編集",uninstall:"アンインストール",uninstallTitle:"アプリをアンインストールしますか?",uninstallDescription:"登録とペイロードリンクを削除します。Dock/タスクバーのピンは手動で外してください。",uninstallPurge:"リンク先の外部ディレクトリも削除する",uninstallPurgeHint:"身份を再検証した上で外部ディレクトリ自体を削除します。元に戻せません。",uninstallPinHint:"macOS の Dock ピンと Windows のタスクバーピンは手動で管理してください。",emptyHint:"登録済みアプリはまだありません。「追加」から作成してください。",payload:"ペイロード",registration:"登録",linked:"リンク",uninstallRetained:"外部ディレクトリは保持されました:",uninstallDeleted:"外部ディレクトリを削除しました:"},help:{title:"ヘルプセンター",listTitle:"ドキュメント",empty:"ドキュメントはありません。",readError:"このドキュメントは読み込めませんでした。"},export:{title:"エクスポート",command:"直接コマンド",scriptSh:"Shell スクリプト(.sh)",scriptPs1:"PowerShell スクリプト(.ps1)",copyCommand:"コマンドをコピー",downloadScript:"スクリプトをダウンロード",forceCopy:"アイコン埋め込みの直接コピーを強制する",forceCopyHint:"アップロードしたアイコンは非常に長い data URL として埋め込まれます。既定はスクリプトです。",envAck:"環境変数を確認し、エクスポートを許可します",envAckHint:"このアプリには環境変数が定義されており、完全なエクスポートに値が含まれます。",envReview:"環境変数(エクスポート前に編集可)",blocked:"エクスポートをブロック:"}},ix={shell:{product:"create-opentray",toggleSidebar:"사이드바 전환"},nav:{add:"추가",applications:"앱 목록",help:"도움말 센터"},common:{loading:"불러오는 중…",error:"문제가 발생했습니다.",retry:"재시도",cancel:"취소",confirm:"확인",close:"닫기",copy:"복사",copied:"복사됨",download:"다운로드",refresh:"새로고침",empty:"아직 없습니다."},theme:{title:"테마",system:"시스템",light:"라이트",dark:"다크"},language:{title:"언어"},applications:{title:"앱 목록",statusHealthy:"정상",statusInvalidConfig:"구성 무효",statusIncompatible:"버전 비호환",statusMissingPayload:"페이로드 누락",statusBrokenLink:"링크 끊김",statusRunning:"실행 중",edit:"편집",uninstall:"제거",uninstallTitle:"앱을 제거할까요?",uninstallDescription:"등록 정보와 페이로드 링크가 삭제됩니다. Dock/작업표시줄 고정은 직접 해제하세요.",uninstallPurge:"연결된 외부 디렉터리도 삭제",uninstallPurgeHint:"신원 재검증 후 외부 디렉터리 자체를 삭제합니다. 되돌릴 수 없습니다.",uninstallPinHint:"macOS Dock 고정과 Windows 작업표시줄 고정은 직접 관리해야 합니다.",emptyHint:"등록된 앱이 아직 없습니다. 「추가」에서 만들어 보세요.",payload:"페이로드",registration:"등록",linked:"링크",uninstallRetained:"외부 디렉터리 유지됨:",uninstallDeleted:"외부 디렉터리 삭제됨:"},help:{title:"도움말 센터",listTitle:"문서",empty:"문서가 없습니다.",readError:"이 문서를 읽을 수 없습니다."},export:{title:"내보내기",command:"직접 명령",scriptSh:"Shell 스크립트(.sh)",scriptPs1:"PowerShell 스크립트(.ps1)",copyCommand:"명령 복사",downloadScript:"스크립트 다운로드",forceCopy:"아이콘 포함 직접 복사 강제",forceCopyHint:"업로드한 아이콘은 매우 긴 data URL로 포함됩니다. 기본은 스크립트입니다.",envAck:"환경 변수를 확인했으며 내보내기를 허용합니다",envAckHint:"이 앱에는 환경 변수가 정의되어 있어 전체 내보내기에 값이 포함됩니다.",envReview:"환경 변수(내보내기 전 편집 가능)",blocked:"내보내기 차단:"}},ax={shell:{product:"create-opentray",toggleSidebar:"تبديل الشريط الجانبي"},nav:{add:"إضافة",applications:"التطبيقات",help:"مركز المساعدة"},common:{loading:"جارٍ التحميل…",error:"حدث خطأ.",retry:"إعادة المحاولة",cancel:"إلغاء",confirm:"تأكيد",close:"إغلاق",copy:"نسخ",copied:"تم النسخ",download:"تنزيل",refresh:"تحديث",empty:"لا يوجد شيء بعد."},theme:{title:"المظهر",system:"النظام",light:"فاتح",dark:"داكن"},language:{title:"اللغة"},applications:{title:"التطبيقات",statusHealthy:"سليم",statusInvalidConfig:"تهيئة غير صالحة",statusIncompatible:"إصدار غير متوافق",statusMissingPayload:"الحِمل مفقود",statusBrokenLink:"رابط معطّل",statusRunning:"قيد التشغيل",edit:"تحرير",uninstall:"إزالة",uninstallTitle:"إزالة التطبيق؟",uninstallDescription:"سيُحذف التسجيل ورابط الحِمل. يجب إزالة تثبيت Dock/شريط المهام يدويًا.",uninstallPurge:"حذف الدليل الخارجي المرتبط أيضًا",uninstallPurgeHint:"يحذف الدليل الخارجي نفسه بعد إعادة التحقق من الهوية. لا يمكن التراجع.",uninstallPinHint:"تثبيتات Dock في macOS وشريط المهام في Windows يديرها المستخدم؛ أزلها يدويًا.",emptyHint:"لا توجد تطبيقات مسجلة بعد — أنشئ واحدًا من «إضافة».",payload:"الحِمل",registration:"التسجيل",linked:"مرتبط",uninstallRetained:"احتُفظ بالدليل الخارجي:",uninstallDeleted:"حُذف الدليل الخارجي:"},help:{title:"مركز المساعدة",listTitle:"المستندات",empty:"لا توجد مستندات.",readError:"تعذّرت قراءة هذا المستند."},export:{title:"تصدير",command:"أمر مباشر",scriptSh:"سكربت Shell‏ (.sh)",scriptPs1:"سكربت PowerShell‏ (.ps1)",copyCommand:"نسخ الأمر",downloadScript:"تنزيل السكربت",forceCopy:"فرض النسخ المباشر مع تضمين الأيقونة",forceCopyHint:"تُضمَّن الأيقونات المرفوعة كعناوين data URL طويلة جدًا؛ السكربت هو الافتراضي.",envAck:"راجعت متغيرات البيئة وأوافق على تصديرها",envAckHint:"يحدّد هذا التطبيق متغيرات بيئة، وسيشمل التصدير الكامل قيمها.",envReview:"متغيرات البيئة (قابلة للتحرير قبل التصدير)",blocked:"التصدير محجوب:"}},lx={shell:{product:"create-opentray",toggleSidebar:"Basculer la barre latérale"},nav:{add:"Ajouter",applications:"Applications",help:"Centre d'aide"},common:{loading:"Chargement…",error:"Une erreur est survenue.",retry:"Réessayer",cancel:"Annuler",confirm:"Confirmer",close:"Fermer",copy:"Copier",copied:"Copié",download:"Télécharger",refresh:"Actualiser",empty:"Rien pour le moment."},theme:{title:"Thème",system:"Système",light:"Clair",dark:"Sombre"},language:{title:"Langue"},applications:{title:"Applications",statusHealthy:"Sain",statusInvalidConfig:"Config invalide",statusIncompatible:"Version incompatible",statusMissingPayload:"Charge utile manquante",statusBrokenLink:"Lien rompu",statusRunning:"En cours",edit:"Modifier",uninstall:"Désinstaller",uninstallTitle:"Désinstaller l'application ?",uninstallDescription:"L'enregistrement et le lien de charge utile sont supprimés. Les épingles Dock/barre des tâches se retirent manuellement.",uninstallPurge:"Supprimer aussi le répertoire externe lié",uninstallPurgeHint:"Supprime le répertoire externe lui-même après revalidation de l'identité. Irréversible.",uninstallPinHint:"Les épingles Dock (macOS) et barre des tâches (Windows) sont gérées par l'utilisateur.",emptyHint:"Aucune application enregistrée — créez-en une depuis Ajouter.",payload:"Charge utile",registration:"Enregistrement",linked:"Lié",uninstallRetained:"Répertoire externe conservé :",uninstallDeleted:"Répertoire externe supprimé :"},help:{title:"Centre d'aide",listTitle:"Documents",empty:"Aucun document.",readError:"Impossible de lire ce document."},export:{title:"Exporter",command:"Commande directe",scriptSh:"Script shell (.sh)",scriptPs1:"Script PowerShell (.ps1)",copyCommand:"Copier la commande",downloadScript:"Télécharger le script",forceCopy:"Forcer la copie directe avec icône intégrée",forceCopyHint:"Les icônes téléversées sont incorporées en data URLs très longues ; le script est la valeur par défaut.",envAck:"J'ai revu les variables d'environnement et accepte de les exporter",envAckHint:"Cette application définit des variables d'environnement ; l'export complet inclut leurs valeurs.",envReview:"Variables d'environnement (modifiables avant export)",blocked:"Export bloqué :"}},cx={shell:{product:"create-opentray",toggleSidebar:"Alternar barra lateral"},nav:{add:"Añadir",applications:"Aplicaciones",help:"Centro de ayuda"},common:{loading:"Cargando…",error:"Algo salió mal.",retry:"Reintentar",cancel:"Cancelar",confirm:"Confirmar",close:"Cerrar",copy:"Copiar",copied:"Copiado",download:"Descargar",refresh:"Actualizar",empty:"Aún no hay nada."},theme:{title:"Tema",system:"Sistema",light:"Claro",dark:"Oscuro"},language:{title:"Idioma"},applications:{title:"Aplicaciones",statusHealthy:"Sano",statusInvalidConfig:"Config no válida",statusIncompatible:"Versión incompatible",statusMissingPayload:"Carga útil ausente",statusBrokenLink:"Enlace roto",statusRunning:"En ejecución",edit:"Editar",uninstall:"Desinstalar",uninstallTitle:"¿Desinstalar la aplicación?",uninstallDescription:"Se eliminan el registro y el enlace de carga útil. Los anclajes del Dock/barra de tareas se quitan manualmente.",uninstallPurge:"Eliminar también el directorio externo enlazado",uninstallPurgeHint:"Elimina el directorio externo tras revalidar la identidad. No se puede deshacer.",uninstallPinHint:"Los anclajes del Dock (macOS) y de la barra de tareas (Windows) los gestiona el usuario.",emptyHint:"Aún no hay aplicaciones registradas: crea una desde Añadir.",payload:"Carga útil",registration:"Registro",linked:"Enlazado",uninstallRetained:"Directorio externo conservado:",uninstallDeleted:"Directorio externo eliminado:"},help:{title:"Centro de ayuda",listTitle:"Documentos",empty:"No hay documentos.",readError:"No se pudo leer este documento."},export:{title:"Exportar",command:"Comando directo",scriptSh:"Script de shell (.sh)",scriptPs1:"Script de PowerShell (.ps1)",copyCommand:"Copiar comando",downloadScript:"Descargar script",forceCopy:"Forzar copia directa con icono incrustado",forceCopyHint:"Los iconos subidos se incrustan como data URLs muy largas; el script es la opción predeterminada.",envAck:"He revisado las variables de entorno y acepto exportarlas",envAckHint:"Esta aplicación define variables de entorno; la exportación completa incluye sus valores.",envReview:"Variables de entorno (editables antes de exportar)",blocked:"Exportación bloqueada:"}},ux={shell:{product:"create-opentray",toggleSidebar:"Seitenleiste umschalten"},nav:{add:"Hinzufügen",applications:"Anwendungen",help:"Hilfecenter"},common:{loading:"Lädt…",error:"Etwas ist schiefgelaufen.",retry:"Erneut versuchen",cancel:"Abbrechen",confirm:"Bestätigen",close:"Schließen",copy:"Kopieren",copied:"Kopiert",download:"Herunterladen",refresh:"Aktualisieren",empty:"Noch nichts vorhanden."},theme:{title:"Design",system:"System",light:"Hell",dark:"Dunkel"},language:{title:"Sprache"},applications:{title:"Anwendungen",statusHealthy:"Intakt",statusInvalidConfig:"Ungültige Konfiguration",statusIncompatible:"Inkompatible Version",statusMissingPayload:"Payload fehlt",statusBrokenLink:"Defekter Link",statusRunning:"Läuft",edit:"Bearbeiten",uninstall:"Deinstallieren",uninstallTitle:"Anwendung deinstallieren?",uninstallDescription:"Registrierung und Payload-Link werden entfernt. Dock-/Taskleisten-Anker bitte manuell entfernen.",uninstallPurge:"Verknüpftes externes Verzeichnis ebenfalls löschen",uninstallPurgeHint:"Löscht das externe Verzeichnis nach Identitätsprüfung. Nicht rückgängig machbar.",uninstallPinHint:"Dock-Anker (macOS) und Taskleisten-Anker (Windows) verwaltet der Benutzer manuell.",emptyHint:"Noch keine registrierten Anwendungen — erstelle eine unter „Hinzufügen“.",payload:"Payload",registration:"Registrierung",linked:"Verknüpft",uninstallRetained:"Externes Verzeichnis behalten:",uninstallDeleted:"Externes Verzeichnis gelöscht:"},help:{title:"Hilfecenter",listTitle:"Dokumente",empty:"Keine Dokumente.",readError:"Dieses Dokument konnte nicht gelesen werden."},export:{title:"Exportieren",command:"Direktbefehl",scriptSh:"Shell-Skript (.sh)",scriptPs1:"PowerShell-Skript (.ps1)",copyCommand:"Befehl kopieren",downloadScript:"Skript herunterladen",forceCopy:"Direktes Kopieren mit eingebettetem Symbol erzwingen",forceCopyHint:"Hochgeladene Symbole werden als sehr lange Data-URLs eingebettet; Standard ist das Skript.",envAck:"Ich habe die Umgebungsvariablen geprüft und akzeptiere ihren Export",envAckHint:"Diese Anwendung definiert Umgebungsvariablen; der vollständige Export enthält deren Werte.",envReview:"Umgebungsvariablen (vor dem Export bearbeitbar)",blocked:"Export blockiert:"}},dx={shell:{product:"create-opentray",toggleSidebar:"Показать/скрыть боковую панель"},nav:{add:"Добавить",applications:"Приложения",help:"Центр справки"},common:{loading:"Загрузка…",error:"Что-то пошло не так.",retry:"Повторить",cancel:"Отмена",confirm:"Подтвердить",close:"Закрыть",copy:"Копировать",copied:"Скопировано",download:"Скачать",refresh:"Обновить",empty:"Пока ничего нет."},theme:{title:"Тема",system:"Системная",light:"Светлая",dark:"Тёмная"},language:{title:"Язык"},applications:{title:"Приложения",statusHealthy:"Исправно",statusInvalidConfig:"Неверная конфигурация",statusIncompatible:"Несовместимая версия",statusMissingPayload:"Отсутствует payload",statusBrokenLink:"Битая ссылка",statusRunning:"Выполняется",edit:"Изменить",uninstall:"Удалить",uninstallTitle:"Удалить приложение?",uninstallDescription:"Регистрация и ссылка payload будут удалены. Значки Dock/панели задач удаляйте вручную.",uninstallPurge:"Также удалить связанный внешний каталог",uninstallPurgeHint:"Удаляет внешний каталог после повторной проверки идентичности. Отменить нельзя.",uninstallPinHint:"Значки Dock (macOS) и панели задач (Windows) управляются пользователем вручную.",emptyHint:"Зарегистрированных приложений пока нет — создайте первое в разделе «Добавить».",payload:"Payload",registration:"Регистрация",linked:"Ссылка",uninstallRetained:"Внешний каталог сохранён:",uninstallDeleted:"Внешний каталог удалён:"},help:{title:"Центр справки",listTitle:"Документы",empty:"Документов нет.",readError:"Не удалось прочитать этот документ."},export:{title:"Экспорт",command:"Прямая команда",scriptSh:"Скрипт shell (.sh)",scriptPs1:"Скрипт PowerShell (.ps1)",copyCommand:"Копировать команду",downloadScript:"Скачать скрипт",forceCopy:"Принудительное копирование со встроенной иконкой",forceCopyHint:"Загруженные иконки встраиваются как очень длинные data-URL; по умолчанию — скрипт.",envAck:"Я проверил переменные окружения и согласен на их экспорт",envAckHint:"В этом приложении заданы переменные окружения; полный экспорт включает их значения.",envReview:"Переменные окружения (можно изменить перед экспортом)",blocked:"Экспорт заблокирован:"}},fx={en:$t,"zh-CN":un($t,ox),ja:un($t,sx),ko:un($t,ix),ar:un($t,ax),fr:un($t,lx),es:un($t,cx),de:un($t,ux),ru:un($t,dx)},px=e=>fx[e],zd="create-opentray.locale",Ud="create-opentray.theme",Vd="lang",Zd=new Set(Mo),hx=()=>{try{const t=new URLSearchParams(window.location.search).get(Vd);return t!==null&&Zd.has(t)?t:null}catch{return null}},Ax=e=>{try{const t=new URL(window.location.href);t.searchParams.set(Vd,e),window.history.replaceState(null,"",t)}catch{}},$l=e=>{try{return window.localStorage.getItem(e)}catch{return null}},Xl=(e,t)=>{try{window.localStorage.setItem(e,t)}catch{}},gx=()=>window.matchMedia("(prefers-color-scheme: dark)").matches,ql=e=>e==="system"?gx()?"dark":"light":e,hi=(e,t)=>{const n=document.documentElement;n.lang=e,n.dir=Yd(e),n.classList.toggle("dark",ql(t)==="dark"),n.style.colorScheme=ql(t)},mx=()=>{const e=hx(),t=e!==null?e:null,n=$l(zd),r=t!==null?t:n!==null&&Zd.has(n)?n:rx(navigator.languages??[navigator.language]),o=$l(Ud);return{locale:r,theme:o==="light"||o==="dark"||o==="system"?o:"system"}},Jd=d.createContext(void 0),xx=({initialLocale:e,initialTheme:t,children:n})=>{const[r,o]=d.useState(e),[s,i]=d.useState(t);d.useEffect(()=>{hi(r,s)},[r,s]),d.useEffect(()=>{if(s!=="system")return;const f=window.matchMedia("(prefers-color-scheme: dark)"),h=()=>{hi(r,"system")};return f.addEventListener("change",h),()=>f.removeEventListener("change",h)},[s,r]);const a=d.useCallback(f=>{Ax(f),Xl(zd,f),o(f)},[]),c=d.useCallback(f=>{Xl(Ud,f),i(f)},[]),u=d.useMemo(()=>({locale:r,messages:px(r),direction:Yd(r),theme:s,setLocale:a,setTheme:c}),[r,s,a,c]);return l.jsx(Jd.Provider,{value:u,children:n})},ps=()=>{const e=d.useContext(Jd);if(e===void 0)throw new Error("usePreferences must be used inside PreferencesProvider");return e},$d=d.createContext(void 0),Xd=()=>{const[e]=Tu(),t=d.useMemo(()=>new URLSearchParams(e.split("?")[1]??""),[e]),n=(e.split("?")[0]??"/add").replace(/^\/?/u,"");return{route:n==="applications"||n==="help"?n:"add",query:t}},qd=()=>{const e=d.useContext($d);if(e===void 0)throw new Error("useWorkbenchNavigation must be used inside WorkbenchShell");return e},bx={"zh-CN":"中",ja:"日",ko:"한",en:"EN",ar:"ع",fr:"FR",es:"ES",de:"DE",ru:"RU"},vx=({product:e})=>{const{state:t,toggleSidebar:n}=ds(),r=t==="collapsed",o=`${e} · ${r?"展开":"收起"}`;return r?l.jsx(kr,{size:"lg",className:"group/brand relative justify-center",children:l.jsxs("span",{className:"relative grid size-8 shrink-0 place-items-center",children:[l.jsx("img",{src:"/logo.png",alt:e,width:24,height:24,className:"size-6 rounded-md transition-opacity group-hover/brand:opacity-0 focus-visible-within:opacity-0"}),l.jsx("button",{type:"button",onClick:n,"aria-label":o,title:o,className:"absolute inset-0 grid place-items-center rounded-md opacity-0 transition-opacity hover:bg-sidebar-accent focus-visible:opacity-100 group-hover/brand:opacity-100",children:l.jsx(ll,{"aria-hidden":!0,className:"size-4"})})]})}):l.jsxs(kr,{size:"lg",className:"justify-start pr-1",children:[l.jsx("img",{src:"/logo.png",alt:e,width:24,height:24,className:"size-6 shrink-0 rounded-md"}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:e}),l.jsx("button",{type:"button",onClick:n,"aria-label":o,title:o,className:"grid size-6 shrink-0 place-items-center rounded-md hover:bg-sidebar-accent",children:l.jsx(ll,{"aria-hidden":!0,className:"size-4"})})]})},yx=({children:e,panelOpen:t})=>{const{locale:n,messages:r,setLocale:o,theme:s,setTheme:i}=ps(),{route:a}=Xd(),c=d.useCallback(m=>{window.location.hash=`#/${m}`},[]),[u,f]=d.useState(()=>window.innerWidth>=768),h=t===!0;d.useEffect(()=>{const m=window.matchMedia("(min-width: 768px)"),x=()=>{f(m.matches&&!h)};return x(),m.addEventListener("change",x),()=>m.removeEventListener("change",x)},[h]);const g=d.useMemo(()=>({route:a,navigate:c}),[a,c]),A=[{route:"add",icon:l.jsx(mu,{"aria-hidden":!0}),label:r.nav.add},{route:"applications",icon:l.jsx(ph,{"aria-hidden":!0}),label:r.nav.applications},{route:"help",icon:l.jsx(Xp,{"aria-hidden":!0}),label:r.nav.help}],p=s==="system"?r.theme.system:s==="light"?r.theme.light:r.theme.dark;return l.jsx($d.Provider,{value:g,children:l.jsxs(h0,{open:u,onOpenChange:f,children:[l.jsxs(A0,{collapsible:"icon",children:[l.jsx(m0,{children:l.jsx(Ms,{children:l.jsx(oo,{children:l.jsx(vx,{product:r.shell.product})})})}),l.jsx(b0,{children:l.jsx(v0,{children:l.jsx(y0,{children:l.jsx(Ms,{children:A.map(m=>l.jsx(oo,{children:l.jsxs(ls,{children:[l.jsxs(cs,{render:l.jsx(kr,{isActive:a===m.route,tooltip:m.label,"aria-label":m.label,onClick:()=>{c(m.route)}}),children:[m.icon,l.jsx("span",{children:m.label})]}),l.jsx(us,{side:"right",children:m.label})]})},m.route))})})})}),l.jsx(x0,{children:l.jsxs(Ms,{children:[l.jsx(oo,{children:l.jsxs(Do,{children:[l.jsx(Fo,{render:l.jsxs(kr,{tooltip:r.language.title,"aria-label":r.language.title,children:[l.jsx("span",{"aria-hidden":!0,className:"text-xs font-semibold",children:bx[n]}),l.jsx("span",{children:r.language.title})]})}),l.jsx(Bo,{side:"top",align:"start",children:Mo.map(m=>l.jsx(jo,{onClick:()=>{o(m)},children:nx(m)},m))})]})}),l.jsx(oo,{children:l.jsxs(Do,{children:[l.jsx(Fo,{render:l.jsxs(kr,{tooltip:`${r.theme.title}: ${p}`,"aria-label":`${r.theme.title}: ${p}`,children:[s==="light"?l.jsx(Nh,{"aria-hidden":!0}):s==="dark"?l.jsx(yh,{"aria-hidden":!0}):l.jsx(bh,{"aria-hidden":!0}),l.jsx("span",{children:p})]})}),l.jsx(Bo,{side:"top",align:"start",children:[["system",r.theme.system],["light",r.theme.light],["dark",r.theme.dark]].map(([m,x])=>l.jsx(jo,{onClick:()=>{i(m)},children:x},m))})]})})]})}),l.jsx(g0,{"aria-label":r.shell.toggleSidebar})]}),l.jsx("main",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:e})]})})},Cx=()=>new URLSearchParams(window.location.search).get("token")??"",ln=async(e,t={})=>{const n=await fetch(e,{method:t.method??"GET",headers:{authorization:`Bearer ${Cx()}`,...t.body===void 0?{}:{"content-type":"application/json"}},...t.body===void 0?{}:{body:JSON.stringify(t.body)}}),r=await n.json().catch(()=>({}));return{status:n.status,data:r}},Ix=()=>ln("/api/apps"),ef=e=>ln(`/api/apps/${encodeURIComponent(e)}/config`),wx=e=>ln(`/api/apps/${encodeURIComponent(e)}/icon`),kx=(e,t)=>ln(`/api/apps/${encodeURIComponent(e)}/uninstall`,{method:"POST",body:{...t}}),Ex=()=>ln("/api/skill/list"),Sx=e=>ln(`/api/skill?path=${encodeURIComponent(e)}`),Rx=(e,t)=>ln(`/api/apps/${encodeURIComponent(e)}/export`,{method:"POST",body:{...t}}),Dx=e=>ln(`/api/apps/${encodeURIComponent(e)}/open`,{method:"POST",body:{}}),Fx=e=>ln("/api/export",{method:"POST",body:{...e}}).then(t=>{if(t.status!==200)return t;const n=t.data;return n.ok!==!0?{status:409,data:{code:n.code,message:n.message}}:{status:200,data:n.kind==="command"?{command:n.command}:{filename:n.filename,content:n.content,...n.commandLine===void 0?{}:{commandLine:n.commandLine},...n.iconSharedAs===void 0?{}:{iconSharedAs:n.iconSharedAs},...n.iconReference===void 0?{}:{iconReference:n.iconReference}}}});function Bx(e){if(!e)return null;for(const t of e.elements){const n=t.tagName;if(n==="BUTTON"||n==="INPUT"){const r=t;if(r.type==="submit")return r}}return null}function tf(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":""}:{"data-unchecked":""}},...ji}}const jx=d.createContext(void 0);function Mx(){return d.useContext(jx)}const nf=d.createContext(void 0);function Px(){const e=d.useContext(nf);if(e===void 0)throw new Error(ot(14));return e}const Tx="data-parent",Nx=d.forwardRef(function(t,n){const{checked:r,className:o,defaultChecked:s=!1,"aria-labelledby":i,disabled:a=!1,form:c,id:u,indeterminate:f=!1,inputRef:h,name:g,onCheckedChange:A,parent:p=!1,readOnly:m=!1,render:x,required:v=!1,uncheckedValue:b,value:y,nativeButton:C=!1,style:w,...I}=t,{clearErrors:S}=Mi(),{disabled:R,name:E,setDirty:k,setFilled:F,setFocused:T,setTouched:N,state:M,validationMode:D,validityData:L,validation:_}=Qo(),j=vA(),{labelId:H,controlId:P,registerControlId:B,getDescriptionProps:O}=Pi(),G=Mx(),z=G?.allValues===void 0?void 0:G.parent,U=z!==void 0,Q=R||j.disabled||G?.disabled||a,Z=E??g,K=y??Z,te=It(),le=It();let X=u||P;U&&(p?X=le:K!==void 0?X=`${z.id}-${K}`:X||=le);let ee={};U&&(p?ee=z.getParentProps():K!==void 0&&(ee=z.getChildProps(K)));const{checked:J=r,indeterminate:ce=f,onCheckedChange:ue,...ge}=ee,ae=G?.value,pe=d.useRef(null),oe=Dt(()=>Symbol()),re=d.useRef(!1),{getButtonProps:se,buttonRef:he}=Gt({disabled:Q,native:C}),me=G?.validation??_,[W,Y]=on({controlled:K!==void 0&&ae!==void 0&&!p?ae.includes(K):J,default:s,name:"Checkbox",state:"checked"}),ye=U?!!J:W,q=U&&ce||f;ie(()=>{B!==Er&&(re.current=!0,B(oe.current,X))},[X,B,oe]),d.useEffect(()=>{const Ie=oe.current;return()=>{!re.current||B===Er||(re.current=!1,B(Ie,void 0))}},[B,oe]),Ti(pe,te,W,void 0,!G&&!Q,g);const ne=d.useRef(null),Ee=me.registerInput,Se=G?K:void 0,Le=d.useCallback(Ie=>Ee(Ie,{controlRef:pe,value:Se}),[Ee,Se]),Je=Qt(h,ne,p?void 0:Le),We=bu(i,H,ne,!C,X??void 0);ie(()=>{ne.current&&(ne.current.indeterminate=q,W&&F(!0))},[W,q,F]),ss(W,()=>{G||(S(Z),F(W),k(W!==L.initialValue),me.change(W))});const ut=Bt({checked:W,disabled:Q,form:c,name:p?void 0:Z,id:C?void 0:X??void 0,required:v,ref:Je,style:Z?ta:$o,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Ie){if(Ie.nativeEvent.defaultPrevented)return;if(m){Ie.preventDefault();return}const ze=Ie.currentTarget.checked,Ne=Ce(Mt,Ie.nativeEvent);if(A?.(ze,Ne),!Ne.isCanceled&&(ue?.(ze,Ne),!Ne.isCanceled&&(Y(ze),K!==void 0&&G!==void 0&&!p&&!U))){const nt=ze?[...G.value,K]:G.value.filter(Re=>Re!==K);G.setValue(nt,Ne)}},onClick(Ie){Ie.stopPropagation()},onFocus(){pe.current?.focus()}},y!==void 0?{value:(G?W&&y:y)||""}:ct,O,Ie=>me.getValidationProps(Q,Ie));d.useEffect(()=>{if(!z||K===void 0)return;const Ie=z.disabledStatesRef.current;return Ie.set(K,Q),()=>{Ie.delete(K)}},[z,Q,K]);const $e=d.useMemo(()=>({...M,checked:ye,disabled:Q,readOnly:m,required:v,indeterminate:q}),[M,ye,Q,m,v,q]),Ye=tf($e),mt=je("span",t,{state:$e,ref:[he,pe,n],props:[{id:C?X??void 0:te,role:"checkbox","aria-checked":q?"mixed":ye,"aria-readonly":m||void 0,"aria-required":v||void 0,"aria-labelledby":We,[Tx]:p?"":void 0,onFocus(){Q||T(!0)},onBlur(){const Ie=ne.current;Ie&&(N(!0),T(!1),D==="onBlur"&&me.commit(G?ae:Ie.checked))},onKeyDown(Ie){if(Ie.key!=="Enter"||(Ie.preventBaseUIHandler(),Ie.defaultPrevented))return;const ze=ne.current?.form??null,Ne=Ie.currentTarget,nt=Ie.nativeEvent,Re=Ie.preventDefault,Ge=nt.preventDefault;let _e=!1;Ie.preventDefault=()=>{_e=!0,Re.call(Ie)},nt.preventDefault=()=>{_e=!0,Ge.call(nt)},Ge.call(nt),rt(Ne).queueMicrotask(()=>{Ie.preventDefault=Re,nt.preventDefault=Ge,_e||Bx(ze)?.click()})},onClick(Ie){if(m||Q)return;Ie.preventDefault();const ze=ne.current;ze&&Fi(ze,Ie)}},I,ge,se,O,Ie=>me.getValidationProps(Q,Ie)],stateAttributesMapping:Ye});return l.jsxs(nf.Provider,{value:$e,children:[mt,!W&&!G&&Z&&!p&&b!==void 0&&l.jsx("input",{type:"hidden",form:c,name:Z,value:b,disabled:Q}),l.jsx("input",{...ut,suppressHydrationWarning:!0})]})}),_x=d.forwardRef(function(t,n){const{render:r,className:o,style:s,keepMounted:i=!1,...a}=t,c=Px(),u=c.checked||c.indeterminate,{mounted:f,transitionStatus:h,setMounted:g}=sr(u),A=d.useRef(null),p={...c,transitionStatus:h};Yt({open:u,ref:A,onComplete(){u||g(!1)}});const x={...tf(c),...Nn},v=i||f,b=je("span",t,{ref:[n,A],state:p,stateAttributesMapping:x,props:a});return v?b:null});function Ai({className:e,...t}){return l.jsx(Nx,{"data-slot":"checkbox",className:fe("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",e),...t,children:l.jsx(_x,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:l.jsx(_i,{})})})}function Me({className:e,...t}){return l.jsx("label",{"data-slot":"label",className:fe("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}const rf=d.createContext(void 0);function of(){const e=d.useContext(rf);if(e===void 0)throw new Error(ot(10));return e}const Ox={value:()=>null},Hx=d.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,hiddenUntilFound:i,keepMounted:a,loopFocus:c,onValueChange:u,multiple:f=!1,orientation:h="vertical",value:g,defaultValue:A,style:p,...m}=t,x=d.useMemo(()=>{if(g===void 0)return A??[]},[g,A]),v=d.useRef([]),[b,y]=on({controlled:g,default:x,name:"Accordion",state:"value"}),C=de((R,E,k)=>{if(f)if(E){const F=b.slice();if(F.push(R),u?.(F,k),k.isCanceled)return;y(F)}else{const F=b.filter(T=>T!==R);if(u?.(F,k),k.isCanceled)return;y(F)}else{const F=b[0]===R?[]:[R];if(u?.(F,k),k.isCanceled)return;y(F)}}),w=d.useMemo(()=>({value:b,disabled:s,orientation:h}),[b,s,h]),I=d.useMemo(()=>({disabled:s,handleValueChange:C,hiddenUntilFound:i??!1,keepMounted:a??!1,state:w,value:b}),[s,C,i,a,w,b]),S=je("div",t,{state:w,ref:n,props:m,stateAttributesMapping:Ox});return l.jsx(rf.Provider,{value:I,children:l.jsx(Ur,{elementsRef:v,children:S})})});function Lx(e){const{open:t,defaultOpen:n,onOpenChange:r,disabled:o}=e,[s,i]=on({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:a,setMounted:c,transitionStatus:u}=sr(s,!0,!0),f=It(),[h,g]=d.useState(),A=h===null?void 0:h??f,p=de(m=>{const x=!s,v=Ce(Pn,m.nativeEvent);r(x,v),!v.isCanceled&&i(x)});return d.useMemo(()=>({defaultPanelId:f,disabled:o,handleTrigger:p,mounted:a,open:s,panelId:A,setMounted:c,setOpen:i,setPanelIdState:g,transitionStatus:u}),[f,o,p,a,s,A,c,i,g,u])}const sf=d.createContext(void 0);function af(){const e=d.useContext(sf);if(e===void 0)throw new Error(ot(15));return e}const lf=d.createContext(void 0);function Sa(){const e=d.useContext(lf);if(e===void 0)throw new Error(ot(9));return e}let Ra=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=ko.startingStyle]="startingStyle",e[e.endingStyle=ko.endingStyle]="endingStyle",e})({}),Kx=(function(e){return e.panelOpen="data-panel-open",e})({});const Wx={[Ra.open]:""},Qx={[Ra.closed]:""},Gx={open(e){return e?{[Kx.panelOpen]:""}:null}},Yx={open(e){return e?Wx:Qx}};let zx=(function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e})({});const Da={...Yx,index:e=>({[zx.index]:String(e)}),...Nn,value:()=>null},Ux=d.forwardRef(function(t,n){const{className:r,disabled:o=!1,onOpenChange:s,render:i,value:a,style:c,...u}=t,{ref:f,index:h}=fs(),g=Qt(n,f),{disabled:A,handleValueChange:p,state:m,value:x}=of(),v=It(),b=a??v,y=o||A,C=x.indexOf(b)!==-1,w=de((L,_)=>{s?.(L,_),!_.isCanceled&&p(b,L,_)}),I=Lx({open:C,onOpenChange:w,disabled:y}),S=d.useMemo(()=>({open:I.open,disabled:I.disabled,transitionStatus:I.transitionStatus}),[I.open,I.disabled,I.transitionStatus]),R=d.useMemo(()=>({...I,onOpenChange:w,state:S}),[I,S,w]),E=d.useMemo(()=>({...m,hidden:!C&&!I.mounted,index:h,disabled:y,open:C}),[I.mounted,y,h,C,m]),k=It(),[F,T]=d.useState(),N=F===null?void 0:F??k,M=d.useMemo(()=>({defaultTriggerId:k,open:C,state:E,setTriggerId:T,triggerId:N}),[k,C,E,T,N]),D=je("div",t,{state:E,ref:g,props:u,stateAttributesMapping:Da});return l.jsx(sf.Provider,{value:R,children:l.jsx(lf.Provider,{value:M,children:D})})}),Vx=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{state:a}=Sa();return je("h3",t,{state:a,ref:n,props:i,stateAttributesMapping:Da})}),Zx=d.forwardRef(function(t,n){const{disabled:r,className:o,id:s,render:i,nativeButton:a=!0,style:c,...u}=t,{panelId:f,open:h,handleTrigger:g,disabled:A}=af(),p=r||A,{getButtonProps:m,buttonRef:x}=Gt({disabled:p,focusableWhenDisabled:!0,native:a}),{defaultTriggerId:v,state:b,setTriggerId:y}=Sa(),C=s||void 0,w=C??v;return ie(()=>(y(R=>C??(R===null?void 0:R)),()=>{y(R=>R===C?null:R)}),[C,y]),je("button",t,{state:b,ref:[n,x],props:[{"aria-controls":h?f:void 0,"aria-expanded":h,id:w,onClick:g},u,m],stateAttributesMapping:Gx})}),cr={height:void 0,width:void 0};function Jx(e){const{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:o,mounted:s,onOpenChange:i,open:a,setMounted:c,setOpen:u,transitionStatus:f}=e,h=d.useRef(null),g=d.useRef(null),[A,p]=d.useState(cr),m=d.useRef(cr),x=d.useRef(!1),v=d.useRef(a),b=d.useRef(!1),[y,C]=d.useState(!1),w=d.useRef(null),I=Qt(t,h),S=tt(a),R=$i(h),E=!a&&!s,k=y?"idle":f,F=a&&(v.current||b.current),T=!a&&s&&g.current==="css-animation"&&A.height===void 0&&A.width===void 0?m.current:A,N=n&&E&&g.current!=="css-animation",M=de((H,P=!0)=>{P&&(m.current=H),p(H)}),D=de(()=>{w.current?.(),w.current=null}),L=de(H=>{D(),w.current=()=>{w.current=null,H()}}),_=de(()=>{a&&s&&g.current==="css-animation"&&(b.current=!0)});ie(()=>{!y||f==="starting"||C(!1)},[y,f]),d.useEffect(()=>()=>{_(),D()},[_,D]),ie(()=>{const H=h.current;if(!H)return;!a&&w.current&&D();const P=$x(H,F);if(g.current=P,a&&f==="idle"&&v.current&&P==="css-animation"){m.current=Hn(H);return}if(a&&f==="starting"){const G=x.current;if(x.current=!1,P==="none"){M(Hn(H)),C(!0);return}if(P==="css-transition"){const Q=Xx(H);if(M(Hn(H)),!G)return Q;const Z=io(H,"transition-duration","0s");return L(Z),C(!0),Q}M(Hn(H));const z=io(H,"animation-name","none");if(!G){z();return}const U=io(H,"animation-duration","0s");z(),L(U),C(!0);return}if(!a&&s&&(f==="idle"||f==="starting")){if(v.current=!1,b.current=!1,P==="none"){M(cr,!1),c(!1);return}M(Hn(H));return}if(f!=="ending")return;if(P==="none"){c(!1);return}const B=Hn(H);if(!(B.height>0||B.width>0)){c(!1);return}M(B),P==="css-animation"&&io(H,"animation-name","none")()},[s,a,D,M,c,L,F,f]),Yt({enabled:a&&s&&k==="idle",open:!0,ref:h,onComplete(){a&&M(cr,!1)}}),d.useEffect(()=>{if(a||!s||k!=="ending"||!h.current)return;const P=new AbortController;let B=-1;function O(){S.current||(c(!1),M(cr,!1))}return B=Ct.request(()=>{R(O,P.signal)}),()=>{Ct.cancel(B),P.abort()}},[S,s,a,k,R,M,c]),ie(()=>{const H=h.current;!H||!n||!E||H.setAttribute("hidden","until-found")},[E,n]),d.useEffect(function(){const P=h.current;if(!P)return;function B(O){const G=Ce(Mt,O);i(!0,G),!G.isCanceled&&(x.current=!0,u(!0))}return De(P,"beforematch",B)},[i,u]);const j=o||n||s||a;return{height:T.height,props:{...N?{[Ra.startingStyle]:""}:void 0,hidden:E,id:r},ref:I,shouldPreventOpenAnimation:F,shouldRender:j,transitionStatus:k,width:T.width}}function Hn(e){return{height:e.scrollHeight,width:e.scrollWidth}}function $x(e,t){const n=rt(e).getComputedStyle(e),r=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&ec(n.animationDuration),o=ec(n.transitionDuration);return r&&o||o?"css-transition":r?"css-animation":"none"}function ec(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function io(e,t,n){const r=e.style.getPropertyValue(t),o=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===""){e.style.removeProperty(t);return}e.style.setProperty(t,r,o)}}function Xx(e){const t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(o=>{e.style.setProperty(o,"initial","important")});function n(){Object.entries(t).forEach(([o,s])=>{if(s===""){e.style.removeProperty(o);return}e.style.setProperty(o,s)})}const r=Ct.request(n);return()=>{Ct.cancel(r),n()}}let tc=(function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e})({});const qx=d.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,id:i,render:a,style:c,...u}=t,{hiddenUntilFound:f,keepMounted:h}=of(),{defaultPanelId:g,mounted:A,onOpenChange:p,open:m,setMounted:x,setOpen:v,setPanelIdState:b,transitionStatus:y}=af(),C=o??f,w=s??h,I=i||void 0,S=i??g;ie(()=>(b(P=>I??(P===null?void 0:P)),()=>{b(P=>P===I?null:P)}),[I,b]);const{height:R,props:E,ref:k,shouldPreventOpenAnimation:F,shouldRender:T,transitionStatus:N,width:M}=Jx({externalRef:n,hiddenUntilFound:C,id:S,keepMounted:w,mounted:A,onOpenChange:p,open:m,setMounted:x,setOpen:v,transitionStatus:y}),{state:D,triggerId:L}=Sa(),_={...D,transitionStatus:N},j=Bp(c,_),H=je("div",{...t,style:void 0},{state:_,ref:k,props:[E,{"aria-labelledby":L,role:"region",style:{[tc.accordionPanelHeight]:R===void 0?"auto":`${R}px`,[tc.accordionPanelWidth]:M===void 0?"auto":`${M}px`}},u,j?{style:j}:void 0,F?{style:{animationName:"none"}}:void 0],stateAttributesMapping:Da});return T?H:null});function Fa({className:e,...t}){return l.jsx(Hx,{"data-slot":"accordion",className:fe("flex w-full flex-col",e),...t})}function Ba({className:e,...t}){return l.jsx(Ux,{"data-slot":"accordion-item",className:fe("not-last:border-b",e),...t})}function ja({className:e,children:t,...n}){return l.jsx(Vx,{className:"flex",children:l.jsxs(Zx,{"data-slot":"accordion-trigger",className:fe("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",e),...n,children:[t,l.jsx(Tn,{className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),l.jsx(Oi,{className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function Ma({className:e,children:t,...n}){return l.jsx(qx,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...n,children:l.jsx("div",{className:fe("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),children:t})})}const cf=d.createContext(void 0);function eb(){return d.useContext(cf)}const tb=d.forwardRef(function(t,n){const{className:r,defaultPressed:o=!1,disabled:s=!1,form:i,onPressedChange:a,pressed:c,render:u,type:f,value:h,nativeButton:g=!0,style:A,...p}=t,m=It(h||void 0),x=eb(),v=x?.value??[],b=x?void 0:o,y=(s||x?.disabled)??!1,[C,w]=on({controlled:x?m!==void 0&&v.indexOf(m)>-1:c,default:b,name:"Toggle",state:"pressed"}),{getButtonProps:I,buttonRef:S}=Gt({disabled:y,native:g}),R={disabled:y,pressed:C},E=[S,n],k=[{"aria-pressed":C,onClick(N){const M=!C,D=Ce(Mt,N.nativeEvent);a?.(M,D),!D.isCanceled&&(m&&x?.setGroupValue?.(m,M,D),!D.isCanceled&&w(M))}},p,I],F=je("button",t,{enabled:!x,state:R,ref:E,props:k}),T=d.useMemo(()=>({disabled:y,focusableWhenDisabled:!1}),[y]);return x?l.jsx(Wd,{tag:"button",render:u,className:r,style:A,metadata:T,state:R,refs:E,props:k}):F}),uf="data-composite-item-active",nb=[];function rb(e){const{loopFocus:t=!0,orientation:n="both",grid:r,onLoop:o,direction:s,highlightedIndex:i,onHighlightedIndexChange:a,rootRef:c,enableHomeAndEndKeys:u=!1,stopEventPropagation:f,disabledIndices:h,modifierKeys:g=nb}=e,[A,p]=d.useState(0),m=r!=null,x=d.useRef(null),v=Qt(x,c),b=d.useRef([]),y=d.useRef(!1),C=i??A,w=de((k,F=!1)=>{if((a??p)(k),F){const T=b.current[k];Hl(x.current,T,s,n)}}),I=de(k=>{if(k.size===0||y.current)return;y.current=!0;const F=Array.from(k.keys()),T=F.find(M=>M?.hasAttribute(uf))??null,N=T?k.get(T)?.index??-1:-1;if(N!==-1)w(N);else if(wo(F,C,h)){const M=tn(F,{disabledIndices:h});Ir(F,M)||w(M)}Hl(x.current,T,s,n)});ie(()=>{if(h==null||i!=null||!y.current)return;const k=b.current;if(wo(k,C,h)){const F=tn(k,{disabledIndices:h});Ir(k,F)||w(F)}},[h,i,C,b,w]);const S=de((k,F,T)=>o?o(k,F,T,b):T),R=de(k=>{const F=k.key===fi||k.key===pi;if(!rs.has(k.key)||!u&&F||ob(k,g)||!x.current)return;const N=s==="rtl",M=N?ui:di,D=N?di:ui,L=n==="vertical"?ci:M,_=n==="vertical"?li:D,j=At(k.nativeEvent);if(j!=null&&Ol(j)&&!Gd(j)){const z=j.selectionStart,U=j.selectionEnd,Q=j.value;if(z==null||k.shiftKey||z!==U||k.key!==_&&z<Q.length||k.key!==L&&z>0)return}let H=C;const P=Ao(b,h),B=ni(b,h);r!=null&&(H=r({disabledIndices:h,elementsRef:b,event:k,highlightedIndex:C,loopFocus:t,maxIndex:B,minIndex:P,onLoop:S,orientation:n,rtl:N}));const O=n!=="vertical"&&k.key===M||n!=="horizontal"&&k.key===ci,G=n!=="vertical"&&k.key===D||n!=="horizontal"&&k.key===li;u&&(k.key===fi?H=P:k.key===pi&&(H=B)),H===C&&(O||G)&&(t&&H===B&&O?(H=P,o&&(H=o(k,C,H,b))):t&&H===P&&G?(H=B,o&&(H=o(k,C,H,b))):H=tn(b.current,{startingIndex:H,decrement:G,disabledIndices:h})),H!==C&&!Ir(b.current,H)&&(f&&k.stopPropagation(),(m||F||O||G)&&k.preventDefault(),w(H,!0),queueMicrotask(()=>{b.current[H]?.focus()}))});return{props:{ref:v,onFocus(k){const F=x.current,T=At(k.nativeEvent);!F||T==null||!Ol(T)||T.setSelectionRange(0,T.value.length)},onKeyDown:R},highlightedIndex:C,onHighlightedIndexChange:w,elementsRef:b,onMapChange:I,relayKeyboardEvent:R}}function ob(e,t){for(const n of gm)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function df(e){const{render:t,className:n,style:r,refs:o=Nt,props:s=Nt,state:i=ct,stateAttributesMapping:a,highlightedIndex:c,onHighlightedIndexChange:u,orientation:f,grid:h,loopFocus:g,onLoop:A,enableHomeAndEndKeys:p,onMapChange:m,stopEventPropagation:x=!0,rootRef:v,disabledIndices:b,modifierKeys:y,highlightItemOnHover:C=!1,tag:w="div",...I}=e,S=is(),{props:R,highlightedIndex:E,onHighlightedIndexChange:k,elementsRef:F,onMapChange:T,relayKeyboardEvent:N}=rb({grid:h,loopFocus:g,onLoop:A,orientation:f,highlightedIndex:c,onHighlightedIndexChange:u,rootRef:v,stopEventPropagation:x,enableHomeAndEndKeys:p,direction:S,disabledIndices:b,modifierKeys:y}),M=je(w,e,{state:i,ref:o,props:[R,...s,I],stateAttributesMapping:a}),D=d.useMemo(()=>({highlightedIndex:E,onHighlightedIndexChange:k,highlightItemOnHover:C,relayKeyboardEvent:N}),[E,k,C,N]);return l.jsx(Hp.Provider,{value:D,children:l.jsx(Ur,{elementsRef:F,onMapChange:L=>{m?.(L),T(L)},children:M})})}const sb=d.createContext(void 0);function ib(){return d.useContext(sb)}const ab=d.forwardRef(function(t,n){const{defaultValue:r,disabled:o=!1,loopFocus:s=!0,onValueChange:i,orientation:a="horizontal",multiple:c=!1,value:u,className:f,render:h,style:g,...A}=t,p=Ea(),m=ib(),x=u!==void 0||r!==void 0,v=(p?.disabled??!1)||(m?.disabled??!1)||o,[b,y]=on({controlled:u,default:u===void 0?r??Nt:void 0,name:"ToggleGroup",state:"value"}),C=de((E,k,F)=>{let T;c?(T=b.slice(),k?T.push(E):T.splice(b.indexOf(E),1)):T=k?[E]:[],i?.(T,F),!F.isCanceled&&y(T)}),w={disabled:v,multiple:c,orientation:a},I=d.useMemo(()=>({disabled:v,setGroupValue:C,value:b,isValueInitialized:x}),[v,C,b,x]),S={role:"group"},R=je("div",t,{enabled:!!p,state:w,ref:n,props:[S,A]});return l.jsx(cf.Provider,{value:I,children:p?R:l.jsx(df,{render:h,className:f,style:g,state:w,refs:[n],props:[S,A],loopFocus:s,enableHomeAndEndKeys:!0,orientation:a})})}),lb=ki("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),ff=d.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function Pa({className:e,variant:t,size:n,spacing:r=2,orientation:o="horizontal",children:s,...i}){return l.jsx(ab,{"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":o,style:{"--gap":r},className:fe("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...i,children:l.jsx(ff.Provider,{value:{variant:t,size:n,spacing:r,orientation:o},children:s})})}function Br({className:e,children:t,variant:n="default",size:r="default",...o}){const s=d.useContext(ff);return l.jsx(tb,{"data-slot":"toggle-group-item","data-variant":s.variant||n,"data-size":s.size||r,"data-spacing":s.spacing,className:fe("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",lb({variant:s.variant||n,size:s.size||r}),e),...o,children:t})}function Ta({...e}){return l.jsx(Id,{"data-slot":"dialog",...e})}function cb({...e}){return l.jsx(ya,{"data-slot":"dialog-portal",...e})}function ub({...e}){return l.jsx(Qr,{"data-slot":"dialog-close",...e})}function db({className:e,...t}){return l.jsx(qi,{"data-slot":"dialog-overlay",className:fe("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function Na({className:e,children:t,showCloseButton:n=!0,...r}){return l.jsxs(cb,{children:[l.jsx(db,{}),l.jsxs(xa,{"data-slot":"dialog-content",className:fe("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:[t,n&&l.jsxs(Qr,{"data-slot":"dialog-close",render:l.jsx(Oe,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[l.jsx(Hi,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Kn({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:fe("flex flex-col gap-2",e),...t})}function fb({className:e,showCloseButton:t=!1,children:n,...r}){return l.jsxs("div",{"data-slot":"dialog-footer",className:fe("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...r,children:[n,t&&l.jsx(Qr,{render:l.jsx(Oe,{variant:"outline"}),children:"Close"})]})}function Wn({className:e,...t}){return l.jsx(Ca,{"data-slot":"dialog-title",className:fe("cn-font-heading text-base leading-none font-medium",e),...t})}function _a({className:e,...t}){return l.jsx(ea,{"data-slot":"dialog-description",className:fe("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const pf=new Set(["npx","create-opentray","create","set"]),en={comment:"text-muted-foreground italic",keyword:"text-emerald-600 dark:text-emerald-400 font-medium",flag:"text-sky-600 dark:text-sky-400",string:"text-amber-700 dark:text-amber-300 break-all",env:"text-violet-600 dark:text-violet-400",variable:"text-rose-600 dark:text-rose-400"},pb=(e,t)=>e.split(/(\s+|\$[A-Za-z_][A-Za-z0-9_]*)/g).map((r,o)=>{const s=`${t}-u${o}`;return r.startsWith("$")?l.jsx("span",{className:en.variable,children:r},s):pf.has(r)?l.jsx("span",{className:en.keyword,children:r},s):r.startsWith("--")?l.jsx("span",{className:en.flag,children:r},s):/^[A-Za-z_][A-Za-z0-9_]*=/.test(r)?l.jsx("span",{className:en.env,children:r},s):l.jsx("span",{children:r},s)}),hb=(e,t)=>e.startsWith("#")?l.jsx("span",{className:en.comment,children:e}):e.split(/('(?:[^']|'\\'')*')/g).map((r,o)=>{const s=`${t}-s${o}`;if(!r.startsWith("'"))return l.jsx("span",{children:pb(r,s)},s);const i=r.slice(1,-1);return pf.has(i)?l.jsx("span",{className:en.keyword,children:r},s):i.startsWith("--")?l.jsx("span",{className:en.flag,children:r},s):/^[A-Za-z_][A-Za-z0-9_]*=/.test(i)?l.jsx("span",{className:en.env,children:r},s):l.jsx("span",{className:en.string,children:r},s)}),Ab=({content:e})=>l.jsx("pre",{className:"tech-ltr bg-muted max-h-72 overflow-auto rounded-md p-2 text-xs whitespace-pre-wrap break-words",children:e.split(`
2
- `).map((t,n)=>l.jsx("div",{children:t.length===0?" ":hb(t,n)},n))}),hf=({open:e,subtitle:t,hasEnv:n,share:r=!1,runner:o,onClose:s})=>{const{messages:i}=ps(),[a,c]=d.useState("sh"),[u,f]=d.useState(!1),[h,g]=d.useState(null),[A,p]=d.useState(null),[m,x]=d.useState(null),[v,b]=d.useState(!1),[y,C]=d.useState(!1),w=d.useRef(o);w.current=o,d.useEffect(()=>{f(!1),g(null)},[e]),d.useEffect(()=>{if(!e){p(null),x(null);return}if(n&&!u){p(null),b(!1);return}let E=!1;return b(!0),C(!1),x(null),(async()=>{const k=await w.current({format:a,acknowledgeEnv:u,...h===null?{}:{inlineIcon:h}});if(E)return;if(b(!1),k.status===200){const T=k.data;"content"in T&&T.content!==void 0&&(h===null&&T.iconSharedAs!==void 0&&g(T.iconSharedAs==="embedded"),p({filename:T.filename??"create-opentray.sh",content:T.content,...T.commandLine===void 0?{}:{commandLine:T.commandLine},...T.iconReference===void 0?{}:{iconReference:T.iconReference}}));return}p(null);const F=k.data;"code"in F&&x(`${F.message??F.code}`)})(),()=>{E=!0}},[e,a,u,h,n]);const I=!n||u,S=()=>{if(A===null)return;const E=new Blob([A.content],{type:a==="sh"?"text/x-shellscript":"text/plain"}),k=URL.createObjectURL(E),F=document.createElement("a");F.href=k,F.download=A.filename,F.click(),URL.revokeObjectURL(k)},R=async()=>{A!==null&&(await navigator.clipboard.writeText(A.commandLine??A.content),C(!0))};return l.jsx(Ta,{open:e,onOpenChange:E=>{E||s()},children:l.jsxs(Na,{children:[l.jsxs(Kn,{children:[l.jsx(Wn,{children:r?i.export.shareTitle:i.export.title}),l.jsxs(_a,{children:[l.jsx("span",{className:"tech-ltr block truncate",children:t}),r&&l.jsx("span",{className:"text-muted-foreground mt-1 block text-xs",children:i.export.shareSubtitle})]})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(Pa,{variant:"outline",size:"sm",spacing:0,value:[a],onValueChange:E=>{const k=E[0];(k==="sh"||k==="ps1")&&c(k)},children:[l.jsx(Br,{value:"sh",children:i.export.scriptSh}),l.jsx(Br,{value:"ps1",children:i.export.scriptPs1})]}),v&&l.jsx("span",{className:"text-muted-foreground self-center text-xs",children:i.export.building})]}),n&&l.jsx("div",{className:"border-warning rounded-md border p-3",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(Ai,{id:"export-env-ack",checked:u,onCheckedChange:E=>f(E===!0)}),l.jsxs(Me,{htmlFor:"export-env-ack",className:"text-xs leading-snug",children:[i.export.envAck,l.jsx("span",{className:"text-muted-foreground block",children:i.export.envAckHint})]})]})}),A?.iconReference!==void 0&&A.iconReference!=="none"&&l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(Ai,{id:"export-inline-icon",checked:h===!0,onCheckedChange:E=>g(E===!0)}),l.jsxs(Me,{htmlFor:"export-inline-icon",className:"text-xs leading-snug",children:[i.export.inlineIcon,l.jsx("span",{className:"text-muted-foreground block",children:i.export.inlineIconHint})]})]}),m!==null&&l.jsxs("p",{className:"text-destructive text-xs",role:"alert",children:[i.export.blocked," ",m]}),A!==null&&l.jsx(Fa,{children:l.jsxs(Ba,{value:"content",children:[l.jsx(ja,{className:"text-xs",children:i.export.viewFull}),l.jsx(Ma,{children:l.jsx(Ab,{content:A.content})})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(Oe,{size:"sm",variant:"outline",disabled:!I||A===null,onClick:()=>{R()},children:[l.jsx(eh,{width:14,height:14,"aria-hidden":!0}),y?i.common.copied:i.export.copyCommand]}),l.jsxs(Oe,{size:"sm",disabled:!I||A===null,onClick:S,children:[l.jsx(nh,{width:14,height:14,"aria-hidden":!0}),i.export.downloadFile]})]})]})})};function gb(e){return Cd("alert-dialog",e)}function nc({...e}){return l.jsx(gb,{"data-slot":"alert-dialog",...e})}function mb({...e}){return l.jsx(ya,{"data-slot":"alert-dialog-portal",...e})}function xb({className:e,...t}){return l.jsx(qi,{"data-slot":"alert-dialog-overlay",className:fe("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function rc({className:e,size:t="default",...n}){return l.jsxs(mb,{children:[l.jsx(xb,{}),l.jsx(xa,{"data-slot":"alert-dialog-content","data-size":t,className:fe("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n})]})}function oc({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-header",className:fe("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function sc({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-footer",className:fe("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function ic({className:e,...t}){return l.jsx(Ca,{"data-slot":"alert-dialog-title",className:fe("cn-font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function ac({className:e,...t}){return l.jsx(ea,{"data-slot":"alert-dialog-description",className:fe("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function lc({className:e,...t}){return l.jsx(Oe,{"data-slot":"alert-dialog-action",className:fe(e),...t})}function cc({className:e,variant:t="outline",size:n="default",...r}){return l.jsx(Qr,{"data-slot":"alert-dialog-cancel",className:fe(e),render:l.jsx(Oe,{variant:t,size:n}),...r})}const uc={healthy:"statusHealthy","invalid-config":"statusInvalidConfig","incompatible-version":"statusIncompatible","missing-payload":"statusMissingPayload","broken-link":"statusBrokenLink",running:"statusRunning"},dc=e=>({statusHealthy:e.applications.statusHealthy,statusInvalidConfig:e.applications.statusInvalidConfig,statusIncompatible:e.applications.statusIncompatible,statusMissingPayload:e.applications.statusMissingPayload,statusBrokenLink:e.applications.statusBrokenLink,statusRunning:e.applications.statusRunning}),bb=e=>{const t=e.command??{},n=e.window??{};return{command:[t.executable??"",...t.args??[]].filter(Boolean).join(" "),cwd:t.cwd??"",envKeys:Object.keys(t.env??{}),packageManager:typeof e.packageManager=="string"?e.packageManager:"",window:`${n.width??"—"}×${n.height??"—"}`.replace(/—×—/u,"—"),developerMode:e.developerMode===!0}},dn=({label:e,value:t})=>l.jsxs("div",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-1 text-xs",children:[l.jsx("span",{className:"text-muted-foreground",children:e}),l.jsx("span",{className:"tech-ltr break-all",children:t})]}),vb=({app:e,dataUrl:t})=>{const n=(e.appName??e.key).trim().charAt(0).toUpperCase()||"A";return l.jsx("span",{className:"bg-muted text-muted-foreground flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-md text-sm font-semibold","aria-hidden":!0,children:t!==void 0?l.jsx("img",{src:t,alt:"",className:"size-full object-contain"}):n})},yb=()=>{const{messages:e}=ps(),{navigate:t,route:n}=qd(),[r,o]=d.useState([]),[s,i]=d.useState("loading"),[a,c]=d.useState(null),[u,f]=d.useState(null),[h,g]=d.useState(!1),[A,p]=d.useState(null),[m,x]=d.useState(null),[v,b]=d.useState(null),[y,C]=d.useState({}),[w,I]=d.useState({}),S=d.useCallback(async()=>{i(L=>L==="ready"?"stale":"loading");const D=await Ix();D.status===200?(o(D.data),C({}),i("ready"),await Promise.all(D.data.filter(L=>L.hasIcon===!0).map(async L=>{const _=await wx(L.key),j=_.data;_.status===200&&"dataUrl"in j&&j.dataUrl!==void 0&&I(H=>({...H,[L.key]:j.dataUrl}))}))):i("stale")},[]);d.useEffect(()=>{n==="applications"&&S()},[n,S]),d.useEffect(()=>{const D=()=>{S()};return window.addEventListener("create-opentray:apps-changed",D),()=>window.removeEventListener("create-opentray:apps-changed",D)},[S]);const R=async D=>{if(v===D.key){b(null);return}if(b(D.key),y[D.key]===void 0){const L=await ef(D.key);C(_=>({..._,[D.key]:L.status===200?bb(L.data):"error"}))}},E=async D=>{const L=await Dx(D.key),_=L.data;p(L.status===200&&"ok"in _&&_.ok===!0?_.detail:"message"in _?_.message:e.common.error)},k=D=>{p([D.projectPath!==void 0?D.projectPath:"",D.targetRetained===!0?`${e.applications.uninstallRetained} ${D.payloadPath??""}`:"",D.targetDeleted===!0?`${e.applications.uninstallDeleted} ${D.payloadPath??""}`:"",D.manualPinCleanupHint].filter(Boolean).join(`
3
- `))},F=async(D,L)=>{const _=await kx(D.key,{...L,purgeTarget:h});if(_.status===200)k(_.data);else{const j=_.data;if(_.status===409&&j.code==="app_running"&&(j.pids!==void 0||j.pid!==void 0)){const H=j.pids??(j.pid!==void 0?[j.pid]:[]);f({app:D,pids:H});return}p(j.message??e.common.error)}await S()},T=async()=>{const D=a;c(null),D!==null&&await F(D,{stopRunning:!1})},N=async()=>{const D=u;f(null),D!==null&&await F(D.app,{stopRunning:!0})},M=D=>m===null?Promise.resolve({status:400,data:{code:"state_error",message:"no target"}}):Rx(m.key,D);return l.jsxs("section",{className:"flex h-full flex-col overflow-hidden","aria-label":e.applications.title,children:[l.jsxs("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[l.jsx("h1",{className:"text-sm font-semibold",children:e.applications.title}),l.jsx(Oe,{variant:"ghost",size:"icon-sm","aria-label":e.common.refresh,onClick:()=>{S()},children:l.jsx(Rh,{width:16,height:16,"aria-hidden":!0})})]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:[s==="loading"&&l.jsxs("div",{className:"space-y-2","aria-label":e.common.loading,children:[l.jsx(qt,{className:"h-14 w-full"}),l.jsx(qt,{className:"h-14 w-full"}),l.jsx(qt,{className:"h-14 w-full"})]}),s!=="loading"&&r.length===0&&l.jsx("p",{className:"text-muted-foreground text-sm",children:e.applications.emptyHint}),r.length>0&&l.jsx("ul",{className:"space-y-2",children:r.map(D=>{const L=v===D.key,_=y[D.key],j=D.status!=="healthy";return l.jsxs("li",{className:"border-border bg-card text-card-foreground rounded-lg border px-3 py-2",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(vb,{app:D,dataUrl:w[D.key]}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"truncate text-sm font-medium",children:D.appName??D.key}),j&&l.jsxs(ls,{children:[l.jsx(cs,{render:H=>l.jsx(bo,{variant:"destructive",...H,children:dc(e)[uc[D.status]]})}),l.jsx(us,{children:D.error?.message??dc(e)[uc[D.status]]})]}),D.isLink&&l.jsx(bo,{variant:"outline",children:e.applications.linked})]}),l.jsx("div",{className:"tech-ltr text-muted-foreground truncate text-xs",children:D.appId??D.key})]}),l.jsxs(Oe,{variant:"ghost",size:"sm","aria-expanded":L,onClick:()=>{R(D)},children:[L?l.jsx(Oi,{width:14,height:14,"aria-hidden":!0}):l.jsx(Tn,{width:14,height:14,"aria-hidden":!0}),e.applications.details]}),l.jsxs(Oe,{variant:"outline",size:"sm",onClick:()=>{window.location.hash=`#/add?edit=${encodeURIComponent(D.key)}`},children:[l.jsx(gu,{width:14,height:14,"aria-hidden":!0}),e.applications.edit]}),l.jsxs(Oe,{variant:"outline",size:"sm",onClick:()=>{E(D)},children:[l.jsx(Au,{width:14,height:14,"aria-hidden":!0}),e.applications.open]}),l.jsxs(Oe,{variant:"outline",size:"sm",onClick:()=>x(D),children:[l.jsx(jh,{width:14,height:14,"aria-hidden":!0}),e.applications.share]}),l.jsxs(Oe,{variant:"destructive",size:"sm",onClick:()=>c(D),children:[l.jsx(Oh,{width:14,height:14,"aria-hidden":!0}),e.applications.uninstall]})]}),L&&l.jsxs("div",{className:"border-border mt-2 space-y-1 rounded-md border bg-muted/40 p-3",children:[_===void 0&&l.jsx("p",{className:"text-muted-foreground text-xs",children:e.common.loading}),_==="error"&&l.jsx("p",{className:"text-destructive text-xs",role:"alert",children:e.common.error}),_!==void 0&&_!=="error"&&l.jsxs(l.Fragment,{children:[l.jsx(dn,{label:e.applications.source,value:D.source==="wizard"?e.applications.sourceWizard:e.applications.sourceRegistered}),l.jsx(dn,{label:e.applications.detailsCommand,value:_.command}),l.jsx(dn,{label:e.applications.detailsCwd,value:_.cwd}),l.jsx(dn,{label:e.applications.detailsEnv,value:_.envKeys.length>0?_.envKeys.join(", "):"—"}),l.jsx(dn,{label:e.applications.detailsPm,value:_.packageManager}),l.jsx(dn,{label:e.applications.detailsWindow,value:_.window}),l.jsx(dn,{label:e.applications.detailsDevMode,value:_.developerMode?"ON":"OFF"}),l.jsx(dn,{label:e.applications.detailsProjectDir,value:D.projectDir??D.payloadPath??D.registrationDir})]})]})]},D.key)})}),s==="stale"&&l.jsx("p",{className:"text-warning mt-3 text-xs",role:"status",children:e.common.error}),A!==null&&l.jsx("p",{className:"text-muted-foreground bg-muted mt-3 whitespace-pre-line rounded-md p-3 text-xs",role:"status",children:A})]}),l.jsx(nc,{open:a!==null,onOpenChange:D=>{D||c(null)},children:l.jsxs(rc,{children:[l.jsxs(oc,{children:[l.jsx(ic,{children:e.applications.uninstallTitle}),l.jsxs(ac,{children:[a?.source==="wizard"?e.applications.uninstallWizardDescription:e.applications.uninstallDescription,l.jsx("span",{className:"tech-ltr mt-2 block truncate",children:a?.appId??a?.key}),a?.projectDir!==void 0&&l.jsx("span",{className:"tech-ltr mt-1 block truncate",children:a.projectDir})]})]}),a?.isLink===!0&&l.jsxs("label",{className:"flex items-start gap-2 text-xs",children:[l.jsx(Ai,{checked:h,onCheckedChange:D=>g(D===!0)}),l.jsxs("span",{children:[e.applications.uninstallPurge,l.jsx("span",{className:"text-muted-foreground block",children:e.applications.uninstallPurgeHint})]})]}),l.jsx("p",{className:"text-muted-foreground text-xs",children:e.applications.uninstallPinHint}),l.jsxs(sc,{children:[l.jsx(cc,{children:e.common.cancel}),l.jsx(lc,{onClick:()=>{T()},children:e.applications.uninstall})]})]})}),l.jsx(nc,{open:u!==null,onOpenChange:D=>{D||f(null)},children:l.jsxs(rc,{children:[l.jsxs(oc,{children:[l.jsx(ic,{children:e.applications.stopRunningTitle}),l.jsxs(ac,{children:[e.applications.stopRunningDescription,l.jsxs("span",{className:"tech-ltr mt-2 block",children:[e.applications.stopRunningPids,": ",u?.pids.join(", ")]}),l.jsx("span",{className:"tech-ltr mt-1 block truncate",children:u?.app.appId??u?.app.key})]})]}),l.jsx("p",{className:"text-muted-foreground text-xs",children:e.applications.uninstallPinHint}),l.jsxs(sc,{children:[l.jsx(cc,{children:e.common.cancel}),l.jsx(lc,{onClick:()=>{N()},children:e.applications.stopRunningConfirm})]})]})}),l.jsx(hf,{open:m!==null,subtitle:m?.appId??m?.key??"",hasEnv:m?.hasEnv===!0,runner:M,onClose:()=>x(null)})]})},Oa=d.createContext({indent:20,currentItem:void 0,tree:void 0,toggleIconType:"plus-minus"});function Af(){return d.useContext(Oa)}function Cb({indent:e=20,tree:t,className:n,toggleIconType:r="chevron",...o}){const s=t&&typeof t.getContainerProps=="function"?t.getContainerProps():{},i={...o,...s},{style:a,...c}=i,u={...a,"--tree-indent":`${e}px`};return l.jsx(Oa.Provider,{value:{indent:e,tree:t,toggleIconType:r},children:l.jsx("div",{"data-slot":"tree",style:u,className:fe("flex flex-col",n),...c})})}function Ib({item:e,className:t,render:n,children:r,...o}){const s=Af(),{indent:i}=s,a=typeof e.getProps=="function"?e.getProps():{},c={...o,children:r,...a},{style:u,...f}=c,g={"data-slot":"tree-item",style:{...u,"--tree-padding":`${e.getItemMeta().level*i}px`},className:fe("z-10 ps-(--tree-padding) outline-hidden select-none not-last:pb-0.5 focus:z-20 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),"data-focus":typeof e.isFocused=="function"?e.isFocused()||!1:void 0,"data-folder":typeof e.isFolder=="function"?e.isFolder()||!1:void 0,"data-selected":typeof e.isSelected=="function"?e.isSelected()||!1:void 0,"data-drag-target":typeof e.isDragTarget=="function"?e.isDragTarget()||!1:void 0,"data-search-match":typeof e.isMatchingSearch=="function"?e.isMatchingSearch()||!1:void 0,"aria-expanded":e.isExpanded()};return l.jsx(Oa.Provider,{value:{...s,currentItem:e},children:hu({defaultTagName:"button",render:n,props:Bt(g,f)})})}function wb({item:e,children:t,className:n,...r}){const{currentItem:o,toggleIconType:s}=Af(),i=e||o;return i?l.jsxs("span",{"data-slot":"tree-item-label",className:fe("in-focus-visible:ring-ring/50 bg-background hover:bg-accent in-data-[selected=true]:bg-accent in-data-[selected=true]:text-accent-foreground in-data-[drag-target=true]:bg-accent flex items-center gap-1 transition-colors not-in-data-[folder=true]:ps-7 in-focus-visible:ring-[3px] in-data-[search-match=true]:bg-blue-50! [&_svg]:pointer-events-none [&_svg]:shrink-0","rounded-md","py-1.5","px-2","text-sm",n),...r,children:[i.isFolder()&&(s==="plus-minus"?i.isExpanded()?l.jsx(mh,{"aria-hidden":!0,className:"text-muted-foreground size-3.5",stroke:"currentColor",strokeWidth:"1"}):l.jsx(mu,{"aria-hidden":!0,className:"text-muted-foreground size-3.5",stroke:"currentColor",strokeWidth:"1"}):l.jsx(Tn,{"aria-hidden":!0,className:"text-muted-foreground size-4 in-aria-[expanded=false]:-rotate-90"})),t||(typeof i.getItemName=="function"?i.getItemName():null)]}):(console.warn("TreeItemLabel: No item provided via props or context"),null)}const fc={};function kb(e){let t=fc[e];if(t)return t;t=fc[e]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);t.push(r)}for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);t[r]="%"+("0"+r.toString(16).toUpperCase()).slice(-2)}return t}function nr(e,t){typeof t!="string"&&(t=nr.defaultChars);const n=kb(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(r){let o="";for(let s=0,i=r.length;s<i;s+=3){const a=parseInt(r.slice(s+1,s+3),16);if(a<128){o+=n[a];continue}if((a&224)===192&&s+3<i){const c=parseInt(r.slice(s+4,s+6),16);if((c&192)===128){const u=a<<6&1984|c&63;u<128?o+="��":o+=String.fromCharCode(u),s+=3;continue}}if((a&240)===224&&s+6<i){const c=parseInt(r.slice(s+4,s+6),16),u=parseInt(r.slice(s+7,s+9),16);if((c&192)===128&&(u&192)===128){const f=a<<12&61440|c<<6&4032|u&63;f<2048||f>=55296&&f<=57343?o+="���":o+=String.fromCharCode(f),s+=6;continue}}if((a&248)===240&&s+9<i){const c=parseInt(r.slice(s+4,s+6),16),u=parseInt(r.slice(s+7,s+9),16),f=parseInt(r.slice(s+10,s+12),16);if((c&192)===128&&(u&192)===128&&(f&192)===128){let h=a<<18&1835008|c<<12&258048|u<<6&4032|f&63;h<65536||h>1114111?o+="����":(h-=65536,o+=String.fromCharCode(55296+(h>>10),56320+(h&1023))),s+=9;continue}}o+="�"}return o})}nr.defaultChars=";/?:@&=+$,#";nr.componentChars="";const pc={};function Eb(e){let t=pc[e];if(t)return t;t=pc[e]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);/^[0-9a-z]$/i.test(r)?t.push(r):t.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function Vr(e,t,n){typeof t!="string"&&(n=t,t=Vr.defaultChars),typeof n>"u"&&(n=!0);const r=Eb(t);let o="";for(let s=0,i=e.length;s<i;s++){const a=e.charCodeAt(s);if(n&&a===37&&s+2<i&&/^[0-9a-f]{2}$/i.test(e.slice(s+1,s+3))){o+=e.slice(s,s+3),s+=2;continue}if(a<128){o+=r[a];continue}if(a>=55296&&a<=57343){if(a>=55296&&a<=56319&&s+1<i){const c=e.charCodeAt(s+1);if(c>=56320&&c<=57343){o+=encodeURIComponent(e[s]+e[s+1]),s++;continue}}o+="%EF%BF%BD";continue}o+=encodeURIComponent(e[s])}return o}Vr.defaultChars=";/?:@&=+$,-_.!~*'()#";Vr.componentChars="-_.!~*'()";function gi(e){let t="";return t+=e.protocol||"",t+=e.slashes?"//":"",t+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?t+="["+e.hostname+"]":t+=e.hostname||"",t+=e.port?":"+e.port:"",t+=e.pathname||"",t+=e.search||"",t+=e.hash||"",t}function Po(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const Sb=/^([a-z0-9.+-]+:)/i,Rb=/:[0-9]*$/,Db=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Fb=["<",">",'"',"`"," ","\r",`
4
- `," "],Bb=["{","}","|","\\","^","`"].concat(Fb),jb=["'"].concat(Bb),hc=["%","/","?",";","#"].concat(jb),Ac=["/","?","#"],Mb=255,gc=/^[+a-z0-9A-Z_-]{0,63}$/,Pb=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,mc={javascript:!0,"javascript:":!0},xc={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function mi(e,t){if(e&&e instanceof Po)return e;const n=new Po;return n.parse(e,t),n}Po.prototype.parse=function(e,t){let n,r,o,s=e;if(s=s.trim(),!t&&e.split("#").length===1){const u=Db.exec(s);if(u)return this.pathname=u[1],u[2]&&(this.search=u[2]),this}let i=Sb.exec(s);if(i&&(i=i[0],n=i.toLowerCase(),this.protocol=i,s=s.substr(i.length)),(t||i||s.match(/^\/\/[^@\/]+@[^@\/]+/))&&(o=s.substr(0,2)==="//",o&&!(i&&mc[i])&&(s=s.substr(2),this.slashes=!0)),!mc[i]&&(o||i&&!xc[i])){let u=-1;for(let p=0;p<Ac.length;p++)r=s.indexOf(Ac[p]),r!==-1&&(u===-1||r<u)&&(u=r);let f,h;u===-1?h=s.lastIndexOf("@"):h=s.lastIndexOf("@",u),h!==-1&&(f=s.slice(0,h),s=s.slice(h+1),this.auth=f),u=-1;for(let p=0;p<hc.length;p++)r=s.indexOf(hc[p]),r!==-1&&(u===-1||r<u)&&(u=r);u===-1&&(u=s.length),s[u-1]===":"&&u--;const g=s.slice(0,u);s=s.slice(u),this.parseHost(g),this.hostname=this.hostname||"";const A=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!A){const p=this.hostname.split(/\./);for(let m=0,x=p.length;m<x;m++){const v=p[m];if(v&&!v.match(gc)){let b="";for(let y=0,C=v.length;y<C;y++)v.charCodeAt(y)>127?b+="x":b+=v[y];if(!b.match(gc)){const y=p.slice(0,m),C=p.slice(m+1),w=v.match(Pb);w&&(y.push(w[1]),C.unshift(w[2])),C.length&&(s=C.join(".")+s),this.hostname=y.join(".");break}}}}this.hostname.length>Mb&&(this.hostname=""),A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const a=s.indexOf("#");a!==-1&&(this.hash=s.substr(a),s=s.slice(0,a));const c=s.indexOf("?");return c!==-1&&(this.search=s.substr(c),s=s.slice(0,c)),s&&(this.pathname=s),xc[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Po.prototype.parseHost=function(e){let t=Rb.exec(e);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};const Tb=Object.freeze(Object.defineProperty({__proto__:null,decode:nr,encode:Vr,format:gi,parse:mi},Symbol.toStringTag,{value:"Module"})),gf=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,mf=/[\0-\x1F\x7F-\x9F]/,Nb=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,Ha=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD6E\uDEAD\uDED0\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9\uDFD4\uDFD5\uDFD7\uDFD8]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09\uDFE1]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/,xf=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDF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\u3000]/,_b=Object.freeze(Object.defineProperty({__proto__:null,Any:gf,Cc:mf,Cf:Nb,P:Ha,S:xf,Z:bf},Symbol.toStringTag,{value:"Module"})),Ob=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function Hb(e){return e>=55296&&e<=57343||e>1114111?65533:Ob.get(e)??e}function Lb(e){const t=atob(e),n=t.length&-2,r=new Uint16Array(n/2);for(let o=0,s=0;o<n;o+=2){const i=t.charCodeAt(o),a=t.charCodeAt(o+1);r[s++]=i|a<<8}return r}const Kb=Lb("QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXY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Lx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg");var bt;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.FLAG13=8192]="FLAG13",e[e.BRANCH_LENGTH=8064]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(bt||(bt={}));var et;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(et||(et={}));const bc=32;function xi(e){return e>=et.ZERO&&e<=et.NINE}function Wb(e){return e>=et.UPPER_A&&e<=et.UPPER_F||e>=et.LOWER_A&&e<=et.LOWER_F}function Qb(e){return e>=et.UPPER_A&&e<=et.UPPER_Z||e>=et.LOWER_A&&e<=et.LOWER_Z||xi(e)}function Gb(e){return e===et.EQUALS||Qb(e)}var ft;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(ft||(ft={}));var An;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(An||(An={}));class Yb{decodeTree;emitCodePoint;errors;constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r}state=ft.EntityStart;consumed=1;result=0;treeIndex=0;excess=1;decodeMode=An.Strict;runConsumed=0;startEntity(t){this.decodeMode=t,this.state=ft.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(t,n){switch(this.state){case ft.EntityStart:return t.charCodeAt(n)===et.NUM?(this.state=ft.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=ft.NamedEntity,this.stateNamedEntity(t,n));case ft.NumericStart:return this.stateNumericStart(t,n);case ft.NumericDecimal:return this.stateNumericDecimal(t,n);case ft.NumericHex:return this.stateNumericHex(t,n);case ft.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|bc)===et.LOWER_X?(this.state=ft.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=ft.NumericDecimal,this.stateNumericDecimal(t,n))}stateNumericHex(t,n){for(;n<t.length;){const r=t.charCodeAt(n);if(xi(r)||Wb(r)){const o=r<=et.NINE?r-et.ZERO:(r|bc)-et.LOWER_A+10;this.result=this.result*16+o,this.consumed++,n++}else return this.emitNumericEntity(r,3)}return-1}stateNumericDecimal(t,n){for(;n<t.length;){const r=t.charCodeAt(n);if(xi(r))this.result=this.result*10+(r-et.ZERO),this.consumed++,n++;else return this.emitNumericEntity(r,2)}return-1}emitNumericEntity(t,n){if(this.consumed<=n)return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===et.SEMI)this.consumed+=1;else if(this.decodeMode===An.Strict)return 0;return this.emitCodePoint(Hb(this.result),this.consumed),this.errors&&(t!==et.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,n){const{decodeTree:r}=this;let o=r[this.treeIndex],s=(o&bt.VALUE_LENGTH)>>14;for(;n<t.length;){if(s===0&&(o&bt.FLAG13)!==0){const a=(o&bt.BRANCH_LENGTH)>>7;if(this.runConsumed===0){const c=o&bt.JUMP_TABLE;if(t.charCodeAt(n)!==c)return this.result===0?0:this.emitNotTerminatedNamedEntity();n++,this.excess++,this.runConsumed++}for(;this.runConsumed<a;){if(n>=t.length)return-1;const c=this.runConsumed-1,u=r[this.treeIndex+1+(c>>1)],f=c%2===0?u&255:u>>8&255;if(t.charCodeAt(n)!==f)return this.runConsumed=0,this.result===0?0:this.emitNotTerminatedNamedEntity();n++,this.excess++,this.runConsumed++}this.runConsumed=0,this.treeIndex+=1+(a>>1),o=r[this.treeIndex],s=(o&bt.VALUE_LENGTH)>>14}if(n>=t.length)break;const i=t.charCodeAt(n);if(i===et.SEMI&&s!==0&&(o&bt.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);if(this.treeIndex=Ub(r,o,this.treeIndex+Math.max(1,s),i),this.treeIndex<0)return this.result===0||this.decodeMode===An.Attribute&&(s===0||Gb(i))?0:this.emitNotTerminatedNamedEntity();if(o=r[this.treeIndex],s=(o&bt.VALUE_LENGTH)>>14,s!==0){if(i===et.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==An.Strict&&(o&bt.FLAG13)===0&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}n++,this.excess++}return-1}emitNotTerminatedNamedEntity(){const{result:t,decodeTree:n}=this,r=(n[t]&bt.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),this.errors?.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:o}=this;return this.emitCodePoint(n===1?o[t]&~(bt.VALUE_LENGTH|bt.FLAG13):o[t+1],r),n===3&&this.emitCodePoint(o[t+2],r),r}end(){switch(this.state){case ft.NamedEntity:return this.result!==0&&(this.decodeMode!==An.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ft.NumericDecimal:return this.emitNumericEntity(0,2);case ft.NumericHex:return this.emitNumericEntity(0,3);case ft.NumericStart:return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case ft.EntityStart:return 0}}}function zb(e){let t="";const n=new Yb(e,r=>t+=String.fromCodePoint(r));return function(o,s){let i=0,a=0;for(;(a=o.indexOf("&",a))>=0;){t+=o.slice(i,a),n.startEntity(s);const u=n.write(o,a+1);if(u<0){i=a+n.end();break}i=a+u,a=u===0?i+1:i}const c=t+o.slice(i);return t="",c}}function Ub(e,t,n,r){const o=(t&bt.BRANCH_LENGTH)>>7,s=t&bt.JUMP_TABLE;if(o===0)return s!==0&&r===s?n:-1;if(s){const u=r-s;return u<0||u>=o?-1:e[n+u]-1}const i=o+1>>1;let a=0,c=o-1;for(;a<=c;){const u=a+c>>>1,f=u>>1,g=e[n+f]>>(u&1)*8&255;if(g<r)a=u+1;else if(g>r)c=u-1;else return e[n+i+u]}return-1}const Vb=zb(Kb);function vf(e){return Vb(e,An.Strict)}var Zb=class{src_Any=gf.source;src_Cc=mf.source;src_Z=bf.source;src_P=Ha.source;src_ZPCc=[this.src_Z,this.src_P,this.src_Cc].join("|");src_ZCc=[this.src_Z,this.src_Cc].join("|");cache={};opts={maxLength:1e4,urlAuth:!1,schema_names:[]};constructor(e={}){this.opts={...this.opts,...e}}set(e={}){return this.opts={...this.opts,...e},this.cache={},this}escapeRE(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}nestedPairRE(e,t,n=4){const r=this.escapeRE(e),o=this.escapeRE(t),s=`(?:(?!${this.src_ZCc}|${r}|${o}).)`;let i=`${r}${s}{0,1000}${o}`;for(let a=2;a<=n;a++)i=`${r}(?:${s}|${i}){0,1000}${o}`;return i}get_text_separators(){return this.cache.text_separators??=/[><\uff5c]/}get_pseudo_letter(){return this.cache.src_pseudo_letter??=new RegExp(`(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`)}get_ipv4_addr(){return this.cache.src_ip4??=new RegExp("(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])")}get_ipv6_addr(){const e="[0-9A-Fa-f]{1,4}",t=`(?:(?:${e}:${e})|${this.get_ipv4_addr().source})`;return this.cache.src_ip6_addr??=new RegExp(`(?:(?:${e}:){6}${t}|::(?:${e}:){5}${t}|(?:${e})?::(?:${e}:){4}${t}|(?:(?:${e}:){0,1}${e})?::(?:${e}:){3}${t}|(?:(?:${e}:){0,2}${e})?::(?:${e}:){2}${t}|(?:(?:${e}:){0,3}${e})?::${e}:${t}|(?:(?:${e}:){0,4}${e})?::${t}|(?:(?:${e}:){0,5}${e})?::${e}|(?:(?:${e}:){0,6}${e})?::)`)}get_ipv6_url_host(){return this.cache.src_ip6_host??=new RegExp(`\\[${this.get_ipv6_addr().source}\\]`)}get_ipv6_mail_host(){return this.cache.src_ipv6_mail_host??=new RegExp(`\\[IPv6:${this.get_ipv6_addr().source}\\]`)}get_auth(){return this.cache.src_auth??=new RegExp(`(?:(?:(?!${this.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`)}get_port(){return this.cache.src_port??=new RegExp("(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?")}get_host_terminator(){return this.cache.src_host_terminator??=new RegExp(`(?=$|${this.get_text_separators().source}|${this.src_ZPCc})(?!${this.opts["---"]?"-(?!--)|":"-|"}_|:\\d|\\.-|\\.(?!$|${this.src_ZPCc}))`)}get_path_terminator(){return this.cache.src_path_terminator??=new RegExp(`${this.src_ZPCc}|${this.get_text_separators().source}`)}get_path(){return this.cache.src_path??=new RegExp(`(?:[/?#](?:${this.nestedPairRE("[","]")}|${this.nestedPairRE("(",")")}|${this.nestedPairRE("{","}")}|\\"(?:(?!${this.src_ZCc}|["]).){1,100}\\"|\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\'|\\'(?=${this.get_pseudo_letter().source}|[-])|\\.{2,20}[:]?[a-zA-Z0-9%/&]|\\.(?!${this.src_ZCc}|[.]|$)|`+(this.opts["---"]?"\\-(?!--(?:[^-]|$))(?:-{0,19})|":"\\-{1,20}|")+`,(?!${this.src_ZCc}|$)|;(?!${this.src_ZCc}|$)|\\!{1,20}(?!${this.src_ZCc}|[!]|$)|\\?(?!${this.src_ZCc}|[?]|$)|`+this.get_path_extra().source+`[\\\\/:%@#&=_~*]|(?!${this.get_path_terminator().source}).){1,${this.opts.maxLength}}|\\/)?`)}get_mail_name(){return this.cache.src_mail_name??=new RegExp("[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}")}get_xn(){return this.cache.src_xn??=new RegExp("xn--[a-z0-9\\-]{1,59}")}get_tld(){if(this.cache.tld)return this.cache.tld;const e=[...new Set(this.opts.tlds||[])].sort().reverse().join("|");return this.cache.tld=new RegExp(`${e||"$#none#$"}|${this.get_xn().source}`),this.cache.tld}get_domain_root(){return this.cache.src_domain_root??=new RegExp("(?:"+this.get_xn().source+`|${this.get_pseudo_letter().source}{1,63})`)}get_domain(){return this.cache.src_domain??=new RegExp("(?:"+this.get_xn().source+`|(?:${this.get_pseudo_letter().source})|(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source}))`)}get_url_host_port(){return this.cache.url_host_port??=new RegExp("(?:"+this.get_ipv6_url_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,10}${this.get_domain().source}))`+this.get_port().source+this.get_host_terminator().source)}get_fuzzy_url_host_port(){return this.cache.fuzzy_url_host_port??=new RegExp("(?:"+(this.opts.fuzzyIP?this.get_ipv4_addr().source+"|":"")+`(?:(?:(?:${this.get_domain().source})\\.){1,10}(?:${this.get_tld().source})))`+this.get_host_terminator().source)}get_mail_host(){return this.cache.src_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,4}${this.get_domain().source}))`+this.get_host_terminator().source)}get_fuzzy_mail_host(){return this.cache.src_fuzzy_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source}))`+this.get_host_terminator().source)}get_path_extra(){return this.cache.src_path_extra??=new RegExp("")}get_fuzzy_mail_host_search(){return this.cache.mail_fuzzy_host_search??=new RegExp(`@${this.get_fuzzy_mail_host().source}`,"ig")}get_fuzzy_link_search(){return this.cache.link_fuzzy_search??=new RegExp(`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${this.src_ZPCc}))(?:(?![$+<=>^\`||])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,"ig")}get_http_validator(){return this.cache.http_validator??=new RegExp("\\/\\/"+(this.opts.urlAuth?this.get_auth().source:"")+this.get_url_host_port().source+this.get_path().source,"iy")}get_relative_proto_validator(){return this.cache.relative_proto_validator??=new RegExp((this.opts.urlAuth?this.get_auth().source:"")+`(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})`+this.get_port().source+this.get_host_terminator().source+this.get_path().source,"iy")}get_mail_name_validator(){return this.cache.mail_name_validator??=new RegExp(`(?:^|${this.get_text_separators().source}|"|\\(|${this.src_ZCc})(${this.get_mail_name().source})$`)}get_mailto_validator(){return this.cache.mailto_validator??=new RegExp(`${this.get_mail_name().source}@${this.get_mail_host().source}`,"iy")}get_schema_names(){return this.cache.schema_names??=new RegExp((this.opts.schema_names||[]).map(e=>this.escapeRE(e)).join("|"))}get_schema_search(){return this.cache.schema_search??=new RegExp(`(^|(?!_)(?:[><|]|${this.src_ZPCc}))(${this.get_schema_names().source})`,"ig")}get_schema_at_start(){return this.cache.schema_at_start??=new RegExp(`^${this.get_schema_search().source}`,"i")}},Ps={validate:(e,t,n)=>{const r=n.re.get_http_validator();r.lastIndex=t;const o=r.exec(e);return o?o[0].length:0},normalize:(e,t)=>t.normalize(e)},Jb={"http:":Ps,"https:":Ps,"ftp:":Ps,"//":{validate:function(e,t,n){const r=n.re.get_relative_proto_validator();r.lastIndex=t;const o=r.exec(e);return o?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:o[0].length:0},normalize:(e,t)=>t.normalize(e)},"mailto:":{validate:function(e,t,n){const r=n.re.get_mailto_validator();r.lastIndex=t;const o=r.exec(e);return o?o[0].length:0},normalize:(e,t)=>t.normalize(e)}},$b="a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw",Xb="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф";function qb(){const e=Xb.split("|");return $b.split("|").forEach(t=>{const n=t.indexOf(":"),r=t.slice(0,n);for(const o of t.slice(n+1))e.push(r+o)}),e}var ev={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:qb(),urlAuth:!1,maxLength:1e4},vc=class{schema;index;lastIndex;raw;text;url;constructor(e,t,n,r){const o=e.slice(n,r);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=r,this.raw=o,this.text=o,this.url=o}},tv=class{__opts__;__schemas__;re;constructor(e={}){const{rebuilder:t,...n}=e;this.__opts__={...ev,...n},this.__schemas__={...Jb},this.re=t||new Zb,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)})}add(e,t=null){if(!t)delete this.__schemas__[e];else{const n={normalize:(r,o)=>o.normalize(r),...t};this.__schemas__[e]=n}return this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}set(e={}){return this.__opts__={...this.__opts__,...e},this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}test(e){if(!e.length)return!1;let t,n;for(n=this.re.get_schema_search(),n.lastIndex=0;(t=n.exec(e))!==null;)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0;if(this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(n=this.re.get_fuzzy_link_search(),n.lastIndex=0,n.exec(e)!==null))return!0;if(this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&e.indexOf("@")>=0){const r=this.re.get_fuzzy_mail_host_search(),o=this.re.get_mail_name_validator();for(r.lastIndex=0;(t=r.exec(e))!==null;){const s=e.slice(Math.max(0,t.index-65),t.index);if(o.test(s))return!0}}return!1}testSchemaAt(e,t,n){return this.__schemas__[t.toLowerCase()]?this.__schemas__[t.toLowerCase()].validate(e.slice(0,n+this.__opts__.maxLength),n,this):0}match(e){const t=[],n=this.re.get_schema_search();let r,o,s,i,a,c,u=!1,f=!1,h=!1,g=0;if(!e.length)return null;for(n.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(r=this.re.get_fuzzy_link_search(),r.lastIndex=0),this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&(o=this.re.get_fuzzy_mail_host_search(),o.lastIndex=0,s=this.re.get_mail_name_validator());;){const A=Math.max(g-1,0);if(o&&s&&!h&&(!a||a.index<g))for(o.lastIndex<A&&(o.lastIndex=A);;){const b=o.exec(e);if(!b){h=!0,a=void 0;break}const y=s.exec(e.slice(Math.max(0,b.index-65),b.index));if(y){if(a={schema:"mailto:",index:b.index-y[1].length,lastIndex:b.index+b[0].length},a.index>=g)break;o.lastIndex<A&&(o.lastIndex=A)}}if(r&&!f&&(!i||i.index<g))for(r.lastIndex<A&&(r.lastIndex=A);;){const b=r.exec(e);if(!b){f=!0,i=void 0;break}if(i={schema:"",index:b.index+b[1].length,lastIndex:b.index+b[0].length},i.index>=g)break;r.lastIndex<A&&(r.lastIndex=A)}let p=a;(!p||i&&(i.index<p.index||i.index===p.index&&i.lastIndex>p.lastIndex))&&(p=i);let m;if(!u)for(;;){if(!c){n.lastIndex<A&&(n.lastIndex=A);const C=n.exec(e);if(!C){u=!0;break}c={schema:C[2],index:C.index+C[1].length,lastIndex:C.index+C[0].length}}if(c.index<g){c=void 0;continue}if(p&&c.index>p.index)break;const b=c;c=void 0;const y=this.testSchemaAt(e,b.schema,b.lastIndex);if(y){m={schema:b.schema,index:b.index,lastIndex:b.lastIndex+y};break}}let x=m;if((!x||a&&(a.index<x.index||a.index===x.index&&a.lastIndex>x.lastIndex))&&(x=a),(!x||i&&(i.index<x.index||i.index===x.index&&i.lastIndex>x.lastIndex))&&(x=i),!x)break;x===a?a=void 0:x===i&&(i=void 0);const v=new vc(e,x.schema,x.index,x.lastIndex);v.schema?this.__schemas__[v.schema].normalize(v,this):this.normalize(v),t.push(v),g=x.lastIndex}return t.length?t:null}matchAtStart(e){if(!e.length)return null;const t=this.re.get_schema_at_start().exec(e);if(!t)return null;const n=this.testSchemaAt(e,t[2],t[0].length);if(!n)return null;const r=new vc(e,t[2],t.index+t[1].length,t.index+t[0].length+n);return this.__schemas__[r.schema].normalize(r,this),r}tlds(e,t=!1){return e=Array.isArray(e)?e:[e],t?this.__opts__.tlds=this.__opts__.tlds.concat(e):this.__opts__.tlds=e,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}normalize(e){e.schema||(e.url=`http://${e.url}`),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)}};const Vn=2147483647,Lt=36,La=1,jr=26,nv=38,rv=700,yf=72,Cf=128,If="-",ov=/^xn--/,sv=/[^\0-\x7F]/,iv=/[\x2E\u3002\uFF0E\uFF61]/g,av={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Ts=Lt-La,Kt=Math.floor,Ns=String.fromCharCode;function fn(e){throw new RangeError(av[e])}function lv(e,t){const n=[];let r=e.length;for(;r--;)n[r]=t(e[r]);return n}function wf(e,t){const n=e.split("@");let r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(iv,".");const o=e.split("."),s=lv(o,t).join(".");return r+s}function kf(e){const t=[];let n=0;const r=e.length;for(;n<r;){const o=e.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){const s=e.charCodeAt(n++);(s&64512)==56320?t.push(((o&1023)<<10)+(s&1023)+65536):(t.push(o),n--)}else t.push(o)}return t}const cv=e=>String.fromCodePoint(...e),uv=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:Lt},yc=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},Ef=function(e,t,n){let r=0;for(e=n?Kt(e/rv):e>>1,e+=Kt(e/t);e>Ts*jr>>1;r+=Lt)e=Kt(e/Ts);return Kt(r+(Ts+1)*e/(e+nv))},Sf=function(e){const t=[],n=e.length;let r=0,o=Cf,s=yf,i=e.lastIndexOf(If);i<0&&(i=0);for(let a=0;a<i;++a)e.charCodeAt(a)>=128&&fn("not-basic"),t.push(e.charCodeAt(a));for(let a=i>0?i+1:0;a<n;){const c=r;for(let f=1,h=Lt;;h+=Lt){a>=n&&fn("invalid-input");const g=uv(e.charCodeAt(a++));g>=Lt&&fn("invalid-input"),g>Kt((Vn-r)/f)&&fn("overflow"),r+=g*f;const A=h<=s?La:h>=s+jr?jr:h-s;if(g<A)break;const p=Lt-A;f>Kt(Vn/p)&&fn("overflow"),f*=p}const u=t.length+1;s=Ef(r-c,u,c==0),Kt(r/u)>Vn-o&&fn("overflow"),o+=Kt(r/u),r%=u,t.splice(r++,0,o)}return String.fromCodePoint(...t)},Rf=function(e){const t=[];e=kf(e);const n=e.length;let r=Cf,o=0,s=yf;for(const c of e)c<128&&t.push(Ns(c));const i=t.length;let a=i;for(i&&t.push(If);a<n;){let c=Vn;for(const f of e)f>=r&&f<c&&(c=f);const u=a+1;c-r>Kt((Vn-o)/u)&&fn("overflow"),o+=(c-r)*u,r=c;for(const f of e)if(f<r&&++o>Vn&&fn("overflow"),f===r){let h=o;for(let g=Lt;;g+=Lt){const A=g<=s?La:g>=s+jr?jr:g-s;if(h<A)break;const p=h-A,m=Lt-A;t.push(Ns(yc(A+p%m,0))),h=Kt(p/m)}t.push(Ns(yc(h,0))),s=Ef(o,u,a===i),o=0,++a}++o,++r}return t.join("")},dv=function(e){return wf(e,function(t){return ov.test(t)?Sf(t.slice(4).toLowerCase()):t})},fv=function(e){return wf(e,function(t){return sv.test(t)?"xn--"+Rf(t):t})},Cc={version:"2.3.1",ucs2:{decode:kf,encode:cv},decode:Sf,encode:Rf,toASCII:fv,toUnicode:dv};var Ic=Object.defineProperty,Df=(e,t)=>{let n={};for(var r in e)Ic(n,r,{get:e[r],enumerable:!0});return Ic(n,Symbol.toStringTag,{value:"Module"}),n},pv=Df({arrayReplaceAt:()=>Bf,asciiTrim:()=>As,callable:()=>Ff,escapeHtml:()=>vn,escapeRE:()=>Iv,fromCodePoint:()=>Mr,isMdAsciiPunct:()=>Nr,isPunctChar:()=>Mf,isPunctCharCode:()=>Tr,isSpace:()=>Ve,isValidEntityCode:()=>Ka,isWhiteSpace:()=>Pr,lib:()=>wv,normalizeReference:()=>hs,unescapeAll:()=>rr,unescapeMd:()=>mv});function Ff(e){const t=function(...n){return Reflect.construct(e,n,new.target&&new.target!==t?new.target:e)};return Object.defineProperty(t,"name",{value:e.name}),Object.setPrototypeOf(t,e),t.prototype=e.prototype,t}function Bf(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function Ka(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function Mr(e){if(e>65535){e-=65536;const t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var jf=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,hv=new RegExp(`${jf.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`,"gi"),Av=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function gv(e,t){if(t.charCodeAt(0)===35&&Av.test(t)){const r=t[1].toLowerCase()==="x"?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Ka(r)?Mr(r):e}const n=vf(e);return n!==e?n:e}function mv(e){return e.indexOf("\\")<0?e:e.replace(jf,"$1")}function rr(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(hv,function(t,n,r){return n||gv(t,r)})}var xv=/[&<>"]/,bv=/[&<>"]/g,vv={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function yv(e){return vv[e]}function vn(e){return xv.test(e)?e.replace(bv,yv):e}var Cv=/[.?*+^$[\]\\(){}|-]/g;function Iv(e){return e.replace(Cv,"\\$&")}function Ve(e){switch(e){case 9:case 32:return!0}return!1}function Pr(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function Mf(e){return Ha.test(e)||xf.test(e)}function Tr(e){return Mf(Mr(e))}function Nr(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function hs(e){return e=e.trim().replace(/\s+/g," "),e.toLowerCase().toUpperCase()}function wc(e){return e===32||e===9||e===10||e===13}function As(e){let t=0;for(;t<e.length&&wc(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&wc(e.charCodeAt(n));n--);return e.slice(t,n+1)}var wv={mdurl:Tb,ucmicro:_b};function kv(e,t,n){let r,o,s,i;const a=e.posMax,c=e.pos;for(e.pos=t+1,r=1;e.pos<a;){if(s=e.src.charCodeAt(e.pos),s===93&&(r--,r===0)){o=!0;break}if(i=e.pos,e.md.inline.skipToken(e),s===91){if(i===e.pos-1)r++;else if(n)return e.pos=c,-1}}let u=-1;return o&&(u=e.pos),e.pos=c,u}function Ev(e,t,n){let r,o=t;const s={ok:!1,pos:0,str:""};if(e.charCodeAt(o)===60){for(o++;o<n;){if(r=e.charCodeAt(o),r===10||r===60)return s;if(r===62)return s.pos=o+1,s.str=rr(e.slice(t+1,o)),s.ok=!0,s;if(r===92&&o+1<n){o+=2;continue}o++}return s}let i=0;for(;o<n&&(r=e.charCodeAt(o),!(r===32||r<32||r===127));){if(r===92&&o+1<n){if(e.charCodeAt(o+1)===32){o++;continue}o+=2;continue}if(r===40&&(i++,i>32))return s;if(r===41){if(i===0)break;i--}o++}return t===o||i!==0||(s.str=rr(e.slice(t,o)),s.pos=o,s.ok=!0),s}function Sv(e,t,n,r){let o,s=t;const i={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)i.str=r.str,i.marker=r.marker;else{if(s>=n)return i;let a=e.charCodeAt(s);if(a!==34&&a!==39&&a!==40)return i;t++,s++,a===40&&(a=41),i.marker=a}for(;s<n;){if(o=e.charCodeAt(s),o===i.marker)return i.pos=s+1,i.str+=rr(e.slice(t,s)),i.ok=!0,i;if(o===40&&i.marker===41)return i;o===92&&s+1<n&&s++,s++}return i.can_continue=!0,i.str+=rr(e.slice(t,s)),i}var Rv=Df({parseLinkDestination:()=>Ev,parseLinkLabel:()=>kv,parseLinkTitle:()=>Sv});function _r(e){"@babel/helpers - typeof";return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_r(e)}function Dv(e,t){if(_r(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(_r(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fv(e){var t=Dv(e,"string");return _r(t)=="symbol"?t:t+""}function xe(e,t,n){return(t=Fv(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Fn=class{constructor(e,t,n){xe(this,"map",null),xe(this,"level",0),xe(this,"children",null),xe(this,"content",""),xe(this,"markup",""),xe(this,"info",""),xe(this,"block",!1),xe(this,"hidden",!1),this.type=e,this.tag=t,this.attrs=null,this.nesting=n,this.meta=null}attrIndex(e){if(!this.attrs)return-1;const t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1}attrPush(e){this.attrs?this.attrs.push(e):this.attrs=[e]}attrSet(e,t){const n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r}attrGet(e){const t=this.attrIndex(e);let n=null;return t>=0&&(n=this.attrs[t][1]),n}attrJoin(e,t){const n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=`${this.attrs[n][1]} ${t}`}},Or=class{constructor(){xe(this,"__rules__",[]),xe(this,"__cache__",null)}__find__(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1}__compile__(){const e=new Set;this.__rules__.forEach(t=>{t.enabled&&t.alt.forEach(n=>{n&&e.add(n)})}),this.__cache__=Object.create(null),this.__cache__[""]=[],this.__rules__.forEach(t=>{t.enabled&&this.__cache__[""].push(t.fn)}),e.forEach(t=>{this.__cache__[t]=[],this.__rules__.forEach(n=>{n.enabled&&n.alt.indexOf(t)>=0&&this.__cache__[t].push(n.fn)})})}at(e,t,n={}){const r=this.__find__(e);if(r===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__[r].fn=t,this.__rules__[r].alt=n.alt||[],this.__cache__=null}before(e,t,n,r={}){const o=this.__find__(e);if(o===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(o,0,{name:t,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null}after(e,t,n,r={}){const o=this.__find__(e);if(o===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(o+1,0,{name:t,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null}push(e,t,n={}){this.__rules__.push({name:e,enabled:!0,fn:t,alt:n.alt||[]}),this.__cache__=null}enable(e,t=!1){Array.isArray(e)||(e=[e]);const n=[];return e.forEach(r=>{const o=this.__find__(r);if(o<0){if(t)return;throw new Error(`Rules manager: invalid rule name ${r}`)}this.__rules__[o].enabled=!0,n.push(r)}),this.__cache__=null,n}enableOnly(e,t=!1){Array.isArray(e)||(e=[e]),this.__rules__.forEach(n=>{n.enabled=!1}),this.enable(e,t)}disable(e,t=!1){Array.isArray(e)||(e=[e]);const n=[];return e.forEach(r=>{const o=this.__find__(r);if(o<0){if(t)return;throw new Error(`Rules manager: invalid rule name ${r}`)}this.__rules__[o].enabled=!1,n.push(r)}),this.__cache__=null,n}getRules(e){return this.__cache__||this.__compile__(),this.__cache__[e]||[]}},zt={};zt.code_inline=function(e,t,n,r,o){const s=e[t];return`<code${o.renderAttrs(s)}>${vn(s.content)}</code>`};zt.code_block=function(e,t,n,r,o){const s=e[t];return`<pre${o.renderAttrs(s)}><code>${vn(e[t].content)}</code></pre>
5
- `};zt.fence=function(e,t,n,r,o){const s=e[t],i=s.info?rr(s.info).trim():"";let a="",c="";if(i){const f=i.split(/(\s+)/g);a=f[0],c=f.slice(2).join("")}let u;if(n.highlight?u=n.highlight(s.content,a,c)||vn(s.content):u=vn(s.content),u.indexOf("<pre")===0)return u+`
6
- `;if(i){const f=s.attrIndex("class"),h=s.attrs?s.attrs.slice():[];f<0?h.push(["class",`${n.langPrefix}${a}`]):(h[f]=[h[f][0],h[f][1]],h[f][1]+=` ${n.langPrefix}${a}`);const g={attrs:h};return`<pre><code${o.renderAttrs(g)}>${u}</code></pre>
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index2.js","assets/terminal-pane.js","assets/index.js","assets/index.css"])))=>i.map(i=>d[i]);
2
+ import{d as Ke,r as f,E as Ht,e as Ft,f as Hp,g as xu,h as at,i as Me,j as c,N as Er,k as dt,l as Ut,m as bu,n as ge,o as Nt,p as ji,u as mt,L as Kp,q as Wp,s as Lp,t as Qp,v as Gp,w as Yp,x as vu,y as zp,z as Up,A as Vp,B as Zp,C as Jp,D as $p,F as xl,G as Ye,H as Xp,a as qp,b as eh,R as th,c as nh,P as rh}from"./index.js";import{u as wt,b as le,i as Xe,c as Te,d as ve,g as Kt,o as je,e as yt,f as kt,h as Mi,j as ue,k as Vt,l as Ce,m as oh,n as Pt,p as jn,q as Jn,r as sh,t as ct,s as Lo,v as it,w as gt,x as Tn,y as Qo,z as Fn,C as $n,D as ri,E as Cn,F as Ni,H as ih,J as yu,K as ah,L as Ti,M as Go,N as Cu,O as bl,P as Yn,Q as oi,S as Pi,B as He,T as Iu,U as _i,V as Cr,W as xr,X as Oi,Y as wu,Z as Hi,_ as Ki,$ as Yo,a0 as Wi,a1 as ln,a2 as Li,a3 as lh,I as et,a4 as Qi,a5 as ch,G as si,a6 as vl,a7 as yl,A as uh,a as dh,R as fh}from"./input.js";import{u as ku,B as Co,T as Sr,_ as ph,p as hh,c as Ah}from"./terminal-pane.js";const gh=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Gi=Ke("check",gh);const mh=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Pn=Ke("chevron-down",mh);const xh=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Yi=Ke("chevron-up",xh);const bh=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],vh=Ke("circle-check",bh);const yh=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ch=Ke("circle-question-mark",yh);const Ih=[["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"}]],wh=Ke("copy",Ih);const kh=[["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"}]],Eh=Ke("download",kh);const Sh=[["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"}]],Eu=Ke("external-link",Sh);const Rh=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Dh=Ke("file-text",Rh);const Fh=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Bh=Ke("folder-open",Fh);const jh=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Mh=Ke("folder",jh);const Nh=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Th=Ke("link-2",Nh);const Ph=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],_h=Ke("list",Ph);const Oh=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Hh=Ke("loader-circle",Oh);const Kh=[["path",{d:"M5 12h14",key:"1ays0h"}]],Wh=Ke("minus",Kh);const Lh=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Qh=Ke("monitor",Lh);const Gh=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Yh=Ke("moon",Gh);const zh=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Cl=Ke("panel-left",zh);const Uh=[["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"}]],Su=Ke("pencil",Uh);const Vh=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Zh=Ke("play",Vh);const Jh=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ru=Ke("plus",Jh);const $h=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Xh=Ke("refresh-cw",$h);const qh=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],eA=Ke("settings-2",qh);const tA=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],nA=Ke("share-2",tA);const rA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],oA=Ke("square",rA);const sA=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],iA=Ke("sun",sA);const aA=[["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"}]],lA=Ke("trash-2",aA);const cA=[["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"}]],uA=Ke("triangle-alert",cA);const dA=[["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"}]],Du=Ke("upload",dA);const fA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],zi=Ke("x",fA);function Fu(e,t,n,r=!0,o){const[s,i]=f.useState(),a=wt(o?`${o}-label`:void 0),l=e??t??s;return le(()=>{const u=e||t||!r?void 0:pA(n.current,a);s!==u&&i(u)}),l}function pA(e,t){const n=hA(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function hA(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const n=e.id;if(n){const o=e.nextElementSibling;if(o&&o.htmlFor===n)return o}const r=e.labels;return r&&r[0]}function AA(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:gA,platform:mA,maxTouchPoints:xA}=AA(),zo=gA.toLowerCase(),Rr=mA.toLowerCase(),Uo=/^i(os$|p)/.test(Rr)||Rr==="macintel"&&xA>1,Il="android",ii=Rr===Il||zo.includes(Il),Ui=!Uo&&Rr.startsWith("mac");Rr.startsWith("win");const bA=Ui||Uo,un=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!un&&zo.includes("firefox");!un&&zo.includes("chrom");const vA=bA,Vi=/jsdom|happydom/.test(zo),ai="data-base-ui-focusable",Bu="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Vo="ArrowLeft",Zo="ArrowRight",ju="ArrowUp",Zi="ArrowDown";function Io(e,t){if(!Te(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(ve(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function Ss(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 yA(e){return e.matches("html,body")}function Jo(e){return Xe(e)&&e.matches(Bu)}function CA(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Bu}`)!=null}function li(e){return e?e.getAttribute("role")==="combobox"&&Jo(e):!1}function IA(e){if(!e||Vi)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function wo(e){return e?e.hasAttribute(ai)?e:e.querySelector(`[${ai}]`)||e:null}function bn(e,t,n=!0){return e.filter(o=>o.parentId===t).flatMap(o=>[...!n||o.context?.open?[o]:[],...bn(e,o.id,n)])}function wl(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(s=>s.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function Qt(e){e.preventDefault(),e.stopPropagation()}function wA(e){return"nativeEvent"in e}function Ji(e){return e.pointerType===""&&e.isTrusted?!0:ii&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function $i(e){return Vi?!1:!ii&&e.width===0&&e.height===0||ii&&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 xn(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function kA(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const Xn=Math.min,sn=Math.max,ko=Math.round,$r=Math.floor,an=e=>({x:e,y:e}),EA={left:"right",right:"left",bottom:"top",top:"bottom"};function Mu(e,t,n){return sn(e,Xn(t,n))}function vn(e,t){return typeof e=="function"?e(t):e}function Tt(e){return e.split("-")[0]}function In(e){return e.split("-")[1]}function Xi(e){return e==="x"?"y":"x"}function qi(e){return e==="y"?"height":"width"}function Mt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ea(e){return Xi(Mt(e))}function SA(e,t,n){n===void 0&&(n=!1);const r=In(e),o=ea(e),s=qi(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Eo(i)),[i,Eo(i)]}function RA(e){const t=Eo(e);return[ci(e),t,ci(t)]}function ci(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const kl=["left","right"],El=["right","left"],DA=["top","bottom"],FA=["bottom","top"];function BA(e,t,n){switch(e){case"top":case"bottom":return n?t?El:kl:t?kl:El;case"left":case"right":return t?DA:FA;default:return[]}}function jA(e,t,n,r){const o=In(e);let s=BA(Tt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ci)))),s}function Eo(e){const t=Tt(e);return EA[t]+e.slice(t.length)}function MA(e){var t,n,r,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(o=e.left)!=null?o:0}}function Nu(e){return typeof e!="number"?MA(e):{top:e,right:e,bottom:e,left:e}}function Dr(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Ir(e,t){return t<0||t>=e.length}function xo(e,t){return on(e.current,{disabledIndices:t})}function ui(e,t){return on(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function on(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=t;do s+=n?-o:o;while(s>=0&&s<=e.length-1&&So(e,s,r));return s}function So(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;const o=e[t];return o?!$o(o)||o.matches(":disabled")?!0:!n&&(o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true"):!1}function NA(e){return e.visibility==="hidden"||e.visibility==="collapse"}function $o(e,t=e?Kt(e):null){return!e||!e.isConnected||!t||NA(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const TA='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function PA(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return Mi(n)?n.host:null}function di(e){for(const t of Array.from(e.children))if(kt(t)==="summary")return t;return null}function _A(e,t){const n=di(t);return!!n&&(e===n||ve(n,e))}function Tu(e){const t=e?kt(e):"";return e!=null&&e.matches(TA)&&(t!=="summary"||e.parentElement!=null&&kt(e.parentElement)==="details"&&di(e.parentElement)===e)&&(t!=="details"||di(e)==null)&&(t!=="input"||e.type!=="hidden")}function Pu(e){if(!Tu(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=PA(t)){const n=t!==e,r=kt(t)==="slot";if(t.hasAttribute("inert")||n&&kt(t)==="details"&&!t.open&&!_A(e,t)||t.hasAttribute("hidden")||!r&&!OA(t,n))return!1}return!0}function OA(e,t){const n=Kt(e);return t?n.display!=="none":$o(e,n)}function _u(e){const t=e.tabIndex;if(t<0){const n=kt(e);if(n==="details"||n==="audio"||n==="video"||Xe(e)&&e.isContentEditable)return 0}return t}function Rs(e){if(kt(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function HA(e,t){const n=Rs(e);if(!n)return!0;const r=t.find(o=>{const s=Rs(o);return s?.name===n.name&&s.form===n.form&&s.checked});return r?r===n:t.find(o=>{const s=Rs(o);return s?.name===n.name&&s.form===n.form})===n}function Ou(e){if(Xe(e)&&kt(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Xe(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Hu(e,t){Ou(e).forEach(n=>{Tu(n)&&t.push(n),Hu(n,t)})}function Ku(e,t,n){Ou(e).forEach(r=>{Xe(r)&&r.matches(t)&&n.push(r),Ku(r,t,n)})}function ta(e){return Pu(e)&&_u(e)>=0}function Wu(e){const t=[];return Hu(e,t),t.filter(Pu)}function Wr(e){const t=Wu(e);return t.filter(n=>_u(n)>=0&&HA(n,t))}function Lu(e,t){const n=Wr(e),r=n.length;if(r===0)return;const o=yt(je(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function na(e){return Lu(je(e).body,1)||e}function Qu(e){return Lu(je(e).body,-1)||e}function Gu(e,t){if(!e)return null;const n=Wr(je(e).body),r=n.length;if(r===0)return null;const o=n.indexOf(e);if(o===-1)return null;const s=(o+t+r)%r;return n[s]}function KA(e){return Gu(e,1)}function WA(e){return Gu(e,-1)}function zn(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!ve(n,r)}function LA(e){Wr(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Sl(e){const t=[];Ku(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function ra(e){f.useEffect(e,Ht)}const ar=0;class Wt{static create(){return new Wt}currentId=ar;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=ar,n()},t)}isStarted(){return this.currentId!==ar}clear=()=>{this.currentId!==ar&&(clearTimeout(this.currentId),this.currentId=ar)};disposeEffect=()=>this.clear}function ht(){const e=Ft(Wt.create).current;return ra(e.disposeEffect),e}const QA=f.createContext({disabled:!1});function GA(){return f.useContext(QA)}var cn=Hp();const Xr=null;class YA{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}let qr=new YA;class It{static create(){return new It}static request(t){return qr.request(t)}static cancel(t){return qr.cancel(t)}currentId=Xr;request(t){this.cancel(),this.currentId=qr.request(()=>{this.currentId=Xr,t()})}cancel=()=>{this.currentId!==Xr&&(qr.cancel(this.currentId),this.currentId=Xr)};disposeEffect=()=>this.cancel}function qn(){const e=Ft(It.create).current;return ra(e.disposeEffect),e}function tn(e){return e==null?e:"current"in e?e.current:e}function oa(e,t=!1){const n=qn();return ue((r,o=null)=>{n.cancel();const s=tn(e);if(s==null)return;const i=s,a=()=>{cn.flushSync(r)};if(typeof i.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function l(){Promise.all(i.getAnimations().map(u=>u.finished)).then(()=>{o?.aborted||a()},()=>{if(o?.aborted)return;if(i.getAnimations().some(d=>d.pending||d.playState!=="finished")){l();return}a()})}if(t){const u="data-starting-style";if(!i.hasAttribute(u)){n.request(l);return}const d=new MutationObserver(()=>{i.hasAttribute(u)||(d.disconnect(),l())});d.observe(i,{attributes:!0,attributeFilter:[u]}),o?.addEventListener("abort",()=>d.disconnect(),{once:!0});return}n.request(l)})}function Zt(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=ue(o),i=oa(r,n);f.useEffect(()=>{if(!t)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[t,n,s,i])}let Ro=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const zA={"data-starting-style":""},UA={"data-ending-style":""},_n={transitionStatus(e){return e==="starting"?zA:e==="ending"?UA:null}};function sr(e,t=!1,n=!1){const[r,o]=f.useState(e&&t?"idle":void 0),[s,i]=f.useState(e);return e&&!s&&(i(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),le(()=>{if(!e&&s&&r!=="ending"&&n){const a=It.request(()=>{o("ending")});return()=>{It.cancel(a)}}},[e,s,r,n]),le(()=>{if(!e||t)return;const a=It.request(()=>{o(void 0)});return()=>{It.cancel(a)}},[t,e]),le(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const a=It.request(()=>{o("idle")});return()=>{It.cancel(a)}},[t,e,s,r]),{mounted:s,setMounted:i,transitionStatus:r}}var Ds={exports:{}},Fs={};var Rl;function VA(){if(Rl)return Fs;Rl=1;var e=xu();function t(p,A){return p===A&&(p!==0||1/p===1/A)||p!==p&&A!==A}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(p,A){var m=A(),h=r({inst:{value:m,getSnapshot:A}}),g=h[0].inst,x=h[1];return s(function(){g.value=m,g.getSnapshot=A,l(g)&&x({inst:g})},[p,m,A]),o(function(){return l(g)&&x({inst:g}),p(function(){l(g)&&x({inst:g})})},[p]),i(m),m}function l(p){var A=p.getSnapshot;p=p.value;try{var m=A();return!n(p,m)}catch{return!0}}function u(p,A){return A()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return Fs.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Fs}var Dl;function Yu(){return Dl||(Dl=1,Ds.exports=VA()),Ds.exports}var Xo=Yu();const br={v:[]},Fl=()=>br.v.forEach(e=>e()),ZA=e=>(br.v.push(e)===1&&addEventListener("hashchange",Fl),()=>{br.v=br.v.filter(t=>t!==e),br.v.length||removeEventListener("hashchange",Fl)}),JA=()=>"/"+location.hash.replace(/^#?\/?/,""),$A=(e,{state:t=null,replace:n=!1}={})=>{const r=location.href,[o,s]=e.replace(/^#?\/?/,"").split("?"),i=new URL(location.href);i.hash=`/${o}`,s&&(i.search=s);const a=i.href;n?history.replaceState(t,"",a):history.pushState(t,"",a);const l=typeof HashChangeEvent<"u"?new HashChangeEvent("hashchange",{oldURL:r,newURL:a}):new Event("hashchange",{detail:{oldURL:r,newURL:a}});dispatchEvent(l)},zu=({ssrPath:e="/"}={})=>[Xo.useSyncExternalStore(ZA,JA,()=>e),$A];zu.hrefs=e=>"#"+e;const Bs=768;function XA(){const[e,t]=f.useState(void 0);return f.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Bs-1}px)`),r=()=>t(window.innerWidth<Bs);return n.addEventListener("change",r),t(window.innerWidth<Bs),()=>n.removeEventListener("change",r)},[]),!!e}const Uu=f.createContext(void 0);function On(e){const t=f.useContext(Uu);if(!e&&t===void 0)throw new Error(at(27));return t}(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Ro.startingStyle]="startingStyle",e[e.endingStyle=Ro.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const qA={"data-popup-open":""},eg={"data-popup-open":"","data-pressed":""},tg={"data-open":""},ng={"data-closed":""},rg={"data-anchor-hidden":""},Vu={open(e){return e?qA:null}},fi={open(e){return e?eg:null}},Lr={open(e){return e?tg:ng},anchorHidden(e){return e?rg:null}},sa={...Lr,..._n},ia=f.forwardRef(function(t,n){const{render:r,className:o,style:s,forceRender:i=!1,...a}=t,l=On(),u=l.useState("open"),d=l.useState("nested"),p=l.useState("mounted"),A=l.useState("transitionStatus");return Me("div",t,{state:{open:u,transitionStatus:A},ref:[l.context.backdropRef,n],stateAttributesMapping:sa,props:[{role:"presentation",hidden:!p,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:i||!d})}),Qr=f.forwardRef(function(t,n){const{render:r,className:o,style:s,disabled:i=!1,nativeButton:a=!0,...l}=t,u=On(),d=u.useState("open"),{getButtonProps:p,buttonRef:A}=Vt({disabled:i,native:a}),m={disabled:i};function h(g){d&&u.setOpen(!1,Ce(oh,g.nativeEvent))}return Me("button",t,{state:m,ref:[n,A],props:[{onClick:h},l,p]})}),aa=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,l=On(),u=wt(i);return l.useSyncedValueWithCleanup("descriptionElementId",u),Me("p",t,{ref:n,props:[{id:u},a]})});function og(e,t){return t!=null&&!xn(t)?0:typeof e=="function"?e():e}function er(e,t,n){const r=og(e,n);return typeof r=="number"?r:r?.[t]}function Bl(e){return typeof e=="function"?e():e}function Zu(e,t){return t||e==="click"||e==="mousedown"}function sg(e){return e?.includes("mouse")&&e!=="mousedown"}const ig=f.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Wt,currentIdRef:{current:null},currentContextRef:{current:null}});function ag(e,t){e.current=t.current}function lg(e,t={open:!1}){const{open:n}=t,r="rootStore"in e?e.rootStore:e,o=r.useState("floatingId"),s=f.useContext(ig),{currentIdRef:i,delayRef:a,timeoutMs:l,initialDelayRef:u,currentContextRef:d,hasProvider:p,timeout:A}=s,[m,h]=f.useState(!1),g=f.useRef(n);return le(()=>{g.current=n},[n]),le(()=>{function x(){d.current?.setIsInstantPhase(!1),i.current=null,d.current=null,a.current=u.current,A.clear()}if(i.current&&!n&&i.current===o){if(h(!1),l){const b=o;return A.start(l,()=>{r.select("open")||i.current&&i.current!==b||x()}),()=>{(g.current||i.current!==b)&&A.clear()}}x()}},[n,o,i,a,l,u,d,A,r]),le(()=>{if(!n)return;const x=d.current,b=i.current;A.clear(),d.current={onOpenChange:r.setOpen,setIsInstantPhase:h},i.current=o,a.current={open:0,close:er(u.current,"close")},b!==null&&b!==o?(h(!0),x?.setIsInstantPhase(!0),x?.onOpenChange(!1,Ce(Pt))):(h(!1),x?.setIsInstantPhase(!1))},[n,o,r,i,a,u,d,A]),le(()=>()=>{if(i.current===o){if(d.current=null,!g.current)return;i.current=null,ag(a,u),A.clear()}},[d,i,a,o,u,A]),f.useMemo(()=>({hasProvider:p,delayRef:a,isInstantPhase:m}),[p,a,m])}function De(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function zt(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function nt(e){const t=Ft(cg,e).current;return t.next=e,le(t.effect),t}function cg(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const Ju={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},qo={...Ju,position:"fixed",top:0,left:0},la={...Ju,position:"absolute"},tr=f.forwardRef(function(t,n){const[r,o]=f.useState();le(()=>{vA&&un&&o("button")},[]);const s={tabIndex:0,role:r};return c.jsx("span",{...t,ref:n,style:qo,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});function Fr(e){return`data-base-ui-${e}`}let eo=0;function bo(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:o}=t;cancelAnimationFrame(eo);function s(){o&&!o()||e?.focus({preventScroll:n})}if(r)return s(),Er;const i=requestAnimationFrame(s);return eo=i,()=>{eo===i&&(cancelAnimationFrame(i),eo=0)}}const js={inert:new WeakMap,"aria-hidden":new WeakMap},jl="data-base-ui-inert",pi={inert:new WeakSet,"aria-hidden":new WeakSet};let lr=new WeakMap,Ms=0;function ug(e){return pi[e]}function $u(e){return e?Mi(e)?e.host:$u(e.parentNode):null}const Ml=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=$u(n);return e.contains(r)?r:null}).filter(n=>n!=null),Nl=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},Tl=(e,t,n)=>{const r=[],o=s=>{!s||n.has(s)||Array.from(s.children).forEach(i=>{kt(i)!=="script"&&(t.has(i)?o(i):r.push(i))})};return o(e),r};function dg(e,t,n,r,{mark:o=!0}){let s=null;r?s="inert":n&&(s="aria-hidden");let i=null,a=null;const l=Ml(t,e),u=o?Tl(t,Nl(l),new Set(l)):[],d=[],p=[];if(s){const A=js[s],m=ug(s);a=m,i=A;const h=Ml(t,Array.from(t.querySelectorAll("[aria-live]"))),g=l.concat(h);Tl(t,Nl(g),new Set(g)).forEach(b=>{const v=b.getAttribute(s),y=v!==null&&v!=="false",C=(A.get(b)||0)+1;A.set(b,C),d.push(b),C===1&&y&&m.add(b),y||b.setAttribute(s,s==="inert"?"":"true")})}return o&&u.forEach(A=>{const m=(lr.get(A)||0)+1;lr.set(A,m),p.push(A),m===1&&A.setAttribute(jl,"")}),Ms+=1,()=>{i&&d.forEach(A=>{const h=(i.get(A)||0)-1;i.set(A,h),h||(!a?.has(A)&&s&&A.removeAttribute(s),a?.delete(A))}),o&&p.forEach(A=>{const m=(lr.get(A)||0)-1;lr.set(A,m),m||A.removeAttribute(jl)}),Ms-=1,Ms||(js.inert=new WeakMap,js["aria-hidden"]=new WeakMap,pi.inert=new WeakSet,pi["aria-hidden"]=new WeakSet,lr=new WeakMap)}}function Pl(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0}=t,s=je(e[0]).body;return dg(e,s,n,r,{mark:o})}const fg=500,pg=500,hg={style:{transition:"none"}},Ag="data-base-ui-click-trigger",Xu={fallbackAxisSide:"none"},qu={fallbackAxisSide:"end"},gg={clipPath:"inset(50%)",position:"fixed",top:0,left:0},ed=f.createContext(null),td=()=>f.useContext(ed),mg=Fr("portal");function nd(e={}){const{ref:t,container:n,componentProps:r=dt,elementProps:o}=e,s=Jn(),a=td()?.portalNode,[l,u]=f.useState(null),[d,p]=f.useState(null),A=ue(x=>{x!==null&&p(x)}),m=f.useRef(null);le(()=>{if(n===null){m.current&&(m.current=null,p(null),u(null));return}const x=(n&&(sh(n)?n:n.current))??a??document.body;if(x==null){m.current&&(m.current=null,p(null),u(null));return}m.current!==x&&(m.current=x,p(null),u(x))},[n,a]);const h=Me("div",r,{ref:[t,A],props:[{id:s,[mg]:""},o]}),g=l&&h?cn.createPortal(h,l):null;return{node:d,nodeId:f.isValidElement(h)?h.props.id:void 0,subtree:g}}const ca=f.forwardRef(function(t,n){const{render:r,className:o,style:s,children:i,container:a,...l}=t,{node:u,nodeId:d,subtree:p}=nd({container:a,ref:n,componentProps:t,elementProps:l}),A=f.useRef(null),m=f.useRef(null),h=f.useRef(null),g=f.useRef(null),[x,b]=f.useState(null),v=f.useRef(!1),y=x?.modal,C=x?.open,I=!!x&&!x.modal&&x.open&&!!u;f.useEffect(()=>{if(!u||y)return;function E(S){u&&S.relatedTarget&&zn(S)&&(S.type==="focusin"?v.current&&(Sl(u),v.current=!1):(LA(u),v.current=!0))}return zt(De(u,"focusin",E,!0),De(u,"focusout",E,!0))},[u,y]),le(()=>{!u||C!==!0||!v.current||(Sl(u),v.current=!1)},[C,u]);const w=f.useMemo(()=>({beforeOutsideRef:A,afterOutsideRef:m,beforeInsideRef:h,afterInsideRef:g,portalNode:u,setFocusManagerState:b}),[u]);return c.jsxs(f.Fragment,{children:[p,c.jsxs(ed.Provider,{value:w,children:[I&&u&&c.jsx(tr,{"data-type":"outside",ref:A,onFocus:E=>{if(zn(E,u))h.current?.focus();else{const S=x?x.domReference:null;Qu(S)?.focus()}}}),I&&u&&c.jsx("span",{"aria-owns":d,style:gg}),u&&cn.createPortal(i,u),I&&u&&c.jsx(tr,{"data-type":"outside",ref:m,onFocus:E=>{if(zn(E,u))g.current?.focus();else{const S=x?x.domReference:null;na(S)?.focus(),x?.closeOnFocusOut&&x?.onOpenChange(!1,Ce(jn,E.nativeEvent))}}})]})]})});function rd(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(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 ua{nodesRef={current:[]};events=rd();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const od=f.createContext(null),sd=f.createContext(null),wn=()=>f.useContext(od)?.id||null,kn=e=>{const t=f.useContext(sd);return e??t};function id(e){const t=Jn(),n=kn(e),r=wn();return le(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function xg(e){const{children:t,id:n}=e,r=wn();return c.jsx(od.Provider,{value:f.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function bg(e){const{children:t,externalTree:n}=e,r=Ft(()=>n??new ua).current;return c.jsx(sd.Provider,{value:r,children:t})}function vg(e,t){const n=it(gt(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 _l=20;let mn=[];function da(){mn=mn.filter(e=>e.deref()?.isConnected)}function Ol(e){da(),e&&kt(e)!=="body"&&(mn.push(new WeakRef(e)),mn.length>_l&&(mn=mn.slice(-_l)))}function Hl(){return da(),mn[mn.length-1]?.deref()}function yg(e){return e?ta(e)?e:Wr(e)[0]||e:null}function Kl(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=Wu(e).filter(o=>{const s=o.getAttribute("data-tabindex")||"";return ta(o)||o.hasAttribute("data-tabindex")&&!s.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function fa(e){const{context:t,children:n,disabled:r=!1,initialFocus:o=!0,returnFocus:s=!0,restoreFocus:i=!1,modal:a=!0,closeOnFocusOut:l=!0,openInteractionType:u="",nextFocusableElement:d,previousFocusableElement:p,beforeContentFocusGuardRef:A,externalTree:m,getInsideElements:h}=e,g="rootStore"in t?t.rootStore:t,x=g.useState("open"),b=g.useState("domReferenceElement"),v=g.useState("floatingElement"),{events:y,dataRef:C}=g.context,I=ue(()=>C.current.floatingContext?.nodeId),w=o===!1,E=li(b)&&w,S=nt(o),D=nt(s),k=nt(u),j=nt(x),N=kn(m),T=td(),F=f.useRef(!1),R=f.useRef(!1),O=f.useRef(!1),_=f.useRef(null),M=f.useRef(""),H=f.useRef(""),G=f.useRef(null),B=f.useRef(null),P=Ut(G,A,T?.beforeInsideRef),W=Ut(B,T?.afterInsideRef),Y=ht(),Z=ht(),Q=qn(),J=T!=null,K=wo(v),ee=ue(($=K)=>$?Wr($):[]),ce=ue(()=>h?.().filter($=>$!=null)??[]);f.useEffect(()=>{if(r||!a)return;function $(ne){ne.key==="Tab"&&ve(K,yt(je(K)))&&ee().length===0&&!E&&Qt(ne)}const X=je(K);return De(X,"keydown",$)},[r,K,a,E,ee]),f.useEffect(()=>{if(r||!x)return;const $=je(K);function X(){O.current=!1}function ne(fe){const ie=gt(fe),he=ce(),oe=ve(v,ie)||ve(b,ie)||ve(T?.portalNode,ie)||he.some(se=>se===ie||ve(se,ie));O.current=!oe,H.current=fe.pointerType||"keyboard",ie?.closest(`[${Ag}]`)&&(R.current=!0,Z.start(0,()=>{R.current=!1}))}function de(){H.current="keyboard"}return zt(De($,"pointerdown",ne,!0),De($,"pointerup",X,!0),De($,"pointercancel",X,!0),De($,"keydown",de,!0),X)},[r,v,b,K,x,T,Z,ce]),f.useEffect(()=>{if(r||!l)return;const $=je(K);function X(){R.current=!0,Z.start(0,()=>{R.current=!1})}function ne(he){const oe=gt(he);ta(oe)&&(_.current=oe)}function de(he){const oe=he.relatedTarget,se=he.currentTarget,ae=gt(he);a&&oe==null&&ae!=null&&ve(v,ae)&&Ol(ae),queueMicrotask(()=>{const xe=I(),me=g.context.triggerElements,L=ce(),z=oe?.hasAttribute(Fr("focus-guard"))&&[G.current,B.current,T?.beforeInsideRef.current,T?.afterInsideRef.current,T?.beforeOutsideRef.current,T?.afterOutsideRef.current,tn(p),tn(d)].includes(oe),ye=!(ve(b,oe)||ve(v,oe)||ve(oe,v)||ve(T?.portalNode,oe)||L.some(q=>q===oe||ve(q,oe))||me.hasMatchingElement(q=>ve(q,oe))||z||N&&(bn(N.nodesRef.current,xe).find(q=>ve(q.context?.elements.floating,oe)||ve(q.context?.elements.domReference,oe))||wl(N.nodesRef.current,xe).find(q=>[q.context?.elements.floating,wo(q.context?.elements.floating)].includes(oe)||q.context?.elements.domReference===oe)));if(se===b&&K&&Kl(K),i&&se!==b&&!$o(ae)&&yt($)===$.body){if(Xe(K)&&(K.focus(),i==="popup")){Q.request(()=>{K.focus()});return}const q=ee(),re=_.current,Se=(re&&q.includes(re)?re:null)||q[q.length-1]||K;Xe(Se)&&Se.focus()}if(C.current.insideReactTree){C.current.insideReactTree=!1;return}(E||!a)&&oe&&ye&&!R.current&&(E||oe!==Hl())&&(F.current=!0,g.setOpen(!1,Ce(jn,he)))})}function fe(){O.current||(C.current.insideReactTree=!0,Y.start(0,()=>{C.current.insideReactTree=!1}))}const ie=Xe(b)?b:null;if(!(!v&&!ie))return zt(ie&&De(ie,"focusout",de),ie&&De(ie,"pointerdown",X),v&&De(v,"focusin",ne),v&&De(v,"focusout",de),v&&T&&De(v,"focusout",fe,!0))},[r,b,v,K,a,N,T,g,l,i,ee,E,I,C,Y,Z,Q,d,p,ce]),f.useEffect(()=>{if(r||!v||!x)return;const $=Array.from(T?.portalNode?.querySelectorAll(`[${Fr("portal")}]`)||[]),ne=(N?wl(N.nodesRef.current,I()):[]).find(se=>li(se.context?.elements.domReference||null))?.context?.elements.domReference,fe=[...[v,...$,G.current,B.current,T?.beforeOutsideRef.current,T?.afterOutsideRef.current,...ce()],ne,tn(p),tn(d),E?b:null].filter(se=>se!=null),ie=Pl(fe,{ariaHidden:a||E,mark:!1}),he=[v,...$].filter(se=>se!=null),oe=Pl(he);return()=>{oe(),ie()}},[x,r,b,v,a,T,E,N,I,d,p,ce]),le(()=>{if(!x||r||!Xe(K))return;M.current="",H.current="";const $=je(K),X=yt($);queueMicrotask(()=>{const ne=S.current,de=typeof ne=="function"?ne(k.current||""):ne;if(de===void 0||de===!1||ve(K,X))return;let ie=null;const he=()=>(ie==null&&(ie=ee(K)),ie[0]||K);let oe;de===!0||de===null?oe=he():oe=tn(de),oe=oe||he();const se=ve(K,yt($));bo(oe,{preventScroll:oe===K,shouldFocus(){if(!j.current)return!1;if(se)return!0;const ae=yt($);return!(ae!==oe&&ve(K,ae))}})})},[r,x,K,ee,S,k,j]),le(()=>{if(r||!K)return;const $=je(K),X=yt($),ne=k.current==null;Ol(X);function de(ie){if(ie.open||(M.current=vg(ie.nativeEvent,H.current)),ie.reason===ct&&ie.nativeEvent.type==="mouseleave"&&(F.current=!0),ie.reason===Lo)if(ie.nested)F.current=!1;else if(Ji(ie.nativeEvent)||$i(ie.nativeEvent))F.current=!1;else{let he=!1;je(K).createElement("div").focus({get preventScroll(){return he=!0,!1}}),he?F.current=!1:F.current=!0}}y.on("openchange",de);function fe(ie){const he=D.current;let oe=typeof he=="function"?he(ie):he;if(oe===void 0||oe===!1)return null;oe===null&&(oe=!0);const se=b?.isConnected?b:null,ae=X?.isConnected&&kt(X)!=="body"?X:null;let xe=ne?ae||se:se||ae;return xe||(xe=Hl()||null),typeof oe=="boolean"?xe:tn(oe)||xe||null}return()=>{y.off("openchange",de);const ie=yt($),he=ce(),oe=ve(v,ie)||he.some(me=>me===ie||ve(me,ie))||N&&bn(N.nodesRef.current,I(),!1).some(me=>ve(me.context?.elements.floating,ie)),se=D.current,ae=M.current,xe=fe(ae);queueMicrotask(()=>{const me=yg(xe),L=typeof se!="boolean";if(se&&!F.current&&Xe(me)&&(!(!L&&me!==ie&&ie!==$.body)||oe)){const z={preventScroll:!0};ae==="keyboard"&&(z.focusVisible=!0),me.focus(z)}F.current=!1})}},[r,v,K,D,k,y,N,b,I,ce]),le(()=>{if(!un||x||!v)return;const $=yt(je(v));!Xe($)||!Jo($)||ve(v,$)&&$.blur()},[x,v]),le(()=>{if(!(r||!T))return T.setFocusManagerState({modal:a,closeOnFocusOut:l,open:x,onOpenChange:g.setOpen,domReference:b}),()=>{T.setFocusManagerState(null)}},[r,T,a,x,g,l,b]),le(()=>{if(!(r||!K))return Kl(K),()=>{queueMicrotask(da)}},[r,K]);const te=!r&&(a?!E:!0)&&(J||a);return c.jsxs(f.Fragment,{children:[te&&c.jsx(tr,{"data-type":"inside",ref:P,onFocus:$=>{if(a){const X=ee();bo(X[X.length-1])}else T?.portalNode&&(F.current=!1,zn($,T.portalNode)?na(b)?.focus():tn(p??T.beforeOutsideRef)?.focus())}}),n,te&&c.jsx(tr,{"data-type":"inside",ref:W,onFocus:$=>{a?bo(ee()[0]):T?.portalNode&&(l&&(F.current=!0),zn($,T.portalNode)?Qu(b)?.focus():tn(d??T.afterOutsideRef)?.focus())}})]})}function ad(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:a=0,reason:l=Tn}=t,u="rootStore"in e?e.rootStore:e,d=u.context.dataRef,p=f.useRef(void 0),A=qn(),m=ht(),h=f.useMemo(()=>{function g(b,v,y,C){const I=Ce(l,v,y);b&&C==="touch"&&a>0?m.start(a,()=>{u.setOpen(!0,I)}):u.setOpen(b,I)}function x(b,v,y){const C=d.current.openEvent,I=u.select("domReferenceElement")!==v;return b&&I||!b||!o?!0:C&&i?!y(C.type):!1}return{onPointerDown(b){p.current=xn(b.pointerType,!0)&&$i(b.nativeEvent)?"virtual":b.pointerType},onMouseDown(b){const v=p.current,y=b.nativeEvent,C=u.select("open");if(b.button!==0||r==="click"||xn(v,!0)&&s)return;const I=x(C,b.currentTarget,S=>S==="click"||S==="mousedown"),w=gt(y);if(Jo(w)){g(I,y,w,v);return}const E=b.currentTarget;A.request(()=>{g(I,y,E,v)})},onClick(b){if(r==="mousedown-only")return;const v=p.current;if(r==="mousedown"&&v){p.current=void 0;return}if(xn(v,!0)&&s)return;const y=u.select("open"),C=x(y,b.currentTarget,I=>I==="click"||I==="mousedown"||I==="keydown"||I==="keyup");g(C,b.nativeEvent,b.currentTarget,v)},onKeyDown(){p.current=void 0}}},[d,r,s,l,u,i,o,A,m,a]);return f.useMemo(()=>n?{reference:h}:dt,[n,h])}function Cg(e,t){let n=null,r=null,o=!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",l=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let u=s.width,d=s.height,p=s.x,A=s.y;return n==null&&t.x&&i&&(n=s.x-t.x),r==null&&t.y&&a&&(r=s.y-t.y),p-=n||0,A-=r||0,u=0,d=0,!o||l?(u=t.axis==="y"?s.width:0,d=t.axis==="x"?s.height:0,p=i&&t.x!=null?t.x:p,A=a&&t.y!=null?t.y:A):o&&!l&&(d=t.axis==="x"?s.height:d,u=t.axis==="y"?s.width:u),o=!0,{width:u,height:d,x:p,y:A,top:A,right:p+u,bottom:A+d,left:p}}}}function Wl(e){return e!=null&&e.clientX!=null}function Ig(e,t={}){const{enabled:n=!0,axis:r="both"}=t,o="rootStore"in e?e.rootStore:e,s=o.useState("open"),i=o.useState("floatingElement"),a=o.useState("domReferenceElement"),l=o.context.dataRef,u=f.useRef(!1),d=f.useRef(null),[p,A]=f.useState(),[m,h]=f.useState([]),g=ue(C=>{o.set("positionReference",C)}),x=ue((C,I,w)=>{u.current||l.current.openEvent&&!Wl(l.current.openEvent)||o.set("positionReference",Cg(w??a,{x:C,y:I,axis:r,dataRef:l,pointerType:p}))}),b=ue(C=>{s?d.current||(x(C.clientX,C.clientY,C.currentTarget),h([])):x(C.clientX,C.clientY,C.currentTarget)}),v=xn(p)?i:s;f.useEffect(()=>{if(!n){g(a);return}if(!v)return;function C(){d.current?.(),d.current=null}const I=it(i);function w(E){const S=gt(E);ve(i,S)?C():x(E.clientX,E.clientY)}return!l.current.openEvent||Wl(l.current.openEvent)?d.current=De(I,"mousemove",w):g(a),C},[v,n,i,l,a,o,x,g,m]),f.useEffect(()=>()=>{o.set("positionReference",null)},[o]),f.useEffect(()=>{n&&!i&&(u.current=!1)},[n,i]),f.useEffect(()=>{!n&&s&&(u.current=!0)},[n,s]);const y=f.useMemo(()=>{function C(I){A(I.pointerType)}return{onPointerDown:C,onPointerEnter:C,onMouseMove:b,onMouseEnter:b}},[b]);return f.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function wg(){return!1}function kg(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function es(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:o=!0,outsidePressEvent:s="sloppy",referencePress:i=wg,bubbles:a,externalTree:l}=t,u="rootStore"in e?e.rootStore:e,d=u.useState("open"),p=u.useState("floatingElement"),{dataRef:A}=u.context,m=kn(l),h=ue(typeof o=="function"?o:()=>!1),g=typeof o=="function"?h:o,x=g!==!1,b=ue(()=>s),{escapeKey:v,outsidePress:y}=kg(a),C=f.useRef(!1),I=f.useRef(!1),w=f.useRef(!1),E=f.useRef(!1),S=f.useRef(""),D=f.useRef(null),k=ht(),j=ht(),N=ue(()=>{j.clear(),A.current.insideReactTree=!1}),T=ue(P=>{const W=A.current.floatingContext?.nodeId;return(m?bn(m.nodesRef.current,W):[]).some(Z=>Z.context?.open&&!Z.context.dataRef.current[P])}),F=ue(P=>Ss(P,u.select("floatingElement"))||Ss(P,u.select("domReferenceElement"))),R=ue(P=>{i()&&u.setOpen(!1,Ce(Tn,P.nativeEvent))}),O=ue(P=>{if(!d||!n||!r||P.key!=="Escape"||E.current||!v&&T("__escapeKeyBubbles"))return;const W=wA(P)?P.nativeEvent:P,Y=Ce(Qo,W);u.setOpen(!1,Y),Y.isCanceled||P.preventDefault(),!v&&!Y.isPropagationAllowed&&P.stopPropagation()}),_=ue(()=>{A.current.insideReactTree=!0,j.start(0,N)}),M=ue(P=>{if(!d||!n||P.button!==0)return;const W=gt(P.nativeEvent);ve(u.select("floatingElement"),W)&&(C.current||(C.current=!0,I.current=!1))}),H=ue(P=>{!d||!n||(P.defaultPrevented||P.nativeEvent.defaultPrevented)&&C.current&&(I.current=!0)});f.useEffect(()=>{if(!d||!n)return N;A.current.__escapeKeyBubbles=v,A.current.__outsidePressBubbles=y;const P=new Wt,W=new Wt;function Y(){P.clear(),E.current=!0}function Z(){P.start(un?5:0,()=>{E.current=!1})}function Q(){w.current=!0,W.start(0,()=>{w.current=!1})}function J(){C.current=!1,I.current=!1}function K(){const L=S.current,z=L==="pen"||!L?"mouse":L,ye=b(),q=typeof ye=="function"?ye():ye;return typeof q=="string"?q:q[z]}function ee(L){const z=K();return z==="intentional"&&L.type!=="click"||z==="sloppy"&&L.type==="click"}function ce(L){const z=A.current.floatingContext?.nodeId,ye=m&&bn(m.nodesRef.current,z).some(q=>Ss(L,q.context?.elements.floating));return F(L)||ye}function te(L){if(ee(L)){L.type!=="click"&&!F(L)&&(W.clear(),w.current=!1),N();return}if(A.current.insideReactTree){N();return}const z=gt(L),ye=`[${Fr("inert")}]`,q=Te(z)?z.getRootNode():null,re=Array.from((Mi(q)?q:je(u.select("floatingElement"))).querySelectorAll(ye)),Se=u.context.triggerElements;if(z&&(Se.hasElement(z)||Se.hasMatchingElement(We=>ve(We,z))))return;let ke=Te(z)?z:null;for(;ke&&!Fn(ke);){const We=$n(ke);if(Fn(We)||!Te(We))break;ke=We}if(!(re.length&&Te(z)&&!yA(z)&&!ve(z,u.select("floatingElement"))&&re.every(We=>!ve(ke,We)))){if(Xe(z)&&!("touches"in L)){const We=Fn(z),rt=Kt(z),Ge=/auto|scroll/,At=We||Ge.test(rt.overflowX),$e=We||Ge.test(rt.overflowY),Oe=At&&z.clientWidth>0&&z.scrollWidth>z.clientWidth,lt=$e&&z.clientHeight>0&&z.scrollHeight>z.clientHeight,Ee=rt.direction==="rtl",Le=lt&&(Ee?L.offsetX<=z.offsetWidth-z.clientWidth:L.offsetX>z.clientWidth),Ze=Oe&&L.offsetY>z.clientHeight;if(Le||Ze)return}if(!ce(L)){if(K()==="intentional"&&w.current){W.clear(),w.current=!1;return}typeof g=="function"&&!g(L)||T("__outsidePressBubbles")||(u.setOpen(!1,Ce(Lo,L)),N())}}}function $(L){K()!=="sloppy"||L.pointerType==="touch"||!u.select("open")||!n||F(L)||te(L)}function X(L){if(K()!=="sloppy"||!u.select("open")||!n||F(L))return;const z=L.touches[0];z&&(D.current={startTime:Date.now(),startX:z.clientX,startY:z.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},k.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function ne(L,z){const ye=gt(L);if(!ye)return;const q=De(ye,L.type,()=>{z(L),q()})}function de(L){S.current="touch",ne(L,X)}function fe(L){k.clear(),L.type==="pointerdown"&&(S.current=L.pointerType),!(L.type==="mousedown"&&D.current&&!D.current.dismissOnMouseDown)&&ne(L,z=>{z.type==="pointerdown"?$(z):te(z)})}function ie(L){if(!C.current)return;const z=I.current;if(J(),K()==="intentional"){if(L.type==="pointercancel"){z&&Q();return}if(!ce(L)){if(z){Q();return}typeof g=="function"&&!g(L)||(W.clear(),w.current=!0,N())}}}function he(L){if(K()!=="sloppy"||!D.current||F(L))return;const z=L.touches[0];if(!z)return;const ye=Math.abs(z.clientX-D.current.startX),q=Math.abs(z.clientY-D.current.startY),re=Math.sqrt(ye*ye+q*q);re>5&&(D.current.dismissOnTouchEnd=!0),re>10&&(te(L),k.clear(),D.current=null)}function oe(L){ne(L,he)}function se(L){K()!=="sloppy"||!D.current||F(L)||(D.current.dismissOnTouchEnd&&te(L),k.clear(),D.current=null)}function ae(L){ne(L,se)}const xe=je(p),me=zt(r&&zt(De(xe,"keydown",O),De(xe,"compositionstart",Y),De(xe,"compositionend",Z)),x&&zt(De(xe,"click",fe,!0),De(xe,"pointerdown",fe,!0),De(xe,"pointerup",ie,!0),De(xe,"pointercancel",ie,!0),De(xe,"mousedown",fe,!0),De(xe,"mouseup",ie,!0),De(xe,"touchstart",de,!0),De(xe,"touchmove",oe,!0),De(xe,"touchend",ae,!0)));return()=>{me(),P.clear(),W.clear(),J(),w.current=!1,N()}},[A,p,r,x,g,d,n,v,y,O,N,b,T,F,m,u,k]);const G=f.useMemo(()=>({onKeyDown:O,onPointerDown:R,onClick:R}),[O,R]),B=f.useMemo(()=>({onKeyDown:O,onPointerDown:H,onMouseDown:H,onClickCapture:_,onMouseDownCapture(P){_(),M(P)},onPointerDownCapture(P){_(),M(P)},onMouseUpCapture:_,onTouchEndCapture:_,onTouchMoveCapture:_}),[O,_,M,H]);return f.useMemo(()=>n?{reference:G,floating:B,trigger:G}:{},[n,G,B])}function Ll(e,t,n){let{reference:r,floating:o}=e;const s=Mt(t),i=ea(t),a=qi(i),l=Tt(t),u=s==="y",d=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,A=r[a]/2-o[a]/2;let m;switch(l){case"top":m={x:d,y:r.y-o.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:p};break;case"left":m={x:r.x-o.width,y:p};break;default:m={x:r.x,y:r.y}}const h=In(t);return h&&(m[i]+=A*(h==="end"?1:-1)*(n&&u?-1:1)),m}async function Eg(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:A=!1,padding:m=0}=vn(t,e),h=Nu(m),x=a[A?p==="floating"?"reference":"floating":p],b=Dr(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:l})),v=p==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),C=await(s.isElement==null?void 0:s.isElement(y))&&await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1},I=Dr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:y,strategy:l}):v);return{top:(b.top-I.top+h.top)/C.y,bottom:(I.bottom-b.bottom+h.bottom)/C.y,left:(b.left-I.left+h.left)/C.x,right:(I.right-b.right+h.right)/C.x}}const Sg=50,Rg=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:Eg},l=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:p}=Ll(u,r,l),A=r,m=0;const h={};for(let g=0;g<s.length;g++){const x=s[g];if(!x)continue;const{name:b,fn:v}=x,{x:y,y:C,data:I,reset:w}=await v({x:d,y:p,initialPlacement:r,placement:A,strategy:o,middlewareData:h,rects:u,platform:a,elements:{reference:e,floating:t}});d=y??d,p=C??p,h[b]={...h[b],...I},w&&m<Sg&&(m++,typeof w=="object"&&(w.placement&&(A=w.placement),w.rects&&(u=w.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):w.rects),{x:d,y:p}=Ll(u,A,l)),g=-1)}return{x:d,y:p,placement:A,strategy:o,middlewareData:h}},Dg=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:l,elements:u}=t,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:A,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...x}=vn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=Tt(o),v=Mt(a),y=Tt(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(u.floating)),I=A||(y||!g?[Eo(a)]:RA(a)),w=h!=="none";!A&&w&&I.push(...jA(a,g,h,C));const E=[a,...I],S=await l.detectOverflow(t,x),D=[];let k=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&D.push(S[b]),p){const F=SA(o,i,C);D.push(S[F[0]],S[F[1]])}if(k=[...k,{placement:o,overflows:D}],!D.every(F=>F<=0)){var j,N;const F=(((j=s.flip)==null?void 0:j.index)||0)+1,R=E[F];if(R&&(!(p==="alignment"?v!==Mt(R):!1)||k.every(M=>Mt(M.placement)===v?M.overflows[0]>0:!0)))return{data:{index:F,overflows:k},reset:{placement:R}};let O=(N=k.filter(_=>_.overflows[0]<=0).sort((_,M)=>_.overflows[1]-M.overflows[1])[0])==null?void 0:N.placement;if(!O)switch(m){case"bestFit":{var T;const _=(T=k.filter(M=>{if(w){const H=Mt(M.placement);return H===v||H==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(H=>H>0).reduce((H,G)=>H+G,0)]).sort((M,H)=>M[1]-H[1])[0])==null?void 0:T[0];_&&(O=_);break}case"initialPlacement":O=a;break}if(o!==O)return{reset:{placement:O}}}return{}}}},ld=new Set(["left","top"]);async function Fg(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Tt(n),a=In(n),l=Mt(n)==="y",u=ld.has(i)?-1:1,d=s&&l?-1:1,p=vn(t,e);let{mainAxis:A,crossAxis:m,alignmentAxis:h}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof h=="number"&&(m=a==="end"?h*-1:h),l?{x:m*d,y:A*u}:{x:A*u,y:m*d}}const Bg=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,l=await Fg(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:i}}}}},jg=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:v=>{let{x:y,y:C}=v;return{x:y,y:C}}},...u}=vn(e,t),d={x:n,y:r},p=await s.detectOverflow(t,u),A=Mt(o),m=Xi(A);let h=d[m],g=d[A];const x=(v,y)=>Mu(y+p[v==="y"?"top":"left"],y,y-p[v==="y"?"bottom":"right"]);i&&(h=x(m,h)),a&&(g=x(A,g));const b=l.fn({...t,[m]:h,[A]:g});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[m]:i,[A]:a}}}}}},Mg=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:s,placement:i,rects:a,middlewareData:l}=t,{offset:u=0,mainAxis:d=!0,crossAxis:p=!0}=vn(e,t),A={x:o,y:s},m=Mt(i),h=Xi(m);let g=A[h],x=A[m];const b=vn(u,t),v=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:(n=b.mainAxis)!=null?n:0,crossAxis:(r=b.crossAxis)!=null?r:0};if(d){const I=h==="y"?"height":"width",w=a.reference[h]-a.floating[I]+v.mainAxis,E=a.reference[h]+a.reference[I]-v.mainAxis;g<w?g=w:g>E&&(g=E)}if(p){var y,C;const I=h==="y"?"width":"height",w=ld.has(Tt(i)),E=a.reference[m]-a.floating[I]+(w&&((y=l.offset)==null?void 0:y[m])||0)+(w?0:v.crossAxis),S=a.reference[m]+a.reference[I]+(w?0:((C=l.offset)==null?void 0:C[m])||0)-(w?v.crossAxis:0);x<E?x=E:x>S&&(x=S)}return{[h]:g,[m]:x}}}},Ng=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...a}=vn(e,t),l=await o.detectOverflow(t,a),u=Tt(n),d=In(n),p=Mt(n)==="y",{width:A,height:m}=r.floating;let h,g;u==="top"||u==="bottom"?(h=u,g=d===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(g=u,h=d==="end"?"top":"bottom");const x=m-l.top-l.bottom,b=A-l.left-l.right,v=Xn(m-l[h],x),y=Xn(A-l[g],b),C=t.middlewareData.shift,I=!C;let w=v,E=y;C!=null&&C.enabled.x&&(E=b),C!=null&&C.enabled.y&&(w=x),I&&!d&&(p?E=A-2*sn(l.left,l.right):w=m-2*sn(l.top,l.bottom)),await i({...t,availableWidth:E,availableHeight:w});const S=await o.getDimensions(s.floating);return A!==S.width||m!==S.height?{reset:{rects:!0}}:{}}}};function cd(e){const t=Kt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Xe(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=ko(n)!==s||ko(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function pa(e){return Te(e)?e:e.contextElement}function Un(e){const t=pa(e);if(!Xe(t))return an(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=cd(t);let i=(s?ko(n.width):n.width)/r,a=(s?ko(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Tg=an(0);function ud(e){const t=it(e);return!Cu()||!t.visualViewport?Tg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pg(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===it(e)}function Mn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=pa(e);let i=an(1);t&&(r?Te(r)&&(i=Un(r)):i=Un(e));const a=Pg(s,n,r)?ud(s):an(0);let l=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,d=o.width/i.x,p=o.height/i.y;if(s&&r){const A=it(s),m=Te(r)?it(r):r;let h=A,g=bl(h);for(;g&&m!==h;){const x=Un(g),b=g.getBoundingClientRect(),v=Kt(g),y=b.left+(g.clientLeft+parseFloat(v.paddingLeft))*x.x,C=b.top+(g.clientTop+parseFloat(v.paddingTop))*x.y;l*=x.x,u*=x.y,d*=x.x,p*=x.y,l+=y,u+=C,h=it(g),g=bl(h)}}return Dr({width:d,height:p,x:l,y:u})}function ts(e,t){const n=Go(e).scrollLeft;return t?t.left+n:Mn(Cn(e)).left+n}function dd(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ts(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function _g(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Cn(r),a=t?Ni(t.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},u=an(1);const d=an(0),p=Xe(r);if((p||!s)&&((kt(r)!=="body"||Ti(i))&&(l=Go(r)),p)){const m=Mn(r);u=Un(r),d.x=m.x+r.clientLeft,d.y=m.y+r.clientTop}const A=i&&!p&&!s?dd(i,l):an(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+A.x,y:n.y*u.y-l.scrollTop*u.y+d.y+A.y}}function Og(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Hg(e){const t=Go(e),n=e.ownerDocument.body,r=sn(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=sn(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+ts(e);const i=-t.scrollTop;return Kt(n).direction==="rtl"&&(s+=sn(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:s,y:i}}const Kg=25;function Wg(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=it(e),s=Cn(e),i=o.visualViewport;let a=s.clientWidth,l=s.clientHeight,u=0,d=0;if(i){const A=!Cu()||t==="fixed";r?A||(u=-i.offsetLeft,d=-i.offsetTop):(a=i.width,l=i.height,A&&(u=i.offsetLeft,d=i.offsetTop))}if(ts(s)<=0){const A=s.ownerDocument,m=A.body,h=getComputedStyle(m),g=A.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,x=Math.abs(s.clientWidth-m.clientWidth-g),b=getComputedStyle(s).scrollbarGutter==="stable both-edges"?x/2:x;b<=Kg&&(a-=b)}return{width:a,height:l,x:u,y:d}}function Lg(e,t){const n=Mn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Un(e),i=e.clientWidth*s.x,a=e.clientHeight*s.y,l=o*s.x,u=r*s.y;return{width:i,height:a,x:l,y:u}}function Ql(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Wg(e,n,t);else if(t==="document")r=Hg(Cn(e));else if(Te(t))r=Lg(t,n);else{const o=ud(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Dr(r)}function Qg(e,t){const n=t.get(e);if(n)return n;let r=ri(e,[],!1).filter(a=>Te(a)&&kt(a)!=="body"),o=null;const s=Kt(e).position==="fixed";let i=s?$n(e):e;for(;Te(i)&&!Fn(i);){const a=Kt(i),l=yu(i),u=o?o.position:s?"fixed":"";!l&&(u==="fixed"||u==="absolute"&&a.position==="static")?r=r.filter(p=>p!==i):o=a,i=$n(i)}return t.set(e,r),r}function Gg(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Ni(t)?[]:Qg(t,this._c):[].concat(n),r],a=Ql(t,i[0],o);let l=a.top,u=a.right,d=a.bottom,p=a.left;for(let A=1;A<i.length;A++){const m=Ql(t,i[A],o);l=sn(m.top,l),u=Xn(m.right,u),d=Xn(m.bottom,d),p=sn(m.left,p)}return{width:u-p,height:d-l,x:p,y:l}}function Yg(e){const{width:t,height:n}=cd(e);return{width:t,height:n}}function zg(e,t,n){const r=Xe(t),o=Cn(t),s=n==="fixed",i=Mn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=an(0);if((r||!s)&&((kt(t)!=="body"||Ti(o))&&(a=Go(t)),r)){const A=Mn(t,!0,s,t);l.x=A.x+t.clientLeft,l.y=A.y+t.clientTop}!r&&o&&(l.x=ts(o));const u=o&&!r&&!s?dd(o,a):an(0),d=i.left+a.scrollLeft-l.x-u.x,p=i.top+a.scrollTop-l.y-u.y;return{x:d,y:p,width:i.width,height:i.height}}function Ns(e){return Kt(e).position==="static"}function Gl(e,t){if(!Xe(e)||Kt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Cn(e)===n&&(n=n.ownerDocument.body),n}function fd(e,t){const n=it(e);if(Ni(e))return n;if(!Xe(e)){let o=$n(e);for(;o&&!Fn(o);){if(Te(o)&&!Ns(o))return o;o=$n(o)}return n}let r=Gl(e,t);for(;r&&ih(r)&&Ns(r);)r=Gl(r,t);return r&&Fn(r)&&Ns(r)&&!yu(r)?n:r||ah(e)||n}const Ug=async function(e){const t=this.getOffsetParent||fd,n=this.getDimensions,r=await n(e.floating);return{reference:zg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Vg(e){return Kt(e).direction==="rtl"}const pd={convertOffsetParentRelativeRectToViewportRelativeRect:_g,getDocumentElement:Cn,getClippingRect:Gg,getOffsetParent:fd,getElementRects:Ug,getClientRects:Og,getDimensions:Yg,getScale:Un,isElement:Te,isRTL:Vg};function hd(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Zg(e,t,n){let r=null,o;const s=Cn(e);function i(){var d;clearTimeout(o),(d=r)==null||d.disconnect(),r=null}function a(d,p){d===void 0&&(d=!1),p===void 0&&(p=1),i();const A=e.getBoundingClientRect(),{left:m,top:h,width:g,height:x}=A;if(d||t(),!g||!x)return;const b=$r(h),v=$r(s.clientWidth-(m+g)),y=$r(s.clientHeight-(h+x)),C=$r(m),w={rootMargin:-b+"px "+-v+"px "+-y+"px "+-C+"px",threshold:sn(0,Xn(1,p))||1};let E=!0;function S(D){const k=D[0].intersectionRatio;if(!hd(A,e.getBoundingClientRect()))return a();if(k!==p){if(!E)return a();k?a(!1,k):o=setTimeout(()=>{a(!1,1e-7)},1e3)}E=!1}try{r=new IntersectionObserver(S,{...w,root:s.ownerDocument})}catch{r=new IntersectionObserver(S,w)}r.observe(e)}const l=it(e),u=()=>a(n);return l.addEventListener("resize",u),a(!0),()=>{l.removeEventListener("resize",u),i()}}function Yl(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=pa(e),d=o||s?[...u?ri(u):[],...t?ri(t):[]]:[];d.forEach(b=>{o&&b.addEventListener("scroll",n),s&&b.addEventListener("resize",n)});const p=u&&a?Zg(u,n,s):null;let A=-1,m=null;i&&(m=new ResizeObserver(b=>{let[v]=b;v&&v.target===u&&m&&t&&(m.unobserve(t),cancelAnimationFrame(A),A=requestAnimationFrame(()=>{var y;(y=m)==null||y.observe(t)})),n()}),u&&!l&&m.observe(u),t&&m.observe(t));let h,g=l?Mn(e):null;l&&x();function x(){const b=Mn(e);g&&!hd(g,b)&&n(),g=b,h=requestAnimationFrame(x)}return n(),()=>{var b;d.forEach(v=>{o&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),p?.(),(b=m)==null||b.disconnect(),m=null,l&&cancelAnimationFrame(h)}}const Jg=Bg,$g=jg,Xg=Dg,qg=Ng,em=Mg,tm=(e,t,n)=>{const r=new Map,o=n??{},s={...pd,...o.platform,_c:r};return Rg(e,t,{...o,platform:s})};var nm=typeof document<"u",rm=function(){},vo=nm?f.useLayoutEffect:rm;function Do(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Do(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Do(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ad(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function zl(e,t){const n=Ad(e);return Math.round(t*n)/n}function Ts(e){const t=f.useRef(e);return vo(()=>{t.current=e}),t}function om(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:l,open:u}=e,[d,p]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[A,m]=f.useState(r);Do(A,r)||m(r);const[h,g]=f.useState(null),[x,b]=f.useState(null),v=f.useCallback(M=>{M!==w.current&&(w.current=M,g(M))},[]),y=f.useCallback(M=>{M!==E.current&&(E.current=M,b(M))},[]),C=s||h,I=i||x,w=f.useRef(null),E=f.useRef(null),S=f.useRef(d),D=l!=null,k=Ts(l),j=Ts(o),N=Ts(u),T=f.useCallback(()=>{if(!w.current||!E.current)return;const M={placement:t,strategy:n,middleware:A};j.current&&(M.platform=j.current),tm(w.current,E.current,M).then(H=>{const G={...H,isPositioned:N.current!==!1};F.current&&!Do(S.current,G)&&(S.current=G,cn.flushSync(()=>{p(G)}))})},[A,t,n,j,N]);vo(()=>{u===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,p(M=>({...M,isPositioned:!1})))},[u]);const F=f.useRef(!1);vo(()=>(F.current=!0,()=>{F.current=!1}),[]),vo(()=>{if(C&&(w.current=C),I&&(E.current=I),C&&I){if(k.current)return k.current(C,I,T);T()}},[C,I,T,k,D]);const R=f.useMemo(()=>({reference:w,floating:E,setReference:v,setFloating:y}),[v,y]),O=f.useMemo(()=>({reference:C,floating:I}),[C,I]),_=f.useMemo(()=>{const M={position:n,left:0,top:0};if(!O.floating)return M;const H=zl(O.floating,d.x),G=zl(O.floating,d.y);return a?{...M,transform:"translate("+H+"px, "+G+"px)",...Ad(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:G}},[n,a,O.floating,d.x,d.y]);return f.useMemo(()=>({...d,update:T,refs:R,elements:O,floatingStyles:_}),[d,T,R,O,_])}const sm=(e,t)=>{const n=Jg(e);return{name:n.name,fn:n.fn,options:[e,t]}},im=(e,t)=>{const n=$g(e);return{name:n.name,fn:n.fn,options:[e,t]}},am=(e,t)=>({fn:em(e).fn,options:[e,t]}),lm=(e,t)=>{const n=Xg(e);return{name:n.name,fn:n.fn,options:[e,t]}},cm=(e,t)=>{const n=qg(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Ps={exports:{}},_s={};var Ul;function um(){if(Ul)return _s;Ul=1;var e=xu(),t=Yu();function n(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;return _s.useSyncExternalStoreWithSelector=function(u,d,p,A,m){var h=s(null);if(h.current===null){var g={hasValue:!1,value:null};h.current=g}else g=h.current;h=a(function(){function b(w){if(!v){if(v=!0,y=w,w=A(w),m!==void 0&&g.hasValue){var E=g.value;if(m(E,w))return C=E}return C=w}if(E=C,r(y,w))return E;var S=A(w);return m!==void 0&&m(E,S)?(y=w,E):(y=w,C=S)}var v=!1,y,C,I=p===void 0?null:p;return[function(){return b(d())},I===null?void 0:function(){return b(I())}]},[d,p,A,m]);var x=o(u,h[0],h[1]);return i(function(){g.hasValue=!0,g.value=x},[x]),l(x),x},_s}var Vl;function dm(){return Vl||(Vl=1,Ps.exports=um()),Ps.exports}var fm=dm();const hi=[];let Ai;function pm(){return Ai}function hm(e){hi.push(e)}function ha(e){const t=(n,r)=>{const o=Ft(Am).current;let s;try{Ai=o;for(const i of hi)i.before(o);s=e(n,r);for(const i of hi)i.after(o);o.didInitialize=!0}finally{Ai=void 0}return s};return t.displayName=e.displayName||e.name,t}function gd(e){return f.forwardRef(ha(e))}function Am(){return{didInitialize:!1}}const gm=bu(19),mm=gm?bm:vm;function Ie(e,t,n,r,o){return mm(e,t,n,r,o)}function xm(e,t,n,r,o){const s=f.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return Xo.useSyncExternalStore(e.subscribe,s,s)}hm({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 r=e.syncHooks[n],o=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,o)||(t=!0,r.value=o)}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 o of e.syncHooks)n.add(o.store);const r=[];for(const o of n)r.push(o.subscribe(t));return()=>{for(const o of r)o()}}),Xo.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function bm(e,t,n,r,o){const s=pm();if(!s)return xm(e,t,n,r,o);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,r)||!Object.is(a.a3,o))&&(a.store!==e&&(s.didChangeStore=!0),a.store=e,a.selector=t,a.a1=n,a.a2=r,a.a3=o,a.value=t(e.getSnapshot(),n,r,o))):(a={store:e,selector:t,a1:n,a2:r,a3:o,value:t(e.getSnapshot(),n,r,o)},s.syncHooks.push(a)),a.value}function vm(e,t,n,r,o){return fm.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class ym{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 r of this.listeners){if(n!==this.updateTick)return;r(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,r,o){return Ie(this,t,n,r,o)}}class Gr extends ym{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){f.useDebugValue(t);const r=this;le(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){const r=this;le(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);le(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){f.useDebugValue(t);const r=this,o=n!==void 0;le(()=>{o&&!Object.is(r.state[t],n)&&r.setState({...r.state,[t]:n})},[r,t,n,o])}select(t,n,r,o){const s=this.selectors[t];return s(this.state,n,r,o)}useState(t,n,r,o){return f.useDebugValue(t),Ie(this,this.selectors[t],n,r,o)}useContextCallback(t,n){f.useDebugValue(t);const r=ue(n??Er);this.context[t]=r}useStateSetter(t){const n=f.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const a=o;o=i,n(i,a,this)}})}}const Cm={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 ns extends Gr{constructor(t){const{syncOnly:n,nested:r,onOpenChange:o,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:rd(),nested:r,triggerElements:s},Cm),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&kA(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function md(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:o,nested:s,onOpenChange:i}=e,a=t.useState("open"),l=t.useState("activeTriggerElement"),u=t.useState(n?"popupElement":"positionerElement"),d=t.context.triggerElements,p=i,A=f.useRef(null);r===void 0&&A.current===null&&(A.current=new ns({open:a,transitionStatus:void 0,referenceElement:l,floatingElement:u,triggerElements:d,onOpenChange:p,floatingId:o,syncOnly:!0,nested:s}));const m=r??A.current;return t.useSyncedValue("floatingId",o),le(()=>{const h={open:a,floatingId:o,referenceElement:l,floatingElement:u};Te(l)&&(h.domReferenceElement=l),m.state.positionReference===m.state.referenceElement&&(h.positionReference=l),m.update(h)},[a,o,l,u,m]),m.context.onOpenChange=p,m.context.nested=s,m}const rs={tabIndex:-1,[ai]:""};function Im(e){return t=>t==="touch"?e.current:!0}function xd(e,t=!1){const n=Jn(),r=wn()!=null,o=Ft(()=>e(n,r)).current;return md({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:o.setOpen}),o}function Aa({handle:e,store:t}){return le(()=>e.attachStore(t),[e,t]),null}function wm(e,t){const n=f.useRef(null),r=f.useRef(null);return f.useCallback(o=>{if(e===void 0)return;let s=!1;if(n.current!==null){const i=n.current,a=r.current,l=t.context.triggerElements.getById(i);a&&l===a&&(t.context.triggerElements.delete(i),s=!0),n.current=null,r.current=null}if(o!==null&&(n.current=e,r.current=o,t.context.triggerElements.add(e,o),s=!0),s){const i=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==i&&t.set("triggerCount",i)}},[t,e])}function ga(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const o=n?.id??null;(o||t)&&(e.activeTriggerId=o,e.activeTriggerElement=n??null)}function bd(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function km(e,t,n,r={}){const o=n.reason,s=o===ct,i=t&&o===Yn,a=!t&&(o===Tn||o===Qo),l=bd(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);const u=()=>{const d={...r.extraState,open:t};i?d.instantType="focus":a?d.instantType="dismiss":s&&(d.instantType=void 0),ga(d,t,n.trigger,l()),e.update(d)};s?cn.flushSync(u):u()}function vd(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=wm(e,n),i=ue(l=>{const u=n.select("open"),d=n.select("activeTriggerId");if(d===e){n.update({activeTriggerElement:l,...u?r:null});return}d==null&&u&&n.update({activeTriggerId:e,activeTriggerElement:l,...r})}),a=f.useCallback(l=>{s(l),l&&i(l)},[s,i]);return le(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:a,isMountedByThisTrigger:o}}function ma(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=f.useRef(null),o=e.useState("open"),s=e.useState("triggerCount"),i=e.useState("activeTriggerId"),a=e.useState("activeTriggerElement");le(()=>{if(!o){r.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const l=e.context.triggerElements.size,u={};e.state.triggerCount!==l&&(u.triggerCount=l);const d=e.select("activeTriggerId");let p=null;if(d){const A=e.context.triggerElements.getById(d);if(A)r.current=d,A!==e.state.activeTriggerElement&&(u.activeTriggerElement=A);else{for(const[m,h]of e.context.triggerElements.entries())if(h===e.state.activeTriggerElement){u.activeTriggerId=m,u.activeTriggerElement=h,r.current=m;break}u.activeTriggerId===void 0&&(r.current===d?p=d:r.current=null)}}else r.current=null;if(!p&&!d&&l===1){const A=e.context.triggerElements.entries().next();if(!A.done){const[m,h]=A.value;u.activeTriggerId=m,u.activeTriggerElement=h,r.current=m}}(u.triggerCount!==void 0||u.activeTriggerId!==void 0||u.activeTriggerElement!==void 0)&&e.update(u),p&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===p&&!e.context.triggerElements.getById(p)){const A=Ce(Pt);e.setOpen(!1,A),A.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,s,i,a,n])}function xa(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=sr(e),i=t.useState("preventUnmountingOnClose"),a=e?!1:i;t.useSyncedValues({mounted:r,transitionStatus:s,preventUnmountingOnClose:a});const l=ue(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Zt({enabled:r&&!e&&!a,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:s}}function ba(e,t){e.useSyncedValues(t),le(()=>()=>{e.update({activeTriggerProps:dt,inactiveTriggerProps:dt,popupProps:dt})},[e])}function Em(e,t){le(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),le(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Yr{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 Sm(){return new ns({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Yr,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function va(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Sm(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:dt,inactiveTriggerProps:dt,popupProps:dt}}function yd(e,t,n=!1){return new ns({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}const wr=e=>e.triggerIdProp??e.activeTriggerId,ya=e=>e.openProp??e.open,Zl=e=>(e.popupElement?.id??e.floatingId)||void 0;function Cd(e,t){return t!==void 0&&ya(e)&&wr(e)===t}function Rm(e,t){return Cd(e,t)?!0:t!==void 0&&ya(e)&&wr(e)==null&&e.triggerCount===1}const Ca={open:ya,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:wr,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Zl,isTriggerActive:(e,t)=>t!==void 0&&wr(e)===t,isOpenedByTrigger:(e,t)=>Cd(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&wr(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Rm(e,t)?Zl(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Id(e){const t=f.useCallback(r=>e===void 0?Er:e.subscribeStore(r),[e]),n=f.useCallback(()=>e===void 0?void 0:e.store,[e]);return Xo.useSyncExternalStore(t,n,()=>e?.serverStore)}function Dm(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Jn(),s=wn()!=null,i=Ft(()=>new ns({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Yr,floatingId:o,syncOnly:!1,nested:s})).current;return le(()=>{const a={open:t,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=Te(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),i.update(a)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function Fm(e){return Bm(e,e.rootContext)}function Bm(e,t){const{nodeId:n,externalTree:r}=e,o=t.useState("referenceElement"),s=t.useState("floatingElement"),i=t.useState("domReferenceElement"),a=t.useState("open"),l=t.useState("floatingId"),[u,d]=f.useState(null),[p,A]=f.useState(void 0),[m,h]=f.useState(void 0),g=f.useRef(null),x=kn(r),b=f.useMemo(()=>({reference:o,floating:s,domReference:i}),[o,s,i]),v=om({...e,elements:{...b,...u&&{reference:u}}}),y=Te(p)?p:null,C=m===void 0?t.state.floatingElement:m;t.useSyncedValue("referenceElement",p??null),t.useSyncedValue("domReferenceElement",p===void 0?i:y),t.useSyncedValue("floatingElement",C);const I=f.useCallback(j=>{const N=Te(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),getClientRects:()=>j.getClientRects(),contextElement:j}:j;d(N),v.refs.setReference(N)},[v.refs]),w=f.useCallback(j=>{(Te(j)||j===null)&&(g.current=j,A(j)),(Te(v.refs.reference.current)||v.refs.reference.current===null||j!==null&&!Te(j))&&v.refs.setReference(j)},[v.refs,A]),E=f.useCallback(j=>{h(j),v.refs.setFloating(j)},[v.refs]),S=f.useMemo(()=>({...v.refs,setReference:w,setFloating:E,setPositionReference:I,domReference:g}),[v.refs,w,E,I]),D=f.useMemo(()=>({...v.elements,domReference:i}),[v.elements,i]),k=f.useMemo(()=>({...v,dataRef:t.context.dataRef,open:a,onOpenChange:t.setOpen,events:t.context.events,floatingId:l,refs:S,elements:D,nodeId:n,rootStore:t}),[v,S,D,n,t,a,l]);return le(()=>{i&&(g.current=i)},[i]),le(()=>{t.context.dataRef.current.floatingContext=k;const j=x?.nodesRef.current.find(N=>N.id===n);j&&(j.context=k)}),f.useMemo(()=>({...v,context:k,refs:S,elements:D,rootStore:t}),[v,S,D,k,t])}const Os=Ui&&un;function wd(e,t={}){const{enabled:n=!0,delay:r}=t,o="rootStore"in e?e.rootStore:e,{events:s,dataRef:i}=o.context,a=f.useRef(!1),l=f.useRef(null),u=f.useRef(!0),d=ht();f.useEffect(()=>{const A=o.select("domReferenceElement");if(!n)return;const m=it(A);function h(){const b=o.select("domReferenceElement");!o.select("open")&&Xe(b)&&b===yt(je(b))&&(a.current=!0)}function g(){u.current=!0}function x(){u.current=!1}return zt(De(m,"blur",h),Os&&De(m,"keydown",g,!0),Os&&De(m,"pointerdown",x,!0))},[o,n]),f.useEffect(()=>{if(!n)return;function A(m){if(m.reason===Tn||m.reason===Qo){const h=o.select("domReferenceElement");Te(h)&&(l.current=h,a.current=!0)}}return s.on("openchange",A),()=>{s.off("openchange",A)}},[s,n,o]);const p=f.useMemo(()=>{function A(){a.current=!1,l.current=null}return{onMouseLeave(){A()},onFocus(m){const h=m.currentTarget;if(a.current){if(l.current===h)return;A()}const g=gt(m.nativeEvent);if(Te(g)){if(Os&&!m.relatedTarget){if(!u.current&&!Jo(g))return}else if(!IA(g))return}const x=Io(m.relatedTarget,o.context.triggerElements),{nativeEvent:b,currentTarget:v}=m,y=typeof r=="function"?r():r;if(o.select("open")&&x||y===0||y===void 0){o.setOpen(!0,Ce(Yn,b,v));return}d.start(y,()=>{a.current||o.setOpen(!0,Ce(Yn,b,v))})},onBlur(m){A();const h=m.relatedTarget,g=m.nativeEvent,x=Te(h)&&h.hasAttribute(Fr("focus-guard"))&&h.getAttribute("data-type")==="outside";d.start(0,()=>{const b=o.select("domReferenceElement"),v=yt(je(b));!h&&v===b||ve(i.current.floatingContext?.refs.floating.current,v)||ve(b,v)||x||Io(h??v,o.context.triggerElements)||o.setOpen(!1,Ce(Yn,g))})}}},[i,r,o,d]);return f.useMemo(()=>n?{reference:p,trigger:p}:{},[n,p])}class Ia{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 Wt,this.restTimeout=new Wt,this.handleCloseOptions=void 0}static create(){return new Ia}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Fo=new WeakMap;function Bo(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Fo.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Fo.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function kd(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,s=Fo.get(n);s&&s!==e&&Bo(s),Bo(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,Fo.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function wa(e){const t=e.context.dataRef.current,n=Ft(()=>t.hoverInteractionState??Ia.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),ra(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Ed(e,t={}){const{enabled:n=!0,closeDelay:r=0,nodeId:o}=t,s="rootStore"in e?e.rootStore:e,i=s.useState("open"),a=s.useState("floatingElement"),l=s.useState("domReferenceElement"),{dataRef:u}=s.context,d=kn(),p=wn(),A=wa(s),m=ht(),h=ue(()=>Zu(u.current.openEvent?.type,A.interactedInside)),g=ue(()=>sg(u.current.openEvent?.type)),x=ue(()=>{Bo(A)});le(()=>{i||(A.pointerType=void 0,A.restTimeoutPending=!1,A.interactedInside=!1,x())},[i,A,x]),f.useEffect(()=>x,[x]),le(()=>{if(n&&i&&A.handleCloseOptions?.blockPointerEvents&&g()&&Te(l)&&a){const b=l,v=a,y=je(a),C=d?.nodesRef.current.find(S=>S.id===p)?.context?.elements.floating;C&&(C.style.pointerEvents="");const I=A.pointerEventsScopeElement!==v?A.pointerEventsScopeElement:null,w=C!==v?C:null,E=A.handleCloseOptions?.getScope?.()??I??w??b.closest("[data-rootownerid]")??y.body;return kd(A,{scopeElement:E,referenceElement:b,floatingElement:v}),()=>{x()}}},[n,i,l,a,A,g,d,p,x]),f.useEffect(()=>{if(!n)return;function b(){return!!(d&&p&&bn(d.nodesRef.current,p).length>0)}function v(S){const D=er(r,"close",A.pointerType),k=()=>{s.setOpen(!1,Ce(ct,S)),d?.events.emit("floating.closed",S)};D?A.openChangeTimeout.start(D,k):(A.openChangeTimeout.clear(),k())}function y(S){const D=gt(S);if(!CA(D)){A.interactedInside=!1;return}A.interactedInside=D?.closest("[aria-haspopup]")!=null}function C(){A.openChangeTimeout.clear(),m.clear(),d?.events.off("floating.closed",w),x()}function I(S){if(b()&&d){d.events.on("floating.closed",w);return}if(Io(S.relatedTarget,s.context.triggerElements))return;const D=u.current.floatingContext?.nodeId??o,k=S.relatedTarget;if(!(d&&D&&Te(k)&&bn(d.nodesRef.current,D,!1).some(N=>ve(N.context?.elements.floating,k)))){if(A.handler){A.handler(S);return}x(),g()&&!h()&&v(S)}}function w(S){!d||!p||b()||m.start(0,()=>{d.events.off("floating.closed",w),s.setOpen(!1,Ce(ct,S)),d.events.emit("floating.closed",S)})}const E=a;return zt(E&&De(E,"mouseenter",C),E&&De(E,"mouseleave",I),E&&De(E,"pointerdown",y,!0),()=>{d?.events.off("floating.closed",w)})},[n,a,s,u,r,o,g,h,x,A,d,p,m])}const jm={current:null};function Sd(e,t={}){const{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:s=!1,restMs:i=0,move:a=!0,triggerElementRef:l=jm,externalTree:u,isActiveTrigger:d=!0,getHandleCloseContext:p,isClosing:A,shouldOpen:m,guardStaleOpen:h=!1}=t,g="rootStore"in e?e.rootStore:e,{dataRef:x,events:b}=g.context,v=kn(u),y=wa(g),C=f.useRef(!1),I=nt(o),w=nt(r),E=nt(i),S=nt(n),D=nt(m),k=nt(A),j=ue(()=>Zu(x.current.openEvent?.type,y.interactedInside)),N=ue(()=>D.current?.()!==!1),T=ue((O,_,M)=>{const H=g.context.triggerElements;if(H.hasElement(_))return!O||!ve(O,_);if(!Te(M))return!1;const G=M;return H.hasMatchingElement(B=>ve(B,G))&&(!O||!ve(O,G))}),F=ue(()=>{if(!y.handler)return;je(g.select("domReferenceElement")).removeEventListener("mousemove",y.handler),y.handler=void 0}),R=ue(()=>{Bo(y)});return d&&(y.handleCloseOptions=I.current?.__options),f.useEffect(()=>F,[F]),f.useEffect(()=>{if(!n)return;function O(_){_.open?C.current=!1:(C.current=_.reason===ct,F(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return b.on("openchange",O),()=>{b.off("openchange",O)}},[n,b,y,F]),f.useEffect(()=>{if(!n)return;function O(P,W=!0){const Y=er(w.current,"close",y.pointerType);Y?y.openChangeTimeout.start(Y,()=>{g.setOpen(!1,Ce(ct,P)),v?.events.emit("floating.closed",P)}):W&&(y.openChangeTimeout.clear(),g.setOpen(!1,Ce(ct,P)),v?.events.emit("floating.closed",P))}const _=l.current??(d?g.select("domReferenceElement"):null);if(!Te(_))return;function M(P){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,s&&!xn(y.pointerType))return;const W=Bl(E.current),Y=er(w.current,"open",y.pointerType),Z=gt(P),Q=P.currentTarget??null,J=g.select("domReferenceElement");let K=Q;if(Te(Z)&&!g.context.triggerElements.hasElement(Z)){for(const ie of g.context.triggerElements.elements())if(ve(ie,Z)){K=ie;break}}Te(Q)&&Te(J)&&!g.context.triggerElements.hasElement(Q)&&ve(Q,J)&&(K=J);const ee=K==null?!1:T(J,K,Z),ce=g.select("open"),te=k.current?.()??g.select("transitionStatus")==="ending",$=!ce&&te&&C.current,X=!ee&&Te(K)&&Te(J)&&ve(J,K)&&$,ne=W>0&&!Y,de=ee&&(ce||$)||X,fe=!ce||ee;if(de){N()&&g.setOpen(!0,Ce(ct,P,K));return}ne||(Y?y.openChangeTimeout.start(Y,()=>{fe&&N()&&g.setOpen(!0,Ce(ct,P,K))}):fe&&N()&&g.setOpen(!0,Ce(ct,P,K)))}function H(P){if(j()){R();return}F();const W=g.select("domReferenceElement"),Y=je(W);y.restTimeout.clear(),y.restTimeoutPending=!1;const Z=x.current.floatingContext??p?.();if(Io(P.relatedTarget,g.context.triggerElements))return;if(I.current&&Z){g.select("open")||y.openChangeTimeout.clear();const J=l.current;y.handler=I.current({...Z,tree:v,x:P.clientX,y:P.clientY,onClose(){R(),F(),S.current&&!j()&&J===g.select("domReferenceElement")&&O(P,!0)}}),Y.addEventListener("mousemove",y.handler),y.handler(P);return}(y.pointerType!=="touch"||!ve(g.select("floatingElement"),P.relatedTarget))&&O(P)}function G(P){ve(_,P.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}const B=h?De(_,"mouseout",G):void 0;return a?zt(De(_,"mousemove",M,{once:!0}),De(_,"mouseenter",M),De(_,"mouseleave",H),B):zt(De(_,"mouseenter",M),De(_,"mouseleave",H),B)},[F,R,x,w,g,n,I,y,d,T,j,s,a,E,l,v,S,p,k,N,h]),f.useMemo(()=>{if(!n)return;function O(_){y.pointerType=_.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(_){const{nativeEvent:M}=_,H=_.currentTarget,G=g.select("domReferenceElement"),B=g.select("open"),P=T(G,H,_.target);if(s&&!xn(y.pointerType))return;if(B&&P&&y.handleCloseOptions?.blockPointerEvents){const Z=g.select("floatingElement");if(Z){const Q=y.handleCloseOptions?.getScope?.()??H.ownerDocument.body;kd(y,{scopeElement:Q,referenceElement:H,floatingElement:Z})}}const W=Bl(E.current);if(B&&!P||W===0||!P&&y.restTimeoutPending&&_.movementX**2+_.movementY**2<2)return;y.restTimeout.clear();function Y(){if(y.restTimeoutPending=!1,j())return;const Z=g.select("open");!y.blockMouseMove&&(!Z||P)&&N()&&g.setOpen(!0,Ce(ct,M,H))}y.pointerType==="touch"?cn.flushSync(()=>{Y()}):P&&B?Y():(y.restTimeoutPending=!0,y.restTimeout.start(W,Y))}}},[n,y,j,T,s,g,E,N])}const Mm="Escape";function Jl(e){return un&&e.movementX===0&&e.movementY===0}function os(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function to(e,t){return os(t,e===ju||e===Zi,e===Vo||e===Zo)}function Hs(e,t,n){return os(t,e===Zi,n?e===Vo:e===Zo)||e==="Enter"||e===" "||e===""}function Nm(e,t,n){return os(t,n?e===Vo:e===Zo,e===Zi)}function Tm(e,t,n,r){const o=n?e===Zo:e===Vo,s=e===ju;return t==="both"||t==="horizontal"&&r?e===Mm:os(t,o,s)}function Rd(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:a=!1,loopFocus:l=!1,nested:u=!1,rtl:d=!1,virtual:p=!1,focusItemOnOpen:A="auto",focusItemOnHover:m=!0,openOnArrowKeyDown:h=!0,disabledIndices:g=void 0,orientation:x="vertical",parentOrientation:b,id:v,resetOnPointerLeave:y=!0,externalTree:C,grid:I}=t,w=I!=null,E="rootStore"in e?e.rootStore:e,S=E.useState("open"),D=E.useState("floatingElement"),k=E.useState("domReferenceElement"),j=E.context.dataRef,N=wo(D),T=li(k),F=nt(N),R=wn(),O=kn(C),_=f.useRef(A),M=f.useRef(i??-1),H=f.useRef(null),G=f.useRef(!0),B=ue(L=>{o(M.current===-1?null:M.current,L)}),P=f.useRef(!!D),W=f.useRef(S),Y=f.useRef(!1),Z=f.useRef(!1),Q=f.useRef(null),J=nt(g),K=nt(S),ee=nt(i),ce=nt(y),te=qn(),$=qn(),X=ue(()=>{function L(re){p?O?.events.emit("virtualfocus",re):Q.current=bo(re,{sync:Y.current,preventScroll:!0})}const z=n.current[M.current],ye=Z.current;z&&L(z),(Y.current?re=>re():re=>te.request(re))(()=>{const re=n.current[M.current]||z;if(!re)return;z||L(re),oe&&(ye||!G.current)&&re.scrollIntoView?.({block:"nearest",inline:"nearest"})})});le(()=>{j.current.orientation=x},[j,x]),le(()=>{s&&(S&&D?(M.current=i??-1,_.current&&i!=null&&(Z.current=!0,B())):P.current&&(M.current=-1,B()))},[s,S,D,i,B]),le(()=>{if(s){if(!S){Y.current=!1;return}if(D)if(r==null){if(Y.current=!1,ee.current!=null)return;if(P.current&&(M.current=-1,X()),(!W.current||!P.current)&&_.current&&(H.current!=null||_.current===!0&&H.current==null)){let L=0;const z=()=>{n.current[0]==null?(L<2&&(L?q=>$.request(q):queueMicrotask)(z),L+=1):(M.current=H.current==null||Hs(H.current,x,d)||u?xo(n):ui(n),H.current=null,B())};z()}}else Ir(n.current,r)||(M.current=r,X(),Z.current=!1)}},[s,S,D,r,ee,u,n,x,d,B,X,$]),le(()=>{if(!s||D||!O||p||!P.current)return;const L=O.nodesRef.current,z=L.find(re=>re.id===R)?.context?.elements.floating,ye=yt(je(k??z??null)),q=L.some(re=>re.context&&ve(re.context.elements.floating,ye));z&&!q&&G.current&&z.focus({preventScroll:!0})},[s,D,k,O,R,p]),le(()=>{W.current=S,P.current=!!D}),le(()=>{S||(H.current=null,_.current=A)},[S,A]);const ne=r!=null,de=ue(L=>{if(!K.current)return;const z=n.current.indexOf(L.currentTarget);z!==-1&&(M.current!==z||r!==z)&&(M.current=z,B(L))}),fe=ue(()=>b??O?.nodesRef.current.find(L=>L.id===R)?.context?.dataRef?.current.orientation),ie=ue(()=>xo(n,J.current)),he=ue(L=>{if(G.current=!1,Y.current=!0,L.which===229||!K.current&&L.currentTarget===F.current)return;if(u&&Tm(L.key,x,d,w)){to(L.key,fe())||Qt(L),E.setOpen(!1,Ce(oi,L.nativeEvent)),Xe(k)&&(p?O?.events.emit("virtualfocus",k):k.focus());return}const z=M.current,ye=xo(n,g),q=ui(n,g);if(T||(L.key==="Home"&&(Qt(L),M.current=ye,B(L)),L.key==="End"&&(Qt(L),M.current=q,B(L))),I!=null){const re=I(L,M.current,n,x,l,d,g,ye,q);if(re!=null&&(M.current=re,B(L)),x==="both")return}if(to(L.key,x)){if(Qt(L),S&&!p&&yt(L.currentTarget.ownerDocument)===L.currentTarget){M.current=Hs(L.key,x,d)?ye:q,B(L);return}Hs(L.key,x,d)?l?z>=q?a&&z!==n.current.length?M.current=-1:(Y.current=!1,M.current=ye):M.current=on(n.current,{startingIndex:z,disabledIndices:g}):M.current=Math.min(q,on(n.current,{startingIndex:z,disabledIndices:g})):l?z<=ye?a&&z!==-1?M.current=n.current.length:(Y.current=!1,M.current=q):M.current=on(n.current,{startingIndex:z,decrement:!0,disabledIndices:g}):M.current=Math.max(ye,on(n.current,{startingIndex:z,decrement:!0,disabledIndices:g})),Ir(n.current,M.current)&&(M.current=-1),B(L)}}),oe=f.useMemo(()=>({onFocus(z){Y.current=!0,de(z)},onClick:({currentTarget:z})=>z.focus({preventScroll:!0}),onMouseMove(z){Jl(z)||(Y.current=!0,Z.current=!1,m&&de(z))},onPointerLeave(z){if(!K.current||!G.current||z.pointerType==="touch")return;Y.current=!0;const ye=z.relatedTarget;if(!(!m||n.current.includes(ye))&&ce.current&&(Q.current?.(),Q.current=null,M.current=-1,B(z),!p)){const q=F.current,re=yt(je(q));q&&ve(q,re)&&q.focus({preventScroll:!0})}}}),[de,K,F,m,n,B,ce,p]),se=f.useMemo(()=>p&&S&&ne&&{"aria-activedescendant":`${v}-${r}`},[p,S,ne,v,r]),ae=f.useMemo(()=>({"aria-orientation":x==="both"?void 0:x,...T?{}:se,onKeyDown(L){if(L.key==="Tab"&&L.shiftKey&&S&&!p){const z=gt(L.nativeEvent);if(z&&!ve(F.current,z))return;Qt(L),E.setOpen(!1,Ce(jn,L.nativeEvent)),Xe(k)&&k.focus();return}he(L)},onPointerMove(L){Jl(L)||(G.current=!0)}}),[se,he,F,x,T,E,S,p,k]),xe=f.useMemo(()=>{function L(q){E.setOpen(!0,Ce(oi,q.nativeEvent,q.currentTarget))}function z(q){A==="auto"&&Ji(q.nativeEvent)&&(_.current=!p)}function ye(q){_.current=A,A==="auto"&&$i(q.nativeEvent)&&(_.current=!0)}return{onKeyDown(q){const re=E.select("open");G.current=!1;const Se=q.key.startsWith("Arrow"),ke=Nm(q.key,fe(),d),We=to(q.key,x),rt=(u?ke:We)||q.key==="Enter"||q.key.trim()==="";if(p&&re)return he(q);if(!(!re&&!h&&Se)){if(rt){const Ge=to(q.key,fe());H.current=u&&Ge?null:q.key}if(u){ke&&(Qt(q),re?(M.current=ie(),B(q)):L(q));return}We&&(ee.current!=null&&(M.current=ee.current),Qt(q),!re&&h?L(q):he(q),re&&B(q))}},onFocus(q){E.select("open")&&!p&&(M.current=-1,B(q))},onPointerDown:ye,onPointerEnter:ye,onMouseDown:z,onClick:z}},[he,A,ie,u,B,E,h,x,fe,d,ee,p]),me=f.useMemo(()=>({...se,...xe}),[se,xe]);return f.useMemo(()=>s?{reference:me,floating:ae,item:oe,trigger:xe}:{},[s,me,ae,xe,oe])}function Dd(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:s,disabledIndices:i,onTyping:a,enabled:l=!0,resetMs:u=750,selectedIndex:d=null}=t,p="rootStore"in e?e.rootStore:e,A=p.useState("open"),m=ht(),h=f.useRef(""),g=f.useRef(d??o??-1),x=f.useRef(null),b=ue(C=>{function I(F){return r?.current[F]}function w(F){const R=I(F);return R&&!$o(R)||R?.matches(":disabled")?!1:i==null||!So(Ht,F,i)}function E(F,R,O=0){if(F.length===0)return-1;const _=(O%F.length+F.length)%F.length,M=R.toLowerCase();for(let H=0;H<F.length;H+=1){const G=(_+H)%F.length;if(!(!F[G]?.toLowerCase().startsWith(M)||!w(G)))return G}return-1}const S=n.current;if(h.current.length>0&&C.key===" "&&(Qt(C),a?.(!0)),h.current.length>0&&h.current[0]!==" "&&E(S,h.current)===-1&&C.key!==" "&&a?.(!1),S==null||C.key.length!==1||C.ctrlKey||C.metaKey||C.altKey)return;A&&C.key!==" "&&(Qt(C),a?.(!0));const D=h.current==="";D&&(g.current=d??o??-1),S.every((F,R)=>F&&w(R)?F[0]?.toLowerCase()!==F[1]?.toLowerCase():!0)&&h.current===C.key&&(h.current="",g.current=x.current),h.current+=C.key,m.start(u,()=>{h.current="",g.current=x.current,a?.(!1)});const N=((D?d??o??-1:g.current)??0)+1,T=E(S,h.current,N);T!==-1?(s?.(T),x.current=T):C.key!==" "&&(h.current="",a?.(!1))}),v=ue(C=>{const I=C.relatedTarget,w=p.select("domReferenceElement"),E=p.select("floatingElement");ve(w,I)||ve(E,I)||(m.clear(),h.current="",g.current=x.current,a?.(!1))});le(()=>{!A&&d!==null||(m.clear(),x.current=null,h.current!==""&&(h.current=""))},[A,d,m]);const y=f.useMemo(()=>({onKeyDown:b,onBlur:v}),[b,v]);return f.useMemo(()=>l?{reference:y,floating:y}:{},[l,y])}const $l=.1,Pm=$l*$l,Qe=.5;function no(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function ro(e,t,n,r,o,s,i,a,l,u){let d=!1;return no(e,t,n,r,o,s)&&(d=!d),no(e,t,o,s,i,a)&&(d=!d),no(e,t,i,a,l,u)&&(d=!d),no(e,t,l,u,n,r)&&(d=!d),d}function _m(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function oo(e,t,n,r,o,s){const i=Math.min(n,o),a=Math.max(n,o),l=Math.min(r,s),u=Math.max(r,s);return e>=i&&e<=a&&t>=l&&t<=u}function Fd(e={}){const{blockPointerEvents:t=!1}=e,n=new Wt,r=({x:o,y:s,placement:i,elements:a,onClose:l,nodeId:u,tree:d})=>{const p=i?.split("-")[0];let A=!1,m=null,h=null,g=typeof performance<"u"?performance.now():0;function x(v,y){const C=performance.now(),I=C-g;if(m===null||h===null||I===0)return m=v,h=y,g=C,!1;const w=v-m,E=y-h,S=w*w+E*E,D=I*I*Pm;return m=v,h=y,g=C,S<D}function b(){n.clear(),l()}return function(y){n.clear();const C=a.domReference,I=a.floating;if(!C||!I||p==null||o==null||s==null)return;const{clientX:w,clientY:E}=y,S=gt(y),D=y.type==="mouseleave",k=ve(I,S),j=ve(C,S);if(k&&(A=!0,!D))return;if(j&&(A=!1,!D)){A=!0;return}if(D&&Te(y.relatedTarget)&&ve(I,y.relatedTarget))return;function N(){return!!(d&&bn(d.nodesRef.current,u).length>0)}function T(){N()||b()}if(N())return;const F=C.getBoundingClientRect(),R=I.getBoundingClientRect(),O=o>R.right-R.width/2,_=s>R.bottom-R.height/2,M=R.width>F.width,H=R.height>F.height,G=(M?F:R).left,B=(M?F:R).right,P=(H?F:R).top,W=(H?F:R).bottom;if(p==="top"&&s>=F.bottom-1||p==="bottom"&&s<=F.top+1||p==="left"&&o>=F.right-1||p==="right"&&o<=F.left+1){T();return}let Y=!1;switch(p){case"top":Y=oo(w,E,G,F.top+1,B,R.bottom-1);break;case"bottom":Y=oo(w,E,G,R.top+1,B,F.bottom-1);break;case"left":Y=oo(w,E,R.right-1,W,F.left+1,P);break;case"right":Y=oo(w,E,F.right-1,W,R.left+1,P);break}if(Y)return;if(A&&!_m(w,E,F)){T();return}if(!D&&x(w,E)){T();return}let Z=!1;switch(p){case"top":{const Q=M?Qe/2:Qe*4,J=M||O?o+Q:o-Q,K=M?o-Q:O?o+Q:o-Q,ee=s+Qe+1,ce=O||M?R.bottom-Qe:R.top,te=O?M?R.bottom-Qe:R.top:R.bottom-Qe;Z=ro(w,E,J,ee,K,ee,R.left,ce,R.right,te);break}case"bottom":{const Q=M?Qe/2:Qe*4,J=M||O?o+Q:o-Q,K=M?o-Q:O?o+Q:o-Q,ee=s-Qe,ce=O||M?R.top+Qe:R.bottom,te=O?M?R.top+Qe:R.bottom:R.top+Qe;Z=ro(w,E,J,ee,K,ee,R.left,ce,R.right,te);break}case"left":{const Q=H?Qe/2:Qe*4,J=H||_?s+Q:s-Q,K=H?s-Q:_?s+Q:s-Q,ee=o+Qe+1,ce=_||H?R.right-Qe:R.left,te=_?H?R.right-Qe:R.left:R.right-Qe;Z=ro(w,E,ce,R.top,te,R.bottom,ee,J,ee,K);break}case"right":{const Q=H?Qe/2:Qe*4,J=H||_?s+Q:s-Q,K=H?s-Q:_?s+Q:s-Q,ee=o-Qe,ce=_||H?R.left+Qe:R.right,te=_?H?R.left+Qe:R.right:R.left+Qe;Z=ro(w,E,ee,J,ee,K,ce,R.top,te,R.bottom);break}}Z?A||n.start(40,T):T()}};return r.__options={...e,blockPointerEvents:t},r}const Bd=f.createContext(void 0);function Om(){const e=f.useContext(Bd);if(e===void 0)throw new Error(at(26));return e}const gi="ArrowUp",mi="ArrowDown",xi="ArrowLeft",bi="ArrowRight",vi="Home",yi="End",ss=new Set([gi,mi,xi,bi,vi,yi]),Hm="Shift",Km=[Hm,"Control","Alt","Meta"];function Wm(e){return Xe(e)&&e.tagName==="INPUT"}function Xl(e){return!!(Wm(e)&&e.selectionStart!=null||Xe(e)&&e.tagName==="TEXTAREA")}function ql(e,t,n,r){if(!e||!t||!t.scrollTo)return;let o=e.scrollLeft,s=e.scrollTop;const i=e.clientWidth<e.scrollWidth,a=e.clientHeight<e.scrollHeight;if(i&&r!=="vertical"){const l=ec(e,t,"left"),u=so(e),d=so(t);n==="ltr"&&(l+t.offsetWidth+d.scrollMarginRight>e.scrollLeft+e.clientWidth-u.scrollPaddingRight?o=l+t.offsetWidth+d.scrollMarginRight-e.clientWidth+u.scrollPaddingRight:l-d.scrollMarginLeft<e.scrollLeft+u.scrollPaddingLeft&&(o=l-d.scrollMarginLeft-u.scrollPaddingLeft)),n==="rtl"&&(l-d.scrollMarginLeft<e.scrollLeft+u.scrollPaddingLeft?o=l-d.scrollMarginLeft-u.scrollPaddingLeft:l+t.offsetWidth+d.scrollMarginRight>e.scrollLeft+e.clientWidth-u.scrollPaddingRight&&(o=l+t.offsetWidth+d.scrollMarginRight-e.clientWidth+u.scrollPaddingRight))}if(a&&r!=="horizontal"){const l=ec(e,t,"top"),u=so(e),d=so(t);l-d.scrollMarginTop<e.scrollTop+u.scrollPaddingTop?s=l-d.scrollMarginTop-u.scrollPaddingTop:l+t.offsetHeight+d.scrollMarginBottom>e.scrollTop+e.clientHeight-u.scrollPaddingBottom&&(s=l+t.offsetHeight+d.scrollMarginBottom-e.clientHeight+u.scrollPaddingBottom)}e.scrollTo({left:o,top:s,behavior:"auto"})}function ec(e,t,n){const r=n==="left"?"offsetLeft":"offsetTop";let o=0;for(;t.offsetParent&&(o+=t[r],t.offsetParent!==e);)t=t.offsetParent;return o}function so(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const Lm={...Lr,..._n,nestedDialogOpen(e){return e?{"data-nested-dialog-open":""}:null}},ka=f.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,initialFocus:a,...l}=t,u=On(),d=u.useState("descriptionElementId"),p=u.useState("disablePointerDismissal"),A=u.useState("floatingRootContext"),m=u.useState("popupProps"),h=u.useState("modal"),g=u.useState("mounted"),x=u.useState("nested"),b=u.useState("nestedOpenDialogCount"),v=u.useState("open"),y=u.useState("openMethod"),C=u.useState("titleElementId"),I=u.useState("transitionStatus"),w=u.useState("role"),E=A.useState("floatingId");Om(),Zt({open:v,ref:u.context.popupRef,onComplete(){v&&u.context.onOpenChangeComplete?.(!0)}});const S=a===void 0?Im(u.context.popupRef):a,D=b>0,k=u.useStateSetter("popupElement"),N=Me("div",t,{state:{open:v,nested:x,transitionStatus:I,nestedDialogOpen:D},props:[m,{id:E,"aria-labelledby":C,"aria-describedby":d,role:w,...rs,hidden:!g,onKeyDown(T){ss.has(T.key)&&T.stopPropagation()},style:{"--nested-dialogs":b}},l],ref:[n,u.context.popupRef,k],stateAttributesMapping:Lm});return c.jsx(fa,{context:A,openInteractionType:y,disabled:!g,closeOnFocusOut:!p,initialFocus:S,returnFocus:i,modal:h!==!1,restoreFocus:"popup",children:N})});function Ea(e){return bu(19)?e:e?"true":void 0}const Sa=f.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const i=r.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 c.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),Ra=f.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,s=On(),i=s.useState("mounted"),a=s.useState("modal"),l=s.useState("open");return i||r?c.jsx(Bd.Provider,{value:r,children:c.jsxs(ca,{ref:n,...o,children:[i&&a===!0&&c.jsx(Sa,{ref:s.context.internalBackdropRef,inert:Ea(!l)}),t.children]})}):null});let tc={},nc={},rc="";function is(e,t){return Ti(e)?e:t}function oc(e,t,n){return/hidden|clip/.test(e.getComputedStyle(is(t,n)).overflowY)}function Qm(e){if(typeof document>"u")return!1;const t=je(e);return it(t).innerWidth-t.documentElement.clientWidth>0}function Gm(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=je(e),r=n.documentElement,o=n.body,s=is(r,o),i=s.style.overflowY,a=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",s.style.overflowY="scroll";const l=s.offsetWidth;s.style.overflowY="hidden";const u=s.offsetWidth;return s.style.overflowY=i,r.style.scrollbarGutter=a,l===u}function Ym(e){const t=je(e),n=t.documentElement,r=t.body,o=is(n,r),s={overflowY:o.style.overflowY,overflowX:o.style.overflowX};return Object.assign(o.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(o.style,s)}}function zm(e){const t=je(e),n=t.documentElement,r=t.body,o=it(n);let s=0,i=0,a=!1;const l=It.create();if(un&&(o.visualViewport?.scale??1)!==1)return()=>{};function u(){const m=o.getComputedStyle(n),h=o.getComputedStyle(r),b=(m.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,tc={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},rc=n.style.scrollBehavior,nc={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const v=n.scrollHeight>n.clientHeight,y=n.scrollWidth>n.clientWidth,C=m.overflowY==="scroll"||h.overflowY==="scroll",I=m.overflowX==="scroll"||h.overflowX==="scroll",w=Math.max(0,o.innerWidth-r.clientWidth),E=Math.max(0,o.innerHeight-r.clientHeight),S=parseFloat(h.marginTop)+parseFloat(h.marginBottom),D=parseFloat(h.marginLeft)+parseFloat(h.marginRight),k=is(n,r);if(a=Gm(e),a){n.style.scrollbarGutter=b,k.style.overflowY="hidden",k.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:b,overflowY:"hidden",overflowX:"hidden"}),(v||C)&&(n.style.overflowY="scroll"),(y||I)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:S||E?`calc(100dvh - ${S+E}px)`:"100dvh",width:D||w?`calc(100vw - ${D+w}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,tc),Object.assign(r.style,nc),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=rc)}function p(){d(),l.request(u)}u();const A=De(o,"resize",p);return()=>{l.cancel(),d(),typeof o.removeEventListener=="function"&&A()}}class Um{lockCount=0;restore=null;timeoutLock=Wt.create();timeoutUnlock=Wt.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=je(t),r=n.documentElement,o=n.body,s=it(r);if(oc(s,r,o)){const a=new s.MutationObserver(()=>{oc(s,r,o)||(a.disconnect(),this.restore=null,this.lock(t))}),l={attributes:!0};a.observe(r,l),a.observe(o,l),this.restore=()=>a.disconnect();return}const i=Uo||!Qm(t);this.restore=i?Ym(t):zm(t)}}const Vm=new Um;function jd(e=!0,t=null){le(()=>{if(e)return Vm.acquire(t)},[e,t])}function Zm({store:e,parentContext:t,isDrawer:n}){const r=e.useState("open"),o=e.useState("disablePointerDismissal"),s=e.useState("modal"),i=e.useState("popupElement"),a=e.useState("floatingRootContext"),[l,u]=f.useState(0),[d,p]=f.useState(0),A=l===0,m=es(a,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(h){if(!e.context.outsidePressEnabledRef.current||"button"in h&&h.button!==0)return!1;if("touches"in h){if(h.type==="touchend"){if(h.changedTouches.length!==1||h.touches.length!==0)return!1}else if(h.touches.length!==1)return!1}const g=gt(h);if(A&&!o){if(s){const x=e.context.internalBackdropRef.current,b=e.context.backdropRef.current;return x||b?x===g||b===g||ve(g,i)&&!g?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:A});return jd(r&&s===!0,i),e.useContextCallback("onNestedDialogOpen",(h,g)=>{u(h),p(g)}),le(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(l+1,d+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),ba(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}const Jm={...Ca,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 $m extends Gr{constructor(t,n,r){const o=new Yr,s=Xm(t,o,n,r);super(s,qm(o),Jm)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const r={open:t};ga(r,t,n.trigger),this.update(r)}}function Xm(e,t,n,r=!1){const o={...va(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e};return o.floatingRootContext=yd(t,n,r),o}function qm(e){return{popupRef:f.createRef(),backdropRef:f.createRef(),internalBackdropRef:f.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Md(e,t){const{children:n,open:r,defaultOpen:o=!1,onOpenChange:s,onOpenChangeComplete:i,disablePointerDismissal:a=!1,modal:l=!0,actionsRef:u,handle:d,triggerId:p,defaultTriggerId:A=null}=t,m=e==="drawer",h=e==="alert-dialog",g=h?!0:l,x=h||a,b=h?"alertdialog":"dialog",v=On(!0),y=v!=null,C={modal:g,disablePointerDismissal:x,nested:y,role:b},I=xd((j,N)=>new $m({open:o,openProp:r,activeTriggerId:A,triggerIdProp:p,...C},j,N),!0);I.useControlledProp("openProp",r),I.useControlledProp("triggerIdProp",p),I.useSyncedValues(C),I.useContextCallback("onOpenChange",s),I.useContextCallback("onOpenChangeComplete",i);const w=I.useState("open"),E=I.useState("mounted"),S=I.useState("payload");Em(I,w),ma(I);const{forceUnmount:D}=xa(w,I);f.useImperativeHandle(u,()=>({unmount:D,close:()=>I.setOpen(!1,Ce(Pi))}),[D,I]);const k=w||E;return c.jsxs(Uu.Provider,{value:I,children:[d&&c.jsx(Aa,{handle:d,store:I}),k&&c.jsx(Zm,{store:I,parentContext:v?.context,isDrawer:m}),typeof n=="function"?n({payload:S}):n]})}function Nd(e){return Md("dialog",e)}const Da=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,l=On(),u=wt(i);return l.useSyncedValueWithCleanup("titleElementId",u),Me("h2",t,{ref:n,props:[{id:u},a]})});function e0(e){const t=f.useRef(""),n=f.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:f.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function as(e,t){const n=f.useRef(e),r=ue(t);le(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function t0(e,t){const n=ue((s,i)=>{(typeof e=="function"?e():e)||t(i||(Uo?"touch":""))}),{onClick:r,onPointerDown:o}=e0(n);return f.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function Td(e){const[t,n]=f.useState(null),r=t0(e,n);return as(e,o=>{o&&!e&&n(null)}),f.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function n0({...e}){return c.jsx(Nd,{"data-slot":"sheet",...e})}function r0({...e}){return c.jsx(Ra,{"data-slot":"sheet-portal",...e})}function o0({className:e,...t}){return c.jsx(ia,{"data-slot":"sheet-overlay",className:ge("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...t})}function s0({className:e,children:t,side:n="right",showCloseButton:r=!0,...o}){return c.jsxs(r0,{children:[c.jsx(o0,{}),c.jsxs(ka,{"data-slot":"sheet-content","data-side":n,className:ge("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...o,children:[t,r&&c.jsxs(Qr,{"data-slot":"sheet-close",render:c.jsx(He,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[c.jsx(zi,{}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function i0({className:e,...t}){return c.jsx("div",{"data-slot":"sheet-header",className:ge("flex flex-col gap-0.5 p-4",e),...t})}function a0({className:e,...t}){return c.jsx(Da,{"data-slot":"sheet-title",className:ge("cn-font-heading text-base font-medium text-foreground",e),...t})}function l0({className:e,...t}){return c.jsx(aa,{"data-slot":"sheet-description",className:ge("text-sm text-muted-foreground",e),...t})}function nn({className:e,...t}){return c.jsx("div",{"data-slot":"skeleton",className:ge("animate-pulse rounded-md bg-muted",e),...t})}const Pd=f.createContext(void 0);function zr(e){const t=f.useContext(Pd);if(t===void 0&&!e)throw new Error(at(72));return t}const c0={...Ca,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 u0 extends Gr{constructor(t,n,r){const o=new Yr;super(d0(t,o,n,r),f0(o),c0)}setOpen=(t,n)=>{km(this,t,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,Ce(Tn,t))}}function d0(e,t,n,r=!1){const o={...va(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return o.floatingRootContext=yd(t,n,r),o}function f0(e){return{popupRef:f.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const p0=ha(function(t){const{disabled:n=!1,defaultOpen:r=!1,open:o,disableHoverablePopup:s=!1,trackCursorAxis:i="none",actionsRef:a,onOpenChange:l,onOpenChangeComplete:u,handle:d,triggerId:p,defaultTriggerId:A=null,children:m}=t,h=xd((j,N)=>new u0({open:r,openProp:o,activeTriggerId:A,triggerIdProp:p},j,N));h.useControlledProp("openProp",o),h.useControlledProp("triggerIdProp",p),h.useContextCallback("onOpenChange",l),h.useContextCallback("onOpenChangeComplete",u);const g=h.useState("open"),x=!n&&g,b=h.useState("activeTriggerId"),v=h.useState("mounted"),y=h.useState("payload");h.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:s,disabled:n}),ma(h,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:C,transitionStatus:I}=xa(x,h),w=h.useState("isInstantPhase"),E=h.useState("instantType"),S=h.useState("lastOpenChangeReason"),D=f.useRef(null);le(()=>{g&&n&&h.setOpen(!1,Ce(Iu))},[g,n,h]),le(()=>{I==="ending"&&S===Pt||I!=="ending"&&w?(E!=="delay"&&(D.current=E),h.set("instantType","delay")):D.current!==null&&(h.set("instantType",D.current),D.current=null)},[I,w,S,E,h]),le(()=>{x&&b==null&&h.set("payload",void 0)},[h,b,x]),f.useImperativeHandle(a,()=>({unmount:C,close:()=>h.setOpen(!1,Ce(Pi))}),[C,h]);const k=x||v||!n&&i!=="none";return c.jsxs(Pd.Provider,{value:h,children:[d&&c.jsx(Aa,{handle:d,store:h}),k&&c.jsx(h0,{store:h,disabled:n,trackCursorAxis:i}),typeof m=="function"?m({payload:y}):m]})});function h0({store:e,disabled:t,trackCursorAxis:n}){const r=e.useState("floatingRootContext"),o=es(r,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),s=Ig(r,{enabled:!t&&n!=="none",axis:n==="none"?void 0:n}),i=f.useMemo(()=>Nt(s.reference,o.reference),[s.reference,o.reference]);return ba(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:o.floating??dt}),null}const A0=f.createContext(void 0);function g0(){return f.useContext(A0)}const sc=600,_d="data-base-ui-tooltip-trigger";function ic(e){if("composedPath"in e){const n=e.composedPath();for(let r=0;r<n.length;r+=1){const o=n[r];if(Te(o))return o}}const t=e.target;return Te(t)?t:null}function m0(e){let t=e;for(;t;){const n=t.closest(`[${_d}]`);if(n)return n;const r=t.getRootNode();t="host"in r&&Te(r.host)?r.host:null}return null}const x0=gd(function(t,n){const{render:r,className:o,style:s,handle:i,payload:a,disabled:l,delay:u,closeOnClick:d=!0,closeDelay:p,id:A,...m}=t,h=zr(!0),x=Id(i)??h;if(!x)throw new Error(at(82));const b=wt(A),v=x.useState("isTriggerActive",b),y=x.useState("isOpenedByTrigger",b),C=x.useState("floatingRootContext"),I=f.useRef(null),w=u??sc,E=p??0,{registerTrigger:S,isMountedByThisTrigger:D}=vd(b,I,x,{payload:a,closeOnClick:d,closeDelay:E}),k=g0(),{delayRef:j,isInstantPhase:N,hasProvider:T}=lg(C,{open:y}),F=wa(C);x.useSyncedValue("isInstantPhase",N);const R=x.useState("disabled"),O=l??R,_=nt(O),M=x.useState("trackCursorAxis"),H=x.useState("disableHoverablePopup"),G=f.useRef(!1),B=ht(),P=f.useRef(void 0);function W(){return T?er(j.current,"open")===0?0:u??k??sc:w}function Y(X){const ne=I.current;if(!ne||!X)return!1;const de=m0(X);return de!==null&&de!==ne&&ve(ne,de)}function Z(X){const ne=Y(X);return G.current=ne,ne&&(F.openChangeTimeout.clear(),F.restTimeout.clear(),F.restTimeoutPending=!1,B.clear()),ne}const Q=Sd(C,{enabled:!O,mouseOnly:!0,move:!1,handleClose:!H&&M!=="both"?Fd():null,restMs:W,delay(){return p==null&&T?{close:er(j.current,"close")}:{close:E}},triggerElementRef:I,isActiveTrigger:v,isClosing:()=>x.select("transitionStatus")==="ending",shouldOpen(){return!G.current}}),J=wd(C,{enabled:!O}).reference,K=X=>{const ne=G.current,de=ic(X),fe=Z(de),ie=I.current,he=ie&&de&&ve(ie,de);if(fe&&x.select("open")&&x.select("lastOpenChangeReason")===ct){x.setOpen(!1,Ce(ct,X));return}if(ne&&!fe&&he&&!_.current&&!x.select("open")&&ie&&xn(P.current)){const oe=()=>{!G.current&&!_.current&&!x.select("open")&&x.setOpen(!0,Ce(ct,X,ie))},se=W();se===0?(B.clear(),oe()):B.start(se,oe)}},ee=x.useState("triggerProps",D);return Me("button",t,{state:{open:y},ref:[n,S,I],props:[Q,J,D||M!=="none"?ee:void 0,{onMouseOver(X){K(X.nativeEvent)},onFocus(X){Y(ic(X.nativeEvent))&&X.preventBaseUIHandler()},onMouseLeave(){G.current=!1,B.clear(),P.current=void 0},onPointerEnter(X){P.current=X.pointerType},onPointerDown(X){P.current=X.pointerType,x.set("closeOnClick",d),d&&!x.select("open")&&x.cancelPendingOpen(X.nativeEvent)},onClick(X){d&&!x.select("open")&&x.cancelPendingOpen(X.nativeEvent)},id:b,"data-trigger-disabled":O?"":void 0,[_d]:O?void 0:""},m],stateAttributesMapping:Vu})}),Od=f.createContext(void 0);function b0(){const e=f.useContext(Od);if(e===void 0)throw new Error(at(70));return e}const v0=f.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,style:a,...l}=t,{node:u,subtree:d}=nd({container:o,ref:n,componentProps:t,elementProps:l});return!d&&!u?null:c.jsxs(f.Fragment,{children:[d,u&&cn.createPortal(r,u)]})}),y0=f.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return zr().useState("mounted")||r?c.jsx(Od.Provider,{value:r,children:c.jsx(v0,{ref:n,...o})}):null}),Hd=f.createContext(void 0);function Kd(){const e=f.useContext(Hd);if(e===void 0)throw new Error(at(71));return e}const C0=f.createContext(void 0);function ls(){return f.useContext(C0)?.direction??"ltr"}const I0=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:l}=t,{element:u,padding:d=0,offsetParent:p="real"}=vn(e,t)||{};if(u==null)return{};const A=Nu(d),m={x:n,y:r},h=ea(o),g=qi(h),x=await i.getDimensions(u),b=h==="y",v=b?"top":"left",y=b?"bottom":"right",C=b?"clientHeight":"clientWidth",I=s.reference[g]+s.reference[h]-m[h]-s.floating[g],w=m[h]-s.reference[h],E=p==="real"?await i.getOffsetParent?.(u):a.floating;let S=a.floating[C]||s.floating[g];(!S||!await i.isElement?.(E))&&(S=a.floating[C]||s.floating[g]);const D=I/2-w/2,k=S/2-x[g]/2-1,j=Math.min(A[v],k),N=Math.min(A[y],k),T=j,F=S-x[g]-N,R=S/2-x[g]/2+D,O=Mu(T,R,F),_=!l.arrow&&In(o)!=null&&R!==O&&s.reference[g]/2-(R<T?j:N)-x[g]/2<0,M=_?R<T?R-T:R-F:0;return{[h]:m[h]+M,data:{[h]:O,centerOffset:R-O-M,..._&&{alignmentOffset:M}},reset:_}}}),w0=(e,t)=>({...I0(e),options:[e,t]}),k0={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===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}}}},E0={sideX:"left",sideY:"top"},ac="--available-width",lc="--available-height";function Wd(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function cc(e,t,n){const{rects:r,placement:o}=e;return{side:Wd(t,Tt(o),n),align:In(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Fa(e){return S0(e,Fm)}function S0(e,t){const{anchor:n,positionMethod:r="absolute",side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,collisionBoundary:l,collisionPadding:u=5,sticky:d=!1,arrowPadding:p=5,disableAnchorTracking:A=!1,inline:m,keepMounted:h=!1,floatingRootContext:g,mounted:x,collisionAvoidance:b,shift:v,nodeId:y,adaptiveOrigin:C,lazyFlip:I=!1,externalTree:w}=e,[E,S]=f.useState(null);!x&&E!==null&&S(null);const D=b.side||"flip",k=b.align||"flip",j=b.fallbackAxisSide||"end",N=v?.crossAxis??!1,T=v?.rootBoundary,F=typeof n=="function"?n:void 0,R=ue(F),O=F?R:n,_=nt(n),M=nt(x),G=ls()==="rtl",B=E||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":G?"left":"right","inline-start":G?"right":"left"}[o],P=i==="center"?B:`${B}-${i}`;let W=u;typeof W=="number"?W={top:W,right:W,bottom:W,left:W}:W&&(W={top:W.top||0,right:W.right||0,bottom:W.bottom||0,left:W.left||0});const Y=1,Z=o==="bottom"?Y:0,Q=o==="top"?Y:0,J=o==="right"?Y:0,K=o==="left"?Y:0,ee={boundary:l==="clipping-ancestors"?"clippingAncestors":l,padding:W},ce=f.useRef(null),te=nt(s),$=nt(a),X=typeof s!="function"?s:0,ne=typeof a!="function"?a:0,de=[];m&&de.push(m),de.push(sm(Re=>{const Pe=cc(Re,o,G),Je=typeof te.current=="function"?te.current(Pe):te.current,qe=typeof $.current=="function"?$.current(Pe):$.current;return{mainAxis:Je,crossAxis:qe,alignmentAxis:qe}},[X,ne,G,o]));const fe=k==="none"&&D!=="shift",ie=!fe&&(d||N||D==="shift"),he=D==="none"?null:lm({...ee,padding:{top:W.top+Y+Z,right:W.right+Y+K,bottom:W.bottom+Y+Q,left:W.left+Y+J},mainAxis:!N&&D==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:j}),oe=fe?null:im({...ee,rootBoundary:T,mainAxis:k!=="none",crossAxis:ie,limiter:d||N?void 0:am(Re=>{if(!ce.current)return{};const{width:Pe,height:Je}=ce.current.getBoundingClientRect(),qe=Mt(Tt(Re.placement)),ft=qe==="y"?Pe:Je,ot=qe==="y"?W.left+W.right:W.top+W.bottom;return{offset:ft/2+ot/2}})},[ee,d,N,T,W,k]);D==="shift"||k==="shift"||i==="center"?de.push(oe,he):de.push(he,oe),de.push(cm({...ee,apply({elements:{floating:Re},availableWidth:Pe,availableHeight:Je,rects:qe}){if(!M.current)return;const ft=Re.style;ft.setProperty(ac,`${Pe}px`),ft.setProperty(lc,`${Je}px`);const ot=it(Re).devicePixelRatio||1,{x:Ct,y:st,width:Et,height:St}=qe.reference,qt=(Math.round((Ct+Et)*ot)-Math.round(Ct*ot))/ot,Be=(Math.round((st+St)*ot)-Math.round(st*ot))/ot;ft.setProperty("--anchor-width",`${qt}px`),ft.setProperty("--anchor-height",`${Be}px`)}}),w0(Re=>({element:ce.current||je(Re.elements.floating).createElement("div"),padding:p,offsetParent:"floating"}),[p]),{name:"transformOrigin",fn(Re){const{elements:Pe,middlewareData:Je,placement:qe,rects:ft,y:ot}=Re,Ct=Tt(qe),st=Mt(Ct),Et=ce.current,St=Je.arrow?.x||0,qt=Je.arrow?.y||0,Be=Et?.clientWidth||0,Ue=Et?.clientHeight||0,bt=St+Be/2,Rt=qt+Ue/2,Bt=Math.abs(Je.shift?.y||0),jt=ft.reference.height/2,Lt=typeof s=="function"?s(cc(Re,o,G)):s,dn=Bt>Lt,Dt={top:`${bt}px calc(100% + ${Lt}px)`,bottom:`${bt}px ${-Lt}px`,left:`calc(100% + ${Lt}px) ${Rt}px`,right:`${-Lt}px ${Rt}px`}[Ct],en=`${bt}px ${ft.reference.y+jt-ot}px`;return Pe.floating.style.setProperty("--transform-origin",ie&&st==="y"&&dn?en:Dt),{}}},k0,C),le(()=>{!x&&g&&g.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[x,g]);const se=f.useMemo(()=>({elementResize:!A&&typeof ResizeObserver<"u",layoutShift:!A&&typeof IntersectionObserver<"u"}),[A]),{refs:ae,elements:xe,x:me,y:L,middlewareData:z,update:ye,placement:q,context:re,isPositioned:Se,floatingStyles:ke}=t({rootContext:g,open:h?x:void 0,placement:P,middleware:de,strategy:r,whileElementsMounted:h?void 0:(...Re)=>Yl(...Re,se),nodeId:y,externalTree:w}),{sideX:We,sideY:rt}=z.adaptiveOrigin||E0,Ge=Se?r:"fixed",At=f.useMemo(()=>{let Re;return Se?C?Re={position:Ge,[We]:me,[rt]:L}:Re={...ke,position:Ge}:Re={position:Ge,top:0,left:0},Re[ac]="100vw",Re[lc]="100vh",Se||(Re.opacity=0),Re},[C,Ge,We,me,rt,L,ke,Se]),$e=f.useRef(null);le(()=>{if(!x)return;const Re=_.current,Pe=typeof Re=="function"?Re():Re,qe=(uc(Pe)?Pe.current:Pe)||null||null;qe!==$e.current&&(ae.setPositionReference(qe),$e.current=qe)},[x,ae,O,_]),f.useEffect(()=>{if(!x)return;const Re=_.current;typeof Re!="function"&&uc(Re)&&Re.current!==$e.current&&(ae.setPositionReference(Re.current),$e.current=Re.current)},[x,ae,O,_]),f.useEffect(()=>{if(h&&x&&xe.reference&&xe.floating)return Yl(xe.reference,xe.floating,ye,se)},[h,x,xe,ye,se]);const Oe=Tt(q),lt=Wd(o,Oe,G),Ee=In(q)||"center",Le=!!z.hide?.referenceHidden;le(()=>{I&&x&&Se&&Oe!==B&&S(Oe)},[I,x,Se,Oe,B]);const Ze=f.useMemo(()=>({position:"absolute",top:z.arrow?.y,left:z.arrow?.x}),[z.arrow]),ze=z.arrow?.centerOffset!==0;return f.useMemo(()=>({positionerStyles:At,arrowStyles:Ze,arrowRef:ce,arrowUncentered:ze,side:lt,align:Ee,physicalSide:Oe,anchorHidden:Le,refs:ae,context:re,isPositioned:Se,update:ye}),[At,Ze,ce,ze,lt,Ee,Oe,Le,ae,re,Se,ye])}function uc(e){return e!=null&&"current"in e}function cs(e){return e==="starting"?hg:dt}function Ba(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:a=!1}){const l={...n};return a&&(l.pointerEvents="none"),Me("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:l},cs(r),o],stateAttributesMapping:Lr})}const R0=f.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:a="top",align:l="center",sideOffset:u=0,alignOffset:d=0,collisionBoundary:p="clipping-ancestors",collisionPadding:A=5,arrowPadding:m=5,sticky:h=!1,disableAnchorTracking:g=!1,collisionAvoidance:x=qu,style:b,...v}=t,y=zr(),C=b0(),I=y.useState("open"),w=y.useState("mounted"),E=y.useState("trackCursorAxis"),S=y.useState("disableHoverablePopup"),D=y.useState("floatingRootContext"),k=y.useState("instantType"),j=y.useState("transitionStatus"),N=y.useState("adaptiveOrigin"),T=Fa({anchor:s,positionMethod:i,floatingRootContext:D,mounted:w,side:a,sideOffset:u,align:l,alignOffset:d,collisionBoundary:p,collisionPadding:A,sticky:h,arrowPadding:m,disableAnchorTracking:g,keepMounted:C,collisionAvoidance:x,adaptiveOrigin:N}),F=f.useMemo(()=>({open:I,side:T.side,align:T.align,anchorHidden:T.anchorHidden,instant:E!=="none"?"tracking-cursor":k}),[I,T.side,T.align,T.anchorHidden,E,k]),R=Ba(t,F,{styles:T.positionerStyles,transitionStatus:j,props:v,refs:[n,y.useStateSetter("positionerElement")],hidden:!w,inert:!I||E==="both"||S});return c.jsx(Hd.Provider,{value:T,children:R})}),D0=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=zr(),{side:l,align:u}=Kd(),d=a.useState("open"),p=a.useState("instantType"),A=a.useState("transitionStatus"),m=a.useState("popupProps"),h=a.useState("floatingRootContext"),g=a.useState("disabled"),x=a.useState("closeDelay");Zt({open:d,ref:a.context.popupRef,onComplete(){d&&a.context.onOpenChangeComplete?.(!0)}}),Ed(h,{enabled:!g,closeDelay:x});const b=a.useStateSetter("popupElement");return Me("div",t,{state:{open:d,side:l,align:u,instant:p,transitionStatus:A},ref:[n,a.context.popupRef,b],props:[rs,m,cs(A),i],stateAttributesMapping:sa})}),F0=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=zr(),{arrowRef:l,side:u,align:d,arrowUncentered:p,arrowStyles:A}=Kd(),m=a.useState("open"),h=a.useState("instantType");return Me("div",t,{state:{open:m,side:u,align:d,uncentered:p,instant:h},ref:[n,l],props:[{style:A,"aria-hidden":!0},i],stateAttributesMapping:Lr})});function B0(e){const[t,n]=f.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function us({...e}){return c.jsx(p0,{"data-slot":"tooltip",...e})}function ds({...e}){return c.jsx(x0,{"data-slot":"tooltip-trigger",...e})}function fs({className:e,side:t="top",sideOffset:n=4,align:r="center",alignOffset:o=0,children:s,...i}){return c.jsx(y0,{children:c.jsx(R0,{align:r,alignOffset:o,side:t,sideOffset:n,className:"isolate z-50",children:c.jsxs(D0,{"data-slot":"tooltip-content",className:ge("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...i,children:[s,c.jsx(F0,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const j0="sidebar_state",M0=3600*24*7,N0="16rem",T0="18rem",P0="3rem",_0="b",Ld=f.createContext(null);function ps(){const e=f.useContext(Ld);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function O0({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:o,children:s,...i}){const a=XA(),[l,u]=f.useState(!1),[d,p]=f.useState(e),A=t??d,m=f.useCallback(b=>{const v=typeof b=="function"?b(A):b;n?n(v):p(v),document.cookie=`${j0}=${v}; path=/; max-age=${M0}`},[n,A]),h=f.useCallback(()=>a?u(b=>!b):m(b=>!b),[a,m,u]);f.useEffect(()=>{const b=v=>{v.key===_0&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),h())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[h]);const g=A?"expanded":"collapsed",x=f.useMemo(()=>({state:g,open:A,setOpen:m,isMobile:a,openMobile:l,setOpenMobile:u,toggleSidebar:h}),[g,A,m,a,l,u,h]);return c.jsx(Ld.Provider,{value:x,children:c.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":N0,"--sidebar-width-icon":P0,...o},className:ge("group/sidebar-wrapper flex h-svh w-full has-data-[variant=inset]:bg-sidebar",r),...i,children:s})})}function H0({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:o,dir:s,...i}){const{isMobile:a,state:l,openMobile:u,setOpenMobile:d}=ps();return n==="none"?c.jsx("div",{"data-slot":"sidebar",className:ge("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",r),...i,children:o}):a?c.jsx(n0,{open:u,onOpenChange:d,...i,children:c.jsxs(s0,{dir:s,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":T0},side:e,children:[c.jsxs(i0,{className:"sr-only",children:[c.jsx(a0,{children:"Sidebar"}),c.jsx(l0,{children:"Displays the mobile sidebar."})]}),c.jsx("div",{className:"flex h-full w-full flex-col",children:o})]})}):c.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":l,"data-collapsible":l==="collapsed"?n:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[c.jsx("div",{"data-slot":"sidebar-gap",className:ge("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),c.jsx("div",{"data-slot":"sidebar-container","data-side":e,className:ge("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...i,children:c.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:o})})]})}function K0({className:e,...t}){const{toggleSidebar:n}=ps();return c.jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:n,title:"Toggle Sidebar",className:ge("absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})}function W0({className:e,...t}){return c.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:ge("flex flex-col gap-2 p-2",e),...t})}function L0({className:e,...t}){return c.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:ge("flex flex-col gap-2 p-2",e),...t})}function Q0({className:e,...t}){return c.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:ge("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function G0({className:e,...t}){return c.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:ge("relative flex w-full min-w-0 flex-col p-2",e),...t})}function Y0({className:e,...t}){return c.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:ge("w-full text-sm",e),...t})}function Ks({className:e,...t}){return c.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:ge("flex w-full min-w-0 flex-col gap-0",e),...t})}function io({className:e,...t}){return c.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:ge("group/menu-item relative",e),...t})}const z0=ji("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function kr({render:e,isActive:t=!1,variant:n="default",size:r="default",tooltip:o,className:s,...i}){const{isMobile:a,state:l}=ps(),u=ku({defaultTagName:"button",props:Nt({className:ge(z0({variant:n,size:r}),s)},i),render:o?c.jsx(ds,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:r,active:t}});return o?(typeof o=="string"&&(o={children:o}),c.jsxs(us,{children:[u,c.jsx(fs,{side:"right",align:"center",hidden:l!=="collapsed"||a,...o})]})):u}const Qd=f.createContext(void 0);function Gd(e){const t=f.useContext(Qd);if(t===void 0&&!e)throw new Error(at(33));return t}const Yd=f.createContext(void 0);function ir(e){const t=f.useContext(Yd);if(t===void 0&&!e)throw new Error(at(36));return t}const U0=f.createContext(void 0);function ja(e=!0){const t=f.useContext(U0);if(t===void 0&&!e)throw new Error(at(25));return t}function V0(e){const{closeOnClick:t,highlighted:n,id:r,nodeId:o,store:s,typingRef:i,itemRef:a,itemMetadata:l}=e,{events:u}=s.useState("floatingTreeRoot"),d=s.useState("open"),p=ja(!0),A=p!==void 0;return f.useMemo(()=>({id:r,role:"menuitem",tabIndex:d&&n?0:-1,onKeyDown(m){m.key===" "&&i?.current&&m.preventDefault()},onMouseMove(m){o&&u.emit("itemhover",{nodeId:o,target:m.currentTarget})},onClick(m){t&&u.emit("close",{domEvent:m,reason:Cr})},onMouseUp(m){if(p){const h=p.initialCursorPointRef.current;if(p.initialCursorPointRef.current=null,A&&h&&Math.abs(m.clientX-h.x)<=1&&Math.abs(m.clientY-h.y)<=1||A&&!Ui&&m.button===2)return}a.current&&s.context.allowMouseUpTriggerRef.current&&(!A||m.button===2)&&l.type==="regular-item"&&_i(a.current,m,{detail:1})}}),[t,n,r,u,o,d,s,i,a,p,A,l])}const Z0={type:"regular-item"};function J0(e){const{closeOnClick:t,disabled:n,highlighted:r,id:o,store:s,typingRef:i=s.context.typingRef,nativeButton:a,itemMetadata:l,nodeId:u}=e,d=f.useRef(null),{getButtonProps:p,buttonRef:A}=Vt({disabled:n,focusableWhenDisabled:!0,native:a,composite:!0}),m=V0({closeOnClick:t,highlighted:r,id:o,nodeId:u,store:s,typingRef:i,itemRef:d,itemMetadata:l}),h=f.useCallback(x=>Nt(m,{onMouseEnter(){l.type==="submenu-trigger"&&l.setActive()}},x,p),[m,p,l]),g=Ut(d,A);return f.useMemo(()=>({getItemProps:h,itemRef:g}),[h,g])}const zd=f.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function $0(){return f.useContext(zd)}function hs(e={}){const{guess:t,label:n,metadata:r,textRef:o,index:s}=e,{register:i,unregister:a,subscribeMapChange:l,nextIndexRef:u}=$0(),d=f.useRef(-1),[p,A]=f.useState(s==null&&t?()=>{if(d.current===-1){const x=u.current;u.current+=1,d.current=x}return d.current}:-1),m=s??p,h=f.useRef(null),g=f.useCallback(x=>{const b=h.current;b&&a(b),h.current=x,x&&i(x,{metadata:r??null,index:s??null,label:n,textRef:o})},[s,i,a,r,n,o]);return le(()=>{if(s==null)return l(x=>{const b=h.current?x.get(h.current)?.index:null;b!=null&&A(b)})},[s,l]),{ref:g,index:m}}const X0=f.forwardRef(function(t,n){const{render:r,className:o,id:s,label:i,nativeButton:a=!1,disabled:l=!1,closeOnClick:u=!0,style:d,...p}=t,A=hs({guess:!0,label:i}),m=Gd(!0),h=wt(s),{store:g}=ir(),x=g.useState("disabled"),b=l||x,v=g.useState("isActive",A.index),y=g.useState("itemProps"),{getItemProps:C,itemRef:I}=J0({closeOnClick:u,disabled:b,highlighted:v,id:h,store:g,nativeButton:a,nodeId:m?.context.nodeId,itemMetadata:Z0});return Me("div",t,{state:{disabled:b,highlighted:v},props:[y,p,C],ref:[I,n,A.ref]})}),q0=f.createContext(void 0);function Ma(e){return f.useContext(q0)}const ex=f.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...a}=t,{store:l}=ir(),{side:u,align:d}=Gd(),p=Ma()!=null,A=l.useState("open"),m=l.useState("transitionStatus"),h=l.useState("popupProps"),g=l.useState("mounted"),x=l.useState("instantType"),b=l.useState("activeTriggerElement"),v=l.useState("parent"),y=l.useState("lastOpenChangeReason"),C=l.useState("rootId"),I=l.useState("floatingRootContext"),w=l.useState("floatingTreeRoot"),E=l.useState("closeDelay"),S=l.useState("hoverEnabled"),D=l.useState("disabled"),k=l.useState("openMethod"),j=v.type==="context-menu";Zt({open:A,ref:l.context.popupRef,onComplete(){A&&l.context.onOpenChangeComplete?.(!0)}}),f.useEffect(()=>{function O(_){l.setOpen(!1,Ce(_.reason,_.domEvent))}return w.events.on("close",O),()=>{w.events.off("close",O)}},[w.events,l]),Ed(I,{enabled:S&&!D&&!j&&v.type!=="menubar",closeDelay:E});const N=l.useStateSetter("popupElement"),T={transitionStatus:m,side:u,align:d,open:A,nested:v.type==="menu",instant:x},F=Me("div",t,{state:T,ref:[n,l.context.popupRef,N],stateAttributesMapping:sa,props:[h,{onKeyDown(O){p&&ss.has(O.key)&&O.stopPropagation()}},cs(m),a,{"data-rootownerid":C}]});let R=v.type===void 0||j;return(b||v.type==="menubar"&&y!==Lo)&&(R=!0),c.jsx(fa,{context:I,openInteractionType:k,modal:j,disabled:!g,returnFocus:i===void 0?R:i,initialFocus:v.type!=="menu",restoreFocus:!0,externalTree:v.type!=="menubar"?w:void 0,previousFocusableElement:b,nextFocusableElement:v.type===void 0?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:v.type===void 0?l.context.beforeContentFocusGuardRef:void 0,children:F})}),Ud=f.createContext(void 0);function tx(){const e=f.useContext(Ud);if(e===void 0)throw new Error(at(32));return e}const nx=f.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=ir();return s.useState("mounted")||r?c.jsx(Ud.Provider,{value:r,children:c.jsx(ca,{ref:n,...o})}):null});function Ur(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=ue(o),[,i]=f.useState(!1),a=Ft(ox).current,l=Ft(rx).current,u=f.useRef(0),d=f.useRef(!0),p=f.useRef([]),A=f.useRef(null),m=ue(()=>{d.current||(d.current=!0,i(I=>!I))}),h=ue((I,w)=>{l.set(I,w),m()}),g=ue(I=>{l.delete(I),m()}),x=ue(I=>{const w=new Map;return n.current.length=0,r&&(r.current.length=0),I.forEach(E=>{w.set(E.element,{...E.registration.metadata??{},index:E.index}),n.current[E.index]=E.element,r&&(r.current[E.index]=E.registration.label!==void 0?E.registration.label:E.registration.textRef?.current?.textContent??E.element.textContent)}),u.current=n.current.length,w});function b(I){if(A.current?.disconnect(),A.current=null,typeof MutationObserver!="function"||I.length<2)return;const w=new MutationObserver(S=>{if(!ax(S))return;let D=null;for(const k of I)if(k.isConnected){if(D&&Vd(D,k)>0){w.disconnect(),m();return}D=k}});A.current=w;const E=new Set;for(let S=1;S<I.length;S+=1){const D=ix(I[S-1],I[S]);D&&E.add(D)}E.forEach(S=>w.observe(S,{childList:!0}))}const v=ue(()=>{const[I,w]=sx(l),E=x(I);b(w),p.current=I,d.current=!1,a.forEach(S=>S(E)),s(E)});le(()=>(d.current||x(p.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,x]),le(()=>{d.current&&v()}),le(()=>()=>{A.current?.disconnect(),d.current=!0},[]);const y=ue(I=>(a.add(I),()=>{a.delete(I)})),C=f.useMemo(()=>({register:h,unregister:g,subscribeMapChange:y,nextIndexRef:u}),[h,g,y,u]);return c.jsx(zd.Provider,{value:C,children:t})}function rx(){return new Map}function ox(){return new Set}function sx(e){const t=new Set,n=[],r=[];e.forEach((s,i)=>{if(!i.isConnected)return;const a=s.index,l={index:a??-1,element:i,registration:s};a===null?r.push(l):a>=0&&(t.add(a),n.push(l))});let o=0;return r.sort((s,i)=>Vd(s.element,i.element)),r.forEach(s=>{for(;t.has(o);)o+=1;s.index=o,n.push(s),o+=1}),t.size>0&&n.sort((s,i)=>s.index-i.index),[n,r.map(s=>s.element)]}function ix(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function ax(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 Vd(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const lx=20;function Zd(e,t,n,r){const[o,s]=f.useState(!1);le(()=>{if(!e||!t||n==null){s(!1);return}const i=je(n).documentElement.clientWidth,a=n.offsetWidth;s(i>0&&a>0&&a>=i-lx)},[e,t,n]),jd(e&&(!t||o),r)}const cx=f.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:a,align:l,sideOffset:u=0,alignOffset:d=0,collisionBoundary:p="clipping-ancestors",collisionPadding:A=5,arrowPadding:m=5,sticky:h=!1,disableAnchorTracking:g=!1,collisionAvoidance:x=Xu,style:b,...v}=t,{store:y}=ir(),C=tx(),I=ja(!0),w=y.useState("parent"),E=y.useState("floatingRootContext"),S=y.useState("floatingTreeRoot"),D=y.useState("mounted"),k=y.useState("open"),j=y.useState("modal"),N=y.useState("openMethod"),T=y.useState("activeTriggerElement"),F=y.useState("transitionStatus"),R=y.useState("positionerElement"),O=y.useState("instantType"),_=y.useState("adaptiveOrigin"),M=y.useState("lastOpenChangeReason"),H=y.useState("floatingNodeId"),G=y.useState("floatingParentNodeId"),B=E.useState("domReferenceElement"),P=f.useRef(null),W=oa(R);let Y=r,Z=u,Q=d,J=l,K=x;w.type==="context-menu"&&(Y=r??w.context?.anchor,J=J??"start",!a&&J!=="center"&&(Q=t.alignOffset??2,Z=t.sideOffset??-5));let ee=a,ce=J;w.type==="menu"?(ee=ee??"inline-end",ce=ce??"start",K=t.collisionAvoidance??qu):w.type==="menubar"&&(ee=ee??(w.context.orientation==="vertical"?"inline-end":"bottom"),ce=ce??"start");const te=w.type==="context-menu",$=Fa({anchor:Y,floatingRootContext:E,positionMethod:I?"fixed":o,mounted:D,side:ee,sideOffset:Z,align:ce,alignOffset:Q,arrowPadding:te?0:m,collisionBoundary:p,collisionPadding:A,sticky:h,nodeId:H,keepMounted:C,disableAnchorTracking:g,collisionAvoidance:K,shift:te?{crossAxis:!("side"in K&&K.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:S,adaptiveOrigin:_});f.useEffect(()=>{function se(ae){ae.open&&(ae.parentNodeId===H&&y.set("hoverEnabled",!1),ae.nodeId!==H&&ae.parentNodeId===y.select("floatingParentNodeId")&&y.setOpen(!1,Ce(xr)))}return S.events.on("menuopenchange",se),()=>{S.events.off("menuopenchange",se)}},[y,S.events,H]),f.useEffect(()=>{if(y.select("floatingParentNodeId")==null)return;function se(ae){if(ae.open||ae.nodeId!==y.select("floatingParentNodeId"))return;const xe=ae.reason??xr;y.setOpen(!1,Ce(xe))}return S.events.on("menuopenchange",se),()=>{S.events.off("menuopenchange",se)}},[S.events,y]);const X=ht();f.useEffect(()=>{k||X.clear()},[k,X]),f.useEffect(()=>{function se(ae){if(!(!k||ae.nodeId!==y.select("floatingParentNodeId")))if(ae.target&&T&&T!==ae.target){const xe=y.select("closeDelay");xe>0?X.isStarted()||X.start(xe,()=>{y.setOpen(!1,Ce(xr))}):y.setOpen(!1,Ce(xr))}else X.clear()}return S.events.on("itemhover",se),()=>{S.events.off("itemhover",se)}},[S.events,k,T,y,X]),f.useEffect(()=>{const se={open:k,nodeId:H,parentNodeId:G,reason:y.select("lastOpenChangeReason")};S.events.emit("menuopenchange",se)},[S.events,k,y,H,G]),le(()=>{const se=B,ae=P.current;if(se&&(P.current=se),ae&&se&&se!==ae){y.set("instantType",void 0);const xe=new AbortController;return W(()=>{y.set("instantType","trigger-change")},xe.signal),()=>{xe.abort()}}},[B,W,y]);const ne={open:k,side:$.side,align:$.align,anchorHidden:$.anchorHidden,nested:w.type==="menu",instant:O},de=w.type==="menubar"&&w.context.modal;Zd(k&&(de||j&&M!==ct),N==="touch",R,T);const ie=Ba(t,ne,{styles:$.positionerStyles,transitionStatus:F,props:v,refs:[n,y.useStateSetter("positionerElement")],hidden:!D,inert:!k}),he=D&&w.type!=="menu"&&(w.type!=="menubar"&&j&&M!==ct||w.type==="menubar"&&w.context.modal);let oe=null;return w.type==="menubar"?oe=w.context.contentElement:w.type===void 0&&(oe=T),c.jsxs(Qd.Provider,{value:$,children:[he&&c.jsx(Sa,{ref:w.type==="context-menu"||w.type==="nested-context-menu"?w.context.internalBackdropRef:null,inert:Ea(!k),cutout:oe}),c.jsx(xg,{id:H,children:c.jsx(Ur,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,children:ie})})]})}),ux=f.createContext(null);function Jd(e){return f.useContext(ux)}const dx={...Ca,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 fx extends Gr{constructor(t){super({...hx(),...t},px(),dx),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){let r=n.store.select("rootId"),o=n.store.select("floatingTreeRoot"),s=n.store.select("keyboardEventRelay");this.unsubscribeParentListener=n.store.subscribe(()=>{const i=n.store.select("rootId"),a=n.store.select("floatingTreeRoot"),l=n.store.select("keyboardEventRelay");r===i&&o===a&&s===l||(r=i,o=a,s=l,this.notifyAll())}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}unsubscribeParentListener=null}function px(){return{positionerRef:f.createRef(),popupRef:f.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:f.createRef(),beforeContentFocusGuardRef:f.createRef(),onOpenChangeComplete:void 0,triggerElements:new Yr}}function hx(){return{...va(),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 ua,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:dt,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}const Ax=f.createContext(void 0);function gx(){return f.useContext(Ax)}const mx=ha(function(t){const{children:n,open:r,onOpenChange:o,onOpenChangeComplete:s,defaultOpen:i=!1,disabled:a=!1,modal:l,loopFocus:u=!0,orientation:d="vertical",actionsRef:p,closeParentOnEsc:A=!1,handle:m,triggerId:h,defaultTriggerId:g=null,highlightItemOnHover:x=!0}=t,b=ja(!0),v=ir(!0),y=Jd(!0),C=gx(),I=f.useMemo(()=>C&&v?{type:"menu",store:v.store}:y?{type:"menubar",context:y}:b&&!v?{type:"context-menu",context:b}:{type:void 0},[b,v,y,C]),w=xx({open:i,openProp:r,activeTriggerId:g,triggerIdProp:h,parent:I});w.useControlledProp("openProp",r),w.useControlledProp("triggerIdProp",h),w.useContextCallback("onOpenChangeComplete",s);const E=Jn(),S=Jn(),D=w.useState("floatingTreeRoot"),k=id(D),j=wn(),N=w.useState("open"),T=w.useState("activeTriggerElement"),F=w.useState("positionerElement"),R=w.useState("hoverEnabled"),O=w.useState("disabled"),_=w.useState("lastOpenChangeReason"),M=w.useState("parent"),H=w.useState("activeIndex"),G=w.useState("payload"),B=w.useState("floatingParentNodeId"),P=f.useRef(null),W=f.useRef(M.type!=="context-menu"),Y=ht(),Z=f.useRef(!0),Q=ht(),J=B!=null,{openMethod:K,triggerProps:ee}=Td(N);w.useSyncedValues({disabled:a,highlightItemOnHover:x,modal:M.type===void 0?l:void 0,openMethod:K,rootId:E}),ma(w);const{forceUnmount:ce}=xa(N,w,()=>{w.set("allowMouseEnter",!1)});le(()=>{b&&!v?w.update({parent:{type:"context-menu",context:b},floatingNodeId:k,floatingParentNodeId:j}):v&&w.update({floatingNodeId:k,floatingParentNodeId:j})},[b,v,k,j,w]),f.useEffect(()=>{if(N||(P.current=null),M.type==="context-menu"){if(!N){Y.clear(),W.current=!1;return}Y.start(500,()=>{W.current=!0})}},[Y,N,M.type]),le(()=>{!N&&!R&&w.set("hoverEnabled",!0)},[N,R,w]);const te=ue((re,Se)=>{const ke=Se.reason;if(!re&&!w.select("open")||N===re&&Se.trigger===T&&_===ke)return;const We=bd(Se);if(!re&&Se.trigger==null&&(Se.trigger=T??void 0),o?.(re,Se),Se.isCanceled)return;w.state.floatingRootContext.dispatchOpenChange(re,Se);const rt=Se.event;if(re===!1&&rt?.type==="click"&&rt.pointerType==="touch"&&!Z.current)return;re&&ke===Yn?(Z.current=!1,Q.start(300,()=>{Z.current=!0})):(Z.current=!0,Q.clear());const Ge=(ke===Tn||ke===Cr)&&rt.detail===0,At=!re&&(ke===Qo||ke==null),$e={open:re,openChangeReason:ke};P.current=Se.event,ga($e,re,Se.trigger,We()),w.update($e),M.type==="menubar"&&(ke===Yn||ke===jn||ke===ct||ke===oi||ke===xr)?w.set("instantType","group"):Ge||At?w.set("instantType",Ge?"click":"dismiss"):w.set("instantType",void 0)}),$=md({popupStore:w,floatingId:S,nested:j!=null,onOpenChange:te}),X=$.context.events;le(()=>{const re=({open:Se,eventDetails:ke})=>te(Se,ke);return X.on("setOpen",re),()=>{X?.off("setOpen",re)}},[X,te]);const ne=f.useCallback(()=>{w.setOpen(!1,Ce(Pi))},[w]);f.useImperativeHandle(p,()=>({unmount:ce,close:ne}),[ce,ne]);let de;M.type==="context-menu"&&(de=M.context),f.useImperativeHandle(de?.positionerRef,()=>F,[F]),f.useImperativeHandle(de?.actionsRef,()=>({setOpen:te}),[te]);const fe=es($,{enabled:!O,bubbles:{escapeKey:A&&M.type==="menu"},outsidePress(){return M.type!=="context-menu"||P.current?.type==="contextmenu"?!0:W.current},externalTree:J?D:void 0}),ie=ls(),he=f.useCallback(re=>{w.select("activeIndex")!==re&&w.set("activeIndex",re)},[w]),oe=Rd($,{enabled:!O,listRef:w.context.itemDomElements,activeIndex:H,nested:M.type!==void 0,loopFocus:u,orientation:d,parentOrientation:M.type==="menubar"?M.context.orientation:void 0,rtl:ie==="rtl",disabledIndices:Ht,onNavigate:he,openOnArrowKeyDown:M.type!=="context-menu",externalTree:J?D:void 0,focusItemOnHover:x}),se=f.useCallback(re=>{w.context.typingRef.current=re},[w]),ae=Dd($,{enabled:!O,listRef:w.context.itemLabels,elementsRef:w.context.itemDomElements,activeIndex:H,resetMs:fg,onMatch:re=>{N&&re!==H&&w.set("activeIndex",re)},onTyping:se}),xe=f.useMemo(()=>{const re=Nt(ae.reference,oe.reference,fe.reference,{onMouseMove(){w.set("allowMouseEnter",!0)}},ee);return re["aria-haspopup"]="menu",re["aria-expanded"]=N,re},[w,ae.reference,oe.reference,fe.reference,ee,N]),me=f.useMemo(()=>{const re=Nt(oe.trigger,fe.trigger,ee);return re["aria-haspopup"]="menu",re["aria-expanded"]=!1,re},[oe.trigger,fe.trigger,ee]),L=f.useMemo(()=>Nt(rs,{id:S,role:"menu","aria-labelledby":T?.id,onMouseMove(){w.set("allowMouseEnter",!0),M.type==="menu"&&w.set("hoverEnabled",!1)},onClick(){w.select("hoverEnabled")&&w.set("hoverEnabled",!1)},onKeyDown(re){const Se=w.select("keyboardEventRelay");Se&&!re.isPropagationStopped()&&Se(re)}},ae.floating,oe.floating,fe.floating),[T,S,M.type,w,ae.floating,oe.floating,fe.floating]),z=oe.item??dt;ba(w,{floatingRootContext:$,activeTriggerProps:xe,inactiveTriggerProps:me,popupProps:L,itemProps:z});const ye=f.useMemo(()=>({store:w,parent:I}),[w,I]),q=c.jsxs(Yd.Provider,{value:ye,children:[m&&c.jsx(Aa,{handle:m,store:w}),typeof n=="function"?n({payload:G}):n]});return M.type===void 0||M.type==="context-menu"?c.jsx(bg,{externalTree:D,children:q}):q});function xx(e){return Ft(()=>new fx(e)).current}const ao=5;function $d(e,t){const n=bx(t);return e.clientX>=n.left-ao&&e.clientX<=n.right+ao&&e.clientY>=n.top-ao&&e.clientY<=n.bottom+ao}function bx(e){const t=e.getBoundingClientRect(),n=it(e);if(Vi)return t;const r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const i=parseFloat(r.width)||0,a=parseFloat(r.height)||0,l=parseFloat(o.width)||0,u=parseFloat(o.height)||0,d=Math.max(t.width,i,l),p=Math.max(t.height,a,u),A=d-t.width,m=p-t.height;return{left:t.left-A/2,right:t.right+A/2,top:t.top-m/2,bottom:t.bottom+m/2}}function Xd(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Oi(),{ref:o,index:s}=hs(e),i=n===s,a=f.useRef(null),l=Ut(o,a);return{compositeProps:{tabIndex:i?0:-1,onFocus(){r(s)},onMouseMove(){const d=a.current;if(!t||!d)return;const p=d.hasAttribute("disabled")||d.ariaDisabled==="true";!i&&!p&&d.focus()}},compositeRef:l,index:s}}function qd(e){const{render:t,className:n,style:r,state:o=dt,props:s=Ht,refs:i=Ht,metadata:a,stateAttributesMapping:l,tag:u="div",...d}=e,{compositeProps:p,compositeRef:A}=Xd({metadata:a});return Me(u,e,{state:o,ref:[A,...i],props:[p,...s,d],stateAttributesMapping:l})}function ef(e){if(Xe(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!Fn(e))return ef($n(e))}function vx(e,t){const n=f.useRef(null);function r(s){cn.flushSync(()=>{e.setOpen(!1,Ce(jn,s.nativeEvent,s.currentTarget))}),WA(n.current)?.focus()}function o(s){const i=e.select("positionerElement");if(i&&zn(s,i))e.context.beforeContentFocusGuardRef.current?.focus();else{cn.flushSync(()=>{e.setOpen(!1,Ce(jn,s.nativeEvent,s.currentTarget))});let a=KA(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&ve(i,a);){const l=a;if(a=na(a),a===l)break}a?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:o}}function yx(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,o=f.useRef(!1);return f.useMemo(()=>t?{onMouseDown:s=>{(n==="open"&&!r||n==="close"&&r)&&(o.current=!0,je(s.currentTarget).addEventListener("click",()=>{o.current=!1},{once:!0}))},onClick:s=>{o.current&&(o.current=!1,s.preventBaseUIHandler())}}:dt,[t,n,r])}const Cx=gd(function(t,n){const{render:r,className:o,style:s,disabled:i=!1,nativeButton:a=!0,id:l,openOnHover:u,delay:d=100,closeDelay:p=0,handle:A,payload:m,...h}=t,g=ir(!0),b=Id(A)??g?.store;if(!b)throw new Error(at(85));const v=wt(l),y=b.useState("isTriggerActive",v),C=b.useState("floatingRootContext"),I=b.useState("isOpenedByTrigger",v),w=b.useState("triggerPopupId",v),E=f.useRef(null),S=wx(),D=Oi(!0),k=kn(),j=f.useMemo(()=>k??new ua,[k]),N=id(j),T=wn(),{registerTrigger:F,isMountedByThisTrigger:R}=vd(v,E,b,{payload:m,closeDelay:p,parent:S,floatingTreeRoot:j,floatingNodeId:N,floatingParentNodeId:T,keyboardEventRelay:D?.relayKeyboardEvent}),O=S.type==="menubar",_=b.useState("disabled"),M=i||_||O&&S.context.disabled,{getButtonProps:H,buttonRef:G}=Vt({disabled:M,native:a});f.useEffect(()=>{!I&&S.type===void 0&&(b.context.allowMouseUpTriggerRef.current=!1)},[b,I,S.type]);const B=f.useRef(null),P=ht(),W=ue(se=>{if(!B.current)return;P.clear(),b.context.allowMouseUpTriggerRef.current=!1;const ae=se.target;ve(B.current,ae)||ve(b.select("positionerElement"),ae)||ae===B.current||ae!=null&&ef(ae)===b.select("rootId")||$d(se,B.current)||j.events.emit("close",{domEvent:se,reason:wu})});f.useEffect(()=>{I&&b.select("lastOpenChangeReason")===ct&&je(B.current).addEventListener("mouseup",W,{once:!0})},[I,W,b]);const Y=O&&S.context.hasSubmenuOpen,Q=Sd(C,{enabled:(u??Y)&&!M&&(!O||Y&&!R),handleClose:Fd({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?d:void 0,delay:{close:p},triggerElementRef:E,externalTree:j,isActiveTrigger:y,isClosing:()=>b.select("transitionStatus")==="ending"}),J=Ix(I,b.select("lastOpenChangeReason")),K=ad(C,{enabled:!M,event:I&&O?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0?J:!1}),ee=wd(C,{enabled:!M&&Y}),ce=yx({open:I,enabled:O,mouseDownAction:"open"}),te=f.useMemo(()=>Nt(ee.reference,K.reference),[ee.reference,K.reference]),$=b.useState("triggerProps",R),{preFocusGuardRef:X,handlePreFocusGuardFocus:ne,handleFocusTargetFocus:de}=vx(b,E),fe={disabled:M,open:I},ie=[B,n,G,F,E],he=[te,Q??dt,$,{"aria-haspopup":"menu","aria-controls":w,id:v,onMouseDown:se=>{if(b.select("open"))return;P.start(200,()=>{b.context.allowMouseUpTriggerRef.current=!0}),je(se.currentTarget).addEventListener("mouseup",W,{once:!0})}},O?{role:"menuitem"}:{},ce,h,H],oe=Me("button",t,{enabled:!O,stateAttributesMapping:fi,state:fe,ref:ie,props:he});return O?c.jsx(qd,{tag:"button",render:r,className:o,style:s,state:fe,refs:ie,props:he,stateAttributesMapping:fi}):I?c.jsxs(f.Fragment,{children:[c.jsx(tr,{ref:X,onFocus:ne},`${v}-pre-focus-guard`),c.jsx(f.Fragment,{children:oe},v),c.jsx(tr,{ref:b.context.triggerFocusTargetRef,onFocus:de},`${v}-post-focus-guard`)]}):c.jsx(f.Fragment,{children:oe},v)});function Ix(e,t){const n=ht(),[r,o]=f.useState(!1);return le(()=>{e&&t===ct?(o(!0),n.start(pg,()=>{o(!1)})):e||(n.clear(),o(!1))},[e,t,n]),r}function wx(){const e=Jd();return f.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}function tf(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function jo({...e}){return c.jsx(mx,{"data-slot":"dropdown-menu",...e})}function Mo({...e}){return c.jsx(Cx,{"data-slot":"dropdown-menu-trigger",...e})}function No({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:o,...s}){return c.jsx(nx,{children:c.jsx(cx,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:c.jsx(ex,{"data-slot":"dropdown-menu-content",className:ge("cn-menu-target cn-menu-translucent z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",o),...s})})})}function To({className:e,inset:t,variant:n="default",...r}){return c.jsx(X0,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:ge("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}const nf=f.createContext(void 0),rf=()=>{const[e]=zu(),t=f.useMemo(()=>new URLSearchParams(e.split("?")[1]??""),[e]),n=(e.split("?")[0]??"/add").replace(/^\/?/u,"");return{route:n==="applications"||n==="help"?n:"add",query:t}},of=()=>{const e=f.useContext(nf);if(e===void 0)throw new Error("useWorkbenchNavigation must be used inside WorkbenchShell");return e},kx=({product:e})=>{const{messages:t}=mt(),{state:n,toggleSidebar:r}=ps(),o=n==="collapsed",s=`${e} · ${o?t.shell.expand:t.shell.collapse}`;return o?c.jsx(kr,{size:"lg",className:"group/brand relative justify-center",children:c.jsxs("span",{className:"relative grid size-8 shrink-0 place-items-center",children:[c.jsx("img",{src:"/logo.png",alt:e,width:24,height:24,className:"size-6 rounded-md transition-opacity group-hover/brand:opacity-0 focus-visible-within:opacity-0"}),c.jsx("button",{type:"button",onClick:r,"aria-label":s,title:s,className:"absolute inset-0 grid place-items-center rounded-md opacity-0 transition-opacity hover:bg-sidebar-accent focus-visible:opacity-100 group-hover/brand:opacity-100",children:c.jsx(Cl,{"aria-hidden":!0,className:"size-4"})})]})}):c.jsxs(kr,{size:"lg",className:"justify-start pr-1",children:[c.jsx("img",{src:"/logo.png",alt:e,width:24,height:24,className:"size-6 shrink-0 rounded-md"}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:e}),c.jsx("button",{type:"button",onClick:r,"aria-label":s,title:s,className:"grid size-6 shrink-0 place-items-center rounded-md hover:bg-sidebar-accent",children:c.jsx(Cl,{"aria-hidden":!0,className:"size-4"})})]})},Ex=({children:e,panelOpen:t})=>{const{locale:n,messages:r,setLocale:o,theme:s,setTheme:i}=mt(),{route:a}=rf(),l=f.useCallback(g=>{window.location.hash=`#/${g}`},[]),[u,d]=f.useState(()=>window.innerWidth>=768),p=t===!0;f.useEffect(()=>{const g=window.matchMedia("(min-width: 768px)"),x=()=>{d(g.matches&&!p)};return x(),g.addEventListener("change",x),()=>g.removeEventListener("change",x)},[p]);const A=f.useMemo(()=>({route:a,navigate:l}),[a,l]),m=[{route:"add",icon:c.jsx(Ru,{"aria-hidden":!0}),label:r.nav.add},{route:"applications",icon:c.jsx(_h,{"aria-hidden":!0}),label:r.nav.applications},{route:"help",icon:c.jsx(Ch,{"aria-hidden":!0}),label:r.nav.help}],h=s==="system"?r.theme.system:s==="light"?r.theme.light:r.theme.dark;return c.jsx(nf.Provider,{value:A,children:c.jsxs(O0,{open:u,onOpenChange:d,children:[c.jsxs(H0,{collapsible:"icon",children:[c.jsx(W0,{children:c.jsx(Ks,{children:c.jsx(io,{children:c.jsx(kx,{product:r.shell.product})})})}),c.jsx(Q0,{children:c.jsx(G0,{children:c.jsx(Y0,{children:c.jsx(Ks,{children:m.map(g=>c.jsx(io,{children:c.jsxs(us,{children:[c.jsxs(ds,{render:c.jsx(kr,{isActive:a===g.route,tooltip:g.label,"aria-label":g.label,onClick:()=>{l(g.route)}}),children:[g.icon,c.jsx("span",{children:g.label})]}),c.jsx(fs,{side:"right",children:g.label})]})},g.route))})})})}),c.jsx(L0,{children:c.jsxs(Ks,{children:[c.jsx(io,{children:c.jsxs(jo,{children:[c.jsx(Mo,{render:c.jsxs(kr,{tooltip:r.language.title,"aria-label":r.language.title,children:[c.jsx("span",{"aria-hidden":!0,className:"text-xs font-semibold",children:Kp[n]}),c.jsx("span",{children:r.language.title})]})}),c.jsx(No,{side:"top",align:"start",children:Wp.map(g=>c.jsx(To,{onClick:()=>{o(g)},children:Lp(g)},g))})]})}),c.jsx(io,{children:c.jsxs(jo,{children:[c.jsx(Mo,{render:c.jsxs(kr,{tooltip:`${r.theme.title}: ${h}`,"aria-label":`${r.theme.title}: ${h}`,children:[s==="light"?c.jsx(iA,{"aria-hidden":!0}):s==="dark"?c.jsx(Yh,{"aria-hidden":!0}):c.jsx(Qh,{"aria-hidden":!0}),c.jsx("span",{children:h})]})}),c.jsx(No,{side:"top",align:"start",children:[["system",r.theme.system],["light",r.theme.light],["dark",r.theme.dark]].map(([g,x])=>c.jsx(To,{onClick:()=>{i(g)},children:x},g))})]})})]})}),c.jsx(K0,{"aria-label":r.shell.toggleSidebar})]}),c.jsx("main",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:e})]})})};function Sx(e){if(!e)return null;for(const t of e.elements){const n=t.tagName;if(n==="BUTTON"||n==="INPUT"){const r=t;if(r.type==="submit")return r}}return null}function sf(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":""}:{"data-unchecked":""}},...Hi}}const Rx=f.createContext(void 0);function Dx(){return f.useContext(Rx)}const af=f.createContext(void 0);function Fx(){const e=f.useContext(af);if(e===void 0)throw new Error(at(14));return e}const Bx="data-parent",jx=f.forwardRef(function(t,n){const{checked:r,className:o,defaultChecked:s=!1,"aria-labelledby":i,disabled:a=!1,form:l,id:u,indeterminate:d=!1,inputRef:p,name:A,onCheckedChange:m,parent:h=!1,readOnly:g=!1,render:x,required:b=!1,uncheckedValue:v,value:y,nativeButton:C=!1,style:I,...w}=t,{clearErrors:E}=Ki(),{disabled:S,name:D,setDirty:k,setFilled:j,setFocused:N,setTouched:T,state:F,validationMode:R,validityData:O,validation:_}=Yo(),M=GA(),{labelId:H,controlId:G,registerControlId:B,getDescriptionProps:P}=Wi(),W=Dx(),Y=W?.allValues===void 0?void 0:W.parent,Z=Y!==void 0,Q=S||M.disabled||W?.disabled||a,J=D??A,K=y??J,ee=wt(),ce=wt();let te=u||G;Z&&(h?te=ce:K!==void 0?te=`${Y.id}-${K}`:te||=ce);let $={};Z&&(h?$=Y.getParentProps():K!==void 0&&($=Y.getChildProps(K)));const{checked:X=r,indeterminate:ne=d,onCheckedChange:de,...fe}=$,ie=W?.value,he=f.useRef(null),oe=Ft(()=>Symbol()),se=f.useRef(!1),{getButtonProps:ae,buttonRef:xe}=Vt({disabled:Q,native:C}),me=W?.validation??_,[L,z]=ln({controlled:K!==void 0&&ie!==void 0&&!h?ie.includes(K):X,default:s,name:"Checkbox",state:"checked"}),ye=Z?!!X:L,q=Z&&ne||d;le(()=>{B!==Er&&(se.current=!0,B(oe.current,te))},[te,B,oe]),f.useEffect(()=>{const Ee=oe.current;return()=>{!se.current||B===Er||(se.current=!1,B(Ee,void 0))}},[B,oe]),Li(he,ee,L,void 0,!W&&!Q,A);const re=f.useRef(null),Se=me.registerInput,ke=W?K:void 0,We=f.useCallback(Ee=>Se(Ee,{controlRef:he,value:ke}),[Se,ke]),rt=Ut(p,re,h?void 0:We),Ge=Fu(i,H,re,!C,te??void 0);le(()=>{re.current&&(re.current.indeterminate=q,L&&j(!0))},[L,q,j]),as(L,()=>{W||(E(J),j(L),k(L!==O.initialValue),me.change(L))});const At=Nt({checked:L,disabled:Q,form:l,name:h?void 0:J,id:C?void 0:te??void 0,required:b,ref:rt,style:J?la:qo,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Ee){if(Ee.nativeEvent.defaultPrevented)return;if(g){Ee.preventDefault();return}const Le=Ee.currentTarget.checked,Ze=Ce(Pt,Ee.nativeEvent);if(m?.(Le,Ze),!Ze.isCanceled&&(de?.(Le,Ze),!Ze.isCanceled&&(z(Le),K!==void 0&&W!==void 0&&!h&&!Z))){const ze=Le?[...W.value,K]:W.value.filter(Re=>Re!==K);W.setValue(ze,Ze)}},onClick(Ee){Ee.stopPropagation()},onFocus(){he.current?.focus()}},y!==void 0?{value:(W?L&&y:y)||""}:dt,P,Ee=>me.getValidationProps(Q,Ee));f.useEffect(()=>{if(!Y||K===void 0)return;const Ee=Y.disabledStatesRef.current;return Ee.set(K,Q),()=>{Ee.delete(K)}},[Y,Q,K]);const $e=f.useMemo(()=>({...F,checked:ye,disabled:Q,readOnly:g,required:b,indeterminate:q}),[F,ye,Q,g,b,q]),Oe=sf($e),lt=Me("span",t,{state:$e,ref:[xe,he,n],props:[{id:C?te??void 0:ee,role:"checkbox","aria-checked":q?"mixed":ye,"aria-readonly":g||void 0,"aria-required":b||void 0,"aria-labelledby":Ge,[Bx]:h?"":void 0,onFocus(){Q||N(!0)},onBlur(){const Ee=re.current;Ee&&(T(!0),N(!1),R==="onBlur"&&me.commit(W?ie:Ee.checked))},onKeyDown(Ee){if(Ee.key!=="Enter"||(Ee.preventBaseUIHandler(),Ee.defaultPrevented))return;const Le=re.current?.form??null,Ze=Ee.currentTarget,ze=Ee.nativeEvent,Re=Ee.preventDefault,Pe=ze.preventDefault;let Je=!1;Ee.preventDefault=()=>{Je=!0,Re.call(Ee)},ze.preventDefault=()=>{Je=!0,Pe.call(ze)},Pe.call(ze),it(Ze).queueMicrotask(()=>{Ee.preventDefault=Re,ze.preventDefault=Pe,Je||Sx(Le)?.click()})},onClick(Ee){if(g||Q)return;Ee.preventDefault();const Le=re.current;Le&&_i(Le,Ee)}},w,fe,ae,P,Ee=>me.getValidationProps(Q,Ee)],stateAttributesMapping:Oe});return c.jsxs(af.Provider,{value:$e,children:[lt,!L&&!W&&J&&!h&&v!==void 0&&c.jsx("input",{type:"hidden",form:l,name:J,value:v,disabled:Q}),c.jsx("input",{...At,suppressHydrationWarning:!0})]})}),Mx=f.forwardRef(function(t,n){const{render:r,className:o,style:s,keepMounted:i=!1,...a}=t,l=Fx(),u=l.checked||l.indeterminate,{mounted:d,transitionStatus:p,setMounted:A}=sr(u),m=f.useRef(null),h={...l,transitionStatus:p};Zt({open:u,ref:m,onComplete(){u||A(!1)}});const x={...sf(l),..._n},b=i||d,v=Me("span",t,{ref:[n,m],state:h,stateAttributesMapping:x,props:a});return b?v:null});function Ci({className:e,...t}){return c.jsx(jx,{"data-slot":"checkbox",className:ge("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",e),...t,children:c.jsx(Mx,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:c.jsx(Gi,{})})})}function Ne({className:e,...t}){return c.jsx("label",{"data-slot":"label",className:ge("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}const lf=f.createContext(void 0);function cf(){const e=f.useContext(lf);if(e===void 0)throw new Error(at(10));return e}const Nx={value:()=>null},Tx=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,hiddenUntilFound:i,keepMounted:a,loopFocus:l,onValueChange:u,multiple:d=!1,orientation:p="vertical",value:A,defaultValue:m,style:h,...g}=t,x=f.useMemo(()=>{if(A===void 0)return m??[]},[A,m]),b=f.useRef([]),[v,y]=ln({controlled:A,default:x,name:"Accordion",state:"value"}),C=ue((S,D,k)=>{if(d)if(D){const j=v.slice();if(j.push(S),u?.(j,k),k.isCanceled)return;y(j)}else{const j=v.filter(N=>N!==S);if(u?.(j,k),k.isCanceled)return;y(j)}else{const j=v[0]===S?[]:[S];if(u?.(j,k),k.isCanceled)return;y(j)}}),I=f.useMemo(()=>({value:v,disabled:s,orientation:p}),[v,s,p]),w=f.useMemo(()=>({disabled:s,handleValueChange:C,hiddenUntilFound:i??!1,keepMounted:a??!1,state:I,value:v}),[s,C,i,a,I,v]),E=Me("div",t,{state:I,ref:n,props:g,stateAttributesMapping:Nx});return c.jsx(lf.Provider,{value:w,children:c.jsx(Ur,{elementsRef:b,children:E})})});function Px(e){const{open:t,defaultOpen:n,onOpenChange:r,disabled:o}=e,[s,i]=ln({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:a,setMounted:l,transitionStatus:u}=sr(s,!0,!0),d=wt(),[p,A]=f.useState(),m=p===null?void 0:p??d,h=ue(g=>{const x=!s,b=Ce(Tn,g.nativeEvent);r(x,b),!b.isCanceled&&i(x)});return f.useMemo(()=>({defaultPanelId:d,disabled:o,handleTrigger:h,mounted:a,open:s,panelId:m,setMounted:l,setOpen:i,setPanelIdState:A,transitionStatus:u}),[d,o,h,a,s,m,l,i,A,u])}const uf=f.createContext(void 0);function df(){const e=f.useContext(uf);if(e===void 0)throw new Error(at(15));return e}const ff=f.createContext(void 0);function Na(){const e=f.useContext(ff);if(e===void 0)throw new Error(at(9));return e}let Ta=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Ro.startingStyle]="startingStyle",e[e.endingStyle=Ro.endingStyle]="endingStyle",e})({}),_x=(function(e){return e.panelOpen="data-panel-open",e})({});const Ox={[Ta.open]:""},Hx={[Ta.closed]:""},Kx={open(e){return e?{[_x.panelOpen]:""}:null}},Wx={open(e){return e?Ox:Hx}};let Lx=(function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e})({});const Pa={...Wx,index:e=>({[Lx.index]:String(e)}),..._n,value:()=>null},Qx=f.forwardRef(function(t,n){const{className:r,disabled:o=!1,onOpenChange:s,render:i,value:a,style:l,...u}=t,{ref:d,index:p}=hs(),A=Ut(n,d),{disabled:m,handleValueChange:h,state:g,value:x}=cf(),b=wt(),v=a??b,y=o||m,C=x.indexOf(v)!==-1,I=ue((O,_)=>{s?.(O,_),!_.isCanceled&&h(v,O,_)}),w=Px({open:C,onOpenChange:I,disabled:y}),E=f.useMemo(()=>({open:w.open,disabled:w.disabled,transitionStatus:w.transitionStatus}),[w.open,w.disabled,w.transitionStatus]),S=f.useMemo(()=>({...w,onOpenChange:I,state:E}),[w,E,I]),D=f.useMemo(()=>({...g,hidden:!C&&!w.mounted,index:p,disabled:y,open:C}),[w.mounted,y,p,C,g]),k=wt(),[j,N]=f.useState(),T=j===null?void 0:j??k,F=f.useMemo(()=>({defaultTriggerId:k,open:C,state:D,setTriggerId:N,triggerId:T}),[k,C,D,N,T]),R=Me("div",t,{state:D,ref:A,props:u,stateAttributesMapping:Pa});return c.jsx(uf.Provider,{value:S,children:c.jsx(ff.Provider,{value:F,children:R})})}),Gx=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{state:a}=Na();return Me("h3",t,{state:a,ref:n,props:i,stateAttributesMapping:Pa})}),Yx=f.forwardRef(function(t,n){const{disabled:r,className:o,id:s,render:i,nativeButton:a=!0,style:l,...u}=t,{panelId:d,open:p,handleTrigger:A,disabled:m}=df(),h=r||m,{getButtonProps:g,buttonRef:x}=Vt({disabled:h,focusableWhenDisabled:!0,native:a}),{defaultTriggerId:b,state:v,setTriggerId:y}=Na(),C=s||void 0,I=C??b;return le(()=>(y(S=>C??(S===null?void 0:S)),()=>{y(S=>S===C?null:S)}),[C,y]),Me("button",t,{state:v,ref:[n,x],props:[{"aria-controls":p?d:void 0,"aria-expanded":p,id:I,onClick:A},u,g],stateAttributesMapping:Kx})}),cr={height:void 0,width:void 0};function zx(e){const{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:o,mounted:s,onOpenChange:i,open:a,setMounted:l,setOpen:u,transitionStatus:d}=e,p=f.useRef(null),A=f.useRef(null),[m,h]=f.useState(cr),g=f.useRef(cr),x=f.useRef(!1),b=f.useRef(a),v=f.useRef(!1),[y,C]=f.useState(!1),I=f.useRef(null),w=Ut(t,p),E=nt(a),S=oa(p),D=!a&&!s,k=y?"idle":d,j=a&&(b.current||v.current),N=!a&&s&&A.current==="css-animation"&&m.height===void 0&&m.width===void 0?g.current:m,T=n&&D&&A.current!=="css-animation",F=ue((H,G=!0)=>{G&&(g.current=H),h(H)}),R=ue(()=>{I.current?.(),I.current=null}),O=ue(H=>{R(),I.current=()=>{I.current=null,H()}}),_=ue(()=>{a&&s&&A.current==="css-animation"&&(v.current=!0)});le(()=>{!y||d==="starting"||C(!1)},[y,d]),f.useEffect(()=>()=>{_(),R()},[_,R]),le(()=>{const H=p.current;if(!H)return;!a&&I.current&&R();const G=Ux(H,j);if(A.current=G,a&&d==="idle"&&b.current&&G==="css-animation"){g.current=Kn(H);return}if(a&&d==="starting"){const W=x.current;if(x.current=!1,G==="none"){F(Kn(H)),C(!0);return}if(G==="css-transition"){const Q=Vx(H);if(F(Kn(H)),!W)return Q;const J=lo(H,"transition-duration","0s");return O(J),C(!0),Q}F(Kn(H));const Y=lo(H,"animation-name","none");if(!W){Y();return}const Z=lo(H,"animation-duration","0s");Y(),O(Z),C(!0);return}if(!a&&s&&(d==="idle"||d==="starting")){if(b.current=!1,v.current=!1,G==="none"){F(cr,!1),l(!1);return}F(Kn(H));return}if(d!=="ending")return;if(G==="none"){l(!1);return}const B=Kn(H);if(!(B.height>0||B.width>0)){l(!1);return}F(B),G==="css-animation"&&lo(H,"animation-name","none")()},[s,a,R,F,l,O,j,d]),Zt({enabled:a&&s&&k==="idle",open:!0,ref:p,onComplete(){a&&F(cr,!1)}}),f.useEffect(()=>{if(a||!s||k!=="ending"||!p.current)return;const G=new AbortController;let B=-1;function P(){E.current||(l(!1),F(cr,!1))}return B=It.request(()=>{S(P,G.signal)}),()=>{It.cancel(B),G.abort()}},[E,s,a,k,S,F,l]),le(()=>{const H=p.current;!H||!n||!D||H.setAttribute("hidden","until-found")},[D,n]),f.useEffect(function(){const G=p.current;if(!G)return;function B(P){const W=Ce(Pt,P);i(!0,W),!W.isCanceled&&(x.current=!0,u(!0))}return De(G,"beforematch",B)},[i,u]);const M=o||n||s||a;return{height:N.height,props:{...T?{[Ta.startingStyle]:""}:void 0,hidden:D,id:r},ref:w,shouldPreventOpenAnimation:j,shouldRender:M,transitionStatus:k,width:N.width}}function Kn(e){return{height:e.scrollHeight,width:e.scrollWidth}}function Ux(e,t){const n=it(e).getComputedStyle(e),r=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&dc(n.animationDuration),o=dc(n.transitionDuration);return r&&o||o?"css-transition":r?"css-animation":"none"}function dc(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function lo(e,t,n){const r=e.style.getPropertyValue(t),o=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===""){e.style.removeProperty(t);return}e.style.setProperty(t,r,o)}}function Vx(e){const t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(o=>{e.style.setProperty(o,"initial","important")});function n(){Object.entries(t).forEach(([o,s])=>{if(s===""){e.style.removeProperty(o);return}e.style.setProperty(o,s)})}const r=It.request(n);return()=>{It.cancel(r),n()}}let fc=(function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e})({});const Zx=f.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,id:i,render:a,style:l,...u}=t,{hiddenUntilFound:d,keepMounted:p}=cf(),{defaultPanelId:A,mounted:m,onOpenChange:h,open:g,setMounted:x,setOpen:b,setPanelIdState:v,transitionStatus:y}=df(),C=o??d,I=s??p,w=i||void 0,E=i??A;le(()=>(v(G=>w??(G===null?void 0:G)),()=>{v(G=>G===w?null:G)}),[w,v]);const{height:S,props:D,ref:k,shouldPreventOpenAnimation:j,shouldRender:N,transitionStatus:T,width:F}=zx({externalRef:n,hiddenUntilFound:C,id:E,keepMounted:I,mounted:m,onOpenChange:h,open:g,setMounted:x,setOpen:b,transitionStatus:y}),{state:R,triggerId:O}=Na(),_={...R,transitionStatus:T},M=Qp(l,_),H=Me("div",{...t,style:void 0},{state:_,ref:k,props:[D,{"aria-labelledby":O,role:"region",style:{[fc.accordionPanelHeight]:S===void 0?"auto":`${S}px`,[fc.accordionPanelWidth]:F===void 0?"auto":`${F}px`}},u,M?{style:M}:void 0,j?{style:{animationName:"none"}}:void 0],stateAttributesMapping:Pa});return N?H:null});function _a({className:e,...t}){return c.jsx(Tx,{"data-slot":"accordion",className:ge("flex w-full flex-col",e),...t})}function Oa({className:e,...t}){return c.jsx(Qx,{"data-slot":"accordion-item",className:ge("not-last:border-b",e),...t})}function Ha({className:e,children:t,...n}){return c.jsx(Gx,{className:"flex",children:c.jsxs(Yx,{"data-slot":"accordion-trigger",className:ge("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",e),...n,children:[t,c.jsx(Pn,{className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),c.jsx(Yi,{className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function Ka({className:e,children:t,...n}){return c.jsx(Zx,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...n,children:c.jsx("div",{className:ge("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),children:t})})}const pf=f.createContext(void 0);function Jx(){return f.useContext(pf)}const $x=f.forwardRef(function(t,n){const{className:r,defaultPressed:o=!1,disabled:s=!1,form:i,onPressedChange:a,pressed:l,render:u,type:d,value:p,nativeButton:A=!0,style:m,...h}=t,g=wt(p||void 0),x=Jx(),b=x?.value??[],v=x?void 0:o,y=(s||x?.disabled)??!1,[C,I]=ln({controlled:x?g!==void 0&&b.indexOf(g)>-1:l,default:v,name:"Toggle",state:"pressed"}),{getButtonProps:w,buttonRef:E}=Vt({disabled:y,native:A}),S={disabled:y,pressed:C},D=[E,n],k=[{"aria-pressed":C,onClick(T){const F=!C,R=Ce(Pt,T.nativeEvent);a?.(F,R),!R.isCanceled&&(g&&x?.setGroupValue?.(g,F,R),!R.isCanceled&&I(F))}},h,w],j=Me("button",t,{enabled:!x,state:S,ref:D,props:k}),N=f.useMemo(()=>({disabled:y,focusableWhenDisabled:!1}),[y]);return x?c.jsx(qd,{tag:"button",render:u,className:r,style:m,metadata:N,state:S,refs:D,props:k}):j}),hf="data-composite-item-active",Xx=[];function qx(e){const{loopFocus:t=!0,orientation:n="both",grid:r,onLoop:o,direction:s,highlightedIndex:i,onHighlightedIndexChange:a,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:d,disabledIndices:p,modifierKeys:A=Xx}=e,[m,h]=f.useState(0),g=r!=null,x=f.useRef(null),b=Ut(x,l),v=f.useRef([]),y=f.useRef(!1),C=i??m,I=ue((k,j=!1)=>{if((a??h)(k),j){const N=v.current[k];ql(x.current,N,s,n)}}),w=ue(k=>{if(k.size===0||y.current)return;y.current=!0;const j=Array.from(k.keys()),N=j.find(F=>F?.hasAttribute(hf))??null,T=N?k.get(N)?.index??-1:-1;if(T!==-1)I(T);else if(So(j,C,p)){const F=on(j,{disabledIndices:p});Ir(j,F)||I(F)}ql(x.current,N,s,n)});le(()=>{if(p==null||i!=null||!y.current)return;const k=v.current;if(So(k,C,p)){const j=on(k,{disabledIndices:p});Ir(k,j)||I(j)}},[p,i,C,v,I]);const E=ue((k,j,N)=>o?o(k,j,N,v):N),S=ue(k=>{const j=k.key===vi||k.key===yi;if(!ss.has(k.key)||!u&&j||eb(k,A)||!x.current)return;const T=s==="rtl",F=T?xi:bi,R=T?bi:xi,O=n==="vertical"?mi:F,_=n==="vertical"?gi:R,M=gt(k.nativeEvent);if(M!=null&&Xl(M)&&!tf(M)){const Y=M.selectionStart,Z=M.selectionEnd,Q=M.value;if(Y==null||k.shiftKey||Y!==Z||k.key!==_&&Y<Q.length||k.key!==O&&Y>0)return}let H=C;const G=xo(v,p),B=ui(v,p);r!=null&&(H=r({disabledIndices:p,elementsRef:v,event:k,highlightedIndex:C,loopFocus:t,maxIndex:B,minIndex:G,onLoop:E,orientation:n,rtl:T}));const P=n!=="vertical"&&k.key===F||n!=="horizontal"&&k.key===mi,W=n!=="vertical"&&k.key===R||n!=="horizontal"&&k.key===gi;u&&(k.key===vi?H=G:k.key===yi&&(H=B)),H===C&&(P||W)&&(t&&H===B&&P?(H=G,o&&(H=o(k,C,H,v))):t&&H===G&&W?(H=B,o&&(H=o(k,C,H,v))):H=on(v.current,{startingIndex:H,decrement:W,disabledIndices:p})),H!==C&&!Ir(v.current,H)&&(d&&k.stopPropagation(),(g||j||P||W)&&k.preventDefault(),I(H,!0),queueMicrotask(()=>{v.current[H]?.focus()}))});return{props:{ref:b,onFocus(k){const j=x.current,N=gt(k.nativeEvent);!j||N==null||!Xl(N)||N.setSelectionRange(0,N.value.length)},onKeyDown:S},highlightedIndex:C,onHighlightedIndexChange:I,elementsRef:v,onMapChange:w,relayKeyboardEvent:S}}function eb(e,t){for(const n of Km)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Af(e){const{render:t,className:n,style:r,refs:o=Ht,props:s=Ht,state:i=dt,stateAttributesMapping:a,highlightedIndex:l,onHighlightedIndexChange:u,orientation:d,grid:p,loopFocus:A,onLoop:m,enableHomeAndEndKeys:h,onMapChange:g,stopEventPropagation:x=!0,rootRef:b,disabledIndices:v,modifierKeys:y,highlightItemOnHover:C=!1,tag:I="div",...w}=e,E=ls(),{props:S,highlightedIndex:D,onHighlightedIndexChange:k,elementsRef:j,onMapChange:N,relayKeyboardEvent:T}=qx({grid:p,loopFocus:A,onLoop:m,orientation:d,highlightedIndex:l,onHighlightedIndexChange:u,rootRef:b,stopEventPropagation:x,enableHomeAndEndKeys:h,direction:E,disabledIndices:v,modifierKeys:y}),F=Me(I,e,{state:i,ref:o,props:[S,...s,w],stateAttributesMapping:a}),R=f.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:k,highlightItemOnHover:C,relayKeyboardEvent:T}),[D,k,C,T]);return c.jsx(lh.Provider,{value:R,children:c.jsx(Ur,{elementsRef:j,onMapChange:O=>{g?.(O),N(O)},children:F})})}const tb=f.createContext(void 0);function nb(){return f.useContext(tb)}const rb=f.forwardRef(function(t,n){const{defaultValue:r,disabled:o=!1,loopFocus:s=!0,onValueChange:i,orientation:a="horizontal",multiple:l=!1,value:u,className:d,render:p,style:A,...m}=t,h=Ma(),g=nb(),x=u!==void 0||r!==void 0,b=(h?.disabled??!1)||(g?.disabled??!1)||o,[v,y]=ln({controlled:u,default:u===void 0?r??Ht:void 0,name:"ToggleGroup",state:"value"}),C=ue((D,k,j)=>{let N;l?(N=v.slice(),k?N.push(D):N.splice(v.indexOf(D),1)):N=k?[D]:[],i?.(N,j),!j.isCanceled&&y(N)}),I={disabled:b,multiple:l,orientation:a},w=f.useMemo(()=>({disabled:b,setGroupValue:C,value:v,isValueInitialized:x}),[b,C,v,x]),E={role:"group"},S=Me("div",t,{enabled:!!h,state:I,ref:n,props:[E,m]});return c.jsx(pf.Provider,{value:w,children:h?S:c.jsx(Af,{render:p,className:d,style:A,state:I,refs:[n],props:[E,m],loopFocus:s,enableHomeAndEndKeys:!0,orientation:a})})}),ob=ji("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),gf=f.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function Wa({className:e,variant:t,size:n,spacing:r=2,orientation:o="horizontal",children:s,...i}){return c.jsx(rb,{"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":o,style:{"--gap":r},className:ge("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...i,children:c.jsx(gf.Provider,{value:{variant:t,size:n,spacing:r,orientation:o},children:s})})}function Br({className:e,children:t,variant:n="default",size:r="default",...o}){const s=f.useContext(gf);return c.jsx($x,{"data-slot":"toggle-group-item","data-variant":s.variant||n,"data-size":s.size||r,"data-spacing":s.spacing,className:ge("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",ob({variant:s.variant||n,size:s.size||r}),e),...o,children:t})}function La({...e}){return c.jsx(Nd,{"data-slot":"dialog",...e})}function sb({...e}){return c.jsx(Ra,{"data-slot":"dialog-portal",...e})}function ib({...e}){return c.jsx(Qr,{"data-slot":"dialog-close",...e})}function ab({className:e,...t}){return c.jsx(ia,{"data-slot":"dialog-overlay",className:ge("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function Qa({className:e,children:t,showCloseButton:n=!0,...r}){return c.jsxs(sb,{children:[c.jsx(ab,{}),c.jsxs(ka,{"data-slot":"dialog-content",className:ge("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:[t,n&&c.jsxs(Qr,{"data-slot":"dialog-close",render:c.jsx(He,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[c.jsx(zi,{}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ln({className:e,...t}){return c.jsx("div",{"data-slot":"dialog-header",className:ge("flex flex-col gap-2",e),...t})}function lb({className:e,showCloseButton:t=!1,children:n,...r}){return c.jsxs("div",{"data-slot":"dialog-footer",className:ge("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...r,children:[n,t&&c.jsx(Qr,{render:c.jsx(He,{variant:"outline"}),children:"Close"})]})}function Qn({className:e,...t}){return c.jsx(Da,{"data-slot":"dialog-title",className:ge("cn-font-heading text-base leading-none font-medium",e),...t})}function Ga({className:e,...t}){return c.jsx(aa,{"data-slot":"dialog-description",className:ge("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const mf=new Set(["npx","create-opentray","create","set"]),rn={comment:"text-muted-foreground italic",keyword:"text-emerald-600 dark:text-emerald-400 font-medium",flag:"text-sky-600 dark:text-sky-400",string:"text-amber-700 dark:text-amber-300 break-all",env:"text-violet-600 dark:text-violet-400",variable:"text-rose-600 dark:text-rose-400"},cb=(e,t)=>e.split(/(\s+|\$[A-Za-z_][A-Za-z0-9_]*)/g).map((r,o)=>{const s=`${t}-u${o}`;return r.startsWith("$")?c.jsx("span",{className:rn.variable,children:r},s):mf.has(r)?c.jsx("span",{className:rn.keyword,children:r},s):r.startsWith("--")?c.jsx("span",{className:rn.flag,children:r},s):/^[A-Za-z_][A-Za-z0-9_]*=/.test(r)?c.jsx("span",{className:rn.env,children:r},s):c.jsx("span",{children:r},s)}),ub=(e,t)=>e.startsWith("#")?c.jsx("span",{className:rn.comment,children:e}):e.split(/('(?:[^']|'\\'')*')/g).map((r,o)=>{const s=`${t}-s${o}`;if(!r.startsWith("'"))return c.jsx("span",{children:cb(r,s)},s);const i=r.slice(1,-1);return mf.has(i)?c.jsx("span",{className:rn.keyword,children:r},s):i.startsWith("--")?c.jsx("span",{className:rn.flag,children:r},s):/^[A-Za-z_][A-Za-z0-9_]*=/.test(i)?c.jsx("span",{className:rn.env,children:r},s):c.jsx("span",{className:rn.string,children:r},s)}),db=({content:e})=>c.jsx("pre",{className:"tech-ltr bg-muted max-h-72 overflow-auto rounded-md p-2 text-xs whitespace-pre-wrap break-words",children:e.split(`
3
+ `).map((t,n)=>c.jsx("div",{children:t.length===0?" ":ub(t,n)},n))}),xf=({open:e,subtitle:t,hasEnv:n,share:r=!1,runner:o,onClose:s})=>{const{messages:i}=mt(),[a,l]=f.useState("sh"),[u,d]=f.useState(!1),[p,A]=f.useState(null),[m,h]=f.useState(null),[g,x]=f.useState(null),[b,v]=f.useState(!1),[y,C]=f.useState(!1),I=f.useRef(o);I.current=o,f.useEffect(()=>{d(!1),A(null)},[e]),f.useEffect(()=>{if(!e){h(null),x(null);return}if(n&&!u){h(null),v(!1);return}let D=!1;return v(!0),C(!1),x(null),(async()=>{const k=await I.current({format:a,acknowledgeEnv:u,...p===null?{}:{inlineIcon:p}});if(D)return;if(v(!1),k.status===200){const N=k.data;"content"in N&&N.content!==void 0&&(p===null&&N.iconSharedAs!==void 0&&A(N.iconSharedAs==="embedded"),h({filename:N.filename??"create-opentray.sh",content:N.content,...N.commandLine===void 0?{}:{commandLine:N.commandLine},...N.iconReference===void 0?{}:{iconReference:N.iconReference}}));return}h(null);const j=k.data;"code"in j&&x(`${j.message??j.code}`)})(),()=>{D=!0}},[e,a,u,p,n]);const w=!n||u,E=()=>{if(m===null)return;const D=new Blob([m.content],{type:a==="sh"?"text/x-shellscript":"text/plain"}),k=URL.createObjectURL(D),j=document.createElement("a");j.href=k,j.download=m.filename,j.click(),URL.revokeObjectURL(k)},S=async()=>{m!==null&&(await navigator.clipboard.writeText(m.commandLine??m.content),C(!0))};return c.jsx(La,{open:e,onOpenChange:D=>{D||s()},children:c.jsxs(Qa,{children:[c.jsxs(Ln,{children:[c.jsx(Qn,{children:r?i.export.shareTitle:i.export.title}),c.jsxs(Ga,{children:[c.jsx("span",{className:"tech-ltr block truncate",children:t}),r&&c.jsx("span",{className:"text-muted-foreground mt-1 block text-xs",children:i.export.shareSubtitle})]})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs(Wa,{variant:"outline",size:"sm",spacing:0,value:[a],onValueChange:D=>{const k=D[0];(k==="sh"||k==="ps1")&&l(k)},children:[c.jsx(Br,{value:"sh",children:i.export.scriptSh}),c.jsx(Br,{value:"ps1",children:i.export.scriptPs1})]}),b&&c.jsx("span",{className:"text-muted-foreground self-center text-xs",children:i.export.building})]}),n&&c.jsx("div",{className:"border-warning rounded-md border p-3",children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Ci,{id:"export-env-ack",checked:u,onCheckedChange:D=>d(D===!0)}),c.jsxs(Ne,{htmlFor:"export-env-ack",className:"text-xs leading-snug",children:[i.export.envAck,c.jsx("span",{className:"text-muted-foreground block",children:i.export.envAckHint})]})]})}),m?.iconReference!==void 0&&m.iconReference!=="none"&&c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Ci,{id:"export-inline-icon",checked:p===!0,onCheckedChange:D=>A(D===!0)}),c.jsxs(Ne,{htmlFor:"export-inline-icon",className:"text-xs leading-snug",children:[i.export.inlineIcon,c.jsx("span",{className:"text-muted-foreground block",children:i.export.inlineIconHint})]})]}),g!==null&&c.jsxs("p",{className:"text-destructive text-xs",role:"alert",children:[i.export.blocked," ",g]}),m!==null&&c.jsx(_a,{children:c.jsxs(Oa,{value:"content",children:[c.jsx(Ha,{className:"text-xs",children:i.export.viewFull}),c.jsx(Ka,{children:c.jsx(db,{content:m.content})})]})}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsxs(He,{size:"sm",variant:"outline",disabled:!w||m===null,onClick:()=>{S()},children:[c.jsx(wh,{width:14,height:14,"aria-hidden":!0}),y?i.common.copied:i.export.copyCommand]}),c.jsxs(He,{size:"sm",disabled:!w||m===null,onClick:E,children:[c.jsx(Eh,{width:14,height:14,"aria-hidden":!0}),i.export.downloadFile]})]})]})})};function fb(e){return Md("alert-dialog",e)}function pc({...e}){return c.jsx(fb,{"data-slot":"alert-dialog",...e})}function pb({...e}){return c.jsx(Ra,{"data-slot":"alert-dialog-portal",...e})}function hb({className:e,...t}){return c.jsx(ia,{"data-slot":"alert-dialog-overlay",className:ge("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function hc({className:e,size:t="default",...n}){return c.jsxs(pb,{children:[c.jsx(hb,{}),c.jsx(ka,{"data-slot":"alert-dialog-content","data-size":t,className:ge("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n})]})}function Ac({className:e,...t}){return c.jsx("div",{"data-slot":"alert-dialog-header",className:ge("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function gc({className:e,...t}){return c.jsx("div",{"data-slot":"alert-dialog-footer",className:ge("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function mc({className:e,...t}){return c.jsx(Da,{"data-slot":"alert-dialog-title",className:ge("cn-font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function xc({className:e,...t}){return c.jsx(aa,{"data-slot":"alert-dialog-description",className:ge("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function bc({className:e,...t}){return c.jsx(He,{"data-slot":"alert-dialog-action",className:ge(e),...t})}function vc({className:e,variant:t="outline",size:n="default",...r}){return c.jsx(Qr,{"data-slot":"alert-dialog-cancel",className:ge(e),render:c.jsx(He,{variant:t,size:n}),...r})}const yc={healthy:"statusHealthy","invalid-config":"statusInvalidConfig","incompatible-version":"statusIncompatible","missing-payload":"statusMissingPayload","broken-link":"statusBrokenLink",running:"statusRunning"},Cc=e=>({statusHealthy:e.applications.statusHealthy,statusInvalidConfig:e.applications.statusInvalidConfig,statusIncompatible:e.applications.statusIncompatible,statusMissingPayload:e.applications.statusMissingPayload,statusBrokenLink:e.applications.statusBrokenLink,statusRunning:e.applications.statusRunning}),Ab=e=>{const t=e.command??{},n=e.window??{};return{command:[t.executable??"",...t.args??[]].filter(Boolean).join(" "),cwd:t.cwd??"",envKeys:Object.keys(t.env??{}),packageManager:typeof e.packageManager=="string"?e.packageManager:"",window:`${n.width??"—"}×${n.height??"—"}`.replace(/—×—/u,"—"),developerMode:e.developerMode===!0}},fn=({label:e,value:t})=>c.jsxs("div",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-1 text-xs",children:[c.jsx("span",{className:"text-muted-foreground",children:e}),c.jsx("span",{className:"tech-ltr break-all",children:t})]}),gb=({app:e,dataUrl:t})=>{const n=(e.appName??e.key).trim().charAt(0).toUpperCase()||"A";return c.jsx("span",{className:"bg-muted text-muted-foreground flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-md text-sm font-semibold","aria-hidden":!0,children:t!==void 0?c.jsx("img",{src:t,alt:"",className:"size-full object-contain"}):n})},mb=()=>{const{messages:e}=mt(),{navigate:t,route:n}=of(),[r,o]=f.useState([]),[s,i]=f.useState("loading"),[a,l]=f.useState(null),[u,d]=f.useState(null),[p,A]=f.useState(!1),[m,h]=f.useState(null),[g,x]=f.useState(null),[b,v]=f.useState(null),[y,C]=f.useState({}),[I,w]=f.useState({}),E=f.useCallback(async()=>{i(O=>O==="ready"?"stale":"loading");const R=await Gp();R.status===200?(o(R.data),C({}),i("ready"),await Promise.all(R.data.filter(O=>O.hasIcon===!0).map(async O=>{const _=await Yp(O.key),M=_.data;_.status===200&&"dataUrl"in M&&M.dataUrl!==void 0&&w(H=>({...H,[O.key]:M.dataUrl}))}))):i("stale")},[]);f.useEffect(()=>{n==="applications"&&E()},[n,E]),f.useEffect(()=>{const R=()=>{E()};return window.addEventListener("create-opentray:apps-changed",R),()=>window.removeEventListener("create-opentray:apps-changed",R)},[E]);const S=async R=>{if(b===R.key){v(null);return}if(v(R.key),y[R.key]===void 0){const O=await vu(R.key);C(_=>({..._,[R.key]:O.status===200?Ab(O.data):"error"}))}},D=async R=>{const O=await zp(R.key),_=O.data;h(O.status===200&&"ok"in _&&_.ok===!0?_.detail:"message"in _?_.message:e.common.error)},k=R=>{h([R.projectPath!==void 0?R.projectPath:"",R.targetRetained===!0?`${e.applications.uninstallRetained} ${R.payloadPath??""}`:"",R.targetDeleted===!0?`${e.applications.uninstallDeleted} ${R.payloadPath??""}`:"",R.manualPinCleanupHint].filter(Boolean).join(`
4
+ `))},j=async(R,O)=>{const _=await Vp(R.key,{...O,purgeTarget:p});if(_.status===200)k(_.data);else{const M=_.data;if(_.status===409&&M.code==="app_running"&&(M.pids!==void 0||M.pid!==void 0)){const H=M.pids??(M.pid!==void 0?[M.pid]:[]);d({app:R,pids:H});return}h(M.message??e.common.error)}await E()},N=async()=>{const R=a;l(null),R!==null&&await j(R,{stopRunning:!1})},T=async()=>{const R=u;d(null),R!==null&&await j(R.app,{stopRunning:!0})},F=R=>g===null?Promise.resolve({status:400,data:{code:"state_error",message:"no target"}}):Up(g.key,R);return c.jsxs("section",{className:"flex h-full flex-col overflow-hidden","aria-label":e.applications.title,children:[c.jsxs("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[c.jsx("h1",{className:"text-sm font-semibold",children:e.applications.title}),c.jsx(He,{variant:"ghost",size:"icon-sm","aria-label":e.common.refresh,onClick:()=>{E()},children:c.jsx(Xh,{width:16,height:16,"aria-hidden":!0})})]}),c.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:[s==="loading"&&c.jsxs("div",{className:"space-y-2","aria-label":e.common.loading,children:[c.jsx(nn,{className:"h-14 w-full"}),c.jsx(nn,{className:"h-14 w-full"}),c.jsx(nn,{className:"h-14 w-full"})]}),s!=="loading"&&r.length===0&&c.jsx("p",{className:"text-muted-foreground text-sm",children:e.applications.emptyHint}),r.length>0&&c.jsx("ul",{className:"space-y-2",children:r.map(R=>{const O=b===R.key,_=y[R.key],M=R.status!=="healthy";return c.jsxs("li",{className:"border-border bg-card text-card-foreground rounded-lg border px-3 py-2",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(gb,{app:R,dataUrl:I[R.key]}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"truncate text-sm font-medium",children:R.appName??R.key}),M&&c.jsxs(us,{children:[c.jsx(ds,{render:H=>c.jsx(Co,{variant:"destructive",...H,children:Cc(e)[yc[R.status]]})}),c.jsx(fs,{children:R.error?.message??Cc(e)[yc[R.status]]})]}),R.isLink&&c.jsx(Co,{variant:"outline",children:e.applications.linked})]}),c.jsx("div",{className:"tech-ltr text-muted-foreground truncate text-xs",children:R.appId??R.key})]}),c.jsxs(He,{variant:"ghost",size:"sm","aria-expanded":O,onClick:()=>{S(R)},children:[O?c.jsx(Yi,{width:14,height:14,"aria-hidden":!0}):c.jsx(Pn,{width:14,height:14,"aria-hidden":!0}),e.applications.details]}),c.jsxs(He,{variant:"outline",size:"sm",onClick:()=>{window.location.hash=`#/add?edit=${encodeURIComponent(R.key)}`},children:[c.jsx(Su,{width:14,height:14,"aria-hidden":!0}),e.applications.edit]}),c.jsxs(He,{variant:"outline",size:"sm",onClick:()=>{D(R)},children:[c.jsx(Eu,{width:14,height:14,"aria-hidden":!0}),e.applications.open]}),c.jsxs(He,{variant:"outline",size:"sm",onClick:()=>x(R),children:[c.jsx(nA,{width:14,height:14,"aria-hidden":!0}),e.applications.share]}),c.jsxs(He,{variant:"destructive",size:"sm",onClick:()=>l(R),children:[c.jsx(lA,{width:14,height:14,"aria-hidden":!0}),e.applications.uninstall]})]}),O&&c.jsxs("div",{className:"border-border mt-2 space-y-1 rounded-md border bg-muted/40 p-3",children:[_===void 0&&c.jsx("p",{className:"text-muted-foreground text-xs",children:e.common.loading}),_==="error"&&c.jsx("p",{className:"text-destructive text-xs",role:"alert",children:e.common.error}),_!==void 0&&_!=="error"&&c.jsxs(c.Fragment,{children:[c.jsx(fn,{label:e.applications.source,value:R.source==="wizard"?e.applications.sourceWizard:e.applications.sourceRegistered}),c.jsx(fn,{label:e.applications.detailsCommand,value:_.command}),c.jsx(fn,{label:e.applications.detailsCwd,value:_.cwd}),c.jsx(fn,{label:e.applications.detailsEnv,value:_.envKeys.length>0?_.envKeys.join(", "):"—"}),c.jsx(fn,{label:e.applications.detailsPm,value:_.packageManager}),c.jsx(fn,{label:e.applications.detailsWindow,value:_.window}),c.jsx(fn,{label:e.applications.detailsDevMode,value:_.developerMode?"ON":"OFF"}),c.jsx(fn,{label:e.applications.detailsProjectDir,value:R.projectDir??R.payloadPath??R.registrationDir})]})]})]},R.key)})}),s==="stale"&&c.jsx("p",{className:"text-warning mt-3 text-xs",role:"status",children:e.common.error}),m!==null&&c.jsx("p",{className:"text-muted-foreground bg-muted mt-3 whitespace-pre-line rounded-md p-3 text-xs",role:"status",children:m})]}),c.jsx(pc,{open:a!==null,onOpenChange:R=>{R||l(null)},children:c.jsxs(hc,{children:[c.jsxs(Ac,{children:[c.jsx(mc,{children:e.applications.uninstallTitle}),c.jsxs(xc,{children:[a?.source==="wizard"?e.applications.uninstallWizardDescription:e.applications.uninstallDescription,c.jsx("span",{className:"tech-ltr mt-2 block truncate",children:a?.appId??a?.key}),a?.projectDir!==void 0&&c.jsx("span",{className:"tech-ltr mt-1 block truncate",children:a.projectDir})]})]}),a?.isLink===!0&&c.jsxs("label",{className:"flex items-start gap-2 text-xs",children:[c.jsx(Ci,{checked:p,onCheckedChange:R=>A(R===!0)}),c.jsxs("span",{children:[e.applications.uninstallPurge,c.jsx("span",{className:"text-muted-foreground block",children:e.applications.uninstallPurgeHint})]})]}),c.jsx("p",{className:"text-muted-foreground text-xs",children:e.applications.uninstallPinHint}),c.jsxs(gc,{children:[c.jsx(vc,{children:e.common.cancel}),c.jsx(bc,{onClick:()=>{N()},children:e.applications.uninstall})]})]})}),c.jsx(pc,{open:u!==null,onOpenChange:R=>{R||d(null)},children:c.jsxs(hc,{children:[c.jsxs(Ac,{children:[c.jsx(mc,{children:e.applications.stopRunningTitle}),c.jsxs(xc,{children:[e.applications.stopRunningDescription,c.jsxs("span",{className:"tech-ltr mt-2 block",children:[e.applications.stopRunningPids,": ",u?.pids.join(", ")]}),c.jsx("span",{className:"tech-ltr mt-1 block truncate",children:u?.app.appId??u?.app.key})]})]}),c.jsx("p",{className:"text-muted-foreground text-xs",children:e.applications.uninstallPinHint}),c.jsxs(gc,{children:[c.jsx(vc,{children:e.common.cancel}),c.jsx(bc,{onClick:()=>{T()},children:e.applications.stopRunningConfirm})]})]})}),c.jsx(xf,{open:g!==null,subtitle:g?.appId??g?.key??"",hasEnv:g?.hasEnv===!0,runner:F,onClose:()=>x(null)})]})},Ya=f.createContext({indent:20,currentItem:void 0,tree:void 0,toggleIconType:"plus-minus"});function bf(){return f.useContext(Ya)}function xb({indent:e=20,tree:t,className:n,toggleIconType:r="chevron",...o}){const s=t&&typeof t.getContainerProps=="function"?t.getContainerProps():{},i={...o,...s},{style:a,...l}=i,u={...a,"--tree-indent":`${e}px`};return c.jsx(Ya.Provider,{value:{indent:e,tree:t,toggleIconType:r},children:c.jsx("div",{"data-slot":"tree",style:u,className:ge("flex flex-col",n),...l})})}function bb({item:e,className:t,render:n,children:r,...o}){const s=bf(),{indent:i}=s,a=typeof e.getProps=="function"?e.getProps():{},l={...o,children:r,...a},{style:u,...d}=l,A={"data-slot":"tree-item",style:{...u,"--tree-padding":`${e.getItemMeta().level*i}px`},className:ge("z-10 ps-(--tree-padding) outline-hidden select-none not-last:pb-0.5 focus:z-20 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),"data-focus":typeof e.isFocused=="function"?e.isFocused()||!1:void 0,"data-folder":typeof e.isFolder=="function"?e.isFolder()||!1:void 0,"data-selected":typeof e.isSelected=="function"?e.isSelected()||!1:void 0,"data-drag-target":typeof e.isDragTarget=="function"?e.isDragTarget()||!1:void 0,"data-search-match":typeof e.isMatchingSearch=="function"?e.isMatchingSearch()||!1:void 0,"aria-expanded":e.isExpanded()};return c.jsx(Ya.Provider,{value:{...s,currentItem:e},children:ku({defaultTagName:"button",render:n,props:Nt(A,d)})})}function vb({item:e,children:t,className:n,...r}){const{currentItem:o,toggleIconType:s}=bf(),i=e||o;return i?c.jsxs("span",{"data-slot":"tree-item-label",className:ge("in-focus-visible:ring-ring/50 bg-background hover:bg-accent in-data-[selected=true]:bg-accent in-data-[selected=true]:text-accent-foreground in-data-[drag-target=true]:bg-accent flex items-center gap-1 transition-colors not-in-data-[folder=true]:ps-7 in-focus-visible:ring-[3px] in-data-[search-match=true]:bg-blue-50! [&_svg]:pointer-events-none [&_svg]:shrink-0","rounded-md","py-1.5","px-2","text-sm",n),...r,children:[i.isFolder()&&(s==="plus-minus"?i.isExpanded()?c.jsx(Wh,{"aria-hidden":!0,className:"text-muted-foreground size-3.5",stroke:"currentColor",strokeWidth:"1"}):c.jsx(Ru,{"aria-hidden":!0,className:"text-muted-foreground size-3.5",stroke:"currentColor",strokeWidth:"1"}):c.jsx(Pn,{"aria-hidden":!0,className:"text-muted-foreground size-4 in-aria-[expanded=false]:-rotate-90"})),t||(typeof i.getItemName=="function"?i.getItemName():null)]}):(console.warn("TreeItemLabel: No item provided via props or context"),null)}const Ic={};function yb(e){let t=Ic[e];if(t)return t;t=Ic[e]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);t.push(r)}for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);t[r]="%"+("0"+r.toString(16).toUpperCase()).slice(-2)}return t}function nr(e,t){typeof t!="string"&&(t=nr.defaultChars);const n=yb(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(r){let o="";for(let s=0,i=r.length;s<i;s+=3){const a=parseInt(r.slice(s+1,s+3),16);if(a<128){o+=n[a];continue}if((a&224)===192&&s+3<i){const l=parseInt(r.slice(s+4,s+6),16);if((l&192)===128){const u=a<<6&1984|l&63;u<128?o+="��":o+=String.fromCharCode(u),s+=3;continue}}if((a&240)===224&&s+6<i){const l=parseInt(r.slice(s+4,s+6),16),u=parseInt(r.slice(s+7,s+9),16);if((l&192)===128&&(u&192)===128){const d=a<<12&61440|l<<6&4032|u&63;d<2048||d>=55296&&d<=57343?o+="���":o+=String.fromCharCode(d),s+=6;continue}}if((a&248)===240&&s+9<i){const l=parseInt(r.slice(s+4,s+6),16),u=parseInt(r.slice(s+7,s+9),16),d=parseInt(r.slice(s+10,s+12),16);if((l&192)===128&&(u&192)===128&&(d&192)===128){let p=a<<18&1835008|l<<12&258048|u<<6&4032|d&63;p<65536||p>1114111?o+="����":(p-=65536,o+=String.fromCharCode(55296+(p>>10),56320+(p&1023))),s+=9;continue}}o+="�"}return o})}nr.defaultChars=";/?:@&=+$,#";nr.componentChars="";const wc={};function Cb(e){let t=wc[e];if(t)return t;t=wc[e]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);/^[0-9a-z]$/i.test(r)?t.push(r):t.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function Vr(e,t,n){typeof t!="string"&&(n=t,t=Vr.defaultChars),typeof n>"u"&&(n=!0);const r=Cb(t);let o="";for(let s=0,i=e.length;s<i;s++){const a=e.charCodeAt(s);if(n&&a===37&&s+2<i&&/^[0-9a-f]{2}$/i.test(e.slice(s+1,s+3))){o+=e.slice(s,s+3),s+=2;continue}if(a<128){o+=r[a];continue}if(a>=55296&&a<=57343){if(a>=55296&&a<=56319&&s+1<i){const l=e.charCodeAt(s+1);if(l>=56320&&l<=57343){o+=encodeURIComponent(e[s]+e[s+1]),s++;continue}}o+="%EF%BF%BD";continue}o+=encodeURIComponent(e[s])}return o}Vr.defaultChars=";/?:@&=+$,-_.!~*'()#";Vr.componentChars="-_.!~*'()";function Ii(e){let t="";return t+=e.protocol||"",t+=e.slashes?"//":"",t+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?t+="["+e.hostname+"]":t+=e.hostname||"",t+=e.port?":"+e.port:"",t+=e.pathname||"",t+=e.search||"",t+=e.hash||"",t}function Po(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const Ib=/^([a-z0-9.+-]+:)/i,wb=/:[0-9]*$/,kb=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Eb=["<",">",'"',"`"," ","\r",`
5
+ `," "],Sb=["{","}","|","\\","^","`"].concat(Eb),Rb=["'"].concat(Sb),kc=["%","/","?",";","#"].concat(Rb),Ec=["/","?","#"],Db=255,Sc=/^[+a-z0-9A-Z_-]{0,63}$/,Fb=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Rc={javascript:!0,"javascript:":!0},Dc={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function wi(e,t){if(e&&e instanceof Po)return e;const n=new Po;return n.parse(e,t),n}Po.prototype.parse=function(e,t){let n,r,o,s=e;if(s=s.trim(),!t&&e.split("#").length===1){const u=kb.exec(s);if(u)return this.pathname=u[1],u[2]&&(this.search=u[2]),this}let i=Ib.exec(s);if(i&&(i=i[0],n=i.toLowerCase(),this.protocol=i,s=s.substr(i.length)),(t||i||s.match(/^\/\/[^@\/]+@[^@\/]+/))&&(o=s.substr(0,2)==="//",o&&!(i&&Rc[i])&&(s=s.substr(2),this.slashes=!0)),!Rc[i]&&(o||i&&!Dc[i])){let u=-1;for(let h=0;h<Ec.length;h++)r=s.indexOf(Ec[h]),r!==-1&&(u===-1||r<u)&&(u=r);let d,p;u===-1?p=s.lastIndexOf("@"):p=s.lastIndexOf("@",u),p!==-1&&(d=s.slice(0,p),s=s.slice(p+1),this.auth=d),u=-1;for(let h=0;h<kc.length;h++)r=s.indexOf(kc[h]),r!==-1&&(u===-1||r<u)&&(u=r);u===-1&&(u=s.length),s[u-1]===":"&&u--;const A=s.slice(0,u);s=s.slice(u),this.parseHost(A),this.hostname=this.hostname||"";const m=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!m){const h=this.hostname.split(/\./);for(let g=0,x=h.length;g<x;g++){const b=h[g];if(b&&!b.match(Sc)){let v="";for(let y=0,C=b.length;y<C;y++)b.charCodeAt(y)>127?v+="x":v+=b[y];if(!v.match(Sc)){const y=h.slice(0,g),C=h.slice(g+1),I=b.match(Fb);I&&(y.push(I[1]),C.unshift(I[2])),C.length&&(s=C.join(".")+s),this.hostname=y.join(".");break}}}}this.hostname.length>Db&&(this.hostname=""),m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const a=s.indexOf("#");a!==-1&&(this.hash=s.substr(a),s=s.slice(0,a));const l=s.indexOf("?");return l!==-1&&(this.search=s.substr(l),s=s.slice(0,l)),s&&(this.pathname=s),Dc[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Po.prototype.parseHost=function(e){let t=wb.exec(e);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};const Bb=Object.freeze(Object.defineProperty({__proto__:null,decode:nr,encode:Vr,format:Ii,parse:wi},Symbol.toStringTag,{value:"Module"})),vf=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,yf=/[\0-\x1F\x7F-\x9F]/,jb=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,za=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95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\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uF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-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0-\uDCBB\uDCC0\uDCC1\uDCD0-\uDCD8\uDD00-\uDE57\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8\uDF00-\uDF92\uDF94-\uDFEF\uDFFA]/,If=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,Mb=Object.freeze(Object.defineProperty({__proto__:null,Any:vf,Cc:yf,Cf:jb,P:za,S:Cf,Z:If},Symbol.toStringTag,{value:"Module"})),Nb=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function Tb(e){return e>=55296&&e<=57343||e>1114111?65533:Nb.get(e)??e}function Pb(e){const t=atob(e),n=t.length&-2,r=new Uint16Array(n/2);for(let o=0,s=0;o<n;o+=2){const i=t.charCodeAt(o),a=t.charCodeAt(o+1);r[s++]=i|a<<8}return r}const _b=Pb("QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNd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aBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg");var vt;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.FLAG13=8192]="FLAG13",e[e.BRANCH_LENGTH=8064]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(vt||(vt={}));var tt;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(tt||(tt={}));const Fc=32;function ki(e){return e>=tt.ZERO&&e<=tt.NINE}function Ob(e){return e>=tt.UPPER_A&&e<=tt.UPPER_F||e>=tt.LOWER_A&&e<=tt.LOWER_F}function Hb(e){return e>=tt.UPPER_A&&e<=tt.UPPER_Z||e>=tt.LOWER_A&&e<=tt.LOWER_Z||ki(e)}function Kb(e){return e===tt.EQUALS||Hb(e)}var pt;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(pt||(pt={}));var gn;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(gn||(gn={}));class Wb{decodeTree;emitCodePoint;errors;constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r}state=pt.EntityStart;consumed=1;result=0;treeIndex=0;excess=1;decodeMode=gn.Strict;runConsumed=0;startEntity(t){this.decodeMode=t,this.state=pt.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(t,n){switch(this.state){case pt.EntityStart:return t.charCodeAt(n)===tt.NUM?(this.state=pt.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=pt.NamedEntity,this.stateNamedEntity(t,n));case pt.NumericStart:return this.stateNumericStart(t,n);case pt.NumericDecimal:return this.stateNumericDecimal(t,n);case pt.NumericHex:return this.stateNumericHex(t,n);case pt.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|Fc)===tt.LOWER_X?(this.state=pt.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=pt.NumericDecimal,this.stateNumericDecimal(t,n))}stateNumericHex(t,n){for(;n<t.length;){const r=t.charCodeAt(n);if(ki(r)||Ob(r)){const o=r<=tt.NINE?r-tt.ZERO:(r|Fc)-tt.LOWER_A+10;this.result=this.result*16+o,this.consumed++,n++}else return this.emitNumericEntity(r,3)}return-1}stateNumericDecimal(t,n){for(;n<t.length;){const r=t.charCodeAt(n);if(ki(r))this.result=this.result*10+(r-tt.ZERO),this.consumed++,n++;else return this.emitNumericEntity(r,2)}return-1}emitNumericEntity(t,n){if(this.consumed<=n)return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===tt.SEMI)this.consumed+=1;else if(this.decodeMode===gn.Strict)return 0;return this.emitCodePoint(Tb(this.result),this.consumed),this.errors&&(t!==tt.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,n){const{decodeTree:r}=this;let o=r[this.treeIndex],s=(o&vt.VALUE_LENGTH)>>14;for(;n<t.length;){if(s===0&&(o&vt.FLAG13)!==0){const a=(o&vt.BRANCH_LENGTH)>>7;if(this.runConsumed===0){const l=o&vt.JUMP_TABLE;if(t.charCodeAt(n)!==l)return this.result===0?0:this.emitNotTerminatedNamedEntity();n++,this.excess++,this.runConsumed++}for(;this.runConsumed<a;){if(n>=t.length)return-1;const l=this.runConsumed-1,u=r[this.treeIndex+1+(l>>1)],d=l%2===0?u&255:u>>8&255;if(t.charCodeAt(n)!==d)return this.runConsumed=0,this.result===0?0:this.emitNotTerminatedNamedEntity();n++,this.excess++,this.runConsumed++}this.runConsumed=0,this.treeIndex+=1+(a>>1),o=r[this.treeIndex],s=(o&vt.VALUE_LENGTH)>>14}if(n>=t.length)break;const i=t.charCodeAt(n);if(i===tt.SEMI&&s!==0&&(o&vt.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);if(this.treeIndex=Qb(r,o,this.treeIndex+Math.max(1,s),i),this.treeIndex<0)return this.result===0||this.decodeMode===gn.Attribute&&(s===0||Kb(i))?0:this.emitNotTerminatedNamedEntity();if(o=r[this.treeIndex],s=(o&vt.VALUE_LENGTH)>>14,s!==0){if(i===tt.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==gn.Strict&&(o&vt.FLAG13)===0&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}n++,this.excess++}return-1}emitNotTerminatedNamedEntity(){const{result:t,decodeTree:n}=this,r=(n[t]&vt.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),this.errors?.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:o}=this;return this.emitCodePoint(n===1?o[t]&~(vt.VALUE_LENGTH|vt.FLAG13):o[t+1],r),n===3&&this.emitCodePoint(o[t+2],r),r}end(){switch(this.state){case pt.NamedEntity:return this.result!==0&&(this.decodeMode!==gn.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case pt.NumericDecimal:return this.emitNumericEntity(0,2);case pt.NumericHex:return this.emitNumericEntity(0,3);case pt.NumericStart:return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case pt.EntityStart:return 0}}}function Lb(e){let t="";const n=new Wb(e,r=>t+=String.fromCodePoint(r));return function(o,s){let i=0,a=0;for(;(a=o.indexOf("&",a))>=0;){t+=o.slice(i,a),n.startEntity(s);const u=n.write(o,a+1);if(u<0){i=a+n.end();break}i=a+u,a=u===0?i+1:i}const l=t+o.slice(i);return t="",l}}function Qb(e,t,n,r){const o=(t&vt.BRANCH_LENGTH)>>7,s=t&vt.JUMP_TABLE;if(o===0)return s!==0&&r===s?n:-1;if(s){const u=r-s;return u<0||u>=o?-1:e[n+u]-1}const i=o+1>>1;let a=0,l=o-1;for(;a<=l;){const u=a+l>>>1,d=u>>1,A=e[n+d]>>(u&1)*8&255;if(A<r)a=u+1;else if(A>r)l=u-1;else return e[n+i+u]}return-1}const Gb=Lb(_b);function wf(e){return Gb(e,gn.Strict)}var Yb=class{src_Any=vf.source;src_Cc=yf.source;src_Z=If.source;src_P=za.source;src_ZPCc=[this.src_Z,this.src_P,this.src_Cc].join("|");src_ZCc=[this.src_Z,this.src_Cc].join("|");cache={};opts={maxLength:1e4,urlAuth:!1,schema_names:[]};constructor(e={}){this.opts={...this.opts,...e}}set(e={}){return this.opts={...this.opts,...e},this.cache={},this}escapeRE(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}nestedPairRE(e,t,n=4){const r=this.escapeRE(e),o=this.escapeRE(t),s=`(?:(?!${this.src_ZCc}|${r}|${o}).)`;let i=`${r}${s}{0,1000}${o}`;for(let a=2;a<=n;a++)i=`${r}(?:${s}|${i}){0,1000}${o}`;return i}get_text_separators(){return this.cache.text_separators??=/[><\uff5c]/}get_pseudo_letter(){return this.cache.src_pseudo_letter??=new RegExp(`(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`)}get_ipv4_addr(){return this.cache.src_ip4??=new RegExp("(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])")}get_ipv6_addr(){const e="[0-9A-Fa-f]{1,4}",t=`(?:(?:${e}:${e})|${this.get_ipv4_addr().source})`;return this.cache.src_ip6_addr??=new RegExp(`(?:(?:${e}:){6}${t}|::(?:${e}:){5}${t}|(?:${e})?::(?:${e}:){4}${t}|(?:(?:${e}:){0,1}${e})?::(?:${e}:){3}${t}|(?:(?:${e}:){0,2}${e})?::(?:${e}:){2}${t}|(?:(?:${e}:){0,3}${e})?::${e}:${t}|(?:(?:${e}:){0,4}${e})?::${t}|(?:(?:${e}:){0,5}${e})?::${e}|(?:(?:${e}:){0,6}${e})?::)`)}get_ipv6_url_host(){return this.cache.src_ip6_host??=new RegExp(`\\[${this.get_ipv6_addr().source}\\]`)}get_ipv6_mail_host(){return this.cache.src_ipv6_mail_host??=new RegExp(`\\[IPv6:${this.get_ipv6_addr().source}\\]`)}get_auth(){return this.cache.src_auth??=new RegExp(`(?:(?:(?!${this.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`)}get_port(){return this.cache.src_port??=new RegExp("(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?")}get_host_terminator(){return this.cache.src_host_terminator??=new RegExp(`(?=$|${this.get_text_separators().source}|${this.src_ZPCc})(?!${this.opts["---"]?"-(?!--)|":"-|"}_|:\\d|\\.-|\\.(?!$|${this.src_ZPCc}))`)}get_path_terminator(){return this.cache.src_path_terminator??=new RegExp(`${this.src_ZPCc}|${this.get_text_separators().source}`)}get_path(){return this.cache.src_path??=new RegExp(`(?:[/?#](?:${this.nestedPairRE("[","]")}|${this.nestedPairRE("(",")")}|${this.nestedPairRE("{","}")}|\\"(?:(?!${this.src_ZCc}|["]).){1,100}\\"|\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\'|\\'(?=${this.get_pseudo_letter().source}|[-])|\\.{2,20}[:]?[a-zA-Z0-9%/&]|\\.(?!${this.src_ZCc}|[.]|$)|`+(this.opts["---"]?"\\-(?!--(?:[^-]|$))(?:-{0,19})|":"\\-{1,20}|")+`,(?!${this.src_ZCc}|$)|;(?!${this.src_ZCc}|$)|\\!{1,20}(?!${this.src_ZCc}|[!]|$)|\\?(?!${this.src_ZCc}|[?]|$)|`+this.get_path_extra().source+`[\\\\/:%@#&=_~*]|(?!${this.get_path_terminator().source}).){1,${this.opts.maxLength}}|\\/)?`)}get_mail_name(){return this.cache.src_mail_name??=new RegExp("[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}")}get_xn(){return this.cache.src_xn??=new RegExp("xn--[a-z0-9\\-]{1,59}")}get_tld(){if(this.cache.tld)return this.cache.tld;const e=[...new Set(this.opts.tlds||[])].sort().reverse().join("|");return this.cache.tld=new RegExp(`${e||"$#none#$"}|${this.get_xn().source}`),this.cache.tld}get_domain_root(){return this.cache.src_domain_root??=new RegExp("(?:"+this.get_xn().source+`|${this.get_pseudo_letter().source}{1,63})`)}get_domain(){return this.cache.src_domain??=new RegExp("(?:"+this.get_xn().source+`|(?:${this.get_pseudo_letter().source})|(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source}))`)}get_url_host_port(){return this.cache.url_host_port??=new RegExp("(?:"+this.get_ipv6_url_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,10}${this.get_domain().source}))`+this.get_port().source+this.get_host_terminator().source)}get_fuzzy_url_host_port(){return this.cache.fuzzy_url_host_port??=new RegExp("(?:"+(this.opts.fuzzyIP?this.get_ipv4_addr().source+"|":"")+`(?:(?:(?:${this.get_domain().source})\\.){1,10}(?:${this.get_tld().source})))`+this.get_host_terminator().source)}get_mail_host(){return this.cache.src_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,4}${this.get_domain().source}))`+this.get_host_terminator().source)}get_fuzzy_mail_host(){return this.cache.src_fuzzy_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source}))`+this.get_host_terminator().source)}get_path_extra(){return this.cache.src_path_extra??=new RegExp("")}get_fuzzy_mail_host_search(){return this.cache.mail_fuzzy_host_search??=new RegExp(`@${this.get_fuzzy_mail_host().source}`,"ig")}get_fuzzy_link_search(){return this.cache.link_fuzzy_search??=new RegExp(`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${this.src_ZPCc}))(?:(?![$+<=>^\`||])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,"ig")}get_http_validator(){return this.cache.http_validator??=new RegExp("\\/\\/"+(this.opts.urlAuth?this.get_auth().source:"")+this.get_url_host_port().source+this.get_path().source,"iy")}get_relative_proto_validator(){return this.cache.relative_proto_validator??=new RegExp((this.opts.urlAuth?this.get_auth().source:"")+`(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})`+this.get_port().source+this.get_host_terminator().source+this.get_path().source,"iy")}get_mail_name_validator(){return this.cache.mail_name_validator??=new RegExp(`(?:^|${this.get_text_separators().source}|"|\\(|${this.src_ZCc})(${this.get_mail_name().source})$`)}get_mailto_validator(){return this.cache.mailto_validator??=new RegExp(`${this.get_mail_name().source}@${this.get_mail_host().source}`,"iy")}get_schema_names(){return this.cache.schema_names??=new RegExp((this.opts.schema_names||[]).map(e=>this.escapeRE(e)).join("|"))}get_schema_search(){return this.cache.schema_search??=new RegExp(`(^|(?!_)(?:[><|]|${this.src_ZPCc}))(${this.get_schema_names().source})`,"ig")}get_schema_at_start(){return this.cache.schema_at_start??=new RegExp(`^${this.get_schema_search().source}`,"i")}},Ws={validate:(e,t,n)=>{const r=n.re.get_http_validator();r.lastIndex=t;const o=r.exec(e);return o?o[0].length:0},normalize:(e,t)=>t.normalize(e)},zb={"http:":Ws,"https:":Ws,"ftp:":Ws,"//":{validate:function(e,t,n){const r=n.re.get_relative_proto_validator();r.lastIndex=t;const o=r.exec(e);return o?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:o[0].length:0},normalize:(e,t)=>t.normalize(e)},"mailto:":{validate:function(e,t,n){const r=n.re.get_mailto_validator();r.lastIndex=t;const o=r.exec(e);return o?o[0].length:0},normalize:(e,t)=>t.normalize(e)}},Ub="a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw",Vb="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф";function Zb(){const e=Vb.split("|");return Ub.split("|").forEach(t=>{const n=t.indexOf(":"),r=t.slice(0,n);for(const o of t.slice(n+1))e.push(r+o)}),e}var Jb={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:Zb(),urlAuth:!1,maxLength:1e4},Bc=class{schema;index;lastIndex;raw;text;url;constructor(e,t,n,r){const o=e.slice(n,r);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=r,this.raw=o,this.text=o,this.url=o}},$b=class{__opts__;__schemas__;re;constructor(e={}){const{rebuilder:t,...n}=e;this.__opts__={...Jb,...n},this.__schemas__={...zb},this.re=t||new Yb,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)})}add(e,t=null){if(!t)delete this.__schemas__[e];else{const n={normalize:(r,o)=>o.normalize(r),...t};this.__schemas__[e]=n}return this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}set(e={}){return this.__opts__={...this.__opts__,...e},this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}test(e){if(!e.length)return!1;let t,n;for(n=this.re.get_schema_search(),n.lastIndex=0;(t=n.exec(e))!==null;)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0;if(this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(n=this.re.get_fuzzy_link_search(),n.lastIndex=0,n.exec(e)!==null))return!0;if(this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&e.indexOf("@")>=0){const r=this.re.get_fuzzy_mail_host_search(),o=this.re.get_mail_name_validator();for(r.lastIndex=0;(t=r.exec(e))!==null;){const s=e.slice(Math.max(0,t.index-65),t.index);if(o.test(s))return!0}}return!1}testSchemaAt(e,t,n){return this.__schemas__[t.toLowerCase()]?this.__schemas__[t.toLowerCase()].validate(e.slice(0,n+this.__opts__.maxLength),n,this):0}match(e){const t=[],n=this.re.get_schema_search();let r,o,s,i,a,l,u=!1,d=!1,p=!1,A=0;if(!e.length)return null;for(n.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(r=this.re.get_fuzzy_link_search(),r.lastIndex=0),this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&(o=this.re.get_fuzzy_mail_host_search(),o.lastIndex=0,s=this.re.get_mail_name_validator());;){const m=Math.max(A-1,0);if(o&&s&&!p&&(!a||a.index<A))for(o.lastIndex<m&&(o.lastIndex=m);;){const v=o.exec(e);if(!v){p=!0,a=void 0;break}const y=s.exec(e.slice(Math.max(0,v.index-65),v.index));if(y){if(a={schema:"mailto:",index:v.index-y[1].length,lastIndex:v.index+v[0].length},a.index>=A)break;o.lastIndex<m&&(o.lastIndex=m)}}if(r&&!d&&(!i||i.index<A))for(r.lastIndex<m&&(r.lastIndex=m);;){const v=r.exec(e);if(!v){d=!0,i=void 0;break}if(i={schema:"",index:v.index+v[1].length,lastIndex:v.index+v[0].length},i.index>=A)break;r.lastIndex<m&&(r.lastIndex=m)}let h=a;(!h||i&&(i.index<h.index||i.index===h.index&&i.lastIndex>h.lastIndex))&&(h=i);let g;if(!u)for(;;){if(!l){n.lastIndex<m&&(n.lastIndex=m);const C=n.exec(e);if(!C){u=!0;break}l={schema:C[2],index:C.index+C[1].length,lastIndex:C.index+C[0].length}}if(l.index<A){l=void 0;continue}if(h&&l.index>h.index)break;const v=l;l=void 0;const y=this.testSchemaAt(e,v.schema,v.lastIndex);if(y){g={schema:v.schema,index:v.index,lastIndex:v.lastIndex+y};break}}let x=g;if((!x||a&&(a.index<x.index||a.index===x.index&&a.lastIndex>x.lastIndex))&&(x=a),(!x||i&&(i.index<x.index||i.index===x.index&&i.lastIndex>x.lastIndex))&&(x=i),!x)break;x===a?a=void 0:x===i&&(i=void 0);const b=new Bc(e,x.schema,x.index,x.lastIndex);b.schema?this.__schemas__[b.schema].normalize(b,this):this.normalize(b),t.push(b),A=x.lastIndex}return t.length?t:null}matchAtStart(e){if(!e.length)return null;const t=this.re.get_schema_at_start().exec(e);if(!t)return null;const n=this.testSchemaAt(e,t[2],t[0].length);if(!n)return null;const r=new Bc(e,t[2],t.index+t[1].length,t.index+t[0].length+n);return this.__schemas__[r.schema].normalize(r,this),r}tlds(e,t=!1){return e=Array.isArray(e)?e:[e],t?this.__opts__.tlds=this.__opts__.tlds.concat(e):this.__opts__.tlds=e,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}normalize(e){e.schema||(e.url=`http://${e.url}`),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)}};const Vn=2147483647,Gt=36,Ua=1,jr=26,Xb=38,qb=700,kf=72,Ef=128,Sf="-",ev=/^xn--/,tv=/[^\0-\x7F]/,nv=/[\x2E\u3002\uFF0E\uFF61]/g,rv={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Ls=Gt-Ua,Yt=Math.floor,Qs=String.fromCharCode;function pn(e){throw new RangeError(rv[e])}function ov(e,t){const n=[];let r=e.length;for(;r--;)n[r]=t(e[r]);return n}function Rf(e,t){const n=e.split("@");let r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(nv,".");const o=e.split("."),s=ov(o,t).join(".");return r+s}function Df(e){const t=[];let n=0;const r=e.length;for(;n<r;){const o=e.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){const s=e.charCodeAt(n++);(s&64512)==56320?t.push(((o&1023)<<10)+(s&1023)+65536):(t.push(o),n--)}else t.push(o)}return t}const sv=e=>String.fromCodePoint(...e),iv=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:Gt},jc=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},Ff=function(e,t,n){let r=0;for(e=n?Yt(e/qb):e>>1,e+=Yt(e/t);e>Ls*jr>>1;r+=Gt)e=Yt(e/Ls);return Yt(r+(Ls+1)*e/(e+Xb))},Bf=function(e){const t=[],n=e.length;let r=0,o=Ef,s=kf,i=e.lastIndexOf(Sf);i<0&&(i=0);for(let a=0;a<i;++a)e.charCodeAt(a)>=128&&pn("not-basic"),t.push(e.charCodeAt(a));for(let a=i>0?i+1:0;a<n;){const l=r;for(let d=1,p=Gt;;p+=Gt){a>=n&&pn("invalid-input");const A=iv(e.charCodeAt(a++));A>=Gt&&pn("invalid-input"),A>Yt((Vn-r)/d)&&pn("overflow"),r+=A*d;const m=p<=s?Ua:p>=s+jr?jr:p-s;if(A<m)break;const h=Gt-m;d>Yt(Vn/h)&&pn("overflow"),d*=h}const u=t.length+1;s=Ff(r-l,u,l==0),Yt(r/u)>Vn-o&&pn("overflow"),o+=Yt(r/u),r%=u,t.splice(r++,0,o)}return String.fromCodePoint(...t)},jf=function(e){const t=[];e=Df(e);const n=e.length;let r=Ef,o=0,s=kf;for(const l of e)l<128&&t.push(Qs(l));const i=t.length;let a=i;for(i&&t.push(Sf);a<n;){let l=Vn;for(const d of e)d>=r&&d<l&&(l=d);const u=a+1;l-r>Yt((Vn-o)/u)&&pn("overflow"),o+=(l-r)*u,r=l;for(const d of e)if(d<r&&++o>Vn&&pn("overflow"),d===r){let p=o;for(let A=Gt;;A+=Gt){const m=A<=s?Ua:A>=s+jr?jr:A-s;if(p<m)break;const h=p-m,g=Gt-m;t.push(Qs(jc(m+h%g,0))),p=Yt(h/g)}t.push(Qs(jc(p,0))),s=Ff(o,u,a===i),o=0,++a}++o,++r}return t.join("")},av=function(e){return Rf(e,function(t){return ev.test(t)?Bf(t.slice(4).toLowerCase()):t})},lv=function(e){return Rf(e,function(t){return tv.test(t)?"xn--"+jf(t):t})},Mc={version:"2.3.1",ucs2:{decode:Df,encode:sv},decode:Bf,encode:jf,toASCII:lv,toUnicode:av};var Nc=Object.defineProperty,Mf=(e,t)=>{let n={};for(var r in e)Nc(n,r,{get:e[r],enumerable:!0});return Nc(n,Symbol.toStringTag,{value:"Module"}),n},cv=Mf({arrayReplaceAt:()=>Tf,asciiTrim:()=>gs,callable:()=>Nf,escapeHtml:()=>yn,escapeRE:()=>bv,fromCodePoint:()=>Mr,isMdAsciiPunct:()=>Pr,isPunctChar:()=>_f,isPunctCharCode:()=>Tr,isSpace:()=>Ve,isValidEntityCode:()=>Va,isWhiteSpace:()=>Nr,lib:()=>vv,normalizeReference:()=>As,unescapeAll:()=>rr,unescapeMd:()=>pv});function Nf(e){const t=function(...n){return Reflect.construct(e,n,new.target&&new.target!==t?new.target:e)};return Object.defineProperty(t,"name",{value:e.name}),Object.setPrototypeOf(t,e),t.prototype=e.prototype,t}function Tf(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function Va(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function Mr(e){if(e>65535){e-=65536;const t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var Pf=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,uv=new RegExp(`${Pf.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`,"gi"),dv=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function fv(e,t){if(t.charCodeAt(0)===35&&dv.test(t)){const r=t[1].toLowerCase()==="x"?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Va(r)?Mr(r):e}const n=wf(e);return n!==e?n:e}function pv(e){return e.indexOf("\\")<0?e:e.replace(Pf,"$1")}function rr(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(uv,function(t,n,r){return n||fv(t,r)})}var hv=/[&<>"]/,Av=/[&<>"]/g,gv={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function mv(e){return gv[e]}function yn(e){return hv.test(e)?e.replace(Av,mv):e}var xv=/[.?*+^$[\]\\(){}|-]/g;function bv(e){return e.replace(xv,"\\$&")}function Ve(e){switch(e){case 9:case 32:return!0}return!1}function Nr(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function _f(e){return za.test(e)||Cf.test(e)}function Tr(e){return _f(Mr(e))}function Pr(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function As(e){return e=e.trim().replace(/\s+/g," "),e.toLowerCase().toUpperCase()}function Tc(e){return e===32||e===9||e===10||e===13}function gs(e){let t=0;for(;t<e.length&&Tc(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&Tc(e.charCodeAt(n));n--);return e.slice(t,n+1)}var vv={mdurl:Bb,ucmicro:Mb};function yv(e,t,n){let r,o,s,i;const a=e.posMax,l=e.pos;for(e.pos=t+1,r=1;e.pos<a;){if(s=e.src.charCodeAt(e.pos),s===93&&(r--,r===0)){o=!0;break}if(i=e.pos,e.md.inline.skipToken(e),s===91){if(i===e.pos-1)r++;else if(n)return e.pos=l,-1}}let u=-1;return o&&(u=e.pos),e.pos=l,u}function Cv(e,t,n){let r,o=t;const s={ok:!1,pos:0,str:""};if(e.charCodeAt(o)===60){for(o++;o<n;){if(r=e.charCodeAt(o),r===10||r===60)return s;if(r===62)return s.pos=o+1,s.str=rr(e.slice(t+1,o)),s.ok=!0,s;if(r===92&&o+1<n){o+=2;continue}o++}return s}let i=0;for(;o<n&&(r=e.charCodeAt(o),!(r===32||r<32||r===127));){if(r===92&&o+1<n){if(e.charCodeAt(o+1)===32){o++;continue}o+=2;continue}if(r===40&&(i++,i>32))return s;if(r===41){if(i===0)break;i--}o++}return t===o||i!==0||(s.str=rr(e.slice(t,o)),s.pos=o,s.ok=!0),s}function Iv(e,t,n,r){let o,s=t;const i={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)i.str=r.str,i.marker=r.marker;else{if(s>=n)return i;let a=e.charCodeAt(s);if(a!==34&&a!==39&&a!==40)return i;t++,s++,a===40&&(a=41),i.marker=a}for(;s<n;){if(o=e.charCodeAt(s),o===i.marker)return i.pos=s+1,i.str+=rr(e.slice(t,s)),i.ok=!0,i;if(o===40&&i.marker===41)return i;o===92&&s+1<n&&s++,s++}return i.can_continue=!0,i.str+=rr(e.slice(t,s)),i}var wv=Mf({parseLinkDestination:()=>Cv,parseLinkLabel:()=>yv,parseLinkTitle:()=>Iv});function _r(e){"@babel/helpers - typeof";return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_r(e)}function kv(e,t){if(_r(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(_r(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ev(e){var t=kv(e,"string");return _r(t)=="symbol"?t:t+""}function be(e,t,n){return(t=Ev(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Bn=class{constructor(e,t,n){be(this,"map",null),be(this,"level",0),be(this,"children",null),be(this,"content",""),be(this,"markup",""),be(this,"info",""),be(this,"block",!1),be(this,"hidden",!1),this.type=e,this.tag=t,this.attrs=null,this.nesting=n,this.meta=null}attrIndex(e){if(!this.attrs)return-1;const t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1}attrPush(e){this.attrs?this.attrs.push(e):this.attrs=[e]}attrSet(e,t){const n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r}attrGet(e){const t=this.attrIndex(e);let n=null;return t>=0&&(n=this.attrs[t][1]),n}attrJoin(e,t){const n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=`${this.attrs[n][1]} ${t}`}},Or=class{constructor(){be(this,"__rules__",[]),be(this,"__cache__",null)}__find__(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1}__compile__(){const e=new Set;this.__rules__.forEach(t=>{t.enabled&&t.alt.forEach(n=>{n&&e.add(n)})}),this.__cache__=Object.create(null),this.__cache__[""]=[],this.__rules__.forEach(t=>{t.enabled&&this.__cache__[""].push(t.fn)}),e.forEach(t=>{this.__cache__[t]=[],this.__rules__.forEach(n=>{n.enabled&&n.alt.indexOf(t)>=0&&this.__cache__[t].push(n.fn)})})}at(e,t,n={}){const r=this.__find__(e);if(r===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__[r].fn=t,this.__rules__[r].alt=n.alt||[],this.__cache__=null}before(e,t,n,r={}){const o=this.__find__(e);if(o===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(o,0,{name:t,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null}after(e,t,n,r={}){const o=this.__find__(e);if(o===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(o+1,0,{name:t,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null}push(e,t,n={}){this.__rules__.push({name:e,enabled:!0,fn:t,alt:n.alt||[]}),this.__cache__=null}enable(e,t=!1){Array.isArray(e)||(e=[e]);const n=[];return e.forEach(r=>{const o=this.__find__(r);if(o<0){if(t)return;throw new Error(`Rules manager: invalid rule name ${r}`)}this.__rules__[o].enabled=!0,n.push(r)}),this.__cache__=null,n}enableOnly(e,t=!1){Array.isArray(e)||(e=[e]),this.__rules__.forEach(n=>{n.enabled=!1}),this.enable(e,t)}disable(e,t=!1){Array.isArray(e)||(e=[e]);const n=[];return e.forEach(r=>{const o=this.__find__(r);if(o<0){if(t)return;throw new Error(`Rules manager: invalid rule name ${r}`)}this.__rules__[o].enabled=!1,n.push(r)}),this.__cache__=null,n}getRules(e){return this.__cache__||this.__compile__(),this.__cache__[e]||[]}},Jt={};Jt.code_inline=function(e,t,n,r,o){const s=e[t];return`<code${o.renderAttrs(s)}>${yn(s.content)}</code>`};Jt.code_block=function(e,t,n,r,o){const s=e[t];return`<pre${o.renderAttrs(s)}><code>${yn(e[t].content)}</code></pre>
6
+ `};Jt.fence=function(e,t,n,r,o){const s=e[t],i=s.info?rr(s.info).trim():"";let a="",l="";if(i){const d=i.split(/(\s+)/g);a=d[0],l=d.slice(2).join("")}let u;if(n.highlight?u=n.highlight(s.content,a,l)||yn(s.content):u=yn(s.content),u.indexOf("<pre")===0)return u+`
7
+ `;if(i){const d=s.attrIndex("class"),p=s.attrs?s.attrs.slice():[];d<0?p.push(["class",`${n.langPrefix}${a}`]):(p[d]=[p[d][0],p[d][1]],p[d][1]+=` ${n.langPrefix}${a}`);const A={attrs:p};return`<pre><code${o.renderAttrs(A)}>${u}</code></pre>
7
8
  `}return`<pre><code${o.renderAttrs(s)}>${u}</code></pre>
8
- `};zt.image=function(e,t,n,r,o){const s=e[t];return s.attrs[s.attrIndex("alt")][1]=o.renderInlineAsText(s.children,n,r),o.renderToken(e,t,n)};zt.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
9
+ `};Jt.image=function(e,t,n,r,o){const s=e[t];return s.attrs[s.attrIndex("alt")][1]=o.renderInlineAsText(s.children,n,r),o.renderToken(e,t,n)};Jt.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
9
10
  `:`<br>
10
- `};zt.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
11
+ `};Jt.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
11
12
  `:`<br>
12
13
  `:`
13
- `};zt.text=function(e,t){return vn(e[t].content)};zt.html_block=function(e,t){return e[t].content};zt.html_inline=function(e,t){return e[t].content};var Pf=class{constructor(){xe(this,"rules",Object.assign({},zt))}renderAttrs(e){let t,n,r;if(!e.attrs)return"";for(r="",t=0,n=e.attrs.length;t<n;t++)r+=` ${vn(e.attrs[t][0])}="${vn(String(e.attrs[t][1]))}"`;return r}renderToken(e,t,n){const r=e[t];let o="";if(r.hidden)return"";let s=t-1;for(;s>=0&&e[s].hidden&&e[s].nesting===0;)s--;r.block&&r.nesting!==-1&&s>=0&&e[s].hidden&&e[s].nesting===-1&&(o+=`
14
- `),o+=(r.nesting===-1?"</":"<")+r.tag,o+=this.renderAttrs(r),r.nesting===0&&n.xhtmlOut&&(o+=" /");let i=!1;if(r.block&&(i=!0,r.nesting===1)){let a=t+1;for(;a<e.length&&e[a].hidden&&e[a].nesting===0;)a++;if(a<e.length){const c=e[a];(c.type==="inline"||c.hidden||c.nesting===-1&&c.tag===r.tag)&&(i=!1)}}return o+=i?`>
14
+ `};Jt.text=function(e,t){return yn(e[t].content)};Jt.html_block=function(e,t){return e[t].content};Jt.html_inline=function(e,t){return e[t].content};var Of=class{constructor(){be(this,"rules",Object.assign({},Jt))}renderAttrs(e){let t,n,r;if(!e.attrs)return"";for(r="",t=0,n=e.attrs.length;t<n;t++)r+=` ${yn(e.attrs[t][0])}="${yn(String(e.attrs[t][1]))}"`;return r}renderToken(e,t,n){const r=e[t];let o="";if(r.hidden)return"";let s=t-1;for(;s>=0&&e[s].hidden&&e[s].nesting===0;)s--;r.block&&r.nesting!==-1&&s>=0&&e[s].hidden&&e[s].nesting===-1&&(o+=`
15
+ `),o+=(r.nesting===-1?"</":"<")+r.tag,o+=this.renderAttrs(r),r.nesting===0&&n.xhtmlOut&&(o+=" /");let i=!1;if(r.block&&(i=!0,r.nesting===1)){let a=t+1;for(;a<e.length&&e[a].hidden&&e[a].nesting===0;)a++;if(a<e.length){const l=e[a];(l.type==="inline"||l.hidden||l.nesting===-1&&l.tag===r.tag)&&(i=!1)}}return o+=i?`>
15
16
  `:">",o}renderInline(e,t,n){let r="";const o=this.rules;for(let s=0,i=e.length;s<i;s++){const a=e[s].type;typeof o[a]<"u"?r+=o[a](e,s,t,n,this):r+=this.renderToken(e,s,t)}return r}renderInlineAsText(e,t,n){let r="";for(let o=0,s=e.length;o<s;o++)switch(e[o].type){case"text":case"code_inline":r+=e[o].content;break;case"image":r+=this.renderInlineAsText(e[o].children,t,n);break;case"html_inline":case"html_block":r+=e[o].content;break;case"softbreak":case"hardbreak":r+=`
16
- `}return r}render(e,t,n){let r="";const o=this.rules;for(let s=0,i=e.length;s<i;s++){const a=e[s].type;a==="inline"?r+=this.renderInline(e[s].children,t,n):typeof o[a]<"u"?r+=o[a](e,s,t,n,this):r+=this.renderToken(e,s,t)}return r}},Tf=class{constructor(e,t,n){xe(this,"tokens",[]),xe(this,"inlineMode",!1),xe(this,"Token",Fn),this.src=e,this.env=n,this.md=t}},Bv=/\r\n?|\n/g,jv=/\0/g;function Mv(e){let t;t=e.src.replace(Bv,`
17
- `),t=t.replace(jv,"�"),e.src=t}function Pv(e){let t;e.inlineMode?(t=new e.Token("inline","",0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function Tv(e){const t=e.tokens;let n=0;for(let r=0;r<t.length;r++)t[r].type!=="reference_definition"&&(r!==n&&(t[n]=t[r]),n++);t.length!==n&&(t.length=n)}function Nv(e){const t=e.tokens;for(let n=0,r=t.length;n<r;n++){const o=t[n];o.type==="inline"&&e.md.inline.parse(o.content,e.md,e.env,o.children)}}function _v(e){return/^<a[>\s]/i.test(e)}function Ov(e){return/^<\/a\s*>/i.test(e)}function Hv(e){const t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!=="inline"||!e.md.linkify.test(t[n].content))continue;let o=t[n].children,s=0;for(let i=o.length-1;i>=0;i--){const a=o[i];if(a.type==="link_close"){for(i--;o[i].level!==a.level&&o[i].type!=="link_open";)i--;continue}if(a.type==="html_inline"&&(_v(a.content)&&s>0&&s--,Ov(a.content)&&s++),!(s>0)&&a.type==="text"&&e.md.linkify.test(a.content)){const c=a.content;let u=e.md.linkify.match(c);const f=[];let h=a.level,g=0;u.length>0&&u[0].index===0&&i>0&&o[i-1].type==="text_special"&&(u=u.slice(1));for(let A=0;A<u.length;A++){const p=u[A].url,m=e.md.normalizeLink(p);if(!e.md.validateLink(m))continue;let x=u[A].text;u[A].schema?u[A].schema==="mailto:"&&!/^mailto:/i.test(x)?x=e.md.normalizeLinkText(`mailto:${x}`).replace(/^mailto:/,""):x=e.md.normalizeLinkText(x):x=e.md.normalizeLinkText(`http://${x}`).replace(/^http:\/\//,"");const v=u[A].index;if(v>g){const w=new e.Token("text","",0);w.content=c.slice(g,v),w.level=h,f.push(w)}const b=new e.Token("link_open","a",1);b.attrs=[["href",m]],b.level=h++,b.markup="linkify",b.info="auto",f.push(b);const y=new e.Token("text","",0);y.content=x,y.level=h,f.push(y);const C=new e.Token("link_close","a",-1);C.level=--h,C.markup="linkify",C.info="auto",f.push(C),g=u[A].lastIndex}if(g<c.length){const A=new e.Token("text","",0);A.content=c.slice(g),A.level=h,f.push(A)}t[n].children=o=Bf(o,i,f)}}}}var Nf=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Lv=/\((c|tm|r)\)/i,Kv=/\((c|tm|r)\)/gi,Wv={c:"©",r:"®",tm:"™"};function Qv(e,t){return Wv[t.toLowerCase()]}function Gv(e){let t=0;for(let n=e.length-1;n>=0;n--){const r=e[n];r.type==="text"&&!t&&(r.content=r.content.replace(Kv,Qv)),r.type==="link_open"&&r.info==="auto"&&t--,r.type==="link_close"&&r.info==="auto"&&t++}}function Yv(e){let t=0;for(let n=e.length-1;n>=0;n--){const r=e[n];r.type==="text"&&!t&&Nf.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1—").replace(/(^|\s)--(?=\s|$)/gm,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1–")),r.type==="link_open"&&r.info==="auto"&&t--,r.type==="link_close"&&r.info==="auto"&&t++}}function zv(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(Lv.test(e.tokens[t].content)&&Gv(e.tokens[t].children),Nf.test(e.tokens[t].content)&&Yv(e.tokens[t].children))}var Uv=/['"]/,kc=/['"]/g,Ec="’";function ao(e,t,n,r){e[t]||(e[t]=[]),e[t].push({pos:n,ch:r})}function Vv(e,t){let n="",r=0;t.sort((o,s)=>o.pos-s.pos);for(let o=0;o<t.length;o++){const s=t[o];n+=e.slice(r,s.pos)+s.ch,r=s.pos+1}return n+e.slice(r)}function Zv(e,t){let n;const r=[],o={};for(let s=0;s<e.length;s++){const i=e[s],a=e[s].level;for(n=r.length-1;n>=0&&!(r[n].level<=a);n--);if(r.length=n+1,i.type!=="text")continue;const c=i.content;let u=0;const f=c.length;e:for(;u<f;){kc.lastIndex=u;const h=kc.exec(c);if(!h)break;let g=!0,A=!0;u=h.index+1;const p=h[0]==="'";let m=32;if(h.index-1>=0)m=c.charCodeAt(h.index-1);else for(n=s-1;n>=0&&!(e[n].type==="softbreak"||e[n].type==="hardbreak");n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let x=32;if(u<f)x=c.charCodeAt(u);else for(n=s+1;n<e.length&&!(e[n].type==="softbreak"||e[n].type==="hardbreak");n++)if(e[n].content){x=e[n].content.charCodeAt(0);break}const v=Nr(m)||Tr(m),b=Nr(x)||Tr(x),y=Pr(m),C=Pr(x);if(C?g=!1:b&&(y||v||(g=!1)),y?A=!1:v&&(C||b||(A=!1)),x===34&&h[0]==='"'&&m>=48&&m<=57&&(A=g=!1),g&&A&&(g=v,A=b),!g&&!A){p&&ao(o,s,h.index,Ec);continue}if(A)for(n=r.length-1;n>=0;n--){let w=r[n];if(r[n].level<a)break;if(w.single===p&&r[n].level===a){w=r[n];let I,S;p?(I=t.md.options.quotes[2],S=t.md.options.quotes[3]):(I=t.md.options.quotes[0],S=t.md.options.quotes[1]),ao(o,s,h.index,S),ao(o,w.token,w.pos,I),r.length=n;continue e}}g?r.push({token:s,pos:h.index,single:p,level:a}):A&&p&&ao(o,s,h.index,Ec)}}Object.keys(o).forEach(function(s){const i=Number(s);e[i].content=Vv(e[i].content,o[s])})}function Jv(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!=="inline"||!Uv.test(e.tokens[t].content)||Zv(e.tokens[t].children,e)}function $v(e){let t,n;const r=e.length;for(t=0;t<r;t++)e[t].type==="text_special"&&(e[t].type="text");for(t=n=0;t<r;t++)e[t].type==="text"&&t+1<r&&e[t+1].type==="text"?e[t+1].content=e[t].content+e[t+1].content:(t!==n&&(e[n]=e[t]),n++);t!==n&&(e.length=n)}function Xv(e){let t,n;const r=e.tokens,o=r.length;for(let s=0;s<o;s++){if(r[s].type!=="inline")continue;const i=r[s].children,a=i.length;for(t=0;t<a;t++)i[t].type==="text_special"&&(i[t].type="text"),i[t].children&&$v(i[t].children);for(t=n=0;t<a;t++)i[t].type==="text"&&t+1<a&&i[t+1].type==="text"?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var _s=[["normalize",Mv],["block",Pv],["strip_references",Tv],["inline",Nv],["linkify",Hv],["replacements",zv],["smartquotes",Jv],["text_join",Xv]],_f=class{constructor(){xe(this,"ruler",new Or),xe(this,"State",Tf);for(let e=0;e<_s.length;e++)this.ruler.push(_s[e][0],_s[e][1])}process(e){const t=this.ruler.getRules("");for(let n=0,r=t.length;n<r;n++)t[n](e)}},Of=class{constructor(e,t,n,r){xe(this,"bMarks",[]),xe(this,"eMarks",[]),xe(this,"tShift",[]),xe(this,"sCount",[]),xe(this,"bsCount",[]),xe(this,"blkIndent",0),xe(this,"line",0),xe(this,"lineMax",0),xe(this,"tight",!1),xe(this,"listIndent",-1),xe(this,"parentType","root"),xe(this,"level",0),xe(this,"Token",Fn),this.src=e,this.md=t,this.env=n,this.tokens=r;const o=this.src;for(let s=0,i=0,a=0,c=0,u=o.length,f=!1;i<u;i++){const h=o.charCodeAt(i);if(!f)if(Ve(h)){a++,h===9?c+=4-c%4:c++;continue}else f=!0;(h===10||i===u-1)&&(h!==10&&i++,this.bMarks.push(s),this.eMarks.push(i),this.tShift.push(a),this.sCount.push(c),this.bsCount.push(0),f=!1,a=0,c=0,s=i+1)}this.bMarks.push(o.length),this.eMarks.push(o.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}push(e,t,n){const r=new Fn(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e}skipSpaces(e){for(let t=this.src.length;e<t&&Ve(this.src.charCodeAt(e));e++);return e}skipSpacesBack(e,t){if(e<=t)return e;for(;e>t;)if(!Ve(this.src.charCodeAt(--e)))return e+1;return e}skipChars(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e}skipCharsBack(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e}getLines(e,t,n,r){if(e>=t)return"";const o=new Array(t-e);for(let s=0,i=e;i<t;i++,s++){let a=0;const c=this.bMarks[i];let u=c,f;for(i+1<t||r?f=this.eMarks[i]+1:f=this.eMarks[i];u<f&&a<n;){const h=this.src.charCodeAt(u);if(Ve(h))h===9?a+=4-(a+this.bsCount[i])%4:a++;else if(u-c<this.tShift[i])a++;else break;u++}a>n?o[s]=new Array(a-n+1).join(" ")+this.src.slice(u,f):o[s]=this.src.slice(u,f)}return o.join("")}},qv=65536;function Os(e,t){const n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function Sc(e){const t=[],n=e.length;let r=0,o=e.charCodeAt(r),s=!1,i=0,a="";for(;r<n;)o===124&&(s?(a+=e.substring(i,r-1),i=r):(t.push(a+e.substring(i,r)),a="",i=r+1)),s=o===92,r++,o=e.charCodeAt(r);return t.push(a+e.substring(i)),t}function ey(e,t,n,r){if(t+2>n)return!1;let o=t+1;if(e.sCount[o]<e.blkIndent||e.sCount[o]-e.blkIndent>=4)return!1;let s=e.bMarks[o]+e.tShift[o];if(s>=e.eMarks[o])return!1;const i=e.src.charCodeAt(s++);if(i!==124&&i!==45&&i!==58||s>=e.eMarks[o])return!1;const a=e.src.charCodeAt(s++);if(a!==124&&a!==45&&a!==58&&!Ve(a)||i===45&&Ve(a))return!1;for(;s<e.eMarks[o];){const C=e.src.charCodeAt(s);if(C!==124&&C!==45&&C!==58&&!Ve(C))return!1;s++}let c=Os(e,t+1),u=c.split("|");const f=[];for(let C=0;C<u.length;C++){const w=u[C].trim();if(!w){if(C===0||C===u.length-1)continue;return!1}if(!/^:?-+:?$/.test(w))return!1;w.charCodeAt(w.length-1)===58?f.push(w.charCodeAt(0)===58?"center":"right"):w.charCodeAt(0)===58?f.push("left"):f.push("")}if(c=Os(e,t).trim(),c.indexOf("|")===-1||e.sCount[t]-e.blkIndent>=4)return!1;u=Sc(c),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop();const h=u.length;if(h===0||h!==f.length)return!1;if(r)return!0;const g=e.parentType;e.parentType="table";const A=e.md.block.ruler.getRules("blockquote"),p=e.push("table_open","table",1),m=[t,0];p.map=m;const x=e.push("thead_open","thead",1);x.map=[t,t+1];const v=e.push("tr_open","tr",1);v.map=[t,t+1];for(let C=0;C<u.length;C++){const w=e.push("th_open","th",1);f[C]&&(w.attrs=[["style",`text-align:${f[C]}`]]);const I=e.push("inline","",0);I.content=u[C].trim(),I.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let b,y=0;for(o=t+2;o<n&&!(e.sCount[o]<e.blkIndent);o++){let C=!1;for(let I=0,S=A.length;I<S;I++)if(A[I](e,o,n,!0)){C=!0;break}if(C||(c=Os(e,o).trim(),!c)||e.sCount[o]-e.blkIndent>=4||(u=Sc(c),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop(),y+=h-u.length,y>qv))break;if(o===t+2){const I=e.push("tbody_open","tbody",1);I.map=b=[t+2,0]}const w=e.push("tr_open","tr",1);w.map=[o,o+1];for(let I=0;I<h;I++){const S=e.push("td_open","td",1);f[I]&&(S.attrs=[["style",`text-align:${f[I]}`]]);const R=e.push("inline","",0);R.content=u[I]?u[I].trim():"",R.children=[],e.push("td_close","td",-1)}e.push("tr_close","tr",-1)}return b&&(e.push("tbody_close","tbody",-1),b[1]=o),e.push("table_close","table",-1),m[1]=o,e.parentType=g,e.line=o,!0}function ty(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,o=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,o=r;continue}break}e.line=o;const s=e.push("code_block","code",0);return s.content=e.getLines(t,o,4+e.blkIndent,!1)+`
18
- `,s.map=[t,e.line],!0}function ny(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||o+3>s)return!1;const i=e.src.charCodeAt(o);if(i!==126&&i!==96)return!1;let a=o;o=e.skipChars(o,i);let c=o-a;if(c<3)return!1;const u=e.src.slice(a,o),f=e.src.slice(o,s);if(i===96&&f.indexOf(String.fromCharCode(i))>=0)return!1;if(r)return!0;let h=t,g=!1;for(;h++,!(h>=n||(o=a=e.bMarks[h]+e.tShift[h],s=e.eMarks[h],o<s&&e.sCount[h]<e.blkIndent));)if(e.src.charCodeAt(o)===i&&!(e.sCount[h]-e.blkIndent>=4)&&(o=e.skipChars(o,i),!(o-a<c)&&(o=e.skipSpaces(o),!(o<s)))){g=!0;break}c=e.sCount[t],e.line=h+(g?1:0);const A=e.push("fence","code",0);return A.info=f,A.content=e.getLines(t+1,h,c,!0),A.markup=u,A.map=[t,e.line],!0}function ry(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t];const i=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(o)!==62)return!1;if(r)return!0;const a=[],c=[],u=[],f=[],h=e.md.block.ruler.getRules("blockquote"),g=e.parentType;e.parentType="blockquote";let A=!1,p;for(p=t;p<n;p++){const y=e.sCount[p]<e.blkIndent;if(o=e.bMarks[p]+e.tShift[p],s=e.eMarks[p],o>=s)break;if(e.src.charCodeAt(o++)===62&&!y){let w=e.sCount[p]+1,I,S;e.src.charCodeAt(o)===32?(o++,w++,S=!1,I=!0):e.src.charCodeAt(o)===9?(I=!0,(e.bsCount[p]+w)%4===3?(o++,w++,S=!1):S=!0):I=!1;let R=w;for(a.push(e.bMarks[p]),e.bMarks[p]=o;o<s;){const E=e.src.charCodeAt(o);if(Ve(E))E===9?R+=4-(R+e.bsCount[p]+(S?1:0))%4:R++;else break;o++}A=o>=s,c.push(e.bsCount[p]),e.bsCount[p]=e.sCount[p]+1+(I?1:0),u.push(e.sCount[p]),e.sCount[p]=R-w,f.push(e.tShift[p]),e.tShift[p]=o-e.bMarks[p];continue}if(A)break;let C=!1;for(let w=0,I=h.length;w<I;w++)if(h[w](e,p,n,!0)){C=!0;break}if(C){e.lineMax=p,e.blkIndent!==0&&(a.push(e.bMarks[p]),c.push(e.bsCount[p]),f.push(e.tShift[p]),u.push(e.sCount[p]),e.sCount[p]-=e.blkIndent);break}a.push(e.bMarks[p]),c.push(e.bsCount[p]),f.push(e.tShift[p]),u.push(e.sCount[p]),e.sCount[p]=-1}const m=e.blkIndent;e.blkIndent=0;const x=e.push("blockquote_open","blockquote",1);x.markup=">";const v=[t,0];x.map=v,e.md.block.tokenize(e,t,p);const b=e.push("blockquote_close","blockquote",-1);b.markup=">",e.lineMax=i,e.parentType=g,v[1]=e.line;for(let y=0;y<f.length;y++)e.bMarks[y+t]=a[y],e.tShift[y+t]=f[y],e.sCount[y+t]=u[y],e.bsCount[y+t]=c[y];return e.blkIndent=m,!0}function oy(e,t,n,r){const o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let s=e.bMarks[t]+e.tShift[t];const i=e.src.charCodeAt(s++);if(i!==42&&i!==45&&i!==95)return!1;let a=1;for(;s<o;){const u=e.src.charCodeAt(s++);if(u!==i&&!Ve(u))return!1;u===i&&a++}if(a<3)return!1;if(r)return!0;e.line=t+1;const c=e.push("hr","hr",0);return c.map=[t,e.line],c.markup=Array(a+1).join(String.fromCharCode(i)),!0}function Rc(e,t){const n=e.eMarks[t];let r=e.bMarks[t]+e.tShift[t];const o=e.src.charCodeAt(r++);return o!==42&&o!==45&&o!==43||r<n&&!Ve(e.src.charCodeAt(r))?-1:r}function Dc(e,t){const n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];let o=n;if(o+1>=r)return-1;let s=e.src.charCodeAt(o++);if(s<48||s>57)return-1;for(;;){if(o>=r)return-1;if(s=e.src.charCodeAt(o++),s>=48&&s<=57){if(o-n>=10)return-1;continue}if(s===41||s===46)break;return-1}return o<r&&(s=e.src.charCodeAt(o),!Ve(s))?-1:o}function sy(e,t){const n=e.level+2;for(let r=t+2,o=e.tokens.length-2;r<o;r++)e.tokens[r].level===n&&e.tokens[r].type==="paragraph_open"&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function iy(e,t,n,r){let o,s,i,a,c=t,u=!0;if(e.sCount[c]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]<e.blkIndent)return!1;let f=!1;r&&e.parentType==="paragraph"&&e.sCount[c]>=e.blkIndent&&(f=!0);let h,g,A;if((A=Dc(e,c))>=0){if(h=!0,i=e.bMarks[c]+e.tShift[c],g=Number(e.src.slice(i,A-1)),f&&g!==1)return!1}else if((A=Rc(e,c))>=0)h=!1;else return!1;if(f&&e.skipSpaces(A)>=e.eMarks[c])return!1;if(r)return!0;const p=e.src.charCodeAt(A-1),m=e.tokens.length;h?(a=e.push("ordered_list_open","ol",1),g!==1&&(a.attrs=[["start",g]])):a=e.push("bullet_list_open","ul",1);const x=[c,0];a.map=x,a.markup=String.fromCharCode(p);let v=!1;const b=e.md.block.ruler.getRules("list"),y=e.parentType;for(e.parentType="list";c<n;){s=A,o=e.eMarks[c];const C=e.sCount[c]+A-(e.bMarks[c]+e.tShift[c]);let w=C;for(;s<o;){const D=e.src.charCodeAt(s);if(D===9)w+=4-(w+e.bsCount[c])%4;else if(D===32)w++;else break;s++}const I=s;let S;I>=o?S=1:S=w-C,S>4&&(S=1);const R=C+S;a=e.push("list_item_open","li",1),a.markup=String.fromCharCode(p);const E=[c,0];a.map=E,h&&(a.info=e.src.slice(i,A-1));const k=e.tight,F=e.tShift[c],T=e.sCount[c],N=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=R,e.tight=!0,e.tShift[c]=I-e.bMarks[c],e.sCount[c]=w,I>=o&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,c,n),(!e.tight||v)&&(u=!1),v=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=N,e.tShift[c]=F,e.sCount[c]=T,e.tight=k,a=e.push("list_item_close","li",-1),a.markup=String.fromCharCode(p),c=e.line,E[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let M=!1;for(let D=0,L=b.length;D<L;D++)if(b[D](e,c,n,!0)){M=!0;break}if(M)break;if(h){if(A=Dc(e,c),A<0)break;i=e.bMarks[c]+e.tShift[c]}else if(A=Rc(e,c),A<0)break;if(p!==e.src.charCodeAt(A-1))break}return h?a=e.push("ordered_list_close","ol",-1):a=e.push("bullet_list_close","ul",-1),a.markup=String.fromCharCode(p),x[1]=c,e.line=c,e.parentType=y,u&&sy(e,m),!0}function ay(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t],i=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(o)!==91)return!1;function a(C){const w=e.lineMax;if(C>=w||e.isEmpty(C))return null;let I=!1;if(e.sCount[C]-e.blkIndent>3&&(I=!0),e.sCount[C]<0&&(I=!0),!I){const E=e.md.block.ruler.getRules("reference"),k=e.parentType;e.parentType="reference";let F=!1;for(let T=0,N=E.length;T<N;T++)if(E[T](e,C,w,!0)){F=!0;break}if(e.parentType=k,F)return null}const S=e.bMarks[C]+e.tShift[C],R=e.eMarks[C];return e.src.slice(S,R+1)}let c=e.src.slice(o,s+1);s=c.length;let u=-1;for(o=1;o<s;o++){const C=c.charCodeAt(o);if(C===91)return!1;if(C===93){u=o;break}else if(C===10){const w=a(i);w!==null&&(c+=w,s=c.length,i++)}else if(C===92&&(o++,o<s&&c.charCodeAt(o)===10)){const w=a(i);w!==null&&(c+=w,s=c.length,i++)}}if(u<0||c.charCodeAt(u+1)!==58)return!1;for(o=u+2;o<s;o++){const C=c.charCodeAt(o);if(C===10){const w=a(i);w!==null&&(c+=w,s=c.length,i++)}else if(!Ve(C))break}const f=e.md.helpers.parseLinkDestination(c,o,s);if(!f.ok)return!1;const h=e.md.normalizeLink(f.str);if(!e.md.validateLink(h))return!1;o=f.pos;const g=o,A=i,p=o;for(;o<s;o++){const C=c.charCodeAt(o);if(C===10){const w=a(i);w!==null&&(c+=w,s=c.length,i++)}else if(!Ve(C))break}let m=e.md.helpers.parseLinkTitle(c,o,s);for(;m.can_continue;){const C=a(i);if(C===null)break;c+=C,o=s,s=c.length,i++,m=e.md.helpers.parseLinkTitle(c,o,s,m)}let x;for(o<s&&p!==o&&m.ok?(x=m.str,o=m.pos):(x="",o=g,i=A);o<s&&Ve(c.charCodeAt(o));)o++;if(o<s&&c.charCodeAt(o)!==10&&x)for(x="",o=g,i=A;o<s&&Ve(c.charCodeAt(o));)o++;if(o<s&&c.charCodeAt(o)!==10)return!1;const v=hs(c.slice(1,u));if(!v)return!1;if(r)return!0;typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[v]>"u"&&(e.env.references[v]={title:x,href:h});const b=e.push("reference_definition","",0);b.map=[t,i],b.hidden=!0;const y=Object.create(null);return y.label=v,b.meta=y,e.line=i,!0}var ly=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Hf=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,Lf="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",cy=new RegExp(`^(?:${Hf}|${Lf}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),uy=new RegExp(`^(?:${Hf}|${Lf})`),En=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Za-z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp(`^</?(${ly.join("|")})(?=(\\s|/?>|$))`,"i"),/^$/,!0],[new RegExp(`${uy.source}\\s*$`),/^$/,!1]];function dy(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(o)!==60)return!1;let i=e.src.slice(o,s),a=0;for(;a<En.length&&!En[a][0].test(i);a++);if(a===En.length)return!1;if(r)return En[a][2];let c=t+1;const u=En[a][1].test("");if(!En[a][1].test(i)){for(;c<n&&!(e.sCount[c]<e.blkIndent&&(u||!e.isEmpty(c)));c++)if(o=e.bMarks[c]+e.tShift[c],s=e.eMarks[c],i=e.src.slice(o,s),En[a][1].test(i)){i.length!==0&&c++;break}}e.line=c;const f=e.push("html_block","",0);return f.map=[t,c],f.content=e.getLines(t,c,e.blkIndent,!0),!0}function fy(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.src.charCodeAt(o);if(i!==35||o>=s)return!1;let a=1;for(i=e.src.charCodeAt(++o);i===35&&o<s&&a<=6;)a++,i=e.src.charCodeAt(++o);if(a>6||o<s&&!Ve(i))return!1;if(r)return!0;s=e.skipSpacesBack(s,o);const c=e.skipCharsBack(s,35,o);c>o&&Ve(e.src.charCodeAt(c-1))&&(s=c),e.line=t+1;const u=e.push("heading_open",`h${a}`,1);u.markup="########".slice(0,a),u.map=[t,e.line];const f=e.push("inline","",0);f.content=As(e.src.slice(o,s)),f.map=[t,e.line],f.children=[];const h=e.push("heading_close",`h${a}`,-1);return h.markup="########".slice(0,a),!0}function py(e,t,n){const r=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;const o=e.parentType;e.parentType="paragraph";let s=0,i,a=t+1;for(;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3)continue;if(e.sCount[a]>=e.blkIndent){let A=e.bMarks[a]+e.tShift[a];const p=e.eMarks[a];if(A<p&&(i=e.src.charCodeAt(A),(i===45||i===61)&&(A=e.skipChars(A,i),A=e.skipSpaces(A),A>=p))){s=i===61?1:2;break}}if(e.sCount[a]<0)continue;let g=!1;for(let A=0,p=r.length;A<p;A++)if(r[A](e,a,n,!0)){g=!0;break}if(g)break}if(!s)return e.parentType=o,!1;const c=As(e.getLines(t,a,e.blkIndent,!1));e.line=a+1;const u=e.push("heading_open",`h${s}`,1);u.markup=String.fromCharCode(i),u.map=[t,e.line];const f=e.push("inline","",0);f.content=c,f.map=[t,e.line-1],f.children=[];const h=e.push("heading_close",`h${s}`,-1);return h.markup=String.fromCharCode(i),e.parentType=o,!0}function hy(e,t,n){const r=e.md.block.ruler.getRules("paragraph"),o=e.parentType;let s=t+1;for(e.parentType="paragraph";s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3||e.sCount[s]<0)continue;let u=!1;for(let f=0,h=r.length;f<h;f++)if(r[f](e,s,n,!0)){u=!0;break}if(u)break}const i=As(e.getLines(t,s,e.blkIndent,!1));e.line=s;const a=e.push("paragraph_open","p",1);a.map=[t,e.line];const c=e.push("inline","",0);return c.content=i,c.map=[t,e.line],c.children=[],e.push("paragraph_close","p",-1),e.parentType=o,!0}var lo=[["table",ey,["paragraph","reference"]],["code",ty],["fence",ny,["paragraph","reference","blockquote","list"]],["blockquote",ry,["paragraph","reference","blockquote","list"]],["hr",oy,["paragraph","reference","blockquote","list"]],["list",iy,["paragraph","reference","blockquote"]],["reference",ay],["html_block",dy,["paragraph","reference","blockquote"]],["heading",fy,["paragraph","reference","blockquote"]],["lheading",py],["paragraph",hy]],Kf=class{constructor(){xe(this,"ruler",new Or),xe(this,"State",Of);for(let e=0;e<lo.length;e++)this.ruler.push(lo[e][0],lo[e][1],{alt:(lo[e][2]||[]).slice()})}tokenize(e,t,n){const r=this.ruler.getRules(""),o=r.length,s=e.md.options.maxNesting;let i=t,a=!1;for(;i<n&&(e.line=i=e.skipEmptyLines(i),!(i>=n||e.sCount[i]<e.blkIndent));){if(e.level>=s){e.line=n;break}const c=e.line;let u=!1;for(let f=0;f<o;f++)if(u=r[f](e,i,n,!1),u){if(c>=e.line)throw new Error("block rule didn't increment state.line");break}if(!u)throw new Error("none of the block rules matched");e.tight=!a,e.isEmpty(e.line-1)&&(a=!0),i=e.line,i<n&&e.isEmpty(i)&&(a=!0,i++,e.line=i)}}parse(e,t,n,r){if(!e)return;const o=new this.State(e,t,n,r);this.tokenize(o,o.line,o.lineMax)}},Wf=class{constructor(e,t,n,r){xe(this,"pos",0),xe(this,"level",0),xe(this,"pending",""),xe(this,"pendingLevel",0),xe(this,"cache",{}),xe(this,"backticks",{}),xe(this,"backticksScanned",!1),xe(this,"linkLevel",0),xe(this,"delimiters",[]),xe(this,"_prev_delimiters",[]),xe(this,"Token",Fn),this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.posMax=this.src.length}pushPending(){const e=new Fn("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e}push(e,t,n){this.pending&&this.pushPending();const r=new Fn(e,t,n);let o;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],o={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(o),r}scanDelims(e,t){const n=this.posMax,r=this.src.charCodeAt(e);let o;if(e===0)o=32;else if(e===1)o=this.src.charCodeAt(0),(o&63488)===55296&&(o=65533);else if(o=this.src.charCodeAt(e-1),(o&64512)===56320){const p=this.src.charCodeAt(e-2);o=(p&64512)===55296?65536+(p-55296<<10)+(o-56320):65533}else(o&64512)===55296&&(o=65533);let s=e;for(;s<n&&this.src.charCodeAt(s)===r;)s++;const i=s-e;let a=s<n?this.src.charCodeAt(s):32;if((a&64512)===55296){const p=this.src.charCodeAt(s+1);a=(p&64512)===56320?65536+(a-55296<<10)+(p-56320):65533}else(a&64512)===56320&&(a=65533);const c=Nr(o)||Tr(o),u=Nr(a)||Tr(a),f=Pr(o),h=Pr(a),g=!h&&(!u||f||c),A=!f&&(!c||h||u);return{can_open:g&&(t||!A||c),can_close:A&&(t||!g||u),length:i}}};function Ay(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function gy(e,t){let n=e.pos;for(;n<e.posMax&&!Ay(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var my=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function xy(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;const n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;const o=e.pending.match(my);if(!o)return!1;const s=o[1],i=e.md.linkify.matchAtStart(e.src.slice(n-s.length));if(!i)return!1;let a=i.url;if(a.length<=s.length)return!1;let c=a.length;for(;c>0&&a.charCodeAt(c-1)===42;)c--;c!==a.length&&(a=a.slice(0,c));const u=e.md.normalizeLink(a);if(!e.md.validateLink(u))return!1;if(!t){e.pending=e.pending.slice(0,-s.length);const f=e.push("link_open","a",1);f.attrs=[["href",u]],f.markup="linkify",f.info="auto";const h=e.push("text","",0);h.content=e.md.normalizeLinkText(a);const g=e.push("link_close","a",-1);g.markup="linkify",g.info="auto"}return e.pos+=a.length-s.length,!0}function by(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;const r=e.pending.length-1,o=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let s=r-1;for(;s>=1&&e.pending.charCodeAt(s-1)===32;)s--;e.pending=e.pending.slice(0,s),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(n++;n<o&&Ve(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var Wa=[];for(let e=0;e<256;e++)Wa.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){Wa[e.charCodeAt(0)]=1});function vy(e,t){let n=e.pos;const r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let o=e.src.charCodeAt(n);if(o===10){for(t||e.push("hardbreak","br",0),n++;n<r&&(o=e.src.charCodeAt(n),!!Ve(o));)n++;return e.pos=n,!0}if(o===32){if(!t){const a=e.push("text_special","",0);a.content="\\",a.markup="\\",a.info="escape"}return e.pos=n,!0}let s=e.src[n];if(o>=55296&&o<=56319&&n+1<r){const a=e.src.charCodeAt(n+1);a>=56320&&a<=57343&&(s+=e.src[n+1],n++)}const i="\\"+s;if(!t){const a=e.push("text_special","",0);o<256&&Wa[o]!==0?a.content=s:a.content=i,a.markup=i,a.info="escape"}return e.pos=n+1,!0}function yy(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;const r=n;n++;const o=e.posMax;for(;n<o&&e.src.charCodeAt(n)===96;)n++;const s=e.src.slice(r,n),i=s.length;if(e.backticksScanned&&(e.backticks[i]||0)<=r)return t||(e.pending+=s),e.pos+=i,!0;let a=n,c;for(;(c=e.src.indexOf("`",a))!==-1;){for(a=c+1;a<o&&e.src.charCodeAt(a)===96;)a++;const u=a-c;if(u===i){if(!t){const f=e.push("code_inline","code",0);f.markup=s,f.content=e.src.slice(n,c).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return e.pos=a,!0}e.backticks[u]=c}return e.backticksScanned=!0,t||(e.pending+=s),e.pos+=i,!0}function Cy(e,t){const n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;const o=e.scanDelims(e.pos,!0);let s=o.length;const i=String.fromCharCode(r);if(s<2)return!1;let a;s%2&&(a=e.push("text","",0),a.content=i,s--);for(let c=0;c<s;c+=2)a=e.push("text","",0),a.content=i+i,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function Fc(e,t){let n;const r=[],o=t.length;for(let s=0;s<o;s++){const i=t[s];if(i.marker!==126||i.end===-1)continue;const a=t[i.end];n=e.tokens[i.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=e.tokens[a.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="",e.tokens[a.token-1].type==="text"&&e.tokens[a.token-1].content==="~"&&r.push(a.token-1)}for(;r.length;){const s=r.pop();let i=s+1;for(;i<e.tokens.length&&e.tokens[i].type==="s_close";)i++;i--,s!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[s],e.tokens[s]=n)}}function Iy(e){const t=e.tokens_meta,n=e.tokens_meta.length;Fc(e,e.delimiters);for(let o=0;o<n;o++){var r;const s=(r=t[o])===null||r===void 0?void 0:r.delimiters;s&&Fc(e,s)}}var Qf={tokenize:Cy,postProcess:Iy};function wy(e,t){const n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;const o=e.scanDelims(e.pos,r===42);for(let s=0;s<o.length;s++){const i=e.push("text","",0);i.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:o.length,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close})}return e.pos+=o.length,!0}function Bc(e,t){const n=t.length;for(let r=n-1;r>=0;r--){const o=t[r];if(o.marker!==95&&o.marker!==42||o.end===-1)continue;const s=t[o.end],i=r>0&&t[r-1].end===o.end+1&&t[r-1].marker===o.marker&&t[r-1].token===o.token-1&&t[o.end+1].token===s.token+1,a=String.fromCharCode(o.marker),c=e.tokens[o.token];c.type=i?"strong_open":"em_open",c.tag=i?"strong":"em",c.nesting=1,c.markup=i?a+a:a,c.content="";const u=e.tokens[s.token];u.type=i?"strong_close":"em_close",u.tag=i?"strong":"em",u.nesting=-1,u.markup=i?a+a:a,u.content="",i&&(e.tokens[t[r-1].token].content="",e.tokens[t[o.end+1].token].content="",r--)}}function ky(e){const t=e.tokens_meta,n=e.tokens_meta.length;Bc(e,e.delimiters);for(let o=0;o<n;o++){var r;const s=(r=t[o])===null||r===void 0?void 0:r.delimiters;s&&Bc(e,s)}}var Gf={tokenize:wy,postProcess:ky};function Ey(e,t){let n,r,o,s,i="",a="",c=e.pos,u=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;const f=e.pos,h=e.posMax,g=e.pos+1,A=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(A<0)return!1;let p=A+1;if(p<h&&e.src.charCodeAt(p)===40){for(u=!1,p++;p<h&&(n=e.src.charCodeAt(p),!(!Ve(n)&&n!==10));p++);if(p>=h)return!1;if(c=p,o=e.md.helpers.parseLinkDestination(e.src,p,e.posMax),o.ok){for(i=e.md.normalizeLink(o.str),e.md.validateLink(i)?p=o.pos:i="",c=p;p<h&&(n=e.src.charCodeAt(p),!(!Ve(n)&&n!==10));p++);if(o=e.md.helpers.parseLinkTitle(e.src,p,e.posMax),p<h&&c!==p&&o.ok)for(a=o.str,p=o.pos;p<h&&(n=e.src.charCodeAt(p),!(!Ve(n)&&n!==10));p++);}(p>=h||e.src.charCodeAt(p)!==41)&&(u=!0),p++}if(u){if(typeof e.env.references>"u")return!1;if(p<h&&e.src.charCodeAt(p)===91?(c=p+1,p=e.md.helpers.parseLinkLabel(e,p),p>=0?r=e.src.slice(c,p++):p=A+1):p=A+1,r||(r=e.src.slice(g,A)),r=hs(r),s=e.env.references[r],!s)return e.pos=f,!1;i=s.href,a=s.title}if(!t){e.pos=g,e.posMax=A;const m=e.push("link_open","a",1),x=[["href",i]];if(m.attrs=x,a&&x.push(["title",a]),r){const v=Object.create(null);v.label=r,m.meta=v}e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=p,e.posMax=h,!0}function Sy(e,t){let n,r,o,s,i,a,c,u,f="";const h=e.pos,g=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const A=e.pos+2,p=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(p<0)return!1;if(s=p+1,s<g&&e.src.charCodeAt(s)===40){for(s++;s<g&&(n=e.src.charCodeAt(s),!(!Ve(n)&&n!==10));s++);if(s>=g)return!1;for(u=s,a=e.md.helpers.parseLinkDestination(e.src,s,e.posMax),a.ok&&(f=e.md.normalizeLink(a.str),e.md.validateLink(f)?s=a.pos:f=""),u=s;s<g&&(n=e.src.charCodeAt(s),!(!Ve(n)&&n!==10));s++);if(a=e.md.helpers.parseLinkTitle(e.src,s,e.posMax),s<g&&u!==s&&a.ok)for(c=a.str,s=a.pos;s<g&&(n=e.src.charCodeAt(s),!(!Ve(n)&&n!==10));s++);else c="";if(s>=g||e.src.charCodeAt(s)!==41)return e.pos=h,!1;s++}else{if(typeof e.env.references>"u")return!1;if(s<g&&e.src.charCodeAt(s)===91?(u=s+1,s=e.md.helpers.parseLinkLabel(e,s),s>=0?o=e.src.slice(u,s++):s=p+1):s=p+1,o||(o=e.src.slice(A,p)),o=hs(o),i=e.env.references[o],!i)return e.pos=h,!1;f=i.href,c=i.title}if(!t){r=e.src.slice(A,p);const m=[];e.md.inline.parse(r,e.md,e.env,m);const x=e.push("image","img",0),v=[["src",f],["alt",""]];if(x.attrs=v,x.children=m,x.content=r,c&&v.push(["title",c]),o){const b=Object.create(null);b.label=o,x.meta=b}}return e.pos=s,e.posMax=g,!0}var Ry=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,Dy=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Fy(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;const r=e.pos,o=e.posMax;for(;;){if(++n>=o)return!1;const i=e.src.charCodeAt(n);if(i===60)return!1;if(i===62)break}const s=e.src.slice(r+1,n);if(Dy.test(s)){const i=e.md.normalizeLink(s);if(!e.md.validateLink(i))return!1;if(!t){const a=e.push("link_open","a",1);a.attrs=[["href",i]],a.markup="autolink",a.info="auto";const c=e.push("text","",0);c.content=e.md.normalizeLinkText(s);const u=e.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return e.pos+=s.length+2,!0}if(Ry.test(s)){const i=e.md.normalizeLink(`mailto:${s}`);if(!e.md.validateLink(i))return!1;if(!t){const a=e.push("link_open","a",1);a.attrs=[["href",i]],a.markup="autolink",a.info="auto";const c=e.push("text","",0);c.content=e.md.normalizeLinkText(s);const u=e.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return e.pos+=s.length+2,!0}return!1}function By(e){return/^<a[>\s]/i.test(e)}function jy(e){return/^<\/a\s*>/i.test(e)}function My(e){const t=e|32;return t>=97&&t<=122}function Py(e,t){if(!e.md.options.html)return!1;const n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;const o=e.src.charCodeAt(r+1);if(o!==33&&o!==63&&o!==47&&!My(o))return!1;const s=e.src.slice(r).match(cy);if(!s)return!1;if(!t){const i=e.push("html_inline","",0);i.content=s[0],By(i.content)&&e.linkLevel++,jy(i.content)&&e.linkLevel--}return e.pos+=s[0].length,!0}var Ty=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Ny=/^&([a-z][a-z0-9]{1,31});/i;function _y(e,t){const n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){const o=e.src.slice(n).match(Ty);if(o){if(!t){const s=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),i=e.push("text_special","",0);i.content=Ka(s)?Mr(s):Mr(65533),i.markup=o[0],i.info="entity"}return e.pos+=o[0].length,!0}}else{const o=e.src.slice(n).match(Ny);if(o){const s=vf(o[0]);if(s!==o[0]){if(!t){const i=e.push("text_special","",0);i.content=s,i.markup=o[0],i.info="entity"}return e.pos+=o[0].length,!0}}}return!1}function jc(e){const t={},n=e.length;if(!n)return;let r=0,o=-2;const s=[];for(let i=0;i<n;i++){const a=e[i];if(s.push(0),(e[r].marker!==a.marker||o!==a.token-1)&&(r=i),o=a.token,a.length=a.length||0,!a.close)continue;t.hasOwnProperty(a.marker)||(t[a.marker]=[-1,-1,-1,-1,-1,-1]);const c=t[a.marker][(a.open?3:0)+a.length%3];let u=r-s[r]-1,f=u;for(;u>c;u-=s[u]+1){const h=e[u];if(h.marker===a.marker&&h.open&&h.end<0){let g=!1;if((h.close||a.open)&&(h.length+a.length)%3===0&&(h.length%3!==0||a.length%3!==0)&&(g=!0),!g){const A=u>0&&!e[u-1].open?s[u-1]+1:0;s[i]=i-u+A,s[u]=A,a.open=!1,h.end=i,h.close=!1,f=-1,o=-2;break}}}f!==-1&&(t[a.marker][(a.open?3:0)+(a.length||0)%3]=f)}}function Oy(e){const t=e.tokens_meta,n=e.tokens_meta.length;jc(e.delimiters);for(let o=0;o<n;o++){var r;const s=(r=t[o])===null||r===void 0?void 0:r.delimiters;s&&jc(s)}}function Hy(e){let t,n,r=0;const o=e.tokens,s=e.tokens.length;for(t=n=0;t<s;t++)o[t].nesting<0&&r--,o[t].level=r,o[t].nesting>0&&r++,o[t].type==="text"&&t+1<s&&o[t+1].type==="text"?o[t+1].content=o[t].content+o[t+1].content:(t!==n&&(o[n]=o[t]),n++);t!==n&&(o.length=n)}var Hs=[["text",gy],["linkify",xy],["newline",by],["escape",vy],["backticks",yy],["strikethrough",Qf.tokenize],["emphasis",Gf.tokenize],["link",Ey],["image",Sy],["autolink",Fy],["html_inline",Py],["entity",_y]],Ls=[["balance_pairs",Oy],["strikethrough",Qf.postProcess],["emphasis",Gf.postProcess],["fragments_join",Hy]],Yf=class{constructor(){xe(this,"ruler",new Or),xe(this,"ruler2",new Or),xe(this,"State",Wf);for(let e=0;e<Hs.length;e++)this.ruler.push(Hs[e][0],Hs[e][1]);for(let e=0;e<Ls.length;e++)this.ruler2.push(Ls[e][0],Ls[e][1])}skipToken(e){const t=e.pos,n=this.ruler.getRules(""),r=n.length,o=e.md.options.maxNesting,s=e.cache;if(typeof s[t]<"u"){e.pos=s[t];return}let i=!1;if(e.level<o){for(let a=0;a<r;a++)if(e.level++,i=n[a](e,!0),e.level--,i){if(t>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;i||e.pos++,s[t]=e.pos}tokenize(e){const t=this.ruler.getRules(""),n=t.length,r=e.posMax,o=e.md.options.maxNesting;for(;e.pos<r;){const s=e.pos;let i=!1;if(e.level<o){for(let a=0;a<n;a++)if(i=t[a](e,!1),i){if(s>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(i){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()}parse(e,t,n,r){const o=new this.State(e,t,n,r);this.tokenize(o);const s=this.ruler2.getRules(""),i=s.length;for(let a=0;a<i;a++)s[a](o)}},Ly={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","strip_references","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","strip_references","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}}},Ky=/^(vbscript|javascript|file|data):/,Wy=/^data:image\/(gif|png|jpeg|webp);/,Mc=["http:","https:","mailto:"],Ut=class{validateLink(e){const t=e.trim().toLowerCase();return Ky.test(t)?Wy.test(t):!0}normalizeLink(e){const t=mi(e,!0);if(t.hostname&&(!t.protocol||Mc.indexOf(t.protocol)>=0))try{t.hostname=Cc.toASCII(t.hostname)}catch{}return Vr(gi(t))}normalizeLinkText(e){const t=mi(e,!0);if(t.hostname&&(!t.protocol||Mc.indexOf(t.protocol)>=0))try{t.hostname=Cc.toUnicode(t.hostname)}catch{}return nr(gi(t),nr.defaultChars+"%")}constructor(...e){xe(this,"inline",new Yf),xe(this,"block",new Kf),xe(this,"core",new _f),xe(this,"renderer",new Pf),xe(this,"linkify",new tv),xe(this,"utils",pv),xe(this,"helpers",Object.assign({},Rv));const[t,n]=e;typeof t=="string"?(this.configure(t),n&&this.set(n)):(this.configure("default"),this.set(t||{}))}set(e){return Object.assign(this.options,e),this}configure(e){let t;if(typeof e=="string"){const o=e;if(t=Ly[o],!t)throw new Error(`Wrong 'markdown-it' preset "${o}", check name`)}else t=e;if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");t.options&&(this.options={...t.options});const n=t.components;if(n){var r;["core","block","inline"].forEach(s=>{var i;const a=(i=n[s])===null||i===void 0?void 0:i.rules;a&&this[s].ruler.enableOnly(a)});const o=(r=n.inline)===null||r===void 0?void 0:r.rules2;o&&this.inline.ruler2.enableOnly(o)}return this}enable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(o=>{n=n.concat(this[o].ruler.enable(e,!0))}),n=n.concat(this.inline.ruler2.enable(e,!0));const r=e.filter(o=>n.indexOf(o)<0);if(r.length&&!t)throw new Error(`MarkdownIt. Failed to enable unknown rule(s): ${r}`);return this}disable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(o=>{n=n.concat(this[o].ruler.disable(e,!0))}),n=n.concat(this.inline.ruler2.disable(e,!0));const r=e.filter(o=>n.indexOf(o)<0);if(r.length&&!t)throw new Error(`MarkdownIt. Failed to disable unknown rule(s): ${r}`);return this}use(e,...t){return e.apply(e,[this,...t]),this}parse(e,t){if(typeof e!="string")throw new Error("Input data should be a String");const n=new this.core.State(e,this,t);return this.core.process(n),n.tokens}render(e,t={}){return this.renderer.render(this.parse(e,t),this.options,t)}parseInline(e,t){const n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens}renderInline(e,t={}){return this.renderer.render(this.parseInline(e,t),this.options,t)}};xe(Ut,"Token",Fn);xe(Ut,"Ruler",Or);xe(Ut,"Renderer",Pf);xe(Ut,"ParserCore",_f);xe(Ut,"StateCore",Tf);xe(Ut,"ParserBlock",Kf);xe(Ut,"StateBlock",Of);xe(Ut,"ParserInline",Yf);xe(Ut,"StateInline",Wf);var Qy=Ff(Ut),Ks,Pc;function Gy(){return Pc||(Pc=1,Ks=function(t,n){var r=3,o="-",s=o.charCodeAt(0),i=o.length;function a(c,u,f,h){var g,A,p,m,x,v,b,y=!1,C=c.bMarks[u]+c.tShift[u],w=c.eMarks[u];if(u!==0||s!==c.src.charCodeAt(0))return!1;for(g=C+1;g<=w;g++)if(o[(g-C)%i]!==c.src[g]){b=g+1;break}if(p=Math.floor((g-C)/i),p<r)return!1;if(g-=(g-C)%i,h)return!0;for(A=u;A++,!(A>=f||c.src.slice(C,w)==="..."||(C=c.bMarks[A]+c.tShift[A],w=c.eMarks[A],C<w&&c.sCount[A]<c.blkIndent));)if(s===c.src.charCodeAt(C)&&!(c.sCount[A]-c.blkIndent>=4)){for(g=C+1;g<=w&&o[(g-C)%i]===c.src[g];g++);if(!(Math.floor((g-C)/i)<p)&&(g-=(g-C)%i,g=c.skipSpaces(g),!(g<w))){y=!0;break}}return x=c.parentType,v=c.lineMax,c.parentType="container",c.lineMax=A,m=c.push("front_matter",null,0),m.hidden=!0,m.markup=c.src.slice(u,g),m.block=!0,m.map=[u,A+(y?1:0)],m.meta=c.src.slice(b,C-1),c.parentType=x,c.lineMax=v,c.line=A+(y?1:0),n(m.meta),!0}t.block.ruler.before("table","front_matter",a,{alt:["paragraph","reference","blockquote","list"]})}),Ks}var Yy=Gy();const zy=jp(Yy);var Uy=Object.defineProperty,Vy=Object.defineProperties,Zy=Object.getOwnPropertyDescriptors,Tc=Object.getOwnPropertySymbols,Jy=Object.prototype.hasOwnProperty,$y=Object.prototype.propertyIsEnumerable,Nc=(e,t,n)=>t in e?Uy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lt=(e,t)=>{for(var n in t||(t={}))Jy.call(t,n)&&Nc(e,n,t[n]);if(Tc)for(var n of Tc(t))$y.call(t,n)&&Nc(e,n,t[n]);return e},Hr=(e,t)=>Vy(e,Zy(t)),To=(e,t,n)=>new Promise((r,o)=>{var s=c=>{try{a(n.next(c))}catch(u){o(u)}},i=c=>{try{a(n.throw(c))}catch(u){o(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(s,i);a((n=n.apply(e,t)).next())});function Xy(e,t){return typeof e=="function"?e(t):e}function Lr(e,t){return n=>{t.setState(r=>Hr(lt({},r),{[e]:Xy(n,r[e])}))}}var _c=(e,t=100,n=1e3)=>new Promise(r=>{let o;const s=setInterval(()=>{e()&&(r(),clearInterval(s),clearTimeout(o))},t);o=setTimeout(()=>{clearInterval(s),r()},n)}),zf="Headless Tree: ",bi=e=>Error(zf+e),qy=e=>console.warn(zf+e),eC={key:"tree",getInitialState:e=>lt({expandedItems:[],focusedItem:null},e),getDefaultConfig:(e,t)=>lt({setExpandedItems:Lr("expandedItems",t),setFocusedItem:Lr("focusedItem",t)},e),stateHandlerNames:{expandedItems:"setExpandedItems",focusedItem:"setFocusedItem"},treeInstance:{getItemsMeta:({tree:e})=>{const{rootItemId:t}=e.getConfig(),{expandedItems:n}=e.getState(),r=[],o=new Set(n),s=(c,u,f,h,g)=>{var A;if(u.includes(c)){qy(`Circular reference for ${u.join(".")}`);return}if(r.push({itemId:c,level:f,index:r.length,parentId:u.at(-1),setSize:h,posInSet:g}),o.has(c)){const p=(A=e.retrieveChildrenIds(c))!=null?A:[];let m=0;for(const x of p)s(x,u.concat(c),f+1,p.length,m++)}},i=e.retrieveChildrenIds(t);let a=0;for(const c of i)s(c,[t],0,i.length,a++);return r},getFocusedItem:({tree:e})=>{var t;const n=e.getState().focusedItem;return(t=n!==null?e.getItemInstance(n):null)!=null?t:e.getItems()[0]},getRootItem:({tree:e})=>{const{rootItemId:t}=e.getConfig();return e.getItemInstance(t)},focusNextItem:({tree:e})=>{var t;const n=e.getFocusedItem().getItemMeta();if(!n)return;const r=Math.min(n.index+1,e.getItems().length-1);(t=e.getItems()[r])==null||t.setFocused()},focusPreviousItem:({tree:e})=>{var t;const n=e.getFocusedItem().getItemMeta();if(!n)return;const r=Math.max(n.index-1,0);(t=e.getItems()[r])==null||t.setFocused()},updateDomFocus:({tree:e})=>{setTimeout(()=>To(null,null,function*(){var t,n,r,o,s;const i=e.getFocusedItem();(n=(t=e.getConfig()).scrollToItem)==null||n.call(t,i),yield _c(()=>i.getElement()!==null,20,500);const a=i.getElement();if(!a){(r=e.getItems()[0])==null||r.setFocused(),(s=(o=e.getItems()[0])==null?void 0:o.getElement())==null||s.focus();return}a.focus()}))},getContainerProps:({prev:e,tree:t},n)=>Hr(lt({},e?.()),{role:"tree","aria-label":n??"",ref:t.registerElement}),isSearchOpen:()=>!1},itemInstance:{scrollTo:(e,t)=>To(null,[e,t],function*({tree:n,item:r},o){var s,i,a;(i=(s=n.getConfig()).scrollToItem)==null||i.call(s,r),yield _c(()=>r.getElement()!==null,20),(a=r.getElement())==null||a.scrollIntoView(o)}),getId:({itemId:e})=>e,getKey:({itemId:e})=>e,getProps:({item:e,prev:t})=>{const n=e.getItemMeta();return Hr(lt({},t?.()),{ref:e.registerElement,role:"treeitem","aria-setsize":n.setSize,"aria-posinset":n.posInSet+1,"aria-selected":"false","aria-label":e.getItemName(),"aria-level":n.level+1,"aria-expanded":e.isFolder()?e.isExpanded():void 0,tabIndex:e.isFocused()?0:-1,onClick:r=>{e.setFocused(),e.primaryAction(),!(r.ctrlKey||r.shiftKey||r.metaKey)&&e.isFolder()&&(e.isExpanded()?e.collapse():e.expand())}})},expand:({tree:e,item:t,itemId:n})=>{var r;t.isFolder()&&((r=e.getState().loadingItemChildrens)!=null&&r.includes(n)||(e.applySubStateUpdate("expandedItems",o=>[...o,n]),e.rebuildTree()))},collapse:({tree:e,item:t,itemId:n})=>{t.isFolder()&&(e.applySubStateUpdate("expandedItems",r=>r.filter(o=>o!==n)),e.rebuildTree())},getItemData:({tree:e,itemId:t})=>e.retrieveItemData(t),equals:({item:e},t)=>e.getId()===t?.getId(),isExpanded:({tree:e,itemId:t})=>e.getState().expandedItems.includes(t),isDescendentOf:({item:e},t)=>{const n=e.getParent();return!!(n?.getId()===t||n?.isDescendentOf(t))},isFocused:({tree:e,item:t,itemId:n})=>e.getState().focusedItem===n||e.getState().focusedItem===null&&t.getItemMeta().index===0,isFolder:({tree:e,item:t,itemId:n})=>n===e.getConfig().rootItemId||e.getConfig().isItemFolder(t),getItemName:({tree:e,item:t})=>e.getConfig().getItemName(t),setFocused:({tree:e,itemId:t})=>{e.applySubStateUpdate("focusedItem",t)},primaryAction:({tree:e,item:t})=>{var n,r;return(r=(n=e.getConfig()).onPrimaryAction)==null?void 0:r.call(n,t)},getParent:({tree:e,item:t})=>t.getItemMeta().parentId?e.getItemInstance(t.getItemMeta().parentId):void 0,getIndexInParent:({item:e})=>e.getItemMeta().posInSet,getChildren:({tree:e,itemId:t})=>e.retrieveChildrenIds(t).map(n=>e.getItemInstance(n)),getTree:({tree:e})=>e,getItemAbove:({tree:e,item:t})=>e.getItems()[t.getItemMeta().index-1],getItemBelow:({tree:e,item:t})=>e.getItems()[t.getItemMeta().index+1]},hotkeys:{focusNextItem:{hotkey:"ArrowDown",canRepeat:!0,preventDefault:!0,isEnabled:e=>{var t,n;return!((n=(t=e.isSearchOpen)==null?void 0:t.call(e))!=null&&n)&&!e.getState().dnd},handler:(e,t)=>{t.focusNextItem(),t.updateDomFocus()}},focusPreviousItem:{hotkey:"ArrowUp",canRepeat:!0,preventDefault:!0,isEnabled:e=>{var t,n;return!((n=(t=e.isSearchOpen)==null?void 0:t.call(e))!=null&&n)&&!e.getState().dnd},handler:(e,t)=>{t.focusPreviousItem(),t.updateDomFocus()}},expandOrDown:{hotkey:"ArrowRight",canRepeat:!0,handler:(e,t)=>{const n=t.getFocusedItem();n.isExpanded()||!n.isFolder()?(t.focusNextItem(),t.updateDomFocus()):n.expand()}},collapseOrUp:{hotkey:"ArrowLeft",canRepeat:!0,handler:(e,t)=>{var n;const r=t.getFocusedItem();(!r.isExpanded()||!r.isFolder())&&r.getItemMeta().level!==0?((n=r.getParent())==null||n.setFocused(),t.updateDomFocus()):r.collapse()}},focusFirstItem:{hotkey:"Home",handler:(e,t)=>{var n;(n=t.getItems()[0])==null||n.setFocused(),t.updateDomFocus()}},focusLastItem:{hotkey:"End",handler:(e,t)=>{var n;(n=t.getItems()[t.getItems().length-1])==null||n.setFocused(),t.updateDomFocus()}}}},tC=(e,t,n)=>{const r={};return[r,()=>{const s=n(r);e:for(let i=0;i<e.length;i++){const a=e[i][t];if(!a)continue e;t:for(const[c,u]of Object.entries(a)){if(!u)continue t;const f=r[c];r[c]=(...h)=>u(Hr(lt({},s),{prev:f}),...h)}}}]},nC=e=>{var t;const n=e?.map(r=>r.key);for(const r of e??[]){const o=(t=r.deps)==null?void 0:t.find(s=>!n?.includes(s));if(o)throw bi(`${r.key} needs ${o}`)}},rC=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)for(let o=r+1;o<n;o++)t(e[o],e[r])<0&&([e[r],e[o]]=[e[o],e[r]]);return e},oC=e=>(t,n)=>{var r,o;return n.key&&((r=t.overwrites)!=null&&r.includes(n.key))?1:t.key&&((o=n.overwrites)!=null&&o.includes(t.key))?-1:e.indexOf(t)-e.indexOf(n)},sC=(e=[])=>rC(e,oC(e)),iC=e=>{var t,n,r,o;const s=(t=e.instanceBuilder)!=null?t:tC,i=[eC,...sC(e.features)];nC(i);const a=[...i],[c,u]=s(a,"treeInstance",E=>({tree:E}));let f=i.reduce((E,k)=>{var F,T;return(T=(F=k.getInitialState)==null?void 0:F.call(k,E,c))!=null?T:E},(r=(n=e.initialState)!=null?n:e.state)!=null?r:{}),h=i.reduce((E,k)=>{var F,T;return(T=(F=k.getDefaultConfig)==null?void 0:F.call(k,E,c))!=null?T:E},e);const g=i.reduce((E,k)=>lt(lt({},E),k.stateHandlerNames),{});let A;const p={current:{}};let m=!1;const x={};let v=[];const b={},y={};let C={};const w={},I=()=>{v=[],C={};const[E,k]=s(a,"itemInstance",F=>({item:F,tree:c,itemId:h.rootItemId}));k(),x[h.rootItemId]=E,C[h.rootItemId]={itemId:h.rootItemId,index:-1,parentId:null,level:-1,posInSet:0,setSize:1};for(const F of c.getItemsMeta())if(C[F.itemId]=F,x[F.itemId])v.push(x[F.itemId]);else{const[T,N]=s(a,"itemInstance",M=>({item:M,tree:c,itemId:F.itemId}));N(),x[F.itemId]=T,v.push(T)}m=!1},S=E=>{for(const k of i)E(k)},R={key:"main",treeInstance:{getState:()=>f,setState:({},E)=>{var k;(k=h.setState)==null||k.call(h,f)},setMounted:({},E)=>{var k;const F=p.current;F.isMounted=E,E&&((k=F.waitingForMount)==null||k.forEach(T=>T()),F.waitingForMount=[])},applySubStateUpdate:({},E,k)=>{var F;const T=()=>{f[E]=typeof k=="function"?k(f[E]):k;const M=h[g[E]];M?.(f[E])},N=p.current;N.isMounted?T():((F=N.waitingForMount)!=null||(N.waitingForMount=[]),N.waitingForMount.push(T))},rebuildTree:()=>{var E,k;const F=p.current;F.isMounted?(I(),(E=h.setState)==null||E.call(h,f)):((k=F.waitingForMount)!=null||(F.waitingForMount=[]),F.waitingForMount.push(()=>{var T;I(),(T=h.setState)==null||T.call(h,f)}))},scheduleRebuildTree:()=>{m=!0},getConfig:()=>h,setConfig:(E,k)=>{var F,T,N;const M=typeof k=="function"?k(h):k,D=((F=M.state)==null?void 0:F.expandedItems)&&((T=M.state)==null?void 0:T.expandedItems)!==f.expandedItems;h=M,M.state&&(f=lt(lt({},f),M.state)),D&&(I(),(N=h.setState)==null||N.call(h,f))},getItemInstance:({},E)=>{const k=x[E];if(!k){const[F,T]=s(a,"itemInstance",N=>({item:N,tree:c,itemId:E}));return T(),F}return k},getItems:()=>(m&&I(),v),registerElement:({},E)=>{A!==E&&(A&&!E?S(k=>{var F;return(F=k.onTreeUnmount)==null?void 0:F.call(k,c,A)}):!A&&E&&S(k=>{var F;return(F=k.onTreeMount)==null?void 0:F.call(k,c,E)}),A=E)},getElement:()=>A,getDataRef:()=>p,getHotkeyPresets:()=>w},itemInstance:{registerElement:({itemId:E,item:k},F)=>{if(b[E]===F)return;const T=b[E];T&&!F?S(N=>{var M;return(M=N.onItemUnmount)==null?void 0:M.call(N,k,T,c)}):!T&&F&&S(N=>{var M;return(M=N.onItemMount)==null?void 0:M.call(N,k,F,c)}),b[E]=F},getElement:({itemId:E})=>b[E],getDataRef:({itemId:E})=>{var k;return(k=y[E])!=null?k:y[E]={current:{}}},getItemMeta:({itemId:E})=>{var k;return(k=C[E])!=null?k:{itemId:E,parentId:null,level:-1,index:-1,posInSet:0,setSize:1}}}};a.unshift(R);for(const E of a)Object.assign(w,(o=E.hotkeys)!=null?o:{});return u(),c},aC={key:"selection",getInitialState:e=>lt({selectedItems:[]},e),getDefaultConfig:(e,t)=>lt({setSelectedItems:Lr("selectedItems",t)},e),stateHandlerNames:{selectedItems:"setSelectedItems"},treeInstance:{setSelectedItems:({tree:e},t)=>{e.applySubStateUpdate("selectedItems",t)},getSelectedItems:({tree:e})=>e.getState().selectedItems.map(e.getItemInstance)},itemInstance:{select:({tree:e,itemId:t})=>{const{selectedItems:n}=e.getState();e.setSelectedItems(n.includes(t)?n:[...n,t])},deselect:({tree:e,itemId:t})=>{const{selectedItems:n}=e.getState();e.setSelectedItems(n.filter(r=>r!==t))},isSelected:({tree:e,itemId:t})=>{const{selectedItems:n}=e.getState();return n.includes(t)},selectUpTo:({tree:e,item:t,itemId:n},r)=>{const o=t.getItemMeta().index,s=e.getDataRef();if(!s.current.selectUpToAnchorId){s.current.selectUpToAnchorId=n,e.setSelectedItems([n]);return}const a=e.getItemInstance(s.current.selectUpToAnchorId).getItemMeta().index,[c,u]=o<a?[o,a]:[a,o],f=e.getItems().slice(c,u+1).map(A=>A.getItemMeta().itemId);if(!r){e.setSelectedItems(f);return}const{selectedItems:h}=e.getState(),g=[...new Set([...h,...f])];e.setSelectedItems(g)},toggleSelect:({item:e})=>{e.isSelected()?e.deselect():e.select()},getProps:({tree:e,item:t,itemId:n,prev:r})=>Hr(lt({},r?.()),{"aria-selected":t.isSelected()?"true":"false",onClick:o=>{var s,i;o.shiftKey?t.selectUpTo(o.ctrlKey||o.metaKey):o.ctrlKey||o.metaKey?t.toggleSelect():e.setSelectedItems([n]),o.shiftKey||(e.getDataRef().current.selectUpToAnchorId=n),(i=(s=r?.())==null?void 0:s.onClick)==null||i.call(s,o)}})},hotkeys:{toggleSelectedItem:{hotkey:"Control+Space",preventDefault:!0,handler:(e,t)=>{t.getFocusedItem().toggleSelect()}},selectUpwards:{hotkey:"Shift+ArrowUp",handler:(e,t)=>{const n=t.getFocusedItem(),r=n.getItemAbove();r&&(n.isSelected()&&r.isSelected()?n.deselect():r.select(),r.setFocused(),t.updateDomFocus())}},selectDownwards:{hotkey:"Shift+ArrowDown",handler:(e,t)=>{const n=t.getFocusedItem(),r=n.getItemBelow();r&&(n.isSelected()&&r.isSelected()?n.deselect():r.select(),r.setFocused(),t.updateDomFocus())}},selectAll:{hotkey:"Control+KeyA",preventDefault:!0,handler:(e,t)=>{t.setSelectedItems(t.getItems().map(n=>n.getId()))}}}},Oc=e=>e.code!==""&&e.code!=="Unidentified"?e.code:e.key,Hc={letter:/^Key[A-Z]$/,letterornumber:/^(Key[A-Z]|Digit[0-9])$/,plus:/^(NumpadAdd|Plus)$/,minus:/^(NumpadSubtract|Minus)$/,control:/^(ControlLeft|ControlRight)$/,shift:/^(ShiftLeft|ShiftRight)$/,metaorcontrol:/^(MetaLeft|MetaRight|ControlLeft|ControlRight)$/,enter:/^(Enter|NumpadEnter)$/},Lc=new Set(["MetaLeft","MetaRight","Meta","ControlLeft","ControlRight","Control","AltLeft","AltRight","Alt","ShiftLeft","ShiftRight","Shift"]),lC=(e,t,n)=>{const r=n.hotkey.toLowerCase().split("+"),o=r.every(i=>{if(i in Hc)return[...e].some(c=>Hc[i].test(c));const a=[...e].map(c=>c.toLowerCase());return a.includes(i.toLowerCase())||a.includes(`key${i.toLowerCase()}`)}),s=!n.isEnabled||n.isEnabled(t);return o&&s&&e.size===r.length},cC=(e,t,n,r)=>{var o;return(o=Object.entries(lt(lt({},n),r)).find(([,s])=>lC(e,t,s)))==null?void 0:o[0]},Ws={clearPressedKeys:e=>{e.current.pressedKeys=new Set},dispatchKeyDown:(e,t,n,r={})=>{var o,s,i,a,c;const{isInputFocused:u=!1,releaseAfterDispatch:f=!1}=r,{ignoreHotkeysOnInputs:h,onTreeHotkey:g,hotkeys:A}=e.getConfig();if(u&&h)return;const p=Oc({code:(o=n.code)!=null?o:"",key:(s=n.key)!=null?s:""});(a=(i=t.current).pressedKeys)!=null||(i.pressedKeys=new Set);const m=!t.current.pressedKeys.has(p);p&&t.current.pressedKeys.add(p);const x=cC(t.current.pressedKeys,e,e.getHotkeyPresets(),A);if(f&&p&&t.current.pressedKeys.delete(p),!x)return;const v=lt(lt({},e.getHotkeyPresets()[x]),A?.[x]);v&&(!v.allowWhenInputFocused&&u||!v.canRepeat&&!m||(v.preventDefault&&((c=n.preventDefault)==null||c.call(n)),v.handler(n,e),g?.(x,n)))},dispatchKeyUp:(e,t)=>{var n,r,o,s;const i=Oc({code:(n=t.code)!=null?n:"",key:(r=t.key)!=null?r:""});i&&((s=(o=e.current).pressedKeys)!=null||(o.pressedKeys=new Set),Lc.has(i)&&(e.current.pressedKeys=new Set([...e.current.pressedKeys].filter(a=>Lc.has(a)))),e.current.pressedKeys.delete(i))}},uC={key:"hotkeys-core",onTreeMount:(e,t)=>{const n=e.getDataRef(),r=i=>{const a=i.target instanceof HTMLInputElement;Ws.dispatchKeyDown(e,n,i,{isInputFocused:a,releaseAfterDispatch:a})},o=i=>{Ws.dispatchKeyUp(n,i)},s=()=>{Ws.clearPressedKeys(n)};t.addEventListener("keydown",r),document.addEventListener("keyup",o),window.addEventListener("focus",s),n.current.keydownHandler=r,n.current.keyupHandler=o,n.current.resetHandler=s},onTreeUnmount:(e,t)=>{const n=e.getDataRef();n.current.keyupHandler&&(document.removeEventListener("keyup",n.current.keyupHandler),delete n.current.keyupHandler),n.current.keydownHandler&&(t.removeEventListener("keydown",n.current.keydownHandler),delete n.current.keydownHandler),n.current.resetHandler&&(window.removeEventListener("focus",n.current.resetHandler),delete n.current.resetHandler)}},dC="sync dataLoader returned undefined",fC="sync dataLoader returned promise",Qs=e=>{if(!e)throw bi(dC);if(typeof e=="object"&&"then"in e)throw bi(fC);return e},pC={key:"sync-data-loader",getInitialState:e=>lt({loadingItemData:[],loadingItemChildrens:[]},e),getDefaultConfig:(e,t)=>lt({setLoadingItemData:Lr("loadingItemData",t),setLoadingItemChildrens:Lr("loadingItemChildrens",t)},e),stateHandlerNames:{loadingItemData:"setLoadingItemData",loadingItemChildrens:"setLoadingItemChildrens"},treeInstance:{waitForItemDataLoaded:()=>To(null,null,function*(){}),waitForItemChildrenLoaded:()=>To(null,null,function*(){}),retrieveItemData:({tree:e},t)=>Qs(e.getConfig().dataLoader.getItem(t)),retrieveChildrenIds:({tree:e},t)=>{const{dataLoader:n}=e.getConfig();return"getChildren"in n?Qs(n.getChildren(t)):Qs(n.getChildrenWithData(t)).map(r=>r.data)},loadItemData:({tree:e},t)=>e.retrieveItemData(t),loadChildrenIds:({tree:e},t)=>e.retrieveChildrenIds(t)},itemInstance:{isLoading:()=>!1,hasLoadedData:()=>!0}},hC=Object.defineProperty,AC=Object.defineProperties,gC=Object.getOwnPropertyDescriptors,Kc=Object.getOwnPropertySymbols,mC=Object.prototype.hasOwnProperty,xC=Object.prototype.propertyIsEnumerable,Wc=(e,t,n)=>t in e?hC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,co=(e,t)=>{for(var n in t||(t={}))mC.call(t,n)&&Wc(e,n,t[n]);if(Kc)for(var n of Kc(t))xC.call(t,n)&&Wc(e,n,t[n]);return e},bC=(e,t)=>AC(e,gC(t)),vC=e=>{const[t]=d.useState(()=>({current:iC(e)})),[n,r]=d.useState(()=>t.current.getState());return d.useEffect(()=>(t.current.setMounted(!0),t.current.rebuildTree(),()=>{t.current.setMounted(!1)}),[t]),t.current.setConfig(o=>bC(co(co({},o),e),{state:co(co({},n),e.state),setState:s=>{var i;r(s),(i=e.setState)==null||i.call(e,s)}})),t.current};const yC=/^(https?:|mailto:|#|\.\/|#\/)/iu,CC=e=>e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;"),Mn=Qy({html:!1,linkify:!0,typographer:!1,breaks:!1});zy(Mn,()=>{});Mn.core.ruler.push("render_front_matter",e=>{for(const t of e.tokens)t.type==="front_matter"&&(t.type="fence",t.tag="code",t.info="yaml",t.content=String(t.meta??"").replace(/\n$/,""),t.block=!0);return!0});Mn.validateLink=e=>yC.test(e.trim());const Uf=e=>{for(const t of e)t.type==="link_open"&&(t.attrSet("rel","noreferrer noopener"),t.attrSet("target","_blank")),t.children!==null&&Uf(t.children)};Mn.core.ruler.push("external_links",e=>(Uf(e.tokens),!0));Mn.renderer.rules.fence=(e,t)=>{const n=e[t];return`<pre class="tech-ltr"><code${n.info.trim().length>0?` class="language-${CC(n.info.trim())}"`:""}>${Mn.utils.escapeHtml(n.content)}</code></pre>
19
- `};const IC=e=>Mn.render(e),wC=["prose prose-sm","dark:prose-invert","max-w-[75ch]","prose-headings:font-semibold prose-headings:tracking-tight","prose-h1:text-xl prose-h2:text-lg prose-h3:text-base","prose-p:my-2 prose-li:my-0.5","prose-code:before:content-none prose-code:after:content-none","prose-code:font-mono prose-code:text-[0.85em]","prose-pre:bg-muted prose-pre:text-foreground prose-pre:rounded-lg","prose-a:text-primary prose-a:decoration-primary/40 hover:prose-a:decoration-primary","prose-table:border-collapse prose-table:text-xs","prose-th:border prose-th:border-border prose-th:bg-muted prose-th:px-2 prose-th:py-1 prose-th:text-start prose-th:font-semibold","prose-td:border prose-td:border-border prose-td:px-2 prose-td:py-1 prose-td:align-top","prose-td:font-mono","prose-hr:border-border prose-blockquote:border-primary/40"].join(" "),kC=(e,t)=>e.children!==void 0?t?l.jsx(ah,{"aria-hidden":!0,className:"pointer-events-none size-4 text-amber-500"}):l.jsx(ch,{"aria-hidden":!0,className:"pointer-events-none size-4 text-amber-500"}):l.jsx(sh,{"aria-hidden":!0,className:"pointer-events-none size-4 text-muted-foreground"}),Qc=16,EC=({entries:e,selected:t,onSelect:n})=>{const r=d.useMemo(()=>{const c=new Map;for(const f of e){const h=f.path.split("/"),g=h[h.length-1]??f.path;f.type==="directory"?c.set(f.path,{name:g,path:f.path,children:[]}):c.set(f.path,{name:g,path:f.path})}for(const f of e){const h=f.path.split("/");for(let g=1;g<h.length;g+=1){const A=h.slice(0,g).join("/");c.has(A)||c.set(A,{name:h[g-1]??A,path:A,children:[]})}}for(const f of c.values())f.children!==void 0&&(f.children=[...c.values()].filter(h=>h.path!==""&&h.path.split("/").slice(0,-1).join("/")===f.path).map(h=>h.path));const u={name:"skill",path:"",children:[]};return u.children=[...c.values()].filter(f=>f.path!==""&&f.path.split("/").length===1).map(f=>f.path),c.set("root",u),Object.fromEntries(c)},[e]),o=d.useMemo(()=>Object.values(r).filter(c=>c.children!==void 0&&c.path!=="").map(c=>c.path),[r]),[s,i]=d.useState([t]),a=vC({initialState:{selectedItems:[t],expandedItems:o},setSelectedItems:c=>{i(u=>{const f=typeof c=="function"?c(u):c,h=f[0];return h!==void 0&&r[h]?.children===void 0&&h!=="root"&&n(h),f})},indent:Qc,rootItemId:"root",getItemName:c=>c.getItemData().name,isItemFolder:c=>(c.getItemData()?.children?.length??0)>0,dataLoader:{getItem:c=>r[c]??{name:c,path:""},getChildren:c=>r[c]?.children??[]},features:[pC,aC,uC]});return l.jsx(Cb,{indent:Qc,tree:a,children:a.getItems().map(c=>{const u=c.getItemData(),f=u.children===void 0&&u.path!=="";return l.jsx(Ib,{item:c,onClick:()=>{f&&n(u.path)},children:l.jsx(wb,{className:"tech-ltr relative before:bg-background before:absolute before:inset-x-0 before:-inset-y-0.5 before:-z-10",children:l.jsxs("span",{className:"flex items-center gap-2",children:[kC(u,c.isExpanded()),c.getItemName()]})})},c.getId())})})},SC=()=>{const{messages:e}=ps(),[t,n]=d.useState([]),[r,o]=d.useState("SKILL.md"),[s,i]=d.useState(null),[a,c]=d.useState(null),[u,f]=d.useState(!0),[h,g]=d.useState(!1);d.useEffect(()=>{(async()=>{const p=await Ex();p.status===200?n(p.data):c(e.help.readError),f(!1)})()},[e.help.readError]),d.useEffect(()=>{g(!0),c(null),(async()=>{const p=await Sx(r);p.status===200&&"content"in p.data?i(p.data.content):(i(null),c(e.help.readError)),g(!1)})()},[r,e.help.readError]);const A=d.useMemo(()=>s===null?"":IC(s),[s]);return l.jsxs("section",{className:"flex h-full min-h-0 overflow-hidden","aria-label":e.help.title,children:[l.jsx("nav",{className:"w-64 shrink-0 overflow-y-auto border-e border-border p-2","aria-label":e.help.listTitle,children:u?l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"h-5 w-full"}),l.jsx(qt,{className:"h-5 w-4/5"}),l.jsx(qt,{className:"h-5 w-3/5"})]}):t.length===0?l.jsx("p",{className:"text-muted-foreground px-2 text-xs",children:e.help.empty}):l.jsx(EC,{entries:t,selected:r,onSelect:o})}),l.jsx("article",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-6","aria-live":"polite",children:h?l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"h-6 w-1/2"}),l.jsx(qt,{className:"h-4 w-full"}),l.jsx(qt,{className:"h-4 w-5/6"})]}):a!==null?l.jsx("p",{className:"text-destructive text-sm",children:a}):l.jsx("div",{className:wC,dangerouslySetInnerHTML:{__html:A}})})]})},Vf=e=>`/api/icon-composed/${e}?token=${encodeURIComponent(new URLSearchParams(location.search).get("token")??"")}`,RC={cwd:"",env:[],argsMode:"string",family:null},Qa=new URLSearchParams(location.search).get("token")??"",Ke=(e,t={})=>fetch(e,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${Qa}`},body:JSON.stringify(t)}),DC=()=>new EventSource(`/api/events?token=${encodeURIComponent(Qa)}`),Qn=(e,t)=>`/api/icon-data/${e}/${t}?token=${encodeURIComponent(Qa)}`,vi=e=>{try{return new URL(e).hostname}catch{return e}};function FC({values:e,defaults:t,frozen:n,iconCandidates:r,iconCandidatesPort:o,uploadedIconUrl:s,selectedIconRef:i,iconAnalysis:a,iconComposition:c,iconComposeError:u,iconBackground:f,iconScale:h,onIconBackgroundChange:g,onIconScaleChange:A,onPickIconCandidate:p,onUploadIcon:m,onClearIcon:x,onPatch:v}){const b=n,y=d.useRef(null),[C,w]=d.useState(!1);return l.jsxs("div",{className:"grid grid-cols-1 gap-y-1",children:[l.jsxs("div",{children:[l.jsx(Me,{children:"应用图标"}),l.jsxs("div",{className:"mt-1.5 flex flex-wrap items-start gap-3",children:[l.jsx("button",{type:"button",disabled:b,"aria-label":"选择本地图片作为应用图标",onClick:()=>y.current?.click(),onDragOver:I=>{I.preventDefault(),b||w(!0)},onDragLeave:()=>w(!1),onDrop:I=>{if(I.preventDefault(),w(!1),b)return;const S=I.dataTransfer.files[0];S!==void 0&&m(S)},className:fe("flex size-20 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-dashed border-border bg-popover transition-colors",b?"opacity-50":"hover:border-primary",C&&"border-primary bg-primary/10"),children:s!==void 0?l.jsx("img",{src:s,alt:"已选图标",className:"icon-checker size-full rounded object-contain"}):l.jsxs("span",{className:"flex flex-col items-center gap-1 text-muted-foreground",children:[l.jsx(xu,{className:"size-4"}),l.jsx("span",{className:"text-[10px] leading-tight",children:"点击或拖入图片"})]})}),l.jsx("input",{ref:y,type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden",disabled:b,onChange:I=>{const S=I.target.files?.[0];S!==void 0&&m(S),I.target.value=""}}),l.jsx("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:r.length===0?l.jsx("span",{className:"text-xs text-muted-foreground",children:"未抓取到候选图标;将使用首字母图标"}):r.map(I=>{const S=o===void 0?void 0:Qn(o,I.index),R=i===`${o}:${I.index}`,E=i===void 0&&I.index===0;return l.jsx("button",{type:"button",disabled:b,title:`${I.width}×${I.height} ${I.format.toUpperCase()}`,onClick:()=>p(I),className:fe("icon-checker flex size-14 items-center justify-center overflow-hidden rounded-lg border p-1 transition-all",R||E?"border-primary ring-2 ring-primary/60":"border-border hover:border-primary/60",b&&"opacity-50"),children:S!==void 0?l.jsx("img",{src:S,alt:`候选图标 ${I.width}×${I.height}`,className:"size-full object-contain"}):null},I.index)})}),i!==void 0||s!==void 0?l.jsx("button",{type:"button",disabled:b,onClick:x,className:"text-[11px] text-muted-foreground underline-offset-2 hover:underline",children:"清除选择(回到默认)"}):null]}),l.jsx("div",{className:"mt-3 rounded-lg border border-border p-3",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{role:"img",className:"icon-checker size-14 shrink-0 overflow-hidden rounded-[10px]","aria-label":"图标合成预览",children:c!==void 0?l.jsx("img",{src:Vf(c.key),alt:"图标合成预览",className:"size-full object-contain",onError:I=>{I.currentTarget.style.display="none"}}):l.jsx("span",{className:"flex size-full items-center justify-center text-[10px] text-muted-foreground",children:"预览"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx(Me,{children:"图标背景"}),l.jsx("div",{className:"mt-1.5 flex gap-1.5",children:["black","white","transparent"].map(I=>l.jsxs("button",{type:"button",disabled:b,"aria-pressed":f===I,onClick:()=>g(I),className:fe("flex h-7 items-center gap-1.5 rounded-md border px-2.5 text-[11px] transition-colors",f===I?"border-foreground bg-secondary text-secondary-foreground":"border-border text-muted-foreground hover:border-foreground/40"),children:[I==="black"?"黑色":I==="white"?"白色":"透明",a!==void 0&&a.suggested===I?l.jsx("span",{className:"text-[10px] text-muted-foreground/70",children:"自动"}):null]},I))}),l.jsxs("div",{className:"mt-2.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(Me,{className:"text-[11px]",children:"前景缩放"}),l.jsxs("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[Math.round(h*100),"%"]})]}),l.jsx("input",{type:"range",min:50,max:95,step:5,value:Math.round(h*100),disabled:b,onChange:I=>A(Number(I.target.value)/100),className:"mt-1 w-full accent-foreground","aria-label":"前景图标缩放"})]}),u!==void 0?l.jsx("p",{role:"alert",className:"mt-1.5 text-[11px] font-medium text-red-400",children:u}):null,a!==void 0?l.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-muted-foreground",children:f==="transparent"?"透明背景:原始像素直接透出。":`已按明暗自动选择${a.suggested===f?"":"(已手动覆盖)"}:${a.luminance===void 0?"无法分析明暗":`前景明度 ${a.luminance.toFixed(2)}、覆盖率 ${(a.coverage*100).toFixed(0)}%`}。`}):null]})]})})]}),l.jsxs("div",{children:[l.jsx(Me,{htmlFor:"appId",children:"App ID"}),l.jsx(qe,{id:"appId",className:"mt-1 font-mono",disabled:b,value:e.appId,placeholder:t.appId||"由命令推导(如 start.somecommand.npx)",onChange:I=>v({appId:I.target.value})})]}),l.jsxs("div",{children:[l.jsx(Me,{htmlFor:"appName",children:"应用名称"}),l.jsx(qe,{id:"appName",className:"mt-1",disabled:b,value:e.appName,placeholder:t.appName||"从服务页面标题抓取",onChange:I=>v({appName:I.target.value})})]})]})}function BC({candidates:e,port:t,disabled:n,selectedRef:r,uploadedUrl:o,includeVariants:s,defaultLabel:i,onPick:a,onUpload:c,onClear:u}){const f=d.useRef(null),[h,g]=d.useState(!1),A=s?e:e.filter(m=>m.variant==="original"),p=e.filter(m=>m.variant==="original");return l.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[l.jsx("button",{type:"button",disabled:n,"aria-label":"选择本地图片",onClick:()=>f.current?.click(),onDragOver:m=>{m.preventDefault(),n||g(!0)},onDragLeave:()=>g(!1),onDrop:m=>{if(m.preventDefault(),g(!1),n)return;const x=m.dataTransfer.files[0];x!==void 0&&c(x)},className:fe("flex size-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-dashed border-border bg-popover transition-colors",n?"opacity-50":"hover:border-primary",h&&"border-primary bg-primary/10"),children:o!==void 0?l.jsx("img",{src:o,alt:"已选图标",className:"icon-checker size-full rounded object-contain"}):l.jsxs("span",{className:"flex flex-col items-center gap-1 text-muted-foreground",children:[l.jsx(xu,{className:"size-4"}),l.jsx("span",{className:"text-[10px] leading-tight",children:"上传"})]})}),l.jsx("input",{ref:f,type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden",disabled:n,onChange:m=>{const x=m.target.files?.[0];x!==void 0&&c(x),m.target.value=""}}),l.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[A.length===0?l.jsx("span",{className:"text-xs text-muted-foreground",children:"暂无候选图标"}):A.map(m=>{const x=t===void 0?void 0:Qn(t,m.index),v=r===`${t}:${m.index}`,b=r===void 0&&m.variant==="original"&&m.index===(p[0]?.index??-1);return l.jsx("button",{type:"button",disabled:n,title:m.variant==="original"?`${m.width}×${m.height} ${m.format.toUpperCase()}`:`${m.variant==="solid-black"?"黑色":"白色"}纯色 ${m.format.toUpperCase()}`,onClick:()=>a(m),className:fe("icon-checker flex size-12 items-center justify-center overflow-hidden rounded-lg border p-1 transition-all",v||b?"border-primary ring-2 ring-primary/60":"border-border hover:border-primary/60",n&&"opacity-50"),children:x!==void 0?l.jsx("img",{src:x,alt:`候选 ${m.variant}`,className:"size-full object-contain"}):null},`${m.variant}:${m.index}`)}),i!==void 0&&r===void 0&&A.length>0?l.jsx("span",{className:"text-[11px] text-muted-foreground",children:i}):null]}),r!==void 0||o!==void 0?l.jsx("button",{type:"button",disabled:n,onClick:u,className:"text-[11px] text-muted-foreground underline-offset-2 hover:underline",children:"清除"}):null]})}function jC(e){const t=d.useRef(!0);t.current&&(t.current=!1,e())}const Zf=d.createContext(null);function Vt(){const e=d.useContext(Zf);if(e===null)throw new Error(ot(60));return e}const MC=(e,t)=>Object.is(e,t);function or(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function xo(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:or(r,t,n))}function PC(e,t,n){return e.filter(r=>!or(t,r,n))}function yi(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Jf(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function TC(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Jf(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function $f(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return yi(e)}function Ln(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?yi(e.value):yi(e)}function Xf(e,t,n){function r(){return $f(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const o=t,s=Jf(o)?o.flatMap(i=>i.items):o;if(e==null||typeof e!="object"){const i=s.find(a=>a.value===e);return i&&i.label!=null?i.label:r()}if("value"in e){const i=s.find(a=>a&&a.value===e.value);if(i&&i.label!=null)return i.label}}return r()}function NC(e,t,n){return e.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(l.jsx(d.Fragment,{children:Xf(o,t,n)},s)),r),[])}const ke={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Ln(t,r)!==""},hasNullItemLabel:(e,t)=>t?TC(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(o=>or(t,o,n)):or(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function _C(e,t,n=(r,o)=>r===o){return e.length===t.length&&e.every((r,o)=>n(r,t[o]))}function vr(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const Tt=1;function Ga(e,t){return Math.max(0,e-t)}function No(e,t){if(t<=0)return 0;const n=vr(e,0,t),r=n,o=t-n,s=r<=Tt,i=o<=Tt;return s&&i?r<=o?0:t:s?0:i?t:n}function OC(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:a,name:c,form:u,autoComplete:f,disabled:h=!1,readOnly:g=!1,required:A=!1,modal:p=!0,actionsRef:m,inputRef:x,onOpenChangeComplete:v,items:b,multiple:y=!1,itemToStringLabel:C,itemToStringValue:w,isItemEqualToValue:I=MC,highlightItemOnHover:S=!0,children:R}=e,{clearErrors:E}=Mi(),{setDirty:k,setTouched:F,setFocused:T,validityData:N,setFilled:M,name:D,disabled:L,validation:_,validationMode:j}=Qo(),H=Ni({id:t}),P=L||h,B=D??c,[O,G]=on({controlled:n,default:y?r??Nt:r,name:"Select",state:"value"}),[z,U]=on({controlled:s,default:i,name:"Select",state:"open"}),Q=d.useRef([]),Z=d.useRef([]),K=d.useRef(null),te=d.useRef(null),le=d.useRef(0),X=d.useRef(null),ee=d.useRef([]),J=d.useRef(!1),ce=d.useRef(null),ue=d.useRef(null),ge=d.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ae=d.useRef(!1),{mounted:pe,setMounted:oe,transitionStatus:re}=sr(z),{openMethod:se,triggerProps:he}=wd(z),me=Dt(()=>new Gr({id:H,labelId:void 0,modal:p,multiple:y,itemToStringLabel:C,itemToStringValue:w,isItemEqualToValue:I,value:O,open:z,mounted:pe,transitionStatus:re,items:b,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,W=we(me,ke.activeIndex),Y=we(me,ke.selectedIndex),ye=we(me,ke.triggerElement),q=we(me,ke.positionerElement),ne=a0(se),Ee=se??ne,Se=d.useMemo(()=>y?"":Ln(O,w),[y,O,w]),Le=d.useMemo(()=>y&&Array.isArray(O)?O.map(Fe=>Ln(Fe,w)):Ln(O,w),[y,O,w]),Je=tt(ye),We=de(()=>Le);Ti(Je,H,O,We,!P,c);const ut=d.useRef(O),$e=y?Array.isArray(O)&&O.length>0:O!=null&&Se!=="";ie(()=>{M($e)},[$e,M]),ie(function(){let Ue=O,gt=!1;if(y){const it=Array.isArray(O)?O:[];gt=it.length===0,Ue=it[it.length-1]}const Et=gt?-1:xo(ee.current,Ue,I),St=Et===-1?null:Et;St===null&&(ue.current=null),!z&&me.set("selectedIndex",St)},[y,z,O,I,me]);function Ye(Fe){const Ue=N.initialValue;return Array.isArray(Fe)&&Array.isArray(Ue)?!_C(Fe,Ue,(gt,Et)=>or(gt,Et,I)):Fe!==Ue}ss(O,()=>{E(B),k(Ye(O)),_.change(O)});const mt=de((Fe,Ue)=>{a?.(Fe,Ue),!Ue.isCanceled&&(U(Fe),!Fe&&(Ue.reason===Bn||Ue.reason===Lo)&&(F(!0),T(!1),j==="onBlur"&&_.commit(O)))}),Ie=de(()=>{oe(!1),me.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),v?.(!1)});Yt({enabled:!m,open:z,ref:K,onComplete(){z||Ie()}}),d.useImperativeHandle(m,()=>({unmount:Ie}),[Ie]);const ze=de((Fe,Ue)=>{o?.(Fe,Ue),!Ue.isCanceled&&G(Fe)}),Ne=de(Fe=>{const Ue=Ga(Fe.scrollHeight,Fe.clientHeight),gt=No(Fe.scrollTop,Ue),Et=gt>0,St=gt<Ue;me.set("scrollUpArrowVisible",Et),me.set("scrollDownArrowVisible",St)}),nt=sm({open:z,onOpenChange:mt,elements:{reference:ye,floating:q}}),Re=Ju(nt,{enabled:!g&&!P,event:"mousedown"}),Ge=Xo(nt),_e=md(nt,{enabled:!g&&!P,listRef:Q,activeIndex:W,selectedIndex:Y,disabledIndices:Nt,onNavigate(Fe){Fe===null&&!z||me.set("activeIndex",Fe)},focusItemOnHover:S}),Ze=xd(nt,{enabled:!g&&!P&&(z||!y),listRef:Z,activeIndex:W,selectedIndex:Y,disabledIndices:Fe=>Gd(Q.current[Fe]),onMatch(Fe){z?me.set("activeIndex",Fe):ze(ee.current[Fe],Ce(Mt))},onTyping(Fe){J.current=Fe}}),st=d.useMemo(()=>Bt(Ze.reference,_e.reference,Ge.reference,Re.reference,he),[Re.reference,Ze.reference,_e.reference,Ge.reference,he]),ht=d.useMemo(()=>Bt(ts,Ze.floating,_e.floating,Ge.floating),[Ze.floating,_e.floating,Ge.floating]),yt=_e.item??ct;jC(()=>{me.update({popupProps:ht,triggerProps:st})}),me.useSyncedValues({id:H,modal:p,multiple:y,value:O,open:z,mounted:pe,transitionStatus:re,popupProps:ht,triggerProps:st,items:b,itemToStringLabel:C,itemToStringValue:w,isItemEqualToValue:I,openMethod:Ee});const dt=d.useMemo(()=>({store:me,floatingContext:nt,required:A,disabled:P,readOnly:g,multiple:y,highlightItemOnHover:S,setValue:ze,setOpen:mt,listRef:Q,popupRef:K,scrollHandlerRef:te,handleScrollArrowVisibility:Ne,scrollArrowsMountedCountRef:le,itemProps:yt,valueRef:X,valuesRef:ee,labelsRef:Z,typingRef:J,selectionRef:ge,firstItemTextRef:ce,selectedItemTextRef:ue,validation:_,onOpenChangeComplete:v,alignItemWithTriggerActiveRef:ae,initialValueRef:ut}),[me,nt,A,P,g,y,S,ze,mt,yt,_,v,Ne]),kt=Qt(x,_.inputRef),Pt=y?void 0:B,Zt=d.useMemo(()=>!y||!Array.isArray(O)||!B?null:O.map(Fe=>{const Ue=Ln(Fe,w);return l.jsx("input",{type:"hidden",form:u,name:B,value:Ue,disabled:P},Ue)}),[y,O,u,B,w,P]);return l.jsxs(Zf.Provider,{value:dt,children:[R,l.jsx("input",{..._.getValidationProps(P,{onFocus(){me.state.triggerElement?.focus({focusVisible:!0})},onChange(Fe){if(Fe.nativeEvent.defaultPrevented||P||g)return;const Ue=Fe.currentTarget.value,gt=Ce(Mt,Fe.nativeEvent);function Et(){if(y)return;const St=Ue.toLowerCase();let it=ee.current.findIndex(cn=>Ln(cn,w).toLowerCase()===St||$f(cn,C).toLowerCase()===St);it===-1&&(it=ee.current.findIndex((cn,On)=>{const kn=Z.current[On];return kn!=null&&kn.toLowerCase()===St}));const Rt=ee.current[it];Rt!=null&&ze(Rt,gt)}me.set("forceMount",!0),queueMicrotask(Et)}}),id:H&&Pt==null?`${H}-hidden-input`:void 0,form:u,name:Pt,autoComplete:f,value:Se,disabled:P,required:A&&!(y&&$e),readOnly:g,ref:kt,style:B?ta:$o,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Zt]})}function HC(e,t){return e??t}const LC=400,KC={...oi,...ji,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},WC=d.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:a=!0,style:c,...u}=t,{setTouched:f,setFocused:h,validationMode:g,state:A,disabled:p}=Qo(),{labelId:m}=Pi(),{store:x,setOpen:v,selectionRef:b,validation:y,readOnly:C,required:w,alignItemWithTriggerActiveRef:I,disabled:S}=Vt(),R=p||S||i,E=we(x,ke.open),k=we(x,ke.mounted),F=we(x,ke.value),T=we(x,ke.triggerProps),N=we(x,ke.positionerElement),M=we(x,ke.listElement),D=we(x,ke.popupSide),L=we(x,ke.id),_=we(x,ke.labelId),j=we(x,ke.hasSelectedValue),H=k&&N?D:null,P=s??L,B=HC(m,_);Ni({id:P});const O=tt(N),G=d.useRef(null),{getButtonProps:z,buttonRef:U}=Gt({disabled:R,native:a}),Q=x.useStateSetter("triggerElement"),Z=pt(),K=pt(),te=pt();d.useEffect(()=>{if(E)return te.start(LC,()=>{b.current.allowUnselectedMouseUp=!0,b.current.allowSelectedMouseUp=!0}),()=>{te.clear()};b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},K.clear()},[E,b,K,te]);const le=Bt(T,{id:P,role:"combobox","aria-expanded":E,"aria-haspopup":"listbox","aria-controls":E?M?.id??yo(N)?.id:void 0,"aria-labelledby":B,"aria-readonly":C||void 0,"aria-required":w||void 0,tabIndex:R?-1:0,onFocus(J){h(!0),E&&I.current&&v(!1,Ce(Mt,J.nativeEvent)),Z.start(0,()=>{x.set("forceMount",!0)})},onBlur(J){ve(N,J.relatedTarget)||(f(!0),h(!1),g==="onBlur"&&y.commit(F))},onMouseDown(J){if(E)return;const ce=Be(J.currentTarget);function ue(ge){if(!G.current)return;const ae=ge.target;ve(G.current,ae)||ve(O.current,ae)||Ld(ge,G.current)||v(!1,Ce(pu,ge))}K.start(0,()=>{ce.addEventListener("mouseup",ue,{once:!0})})}},u,z),X=y.getValidationProps(R,le);X.role="combobox";const ee={...A,open:E,disabled:R,value:F,readOnly:C,popupSide:H,placeholder:!j};return je("button",t,{ref:[n,G,U,Q],state:ee,stateAttributesMapping:KC,props:X})}),QC={value:()=>null},GC=d.forwardRef(function(t,n){const{className:r,render:o,children:s,placeholder:i,style:a,...c}=t,{store:u,valueRef:f}=Vt(),h=we(u,ke.value),g=we(u,ke.items),A=we(u,ke.itemToStringLabel),p=we(u,ke.hasSelectedValue),m=!p&&i!=null&&s==null,x=we(u,ke.hasNullItemLabel,m),v={value:h,placeholder:!p};let b=null;return typeof s=="function"?b=s(h):s!=null?b=s:m&&!x?b=i:Array.isArray(h)?b=NC(h,g,A):b=Xf(h,g,A),je("span",t,{state:v,ref:[n,f],props:[{children:b},c],stateAttributesMapping:QC})}),YC=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a}=Vt(),u={open:we(a,ke.open)};return je("span",t,{state:u,ref:n,props:[{"aria-hidden":!0,children:"▼"},i],stateAttributesMapping:_u})}),zC=d.forwardRef(function(t,n){const{store:r}=Vt(),o=we(r,ke.mounted),s=we(r,ke.forceMount);return o||s?l.jsx(na,{ref:n,...t}):null}),qf=d.createContext(void 0);function Ya(){const e=d.useContext(qf);if(!e)throw new Error(ot(59));return e}function _o(e,t){e&&Object.assign(e.style,t)}const ep={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},UC={position:"fixed"},VC=d.forwardRef(function(t,n){const{anchor:r,className:o,render:s,positionMethod:i,side:a,align:c,sideOffset:u,alignOffset:f,collisionBoundary:h="clipping-ancestors",collisionPadding:g,arrowPadding:A,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:x=!0,collisionAvoidance:v=Ku,style:b,...y}=t,{store:C,listRef:w,labelsRef:I,alignItemWithTriggerActiveRef:S,selectedItemTextRef:R,valuesRef:E,initialValueRef:k,popupRef:F,setValue:T,floatingContext:N}=Vt(),M=we(C,ke.open),D=we(C,ke.mounted),L=we(C,ke.modal),_=we(C,ke.value),j=we(C,ke.openMethod),H=we(C,ke.positionerElement),P=we(C,ke.triggerElement),B=we(C,ke.isItemEqualToValue),O=we(C,ke.transitionStatus),G=d.useRef(null),z=d.useRef(null),[U,Q]=d.useState(x),Z=D&&U&&j!=="touch";!D&&U!==x&&Q(x),d.useImperativeHandle(S,()=>Z),Od((Z||L)&&M,j==="touch",H,P);const K=Ia({anchor:r,floatingRootContext:N,positionMethod:i,mounted:D,side:a,sideOffset:u,align:c,alignOffset:f,arrowPadding:A,collisionBoundary:h,collisionPadding:g,sticky:p,disableAnchorTracking:m??Z,collisionAvoidance:v,keepMounted:!0}),te=Z?"none":K.side,le=Z?UC:K.positionerStyles,X={open:M,side:te,align:K.align,anchorHidden:K.anchorHidden};ie(()=>{C.set("popupSide",K.side)},[C,K.side]);const ee=C.useStateSetter("positionerElement"),J=wa(t,X,{styles:le,transitionStatus:O,props:y,refs:[n,ee],hidden:!D,inert:!M}),ce=d.useRef(0),ue=de(ae=>{if(E.current.length===0)return;const pe=ce.current;if(ce.current=ae.size,ae.size===pe)return;const oe=Ce(Mt);if(pe!==0&&!C.state.multiple&&_!==null&&xo(E.current,_,B)===-1){const se=k.current,me=se!=null&&xo(E.current,se,B)!==-1?se:null;T(me,oe),me===null&&(C.set("selectedIndex",null),R.current=null)}if(pe!==0&&C.state.multiple&&Array.isArray(_)){const re=_.filter(se=>xo(E.current,se,B)!==-1);re.length!==_.length&&(T(re,oe),re.length===0&&(C.set("selectedIndex",null),R.current=null))}if(M&&Z){C.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const re={height:""};_o(H,re),_o(F.current,re)}}),ge=d.useMemo(()=>({...K,side:te,alignItemWithTriggerActive:Z,setControlledAlignItemWithTrigger:Q,scrollUpArrowRef:G,scrollDownArrowRef:z}),[K,te,Z,Q]);return l.jsx(Ur,{elementsRef:w,labelsRef:I,onMapChange:ue,children:l.jsxs(qf.Provider,{value:ge,children:[D&&L&&l.jsx(va,{inert:ba(!M),cutout:P}),J]})})}),uo="base-ui-disable-scrollbar",Ci={className:uo,getElement(e){return l.jsx("style",{nonce:e,href:uo,precedence:"base-ui:low",children:`.${uo}{scrollbar-width:none}.${uo}::-webkit-scrollbar{display:none}`})}},ZC=d.createContext(void 0),JC={disableStyleElements:!1};function $C(){return d.useContext(ZC)??JC}const XC={...Wr,...Nn},qC=d.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...a}=t,{store:c,popupRef:u,onOpenChangeComplete:f,setOpen:h,valueRef:g,firstItemTextRef:A,selectedItemTextRef:p,multiple:m,handleScrollArrowVisibility:x,scrollHandlerRef:v,listRef:b,highlightItemOnHover:y,floatingContext:C}=Vt(),{side:w,align:I,alignItemWithTriggerActive:S,isPositioned:R,setControlledAlignItemWithTrigger:E}=Ya(),k=Ea()!=null,F=is(),{nonce:T,disableStyleElements:N}=$C(),M=we(c,ke.id),D=we(c,ke.open),L=we(c,ke.openMethod),_=we(c,ke.mounted),j=we(c,ke.popupProps),H=we(c,ke.transitionStatus),P=we(c,ke.triggerElement),B=we(c,ke.positionerElement),O=we(c,ke.listElement),G=d.useRef(!1),z=d.useRef(!1),U=d.useRef({}),Q=qn(),Z=de(X=>{if(!B||!u.current||!z.current)return;const ee=B.style.top==="0px",J=B.style.bottom==="0px";if(G.current||!S||!ee&&!J){x(X);return}const ce=Yc(B),ue=yr(B.getBoundingClientRect().height,"y",ce),ge=Be(B),ae=rt(B),pe=ae.getComputedStyle(B),oe=parseFloat(pe.marginTop),re=parseFloat(pe.marginBottom),se=Gc(ae.getComputedStyle(u.current)),he=Math.min(ge.documentElement.clientHeight-oe-re,se),me=X.scrollTop,W=fo(X);let Y=null;const ye=Se=>{B.style.height=`${Se}px`},q=ee?W-me:me,ne=Math.min(ue+q,he);if(q<=Tt){const Se=vr(q,0,he-ue);Se>0&&ye(ue+Se),X.scrollTop=ee?W:0,he-(ue+Se)<=Tt&&(G.current=!0),x(X);return}if(he-ne>Tt)Y=ee?1/0:0;else if(J&&me<W){const Se=ue+q-he;Y=me-(q-Se)}const Ee=Math.ceil(ne);if(Ee!==0&&ye(Ee),Y!=null){const Se=vr(Y,0,fo(X));Math.abs(X.scrollTop-Se)>Tt&&(X.scrollTop=Se)}Ee>=he-Tt&&(G.current=!0),x(X)});d.useImperativeHandle(v,()=>Z,[Z]),Yt({open:D,ref:u,onComplete(){D&&f?.(!0)}});const K={open:D,transitionStatus:H,side:w,align:I};ie(()=>{!B||!u.current||Object.keys(U.current).length||(U.current={top:B.style.top||"0",left:B.style.left||"0",right:B.style.right,height:B.style.height,bottom:B.style.bottom,minHeight:B.style.minHeight,maxHeight:B.style.maxHeight,marginTop:B.style.marginTop,marginBottom:B.style.marginBottom})},[u,B]),ie(()=>{D||S||(z.current=!1,G.current=!1,_o(B,U.current))},[D,S,B,u]),ie(()=>{const X=u.current;if(!D||!P||!B||!X||S&&!R||c.state.transitionStatus==="ending")return;if(z.current=!0,X.style.removeProperty("--transform-origin"),!S){Q.request(()=>x(O||X));return}const ee=e1(X);try{let J=p.current;J?.isConnected||(J=!ke.hasSelectedValue(c.state)&&A.current?.isConnected?A.current:null);const ce=g.current,ue=rt(B),ge=ue.getComputedStyle(B),ae=ue.getComputedStyle(X),pe=Be(P),oe=Yc(P),re=po(P.getBoundingClientRect(),oe),se=po(B.getBoundingClientRect(),oe),he=re.height,me=O||X,W=me.scrollHeight,Y=parseFloat(ae.borderBottomWidth),ye=parseFloat(ge.marginTop)||10,q=parseFloat(ge.marginBottom)||10,ne=parseFloat(ge.minHeight)||100,Ee=Gc(ae),Se=5,Le=5,Je=20,We=pe.documentElement.clientHeight-ye-q,ut=pe.documentElement.clientWidth,$e=We-re.bottom+he;let Ye,mt=F==="rtl"?re.right-se.width:re.left,Ie=0;if(J&&ce){const dt=po(ce.getBoundingClientRect(),oe);Ye=po(J.getBoundingClientRect(),oe),mt=se.left+(F==="rtl"?dt.right-Ye.right:dt.left-Ye.left);const kt=dt.top-re.top+dt.height/2;Ie=Ye.top-se.top+Ye.height/2-kt}const ze=$e+Ie+q+Y;let Ne=Math.min(We,ze);const nt=We-ye-q,Re=ze-Ne,Ge=ut-Le;B.style.left=`${vr(mt,Se,Ge-se.width)}px`,B.style.height=`${Ne}px`,B.style.maxHeight="none",B.style.marginTop=`${ye}px`,B.style.marginBottom=`${q}px`,X.style.height="100%";const _e=fo(me),Ze=Re>=_e-Tt;Ze&&(Ne=Math.min(We,se.height)-(Re-_e));const st=re.top<Je||re.bottom>We-Je||Math.ceil(Ne)+Tt<Math.min(W,ne),ht=(ue.visualViewport?.scale??1)!==1&&an;if(st||ht){_o(B,U.current),E(!1);return}const yt=Math.max(ne,Ne);if(Ze){const dt=Math.max(0,We-ze);B.style.top=se.height>=nt?"0":`${dt}px`,B.style.height=`${Ne}px`,me.scrollTop=fo(me)}else B.style.bottom="0",me.scrollTop=Re;if(Ye){const dt=se.top,kt=se.height,Pt=Ye.top+Ye.height/2,Zt=vr(kt>0?(Pt-dt)/kt*100:50,0,100);X.style.setProperty("--transform-origin",`50% ${Zt}%`)}(yt===We||Ne>=Ee)&&(G.current=!0),x(me),y&&c.state.selectedIndex===null&&c.state.activeIndex===null&&b.current[0]!=null&&c.set("activeIndex",0)}finally{ee()}},[c,D,B,P,g,A,p,u,x,S,E,Q,O,b,y,F,R]),d.useEffect(()=>{if(!S||!B||!D)return;const X=rt(B);function ee(J){h(!1,Ce(Lp,J))}return De(X,"resize",ee)},[h,S,B,D]);const te={...O?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":m||void 0,id:`${M}-list`},onKeyDown(X){k&&rs.has(X.key)&&X.stopPropagation()},onScroll(X){O||Z(X.currentTarget)},...S&&{style:O?{height:"100%"}:ep},className:!O&&S?Ci.className:void 0},le=je("div",t,{ref:[n,u],state:K,stateAttributesMapping:XC,props:[j,te,as(H),a]});return l.jsxs(d.Fragment,{children:[!N&&Ci.getElement(T),l.jsx(sa,{context:C,modal:!1,disabled:!_,openInteractionType:L,returnFocus:i,restoreFocus:!0,children:le})]})});function Gc(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function fo(e){return Ga(e.scrollHeight,e.clientHeight)}function Yc(e){return nd.getScale(e)}function yr(e,t,n){return e/n[t]}function po(e,t){return Dr({x:yr(e.x,"x",t),y:yr(e.y,"y",t),width:yr(e.width,"x",t),height:yr(e.height,"y",t)})}const zc=[["transform","none"],["scale","1"],["translate","0 0"]];function e1(e){const{style:t}=e,n={};for(const[r,o]of zc)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of zc){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}const t1=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a,scrollHandlerRef:c,multiple:u}=Vt(),{alignItemWithTriggerActive:f}=Ya(),h=we(a,ke.hasScrollArrows),g=we(a,ke.openMethod),p={id:`${we(a,ke.id)}-list`,role:"listbox","aria-multiselectable":u||void 0,onScroll(x){c.current?.(x.currentTarget)},...f&&{style:ep},className:h&&g!=="touch"?Ci.className:void 0},m=a.useStateSetter("listElement");return je("div",t,{ref:[n,m],props:[p,i]})}),tp=d.createContext(void 0);function za(){const e=d.useContext(tp);if(!e)throw new Error(ot(57));return e}const n1=d.memo(d.forwardRef(function(t,n){const{render:r,className:o,style:s,value:i=null,label:a,disabled:c=!1,nativeButton:u=!1,...f}=t,h=d.useRef(null),g=fs({guess:!0,label:a,textRef:h}),{store:A,itemProps:p,setOpen:m,setValue:x,selectionRef:v,typingRef:b,valuesRef:y,multiple:C,selectedItemTextRef:w,disabled:I,readOnly:S}=Vt(),R=I||c,E=we(A,ke.isActive,g.index),k=we(A,ke.open),F=we(A,ke.isSelected,i),T=we(A,ke.isSelectedByFocus,g.index),N=we(A,ke.isItemEqualToValue),M=g.index,D=d.useRef(null);ie(()=>{const Q=y.current;return Q[M]=i,()=>{delete Q[M]}},[M,i,y]),ie(()=>{const Q=A.state.value;let Z=Q;C&&Array.isArray(Q)&&(Z=Q.length>0?Q[Q.length-1]:void 0),Z!==void 0&&or(i,Z,N)&&(A.set("selectedIndex",M),h.current&&(w.current=h.current))},[M,C,N,A,i,w]);const L=d.useRef("mouse"),_=d.useRef(!1),{getButtonProps:j,buttonRef:H}=Gt({disabled:R,focusableWhenDisabled:!0,native:u,composite:!0}),P={disabled:R,selected:F,highlighted:E};function B(Q){if(I||S)return;const Z=A.state.value;if(C){const K=Array.isArray(Z)?Z:[],te=F?PC(K,i,N):[...K,i];x(te,Ce(Cr,Q))}else x(i,Ce(Cr,Q)),m(!1,Ce(Cr,Q))}function O(){v.current.dragY=0}const G={role:"option","aria-selected":F,tabIndex:k&&E?0:-1,onKeyDown(Q){A.set("activeIndex",M),Q.key===" "&&b.current&&Q.preventDefault()},onClick(Q){const Z=L.current!=="touch",K=Q.nativeEvent.pointerType,te=Z&&Qi(Q.nativeEvent)&&(K!==void 0||E),le=Z&&!te&&!_.current;_.current=!1,!(R||le)&&B(Q.nativeEvent)},onPointerEnter(Q){L.current=Q.pointerType},onPointerMove(Q){if(Q.pointerType==="mouse"&&Q.buttons===1){const Z=v.current;Z.dragY+=Q.movementY,Z.dragY**2>=64&&(Z.allowUnselectedMouseUp=!0)}},onPointerDown(Q){L.current=Q.pointerType,_.current=!0,O()},onMouseUp(){if(O(),R||L.current==="touch"||_.current)return;const Q=!v.current.allowSelectedMouseUp&&F,Z=!v.current.allowUnselectedMouseUp&&!F;Q||Z||(_.current=!0,D.current?.click(),_.current=!1)}},z=je("div",t,{ref:[H,n,g.ref,D],state:P,props:[p,G,f,j]}),U=d.useMemo(()=>({selected:F,index:M,textRef:h,selectedByFocus:T}),[F,M,h,T]);return l.jsx(tp.Provider,{value:U,children:z})})),r1=d.forwardRef(function(t,n){const{selected:r}=za();return t.keepMounted||r?l.jsx(o1,{...t,ref:n}):null}),o1=d.memo(d.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:a}=za(),c=d.useRef(null),{transitionStatus:u,setMounted:f}=sr(a),g=je("span",e,{ref:[t,c],state:{selected:a,transitionStatus:u},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:Nn});return Yt({open:a,ref:c,onComplete(){a||f(!1)}}),g})),s1=d.memo(d.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:s}=za(),{firstItemTextRef:i,selectedItemTextRef:a}=Vt(),{render:c,className:u,style:f,...h}=t,g=d.useCallback(p=>{p&&(r===0&&(i.current=p),s&&(a.current=p))},[i,a,r,s]);return je("div",t,{ref:[g,n,o],props:h})})),np=d.forwardRef(function(t,n){const{render:r,className:o,style:s,direction:i,keepMounted:a,...c}=t,u=i==="up",{store:f,popupRef:h,listRef:g,handleScrollArrowVisibility:A,scrollArrowsMountedCountRef:p}=Vt(),{side:m,scrollDownArrowRef:x,scrollUpArrowRef:v}=Ya(),b=u?ke.scrollUpArrowVisible:ke.scrollDownArrowVisible,y=we(f,b),C=we(f,ke.openMethod),w=y&&C!=="touch",I=pt(),S=u?v:x,{mounted:R,transitionStatus:E,setMounted:k}=sr(w);ie(()=>(p.current+=1,f.set("hasScrollArrows",!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&f.set("hasScrollArrows",!1)}),[f,p]),Yt({open:w,ref:S,onComplete(){w||k(!1)}});const N=je("div",t,{ref:[n,S],state:{direction:i,visible:w,side:m,transitionStatus:E},props:[{"aria-hidden":!0,children:u?"▲":"▼",style:{position:"absolute"},onMouseMove(D){if(D.movementX===0&&D.movementY===0||I.isStarted())return;f.set("activeIndex",null);function L(){const _=f.state.listElement??h.current;if(!_)return;f.set("activeIndex",null),A(_);const j=Ga(_.scrollHeight,_.clientHeight),H=No(_.scrollTop,j),P=H===(u?0:j),B=g.current;if(H!==_.scrollTop&&(_.scrollTop=H),P){I.clear();return}if(B.length>0){const O=S.current?.offsetHeight||0;_.scrollTop=i1(B,u,H,_.clientHeight,O,j)}I.start(40,L)}I.start(40,L)},onMouseLeave(){I.clear()}},c],stateAttributesMapping:Nn});return R||a?N:null});function i1(e,t,n,r,o,s){if(t){let f=0;const h=n+o-Tt;for(let p=0;p<e.length;p+=1){const m=e[p];if(m&&m.offsetTop>=h){f=p;break}}const g=Math.max(0,f-1),A=e[g];return g<f&&A?No(A.offsetTop-o,s):0}let i=e.length-1;const a=n+r-o+Tt;for(let f=0;f<e.length;f+=1){const h=e[f];if(h&&h.offsetTop+h.offsetHeight>a){i=Math.max(0,f-1);break}}const c=Math.min(e.length-1,i+1),u=e[c];return c>i&&u?No(u.offsetTop+u.offsetHeight-r+o,s):s}const a1=d.forwardRef(function(t,n){return l.jsx(np,{...t,ref:n,direction:"down"})}),l1=d.forwardRef(function(t,n){return l.jsx(np,{...t,ref:n,direction:"up"})}),c1=OC;function u1({className:e,...t}){return l.jsx(GC,{"data-slot":"select-value",className:fe("flex flex-1 text-left",e),...t})}function d1({className:e,size:t="default",children:n,...r}){return l.jsxs(WC,{"data-slot":"select-trigger","data-size":t,className:fe("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,l.jsx(YC,{render:l.jsx(Tn,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function f1({className:e,children:t,side:n="bottom",sideOffset:r=4,align:o="center",alignOffset:s=0,alignItemWithTrigger:i=!0,...a}){return l.jsx(zC,{children:l.jsx(VC,{side:n,sideOffset:r,align:o,alignOffset:s,alignItemWithTrigger:i,className:"isolate z-50",children:l.jsxs(qC,{"data-slot":"select-content","data-align-trigger":i,className:fe("cn-menu-target cn-menu-translucent relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...a,children:[l.jsx(p1,{}),l.jsx(t1,{children:t}),l.jsx(h1,{})]})})})}function Gs({className:e,children:t,...n}){return l.jsxs(n1,{"data-slot":"select-item",className:fe("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[l.jsx(s1,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),l.jsx(r1,{render:l.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:l.jsx(_i,{className:"pointer-events-none"})})]})}function p1({className:e,...t}){return l.jsx(l1,{"data-slot":"select-scroll-up-button",className:fe("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(Oi,{})})}function h1({className:e,...t}){return l.jsx(a1,{"data-slot":"select-scroll-down-button",className:fe("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(Tn,{})})}const rp=d.createContext(void 0);function A1(){const e=d.useContext(rp);if(e===void 0)throw new Error(ot(63));return e}const op={...ji,checked(e){return e?{"data-checked":""}:{"data-unchecked":""}}},g1=d.forwardRef(function(t,n){const{checked:r,className:o,defaultChecked:s,"aria-labelledby":i,form:a,id:c,inputRef:u,name:f,nativeButton:h=!1,onCheckedChange:g,readOnly:A=!1,required:p=!1,disabled:m=!1,render:x,uncheckedValue:v,value:b,style:y,...C}=t,{clearErrors:w}=Mi(),{state:I,setTouched:S,setDirty:R,validityData:E,setFilled:k,setFocused:F,validationMode:T,disabled:N,name:M,validation:D}=Qo(),{labelId:L}=Pi(),_=N||m,j=M??f,H=d.useRef(null),P=Qt(H,u,D.inputRef),B=d.useRef(null),O=It(),G=Ni({id:c,implicit:!1,controlRef:B}),z=h?void 0:G,[U,Q]=on({controlled:r,default:!!s,name:"Switch",state:"checked"});Ti(B,O,U,void 0,!_,f),ie(()=>{H.current&&k(H.current.checked)},[k]),ss(U,()=>{w(j),R(U!==E.initialValue),k(U),D.change(U)});const{getButtonProps:Z,buttonRef:K}=Gt({disabled:_,native:h}),te=bu(i,L,H,!h,z),le={id:h?G:O,role:"switch","aria-checked":U,"aria-readonly":A||void 0,"aria-required":p||void 0,"aria-labelledby":te,onFocus(){_||F(!0)},onBlur(){const ce=H.current;!ce||_||(S(!0),F(!1),T==="onBlur"&&D.commit(ce.checked))},onClick(ce){if(A||_)return;ce.preventDefault();const ue=H.current;ue&&Fi(ue,ce)}},X={...D.getValidationProps(_),checked:U,disabled:_,form:a,id:z,name:j,required:p,style:j?ta:$o,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:P,onChange(ce){if(ce.nativeEvent.defaultPrevented)return;if(A){ce.preventDefault();return}const ue=ce.currentTarget.checked,ge=Ce(Mt,ce.nativeEvent);g?.(ue,ge),!ge.isCanceled&&Q(ue)},onClick(ce){ce.stopPropagation()},onFocus(){B.current?.focus()},...b!==void 0?{value:b}:ct},ee=d.useMemo(()=>({...I,checked:U,disabled:_,readOnly:A,required:p}),[I,U,_,A,p]),J=je("span",t,{state:ee,ref:[n,B,K],props:[le,C,Z,ce=>D.getValidationProps(_,ce)],stateAttributesMapping:op});return l.jsxs(rp.Provider,{value:ee,children:[J,!U&&j&&v!==void 0&&l.jsx("input",{type:"hidden",form:a,name:j,value:v,disabled:_}),l.jsx("input",{...X,suppressHydrationWarning:!0})]})}),m1=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=A1();return je("span",t,{state:a,ref:n,stateAttributesMapping:op,props:i})});function ur({className:e,size:t="default",...n}){return l.jsx(g1,{"data-slot":"switch","data-size":t,className:fe("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:l.jsx(m1,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}function x1({frozen:e,values:t,defaults:n,candidates:r,candidatesPort:o,selectedIconRef:s,uploadedIconUrl:i,iconAnalysis:a,iconComposition:c,iconComposeError:u,iconBackground:f,iconScale:h,onIconBackgroundChange:g,onIconScaleChange:A,selectedTrayRef:p,uploadedTrayUrl:m,selectedPort:x,targetDirExists:v,onPickIconCandidate:b,onUploadIcon:y,onClearIcon:C,onPickTray:w,onUploadTray:I,onClearTray:S,onPatch:R,onConfirm:E}){return l.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[l.jsx(FC,{values:t,defaults:n,frozen:e,iconCandidates:r,iconCandidatesPort:o,uploadedIconUrl:i,selectedIconRef:s,iconAnalysis:a,iconComposition:c,iconComposeError:u,iconBackground:f,iconScale:h,onIconBackgroundChange:g,onIconScaleChange:A,onPickIconCandidate:b,onUploadIcon:y,onClearIcon:C,onPatch:R}),l.jsx(Fa,{className:"mt-4 border-t border-border pt-1",children:l.jsxs(Ba,{value:"advanced",className:"border-b-0",children:[l.jsx(ja,{children:"高级选项"}),l.jsxs(Ma,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[l.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[l.jsx(ur,{id:"showStartupTerminal",checked:t.showStartupTerminal,disabled:e,onCheckedChange:k=>R({showStartupTerminal:k})}),l.jsxs("div",{children:[l.jsx(Me,{htmlFor:"showStartupTerminal",className:"text-foreground",children:"显示启动终端"}),l.jsxs("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:[l.jsx(Sr,{className:"mr-0.5 inline size-3"}),"应用启动时打开独立终端窗口,实时显示命令的 PTY 输出(可交互)。"]})]})]}),l.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[l.jsx(ur,{id:"showAddressBar",checked:t.showAddressBar,disabled:e,onCheckedChange:k=>R({showAddressBar:k})}),l.jsxs("div",{children:[l.jsx(Me,{htmlFor:"showAddressBar",className:"text-foreground",children:"显示地址栏"}),l.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"服务窗口顶部显示地址栏(Web Navigation API 管理导航)。"})]})]}),l.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[l.jsx(ur,{id:"imageSmoothingEnabled",checked:t.imageSmoothingEnabled,disabled:e,onCheckedChange:k=>R({imageSmoothingEnabled:k})}),l.jsxs("div",{children:[l.jsx(Me,{htmlFor:"imageSmoothingEnabled",className:"text-foreground",children:"平滑缩放(imageSmoothingEnabled)"}),l.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"默认开启高质量缩放;上传低分辨率像素风图标时关闭可保留硬边锯齿(等比放大应用到应用图标前景与托盘图标)。"})]})]}),l.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[l.jsx(ur,{id:"developerMode",checked:t.developerMode,disabled:e,onCheckedChange:k=>R({developerMode:k})}),l.jsxs("div",{children:[l.jsx(Me,{htmlFor:"developerMode",className:"text-foreground",children:"允许开发者模式"}),l.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"仅表示生成应用内的 WebView DevTools 准入;不改变其它行为。"})]})]})]}),l.jsxs("div",{children:[l.jsx(Me,{children:"托盘图标"}),l.jsx("p",{className:"mb-1.5 mt-0.5 text-[11px] text-muted-foreground",children:"默认与应用图标一致;纯色候选适合系统托盘(macOS 模板风格)。"}),l.jsx(BC,{candidates:r,port:o,disabled:e,selectedRef:p,uploadedUrl:m,includeVariants:!0,defaultLabel:"默认跟随应用图标",onPick:w,onUpload:I,onClear:S})]}),l.jsxs("div",{children:[l.jsx(Me,{htmlFor:"pm",children:"包管理器"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] leading-relaxed text-muted-foreground",children:"仅为生成的应用安装依赖时使用的工具(决定 install 命令与锁文件形态),不影响应用本身的运行方式——生成的应用始终以 Node 启动。默认自动跟随你启动向导所用的包管理器,一般无需修改。"}),l.jsxs(c1,{value:t.pm,disabled:e,onValueChange:k=>R({pm:k}),children:[l.jsx(d1,{id:"pm",className:"mt-0",children:l.jsx(u1,{})}),l.jsxs(f1,{children:[l.jsx(Gs,{value:"npm",children:"npm"}),l.jsx(Gs,{value:"pnpm",children:"pnpm"}),l.jsx(Gs,{value:"bun",children:"bun"})]})]})]}),l.jsxs("div",{className:"rounded-lg border border-border p-3",children:[l.jsx(Me,{children:"生成位置"}),l.jsx("p",{className:"mt-1 font-mono text-[11px] break-all text-muted-foreground",children:n.targetDir||"~/.opentray/create/<应用名>"}),l.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-muted-foreground",children:"生成的项目默认落在 OpenTray 主目录下,同一命令重复创建会落到同一位置; 也可在启动向导时通过位置参数指定其他目录。"}),v?l.jsx("p",{className:"mt-2 text-[11px] font-medium text-amber-400",children:"目标目录已存在且非空——继续生成会失败,或开启下方强制覆盖。"}):null,l.jsxs("div",{className:"mt-3 flex items-start gap-3",children:[l.jsx(ur,{id:"force-overwrite",checked:t.force,disabled:e,onCheckedChange:k=>R({force:k})}),l.jsxs("div",{children:[l.jsx(Me,{htmlFor:"force-overwrite",className:"text-foreground",children:"强制覆盖已存在的目录"}),l.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"开启后将清空目标目录内的现有内容并重新生成(等同 --force)。请确认目录中没有你需要的文件。"})]})]})]})]})]})}),l.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[l.jsx(Oe,{onClick:E,disabled:e,children:"确定创建应用"}),l.jsx("span",{className:"text-xs text-muted-foreground",children:x!==void 0?`已选服务 :${x}(点击状态栏服务可切换)`:"未运行也不影响:应用启动时会自行嗅探命令的监听端口"})]})]})}var ho={},Ys,Uc;function b1(){if(Uc)return Ys;Uc=1;var e=["||","&&",";;","|&","<(","<<<",">>",">&","<&","&",";","(",")","|","<",">"],t=/[\n\r\u2028\u2029]/,n=/[\s#!"$&'():;<=>@\\^`|]/g;return Ys=function(o){return o.map(function(s){if(s==="")return"''";if(s&&typeof s=="object"){if("op"in s&&s.op==="glob"){if(typeof s.pattern!="string")throw new TypeError("glob token requires a string `pattern`");if(t.test(s.pattern))throw new TypeError("glob `pattern` must not contain line terminators");return s.pattern.replace(n,"\\$&")}if("op"in s&&typeof s.op=="string"){if(e.indexOf(s.op)<0)throw new TypeError("invalid `op` value: "+JSON.stringify(s.op));return s.op.replace(/[\s\S]/g,"\\$&")}if("comment"in s&&typeof s.comment=="string"){if(t.test(s.comment))throw new TypeError("`comment` must not contain line terminators");return"#"+s.comment}throw new TypeError("unrecognized object token shape")}return/["\s\\]/.test(s)&&!/'/.test(s)?"'"+s.replace(/(['])/g,"\\$1")+"'":/["'\s]/.test(s)?'"'+s.replace(/(["\\$`!])/g,"\\$1")+'"':String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,"$1\\$2")}).join(" ")},Ys}var zs,Vc;function v1(){if(Vc)return zs;Vc=1;for(var e="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",t=new RegExp("^"+e+"$"),n="|&;()<> \\t",r="'([^']*?)'",o='"((\\\\"|[^"])*?)"',s=/^#$/,i="'",a='"',c="$",u="",f=4294967296,h=0;h<4;h++)u+=(f*Math.random()).toString(16);var g=new RegExp("^"+u);function A(x,v){for(var b=v.lastIndex,y=[],C;C=v.exec(x);)y[y.length]=C,v.lastIndex===C.index&&(v.lastIndex+=1);return v.lastIndex=b,y}function p(x,v,b){var y=typeof x=="function"?x(b):x[b];return typeof y>"u"&&b!=""?y="":typeof y>"u"&&(y="$"),typeof y=="object"?v+u+JSON.stringify(y)+u:v+y}function m(x,v,b){b||(b={});var y=b.escape||"\\",C=b.splitUnquoted===!0?`
20
- `:typeof b.splitUnquoted=="string"?b.splitUnquoted:"",w="(\\"+y+`['"`+n+`]|[^\\s'"`+n+"])+",I=new RegExp(["("+e+")","("+w+"|"+o+"|"+r+")+"].join("|"),"g"),S=A(x,I);if(S.length===0)return[];v||(v={});var R=!1;return S.map(function(E){var k=E[0];if(!k||R)return;if(t.test(k))return{op:k};var F=!1,T=!1,N="",M=[],D=!1,L=null,_=!1,j;function H(){j+=1;var Z,K,te=k.charAt(j);if(te==="{"){if(j+=1,k.charAt(j)==="}")throw new Error("Bad substitution: "+k.slice(j-2,j+1));var le=1;for(Z=j;le>0&&Z<k.length;)k.charAt(Z)==="{"&&k.charAt(Z-1)==="$"?le+=1:k.charAt(Z)==="}"&&(le-=1),Z+=1;if(le!==0)throw new Error("Bad substitution: "+k.slice(j));Z-=1,K=k.slice(j,Z),j=Z}else if(/[*@#?$!_-]/.test(te))K=te,j+=1;else{var X=k.slice(j);Z=X.match(/[^\w\d_]/),Z?(K=X.slice(0,Z.index),j+=Z.index-1):(K=X,j=k.length)}return p(v,"",K)}function P(){if(L!==null){if(L===0)N!==""&&(M[M.length]=N,N="");else{M[M.length]=N,N="";for(var Z=1;Z<L;Z+=1)M[M.length]=""}L=null}}for(j=0;j<k.length;j++){var B=k.charAt(j);if(C&&B!==c&&P(),_=_||!F&&(B==="*"||B==="?"),T)N+=B,T=!1;else if(F)B===F?F=!1:F==i?N+=B:B===y?(j+=1,B=k.charAt(j),B===a||B===y||B===c?N+=B:N+=y+B):B===c?N+=H():N+=B;else if(B===a||B===i)F=B,D=!0;else{if(t.test(B))return{op:k};if(s.test(B)){R=!0;var O={comment:x.slice(E.index+j+1)};return N.length?[N,O]:[O]}else if(B===y)T=!0;else if(B===c){var G=H();if(!C)N+=G;else for(var z=0;z<G.length;z+=1){var U=G.charAt(z);C.indexOf(U)<0?(P(),N+=U):L===null?L=U===" "||U===" "||U===`
21
- `?0:1:U!==" "&&U!==" "&&U!==`
22
- `&&(L+=1)}}else N+=B}}if(_)return{op:"glob",pattern:N};if(C){if(L!==null&&L>0){M[M.length]=N,N="";for(var Q=1;Q<L;Q+=1)M[M.length]=""}return(N!==""||D&&M.length===0)&&(M[M.length]=N),M}return N}).reduce(function(E,k){return typeof k>"u"||[].concat(k).forEach(function(F){E[E.length]=F}),E},[])}return zs=function(v,b,y){var C=m(v,b,y);return typeof b!="function"?C:C.reduce(function(w,I){if(typeof I=="object")return w[w.length]=I,w;var S=I.split(RegExp("("+u+".*?"+u+")","g"));return S.length===1?(w[w.length]=S[0],w):(S.filter(Boolean).forEach(function(R){w[w.length]=g.test(R)?JSON.parse(R.split(u)[1]):R}),w)},[])},zs}var Zc;function y1(){return Zc||(Zc=1,ho.quote=b1(),ho.parse=v1()),ho}var C1=y1();const sp=["npm","go","rust","python","dotnet","custom"],pn={npm:"npm",go:"Go",rust:"Rust",python:"Python",dotnet:".NET",custom:"自定义"},I1={npm:"npmjs",go:"golang",rust:"rust",python:"python",dotnet:"dotnet"},ip=["npx","pnpx","bunx","yarn dlx","nubx","deno run","vpx"],w1=["uvx","pipx run"],ap={family:"npm",runner:"npx",runnerFlags:"",pkg:"",version:"",args:"",binary:"",raw:""},Ua=e=>{if(/["']/.test(e)){const r=(e.match(/'/gu)??[]).length,o=(e.match(/"/gu)??[]).length;if(r%2===1||o%2===1)return[]}const t=C1.parse(e),n=[];for(const r of t){if(typeof r!="string")return[];n.push(r)}return n.length===0?[]:n},Va=e=>e.startsWith("-")&&e.length>1,Rn=e=>{const t=e.lastIndexOf("@");return t>0?{base:e.slice(0,t),version:e.slice(t+1)}:{base:e,version:""}},Gn=e=>e.map(t=>t.trim()).filter(t=>t.length>0).join(" "),dr=(e,t)=>{if(t.trim().length===0)return e;const{version:n}=Rn(e);return n.length>0?e:`${e}@${t.trim()}`},k1=e=>/^(npm|jsr):/.test(e)?e:`npm:${e}`,E1=/^[A-Za-z0-9@._/:+=-]+$/u,S1=e=>E1.test(e)&&e.length>0?e:`'${e.replaceAll("'","'\\''")}'`,Sn=e=>e.map(S1).join(" "),fr=e=>{const t=[];let n=0;for(;n<e.length&&Va(e[n]??"");)t.push(e[n]??""),n+=1;return{flags:t,rest:e.slice(n)}},R1=[new Set(["-A","--allow-all","--allow-read","--allow-write","--allow-net","--allow-env","--allow-run","--allow-sys","--allow-ffi","--allow-hrtime","--no-check","--no-remote","--quiet","-q","--cached-only"]),new Set(["-y","--yes"])],D1=e=>e.includes("=")?!1:R1.some(t=>t.has(e)),pr=e=>e.every(t=>D1(t)),F1=(e,t)=>{const n=t.split(" ");if(e.length<n.length)return-1;for(let r=0;r<n.length;r+=1)if((e[r]??"")!==(n[r]??""))return-1;return n.length},hn=e=>({...ap,...e}),hr=e=>hn({family:"custom",raw:Sn(e)}),B1=e=>{const t=e[0]??"",n=e[1]??"";for(const r of ip){const o=F1(e,r);if(o>0){const{flags:s,rest:i}=fr(e.slice(o));if(!pr(s))return hr(e);const a=i[0]??"",{base:c,version:u}=a.length>0?Rn(a):{base:"",version:""};return hn({family:"npm",runner:r,runnerFlags:s.join(" "),pkg:c,version:u,args:Sn(i.slice(1)),raw:e.join(" ")})}}if(t==="go"&&n==="run"){const{flags:r,rest:o}=fr(e.slice(2));if(!pr(r))return hr(e);const s=o[0]??"",{base:i,version:a}=s.length>0?Rn(s):{base:"",version:""};return hn({family:"go",runner:"",runnerFlags:r.join(" "),pkg:i,version:a,args:Sn(o.slice(1)),raw:e.join(" ")})}if(t==="cargo"&&n==="install"){const{flags:r,rest:o}=fr(e.slice(2));if(!pr(r))return hr(e);const s=o[0]??"",i=s.length>0?Rn(s).base:"";return hn({family:"rust",runner:"",runnerFlags:r.join(" "),pkg:i,args:Sn(o.slice(1)),raw:e.join(" ")})}if(t==="uvx"||t==="pipx"&&n==="run"){const r=t==="uvx"?1:2,{flags:o,rest:s}=fr(e.slice(r));if(!pr(o))return hr(e);const i=s[0]??"",{base:a,version:c}=i.length>0?Rn(i):{base:"",version:""};return hn({family:"python",runner:t==="uvx"?"uvx":"pipx run",runnerFlags:o.join(" "),pkg:a,version:c,args:Sn(s.slice(1)),raw:e.join(" ")})}if(t==="dnx"){const{flags:r,rest:o}=fr(e.slice(1));if(!pr(r))return hr(e);const s=o[0]??"",{base:i,version:a}=s.length>0?Rn(s):{base:"",version:""};return hn({family:"dotnet",runner:"",runnerFlags:r.join(" "),pkg:i,version:a,args:Sn(o.slice(1)),raw:e.join(" ")})}return hn({family:"custom",raw:Sn(e)})},j1=e=>{const t=Ua(e);return t.length===0?hn({family:"custom",raw:e}):B1(t)},lp=e=>{const t=e.pkg.trim(),n=e.binary.trim().length>0?e.binary.trim():t;return{install:Gn(["cargo","install",e.runnerFlags,t]),run:Gn([n,e.args])}},Ii=e=>{switch(e.family){case"custom":return e.raw.trim();case"rust":return lp(e).run;case"npm":{const t=e.runner==="deno run"?k1(dr(e.pkg.trim(),e.version)):dr(e.pkg.trim(),e.version);return Gn([e.runner,e.runnerFlags,t,e.args])}case"go":return Gn(["go","run",e.runnerFlags,dr(e.pkg.trim(),e.version),e.args]);case"python":return Gn([e.runner,e.runnerFlags,dr(e.pkg.trim(),e.version),e.args]);case"dotnet":return Gn(["dnx",e.runnerFlags,dr(e.pkg.trim(),e.version),e.args])}},Ar=(e,t)=>{const n=e.trim().replace(/^(npm|jsr):/,""),r=n.split(/[/\\]/).filter(i=>i.length>0&&!i.startsWith("@")),o=r[r.length-1]??n;let s=Rn(o).base.toLowerCase();return t==="python"&&(s=s.replace(/[._]/g,"-")),s.replace(/[^a-z0-9-]/g,"")},gr=e=>{const t=[];for(const n of Ua(e)){if(Va(n))break;const r=n.toLowerCase().replace(/[^a-z0-9-]/g,"");if(r.length===0)break;t.push(r)}return t},M1=e=>{if(e.family==="custom"){const i=[];for(const u of Ua(e.raw)){if(Va(u))break;i.push(u)}const a=i.map(u=>{const f=u.split(/[/\\]/).filter(h=>h.length>0);if(f.some(h=>h.startsWith("@"))){const h=f.filter(g=>!g.startsWith("@"));return(h[h.length-1]??"").split("@")[0]??""}return(f[f.length-1]??u).split("@")[0]??""}).filter(u=>u.length>0).reverse(),c=a.length>0?a.join("."):"app.opentray";return{appId:c,appName:c==="app.opentray"?"Opentray App":c.split(".").filter(u=>u.length>0).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join(" "),identitySegments:a,tail:""}}const t=I1[e.family];let n;switch(e.family){case"npm":n=[...gr(e.args),Ar(e.pkg,"npm")];break;case"go":n=[...gr(e.args),Ar(e.pkg,"go")];break;case"rust":{const i=Ar(e.pkg,"rust"),a=e.binary.trim().length>0?e.binary.trim().toLowerCase().replace(/[^a-z0-9-]/g,""):i;n=[...gr(e.args),a];break}case"python":n=[...gr(e.args),Ar(e.pkg,"python")];break;case"dotnet":n=[...gr(e.args),Ar(e.pkg,"dotnet")];break}const r=n.filter(i=>i.length>0),o=r.length>0?`${r.join(".")}.${t}`:"app.opentray",s=r.length>0?r.map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" "):"Opentray App";return{appId:o,appName:s,identitySegments:r,tail:t}},P1=e=>{const t=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"opentray-app"},T1=(e,t)=>{let n;for(const r of e)r.key.trim()===t&&(n=r.value);return n},N1=e=>e.family==="npm"&&(e.runner==="npx"||e.runner==="pnpx")?[{key:"npm_config_yes",value:"true",note:"跳过 npm 安装确认(等效 -y),首次运行无需交互"}]:[],_1='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>.NET</title><path d="M24 8.77h-2.468v7.565h-1.425V8.77h-2.462V7.53H24zm-6.852 7.565h-4.821V7.53h4.63v1.24h-3.205v2.494h2.953v1.234h-2.953v2.604h3.396zm-6.708 0H8.882L4.78 9.863a2.896 2.896 0 0 1-.258-.51h-.036c.032.189.048.592.048 1.21v5.772H3.157V7.53h1.659l3.965 6.32c.167.261.275.442.323.54h.024c-.04-.233-.06-.629-.06-1.185V7.529h1.372zm-8.703-.693a.868.829 0 0 1-.869.829.868.829 0 0 1-.868-.83.868.829 0 0 1 .868-.828.868.829 0 0 1 .869.829Z"/></svg>',O1='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Go</title><path d="M1.811 10.231c-.047 0-.058-.023-.035-.059l.246-.315c.023-.035.081-.058.128-.058h4.172c.046 0 .058.035.035.07l-.199.303c-.023.036-.082.07-.117.07zM.047 11.306c-.047 0-.059-.023-.035-.058l.245-.316c.023-.035.082-.058.129-.058h5.328c.047 0 .07.035.058.07l-.093.28c-.012.047-.058.07-.105.07zm2.828 1.075c-.047 0-.059-.035-.035-.07l.163-.292c.023-.035.07-.07.117-.07h2.337c.047 0 .07.035.07.082l-.023.28c0 .047-.047.082-.082.082zm12.129-2.36c-.736.187-1.239.327-1.963.514-.176.046-.187.058-.34-.117-.174-.199-.303-.327-.548-.444-.737-.362-1.45-.257-2.115.175-.795.514-1.204 1.274-1.192 2.22.011.935.654 1.706 1.577 1.835.795.105 1.46-.175 1.987-.77.105-.13.198-.27.315-.434H10.47c-.245 0-.304-.152-.222-.35.152-.362.432-.97.596-1.274a.315.315 0 01.292-.187h4.253c-.023.316-.023.631-.07.947a4.983 4.983 0 01-.958 2.29c-.841 1.11-1.94 1.8-3.33 1.986-1.145.152-2.209-.07-3.143-.77-.865-.655-1.356-1.52-1.484-2.595-.152-1.274.222-2.419.993-3.424.83-1.086 1.928-1.776 3.272-2.02 1.098-.2 2.15-.07 3.096.571.62.41 1.063.97 1.356 1.648.07.105.023.164-.117.2m3.868 6.461c-1.064-.024-2.034-.328-2.852-1.029a3.665 3.665 0 01-1.262-2.255c-.21-1.32.152-2.489.947-3.529.853-1.122 1.881-1.706 3.272-1.95 1.192-.21 2.314-.095 3.33.595.923.63 1.496 1.484 1.648 2.605.198 1.578-.257 2.863-1.344 3.962-.771.783-1.718 1.273-2.805 1.495-.315.06-.63.07-.934.106zm2.78-4.72c-.011-.153-.011-.27-.034-.387-.21-1.157-1.274-1.81-2.384-1.554-1.087.245-1.788.935-2.045 2.033-.21.912.234 1.835 1.075 2.21.643.28 1.285.244 1.905-.07.923-.48 1.425-1.228 1.484-2.233z"/></svg>',H1='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>npm</title><path d="M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z"/></svg>',L1='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Python</title><path d="M14.25.18l.9.2.73.26.59.3.45.32.34.34.25.34.16.33.1.3.04.26.02.2-.01.13V8.5l-.05.63-.13.55-.21.46-.26.38-.3.31-.33.25-.35.19-.35.14-.33.1-.3.07-.26.04-.21.02H8.77l-.69.05-.59.14-.5.22-.41.27-.33.32-.27.35-.2.36-.15.37-.1.35-.07.32-.04.27-.02.21v3.06H3.17l-.21-.03-.28-.07-.32-.12-.35-.18-.36-.26-.36-.36-.35-.46-.32-.59-.28-.73-.21-.88-.14-1.05-.05-1.23.06-1.22.16-1.04.24-.87.32-.71.36-.57.4-.44.42-.33.42-.24.4-.16.36-.1.32-.05.24-.01h.16l.06.01h8.16v-.83H6.18l-.01-2.75-.02-.37.05-.34.11-.31.17-.28.25-.26.31-.23.38-.2.44-.18.51-.15.58-.12.64-.1.71-.06.77-.04.84-.02 1.27.05zm-6.3 1.98l-.23.33-.08.41.08.41.23.34.33.22.41.09.41-.09.33-.22.23-.34.08-.41-.08-.41-.23-.33-.33-.22-.41-.09-.41.09zm13.09 3.95l.28.06.32.12.35.18.36.27.36.35.35.47.32.59.28.73.21.88.14 1.04.05 1.23-.06 1.23-.16 1.04-.24.86-.32.71-.36.57-.4.45-.42.33-.42.24-.4.16-.36.09-.32.05-.24.02-.16-.01h-8.22v.82h5.84l.01 2.76.02.36-.05.34-.11.31-.17.29-.25.25-.31.24-.38.2-.44.17-.51.15-.58.13-.64.09-.71.07-.77.04-.84.01-1.27-.04-1.07-.14-.9-.2-.73-.25-.59-.3-.45-.33-.34-.34-.25-.34-.16-.33-.1-.3-.04-.25-.02-.2.01-.13v-5.34l.05-.64.13-.54.21-.46.26-.38.3-.32.33-.24.35-.2.35-.14.33-.1.3-.06.26-.04.21-.02.13-.01h5.84l.69-.05.59-.14.5-.21.41-.28.33-.32.27-.35.2-.36.15-.36.1-.35.07-.32.04-.28.02-.21V6.07h2.09l.14.01zm-6.47 14.25l-.23.33-.08.41.08.41.23.33.33.23.41.08.41-.08.33-.23.23-.33.08-.41-.08-.41-.23-.33-.33-.23-.41-.08-.41.08z"/></svg>',K1='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Rust</title><path d="M23.8346 11.7033l-1.0073-.6236a13.7268 13.7268 0 00-.0283-.2936l.8656-.8069a.3483.3483 0 00-.1154-.578l-1.1066-.414a8.4958 8.4958 0 00-.087-.2856l.6904-.9587a.3462.3462 0 00-.2257-.5446l-1.1663-.1894a9.3574 9.3574 0 00-.1407-.2622l.49-1.0761a.3437.3437 0 00-.0274-.3361.3486.3486 0 00-.3006-.154l-1.1845.0416a6.7444 6.7444 0 00-.1873-.2268l.2723-1.153a.3472.3472 0 00-.417-.4172l-1.1532.2724a14.0183 14.0183 0 00-.2278-.1873l.0415-1.1845a.3442.3442 0 00-.49-.328l-1.076.491c-.0872-.0476-.1742-.0952-.2623-.1407l-.1903-1.1673A.3483.3483 0 0016.256.955l-.9597.6905a8.4867 8.4867 0 00-.2855-.086l-.414-1.1066a.3483.3483 0 00-.5781-.1154l-.8069.8666a9.2936 9.2936 0 00-.2936-.0284L12.2946.1683a.3462.3462 0 00-.5892 0l-.6236 1.0073a13.7383 13.7383 0 00-.2936.0284L9.9803.3374a.3462.3462 0 00-.578.1154l-.4141 1.1065c-.0962.0274-.1903.0567-.2855.086L7.744.955a.3483.3483 0 00-.5447.2258L7.009 2.348a9.3574 9.3574 0 00-.2622.1407l-1.0762-.491a.3462.3462 0 00-.49.328l.0416 1.1845a7.9826 7.9826 0 00-.2278.1873L3.8413 3.425a.3472.3472 0 00-.4171.4171l.2713 1.1531c-.0628.075-.1255.1509-.1863.2268l-1.1845-.0415a.3462.3462 0 00-.328.49l.491 1.0761a9.167 9.167 0 00-.1407.2622l-1.1662.1894a.3483.3483 0 00-.2258.5446l.6904.9587a13.303 13.303 0 00-.087.2855l-1.1065.414a.3483.3483 0 00-.1155.5781l.8656.807a9.2936 9.2936 0 00-.0283.2935l-1.0073.6236a.3442.3442 0 000 .5892l1.0073.6236c.008.0982.0182.1964.0283.2936l-.8656.8079a.3462.3462 0 00.1155.578l1.1065.4141c.0273.0962.0567.1914.087.2855l-.6904.9587a.3452.3452 0 00.2268.5447l1.1662.1893c.0456.088.0922.1751.1408.2622l-.491 1.0762a.3462.3462 0 00.328.49l1.1834-.0415c.0618.0769.1235.1528.1873.2277l-.2713 1.1541a.3462.3462 0 00.4171.4161l1.153-.2713c.075.0638.151.1255.2279.1863l-.0415 1.1845a.3442.3442 0 00.49.327l1.0761-.49c.087.0486.1741.0951.2622.1407l.1903 1.1662a.3483.3483 0 00.5447.2268l.9587-.6904a9.299 9.299 0 00.2855.087l.414 1.1066a.3452.3452 0 00.5781.1154l.8079-.8656c.0972.0111.1954.0203.2936.0294l.6236 1.0073a.3472.3472 0 00.5892 0l.6236-1.0073c.0982-.0091.1964-.0183.2936-.0294l.8069.8656a.3483.3483 0 00.578-.1154l.4141-1.1066a8.4626 8.4626 0 00.2855-.087l.9587.6904a.3452.3452 0 00.5447-.2268l.1903-1.1662c.088-.0456.1751-.0931.2622-.1407l1.0762.49a.3472.3472 0 00.49-.327l-.0415-1.1845a6.7267 6.7267 0 00.2267-.1863l1.1531.2713a.3472.3472 0 00.4171-.416l-.2713-1.1542c.0628-.0749.1255-.1508.1863-.2278l1.1845.0415a.3442.3442 0 00.328-.49l-.49-1.076c.0475-.0872.0951-.1742.1407-.2623l1.1662-.1893a.3483.3483 0 00.2258-.5447l-.6904-.9587.087-.2855 1.1066-.414a.3462.3462 0 00.1154-.5781l-.8656-.8079c.0101-.0972.0202-.1954.0283-.2936l1.0073-.6236a.3442.3442 0 000-.5892zm-6.7413 8.3551a.7138.7138 0 01.2986-1.396.714.714 0 11-.2997 1.396zm-.3422-2.3142a.649.649 0 00-.7715.5l-.3573 1.6685c-1.1035.501-2.3285.7795-3.6193.7795a8.7368 8.7368 0 01-3.6951-.814l-.3574-1.6684a.648.648 0 00-.7714-.499l-1.473.3158a8.7216 8.7216 0 01-.7613-.898h7.1676c.081 0 .1356-.0141.1356-.088v-2.536c0-.074-.0536-.0881-.1356-.0881h-2.0966v-1.6077h2.2677c.2065 0 1.1065.0587 1.394 1.2088.0901.3533.2875 1.5044.4232 1.8729.1346.413.6833 1.2381 1.2685 1.2381h3.5716a.7492.7492 0 00.1296-.0131 8.7874 8.7874 0 01-.8119.9526zM6.8369 20.024a.714.714 0 11-.2997-1.396.714.714 0 01.2997 1.396zM4.1177 8.9972a.7137.7137 0 11-1.304.5791.7137.7137 0 011.304-.579zm-.8352 1.9813l1.5347-.6824a.65.65 0 00.33-.8585l-.3158-.7147h1.2432v5.6025H3.5669a8.7753 8.7753 0 01-.2834-3.348zm6.7343-.5437V8.7836h2.9601c.153 0 1.0792.1772 1.0792.8697 0 .575-.7107.7815-1.2948.7815zm10.7574 1.4862c0 .2187-.008.4363-.0243.651h-.9c-.09 0-.1265.0586-.1265.1477v.413c0 .973-.5487 1.1846-1.0296 1.2382-.4576.0517-.9648-.1913-1.0275-.4717-.2704-1.5186-.7198-1.8436-1.4305-2.4034.8817-.5599 1.799-1.386 1.799-2.4915 0-1.1936-.819-1.9458-1.3769-2.3153-.7825-.5163-1.6491-.6195-1.883-.6195H5.4682a8.7651 8.7651 0 014.907-2.7699l1.0974 1.151a.648.648 0 00.9182.0213l1.227-1.1743a8.7753 8.7753 0 016.0044 4.2762l-.8403 1.8982a.652.652 0 00.33.8585l1.6178.7188c.0283.2875.0425.577.0425.8717zm-9.3006-9.5993a.7128.7128 0 11.984 1.0316.7137.7137 0 01-.984-1.0316zm8.3389 6.71a.7107.7107 0 01.9395-.3625.7137.7137 0 11-.9405.3635z"/></svg>',mr=e=>{const t=e.replace(/<title>[\s\S]*?<\/title>/g,"");return({className:r})=>l.jsx("span",{"aria-hidden":"true",className:fe("inline-flex size-4 shrink-0 [&_svg]:size-full [&_svg]:fill-current",r),dangerouslySetInnerHTML:{__html:t}})},Oo={npm:mr(H1),go:mr(O1),rust:mr(K1),python:mr(L1),dotnet:mr(_1),custom:gu},W1=sp.filter(e=>e!=="custom"),Jc=(e,t,n)=>l.jsx(Pa,{variant:"outline",size:"sm",className:"flex max-w-full flex-wrap",value:[t],onValueChange:r=>{const o=r[0];o!==void 0&&e.includes(o)&&n(o)},children:e.map(r=>l.jsx(Br,{value:r,className:"px-2.5 text-xs",children:r},r))});function Q1({open:e,draft:t,envPreset:n,onEnvPresetChange:r,onDraftChange:o,onFamilyChange:s,onCancel:i,onApply:a}){const c=p=>{p||i()},u=p=>o({...t,...p}),f=M1(t),h=Ii(t),g=t.family==="rust"?lp(t):null,A=Oo[t.family];return l.jsx(Ta,{open:e,onOpenChange:c,children:l.jsxs(Na,{className:"max-h-[85vh] overflow-y-auto sm:max-w-md",children:[l.jsxs(Kn,{children:[l.jsxs(Wn,{className:"flex items-center gap-2",children:[l.jsxs(Do,{children:[l.jsxs(Fo,{className:"flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring","aria-label":"切换命令系列",title:"切换命令系列",children:[l.jsx(A,{className:"size-4"}),l.jsx(Tn,{className:"size-3"})]}),l.jsx(Bo,{align:"start",className:"w-36",children:W1.map(p=>{const m=Oo[p];return l.jsxs(jo,{onClick:()=>s(p),className:p===t.family?"bg-accent/60":void 0,children:[l.jsx(m,{className:"text-muted-foreground"}),pn[p]]},p)})})]}),"配置 ",pn[t.family]," 系列命令"]}),l.jsx(_a,{children:"修改字段实时预览命令与默认应用标识;确定后写回命令行。"})]}),l.jsxs("div",{className:"space-y-4",children:[t.family==="npm"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx(Me,{children:"Runner"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"同一包换 runner 推导结果不变;deno run 自动补 npm: 前缀。"}),Jc(ip,t.runner,p=>u({runner:p}))]}),t.runnerFlags.length>0||t.runner==="deno run"?l.jsxs("div",{children:[l.jsx(Me,{children:"Runner 参数"}),l.jsx(qe,{className:"mt-1.5 font-mono text-xs",placeholder:"-A",value:t.runnerFlags,onChange:p=>u({runnerFlags:p.target.value})})]}):null,l.jsxs("div",{className:"grid grid-cols-[1fr_110px] gap-3",children:[l.jsxs("div",{children:[l.jsx(Me,{children:"包名"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"支持 @scope/name 与 npm: 前缀。"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"@deepseek-ai/dsh",value:t.pkg,onChange:p=>u({pkg:p.target.value})})]}),l.jsxs("div",{children:[l.jsx(Me,{children:"版本"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空 = latest。"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"latest",value:t.version,onChange:p=>u({version:p.target.value})})]})]}),l.jsxs("div",{children:[l.jsx(Me,{children:"运行参数"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"追加在包名之后;子命令参与 appId 推导。"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"web --port 3000",value:t.args,onChange:p=>u({args:p.target.value})})]})]}):null,t.family==="go"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-[1fr_110px] gap-3",children:[l.jsxs("div",{children:[l.jsx(Me,{children:"Module 路径"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"取末段作为身份,如 rsc.io/fortune → fortune。"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"rsc.io/fortune",value:t.pkg,onChange:p=>u({pkg:p.target.value})})]}),l.jsxs("div",{children:[l.jsx(Me,{children:"版本"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空 = 本地/默认。"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"latest",value:t.version,onChange:p=>u({version:p.target.value})})]})]}),l.jsxs("div",{children:[l.jsx(Me,{children:"运行参数"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"serve --port 8080",value:t.args,onChange:p=>u({args:p.target.value})})]})]}):null,t.family==="rust"&&g!==null?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx(Me,{children:"安装 crate"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"cargo install 目标;Rust 不能直跑,需先安装。"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"ripgrep",value:t.pkg,onChange:p=>u({pkg:p.target.value})})]}),l.jsxs("div",{children:[l.jsx(Me,{children:"运行二进制"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空默认与 crate 同名。"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:t.pkg.trim().length>0?t.pkg.trim():"二进制名",value:t.binary,onChange:p=>u({binary:p.target.value})})]})]}),l.jsxs("div",{children:[l.jsx(Me,{children:"运行参数"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"--json .",value:t.args,onChange:p=>u({args:p.target.value})})]}),l.jsxs("div",{className:"space-y-1 rounded-lg bg-muted/60 p-2.5 font-mono text-xs",children:[l.jsxs("p",{className:"text-muted-foreground",children:[l.jsx("span",{className:"mr-1.5 select-none",children:"$"}),g.install]}),l.jsxs("p",{children:[l.jsx("span",{className:"mr-1.5 select-none text-muted-foreground",children:"$"}),g.run]})]})]}):null,t.family==="python"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx(Me,{children:"Runner"}),Jc(w1,t.runner,p=>u({runner:p}))]}),l.jsxs("div",{className:"grid grid-cols-[1fr_110px] gap-3",children:[l.jsxs("div",{children:[l.jsx(Me,{children:"包名"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"包名中的 . _ 归一为 - 参与推导。"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"ruff",value:t.pkg,onChange:p=>u({pkg:p.target.value})})]}),l.jsxs("div",{children:[l.jsx(Me,{children:"版本"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"latest",value:t.version,onChange:p=>u({version:p.target.value})})]})]}),l.jsxs("div",{children:[l.jsx(Me,{children:"运行参数"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"format --check .",value:t.args,onChange:p=>u({args:p.target.value})})]})]}):null,t.family==="dotnet"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-[1fr_110px] gap-3",children:[l.jsxs("div",{children:[l.jsx(Me,{children:"工具 ID"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:".NET 10 dnx:NuGet 工具临时运行,无需安装。"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"dotnet-format",value:t.pkg,onChange:p=>u({pkg:p.target.value})})]}),l.jsxs("div",{children:[l.jsx(Me,{children:"版本"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"latest",value:t.version,onChange:p=>u({version:p.target.value})})]})]}),l.jsxs("div",{children:[l.jsx(Me,{children:"运行参数"}),l.jsx(qe,{className:"mt-0 font-mono text-xs",placeholder:"--verify-no-changes",value:t.args,onChange:p=>u({args:p.target.value})})]})]}):null]},t.family),l.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/60 px-3 py-2",children:l.jsx("code",{className:"min-w-0 flex-1 font-mono text-xs break-all",children:h.length>0?h:l.jsx("span",{className:"text-muted-foreground",children:"填写后生成命令…"})})}),n!==null?l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsx("span",{className:"text-[11px] text-muted-foreground",children:"环境变量预设"}),n.state==="off"?l.jsxs("button",{type:"button",className:"rounded-md px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground underline-offset-2 transition-colors hover:bg-accent hover:text-foreground hover:underline",title:n.defaultNote,onClick:()=>r("enable"),children:["+ ",n.key,"=true(启用)"]}):l.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-md border border-border bg-secondary/60 py-0.5 pr-1 pl-1.5 font-mono text-[11px]",title:"来自下方「命令选项 → 环境变量」配置(唯一可信源),两侧同步",children:[n.key,"=",n.explicitValue??"",l.jsx("span",{className:"font-sans text-[10px] text-muted-foreground",children:"env 已配置"}),l.jsx("button",{type:"button","aria-label":"移除环境变量预设",title:n.defaultNote,className:"rounded px-1 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>r("disable"),children:"×"})]})]}):l.jsx("p",{className:"text-[11px] text-muted-foreground",children:"此系列/runner 无需注入环境变量。"}),l.jsxs("div",{className:"space-y-1 rounded-lg border border-border bg-muted/40 p-3",children:[l.jsx("p",{className:"text-[11px] text-muted-foreground",children:"默认应用标识(由命令推导,可在下方应用配置中覆盖)"}),l.jsx("code",{className:"font-mono text-sm font-medium break-all",children:f.appId}),l.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["名称 ",f.appName," · ~/.opentray/create/",P1(f.appId),"/"]})]}),l.jsxs(fb,{children:[l.jsx(ub,{render:l.jsx(Oe,{variant:"outline"}),children:"取消"}),l.jsxs(Oe,{onClick:()=>{a(t)},children:[l.jsx(_i,{}),"确定"]})]})]})})}const $c=e=>({...ap,family:e,runner:e==="python"?"uvx":e==="npm"?"npx":""}),Xc=e=>e!=="custom",Us=(e,t)=>e.family===t.family&&e.runner===t.runner&&e.runnerFlags===t.runnerFlags&&e.pkg===t.pkg&&e.version===t.version&&e.args===t.args&&e.binary===t.binary&&e.raw===t.raw;function G1({command:e,onCommandChange:t,commandOptions:n,onCommandOptionsChange:r,disabled:o,onRun:s}){const i=d.useMemo(()=>j1(e),[e]),a=n.family,c=d.useRef({}),[u,f]=d.useState(null),[h,g]=d.useState(a?.family??null);d.useEffect(()=>{if(a!==null){if(c.current[a.family]=a,u===null){g(P=>P===a.family?P:a.family);return}!Xc(a.family)||u.currentFamily!==a.family||f(P=>{if(P===null||P.currentFamily!==a.family)return P;const B=P.drafts[a.family],O=P.bases[a.family];return B===void 0||O===void 0||!Us(B,O)?P:{...P,drafts:{...P.drafts,[a.family]:a},bases:{...P.bases,[a.family]:a}}})}},[a,u===null]);const A=h??i.family,p=P=>{if(a!==null&&a.family===P)return a;const B=c.current[P];return B!==void 0?B:i.family===P?i:$c(P)},[m,x]=d.useState(!1),[v,b]=d.useState(!1),[y,C]=d.useState(!1),w=u===null?void 0:u.drafts[u.currentFamily],I=w??n.family??i,S=N1(I)[0],R=S===void 0?void 0:T1(n.env,S.key),E=S===void 0?null:{key:S.key,defaultNote:S.note,state:R!==void 0?"explicit":"off",...R!==void 0?{explicitValue:R}:{}},k=R!==void 0,F=P=>{const B=S?.key??"npm_config_yes",O=P==="enable"?[...n.env.filter(G=>G.key.trim()!==B),{key:B,value:"true"}]:n.env.filter(G=>G.key.trim()!==B);r({...n,env:O})},T=P=>{if(P===A)return;g(P);const B={...n,...n.argsMode==="array"?{argsMode:"string"}:{}},O=p(P);c.current[P]===void 0&&(c.current[P]=O),r({...B,family:P==="custom"?null:O}),t(Ii(O))},N=()=>{if(!Xc(A))return;const P=p(A);f({snapshot:{family:A,state:P},currentFamily:A,drafts:{[A]:P},bases:{[A]:P}})},M=P=>{f(B=>B===null||B.currentFamily!==P.family?B:{...B,drafts:{...B.drafts,[P.family]:P}})},D=P=>{f(B=>{if(B===null||B.currentFamily===P)return B;const O=B.drafts[P],G=B.bases[P],z=p(P),U=O!==void 0&&G!==void 0&&!Us(O,G),Q=U?O:z;return{...B,currentFamily:P,drafts:{...B.drafts,[P]:Q},bases:{...B.bases,[P]:U?G:z}}})},L=()=>{f(P=>{if(P===null)return P;const B=c.current[P.snapshot.family];return(B===void 0||Us(B,P.snapshot.state))&&(c.current[P.snapshot.family]=P.snapshot.state),null})},_=P=>{c.current[P.family]=P,g(P.family),t(Ii(P)),r({...n,...n.argsMode==="array"?{argsMode:"string"}:{},family:P}),f(null)},j=Oo[A],H=A==="custom";return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex h-8 w-full min-w-0 items-stretch rounded-lg border border-input bg-transparent transition-colors outline-none focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 disabled:opacity-50 dark:bg-input/30",children:[l.jsxs(Do,{children:[l.jsxs(Fo,{disabled:o,className:"flex w-11 items-center justify-between gap-1 rounded-l-lg border-r border-input transition-colors outline-none hover:bg-accent focus-visible:z-10 focus-visible:border-ring","aria-label":`命令系列:${pn[A]},点击切换`,title:`命令系列:${pn[A]}`,children:[l.jsx(j,{className:"size-4 text-muted-foreground ms-2"}),l.jsx(Tn,{className:"size-3 text-muted-foreground/70 me-0.75"})]}),l.jsx(Bo,{align:"start",className:"w-36",children:sp.map(P=>{const B=Oo[P];return l.jsxs(jo,{onClick:()=>T(P),className:P===A?"bg-accent/60":void 0,children:[l.jsx(B,{className:"text-muted-foreground"}),pn[P]]},P)})})]}),H?l.jsx("input",{className:"h-full w-full min-w-0 flex-1 bg-transparent px-2.5 font-mono text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed",placeholder:"npx somecommand start --xx",disabled:o,value:e,onChange:P=>t(P.target.value),onKeyDown:P=>{P.key==="Enter"&&!o&&s()}}):l.jsx("button",{type:"button",className:"h-full min-w-0 flex-1 cursor-pointer truncate px-2.5 text-left font-mono text-sm outline-none select-none disabled:cursor-not-allowed disabled:opacity-60",disabled:o,title:e.length>0?e:`点击配置 ${pn[A]} 系列命令`,"aria-label":`配置 ${pn[A]} 系列命令`,onClick:N,children:e.length>0?e:l.jsxs("span",{className:"text-muted-foreground",children:["点击配置 ",pn[A]," 系列命令…"]})}),k&&S!==void 0?l.jsxs(ls,{open:m||v||y,onOpenChange:P=>{P||C(!1)},children:[l.jsx(cs,{render:l.jsx("span",{tabIndex:0,className:"mr-1 flex size-6 shrink-0 self-center cursor-help items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring","aria-label":"命令将携带 npm_config_yes 环境变量,悬停或点击查看",onPointerEnter:()=>x(!0),onPointerLeave:()=>x(!1),onFocus:()=>b(!0),onBlur:()=>b(!1),onClick:()=>C(P=>!P)}),children:l.jsx(Sr,{className:"size-3.5"})}),l.jsx(us,{side:"top",children:l.jsxs("div",{className:"space-y-1 text-left",children:[l.jsx("p",{className:"text-[11px] opacity-70",children:"环境变量预设"}),l.jsxs("p",{className:"font-mono text-xs",children:[S.key,"=",R]}),l.jsx("p",{className:"text-[11px] opacity-70",children:"来自「命令选项 → 环境变量」配置(唯一可信源,两侧同步)"})]})})]}):null]}),l.jsx(Q1,{open:u!==null,draft:w??$c(A),envPreset:E,onEnvPresetChange:F,onDraftChange:M,onFamilyChange:D,onCancel:L,onApply:_})]})}function Y1({tags:e,onTagsChange:t,disabled:n=!1,placeholder:r,className:o,...s}){const[i,a]=d.useState(""),c=()=>{i.length!==0&&(t([...e,i]),a(""))};return l.jsxs("div",{className:fe("flex min-h-9 w-full flex-wrap items-center gap-1.5 rounded-md border border-input bg-transparent px-2 py-1.5 font-mono text-xs shadow-xs focus-within:border-ring",n&&"opacity-50",o),children:[e.map((u,f)=>l.jsxs("span",{className:"flex items-center gap-1 rounded bg-accent px-1.5 py-0.5 text-accent-foreground",children:[l.jsx("span",{className:"max-w-56 truncate",title:u,children:u}),n?null:l.jsx("button",{type:"button","aria-label":`移除参数 ${f+1}`,className:"text-muted-foreground hover:text-foreground",onClick:()=>{t(e.filter((h,g)=>g!==f))},children:l.jsx(Hi,{className:"size-3"})})]},`${f}:${u}`)),l.jsx("input",{className:"min-w-24 flex-1 bg-transparent font-mono text-xs outline-none placeholder:text-muted-foreground",value:i,disabled:n,placeholder:r??(e.length===0?"程序(如 npx)":"参数,回车添加"),onChange:u=>a(u.target.value),onKeyDown:u=>{if(u.key==="Enter"){u.preventDefault(),c();return}u.key==="Backspace"&&i.length===0&&e.length>0&&(u.preventDefault(),t(e.slice(0,-1)))},onBlur:c,...s})]})}function z1({command:e,onCommandChange:t,argv:n,onArgvChange:r,runAlive:o,frozen:s,failedReason:i,commandOptions:a,defaultCwd:c,onCommandOptionsChange:u,onRun:f,onStop:h}){const g=A=>{u({...a,...A})};return l.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[l.jsxs("div",{className:"flex gap-2",children:[a.argsMode==="array"?l.jsx(Y1,{tags:n,onTagsChange:r,disabled:o,"aria-label":"命令参数(argv)"}):l.jsx(G1,{command:e,onCommandChange:t,commandOptions:a,onCommandOptionsChange:u,disabled:o||s,onRun:f}),o?l.jsxs(Oe,{variant:"destructive",onClick:h,"aria-label":"中断命令",children:[l.jsx(Ph,{}),"中断"]}):l.jsxs(Oe,{disabled:s,onClick:f,"aria-label":"运行命令",children:[l.jsx(kh,{}),"运行"]})]}),i!==void 0?l.jsx("p",{className:"mt-2 font-mono text-xs text-red-400",children:i}):null,l.jsx(Fa,{defaultValue:["command"],className:"mt-3 border-t border-border pt-1",children:l.jsxs(Ba,{value:"command",className:"border-b-0",children:[l.jsx(ja,{children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(Fh,{className:"size-4 text-muted-foreground"}),"命令选项"]})}),l.jsxs(Ma,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[l.jsxs("div",{children:[l.jsx(Me,{children:"参数输入模式"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"数组模式逐个输入参数(回车添加),原样传递、绝不拆分。"}),l.jsxs(Pa,{variant:"outline",size:"sm",spacing:0,value:[a.argsMode],onValueChange:A=>{const p=A[0];(p==="string"||p==="array")&&g({argsMode:p})},disabled:s,children:[l.jsx(Br,{value:"string",children:"字符串"}),l.jsx(Br,{value:"array",children:"数组 (argv)"})]})]}),l.jsxs("div",{children:[l.jsx(Me,{htmlFor:"cmd-cwd",children:"工作目录 (cwd)"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空使用用户主目录(下方完整路径);相对路径按主目录解析。"}),l.jsx(qe,{id:"cmd-cwd",className:"mt-0 font-mono text-xs",disabled:s,value:a.cwd,placeholder:c.length>0?`默认:${c}`:"默认:用户主目录",title:c,onChange:A=>g({cwd:A.target.value})}),c.length>0&&a.cwd.trim().length===0?l.jsx("p",{className:"mt-1 font-mono text-[11px] break-all text-muted-foreground",children:c}):null]})]}),l.jsxs("div",{children:[l.jsx(Me,{children:"环境变量 (env)"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"启动命令时叠加在当前环境之上;同时写入生成的应用。"}),l.jsxs("div",{className:"space-y-1.5",children:[a.env.length===0?l.jsx("p",{className:"text-xs text-muted-foreground",children:"未配置"}):a.env.map((A,p)=>l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx(qe,{className:"font-mono text-xs",disabled:s,"aria-label":`env 名称 ${p+1}`,value:A.key,placeholder:"NAME",onChange:m=>{const x=[...a.env];x[p]={...A,key:m.target.value},g({env:x})}}),l.jsx(qe,{className:"font-mono text-xs",disabled:s,"aria-label":`env 值 ${p+1}`,value:A.value,placeholder:"value",onChange:m=>{const x=[...a.env];x[p]={...A,value:m.target.value},g({env:x})}}),l.jsx(Oe,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":"删除环境变量",onClick:()=>{g({env:a.env.filter((m,x)=>x!==p)})},children:"×"})]},p)),l.jsxs(Oe,{variant:"outline",size:"sm",disabled:s,onClick:()=>g({env:[...a.env,{key:"",value:""}]}),children:[l.jsx(Sr,{className:"size-3.5"}),"添加变量"]})]})]})]})]})})]})}const qc=e=>{const t=e.trim();return t.length===0?"":/^https?:\/\//iu.test(t)?t:`https://${t}`};function U1({value:e,onChange:t,activeSource:n,frozen:r,loading:o,failedReason:s,onSubmit:i}){return l.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 pb-3 text-sm font-medium text-muted-foreground",children:[l.jsx(dh,{className:"size-4"}),"网页地址"]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx($s,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),l.jsx(qe,{className:"pl-8 font-mono text-xs",value:e,placeholder:"https://example.com",disabled:r,onChange:a=>t(a.target.value),onKeyDown:a=>{if(a.key!=="Enter"||r||o)return;const c=qc(e);t(c),i(c)},"aria-label":"网页地址"})]}),l.jsxs(Oe,{size:"sm",disabled:r||o||e.trim().length===0,onClick:()=>{const a=qc(e);t(a),i(a)},children:[o?l.jsx(Ah,{className:"size-4 animate-spin"}):null,"获取预设"]})]}),s!==void 0?l.jsx("p",{className:"pt-2 text-xs text-destructive",role:"alert",children:s}):null,n!==void 0?l.jsxs("p",{className:"pt-2 text-xs text-muted-foreground",children:["源地址:",l.jsx("span",{className:"font-mono",children:n}),"——标题/图标预设来自该页面,均可在下方修改。"]}):l.jsx("p",{className:"pt-2 text-xs text-muted-foreground",children:"直接把网页打包成应用:不需要命令,创建时抓取页面标题与图标作为预设。"})]})}const Vs=["scaffold","icon","install"];function V1({open:e,phase:t,frozenValues:n,iconSrc:r,iconLabel:o,traySrc:s,trayLabel:i,selectedPort:a,currentStep:c,logs:u,error:f,result:h,onBack:g,onCreate:A,onShare:p,onOpenApp:m,onClose:x,confirmError:v,onOpenChange:b}){const y=d.useRef(null);d.useEffect(()=>{y.current?.scrollTo({top:y.current.scrollHeight})},[u.length]);const C=w=>{const I=Vs.indexOf(w),S=Vs.indexOf(c);return t==="success"||I<S?"done":I===S?"active":""};return l.jsx(Ta,{open:e,onOpenChange:w=>{t==="pending"&&w===!1||b(w)},children:l.jsx(Na,{className:"max-w-xl",children:t==="confirm"?l.jsxs(l.Fragment,{children:[l.jsxs(Kn,{children:[l.jsx(Wn,{children:"确认应用信息"}),l.jsx(_a,{children:"表单已固定,以下值将用于生成应用。"})]}),l.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-sm",children:[l.jsx("dt",{className:"text-muted-foreground",children:"App ID"}),l.jsx("dd",{className:"font-mono break-all",children:n.appId}),l.jsx("dt",{className:"text-muted-foreground",children:"应用名称"}),l.jsx("dd",{className:"break-all",children:n.appName}),l.jsx("dt",{className:"text-muted-foreground",children:"图标"}),l.jsxs("dd",{className:"flex flex-wrap items-center gap-4",children:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"icon-checker flex size-10 items-center justify-center overflow-hidden rounded-md","aria-label":"应用图标预览",children:r!==void 0?l.jsx("img",{src:r,alt:"应用图标",className:"size-full object-contain"}):l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"无"})}),l.jsxs("span",{className:"flex flex-col",children:[l.jsx("span",{className:"text-xs leading-tight",children:"应用图标"}),l.jsx("span",{className:"font-mono text-[10px] leading-tight text-muted-foreground",children:o})]})]}),l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"icon-checker flex size-10 items-center justify-center overflow-hidden rounded-md","aria-label":"托盘图标预览",children:s!==void 0?l.jsx("img",{src:s,alt:"托盘图标",className:"size-full object-contain"}):l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"文字"})}),l.jsxs("span",{className:"flex flex-col",children:[l.jsx("span",{className:"text-xs leading-tight",children:"托盘图标"}),l.jsx("span",{className:"font-mono text-[10px] leading-tight text-muted-foreground",children:i})]})]})]}),l.jsx("dt",{className:"text-muted-foreground",children:"服务端口"}),l.jsx("dd",{className:"font-mono",children:a!==void 0?`:${a}(生成后运行时重新嗅探)`:"运行时嗅探"}),l.jsx("dt",{className:"text-muted-foreground",children:"包管理器"}),l.jsx("dd",{children:n.pm})]}),v!==void 0?l.jsx("p",{className:"text-xs font-medium text-red-400",children:v}):null,l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Oe,{variant:"outline",onClick:g,children:"返回修改"}),l.jsx(Oe,{variant:"outline",onClick:p,children:"分享"}),l.jsx(Oe,{onClick:A,children:"确认生成"})]})]}):t==="pending"?l.jsxs(l.Fragment,{children:[l.jsx(Kn,{children:l.jsx(Wn,{children:"正在生成应用…"})}),l.jsx("div",{className:"flex flex-wrap gap-1.5",children:Vs.map(w=>l.jsx(bo,{variant:C(w)==="done"?"default":"secondary",children:w},w))}),l.jsx("div",{ref:y,className:"h-48 overflow-y-auto rounded-md border border-border bg-[#05070b] p-3 font-mono text-[11px] leading-5 text-[#b7c3d8] whitespace-pre-wrap",children:u.join(`
23
- `)})]}):t==="success"&&h!==void 0?l.jsxs(l.Fragment,{children:[l.jsx(Kn,{children:l.jsxs(Wn,{className:"flex items-center gap-2",children:[l.jsx(Jp,{className:"size-5 text-emerald-400"}),"应用已生成"]})}),l.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-sm",children:[l.jsx("dt",{className:"text-muted-foreground",children:"项目目录"}),l.jsx("dd",{className:"font-mono break-all",children:h.projectDir}),h.bundlePath?l.jsxs(l.Fragment,{children:[l.jsx("dt",{className:"text-muted-foreground",children:"macOS Bundle"}),l.jsx("dd",{className:"font-mono break-all",children:h.bundlePath})]}):null]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Oe,{variant:"outline",onClick:x,children:"完成"}),l.jsxs(Oe,{onClick:m,children:[l.jsx(Au,{}),"打开应用"]})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:h.pinHint})]}):l.jsxs(l.Fragment,{children:[l.jsx(Kn,{children:l.jsxs(Wn,{className:"flex items-center gap-2",children:[l.jsx(Lh,{className:"size-5 text-red-400"}),"生成失败"]})}),l.jsx("p",{className:"break-all font-mono text-xs text-red-400",children:f??"未知错误"}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Oe,{variant:"outline",onClick:g,children:"返回重试"})})]})})})}const eu=(e,t)=>{const n=d.useRef(e);n.current=e;const r=d.useRef(void 0),o=d.useRef(void 0),s=d.useCallback(()=>{r.current!==void 0&&(clearTimeout(r.current),r.current=void 0);const f=o.current;o.current=void 0,f!==void 0&&n.current(...f)},[]),i=d.useCallback(()=>{r.current!==void 0&&(clearTimeout(r.current),r.current=void 0),o.current=void 0},[]),a=d.useCallback((...f)=>{o.current=f,r.current!==void 0&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=void 0;const h=o.current;o.current=void 0,h!==void 0&&n.current(...h)},t)},[t]);d.useEffect(()=>s,[s]);const c=d.useRef(a);c.current=a;const u=d.useCallback((...f)=>{c.current(...f)},[]);return u.flush=s,u.cancel=i,u},cp=d.createContext(void 0);function up(){const e=d.useContext(cp);if(e===void 0)throw new Error(ot(64));return e}const Za={tabActivationDirection:e=>({"data-activation-direction":e})},Z1=d.forwardRef(function(t,n){const{className:r,defaultValue:o=0,onValueChange:s,orientation:i="horizontal",render:a,value:c,style:u,...f}=t,h=t.defaultValue!==void 0,g=d.useRef([]),[A,p]=d.useState(()=>new Map),[m,x]=on({controlled:c,default:o,name:"Tabs",state:"value"}),v=c!==void 0,[b,y]=d.useState(()=>new Map),C=d.useRef(void 0),w=d.useCallback(K=>wi(b,K),[b]),[I,S]=d.useState(()=>({previousValue:m,tabActivationDirection:"none"})),{previousValue:R,tabActivationDirection:E}=I;let k=E,F=!1;R!==m&&(k=tu(R,m,i,b),F=R!=null&&m!=null&&w(m)==null);const T=F?R:m,N=R!==T||E!==k;ie(()=>{N&&S({previousValue:T,tabActivationDirection:k})},[T,N,k]);const M=de((K,te)=>{const le=tu(m,K,i,b);te.activationDirection=le,s?.(K,te),!te.isCanceled&&x(K)}),D=de((K,te)=>{s?.(K,Ce(te,void 0,void 0,{activationDirection:"none"}))}),L=de((K,te)=>(p(le=>{const X=new Map(le);return X.set(K,te),X}),()=>{p(le=>{if(le.get(K)!==te)return le;const X=new Map(le);return X.delete(K),X})})),_=d.useCallback(K=>A.get(K),[A]),j=d.useCallback(K=>{for(const te of b.values())if(K===te.value)return te.id},[b]),H=d.useMemo(()=>({getTabElementBySelectedValue:w,getTabIdByPanelValue:j,getTabPanelIdByValue:_,onValueChange:M,orientation:i,registerMountedTabPanel:L,setTabMap:y,tabActivationDirection:k,value:m}),[w,j,_,M,i,L,y,k,m]),P=d.useMemo(()=>{for(const K of b.values())if(K.value===m)return K},[b,m]),B=d.useMemo(()=>{for(const K of b.values())if(!K.disabled)return K.value},[b]),O=d.useRef(!h),G=d.useRef(o),z=d.useRef(h),U=d.useRef(!1);ie(()=>{if(v)return;function K(ee,J){x(ee),S({previousValue:ee,tabActivationDirection:"none"}),D(ee,J),O.current=!1}if(b.size===0){U.current&&m!==null&&!C.current?.isConnected&&K(null,al);return}U.current=!0,C.current=b.keys().next().value;const te=P?.disabled,le=P==null&&m!==null;if(!te&&m===G.current&&(z.current=!1),z.current&&te&&m===G.current)return;const X=O.current;if(te||le){const ee=B??null;if(m===ee){O.current=!1;return}let J=al;X?J=il:te&&(J=fu),K(ee,J);return}X&&P!=null&&(D(m,il),O.current=!1)},[B,v,D,P,x,b,m]);const Z=je("div",t,{state:{orientation:i,tabActivationDirection:k},ref:n,props:f,stateAttributesMapping:Za});return l.jsx(cp.Provider,{value:H,children:l.jsx(Ur,{elementsRef:g,children:Z})})});function wi(e,t){for(const[n,r]of e.entries())if(t===r.value)return n;return null}function tu(e,t,n,r){if(e==null||t==null)return"none";const[o,s,i]=n==="horizontal"?["left","left","right"]:["top","up","down"],a=wi(r,e),c=wi(r,t);if(a==null||c==null)return a!==c&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?t>e?i:s:"none";const u=a.getBoundingClientRect()[o],f=c.getBoundingClientRect()[o];return f<u?s:f>u?i:"none"}const dp=d.createContext(void 0);function J1(){const e=d.useContext(dp);if(e===void 0)throw new Error(ot(65));return e}const $1=d.forwardRef(function(t,n){const{className:r,disabled:o=!1,render:s,value:i,id:a,nativeButton:c=!0,style:u,...f}=t,{value:h,getTabPanelIdByValue:g,onValueChange:A,orientation:p,tabActivationDirection:m}=up(),{activateOnFocus:x,registerTabResizeObserverElement:v,tabsListElement:b}=J1(),{highlightedIndex:y,onHighlightedIndexChange:C}=Bi(),w=It(a),I=d.useMemo(()=>({disabled:o,id:w,value:i}),[o,w,i]),{compositeProps:S,compositeRef:R,index:E}=Kd({metadata:I}),k=i===h,F=d.useRef(!1),T=d.useRef(null),N=de(U=>{T.current?.(),T.current=U?v(U):null});ie(()=>{if(F.current){F.current=!1;return}if(!(k&&E>-1&&y!==E))return;const U=b;if(U!=null){const Q=vt(Be(U));if(Q&&ve(U,Q))return}o||C(E)},[k,E,y,C,o,b]);const{getButtonProps:M,buttonRef:D}=Gt({disabled:o,native:c,focusableWhenDisabled:!0}),L=g(i),_=d.useRef(!1),j=d.useRef(!1);function H(U){A(i,Ce(Mt,U.nativeEvent,void 0,{activationDirection:"none"}))}function P(U){k||o||H(U)}function B(U){k||o||x&&(!_.current||j.current)&&H(U)}function O(U){if(k||o)return;_.current=!0,j.current=U.button===0;const Q=Be(U.currentTarget);function Z(){_.current=!1,j.current=!1,Q.removeEventListener("pointerup",Z),Q.removeEventListener("pointercancel",Z)}Q.addEventListener("pointerup",Z),Q.addEventListener("pointercancel",Z)}return je("button",t,{state:{disabled:o,active:k,orientation:p,tabActivationDirection:m},ref:[n,D,R,N],props:[S,{role:"tab","aria-controls":L,"aria-selected":k,id:w,onClick:P,onFocus:B,onPointerDown:O,[uf]:k?"":void 0,onKeyDownCapture(){F.current=!0}},f,M],stateAttributesMapping:Za})}),X1=d.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:o,loopFocus:s=!0,render:i,style:a,...c}=t,{orientation:u,setTabMap:f,tabActivationDirection:h}=up(),[g,A]=d.useState(0),[p,m]=d.useState(null),x=d.useRef(new Set),v=d.useRef(new Set),b=d.useRef(null);ie(()=>{if(typeof ResizeObserver>"u")return;const R=new ResizeObserver(()=>{x.current.forEach(E=>{E()})});return b.current=R,p&&R.observe(p),v.current.forEach(E=>{R.observe(E)}),()=>{R.disconnect(),b.current=null}},[p]);const y=de(R=>(x.current.add(R),()=>{x.current.delete(R)})),C=de(R=>(v.current.add(R),b.current?.observe(R),()=>{v.current.delete(R),b.current?.unobserve(R)})),w={orientation:u,tabActivationDirection:h},I={"aria-orientation":u==="vertical"?"vertical":void 0,role:"tablist"},S=d.useMemo(()=>({activateOnFocus:r,registerIndicatorUpdateListener:y,registerTabResizeObserverElement:C,tabsListElement:p}),[r,y,C,p]);return l.jsx(dp.Provider,{value:S,children:l.jsx(df,{render:i,className:o,style:a,state:w,refs:[n,m],props:[I,c],stateAttributesMapping:Za,highlightedIndex:g,enableHomeAndEndKeys:!0,loopFocus:s,orientation:u,onHighlightedIndexChange:A,onMapChange:f,disabledIndices:Nt})})});function q1({className:e,orientation:t="horizontal",...n}){return l.jsx(Z1,{"data-slot":"tabs","data-orientation":t,className:fe("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const eI=ki("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function tI({className:e,variant:t="default",...n}){return l.jsx(X1,{"data-slot":"tabs-list","data-variant":t,className:fe(eI({variant:t}),e),...n})}function nu({className:e,...t}){return l.jsx($1,{"data-slot":"tabs-trigger",className:fe("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function ru({className:e,size:t="default",...n}){return l.jsx("div",{"data-slot":"card","data-size":t,className:fe("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...n})}function ou({className:e,...t}){return l.jsx("div",{"data-slot":"card-header",className:fe("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",e),...t})}function su({className:e,...t}){return l.jsx("div",{"data-slot":"card-content",className:fe("px-(--card-spacing)",e),...t})}function nI({className:e,...t}){return l.jsx("div",{"data-slot":"card-footer",className:fe("flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",e),...t})}const fp=d.memo(({port:e,url:t,visible:n,className:r})=>{const o=d.useRef(null),s=d.useRef(t);return d.useEffect(()=>{const i=o.current;if(i===null){s.current=t;return}s.current!==t&&(s.current=t,i.src=t)},[t]),l.jsx("iframe",{ref:o,title:`service-${e}`,src:t,className:r,style:{width:"100%",height:"100%",border:0,background:"#fff",display:n?"block":"none"},sandbox:"allow-same-origin allow-scripts allow-forms"})});fp.displayName="StableIframe";const rI=e=>{const t=e.trim();if(t.length!==0)try{return new URL(/^https?:\/\//iu.test(t)?t:`http://${t}`).href}catch{return}},iu=({status:e,services:t,activeTab:n,onJumpToService:r})=>l.jsxs(nI,{className:"h-8 shrink-0 gap-3 overflow-x-auto px-3 py-0 text-[11px] text-muted-foreground",children:[l.jsxs("span",{className:"font-mono whitespace-nowrap",children:["光标 ",e.cursorY,":",e.cursorX]}),l.jsxs("span",{className:"font-mono whitespace-nowrap",children:[e.cols,"×",e.rows]}),l.jsx("span",{className:"font-mono whitespace-nowrap",children:e.selection===void 0?"无选区":`选区 ${e.selection.start.y}:${e.selection.start.x} – ${e.selection.end.y}:${e.selection.end.x}`}),l.jsx("span",{className:"h-3 w-px bg-border"}),t.length===0?l.jsx("span",{children:"嗅探 HTTP 服务中…(未发现不影响创建应用)"}):t.map(o=>l.jsxs(bo,{variant:n===`svc-${o.port}`?"default":"secondary",className:"cursor-pointer font-mono whitespace-nowrap",onClick:()=>r(o.port),children:[":",o.port,o.title?` · ${o.title}`:""]},o.port))]});function oI({command:e,terminalHostRef:t,terminalReady:n,interactive:r,status:o,services:s,iframeTabs:i,activeTab:a,onActiveTabChange:c,onIframeNavigate:u,onIframeHistoryMove:f,onJumpToService:h,hideTerminal:g=!1,className:A}){return l.jsxs("div",{className:fe("flex min-h-0 flex-col gap-2",A),children:[l.jsx(q1,{value:a,onValueChange:c,children:l.jsxs(tI,{variant:"line",className:"w-full justify-start border-b px-2",children:[g?null:l.jsxs(nu,{value:"terminal",children:[l.jsx(Sr,{className:"size-3.5"}),"终端",!r&&n?l.jsx("span",{className:"text-[10px] text-amber-400",children:"非交互"}):null]}),i.map(p=>l.jsxs(nu,{value:`svc-${p.port}`,children:[l.jsx($s,{className:"size-3.5"}),new URL(p.url).port===""?vi(p.url):`${vi(p.url)}:${new URL(p.url).port}`]},p.port))]})}),l.jsx("div",{className:"flex min-h-0 flex-1 flex-col",hidden:g||a!=="terminal",children:l.jsxs(ru,{size:"sm",className:"min-h-0 flex-1 gap-0",children:[l.jsx(ou,{className:"border-b [.border-b]:pb-2",children:l.jsxs("span",{className:"tech-ltr flex min-w-0 items-center gap-2 font-mono text-xs text-muted-foreground",children:[l.jsx(Sr,{className:"size-4 shrink-0"}),l.jsx("span",{className:"truncate",children:e||"尚未运行命令"})]})}),l.jsxs(su,{className:"min-h-0 flex-1 p-0",children:[l.jsx("div",{ref:t,className:"min-h-0 min-w-0 h-full bg-[#05070b] px-1"}),n?null:l.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"正在加载终端渲染器…"})]}),l.jsx(iu,{status:o,services:s,activeTab:a,onJumpToService:h})]})}),i.map(p=>l.jsx("div",{className:"flex min-h-0 flex-1 flex-col",hidden:a!==`svc-${p.port}`,children:l.jsxs(ru,{size:"sm",className:"min-h-0 flex-1 gap-0",children:[l.jsx(ou,{className:"border-b [.border-b]:pb-2",children:l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(Oe,{variant:"ghost",size:"icon-sm",disabled:p.historyIndex===0,onClick:()=>f(p.port,-1),"aria-label":"后退",children:l.jsx(Kp,{})}),l.jsx(Oe,{variant:"ghost",size:"icon-sm",disabled:p.historyIndex>=p.history.length-1,onClick:()=>f(p.port,1),"aria-label":"前进",children:l.jsx(Wp,{})}),l.jsx(Oe,{variant:"ghost",size:"icon-sm",onClick:()=>u(p.port,p.url,"replace"),"aria-label":"重新加载",children:l.jsx(Qp,{})}),l.jsx($s,{className:"size-4 shrink-0 text-muted-foreground"}),l.jsx(qe,{className:"tech-ltr h-7 font-mono text-xs",defaultValue:p.url,placeholder:"输入 URL 跳转",onKeyDown:m=>{if(m.key!=="Enter")return;const x=m.target.value,v=rI(x);v!==void 0&&u(p.port,v,"push")}},`${p.port}:${p.historyIndex}:${p.url}`)]})}),l.jsx(su,{className:"min-h-0 flex-1 p-0",children:l.jsx(fp,{port:p.port,url:p.url,visible:a===`svc-${p.port}`})}),l.jsx(iu,{status:o,services:s,activeTab:a,onJumpToService:h})]})},p.port))]})}const au={appId:"",appName:"",iconPath:"",iconBackground:"transparent",iconScale:.8,trayIconPath:"",force:!1,pm:"npm",showStartupTerminal:!1,showAddressBar:!1,imageSmoothingEnabled:!0,developerMode:!1},sI={appId:"",appName:"",targetDir:"",iconPath:""};function iI(){const{query:e}=Xd(),t=e.get("edit"),[n,r]=d.useState(void 0),[o,s]=d.useState(""),[i,a]=d.useState([]),[c,u]=d.useState(RC),[f,h]=d.useState(""),[g,A]=d.useState(!1),[p,m]=d.useState(!1),x=d.useCallback($=>{m($),Zn.set($)},[]);d.useEffect(()=>(Zn.set(p),()=>Zn.set(!1)),[p]);const[v,b]=d.useState(void 0),[y,C]=d.useState(!1),[w,I]=d.useState(""),[S,R]=d.useState(!1),[E,k]=d.useState("idle"),[F,T]=d.useState(),[N,M]=d.useState(""),[D,L]=d.useState(!0),[_,j]=d.useState(!1),[H,P]=d.useState(),[B,O]=d.useState(au),[G,z]=d.useState(sI),[U,Q]=d.useState([]),[Z,K]=d.useState(),[te,le]=d.useState(!1),[X,ee]=d.useState([]),[J,ce]=d.useState(),[ue,ge]=d.useState(),[ae,pe]=d.useState(),[oe,re]=d.useState(),[se,he]=d.useState(),[me,W]=d.useState("transparent"),[Y,ye]=d.useState(.8),q=d.useRef(void 0),ne=d.useRef(void 0),Ee=d.useRef(!1),Se=d.useRef(!1),[Le,Je]=d.useState(),[We,ut]=d.useState(),[$e,Ye]=d.useState(),[mt,Ie]=d.useState("terminal"),[ze,Ne]=d.useState([]),[nt,Re]=d.useState({cursorX:0,cursorY:0,cols:0,rows:0}),[Ge,_e]=d.useState(!1),[Ze,st]=d.useState("confirm"),[ht,yt]=d.useState([]),[dt,kt]=d.useState(""),[Pt,Zt]=d.useState(),[Fe,Ue]=d.useState(),[gt,Et]=d.useState(au),St=d.useRef(null),it=d.useRef(void 0),Rt=d.useRef([]),cn=d.useRef(B);cn.current=B;const On=d.useRef(E);On.current=E;const kn=($,be,V)=>{if(be===void 0)return!1;const Ae=Number.parseInt(be.split(":")[1]??"",10);return!$.some(Te=>Te.index===Ae)||be.split(":")[0]!==String(V)},gs=d.useRef(void 0);d.useEffect(()=>{const $=B.iconPath.trim().length>0?B.iconPath.trim():G.iconPath.trim().length>0?G.iconPath.trim():void 0;if(gs.current=$,$===void 0){pe(void 0),he(void 0),q.current=void 0;return}$===q.current&&se!==void 0||(async()=>{try{re(void 0);const be=await Ke("/api/icon-analyze",{path:$});if(!be.ok)throw new Error("analyze failed");const V=await be.json();if(gs.current!==$)return;pe(V),Ee.current=!1,W(V.suggested),Ke("/api/form",{iconBackground:V.suggested});const Ae=await Ke("/api/icon-compose",{foregroundPath:$,background:V.suggested,scale:Y});if(!Ae.ok)throw new Error("compose failed");const Te=await Ae.json();if(gs.current!==$)return;he(Te),q.current=$}catch{pe(void 0),he(void 0),re("图标分析或合成失败,预览不可用")}})()},[B.iconPath,G.iconPath]);const Ja=eu($=>{Ke("/api/form",{iconScale:$});const be=Xa();qa(be,me,$)},250),pp=$=>{ye($),Ja($)},$a=eu($=>{Ke("/api/form",{iconBackground:$});const be=Xa();qa(be,$,Y)},120),hp=$=>{Ee.current=!0,W($),$a($)},Xa=()=>B.iconPath.trim().length>0?B.iconPath.trim():G.iconPath.trim().length>0?G.iconPath.trim():void 0,qa=d.useCallback(async($,be,V)=>{if($===void 0){pe(void 0),he(void 0),q.current=void 0,ne.current=void 0;return}ne.current=$;try{const Ae=await Ke("/api/icon-analyze",{path:$});if(!Ae.ok)throw new Error("analyze failed");const Te=await Ae.json();if(ne.current!==$)return;pe(Te);const xt=await Ke("/api/icon-compose",{foregroundPath:$,background:be,scale:V});if(!xt.ok)throw new Error("compose failed");const Jt=await xt.json();if(ne.current!==$)return;he(Jt),q.current=$}catch{pe(void 0),he(void 0),re("图标合成失败,预览未更新")}},[]);d.useEffect(()=>{Gp()},[]);const Ap=d.useRef(!1);d.useEffect(()=>{t===null||n===t||(r(t),(async()=>{const $=await ef(t);if($.status!==200||"code"in $.data)return;const be=$.data;if(be.command?.executable!==void 0&&s(be.command.executable),be.command?.args!==void 0&&a([...be.command.args]),be.command?.executable!==void 0&&u(V=>({...V,argsMode:"array"})),be.appName!==void 0){const V=be.appName;O(Ae=>({...Ae,appName:V}))}if(be.icons?.imageSmoothingEnabled!==void 0){const V=be.icons.imageSmoothingEnabled;O(Ae=>({...Ae,imageSmoothingEnabled:V}))}if(be.developerMode!==void 0){const V=be.developerMode;O(Ae=>({...Ae,developerMode:V,force:!0}))}if(be.command?.cwd!==void 0){const V=be.command.cwd;u(Ae=>({...Ae,cwd:V}))}if(be.command?.env!==void 0){const V=Object.entries(be.command.env).map(([Ae,Te])=>({key:Ae,value:Te}));u(Ae=>({...Ae,env:V}))}Ap.current=!0})())},[t,n]),d.useEffect(()=>{if(!p)return;let $=!1;return(async()=>{const be=St.current;if(be===null)return;const V=await Yp(be);if($||V===void 0){$||P("ghostty-web 加载失败,输出将以纯文本显示");return}it.current=V,j(!0);const Ae=Rt.current;Rt.current=[];for(const xt of Ae)V.write(xt);V.onData(xt=>{el.current&&Ke("/api/terminal-input",{data:xt})}),V.onResize(({cols:xt,rows:Jt})=>{Ke("/api/terminal-resize",{cols:xt,rows:Jt})});const Te=window.setInterval(()=>{if(!(On.current==="idle"&&!it.current))try{Re(V.readState())}catch{}},300);return()=>window.clearInterval(Te)})(),()=>{$=!0,it.current?.dispose(),it.current=void 0}},[p]);const el=d.useRef(!0);d.useEffect(()=>{el.current=D},[D]),d.useEffect(()=>{const $=DC();return $.onmessage=be=>{const V=JSON.parse(be.data);switch(V.type){case"snapshot":{k(V.state),R(V.runAlive),b(V.urlSource),s(V.command),M(V.command),u(V.commandOptions),L(V.interactive),O(V.form),z(V.defaults),A(V.targetDirExists),Q(V.services),K(V.selectedPort),ee(V.icons??[]),ce(V.iconsPort),Ne(V.urlSource!==void 0?[{port:0,url:V.urlSource,history:[V.urlSource],historyIndex:0}]:V.services.map(Te=>({port:Te.port,url:Te.url,history:[Te.url],historyIndex:0})));const Ae=V.runAlive||V.services.length>0||V.urlSource!==void 0;x(Ae),Ie(V.urlSource!==void 0?"svc-0":Ae&&V.services.length>0?`svc-${V.services[0].port}`:"terminal");break}case"state":k(V.state),V.state==="failed"&&T(V.reason),V.state==="frozen"&&(st("confirm"),_e(!0)),V.state==="materializing"&&(st("pending"),yt([])),V.state==="success"&&st("success"),V.state==="failed"&&nl.current&&(st("failed"),Zt(V.reason));break;case"log":{it.current!==void 0?it.current.write(V.chunk):tl.current!==void 0?P(Ae=>(Ae??"")+V.chunk):Rt.current.push(V.chunk);break}case"term-mode":if(L(V.interactive),!V.interactive&&V.message!==void 0){const Ae=`\x1B[33m${V.message}\x1B[0m\r
24
- `;it.current!==void 0?it.current.write(Ae):Rt.current.push(Ae)}break;case"run-status":R(V.running);break;case"command-display":M(V.command);break;case"command-options":u(V.options),h(V.defaultCwd);break;case"services":{Q(V.services),K(V.selectedPort),Ne(Ae=>{const Te=[...Ae];let xt;for(const Jt of V.services)Te.find(Dp=>Dp.port===Jt.port)===void 0&&(Te.push({port:Jt.port,url:Jt.url,history:[Jt.url],historyIndex:0}),xt=Jt.port);return xt!==void 0&&Ie(`svc-${xt}`),Te});break}case"icons":ee(V.icons),ce(V.port),kn(V.icons,ue,V.port)&&ge(void 0),kn(V.icons,We,V.port)&&ut(void 0);break;case"scrape":le(V.hasIcon);break;case"form":{O(t!==null?Te=>Te:V.values),z(V.defaults),A(V.targetDirExists),Se.current||(Se.current=!0,W(V.values.iconBackground),ye(V.values.iconScale));break}case"materialize-step":kt(V.step),yt(Ae=>[...Ae,`[${V.step}] ${V.message}`]);break;case"materialize-log":yt(Ae=>[...Ae,V.message]);break;case"success":Ue({projectDir:V.projectDir,...V.bundlePath===void 0?{}:{bundlePath:V.bundlePath},pinHint:V.pinHint}),window.dispatchEvent(new Event("create-opentray:apps-changed"));break}},()=>$.close()},[]);const tl=d.useRef(void 0);d.useEffect(()=>{tl.current=H},[H]);const nl=d.useRef(!1);d.useEffect(()=>{nl.current=Ge},[Ge]);const ms=ue===void 0?void 0:Number.parseInt(ue.split(":")[1]??"",10),gp=se!==void 0?Vf(se.key):Le!==void 0?Le:J!==void 0&&ms!==void 0&&X.some($=>$.index===ms)?Qn(J,ms):J!==void 0&&X!==void 0&&X[0]!==void 0&&ue===void 0?Qn(J,X[0].index):void 0,mp=se!==void 0?`合成 ${se.background==="transparent"?"透明底":se.background==="black"?"黑底":"白底"}`:Le!==void 0?"本地图片":X[0]!==void 0?`${X[0].width}×${X[0].height} ${X[0].format.toUpperCase()}`:"首字母图标",rl=(()=>{if($e!==void 0)return $e;const $=B.trayIconPath.trim();if($.length>0&&J!==void 0){const V=X.find(Ae=>Ae.path===$);if(V!==void 0)return Qn(J,V.index)}const be=/^([^:]+):(\d+)$/.exec(We??"");if(be!==null){const V=Number(be[1]),Ae=Number(be[2]);if(Number.isInteger(V)&&Number.isInteger(Ae))return Qn(V,Ae)}$.length})(),xp=$e!==void 0?"本地图片":rl!==void 0?"跟随源图":"跟随应用图标";d.useEffect(()=>{const $=o.trim();if($.length===0)return;const be=window.setTimeout(()=>{Ke("/api/prime",{command:$})},400);return()=>window.clearTimeout(be)},[o]);const bp=async()=>{const $=o.trim();if(!(c.argsMode==="string"&&$.length===0)){if(x(!0),Ie("terminal"),it.current?.reset(),Ne([]),Q([]),le(!1),ee([]),ce(void 0),ge(void 0),Je(void 0),ut(void 0),Ye(void 0),c.argsMode==="array"){if(i.length===0||(i[0]??"").trim().length===0)return;await Ke("/api/command",{argv:i});return}await Ke("/api/command",{command:$})}},vp=$=>{if(ze.find(V=>V.port===$)===void 0){Ke("/api/select-service",{port:$});return}Ke("/api/select-service",{port:$}),Ie(`svc-${$}`)},yp=($,be,V)=>{Ne(Ae=>Ae.map(Te=>{if(Te.port!==$)return Te;if(V==="replace")return{...Te,url:be};const xt=[...Te.history.slice(0,Te.historyIndex+1),be];return{...Te,url:be,history:xt,historyIndex:xt.length-1}}))},Cp=($,be)=>{Ne(V=>V.map(Ae=>{if(Ae.port!==$)return Ae;const Te=Ae.historyIndex+be;return Te<0||Te>=Ae.history.length?Ae:{...Ae,historyIndex:Te,url:Ae.history[Te]}}))},[Ip,xs]=d.useState(),wp=async()=>{Ja.flush(),$a.flush(),st("confirm"),_e(!0);try{const $=await Ke("/api/confirm",{});if(!$.ok){const be=await $.json().catch(()=>({}));xs(be.error??`确认失败(${$.status})`);return}xs(void 0)}catch{xs("确认请求失败")}};d.useEffect(()=>{E==="frozen"&&Et({...cn.current,...B})},[E]);const kp=async()=>{await Ke("/api/create",{})},[Ep,ol]=d.useState(!1),Sp=$=>Fx($),bs=async()=>{_e(!1),(await Ke("/api/cancel",{})).ok||k(be=>be==="frozen"?"discovered":be)},Rp=p?"minmax(0, 520px) minmax(0, 1fr) minmax(0, 0fr)":"minmax(0, 1fr) minmax(0, var(--list-w)) minmax(0, 1fr)";return l.jsxs("div",{className:"grid h-full w-full overflow-hidden",style:{"--list-w":"min(520px, 100vw - 40px)",gridTemplateColumns:Rp,transition:"grid-template-columns 450ms cubic-bezier(0.4, 0, 0.2, 1)"},children:[l.jsxs("div",{className:"flex w-full flex-col gap-4 overflow-y-auto p-5 pr-2 max-md:min-h-full "+(p?"md:border-r md:border-border":""),style:{gridColumn:p?"1":"2",gridRow:"1",transition:"border-color 450ms",scrollbarGutter:"stable"},children:[l.jsx("div",{className:"flex items-center justify-center",children:l.jsxs("div",{className:"inline-flex rounded-lg border border-border bg-card p-0.5 text-xs",children:[l.jsx("button",{type:"button",className:"rounded-md px-3 py-1.5 transition-colors "+(v===void 0&&!y?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),disabled:E==="materializing"||E==="success",onClick:()=>{C(!1),v!==void 0&&(I(""),b(void 0),Ne([]),x(!1),Ke("/api/url",{url:"",exit:!0}))},children:"启动命令"}),l.jsx("button",{type:"button",className:"rounded-md px-3 py-1.5 transition-colors "+(v!==void 0||y?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),disabled:E==="materializing"||E==="success",onClick:()=>C(!0),children:"网页地址"})]})}),v!==void 0||y?l.jsx(U1,{value:w,onChange:I,activeSource:v,frozen:E==="materializing"||E==="frozen"||E==="success",loading:!1,failedReason:E==="failed"?F:void 0,onSubmit:$=>{Ke("/api/url",{url:$}).then(be=>{be.ok&&(b($),Ne([{port:0,url:$,history:[$],historyIndex:0}]),x(!0),Ie("svc-0"))})}}):l.jsx(l.Fragment,{children:l.jsx(z1,{command:o,onCommandChange:s,argv:i,onArgvChange:$=>a([...$]),runAlive:S,frozen:E==="materializing"||E==="frozen"||E==="success",failedReason:E==="failed"?F:void 0,commandOptions:c,defaultCwd:f,onCommandOptionsChange:$=>{u($),Ke("/api/command-options",{cwd:$.cwd,env:$.env,argsMode:$.argsMode,family:$.family})},onRun:()=>{bp()},onStop:()=>{Ke("/api/stop",{})}})}),l.jsx(x1,{frozen:E==="frozen"||E==="materializing"||E==="success",values:B,defaults:G,candidates:X,candidatesPort:J,selectedIconRef:ue,uploadedIconUrl:Le,iconAnalysis:ae,iconComposition:se,iconComposeError:oe,iconBackground:me,iconScale:Y,onIconBackgroundChange:hp,onIconScaleChange:pp,selectedTrayRef:We,uploadedTrayUrl:$e,selectedPort:Z,targetDirExists:g,onPickIconCandidate:$=>{J!==void 0&&(ge(`${J}:${$.index}`),Je(void 0),Ke("/api/icon-select",{port:J,index:$.index}))},onUploadIcon:$=>{const be=URL.createObjectURL($);Je(be),ge(void 0),$.arrayBuffer().then(V=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":$.type||"application/octet-stream",authorization:`Bearer ${new URLSearchParams(location.search).get("token")??""}`},body:V}).then(Ae=>Ae.json()).then(({path:Ae})=>{Ae===void 0||Ae.length===0||(O(Te=>({...Te,iconPath:Ae})),Ke("/api/form",{iconPath:Ae}))}).catch(()=>{})})},onClearIcon:()=>{ge(void 0),Je(void 0),O($=>({...$,iconPath:""})),Ke("/api/form",{iconPath:""})},onPickTray:$=>{J!==void 0&&(ut(`${J}:${$.index}`),Ye(void 0),Ke("/api/tray-icon-select",{port:J,index:$.index}))},onUploadTray:$=>{const be=URL.createObjectURL($);Ye(be),ut(void 0),$.arrayBuffer().then(V=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":$.type||"application/octet-stream",authorization:`Bearer ${new URLSearchParams(location.search).get("token")??""}`},body:V}).then(Ae=>Ae.json()).then(({path:Ae})=>{Ae===void 0||Ae.length===0||(O(Te=>({...Te,trayIconPath:Ae})),Ke("/api/form",{trayIconPath:Ae}))}).catch(()=>{})})},onClearTray:()=>{ut(void 0),Ye(void 0),O($=>({...$,trayIconPath:""})),Ke("/api/form",{trayIconPath:""})},onPatch:$=>{O(be=>({...be,...$})),Ke("/api/form",$)},onConfirm:()=>{wp()}})]}),l.jsx("div",{className:"flex min-h-0 min-w-0 flex-col gap-4 overflow-y-auto p-4 pr-1 max-md:hidden",style:{scrollbarGutter:"stable",gridColumn:p?"2":"3",gridRow:"1",opacity:p?1:0,visibility:p?"visible":"hidden",transition:"opacity 450ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear "+(p?"0s":"450ms")},children:p?l.jsxs(l.Fragment,{children:[l.jsx(oI,{command:N,terminalHostRef:St,terminalReady:_,interactive:D,status:nt,services:v!==void 0?[{port:0,url:v,firstSeenAt:0,title:vi(v)}]:[...U],hideTerminal:v!==void 0,iframeTabs:ze,activeTab:mt,onActiveTabChange:Ie,onIframeNavigate:yp,onIframeHistoryMove:Cp,onJumpToService:vp,className:"min-h-[480px] flex-1"}),H!==void 0?l.jsx("pre",{className:"max-h-56 overflow-auto rounded-xl border border-border bg-card p-3 font-mono text-xs whitespace-pre-wrap",children:H}):null]}):null}),l.jsx(V1,{open:Ge,onOpenChange:$=>{if($){_e(!0);return}if(Ze==="confirm"){bs();return}_e(!1)},phase:Ze,frozenValues:gt,iconSrc:gp,iconLabel:mp,traySrc:rl,trayLabel:xp,selectedPort:Z,currentStep:dt,logs:ht,error:Pt??F,result:Fe,onBack:()=>{bs()},onCreate:()=>{kp()},onShare:()=>ol(!0),onOpenApp:()=>{Ke("/api/open-app",{})},confirmError:Ip,onClose:()=>{if(Ze==="confirm"){bs();return}_e(!1)}}),l.jsx(hf,{open:Ep,subtitle:gt?.appId??N,hasEnv:c.env.some($=>$.key.trim().length>0),share:!0,runner:Sp,onClose:()=>ol(!1)})]})}function aI(){const{route:e}=qd();return l.jsxs(l.Fragment,{children:[l.jsx("div",{hidden:e!=="add",className:"min-h-0 flex-1",children:l.jsx(iI,{})}),l.jsx("div",{hidden:e!=="applications",className:"min-h-0 flex-1",children:l.jsx(yb,{})}),l.jsx("div",{hidden:e!=="help",className:"min-h-0 flex-1",children:l.jsx(SC,{})})]})}const Zn={open:!1,listeners:new Set,set(e){if(this.open!==e){this.open=e;for(const t of this.listeners)t()}},subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}},lI=()=>{const[e,t]=d.useState(Zn.open);return d.useEffect(()=>Zn.subscribe(()=>t(Zn.open)),[]),e};function cI(){return l.jsx(yx,{panelOpen:lI(),children:l.jsx(aI,{})})}const Ho=mx();hi(Ho.locale,Ho.theme);Mp.createRoot(document.getElementById("root")).render(l.jsx(Pp.StrictMode,{children:l.jsx(xx,{initialLocale:Ho.locale,initialTheme:Ho.theme,children:l.jsx(cI,{})})}));
17
+ `}return r}render(e,t,n){let r="";const o=this.rules;for(let s=0,i=e.length;s<i;s++){const a=e[s].type;a==="inline"?r+=this.renderInline(e[s].children,t,n):typeof o[a]<"u"?r+=o[a](e,s,t,n,this):r+=this.renderToken(e,s,t)}return r}},Hf=class{constructor(e,t,n){be(this,"tokens",[]),be(this,"inlineMode",!1),be(this,"Token",Bn),this.src=e,this.env=n,this.md=t}},Sv=/\r\n?|\n/g,Rv=/\0/g;function Dv(e){let t;t=e.src.replace(Sv,`
18
+ `),t=t.replace(Rv,"�"),e.src=t}function Fv(e){let t;e.inlineMode?(t=new e.Token("inline","",0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function Bv(e){const t=e.tokens;let n=0;for(let r=0;r<t.length;r++)t[r].type!=="reference_definition"&&(r!==n&&(t[n]=t[r]),n++);t.length!==n&&(t.length=n)}function jv(e){const t=e.tokens;for(let n=0,r=t.length;n<r;n++){const o=t[n];o.type==="inline"&&e.md.inline.parse(o.content,e.md,e.env,o.children)}}function Mv(e){return/^<a[>\s]/i.test(e)}function Nv(e){return/^<\/a\s*>/i.test(e)}function Tv(e){const t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!=="inline"||!e.md.linkify.test(t[n].content))continue;let o=t[n].children,s=0;for(let i=o.length-1;i>=0;i--){const a=o[i];if(a.type==="link_close"){for(i--;o[i].level!==a.level&&o[i].type!=="link_open";)i--;continue}if(a.type==="html_inline"&&(Mv(a.content)&&s>0&&s--,Nv(a.content)&&s++),!(s>0)&&a.type==="text"&&e.md.linkify.test(a.content)){const l=a.content;let u=e.md.linkify.match(l);const d=[];let p=a.level,A=0;u.length>0&&u[0].index===0&&i>0&&o[i-1].type==="text_special"&&(u=u.slice(1));for(let m=0;m<u.length;m++){const h=u[m].url,g=e.md.normalizeLink(h);if(!e.md.validateLink(g))continue;let x=u[m].text;u[m].schema?u[m].schema==="mailto:"&&!/^mailto:/i.test(x)?x=e.md.normalizeLinkText(`mailto:${x}`).replace(/^mailto:/,""):x=e.md.normalizeLinkText(x):x=e.md.normalizeLinkText(`http://${x}`).replace(/^http:\/\//,"");const b=u[m].index;if(b>A){const I=new e.Token("text","",0);I.content=l.slice(A,b),I.level=p,d.push(I)}const v=new e.Token("link_open","a",1);v.attrs=[["href",g]],v.level=p++,v.markup="linkify",v.info="auto",d.push(v);const y=new e.Token("text","",0);y.content=x,y.level=p,d.push(y);const C=new e.Token("link_close","a",-1);C.level=--p,C.markup="linkify",C.info="auto",d.push(C),A=u[m].lastIndex}if(A<l.length){const m=new e.Token("text","",0);m.content=l.slice(A),m.level=p,d.push(m)}t[n].children=o=Tf(o,i,d)}}}}var Kf=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Pv=/\((c|tm|r)\)/i,_v=/\((c|tm|r)\)/gi,Ov={c:"©",r:"®",tm:"™"};function Hv(e,t){return Ov[t.toLowerCase()]}function Kv(e){let t=0;for(let n=e.length-1;n>=0;n--){const r=e[n];r.type==="text"&&!t&&(r.content=r.content.replace(_v,Hv)),r.type==="link_open"&&r.info==="auto"&&t--,r.type==="link_close"&&r.info==="auto"&&t++}}function Wv(e){let t=0;for(let n=e.length-1;n>=0;n--){const r=e[n];r.type==="text"&&!t&&Kf.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1—").replace(/(^|\s)--(?=\s|$)/gm,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1–")),r.type==="link_open"&&r.info==="auto"&&t--,r.type==="link_close"&&r.info==="auto"&&t++}}function Lv(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(Pv.test(e.tokens[t].content)&&Kv(e.tokens[t].children),Kf.test(e.tokens[t].content)&&Wv(e.tokens[t].children))}var Qv=/['"]/,Pc=/['"]/g,_c="’";function co(e,t,n,r){e[t]||(e[t]=[]),e[t].push({pos:n,ch:r})}function Gv(e,t){let n="",r=0;t.sort((o,s)=>o.pos-s.pos);for(let o=0;o<t.length;o++){const s=t[o];n+=e.slice(r,s.pos)+s.ch,r=s.pos+1}return n+e.slice(r)}function Yv(e,t){let n;const r=[],o={};for(let s=0;s<e.length;s++){const i=e[s],a=e[s].level;for(n=r.length-1;n>=0&&!(r[n].level<=a);n--);if(r.length=n+1,i.type!=="text")continue;const l=i.content;let u=0;const d=l.length;e:for(;u<d;){Pc.lastIndex=u;const p=Pc.exec(l);if(!p)break;let A=!0,m=!0;u=p.index+1;const h=p[0]==="'";let g=32;if(p.index-1>=0)g=l.charCodeAt(p.index-1);else for(n=s-1;n>=0&&!(e[n].type==="softbreak"||e[n].type==="hardbreak");n--)if(e[n].content){g=e[n].content.charCodeAt(e[n].content.length-1);break}let x=32;if(u<d)x=l.charCodeAt(u);else for(n=s+1;n<e.length&&!(e[n].type==="softbreak"||e[n].type==="hardbreak");n++)if(e[n].content){x=e[n].content.charCodeAt(0);break}const b=Pr(g)||Tr(g),v=Pr(x)||Tr(x),y=Nr(g),C=Nr(x);if(C?A=!1:v&&(y||b||(A=!1)),y?m=!1:b&&(C||v||(m=!1)),x===34&&p[0]==='"'&&g>=48&&g<=57&&(m=A=!1),A&&m&&(A=b,m=v),!A&&!m){h&&co(o,s,p.index,_c);continue}if(m)for(n=r.length-1;n>=0;n--){let I=r[n];if(r[n].level<a)break;if(I.single===h&&r[n].level===a){I=r[n];let w,E;h?(w=t.md.options.quotes[2],E=t.md.options.quotes[3]):(w=t.md.options.quotes[0],E=t.md.options.quotes[1]),co(o,s,p.index,E),co(o,I.token,I.pos,w),r.length=n;continue e}}A?r.push({token:s,pos:p.index,single:h,level:a}):m&&h&&co(o,s,p.index,_c)}}Object.keys(o).forEach(function(s){const i=Number(s);e[i].content=Gv(e[i].content,o[s])})}function zv(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!=="inline"||!Qv.test(e.tokens[t].content)||Yv(e.tokens[t].children,e)}function Uv(e){let t,n;const r=e.length;for(t=0;t<r;t++)e[t].type==="text_special"&&(e[t].type="text");for(t=n=0;t<r;t++)e[t].type==="text"&&t+1<r&&e[t+1].type==="text"?e[t+1].content=e[t].content+e[t+1].content:(t!==n&&(e[n]=e[t]),n++);t!==n&&(e.length=n)}function Vv(e){let t,n;const r=e.tokens,o=r.length;for(let s=0;s<o;s++){if(r[s].type!=="inline")continue;const i=r[s].children,a=i.length;for(t=0;t<a;t++)i[t].type==="text_special"&&(i[t].type="text"),i[t].children&&Uv(i[t].children);for(t=n=0;t<a;t++)i[t].type==="text"&&t+1<a&&i[t+1].type==="text"?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var Gs=[["normalize",Dv],["block",Fv],["strip_references",Bv],["inline",jv],["linkify",Tv],["replacements",Lv],["smartquotes",zv],["text_join",Vv]],Wf=class{constructor(){be(this,"ruler",new Or),be(this,"State",Hf);for(let e=0;e<Gs.length;e++)this.ruler.push(Gs[e][0],Gs[e][1])}process(e){const t=this.ruler.getRules("");for(let n=0,r=t.length;n<r;n++)t[n](e)}},Lf=class{constructor(e,t,n,r){be(this,"bMarks",[]),be(this,"eMarks",[]),be(this,"tShift",[]),be(this,"sCount",[]),be(this,"bsCount",[]),be(this,"blkIndent",0),be(this,"line",0),be(this,"lineMax",0),be(this,"tight",!1),be(this,"listIndent",-1),be(this,"parentType","root"),be(this,"level",0),be(this,"Token",Bn),this.src=e,this.md=t,this.env=n,this.tokens=r;const o=this.src;for(let s=0,i=0,a=0,l=0,u=o.length,d=!1;i<u;i++){const p=o.charCodeAt(i);if(!d)if(Ve(p)){a++,p===9?l+=4-l%4:l++;continue}else d=!0;(p===10||i===u-1)&&(p!==10&&i++,this.bMarks.push(s),this.eMarks.push(i),this.tShift.push(a),this.sCount.push(l),this.bsCount.push(0),d=!1,a=0,l=0,s=i+1)}this.bMarks.push(o.length),this.eMarks.push(o.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}push(e,t,n){const r=new Bn(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e}skipSpaces(e){for(let t=this.src.length;e<t&&Ve(this.src.charCodeAt(e));e++);return e}skipSpacesBack(e,t){if(e<=t)return e;for(;e>t;)if(!Ve(this.src.charCodeAt(--e)))return e+1;return e}skipChars(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e}skipCharsBack(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e}getLines(e,t,n,r){if(e>=t)return"";const o=new Array(t-e);for(let s=0,i=e;i<t;i++,s++){let a=0;const l=this.bMarks[i];let u=l,d;for(i+1<t||r?d=this.eMarks[i]+1:d=this.eMarks[i];u<d&&a<n;){const p=this.src.charCodeAt(u);if(Ve(p))p===9?a+=4-(a+this.bsCount[i])%4:a++;else if(u-l<this.tShift[i])a++;else break;u++}a>n?o[s]=new Array(a-n+1).join(" ")+this.src.slice(u,d):o[s]=this.src.slice(u,d)}return o.join("")}},Zv=65536;function Ys(e,t){const n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function Oc(e){const t=[],n=e.length;let r=0,o=e.charCodeAt(r),s=!1,i=0,a="";for(;r<n;)o===124&&(s?(a+=e.substring(i,r-1),i=r):(t.push(a+e.substring(i,r)),a="",i=r+1)),s=o===92,r++,o=e.charCodeAt(r);return t.push(a+e.substring(i)),t}function Jv(e,t,n,r){if(t+2>n)return!1;let o=t+1;if(e.sCount[o]<e.blkIndent||e.sCount[o]-e.blkIndent>=4)return!1;let s=e.bMarks[o]+e.tShift[o];if(s>=e.eMarks[o])return!1;const i=e.src.charCodeAt(s++);if(i!==124&&i!==45&&i!==58||s>=e.eMarks[o])return!1;const a=e.src.charCodeAt(s++);if(a!==124&&a!==45&&a!==58&&!Ve(a)||i===45&&Ve(a))return!1;for(;s<e.eMarks[o];){const C=e.src.charCodeAt(s);if(C!==124&&C!==45&&C!==58&&!Ve(C))return!1;s++}let l=Ys(e,t+1),u=l.split("|");const d=[];for(let C=0;C<u.length;C++){const I=u[C].trim();if(!I){if(C===0||C===u.length-1)continue;return!1}if(!/^:?-+:?$/.test(I))return!1;I.charCodeAt(I.length-1)===58?d.push(I.charCodeAt(0)===58?"center":"right"):I.charCodeAt(0)===58?d.push("left"):d.push("")}if(l=Ys(e,t).trim(),l.indexOf("|")===-1||e.sCount[t]-e.blkIndent>=4)return!1;u=Oc(l),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop();const p=u.length;if(p===0||p!==d.length)return!1;if(r)return!0;const A=e.parentType;e.parentType="table";const m=e.md.block.ruler.getRules("blockquote"),h=e.push("table_open","table",1),g=[t,0];h.map=g;const x=e.push("thead_open","thead",1);x.map=[t,t+1];const b=e.push("tr_open","tr",1);b.map=[t,t+1];for(let C=0;C<u.length;C++){const I=e.push("th_open","th",1);d[C]&&(I.attrs=[["style",`text-align:${d[C]}`]]);const w=e.push("inline","",0);w.content=u[C].trim(),w.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let v,y=0;for(o=t+2;o<n&&!(e.sCount[o]<e.blkIndent);o++){let C=!1;for(let w=0,E=m.length;w<E;w++)if(m[w](e,o,n,!0)){C=!0;break}if(C||(l=Ys(e,o).trim(),!l)||e.sCount[o]-e.blkIndent>=4||(u=Oc(l),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop(),y+=p-u.length,y>Zv))break;if(o===t+2){const w=e.push("tbody_open","tbody",1);w.map=v=[t+2,0]}const I=e.push("tr_open","tr",1);I.map=[o,o+1];for(let w=0;w<p;w++){const E=e.push("td_open","td",1);d[w]&&(E.attrs=[["style",`text-align:${d[w]}`]]);const S=e.push("inline","",0);S.content=u[w]?u[w].trim():"",S.children=[],e.push("td_close","td",-1)}e.push("tr_close","tr",-1)}return v&&(e.push("tbody_close","tbody",-1),v[1]=o),e.push("table_close","table",-1),g[1]=o,e.parentType=A,e.line=o,!0}function $v(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,o=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,o=r;continue}break}e.line=o;const s=e.push("code_block","code",0);return s.content=e.getLines(t,o,4+e.blkIndent,!1)+`
19
+ `,s.map=[t,e.line],!0}function Xv(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||o+3>s)return!1;const i=e.src.charCodeAt(o);if(i!==126&&i!==96)return!1;let a=o;o=e.skipChars(o,i);let l=o-a;if(l<3)return!1;const u=e.src.slice(a,o),d=e.src.slice(o,s);if(i===96&&d.indexOf(String.fromCharCode(i))>=0)return!1;if(r)return!0;let p=t,A=!1;for(;p++,!(p>=n||(o=a=e.bMarks[p]+e.tShift[p],s=e.eMarks[p],o<s&&e.sCount[p]<e.blkIndent));)if(e.src.charCodeAt(o)===i&&!(e.sCount[p]-e.blkIndent>=4)&&(o=e.skipChars(o,i),!(o-a<l)&&(o=e.skipSpaces(o),!(o<s)))){A=!0;break}l=e.sCount[t],e.line=p+(A?1:0);const m=e.push("fence","code",0);return m.info=d,m.content=e.getLines(t+1,p,l,!0),m.markup=u,m.map=[t,e.line],!0}function qv(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t];const i=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(o)!==62)return!1;if(r)return!0;const a=[],l=[],u=[],d=[],p=e.md.block.ruler.getRules("blockquote"),A=e.parentType;e.parentType="blockquote";let m=!1,h;for(h=t;h<n;h++){const y=e.sCount[h]<e.blkIndent;if(o=e.bMarks[h]+e.tShift[h],s=e.eMarks[h],o>=s)break;if(e.src.charCodeAt(o++)===62&&!y){let I=e.sCount[h]+1,w,E;e.src.charCodeAt(o)===32?(o++,I++,E=!1,w=!0):e.src.charCodeAt(o)===9?(w=!0,(e.bsCount[h]+I)%4===3?(o++,I++,E=!1):E=!0):w=!1;let S=I;for(a.push(e.bMarks[h]),e.bMarks[h]=o;o<s;){const D=e.src.charCodeAt(o);if(Ve(D))D===9?S+=4-(S+e.bsCount[h]+(E?1:0))%4:S++;else break;o++}m=o>=s,l.push(e.bsCount[h]),e.bsCount[h]=e.sCount[h]+1+(w?1:0),u.push(e.sCount[h]),e.sCount[h]=S-I,d.push(e.tShift[h]),e.tShift[h]=o-e.bMarks[h];continue}if(m)break;let C=!1;for(let I=0,w=p.length;I<w;I++)if(p[I](e,h,n,!0)){C=!0;break}if(C){e.lineMax=h,e.blkIndent!==0&&(a.push(e.bMarks[h]),l.push(e.bsCount[h]),d.push(e.tShift[h]),u.push(e.sCount[h]),e.sCount[h]-=e.blkIndent);break}a.push(e.bMarks[h]),l.push(e.bsCount[h]),d.push(e.tShift[h]),u.push(e.sCount[h]),e.sCount[h]=-1}const g=e.blkIndent;e.blkIndent=0;const x=e.push("blockquote_open","blockquote",1);x.markup=">";const b=[t,0];x.map=b,e.md.block.tokenize(e,t,h);const v=e.push("blockquote_close","blockquote",-1);v.markup=">",e.lineMax=i,e.parentType=A,b[1]=e.line;for(let y=0;y<d.length;y++)e.bMarks[y+t]=a[y],e.tShift[y+t]=d[y],e.sCount[y+t]=u[y],e.bsCount[y+t]=l[y];return e.blkIndent=g,!0}function ey(e,t,n,r){const o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let s=e.bMarks[t]+e.tShift[t];const i=e.src.charCodeAt(s++);if(i!==42&&i!==45&&i!==95)return!1;let a=1;for(;s<o;){const u=e.src.charCodeAt(s++);if(u!==i&&!Ve(u))return!1;u===i&&a++}if(a<3)return!1;if(r)return!0;e.line=t+1;const l=e.push("hr","hr",0);return l.map=[t,e.line],l.markup=Array(a+1).join(String.fromCharCode(i)),!0}function Hc(e,t){const n=e.eMarks[t];let r=e.bMarks[t]+e.tShift[t];const o=e.src.charCodeAt(r++);return o!==42&&o!==45&&o!==43||r<n&&!Ve(e.src.charCodeAt(r))?-1:r}function Kc(e,t){const n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];let o=n;if(o+1>=r)return-1;let s=e.src.charCodeAt(o++);if(s<48||s>57)return-1;for(;;){if(o>=r)return-1;if(s=e.src.charCodeAt(o++),s>=48&&s<=57){if(o-n>=10)return-1;continue}if(s===41||s===46)break;return-1}return o<r&&(s=e.src.charCodeAt(o),!Ve(s))?-1:o}function ty(e,t){const n=e.level+2;for(let r=t+2,o=e.tokens.length-2;r<o;r++)e.tokens[r].level===n&&e.tokens[r].type==="paragraph_open"&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function ny(e,t,n,r){let o,s,i,a,l=t,u=!0;if(e.sCount[l]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[l]-e.listIndent>=4&&e.sCount[l]<e.blkIndent)return!1;let d=!1;r&&e.parentType==="paragraph"&&e.sCount[l]>=e.blkIndent&&(d=!0);let p,A,m;if((m=Kc(e,l))>=0){if(p=!0,i=e.bMarks[l]+e.tShift[l],A=Number(e.src.slice(i,m-1)),d&&A!==1)return!1}else if((m=Hc(e,l))>=0)p=!1;else return!1;if(d&&e.skipSpaces(m)>=e.eMarks[l])return!1;if(r)return!0;const h=e.src.charCodeAt(m-1),g=e.tokens.length;p?(a=e.push("ordered_list_open","ol",1),A!==1&&(a.attrs=[["start",A]])):a=e.push("bullet_list_open","ul",1);const x=[l,0];a.map=x,a.markup=String.fromCharCode(h);let b=!1;const v=e.md.block.ruler.getRules("list"),y=e.parentType;for(e.parentType="list";l<n;){s=m,o=e.eMarks[l];const C=e.sCount[l]+m-(e.bMarks[l]+e.tShift[l]);let I=C;for(;s<o;){const R=e.src.charCodeAt(s);if(R===9)I+=4-(I+e.bsCount[l])%4;else if(R===32)I++;else break;s++}const w=s;let E;w>=o?E=1:E=I-C,E>4&&(E=1);const S=C+E;a=e.push("list_item_open","li",1),a.markup=String.fromCharCode(h);const D=[l,0];a.map=D,p&&(a.info=e.src.slice(i,m-1));const k=e.tight,j=e.tShift[l],N=e.sCount[l],T=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=S,e.tight=!0,e.tShift[l]=w-e.bMarks[l],e.sCount[l]=I,w>=o&&e.isEmpty(l+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,l,n),(!e.tight||b)&&(u=!1),b=e.line-l>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=T,e.tShift[l]=j,e.sCount[l]=N,e.tight=k,a=e.push("list_item_close","li",-1),a.markup=String.fromCharCode(h),l=e.line,D[1]=l,l>=n||e.sCount[l]<e.blkIndent||e.sCount[l]-e.blkIndent>=4)break;let F=!1;for(let R=0,O=v.length;R<O;R++)if(v[R](e,l,n,!0)){F=!0;break}if(F)break;if(p){if(m=Kc(e,l),m<0)break;i=e.bMarks[l]+e.tShift[l]}else if(m=Hc(e,l),m<0)break;if(h!==e.src.charCodeAt(m-1))break}return p?a=e.push("ordered_list_close","ol",-1):a=e.push("bullet_list_close","ul",-1),a.markup=String.fromCharCode(h),x[1]=l,e.line=l,e.parentType=y,u&&ty(e,g),!0}function ry(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t],i=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(o)!==91)return!1;function a(C){const I=e.lineMax;if(C>=I||e.isEmpty(C))return null;let w=!1;if(e.sCount[C]-e.blkIndent>3&&(w=!0),e.sCount[C]<0&&(w=!0),!w){const D=e.md.block.ruler.getRules("reference"),k=e.parentType;e.parentType="reference";let j=!1;for(let N=0,T=D.length;N<T;N++)if(D[N](e,C,I,!0)){j=!0;break}if(e.parentType=k,j)return null}const E=e.bMarks[C]+e.tShift[C],S=e.eMarks[C];return e.src.slice(E,S+1)}let l=e.src.slice(o,s+1);s=l.length;let u=-1;for(o=1;o<s;o++){const C=l.charCodeAt(o);if(C===91)return!1;if(C===93){u=o;break}else if(C===10){const I=a(i);I!==null&&(l+=I,s=l.length,i++)}else if(C===92&&(o++,o<s&&l.charCodeAt(o)===10)){const I=a(i);I!==null&&(l+=I,s=l.length,i++)}}if(u<0||l.charCodeAt(u+1)!==58)return!1;for(o=u+2;o<s;o++){const C=l.charCodeAt(o);if(C===10){const I=a(i);I!==null&&(l+=I,s=l.length,i++)}else if(!Ve(C))break}const d=e.md.helpers.parseLinkDestination(l,o,s);if(!d.ok)return!1;const p=e.md.normalizeLink(d.str);if(!e.md.validateLink(p))return!1;o=d.pos;const A=o,m=i,h=o;for(;o<s;o++){const C=l.charCodeAt(o);if(C===10){const I=a(i);I!==null&&(l+=I,s=l.length,i++)}else if(!Ve(C))break}let g=e.md.helpers.parseLinkTitle(l,o,s);for(;g.can_continue;){const C=a(i);if(C===null)break;l+=C,o=s,s=l.length,i++,g=e.md.helpers.parseLinkTitle(l,o,s,g)}let x;for(o<s&&h!==o&&g.ok?(x=g.str,o=g.pos):(x="",o=A,i=m);o<s&&Ve(l.charCodeAt(o));)o++;if(o<s&&l.charCodeAt(o)!==10&&x)for(x="",o=A,i=m;o<s&&Ve(l.charCodeAt(o));)o++;if(o<s&&l.charCodeAt(o)!==10)return!1;const b=As(l.slice(1,u));if(!b)return!1;if(r)return!0;typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[b]>"u"&&(e.env.references[b]={title:x,href:p});const v=e.push("reference_definition","",0);v.map=[t,i],v.hidden=!0;const y=Object.create(null);return y.label=b,v.meta=y,e.line=i,!0}var oy=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Qf=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,Gf="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",sy=new RegExp(`^(?:${Qf}|${Gf}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),iy=new RegExp(`^(?:${Qf}|${Gf})`),En=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Za-z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp(`^</?(${oy.join("|")})(?=(\\s|/?>|$))`,"i"),/^$/,!0],[new RegExp(`${iy.source}\\s*$`),/^$/,!1]];function ay(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(o)!==60)return!1;let i=e.src.slice(o,s),a=0;for(;a<En.length&&!En[a][0].test(i);a++);if(a===En.length)return!1;if(r)return En[a][2];let l=t+1;const u=En[a][1].test("");if(!En[a][1].test(i)){for(;l<n&&!(e.sCount[l]<e.blkIndent&&(u||!e.isEmpty(l)));l++)if(o=e.bMarks[l]+e.tShift[l],s=e.eMarks[l],i=e.src.slice(o,s),En[a][1].test(i)){i.length!==0&&l++;break}}e.line=l;const d=e.push("html_block","",0);return d.map=[t,l],d.content=e.getLines(t,l,e.blkIndent,!0),!0}function ly(e,t,n,r){let o=e.bMarks[t]+e.tShift[t],s=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.src.charCodeAt(o);if(i!==35||o>=s)return!1;let a=1;for(i=e.src.charCodeAt(++o);i===35&&o<s&&a<=6;)a++,i=e.src.charCodeAt(++o);if(a>6||o<s&&!Ve(i))return!1;if(r)return!0;s=e.skipSpacesBack(s,o);const l=e.skipCharsBack(s,35,o);l>o&&Ve(e.src.charCodeAt(l-1))&&(s=l),e.line=t+1;const u=e.push("heading_open",`h${a}`,1);u.markup="########".slice(0,a),u.map=[t,e.line];const d=e.push("inline","",0);d.content=gs(e.src.slice(o,s)),d.map=[t,e.line],d.children=[];const p=e.push("heading_close",`h${a}`,-1);return p.markup="########".slice(0,a),!0}function cy(e,t,n){const r=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;const o=e.parentType;e.parentType="paragraph";let s=0,i,a=t+1;for(;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3)continue;if(e.sCount[a]>=e.blkIndent){let m=e.bMarks[a]+e.tShift[a];const h=e.eMarks[a];if(m<h&&(i=e.src.charCodeAt(m),(i===45||i===61)&&(m=e.skipChars(m,i),m=e.skipSpaces(m),m>=h))){s=i===61?1:2;break}}if(e.sCount[a]<0)continue;let A=!1;for(let m=0,h=r.length;m<h;m++)if(r[m](e,a,n,!0)){A=!0;break}if(A)break}if(!s)return e.parentType=o,!1;const l=gs(e.getLines(t,a,e.blkIndent,!1));e.line=a+1;const u=e.push("heading_open",`h${s}`,1);u.markup=String.fromCharCode(i),u.map=[t,e.line];const d=e.push("inline","",0);d.content=l,d.map=[t,e.line-1],d.children=[];const p=e.push("heading_close",`h${s}`,-1);return p.markup=String.fromCharCode(i),e.parentType=o,!0}function uy(e,t,n){const r=e.md.block.ruler.getRules("paragraph"),o=e.parentType;let s=t+1;for(e.parentType="paragraph";s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3||e.sCount[s]<0)continue;let u=!1;for(let d=0,p=r.length;d<p;d++)if(r[d](e,s,n,!0)){u=!0;break}if(u)break}const i=gs(e.getLines(t,s,e.blkIndent,!1));e.line=s;const a=e.push("paragraph_open","p",1);a.map=[t,e.line];const l=e.push("inline","",0);return l.content=i,l.map=[t,e.line],l.children=[],e.push("paragraph_close","p",-1),e.parentType=o,!0}var uo=[["table",Jv,["paragraph","reference"]],["code",$v],["fence",Xv,["paragraph","reference","blockquote","list"]],["blockquote",qv,["paragraph","reference","blockquote","list"]],["hr",ey,["paragraph","reference","blockquote","list"]],["list",ny,["paragraph","reference","blockquote"]],["reference",ry],["html_block",ay,["paragraph","reference","blockquote"]],["heading",ly,["paragraph","reference","blockquote"]],["lheading",cy],["paragraph",uy]],Yf=class{constructor(){be(this,"ruler",new Or),be(this,"State",Lf);for(let e=0;e<uo.length;e++)this.ruler.push(uo[e][0],uo[e][1],{alt:(uo[e][2]||[]).slice()})}tokenize(e,t,n){const r=this.ruler.getRules(""),o=r.length,s=e.md.options.maxNesting;let i=t,a=!1;for(;i<n&&(e.line=i=e.skipEmptyLines(i),!(i>=n||e.sCount[i]<e.blkIndent));){if(e.level>=s){e.line=n;break}const l=e.line;let u=!1;for(let d=0;d<o;d++)if(u=r[d](e,i,n,!1),u){if(l>=e.line)throw new Error("block rule didn't increment state.line");break}if(!u)throw new Error("none of the block rules matched");e.tight=!a,e.isEmpty(e.line-1)&&(a=!0),i=e.line,i<n&&e.isEmpty(i)&&(a=!0,i++,e.line=i)}}parse(e,t,n,r){if(!e)return;const o=new this.State(e,t,n,r);this.tokenize(o,o.line,o.lineMax)}},zf=class{constructor(e,t,n,r){be(this,"pos",0),be(this,"level",0),be(this,"pending",""),be(this,"pendingLevel",0),be(this,"cache",{}),be(this,"backticks",{}),be(this,"backticksScanned",!1),be(this,"linkLevel",0),be(this,"delimiters",[]),be(this,"_prev_delimiters",[]),be(this,"Token",Bn),this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.posMax=this.src.length}pushPending(){const e=new Bn("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e}push(e,t,n){this.pending&&this.pushPending();const r=new Bn(e,t,n);let o;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],o={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(o),r}scanDelims(e,t){const n=this.posMax,r=this.src.charCodeAt(e);let o;if(e===0)o=32;else if(e===1)o=this.src.charCodeAt(0),(o&63488)===55296&&(o=65533);else if(o=this.src.charCodeAt(e-1),(o&64512)===56320){const h=this.src.charCodeAt(e-2);o=(h&64512)===55296?65536+(h-55296<<10)+(o-56320):65533}else(o&64512)===55296&&(o=65533);let s=e;for(;s<n&&this.src.charCodeAt(s)===r;)s++;const i=s-e;let a=s<n?this.src.charCodeAt(s):32;if((a&64512)===55296){const h=this.src.charCodeAt(s+1);a=(h&64512)===56320?65536+(a-55296<<10)+(h-56320):65533}else(a&64512)===56320&&(a=65533);const l=Pr(o)||Tr(o),u=Pr(a)||Tr(a),d=Nr(o),p=Nr(a),A=!p&&(!u||d||l),m=!d&&(!l||p||u);return{can_open:A&&(t||!m||l),can_close:m&&(t||!A||u),length:i}}};function dy(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function fy(e,t){let n=e.pos;for(;n<e.posMax&&!dy(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var py=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function hy(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;const n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;const o=e.pending.match(py);if(!o)return!1;const s=o[1],i=e.md.linkify.matchAtStart(e.src.slice(n-s.length));if(!i)return!1;let a=i.url;if(a.length<=s.length)return!1;let l=a.length;for(;l>0&&a.charCodeAt(l-1)===42;)l--;l!==a.length&&(a=a.slice(0,l));const u=e.md.normalizeLink(a);if(!e.md.validateLink(u))return!1;if(!t){e.pending=e.pending.slice(0,-s.length);const d=e.push("link_open","a",1);d.attrs=[["href",u]],d.markup="linkify",d.info="auto";const p=e.push("text","",0);p.content=e.md.normalizeLinkText(a);const A=e.push("link_close","a",-1);A.markup="linkify",A.info="auto"}return e.pos+=a.length-s.length,!0}function Ay(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;const r=e.pending.length-1,o=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let s=r-1;for(;s>=1&&e.pending.charCodeAt(s-1)===32;)s--;e.pending=e.pending.slice(0,s),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(n++;n<o&&Ve(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var Za=[];for(let e=0;e<256;e++)Za.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){Za[e.charCodeAt(0)]=1});function gy(e,t){let n=e.pos;const r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let o=e.src.charCodeAt(n);if(o===10){for(t||e.push("hardbreak","br",0),n++;n<r&&(o=e.src.charCodeAt(n),!!Ve(o));)n++;return e.pos=n,!0}if(o===32){if(!t){const a=e.push("text_special","",0);a.content="\\",a.markup="\\",a.info="escape"}return e.pos=n,!0}let s=e.src[n];if(o>=55296&&o<=56319&&n+1<r){const a=e.src.charCodeAt(n+1);a>=56320&&a<=57343&&(s+=e.src[n+1],n++)}const i="\\"+s;if(!t){const a=e.push("text_special","",0);o<256&&Za[o]!==0?a.content=s:a.content=i,a.markup=i,a.info="escape"}return e.pos=n+1,!0}function my(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;const r=n;n++;const o=e.posMax;for(;n<o&&e.src.charCodeAt(n)===96;)n++;const s=e.src.slice(r,n),i=s.length;if(e.backticksScanned&&(e.backticks[i]||0)<=r)return t||(e.pending+=s),e.pos+=i,!0;let a=n,l;for(;(l=e.src.indexOf("`",a))!==-1;){for(a=l+1;a<o&&e.src.charCodeAt(a)===96;)a++;const u=a-l;if(u===i){if(!t){const d=e.push("code_inline","code",0);d.markup=s,d.content=e.src.slice(n,l).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return e.pos=a,!0}e.backticks[u]=l}return e.backticksScanned=!0,t||(e.pending+=s),e.pos+=i,!0}function xy(e,t){const n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;const o=e.scanDelims(e.pos,!0);let s=o.length;const i=String.fromCharCode(r);if(s<2)return!1;let a;s%2&&(a=e.push("text","",0),a.content=i,s--);for(let l=0;l<s;l+=2)a=e.push("text","",0),a.content=i+i,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function Wc(e,t){let n;const r=[],o=t.length;for(let s=0;s<o;s++){const i=t[s];if(i.marker!==126||i.end===-1)continue;const a=t[i.end];n=e.tokens[i.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=e.tokens[a.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="",e.tokens[a.token-1].type==="text"&&e.tokens[a.token-1].content==="~"&&r.push(a.token-1)}for(;r.length;){const s=r.pop();let i=s+1;for(;i<e.tokens.length&&e.tokens[i].type==="s_close";)i++;i--,s!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[s],e.tokens[s]=n)}}function by(e){const t=e.tokens_meta,n=e.tokens_meta.length;Wc(e,e.delimiters);for(let o=0;o<n;o++){var r;const s=(r=t[o])===null||r===void 0?void 0:r.delimiters;s&&Wc(e,s)}}var Uf={tokenize:xy,postProcess:by};function vy(e,t){const n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;const o=e.scanDelims(e.pos,r===42);for(let s=0;s<o.length;s++){const i=e.push("text","",0);i.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:o.length,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close})}return e.pos+=o.length,!0}function Lc(e,t){const n=t.length;for(let r=n-1;r>=0;r--){const o=t[r];if(o.marker!==95&&o.marker!==42||o.end===-1)continue;const s=t[o.end],i=r>0&&t[r-1].end===o.end+1&&t[r-1].marker===o.marker&&t[r-1].token===o.token-1&&t[o.end+1].token===s.token+1,a=String.fromCharCode(o.marker),l=e.tokens[o.token];l.type=i?"strong_open":"em_open",l.tag=i?"strong":"em",l.nesting=1,l.markup=i?a+a:a,l.content="";const u=e.tokens[s.token];u.type=i?"strong_close":"em_close",u.tag=i?"strong":"em",u.nesting=-1,u.markup=i?a+a:a,u.content="",i&&(e.tokens[t[r-1].token].content="",e.tokens[t[o.end+1].token].content="",r--)}}function yy(e){const t=e.tokens_meta,n=e.tokens_meta.length;Lc(e,e.delimiters);for(let o=0;o<n;o++){var r;const s=(r=t[o])===null||r===void 0?void 0:r.delimiters;s&&Lc(e,s)}}var Vf={tokenize:vy,postProcess:yy};function Cy(e,t){let n,r,o,s,i="",a="",l=e.pos,u=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;const d=e.pos,p=e.posMax,A=e.pos+1,m=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(m<0)return!1;let h=m+1;if(h<p&&e.src.charCodeAt(h)===40){for(u=!1,h++;h<p&&(n=e.src.charCodeAt(h),!(!Ve(n)&&n!==10));h++);if(h>=p)return!1;if(l=h,o=e.md.helpers.parseLinkDestination(e.src,h,e.posMax),o.ok){for(i=e.md.normalizeLink(o.str),e.md.validateLink(i)?h=o.pos:i="",l=h;h<p&&(n=e.src.charCodeAt(h),!(!Ve(n)&&n!==10));h++);if(o=e.md.helpers.parseLinkTitle(e.src,h,e.posMax),h<p&&l!==h&&o.ok)for(a=o.str,h=o.pos;h<p&&(n=e.src.charCodeAt(h),!(!Ve(n)&&n!==10));h++);}(h>=p||e.src.charCodeAt(h)!==41)&&(u=!0),h++}if(u){if(typeof e.env.references>"u")return!1;if(h<p&&e.src.charCodeAt(h)===91?(l=h+1,h=e.md.helpers.parseLinkLabel(e,h),h>=0?r=e.src.slice(l,h++):h=m+1):h=m+1,r||(r=e.src.slice(A,m)),r=As(r),s=e.env.references[r],!s)return e.pos=d,!1;i=s.href,a=s.title}if(!t){e.pos=A,e.posMax=m;const g=e.push("link_open","a",1),x=[["href",i]];if(g.attrs=x,a&&x.push(["title",a]),r){const b=Object.create(null);b.label=r,g.meta=b}e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=h,e.posMax=p,!0}function Iy(e,t){let n,r,o,s,i,a,l,u,d="";const p=e.pos,A=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const m=e.pos+2,h=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(h<0)return!1;if(s=h+1,s<A&&e.src.charCodeAt(s)===40){for(s++;s<A&&(n=e.src.charCodeAt(s),!(!Ve(n)&&n!==10));s++);if(s>=A)return!1;for(u=s,a=e.md.helpers.parseLinkDestination(e.src,s,e.posMax),a.ok&&(d=e.md.normalizeLink(a.str),e.md.validateLink(d)?s=a.pos:d=""),u=s;s<A&&(n=e.src.charCodeAt(s),!(!Ve(n)&&n!==10));s++);if(a=e.md.helpers.parseLinkTitle(e.src,s,e.posMax),s<A&&u!==s&&a.ok)for(l=a.str,s=a.pos;s<A&&(n=e.src.charCodeAt(s),!(!Ve(n)&&n!==10));s++);else l="";if(s>=A||e.src.charCodeAt(s)!==41)return e.pos=p,!1;s++}else{if(typeof e.env.references>"u")return!1;if(s<A&&e.src.charCodeAt(s)===91?(u=s+1,s=e.md.helpers.parseLinkLabel(e,s),s>=0?o=e.src.slice(u,s++):s=h+1):s=h+1,o||(o=e.src.slice(m,h)),o=As(o),i=e.env.references[o],!i)return e.pos=p,!1;d=i.href,l=i.title}if(!t){r=e.src.slice(m,h);const g=[];e.md.inline.parse(r,e.md,e.env,g);const x=e.push("image","img",0),b=[["src",d],["alt",""]];if(x.attrs=b,x.children=g,x.content=r,l&&b.push(["title",l]),o){const v=Object.create(null);v.label=o,x.meta=v}}return e.pos=s,e.posMax=A,!0}var wy=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,ky=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Ey(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;const r=e.pos,o=e.posMax;for(;;){if(++n>=o)return!1;const i=e.src.charCodeAt(n);if(i===60)return!1;if(i===62)break}const s=e.src.slice(r+1,n);if(ky.test(s)){const i=e.md.normalizeLink(s);if(!e.md.validateLink(i))return!1;if(!t){const a=e.push("link_open","a",1);a.attrs=[["href",i]],a.markup="autolink",a.info="auto";const l=e.push("text","",0);l.content=e.md.normalizeLinkText(s);const u=e.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return e.pos+=s.length+2,!0}if(wy.test(s)){const i=e.md.normalizeLink(`mailto:${s}`);if(!e.md.validateLink(i))return!1;if(!t){const a=e.push("link_open","a",1);a.attrs=[["href",i]],a.markup="autolink",a.info="auto";const l=e.push("text","",0);l.content=e.md.normalizeLinkText(s);const u=e.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return e.pos+=s.length+2,!0}return!1}function Sy(e){return/^<a[>\s]/i.test(e)}function Ry(e){return/^<\/a\s*>/i.test(e)}function Dy(e){const t=e|32;return t>=97&&t<=122}function Fy(e,t){if(!e.md.options.html)return!1;const n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;const o=e.src.charCodeAt(r+1);if(o!==33&&o!==63&&o!==47&&!Dy(o))return!1;const s=e.src.slice(r).match(sy);if(!s)return!1;if(!t){const i=e.push("html_inline","",0);i.content=s[0],Sy(i.content)&&e.linkLevel++,Ry(i.content)&&e.linkLevel--}return e.pos+=s[0].length,!0}var By=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,jy=/^&([a-z][a-z0-9]{1,31});/i;function My(e,t){const n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){const o=e.src.slice(n).match(By);if(o){if(!t){const s=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),i=e.push("text_special","",0);i.content=Va(s)?Mr(s):Mr(65533),i.markup=o[0],i.info="entity"}return e.pos+=o[0].length,!0}}else{const o=e.src.slice(n).match(jy);if(o){const s=wf(o[0]);if(s!==o[0]){if(!t){const i=e.push("text_special","",0);i.content=s,i.markup=o[0],i.info="entity"}return e.pos+=o[0].length,!0}}}return!1}function Qc(e){const t={},n=e.length;if(!n)return;let r=0,o=-2;const s=[];for(let i=0;i<n;i++){const a=e[i];if(s.push(0),(e[r].marker!==a.marker||o!==a.token-1)&&(r=i),o=a.token,a.length=a.length||0,!a.close)continue;t.hasOwnProperty(a.marker)||(t[a.marker]=[-1,-1,-1,-1,-1,-1]);const l=t[a.marker][(a.open?3:0)+a.length%3];let u=r-s[r]-1,d=u;for(;u>l;u-=s[u]+1){const p=e[u];if(p.marker===a.marker&&p.open&&p.end<0){let A=!1;if((p.close||a.open)&&(p.length+a.length)%3===0&&(p.length%3!==0||a.length%3!==0)&&(A=!0),!A){const m=u>0&&!e[u-1].open?s[u-1]+1:0;s[i]=i-u+m,s[u]=m,a.open=!1,p.end=i,p.close=!1,d=-1,o=-2;break}}}d!==-1&&(t[a.marker][(a.open?3:0)+(a.length||0)%3]=d)}}function Ny(e){const t=e.tokens_meta,n=e.tokens_meta.length;Qc(e.delimiters);for(let o=0;o<n;o++){var r;const s=(r=t[o])===null||r===void 0?void 0:r.delimiters;s&&Qc(s)}}function Ty(e){let t,n,r=0;const o=e.tokens,s=e.tokens.length;for(t=n=0;t<s;t++)o[t].nesting<0&&r--,o[t].level=r,o[t].nesting>0&&r++,o[t].type==="text"&&t+1<s&&o[t+1].type==="text"?o[t+1].content=o[t].content+o[t+1].content:(t!==n&&(o[n]=o[t]),n++);t!==n&&(o.length=n)}var zs=[["text",fy],["linkify",hy],["newline",Ay],["escape",gy],["backticks",my],["strikethrough",Uf.tokenize],["emphasis",Vf.tokenize],["link",Cy],["image",Iy],["autolink",Ey],["html_inline",Fy],["entity",My]],Us=[["balance_pairs",Ny],["strikethrough",Uf.postProcess],["emphasis",Vf.postProcess],["fragments_join",Ty]],Zf=class{constructor(){be(this,"ruler",new Or),be(this,"ruler2",new Or),be(this,"State",zf);for(let e=0;e<zs.length;e++)this.ruler.push(zs[e][0],zs[e][1]);for(let e=0;e<Us.length;e++)this.ruler2.push(Us[e][0],Us[e][1])}skipToken(e){const t=e.pos,n=this.ruler.getRules(""),r=n.length,o=e.md.options.maxNesting,s=e.cache;if(typeof s[t]<"u"){e.pos=s[t];return}let i=!1;if(e.level<o){for(let a=0;a<r;a++)if(e.level++,i=n[a](e,!0),e.level--,i){if(t>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;i||e.pos++,s[t]=e.pos}tokenize(e){const t=this.ruler.getRules(""),n=t.length,r=e.posMax,o=e.md.options.maxNesting;for(;e.pos<r;){const s=e.pos;let i=!1;if(e.level<o){for(let a=0;a<n;a++)if(i=t[a](e,!1),i){if(s>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(i){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()}parse(e,t,n,r){const o=new this.State(e,t,n,r);this.tokenize(o);const s=this.ruler2.getRules(""),i=s.length;for(let a=0;a<i;a++)s[a](o)}},Py={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","strip_references","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","strip_references","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}}},_y=/^(vbscript|javascript|file|data):/,Oy=/^data:image\/(gif|png|jpeg|webp);/,Gc=["http:","https:","mailto:"],$t=class{validateLink(e){const t=e.trim().toLowerCase();return _y.test(t)?Oy.test(t):!0}normalizeLink(e){const t=wi(e,!0);if(t.hostname&&(!t.protocol||Gc.indexOf(t.protocol)>=0))try{t.hostname=Mc.toASCII(t.hostname)}catch{}return Vr(Ii(t))}normalizeLinkText(e){const t=wi(e,!0);if(t.hostname&&(!t.protocol||Gc.indexOf(t.protocol)>=0))try{t.hostname=Mc.toUnicode(t.hostname)}catch{}return nr(Ii(t),nr.defaultChars+"%")}constructor(...e){be(this,"inline",new Zf),be(this,"block",new Yf),be(this,"core",new Wf),be(this,"renderer",new Of),be(this,"linkify",new $b),be(this,"utils",cv),be(this,"helpers",Object.assign({},wv));const[t,n]=e;typeof t=="string"?(this.configure(t),n&&this.set(n)):(this.configure("default"),this.set(t||{}))}set(e){return Object.assign(this.options,e),this}configure(e){let t;if(typeof e=="string"){const o=e;if(t=Py[o],!t)throw new Error(`Wrong 'markdown-it' preset "${o}", check name`)}else t=e;if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");t.options&&(this.options={...t.options});const n=t.components;if(n){var r;["core","block","inline"].forEach(s=>{var i;const a=(i=n[s])===null||i===void 0?void 0:i.rules;a&&this[s].ruler.enableOnly(a)});const o=(r=n.inline)===null||r===void 0?void 0:r.rules2;o&&this.inline.ruler2.enableOnly(o)}return this}enable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(o=>{n=n.concat(this[o].ruler.enable(e,!0))}),n=n.concat(this.inline.ruler2.enable(e,!0));const r=e.filter(o=>n.indexOf(o)<0);if(r.length&&!t)throw new Error(`MarkdownIt. Failed to enable unknown rule(s): ${r}`);return this}disable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(o=>{n=n.concat(this[o].ruler.disable(e,!0))}),n=n.concat(this.inline.ruler2.disable(e,!0));const r=e.filter(o=>n.indexOf(o)<0);if(r.length&&!t)throw new Error(`MarkdownIt. Failed to disable unknown rule(s): ${r}`);return this}use(e,...t){return e.apply(e,[this,...t]),this}parse(e,t){if(typeof e!="string")throw new Error("Input data should be a String");const n=new this.core.State(e,this,t);return this.core.process(n),n.tokens}render(e,t={}){return this.renderer.render(this.parse(e,t),this.options,t)}parseInline(e,t){const n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens}renderInline(e,t={}){return this.renderer.render(this.parseInline(e,t),this.options,t)}};be($t,"Token",Bn);be($t,"Ruler",Or);be($t,"Renderer",Of);be($t,"ParserCore",Wf);be($t,"StateCore",Hf);be($t,"ParserBlock",Yf);be($t,"StateBlock",Lf);be($t,"ParserInline",Zf);be($t,"StateInline",zf);var Hy=Nf($t),Vs,Yc;function Ky(){return Yc||(Yc=1,Vs=function(t,n){var r=3,o="-",s=o.charCodeAt(0),i=o.length;function a(l,u,d,p){var A,m,h,g,x,b,v,y=!1,C=l.bMarks[u]+l.tShift[u],I=l.eMarks[u];if(u!==0||s!==l.src.charCodeAt(0))return!1;for(A=C+1;A<=I;A++)if(o[(A-C)%i]!==l.src[A]){v=A+1;break}if(h=Math.floor((A-C)/i),h<r)return!1;if(A-=(A-C)%i,p)return!0;for(m=u;m++,!(m>=d||l.src.slice(C,I)==="..."||(C=l.bMarks[m]+l.tShift[m],I=l.eMarks[m],C<I&&l.sCount[m]<l.blkIndent));)if(s===l.src.charCodeAt(C)&&!(l.sCount[m]-l.blkIndent>=4)){for(A=C+1;A<=I&&o[(A-C)%i]===l.src[A];A++);if(!(Math.floor((A-C)/i)<h)&&(A-=(A-C)%i,A=l.skipSpaces(A),!(A<I))){y=!0;break}}return x=l.parentType,b=l.lineMax,l.parentType="container",l.lineMax=m,g=l.push("front_matter",null,0),g.hidden=!0,g.markup=l.src.slice(u,A),g.block=!0,g.map=[u,m+(y?1:0)],g.meta=l.src.slice(v,C-1),l.parentType=x,l.lineMax=b,l.line=m+(y?1:0),n(g.meta),!0}t.block.ruler.before("table","front_matter",a,{alt:["paragraph","reference","blockquote","list"]})}),Vs}var Wy=Ky();const Ly=Zp(Wy);var Qy=Object.defineProperty,Gy=Object.defineProperties,Yy=Object.getOwnPropertyDescriptors,zc=Object.getOwnPropertySymbols,zy=Object.prototype.hasOwnProperty,Uy=Object.prototype.propertyIsEnumerable,Uc=(e,t,n)=>t in e?Qy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ut=(e,t)=>{for(var n in t||(t={}))zy.call(t,n)&&Uc(e,n,t[n]);if(zc)for(var n of zc(t))Uy.call(t,n)&&Uc(e,n,t[n]);return e},Hr=(e,t)=>Gy(e,Yy(t)),_o=(e,t,n)=>new Promise((r,o)=>{var s=l=>{try{a(n.next(l))}catch(u){o(u)}},i=l=>{try{a(n.throw(l))}catch(u){o(u)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,i);a((n=n.apply(e,t)).next())});function Vy(e,t){return typeof e=="function"?e(t):e}function Kr(e,t){return n=>{t.setState(r=>Hr(ut({},r),{[e]:Vy(n,r[e])}))}}var Vc=(e,t=100,n=1e3)=>new Promise(r=>{let o;const s=setInterval(()=>{e()&&(r(),clearInterval(s),clearTimeout(o))},t);o=setTimeout(()=>{clearInterval(s),r()},n)}),Jf="Headless Tree: ",Ei=e=>Error(Jf+e),Zy=e=>console.warn(Jf+e),Jy={key:"tree",getInitialState:e=>ut({expandedItems:[],focusedItem:null},e),getDefaultConfig:(e,t)=>ut({setExpandedItems:Kr("expandedItems",t),setFocusedItem:Kr("focusedItem",t)},e),stateHandlerNames:{expandedItems:"setExpandedItems",focusedItem:"setFocusedItem"},treeInstance:{getItemsMeta:({tree:e})=>{const{rootItemId:t}=e.getConfig(),{expandedItems:n}=e.getState(),r=[],o=new Set(n),s=(l,u,d,p,A)=>{var m;if(u.includes(l)){Zy(`Circular reference for ${u.join(".")}`);return}if(r.push({itemId:l,level:d,index:r.length,parentId:u.at(-1),setSize:p,posInSet:A}),o.has(l)){const h=(m=e.retrieveChildrenIds(l))!=null?m:[];let g=0;for(const x of h)s(x,u.concat(l),d+1,h.length,g++)}},i=e.retrieveChildrenIds(t);let a=0;for(const l of i)s(l,[t],0,i.length,a++);return r},getFocusedItem:({tree:e})=>{var t;const n=e.getState().focusedItem;return(t=n!==null?e.getItemInstance(n):null)!=null?t:e.getItems()[0]},getRootItem:({tree:e})=>{const{rootItemId:t}=e.getConfig();return e.getItemInstance(t)},focusNextItem:({tree:e})=>{var t;const n=e.getFocusedItem().getItemMeta();if(!n)return;const r=Math.min(n.index+1,e.getItems().length-1);(t=e.getItems()[r])==null||t.setFocused()},focusPreviousItem:({tree:e})=>{var t;const n=e.getFocusedItem().getItemMeta();if(!n)return;const r=Math.max(n.index-1,0);(t=e.getItems()[r])==null||t.setFocused()},updateDomFocus:({tree:e})=>{setTimeout(()=>_o(null,null,function*(){var t,n,r,o,s;const i=e.getFocusedItem();(n=(t=e.getConfig()).scrollToItem)==null||n.call(t,i),yield Vc(()=>i.getElement()!==null,20,500);const a=i.getElement();if(!a){(r=e.getItems()[0])==null||r.setFocused(),(s=(o=e.getItems()[0])==null?void 0:o.getElement())==null||s.focus();return}a.focus()}))},getContainerProps:({prev:e,tree:t},n)=>Hr(ut({},e?.()),{role:"tree","aria-label":n??"",ref:t.registerElement}),isSearchOpen:()=>!1},itemInstance:{scrollTo:(e,t)=>_o(null,[e,t],function*({tree:n,item:r},o){var s,i,a;(i=(s=n.getConfig()).scrollToItem)==null||i.call(s,r),yield Vc(()=>r.getElement()!==null,20),(a=r.getElement())==null||a.scrollIntoView(o)}),getId:({itemId:e})=>e,getKey:({itemId:e})=>e,getProps:({item:e,prev:t})=>{const n=e.getItemMeta();return Hr(ut({},t?.()),{ref:e.registerElement,role:"treeitem","aria-setsize":n.setSize,"aria-posinset":n.posInSet+1,"aria-selected":"false","aria-label":e.getItemName(),"aria-level":n.level+1,"aria-expanded":e.isFolder()?e.isExpanded():void 0,tabIndex:e.isFocused()?0:-1,onClick:r=>{e.setFocused(),e.primaryAction(),!(r.ctrlKey||r.shiftKey||r.metaKey)&&e.isFolder()&&(e.isExpanded()?e.collapse():e.expand())}})},expand:({tree:e,item:t,itemId:n})=>{var r;t.isFolder()&&((r=e.getState().loadingItemChildrens)!=null&&r.includes(n)||(e.applySubStateUpdate("expandedItems",o=>[...o,n]),e.rebuildTree()))},collapse:({tree:e,item:t,itemId:n})=>{t.isFolder()&&(e.applySubStateUpdate("expandedItems",r=>r.filter(o=>o!==n)),e.rebuildTree())},getItemData:({tree:e,itemId:t})=>e.retrieveItemData(t),equals:({item:e},t)=>e.getId()===t?.getId(),isExpanded:({tree:e,itemId:t})=>e.getState().expandedItems.includes(t),isDescendentOf:({item:e},t)=>{const n=e.getParent();return!!(n?.getId()===t||n?.isDescendentOf(t))},isFocused:({tree:e,item:t,itemId:n})=>e.getState().focusedItem===n||e.getState().focusedItem===null&&t.getItemMeta().index===0,isFolder:({tree:e,item:t,itemId:n})=>n===e.getConfig().rootItemId||e.getConfig().isItemFolder(t),getItemName:({tree:e,item:t})=>e.getConfig().getItemName(t),setFocused:({tree:e,itemId:t})=>{e.applySubStateUpdate("focusedItem",t)},primaryAction:({tree:e,item:t})=>{var n,r;return(r=(n=e.getConfig()).onPrimaryAction)==null?void 0:r.call(n,t)},getParent:({tree:e,item:t})=>t.getItemMeta().parentId?e.getItemInstance(t.getItemMeta().parentId):void 0,getIndexInParent:({item:e})=>e.getItemMeta().posInSet,getChildren:({tree:e,itemId:t})=>e.retrieveChildrenIds(t).map(n=>e.getItemInstance(n)),getTree:({tree:e})=>e,getItemAbove:({tree:e,item:t})=>e.getItems()[t.getItemMeta().index-1],getItemBelow:({tree:e,item:t})=>e.getItems()[t.getItemMeta().index+1]},hotkeys:{focusNextItem:{hotkey:"ArrowDown",canRepeat:!0,preventDefault:!0,isEnabled:e=>{var t,n;return!((n=(t=e.isSearchOpen)==null?void 0:t.call(e))!=null&&n)&&!e.getState().dnd},handler:(e,t)=>{t.focusNextItem(),t.updateDomFocus()}},focusPreviousItem:{hotkey:"ArrowUp",canRepeat:!0,preventDefault:!0,isEnabled:e=>{var t,n;return!((n=(t=e.isSearchOpen)==null?void 0:t.call(e))!=null&&n)&&!e.getState().dnd},handler:(e,t)=>{t.focusPreviousItem(),t.updateDomFocus()}},expandOrDown:{hotkey:"ArrowRight",canRepeat:!0,handler:(e,t)=>{const n=t.getFocusedItem();n.isExpanded()||!n.isFolder()?(t.focusNextItem(),t.updateDomFocus()):n.expand()}},collapseOrUp:{hotkey:"ArrowLeft",canRepeat:!0,handler:(e,t)=>{var n;const r=t.getFocusedItem();(!r.isExpanded()||!r.isFolder())&&r.getItemMeta().level!==0?((n=r.getParent())==null||n.setFocused(),t.updateDomFocus()):r.collapse()}},focusFirstItem:{hotkey:"Home",handler:(e,t)=>{var n;(n=t.getItems()[0])==null||n.setFocused(),t.updateDomFocus()}},focusLastItem:{hotkey:"End",handler:(e,t)=>{var n;(n=t.getItems()[t.getItems().length-1])==null||n.setFocused(),t.updateDomFocus()}}}},$y=(e,t,n)=>{const r={};return[r,()=>{const s=n(r);e:for(let i=0;i<e.length;i++){const a=e[i][t];if(!a)continue e;t:for(const[l,u]of Object.entries(a)){if(!u)continue t;const d=r[l];r[l]=(...p)=>u(Hr(ut({},s),{prev:d}),...p)}}}]},Xy=e=>{var t;const n=e?.map(r=>r.key);for(const r of e??[]){const o=(t=r.deps)==null?void 0:t.find(s=>!n?.includes(s));if(o)throw Ei(`${r.key} needs ${o}`)}},qy=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)for(let o=r+1;o<n;o++)t(e[o],e[r])<0&&([e[r],e[o]]=[e[o],e[r]]);return e},e1=e=>(t,n)=>{var r,o;return n.key&&((r=t.overwrites)!=null&&r.includes(n.key))?1:t.key&&((o=n.overwrites)!=null&&o.includes(t.key))?-1:e.indexOf(t)-e.indexOf(n)},t1=(e=[])=>qy(e,e1(e)),n1=e=>{var t,n,r,o;const s=(t=e.instanceBuilder)!=null?t:$y,i=[Jy,...t1(e.features)];Xy(i);const a=[...i],[l,u]=s(a,"treeInstance",D=>({tree:D}));let d=i.reduce((D,k)=>{var j,N;return(N=(j=k.getInitialState)==null?void 0:j.call(k,D,l))!=null?N:D},(r=(n=e.initialState)!=null?n:e.state)!=null?r:{}),p=i.reduce((D,k)=>{var j,N;return(N=(j=k.getDefaultConfig)==null?void 0:j.call(k,D,l))!=null?N:D},e);const A=i.reduce((D,k)=>ut(ut({},D),k.stateHandlerNames),{});let m;const h={current:{}};let g=!1;const x={};let b=[];const v={},y={};let C={};const I={},w=()=>{b=[],C={};const[D,k]=s(a,"itemInstance",j=>({item:j,tree:l,itemId:p.rootItemId}));k(),x[p.rootItemId]=D,C[p.rootItemId]={itemId:p.rootItemId,index:-1,parentId:null,level:-1,posInSet:0,setSize:1};for(const j of l.getItemsMeta())if(C[j.itemId]=j,x[j.itemId])b.push(x[j.itemId]);else{const[N,T]=s(a,"itemInstance",F=>({item:F,tree:l,itemId:j.itemId}));T(),x[j.itemId]=N,b.push(N)}g=!1},E=D=>{for(const k of i)D(k)},S={key:"main",treeInstance:{getState:()=>d,setState:({},D)=>{var k;(k=p.setState)==null||k.call(p,d)},setMounted:({},D)=>{var k;const j=h.current;j.isMounted=D,D&&((k=j.waitingForMount)==null||k.forEach(N=>N()),j.waitingForMount=[])},applySubStateUpdate:({},D,k)=>{var j;const N=()=>{d[D]=typeof k=="function"?k(d[D]):k;const F=p[A[D]];F?.(d[D])},T=h.current;T.isMounted?N():((j=T.waitingForMount)!=null||(T.waitingForMount=[]),T.waitingForMount.push(N))},rebuildTree:()=>{var D,k;const j=h.current;j.isMounted?(w(),(D=p.setState)==null||D.call(p,d)):((k=j.waitingForMount)!=null||(j.waitingForMount=[]),j.waitingForMount.push(()=>{var N;w(),(N=p.setState)==null||N.call(p,d)}))},scheduleRebuildTree:()=>{g=!0},getConfig:()=>p,setConfig:(D,k)=>{var j,N,T;const F=typeof k=="function"?k(p):k,R=((j=F.state)==null?void 0:j.expandedItems)&&((N=F.state)==null?void 0:N.expandedItems)!==d.expandedItems;p=F,F.state&&(d=ut(ut({},d),F.state)),R&&(w(),(T=p.setState)==null||T.call(p,d))},getItemInstance:({},D)=>{const k=x[D];if(!k){const[j,N]=s(a,"itemInstance",T=>({item:T,tree:l,itemId:D}));return N(),j}return k},getItems:()=>(g&&w(),b),registerElement:({},D)=>{m!==D&&(m&&!D?E(k=>{var j;return(j=k.onTreeUnmount)==null?void 0:j.call(k,l,m)}):!m&&D&&E(k=>{var j;return(j=k.onTreeMount)==null?void 0:j.call(k,l,D)}),m=D)},getElement:()=>m,getDataRef:()=>h,getHotkeyPresets:()=>I},itemInstance:{registerElement:({itemId:D,item:k},j)=>{if(v[D]===j)return;const N=v[D];N&&!j?E(T=>{var F;return(F=T.onItemUnmount)==null?void 0:F.call(T,k,N,l)}):!N&&j&&E(T=>{var F;return(F=T.onItemMount)==null?void 0:F.call(T,k,j,l)}),v[D]=j},getElement:({itemId:D})=>v[D],getDataRef:({itemId:D})=>{var k;return(k=y[D])!=null?k:y[D]={current:{}}},getItemMeta:({itemId:D})=>{var k;return(k=C[D])!=null?k:{itemId:D,parentId:null,level:-1,index:-1,posInSet:0,setSize:1}}}};a.unshift(S);for(const D of a)Object.assign(I,(o=D.hotkeys)!=null?o:{});return u(),l},r1={key:"selection",getInitialState:e=>ut({selectedItems:[]},e),getDefaultConfig:(e,t)=>ut({setSelectedItems:Kr("selectedItems",t)},e),stateHandlerNames:{selectedItems:"setSelectedItems"},treeInstance:{setSelectedItems:({tree:e},t)=>{e.applySubStateUpdate("selectedItems",t)},getSelectedItems:({tree:e})=>e.getState().selectedItems.map(e.getItemInstance)},itemInstance:{select:({tree:e,itemId:t})=>{const{selectedItems:n}=e.getState();e.setSelectedItems(n.includes(t)?n:[...n,t])},deselect:({tree:e,itemId:t})=>{const{selectedItems:n}=e.getState();e.setSelectedItems(n.filter(r=>r!==t))},isSelected:({tree:e,itemId:t})=>{const{selectedItems:n}=e.getState();return n.includes(t)},selectUpTo:({tree:e,item:t,itemId:n},r)=>{const o=t.getItemMeta().index,s=e.getDataRef();if(!s.current.selectUpToAnchorId){s.current.selectUpToAnchorId=n,e.setSelectedItems([n]);return}const a=e.getItemInstance(s.current.selectUpToAnchorId).getItemMeta().index,[l,u]=o<a?[o,a]:[a,o],d=e.getItems().slice(l,u+1).map(m=>m.getItemMeta().itemId);if(!r){e.setSelectedItems(d);return}const{selectedItems:p}=e.getState(),A=[...new Set([...p,...d])];e.setSelectedItems(A)},toggleSelect:({item:e})=>{e.isSelected()?e.deselect():e.select()},getProps:({tree:e,item:t,itemId:n,prev:r})=>Hr(ut({},r?.()),{"aria-selected":t.isSelected()?"true":"false",onClick:o=>{var s,i;o.shiftKey?t.selectUpTo(o.ctrlKey||o.metaKey):o.ctrlKey||o.metaKey?t.toggleSelect():e.setSelectedItems([n]),o.shiftKey||(e.getDataRef().current.selectUpToAnchorId=n),(i=(s=r?.())==null?void 0:s.onClick)==null||i.call(s,o)}})},hotkeys:{toggleSelectedItem:{hotkey:"Control+Space",preventDefault:!0,handler:(e,t)=>{t.getFocusedItem().toggleSelect()}},selectUpwards:{hotkey:"Shift+ArrowUp",handler:(e,t)=>{const n=t.getFocusedItem(),r=n.getItemAbove();r&&(n.isSelected()&&r.isSelected()?n.deselect():r.select(),r.setFocused(),t.updateDomFocus())}},selectDownwards:{hotkey:"Shift+ArrowDown",handler:(e,t)=>{const n=t.getFocusedItem(),r=n.getItemBelow();r&&(n.isSelected()&&r.isSelected()?n.deselect():r.select(),r.setFocused(),t.updateDomFocus())}},selectAll:{hotkey:"Control+KeyA",preventDefault:!0,handler:(e,t)=>{t.setSelectedItems(t.getItems().map(n=>n.getId()))}}}},Zc=e=>e.code!==""&&e.code!=="Unidentified"?e.code:e.key,Jc={letter:/^Key[A-Z]$/,letterornumber:/^(Key[A-Z]|Digit[0-9])$/,plus:/^(NumpadAdd|Plus)$/,minus:/^(NumpadSubtract|Minus)$/,control:/^(ControlLeft|ControlRight)$/,shift:/^(ShiftLeft|ShiftRight)$/,metaorcontrol:/^(MetaLeft|MetaRight|ControlLeft|ControlRight)$/,enter:/^(Enter|NumpadEnter)$/},$c=new Set(["MetaLeft","MetaRight","Meta","ControlLeft","ControlRight","Control","AltLeft","AltRight","Alt","ShiftLeft","ShiftRight","Shift"]),o1=(e,t,n)=>{const r=n.hotkey.toLowerCase().split("+"),o=r.every(i=>{if(i in Jc)return[...e].some(l=>Jc[i].test(l));const a=[...e].map(l=>l.toLowerCase());return a.includes(i.toLowerCase())||a.includes(`key${i.toLowerCase()}`)}),s=!n.isEnabled||n.isEnabled(t);return o&&s&&e.size===r.length},s1=(e,t,n,r)=>{var o;return(o=Object.entries(ut(ut({},n),r)).find(([,s])=>o1(e,t,s)))==null?void 0:o[0]},Zs={clearPressedKeys:e=>{e.current.pressedKeys=new Set},dispatchKeyDown:(e,t,n,r={})=>{var o,s,i,a,l;const{isInputFocused:u=!1,releaseAfterDispatch:d=!1}=r,{ignoreHotkeysOnInputs:p,onTreeHotkey:A,hotkeys:m}=e.getConfig();if(u&&p)return;const h=Zc({code:(o=n.code)!=null?o:"",key:(s=n.key)!=null?s:""});(a=(i=t.current).pressedKeys)!=null||(i.pressedKeys=new Set);const g=!t.current.pressedKeys.has(h);h&&t.current.pressedKeys.add(h);const x=s1(t.current.pressedKeys,e,e.getHotkeyPresets(),m);if(d&&h&&t.current.pressedKeys.delete(h),!x)return;const b=ut(ut({},e.getHotkeyPresets()[x]),m?.[x]);b&&(!b.allowWhenInputFocused&&u||!b.canRepeat&&!g||(b.preventDefault&&((l=n.preventDefault)==null||l.call(n)),b.handler(n,e),A?.(x,n)))},dispatchKeyUp:(e,t)=>{var n,r,o,s;const i=Zc({code:(n=t.code)!=null?n:"",key:(r=t.key)!=null?r:""});i&&((s=(o=e.current).pressedKeys)!=null||(o.pressedKeys=new Set),$c.has(i)&&(e.current.pressedKeys=new Set([...e.current.pressedKeys].filter(a=>$c.has(a)))),e.current.pressedKeys.delete(i))}},i1={key:"hotkeys-core",onTreeMount:(e,t)=>{const n=e.getDataRef(),r=i=>{const a=i.target instanceof HTMLInputElement;Zs.dispatchKeyDown(e,n,i,{isInputFocused:a,releaseAfterDispatch:a})},o=i=>{Zs.dispatchKeyUp(n,i)},s=()=>{Zs.clearPressedKeys(n)};t.addEventListener("keydown",r),document.addEventListener("keyup",o),window.addEventListener("focus",s),n.current.keydownHandler=r,n.current.keyupHandler=o,n.current.resetHandler=s},onTreeUnmount:(e,t)=>{const n=e.getDataRef();n.current.keyupHandler&&(document.removeEventListener("keyup",n.current.keyupHandler),delete n.current.keyupHandler),n.current.keydownHandler&&(t.removeEventListener("keydown",n.current.keydownHandler),delete n.current.keydownHandler),n.current.resetHandler&&(window.removeEventListener("focus",n.current.resetHandler),delete n.current.resetHandler)}},a1="sync dataLoader returned undefined",l1="sync dataLoader returned promise",Js=e=>{if(!e)throw Ei(a1);if(typeof e=="object"&&"then"in e)throw Ei(l1);return e},c1={key:"sync-data-loader",getInitialState:e=>ut({loadingItemData:[],loadingItemChildrens:[]},e),getDefaultConfig:(e,t)=>ut({setLoadingItemData:Kr("loadingItemData",t),setLoadingItemChildrens:Kr("loadingItemChildrens",t)},e),stateHandlerNames:{loadingItemData:"setLoadingItemData",loadingItemChildrens:"setLoadingItemChildrens"},treeInstance:{waitForItemDataLoaded:()=>_o(null,null,function*(){}),waitForItemChildrenLoaded:()=>_o(null,null,function*(){}),retrieveItemData:({tree:e},t)=>Js(e.getConfig().dataLoader.getItem(t)),retrieveChildrenIds:({tree:e},t)=>{const{dataLoader:n}=e.getConfig();return"getChildren"in n?Js(n.getChildren(t)):Js(n.getChildrenWithData(t)).map(r=>r.data)},loadItemData:({tree:e},t)=>e.retrieveItemData(t),loadChildrenIds:({tree:e},t)=>e.retrieveChildrenIds(t)},itemInstance:{isLoading:()=>!1,hasLoadedData:()=>!0}},u1=Object.defineProperty,d1=Object.defineProperties,f1=Object.getOwnPropertyDescriptors,Xc=Object.getOwnPropertySymbols,p1=Object.prototype.hasOwnProperty,h1=Object.prototype.propertyIsEnumerable,qc=(e,t,n)=>t in e?u1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fo=(e,t)=>{for(var n in t||(t={}))p1.call(t,n)&&qc(e,n,t[n]);if(Xc)for(var n of Xc(t))h1.call(t,n)&&qc(e,n,t[n]);return e},A1=(e,t)=>d1(e,f1(t)),g1=e=>{const[t]=f.useState(()=>({current:n1(e)})),[n,r]=f.useState(()=>t.current.getState());return f.useEffect(()=>(t.current.setMounted(!0),t.current.rebuildTree(),()=>{t.current.setMounted(!1)}),[t]),t.current.setConfig(o=>A1(fo(fo({},o),e),{state:fo(fo({},n),e.state),setState:s=>{var i;r(s),(i=e.setState)==null||i.call(e,s)}})),t.current};const m1=/^(https?:|mailto:|#|\.\/|#\/)/iu,x1=e=>e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;"),Nn=Hy({html:!1,linkify:!0,typographer:!1,breaks:!1});Ly(Nn,()=>{});Nn.core.ruler.push("render_front_matter",e=>{for(const t of e.tokens)t.type==="front_matter"&&(t.type="fence",t.tag="code",t.info="yaml",t.content=String(t.meta??"").replace(/\n$/,""),t.block=!0);return!0});Nn.validateLink=e=>m1.test(e.trim());const $f=e=>{for(const t of e)t.type==="link_open"&&(t.attrSet("rel","noreferrer noopener"),t.attrSet("target","_blank")),t.children!==null&&$f(t.children)};Nn.core.ruler.push("external_links",e=>($f(e.tokens),!0));Nn.renderer.rules.fence=(e,t)=>{const n=e[t];return`<pre class="tech-ltr"><code${n.info.trim().length>0?` class="language-${x1(n.info.trim())}"`:""}>${Nn.utils.escapeHtml(n.content)}</code></pre>
20
+ `};const b1=e=>Nn.render(e),v1=["prose prose-sm","dark:prose-invert","max-w-[75ch]","prose-headings:font-semibold prose-headings:tracking-tight","prose-h1:text-xl prose-h2:text-lg prose-h3:text-base","prose-p:my-2 prose-li:my-0.5","prose-code:before:content-none prose-code:after:content-none","prose-code:font-mono prose-code:text-[0.85em]","prose-pre:bg-muted prose-pre:text-foreground prose-pre:rounded-lg","prose-a:text-primary prose-a:decoration-primary/40 hover:prose-a:decoration-primary","prose-table:border-collapse prose-table:text-xs","prose-th:border prose-th:border-border prose-th:bg-muted prose-th:px-2 prose-th:py-1 prose-th:text-start prose-th:font-semibold","prose-td:border prose-td:border-border prose-td:px-2 prose-td:py-1 prose-td:align-top","prose-td:font-mono","prose-hr:border-border prose-blockquote:border-primary/40"].join(" "),y1=(e,t)=>e.children!==void 0?t?c.jsx(Bh,{"aria-hidden":!0,className:"pointer-events-none size-4 text-amber-500"}):c.jsx(Mh,{"aria-hidden":!0,className:"pointer-events-none size-4 text-amber-500"}):c.jsx(Dh,{"aria-hidden":!0,className:"pointer-events-none size-4 text-muted-foreground"}),eu=16,C1=({entries:e,selected:t,onSelect:n})=>{const r=f.useMemo(()=>{const l=new Map;for(const d of e){const p=d.path.split("/"),A=p[p.length-1]??d.path;d.type==="directory"?l.set(d.path,{name:A,path:d.path,children:[]}):l.set(d.path,{name:A,path:d.path})}for(const d of e){const p=d.path.split("/");for(let A=1;A<p.length;A+=1){const m=p.slice(0,A).join("/");l.has(m)||l.set(m,{name:p[A-1]??m,path:m,children:[]})}}for(const d of l.values())d.children!==void 0&&(d.children=[...l.values()].filter(p=>p.path!==""&&p.path.split("/").slice(0,-1).join("/")===d.path).map(p=>p.path));const u={name:"skill",path:"",children:[]};return u.children=[...l.values()].filter(d=>d.path!==""&&d.path.split("/").length===1).map(d=>d.path),l.set("root",u),Object.fromEntries(l)},[e]),o=f.useMemo(()=>Object.values(r).filter(l=>l.children!==void 0&&l.path!=="").map(l=>l.path),[r]),[s,i]=f.useState([t]),a=g1({initialState:{selectedItems:[t],expandedItems:o},setSelectedItems:l=>{i(u=>{const d=typeof l=="function"?l(u):l,p=d[0];return p!==void 0&&r[p]?.children===void 0&&p!=="root"&&n(p),d})},indent:eu,rootItemId:"root",getItemName:l=>l.getItemData().name,isItemFolder:l=>(l.getItemData()?.children?.length??0)>0,dataLoader:{getItem:l=>r[l]??{name:l,path:""},getChildren:l=>r[l]?.children??[]},features:[c1,r1,i1]});return c.jsx(xb,{indent:eu,tree:a,children:a.getItems().map(l=>{const u=l.getItemData(),d=u.children===void 0&&u.path!=="";return c.jsx(bb,{item:l,onClick:()=>{d&&n(u.path)},children:c.jsx(vb,{className:"tech-ltr relative before:bg-background before:absolute before:inset-x-0 before:-inset-y-0.5 before:-z-10",children:c.jsxs("span",{className:"flex items-center gap-2",children:[y1(u,l.isExpanded()),l.getItemName()]})})},l.getId())})})},I1=()=>{const{messages:e}=mt(),[t,n]=f.useState([]),[r,o]=f.useState("SKILL.md"),[s,i]=f.useState(null),[a,l]=f.useState(null),[u,d]=f.useState(!0),[p,A]=f.useState(!1);f.useEffect(()=>{(async()=>{const h=await Jp();h.status===200?n(h.data):l(e.help.readError),d(!1)})()},[e.help.readError]),f.useEffect(()=>{A(!0),l(null),(async()=>{const h=await $p(r);h.status===200&&"content"in h.data?i(h.data.content):(i(null),l(e.help.readError)),A(!1)})()},[r,e.help.readError]);const m=f.useMemo(()=>s===null?"":b1(s),[s]);return c.jsxs("section",{className:"flex h-full min-h-0 overflow-hidden","aria-label":e.help.title,children:[c.jsx("nav",{className:"w-64 shrink-0 overflow-y-auto border-e border-border p-2","aria-label":e.help.listTitle,children:u?c.jsxs("div",{className:"space-y-2",children:[c.jsx(nn,{className:"h-5 w-full"}),c.jsx(nn,{className:"h-5 w-4/5"}),c.jsx(nn,{className:"h-5 w-3/5"})]}):t.length===0?c.jsx("p",{className:"text-muted-foreground px-2 text-xs",children:e.help.empty}):c.jsx(C1,{entries:t,selected:r,onSelect:o})}),c.jsx("article",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-6","aria-live":"polite",children:p?c.jsxs("div",{className:"space-y-2",children:[c.jsx(nn,{className:"h-6 w-1/2"}),c.jsx(nn,{className:"h-4 w-full"}),c.jsx(nn,{className:"h-4 w-5/6"})]}):a!==null?c.jsx("p",{className:"text-destructive text-sm",children:a}):c.jsx("div",{className:v1,dangerouslySetInnerHTML:{__html:m}})})]})},Xf=e=>`/api/icon-composed/${e}?token=${encodeURIComponent(new URLSearchParams(location.search).get("token")??"")}`,w1={cwd:"",env:[],argsMode:"string",family:null},Ja=new URLSearchParams(location.search).get("token")??"",_e=(e,t={})=>fetch(e,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${Ja}`},body:JSON.stringify(t)}),k1=()=>new EventSource(`/api/events?token=${encodeURIComponent(Ja)}${xl()===void 0?"":`&lang=${encodeURIComponent(xl())}`}`),Rn=(e,t,n=0)=>`/api/icon-data/${e}/${t}?g=${n}&token=${encodeURIComponent(Ja)}`,Si=e=>{try{return new URL(e).hostname}catch{return e}};function E1({values:e,defaults:t,frozen:n,iconCandidates:r,iconCandidatesPort:o,iconCandidatesGeneration:s,uploadedIconUrl:i,selectedIconRef:a,iconAnalysis:l,iconComposition:u,iconComposeError:d,iconBackground:p,iconScale:A,subjectExtracting:m,subjectStage:h,subjectSettings:g,onSubjectSettingsChange:x,onIconBackgroundChange:b,onIconScaleChange:v,onPickIconCandidate:y,onUploadIcon:C,onClearIcon:I,onPatch:w}){const{messages:E}=mt(),S=n,D=f.useRef(null),[k,j]=f.useState(!1),[N,T]=f.useState(!1);return c.jsxs("div",{className:"grid grid-cols-1 gap-y-1",children:[c.jsxs("div",{children:[c.jsx(Ne,{children:E.icon.appLabel}),c.jsxs("div",{className:"mt-1.5 flex flex-wrap items-start gap-3",children:[c.jsx("button",{type:"button",disabled:S,"aria-label":E.icon.uploadAria,onClick:()=>D.current?.click(),onDragOver:F=>{F.preventDefault(),S||j(!0)},onDragLeave:()=>j(!1),onDrop:F=>{if(F.preventDefault(),j(!1),S)return;const R=F.dataTransfer.files[0];R!==void 0&&C(R)},className:ge("flex size-20 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-dashed border-border bg-popover transition-colors",S?"opacity-50":"hover:border-primary",k&&"border-primary bg-primary/10"),children:i!==void 0?c.jsx("img",{src:i,alt:E.icon.uploadedAlt,className:"icon-checker size-full rounded object-contain"}):c.jsxs("span",{className:"flex flex-col items-center gap-1 text-muted-foreground",children:[c.jsx(Du,{className:"size-4"}),c.jsx("span",{className:"text-[10px] leading-tight",children:E.icon.clickOrDrop})]})}),c.jsx("input",{ref:D,type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden",disabled:S,onChange:F=>{const R=F.target.files?.[0];R!==void 0&&C(R),F.target.value=""}}),c.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[r.length===0?c.jsx("span",{className:"text-xs text-muted-foreground",children:E.icon.noCandidates}):r.filter(F=>F.variant==="original"||F.variant==="subject").map(F=>{const R=o===void 0?void 0:Rn(o,F.index,s),O=a===`${o}:${F.index}`,_=a===void 0&&F.variant==="original"&&F.index===(r.find(M=>M.variant==="original")?.index??-1);return c.jsx("button",{type:"button",disabled:S,title:F.variant==="subject"?Ye(E.icon.subjectTitle,{w:F.width,h:F.height,format:F.format.toUpperCase()}):`${F.width}×${F.height} ${F.format.toUpperCase()}`,onClick:()=>y(F),className:ge("icon-checker flex size-14 items-center justify-center overflow-hidden rounded-lg border p-1 transition-all",O||_?"border-primary ring-2 ring-primary/60":"border-border hover:border-primary/60",S&&"opacity-50"),children:R!==void 0?c.jsx("img",{src:R,alt:F.variant==="subject"?Ye(E.icon.subjectAlt,{w:F.width,h:F.height}):Ye(E.icon.candidateAlt,{w:F.width,h:F.height}),className:"size-full object-contain"}):null},F.index)}),m?c.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",role:"status",children:[c.jsx("span",{className:"inline-block size-3 animate-spin rounded-full border-2 border-muted-foreground/40 border-t-muted-foreground"}),h??E.icon.extracting]}):null,c.jsx("button",{type:"button",disabled:S,"aria-expanded":N,onClick:()=>T(F=>!F),className:"text-[11px] text-muted-foreground underline-offset-2 hover:underline",children:E.icon.settings})]}),N?c.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-2.5 rounded-lg border border-border p-3",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{className:"text-[11px] text-muted-foreground",children:E.icon.modelPrecision}),c.jsx("div",{className:"flex gap-1.5",children:[["isnet",E.icon.modelHigh],["isnet_fp16",E.icon.modelStandard],["isnet_quint8",E.icon.modelLight]].map(([F,R])=>c.jsx("button",{type:"button",disabled:S,"aria-pressed":g.model===F,onClick:()=>x({...g,model:F}),className:ge("h-7 rounded-md border px-2.5 text-[11px] transition-colors",g.model===F?"border-foreground bg-secondary text-secondary-foreground":"border-border text-muted-foreground hover:border-foreground/40"),children:R},F))})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-[11px] text-muted-foreground",children:E.icon.alphaLabel}),c.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:g.alphaThreshold===0?E.common.off:g.alphaThreshold})]}),c.jsx("input",{type:"range",min:0,max:128,step:8,value:g.alphaThreshold,disabled:S,onChange:F=>x({...g,alphaThreshold:Number(F.target.value)}),className:"mt-1 w-full accent-foreground","aria-label":E.icon.alphaAria})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-[11px] text-muted-foreground",children:E.icon.shrinkLabel}),c.jsx("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:g.shrink===0?E.common.off:`${g.shrink}px`})]}),c.jsx("input",{type:"range",min:0,max:6,step:1,value:g.shrink,disabled:S,onChange:F=>x({...g,shrink:Number(F.target.value)}),className:"mt-1 w-full accent-foreground","aria-label":E.icon.shrinkAria})]}),c.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:E.icon.settingsHint})]}):null,a!==void 0||i!==void 0?c.jsx("button",{type:"button",disabled:S,onClick:I,className:"text-[11px] text-muted-foreground underline-offset-2 hover:underline",children:E.icon.clearSelection}):null]}),(a!==void 0||i!==void 0)&&c.jsx("div",{className:"mt-3 rounded-lg border border-border p-3",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{role:"img",className:"icon-checker size-14 shrink-0 overflow-hidden rounded-[10px]","aria-label":E.icon.composePreviewAria,children:u!==void 0?c.jsx("img",{src:Xf(u.key),alt:E.icon.composePreviewAria,className:"size-full object-contain",onError:F=>{F.currentTarget.style.display="none"}}):c.jsx("span",{className:"flex size-full items-center justify-center text-[10px] text-muted-foreground",children:E.icon.previewOnly})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx(Ne,{children:E.icon.background}),c.jsx("div",{className:"mt-1.5 flex gap-1.5",children:["black","white","transparent"].map(F=>c.jsxs("button",{type:"button",disabled:S,"aria-pressed":p===F,onClick:()=>b(F),className:ge("flex h-7 items-center gap-1.5 rounded-md border px-2.5 text-[11px] transition-colors",p===F?"border-foreground bg-secondary text-secondary-foreground":"border-border text-muted-foreground hover:border-foreground/40"),children:[F==="black"?E.icon.bgBlack:F==="white"?E.icon.bgWhite:E.icon.bgTransparent,l!==void 0&&l.suggested===F?c.jsx("span",{className:"text-[10px] text-muted-foreground/70",children:E.icon.autoBadge}):null]},F))}),c.jsxs("div",{className:"mt-2.5",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(Ne,{className:"text-[11px]",children:E.icon.scale}),c.jsxs("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[Math.round(A*100),"%"]})]}),c.jsx("input",{type:"range",min:50,max:95,step:5,value:Math.round(A*100),disabled:S,onChange:F=>v(Number(F.target.value)/100),className:"mt-1 w-full accent-foreground","aria-label":E.icon.scaleAria})]}),d!==void 0?c.jsx("p",{role:"alert",className:"mt-1.5 text-[11px] font-medium text-red-400",children:d}):null,l!==void 0?c.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-muted-foreground",children:p==="transparent"?E.icon.transparentNote:Ye(E.icon.luminanceNote,{manual:l.suggested===p?"":E.icon.manualOverride,detail:l.luminance===void 0?E.icon.luminanceUnavailable:Ye(E.icon.luminanceDetail,{luminance:l.luminance.toFixed(2),coverage:(l.coverage*100).toFixed(0)})})}):null]})]})})]}),c.jsxs("div",{children:[c.jsx(Ne,{htmlFor:"appId",children:"App ID"}),c.jsx(et,{id:"appId",className:"mt-1 font-mono",disabled:S,value:e.appId,placeholder:t.appId||E.form.appIdPlaceholder,onChange:F=>w({appId:F.target.value})})]}),c.jsxs("div",{children:[c.jsx(Ne,{htmlFor:"appName",children:E.form.appName}),c.jsx(et,{id:"appName",className:"mt-1",disabled:S,value:e.appName,placeholder:t.appName||E.form.appNamePlaceholder,onChange:F=>w({appName:F.target.value})})]})]})}function S1({candidates:e,port:t,generation:n,disabled:r,selectedRef:o,uploadedUrl:s,includeVariants:i,defaultLabel:a,onPick:l,onUpload:u,onClear:d}){const{messages:p}=mt(),A=f.useRef(null),[m,h]=f.useState(!1),g=i?e:e.filter(b=>b.variant==="original"),x=e.filter(b=>b.variant==="original");return c.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[c.jsx("button",{type:"button",disabled:r,"aria-label":p.icon.uploadShortAria,onClick:()=>A.current?.click(),onDragOver:b=>{b.preventDefault(),r||h(!0)},onDragLeave:()=>h(!1),onDrop:b=>{if(b.preventDefault(),h(!1),r)return;const v=b.dataTransfer.files[0];v!==void 0&&u(v)},className:ge("flex size-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-dashed border-border bg-popover transition-colors",r?"opacity-50":"hover:border-primary",m&&"border-primary bg-primary/10"),children:s!==void 0?c.jsx("img",{src:s,alt:p.icon.uploadedAlt,className:"icon-checker size-full rounded object-contain"}):c.jsxs("span",{className:"flex flex-col items-center gap-1 text-muted-foreground",children:[c.jsx(Du,{className:"size-4"}),c.jsx("span",{className:"text-[10px] leading-tight",children:p.icon.upload})]})}),c.jsx("input",{ref:A,type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden",disabled:r,onChange:b=>{const v=b.target.files?.[0];v!==void 0&&u(v),b.target.value=""}}),c.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[g.length===0?c.jsx("span",{className:"text-xs text-muted-foreground",children:p.icon.noCandidatesShort}):g.map(b=>{const v=t===void 0?void 0:Rn(t,b.index,n),y=o===`${t}:${b.index}`,C=o===void 0&&b.variant==="original"&&b.index===(x[0]?.index??-1);return c.jsx("button",{type:"button",disabled:r,title:b.variant==="original"?`${b.width}×${b.height} ${b.format.toUpperCase()}`:b.variant==="subject"?Ye(p.icon.subjectTitle,{w:b.width,h:b.height,format:b.format.toUpperCase()}):Ye(p.icon.solid,{color:b.variant==="solid-black"?p.icon.colorBlack:p.icon.colorWhite,format:b.format.toUpperCase()}),onClick:()=>l(b),className:ge("icon-checker flex size-12 items-center justify-center overflow-hidden rounded-lg border p-1 transition-all",y||C?"border-primary ring-2 ring-primary/60":"border-border hover:border-primary/60",r&&"opacity-50"),children:v!==void 0?c.jsx("img",{src:v,alt:Ye(p.icon.candidateVariant,{variant:b.variant}),className:"size-full object-contain"}):null},`${b.variant}:${b.index}`)}),a!==void 0&&o===void 0&&g.length>0?c.jsx("span",{className:"text-[11px] text-muted-foreground",children:a}):null]}),o!==void 0||s!==void 0?c.jsx("button",{type:"button",disabled:r,onClick:d,className:"text-[11px] text-muted-foreground underline-offset-2 hover:underline",children:p.icon.clear}):null]})}function R1(e){const t=f.useRef(!0);t.current&&(t.current=!1,e())}const qf=f.createContext(null);function Xt(){const e=f.useContext(qf);if(e===null)throw new Error(at(60));return e}const D1=(e,t)=>Object.is(e,t);function or(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function yo(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:or(r,t,n))}function F1(e,t,n){return e.filter(r=>!or(t,r,n))}function Ri(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function ep(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function B1(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(ep(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function tp(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Ri(e)}function Wn(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Ri(e.value):Ri(e)}function np(e,t,n){function r(){return tp(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const o=t,s=ep(o)?o.flatMap(i=>i.items):o;if(e==null||typeof e!="object"){const i=s.find(a=>a.value===e);return i&&i.label!=null?i.label:r()}if("value"in e){const i=s.find(a=>a&&a.value===e.value);if(i&&i.label!=null)return i.label}}return r()}function j1(e,t,n){return e.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(c.jsx(f.Fragment,{children:np(o,t,n)},s)),r),[])}const we={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Wn(t,r)!==""},hasNullItemLabel:(e,t)=>t?B1(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(o=>or(t,o,n)):or(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function M1(e,t,n=(r,o)=>r===o){return e.length===t.length&&e.every((r,o)=>n(r,t[o]))}function vr(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const Ot=1;function $a(e,t){return Math.max(0,e-t)}function Oo(e,t){if(t<=0)return 0;const n=vr(e,0,t),r=n,o=t-n,s=r<=Ot,i=o<=Ot;return s&&i?r<=o?0:t:s?0:i?t:n}function N1(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:a,name:l,form:u,autoComplete:d,disabled:p=!1,readOnly:A=!1,required:m=!1,modal:h=!0,actionsRef:g,inputRef:x,onOpenChangeComplete:b,items:v,multiple:y=!1,itemToStringLabel:C,itemToStringValue:I,isItemEqualToValue:w=D1,highlightItemOnHover:E=!0,children:S}=e,{clearErrors:D}=Ki(),{setDirty:k,setTouched:j,setFocused:N,validityData:T,setFilled:F,name:R,disabled:O,validation:_,validationMode:M}=Yo(),H=Qi({id:t}),G=O||p,B=R??l,[P,W]=ln({controlled:n,default:y?r??Ht:r,name:"Select",state:"value"}),[Y,Z]=ln({controlled:s,default:i,name:"Select",state:"open"}),Q=f.useRef([]),J=f.useRef([]),K=f.useRef(null),ee=f.useRef(null),ce=f.useRef(0),te=f.useRef(null),$=f.useRef([]),X=f.useRef(!1),ne=f.useRef(null),de=f.useRef(null),fe=f.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ie=f.useRef(!1),{mounted:he,setMounted:oe,transitionStatus:se}=sr(Y),{openMethod:ae,triggerProps:xe}=Td(Y),me=Ft(()=>new Gr({id:H,labelId:void 0,modal:h,multiple:y,itemToStringLabel:C,itemToStringValue:I,isItemEqualToValue:w,value:P,open:Y,mounted:he,transitionStatus:se,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,L=Ie(me,we.activeIndex),z=Ie(me,we.selectedIndex),ye=Ie(me,we.triggerElement),q=Ie(me,we.positionerElement),re=B0(ae),Se=ae??re,ke=f.useMemo(()=>y?"":Wn(P,I),[y,P,I]),We=f.useMemo(()=>y&&Array.isArray(P)?P.map(Be=>Wn(Be,I)):Wn(P,I),[y,P,I]),rt=nt(ye),Ge=ue(()=>We);Li(rt,H,P,Ge,!G,l);const At=f.useRef(P),$e=y?Array.isArray(P)&&P.length>0:P!=null&&ke!=="";le(()=>{F($e)},[$e,F]),le(function(){let Ue=P,bt=!1;if(y){const jt=Array.isArray(P)?P:[];bt=jt.length===0,Ue=jt[jt.length-1]}const Rt=bt?-1:yo($.current,Ue,w),Bt=Rt===-1?null:Rt;Bt===null&&(de.current=null),!Y&&me.set("selectedIndex",Bt)},[y,Y,P,w,me]);function Oe(Be){const Ue=T.initialValue;return Array.isArray(Be)&&Array.isArray(Ue)?!M1(Be,Ue,(bt,Rt)=>or(bt,Rt,w)):Be!==Ue}as(P,()=>{D(B),k(Oe(P)),_.change(P)});const lt=ue((Be,Ue)=>{a?.(Be,Ue),!Ue.isCanceled&&(Z(Be),!Be&&(Ue.reason===jn||Ue.reason===Lo)&&(j(!0),N(!1),M==="onBlur"&&_.commit(P)))}),Ee=ue(()=>{oe(!1),me.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),b?.(!1)});Zt({enabled:!g,open:Y,ref:K,onComplete(){Y||Ee()}}),f.useImperativeHandle(g,()=>({unmount:Ee}),[Ee]);const Le=ue((Be,Ue)=>{o?.(Be,Ue),!Ue.isCanceled&&W(Be)}),Ze=ue(Be=>{const Ue=$a(Be.scrollHeight,Be.clientHeight),bt=Oo(Be.scrollTop,Ue),Rt=bt>0,Bt=bt<Ue;me.set("scrollUpArrowVisible",Rt),me.set("scrollDownArrowVisible",Bt)}),ze=Dm({open:Y,onOpenChange:lt,elements:{reference:ye,floating:q}}),Re=ad(ze,{enabled:!A&&!G,event:"mousedown"}),Pe=es(ze),Je=Rd(ze,{enabled:!A&&!G,listRef:Q,activeIndex:L,selectedIndex:z,disabledIndices:Ht,onNavigate(Be){Be===null&&!Y||me.set("activeIndex",Be)},focusItemOnHover:E}),qe=Dd(ze,{enabled:!A&&!G&&(Y||!y),listRef:J,activeIndex:L,selectedIndex:z,disabledIndices:Be=>tf(Q.current[Be]),onMatch(Be){Y?me.set("activeIndex",Be):Le($.current[Be],Ce(Pt))},onTyping(Be){X.current=Be}}),ft=f.useMemo(()=>Nt(qe.reference,Je.reference,Pe.reference,Re.reference,xe),[Re.reference,qe.reference,Je.reference,Pe.reference,xe]),ot=f.useMemo(()=>Nt(rs,qe.floating,Je.floating,Pe.floating),[qe.floating,Je.floating,Pe.floating]),Ct=Je.item??dt;R1(()=>{me.update({popupProps:ot,triggerProps:ft})}),me.useSyncedValues({id:H,modal:h,multiple:y,value:P,open:Y,mounted:he,transitionStatus:se,popupProps:ot,triggerProps:ft,items:v,itemToStringLabel:C,itemToStringValue:I,isItemEqualToValue:w,openMethod:Se});const st=f.useMemo(()=>({store:me,floatingContext:ze,required:m,disabled:G,readOnly:A,multiple:y,highlightItemOnHover:E,setValue:Le,setOpen:lt,listRef:Q,popupRef:K,scrollHandlerRef:ee,handleScrollArrowVisibility:Ze,scrollArrowsMountedCountRef:ce,itemProps:Ct,valueRef:te,valuesRef:$,labelsRef:J,typingRef:X,selectionRef:fe,firstItemTextRef:ne,selectedItemTextRef:de,validation:_,onOpenChangeComplete:b,alignItemWithTriggerActiveRef:ie,initialValueRef:At}),[me,ze,m,G,A,y,E,Le,lt,Ct,_,b,Ze]),Et=Ut(x,_.inputRef),St=y?void 0:B,qt=f.useMemo(()=>!y||!Array.isArray(P)||!B?null:P.map(Be=>{const Ue=Wn(Be,I);return c.jsx("input",{type:"hidden",form:u,name:B,value:Ue,disabled:G},Ue)}),[y,P,u,B,I,G]);return c.jsxs(qf.Provider,{value:st,children:[S,c.jsx("input",{..._.getValidationProps(G,{onFocus(){me.state.triggerElement?.focus({focusVisible:!0})},onChange(Be){if(Be.nativeEvent.defaultPrevented||G||A)return;const Ue=Be.currentTarget.value,bt=Ce(Pt,Be.nativeEvent);function Rt(){if(y)return;const Bt=Ue.toLowerCase();let jt=$.current.findIndex(dn=>Wn(dn,I).toLowerCase()===Bt||tp(dn,C).toLowerCase()===Bt);jt===-1&&(jt=$.current.findIndex((dn,Dt)=>{const en=J.current[Dt];return en!=null&&en.toLowerCase()===Bt}));const Lt=$.current[jt];Lt!=null&&Le(Lt,bt)}me.set("forceMount",!0),queueMicrotask(Rt)}}),id:H&&St==null?`${H}-hidden-input`:void 0,form:u,name:St,autoComplete:d,value:ke,disabled:G,required:m&&!(y&&$e),readOnly:A,ref:Et,style:B?la:qo,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),qt]})}function T1(e,t){return e??t}const P1=400,_1={...fi,...Hi,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},O1=f.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:a=!0,style:l,...u}=t,{setTouched:d,setFocused:p,validationMode:A,state:m,disabled:h}=Yo(),{labelId:g}=Wi(),{store:x,setOpen:b,selectionRef:v,validation:y,readOnly:C,required:I,alignItemWithTriggerActiveRef:w,disabled:E}=Xt(),S=h||E||i,D=Ie(x,we.open),k=Ie(x,we.mounted),j=Ie(x,we.value),N=Ie(x,we.triggerProps),T=Ie(x,we.positionerElement),F=Ie(x,we.listElement),R=Ie(x,we.popupSide),O=Ie(x,we.id),_=Ie(x,we.labelId),M=Ie(x,we.hasSelectedValue),H=k&&T?R:null,G=s??O,B=T1(g,_);Qi({id:G});const P=nt(T),W=f.useRef(null),{getButtonProps:Y,buttonRef:Z}=Vt({disabled:S,native:a}),Q=x.useStateSetter("triggerElement"),J=ht(),K=ht(),ee=ht();f.useEffect(()=>{if(D)return ee.start(P1,()=>{v.current.allowUnselectedMouseUp=!0,v.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};v.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},K.clear()},[D,v,K,ee]);const ce=Nt(N,{id:G,role:"combobox","aria-expanded":D,"aria-haspopup":"listbox","aria-controls":D?F?.id??wo(T)?.id:void 0,"aria-labelledby":B,"aria-readonly":C||void 0,"aria-required":I||void 0,tabIndex:S?-1:0,onFocus(X){p(!0),D&&w.current&&b(!1,Ce(Pt,X.nativeEvent)),J.start(0,()=>{x.set("forceMount",!0)})},onBlur(X){ve(T,X.relatedTarget)||(d(!0),p(!1),A==="onBlur"&&y.commit(j))},onMouseDown(X){if(D)return;const ne=je(X.currentTarget);function de(fe){if(!W.current)return;const ie=fe.target;ve(W.current,ie)||ve(P.current,ie)||$d(fe,W.current)||b(!1,Ce(wu,fe))}K.start(0,()=>{ne.addEventListener("mouseup",de,{once:!0})})}},u,Y),te=y.getValidationProps(S,ce);te.role="combobox";const $={...m,open:D,disabled:S,value:j,readOnly:C,popupSide:H,placeholder:!M};return Me("button",t,{ref:[n,W,Z,Q],state:$,stateAttributesMapping:_1,props:te})}),H1={value:()=>null},K1=f.forwardRef(function(t,n){const{className:r,render:o,children:s,placeholder:i,style:a,...l}=t,{store:u,valueRef:d}=Xt(),p=Ie(u,we.value),A=Ie(u,we.items),m=Ie(u,we.itemToStringLabel),h=Ie(u,we.hasSelectedValue),g=!h&&i!=null&&s==null,x=Ie(u,we.hasNullItemLabel,g),b={value:p,placeholder:!h};let v=null;return typeof s=="function"?v=s(p):s!=null?v=s:g&&!x?v=i:Array.isArray(p)?v=j1(p,A,m):v=np(p,A,m),Me("span",t,{state:b,ref:[n,d],props:[{children:v},l],stateAttributesMapping:H1})}),W1=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a}=Xt(),u={open:Ie(a,we.open)};return Me("span",t,{state:u,ref:n,props:[{"aria-hidden":!0,children:"▼"},i],stateAttributesMapping:Vu})}),L1=f.forwardRef(function(t,n){const{store:r}=Xt(),o=Ie(r,we.mounted),s=Ie(r,we.forceMount);return o||s?c.jsx(ca,{ref:n,...t}):null}),rp=f.createContext(void 0);function Xa(){const e=f.useContext(rp);if(!e)throw new Error(at(59));return e}function Ho(e,t){e&&Object.assign(e.style,t)}const op={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Q1={position:"fixed"},G1=f.forwardRef(function(t,n){const{anchor:r,className:o,render:s,positionMethod:i,side:a,align:l,sideOffset:u,alignOffset:d,collisionBoundary:p="clipping-ancestors",collisionPadding:A,arrowPadding:m,sticky:h,disableAnchorTracking:g,alignItemWithTrigger:x=!0,collisionAvoidance:b=Xu,style:v,...y}=t,{store:C,listRef:I,labelsRef:w,alignItemWithTriggerActiveRef:E,selectedItemTextRef:S,valuesRef:D,initialValueRef:k,popupRef:j,setValue:N,floatingContext:T}=Xt(),F=Ie(C,we.open),R=Ie(C,we.mounted),O=Ie(C,we.modal),_=Ie(C,we.value),M=Ie(C,we.openMethod),H=Ie(C,we.positionerElement),G=Ie(C,we.triggerElement),B=Ie(C,we.isItemEqualToValue),P=Ie(C,we.transitionStatus),W=f.useRef(null),Y=f.useRef(null),[Z,Q]=f.useState(x),J=R&&Z&&M!=="touch";!R&&Z!==x&&Q(x),f.useImperativeHandle(E,()=>J),Zd((J||O)&&F,M==="touch",H,G);const K=Fa({anchor:r,floatingRootContext:T,positionMethod:i,mounted:R,side:a,sideOffset:u,align:l,alignOffset:d,arrowPadding:m,collisionBoundary:p,collisionPadding:A,sticky:h,disableAnchorTracking:g??J,collisionAvoidance:b,keepMounted:!0}),ee=J?"none":K.side,ce=J?Q1:K.positionerStyles,te={open:F,side:ee,align:K.align,anchorHidden:K.anchorHidden};le(()=>{C.set("popupSide",K.side)},[C,K.side]);const $=C.useStateSetter("positionerElement"),X=Ba(t,te,{styles:ce,transitionStatus:P,props:y,refs:[n,$],hidden:!R,inert:!F}),ne=f.useRef(0),de=ue(ie=>{if(D.current.length===0)return;const he=ne.current;if(ne.current=ie.size,ie.size===he)return;const oe=Ce(Pt);if(he!==0&&!C.state.multiple&&_!==null&&yo(D.current,_,B)===-1){const ae=k.current,me=ae!=null&&yo(D.current,ae,B)!==-1?ae:null;N(me,oe),me===null&&(C.set("selectedIndex",null),S.current=null)}if(he!==0&&C.state.multiple&&Array.isArray(_)){const se=_.filter(ae=>yo(D.current,ae,B)!==-1);se.length!==_.length&&(N(se,oe),se.length===0&&(C.set("selectedIndex",null),S.current=null))}if(F&&J){C.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const se={height:""};Ho(H,se),Ho(j.current,se)}}),fe=f.useMemo(()=>({...K,side:ee,alignItemWithTriggerActive:J,setControlledAlignItemWithTrigger:Q,scrollUpArrowRef:W,scrollDownArrowRef:Y}),[K,ee,J,Q]);return c.jsx(Ur,{elementsRef:I,labelsRef:w,onMapChange:de,children:c.jsxs(rp.Provider,{value:fe,children:[R&&O&&c.jsx(Sa,{inert:Ea(!F),cutout:G}),X]})})}),po="base-ui-disable-scrollbar",Di={className:po,getElement(e){return c.jsx("style",{nonce:e,href:po,precedence:"base-ui:low",children:`.${po}{scrollbar-width:none}.${po}::-webkit-scrollbar{display:none}`})}},Y1=f.createContext(void 0),z1={disableStyleElements:!1};function U1(){return f.useContext(Y1)??z1}const V1={...Lr,..._n},Z1=f.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...a}=t,{store:l,popupRef:u,onOpenChangeComplete:d,setOpen:p,valueRef:A,firstItemTextRef:m,selectedItemTextRef:h,multiple:g,handleScrollArrowVisibility:x,scrollHandlerRef:b,listRef:v,highlightItemOnHover:y,floatingContext:C}=Xt(),{side:I,align:w,alignItemWithTriggerActive:E,isPositioned:S,setControlledAlignItemWithTrigger:D}=Xa(),k=Ma()!=null,j=ls(),{nonce:N,disableStyleElements:T}=U1(),F=Ie(l,we.id),R=Ie(l,we.open),O=Ie(l,we.openMethod),_=Ie(l,we.mounted),M=Ie(l,we.popupProps),H=Ie(l,we.transitionStatus),G=Ie(l,we.triggerElement),B=Ie(l,we.positionerElement),P=Ie(l,we.listElement),W=f.useRef(!1),Y=f.useRef(!1),Z=f.useRef({}),Q=qn(),J=ue(te=>{if(!B||!u.current||!Y.current)return;const $=B.style.top==="0px",X=B.style.bottom==="0px";if(W.current||!E||!$&&!X){x(te);return}const ne=nu(B),de=yr(B.getBoundingClientRect().height,"y",ne),fe=je(B),ie=it(B),he=ie.getComputedStyle(B),oe=parseFloat(he.marginTop),se=parseFloat(he.marginBottom),ae=tu(ie.getComputedStyle(u.current)),xe=Math.min(fe.documentElement.clientHeight-oe-se,ae),me=te.scrollTop,L=ho(te);let z=null;const ye=ke=>{B.style.height=`${ke}px`},q=$?L-me:me,re=Math.min(de+q,xe);if(q<=Ot){const ke=vr(q,0,xe-de);ke>0&&ye(de+ke),te.scrollTop=$?L:0,xe-(de+ke)<=Ot&&(W.current=!0),x(te);return}if(xe-re>Ot)z=$?1/0:0;else if(X&&me<L){const ke=de+q-xe;z=me-(q-ke)}const Se=Math.ceil(re);if(Se!==0&&ye(Se),z!=null){const ke=vr(z,0,ho(te));Math.abs(te.scrollTop-ke)>Ot&&(te.scrollTop=ke)}Se>=xe-Ot&&(W.current=!0),x(te)});f.useImperativeHandle(b,()=>J,[J]),Zt({open:R,ref:u,onComplete(){R&&d?.(!0)}});const K={open:R,transitionStatus:H,side:I,align:w};le(()=>{!B||!u.current||Object.keys(Z.current).length||(Z.current={top:B.style.top||"0",left:B.style.left||"0",right:B.style.right,height:B.style.height,bottom:B.style.bottom,minHeight:B.style.minHeight,maxHeight:B.style.maxHeight,marginTop:B.style.marginTop,marginBottom:B.style.marginBottom})},[u,B]),le(()=>{R||E||(Y.current=!1,W.current=!1,Ho(B,Z.current))},[R,E,B,u]),le(()=>{const te=u.current;if(!R||!G||!B||!te||E&&!S||l.state.transitionStatus==="ending")return;if(Y.current=!0,te.style.removeProperty("--transform-origin"),!E){Q.request(()=>x(P||te));return}const $=J1(te);try{let X=h.current;X?.isConnected||(X=!we.hasSelectedValue(l.state)&&m.current?.isConnected?m.current:null);const ne=A.current,de=it(B),fe=de.getComputedStyle(B),ie=de.getComputedStyle(te),he=je(G),oe=nu(G),se=Ao(G.getBoundingClientRect(),oe),ae=Ao(B.getBoundingClientRect(),oe),xe=se.height,me=P||te,L=me.scrollHeight,z=parseFloat(ie.borderBottomWidth),ye=parseFloat(fe.marginTop)||10,q=parseFloat(fe.marginBottom)||10,re=parseFloat(fe.minHeight)||100,Se=tu(ie),ke=5,We=5,rt=20,Ge=he.documentElement.clientHeight-ye-q,At=he.documentElement.clientWidth,$e=Ge-se.bottom+xe;let Oe,lt=j==="rtl"?se.right-ae.width:se.left,Ee=0;if(X&&ne){const st=Ao(ne.getBoundingClientRect(),oe);Oe=Ao(X.getBoundingClientRect(),oe),lt=ae.left+(j==="rtl"?st.right-Oe.right:st.left-Oe.left);const Et=st.top-se.top+st.height/2;Ee=Oe.top-ae.top+Oe.height/2-Et}const Le=$e+Ee+q+z;let Ze=Math.min(Ge,Le);const ze=Ge-ye-q,Re=Le-Ze,Pe=At-We;B.style.left=`${vr(lt,ke,Pe-ae.width)}px`,B.style.height=`${Ze}px`,B.style.maxHeight="none",B.style.marginTop=`${ye}px`,B.style.marginBottom=`${q}px`,te.style.height="100%";const Je=ho(me),qe=Re>=Je-Ot;qe&&(Ze=Math.min(Ge,ae.height)-(Re-Je));const ft=se.top<rt||se.bottom>Ge-rt||Math.ceil(Ze)+Ot<Math.min(L,re),ot=(de.visualViewport?.scale??1)!==1&&un;if(ft||ot){Ho(B,Z.current),D(!1);return}const Ct=Math.max(re,Ze);if(qe){const st=Math.max(0,Ge-Le);B.style.top=ae.height>=ze?"0":`${st}px`,B.style.height=`${Ze}px`,me.scrollTop=ho(me)}else B.style.bottom="0",me.scrollTop=Re;if(Oe){const st=ae.top,Et=ae.height,St=Oe.top+Oe.height/2,qt=vr(Et>0?(St-st)/Et*100:50,0,100);te.style.setProperty("--transform-origin",`50% ${qt}%`)}(Ct===Ge||Ze>=Se)&&(W.current=!0),x(me),y&&l.state.selectedIndex===null&&l.state.activeIndex===null&&v.current[0]!=null&&l.set("activeIndex",0)}finally{$()}},[l,R,B,G,A,m,h,u,x,E,D,Q,P,v,y,j,S]),f.useEffect(()=>{if(!E||!B||!R)return;const te=it(B);function $(X){p(!1,Ce(ch,X))}return De(te,"resize",$)},[p,E,B,R]);const ee={...P?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":g||void 0,id:`${F}-list`},onKeyDown(te){k&&ss.has(te.key)&&te.stopPropagation()},onScroll(te){P||J(te.currentTarget)},...E&&{style:P?{height:"100%"}:op},className:!P&&E?Di.className:void 0},ce=Me("div",t,{ref:[n,u],state:K,stateAttributesMapping:V1,props:[M,ee,cs(H),a]});return c.jsxs(f.Fragment,{children:[!T&&Di.getElement(N),c.jsx(fa,{context:C,modal:!1,disabled:!_,openInteractionType:O,returnFocus:i,restoreFocus:!0,children:ce})]})});function tu(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function ho(e){return $a(e.scrollHeight,e.clientHeight)}function nu(e){return pd.getScale(e)}function yr(e,t,n){return e/n[t]}function Ao(e,t){return Dr({x:yr(e.x,"x",t),y:yr(e.y,"y",t),width:yr(e.width,"x",t),height:yr(e.height,"y",t)})}const ru=[["transform","none"],["scale","1"],["translate","0 0"]];function J1(e){const{style:t}=e,n={};for(const[r,o]of ru)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of ru){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}const $1=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a,scrollHandlerRef:l,multiple:u}=Xt(),{alignItemWithTriggerActive:d}=Xa(),p=Ie(a,we.hasScrollArrows),A=Ie(a,we.openMethod),h={id:`${Ie(a,we.id)}-list`,role:"listbox","aria-multiselectable":u||void 0,onScroll(x){l.current?.(x.currentTarget)},...d&&{style:op},className:p&&A!=="touch"?Di.className:void 0},g=a.useStateSetter("listElement");return Me("div",t,{ref:[n,g],props:[h,i]})}),sp=f.createContext(void 0);function qa(){const e=f.useContext(sp);if(!e)throw new Error(at(57));return e}const X1=f.memo(f.forwardRef(function(t,n){const{render:r,className:o,style:s,value:i=null,label:a,disabled:l=!1,nativeButton:u=!1,...d}=t,p=f.useRef(null),A=hs({guess:!0,label:a,textRef:p}),{store:m,itemProps:h,setOpen:g,setValue:x,selectionRef:b,typingRef:v,valuesRef:y,multiple:C,selectedItemTextRef:I,disabled:w,readOnly:E}=Xt(),S=w||l,D=Ie(m,we.isActive,A.index),k=Ie(m,we.open),j=Ie(m,we.isSelected,i),N=Ie(m,we.isSelectedByFocus,A.index),T=Ie(m,we.isItemEqualToValue),F=A.index,R=f.useRef(null);le(()=>{const Q=y.current;return Q[F]=i,()=>{delete Q[F]}},[F,i,y]),le(()=>{const Q=m.state.value;let J=Q;C&&Array.isArray(Q)&&(J=Q.length>0?Q[Q.length-1]:void 0),J!==void 0&&or(i,J,T)&&(m.set("selectedIndex",F),p.current&&(I.current=p.current))},[F,C,T,m,i,I]);const O=f.useRef("mouse"),_=f.useRef(!1),{getButtonProps:M,buttonRef:H}=Vt({disabled:S,focusableWhenDisabled:!0,native:u,composite:!0}),G={disabled:S,selected:j,highlighted:D};function B(Q){if(w||E)return;const J=m.state.value;if(C){const K=Array.isArray(J)?J:[],ee=j?F1(K,i,T):[...K,i];x(ee,Ce(Cr,Q))}else x(i,Ce(Cr,Q)),g(!1,Ce(Cr,Q))}function P(){b.current.dragY=0}const W={role:"option","aria-selected":j,tabIndex:k&&D?0:-1,onKeyDown(Q){m.set("activeIndex",F),Q.key===" "&&v.current&&Q.preventDefault()},onClick(Q){const J=O.current!=="touch",K=Q.nativeEvent.pointerType,ee=J&&Ji(Q.nativeEvent)&&(K!==void 0||D),ce=J&&!ee&&!_.current;_.current=!1,!(S||ce)&&B(Q.nativeEvent)},onPointerEnter(Q){O.current=Q.pointerType},onPointerMove(Q){if(Q.pointerType==="mouse"&&Q.buttons===1){const J=b.current;J.dragY+=Q.movementY,J.dragY**2>=64&&(J.allowUnselectedMouseUp=!0)}},onPointerDown(Q){O.current=Q.pointerType,_.current=!0,P()},onMouseUp(){if(P(),S||O.current==="touch"||_.current)return;const Q=!b.current.allowSelectedMouseUp&&j,J=!b.current.allowUnselectedMouseUp&&!j;Q||J||(_.current=!0,R.current?.click(),_.current=!1)}},Y=Me("div",t,{ref:[H,n,A.ref,R],state:G,props:[h,W,d,M]}),Z=f.useMemo(()=>({selected:j,index:F,textRef:p,selectedByFocus:N}),[j,F,p,N]);return c.jsx(sp.Provider,{value:Z,children:Y})})),q1=f.forwardRef(function(t,n){const{selected:r}=qa();return t.keepMounted||r?c.jsx(eC,{...t,ref:n}):null}),eC=f.memo(f.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:a}=qa(),l=f.useRef(null),{transitionStatus:u,setMounted:d}=sr(a),A=Me("span",e,{ref:[t,l],state:{selected:a,transitionStatus:u},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:_n});return Zt({open:a,ref:l,onComplete(){a||d(!1)}}),A})),tC=f.memo(f.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:s}=qa(),{firstItemTextRef:i,selectedItemTextRef:a}=Xt(),{render:l,className:u,style:d,...p}=t,A=f.useCallback(h=>{h&&(r===0&&(i.current=h),s&&(a.current=h))},[i,a,r,s]);return Me("div",t,{ref:[A,n,o],props:p})})),ip=f.forwardRef(function(t,n){const{render:r,className:o,style:s,direction:i,keepMounted:a,...l}=t,u=i==="up",{store:d,popupRef:p,listRef:A,handleScrollArrowVisibility:m,scrollArrowsMountedCountRef:h}=Xt(),{side:g,scrollDownArrowRef:x,scrollUpArrowRef:b}=Xa(),v=u?we.scrollUpArrowVisible:we.scrollDownArrowVisible,y=Ie(d,v),C=Ie(d,we.openMethod),I=y&&C!=="touch",w=ht(),E=u?b:x,{mounted:S,transitionStatus:D,setMounted:k}=sr(I);le(()=>(h.current+=1,d.set("hasScrollArrows",!0),()=>{h.current=Math.max(0,h.current-1),h.current===0&&d.set("hasScrollArrows",!1)}),[d,h]),Zt({open:I,ref:E,onComplete(){I||k(!1)}});const T=Me("div",t,{ref:[n,E],state:{direction:i,visible:I,side:g,transitionStatus:D},props:[{"aria-hidden":!0,children:u?"▲":"▼",style:{position:"absolute"},onMouseMove(R){if(R.movementX===0&&R.movementY===0||w.isStarted())return;d.set("activeIndex",null);function O(){const _=d.state.listElement??p.current;if(!_)return;d.set("activeIndex",null),m(_);const M=$a(_.scrollHeight,_.clientHeight),H=Oo(_.scrollTop,M),G=H===(u?0:M),B=A.current;if(H!==_.scrollTop&&(_.scrollTop=H),G){w.clear();return}if(B.length>0){const P=E.current?.offsetHeight||0;_.scrollTop=nC(B,u,H,_.clientHeight,P,M)}w.start(40,O)}w.start(40,O)},onMouseLeave(){w.clear()}},l],stateAttributesMapping:_n});return S||a?T:null});function nC(e,t,n,r,o,s){if(t){let d=0;const p=n+o-Ot;for(let h=0;h<e.length;h+=1){const g=e[h];if(g&&g.offsetTop>=p){d=h;break}}const A=Math.max(0,d-1),m=e[A];return A<d&&m?Oo(m.offsetTop-o,s):0}let i=e.length-1;const a=n+r-o+Ot;for(let d=0;d<e.length;d+=1){const p=e[d];if(p&&p.offsetTop+p.offsetHeight>a){i=Math.max(0,d-1);break}}const l=Math.min(e.length-1,i+1),u=e[l];return l>i&&u?Oo(u.offsetTop+u.offsetHeight-r+o,s):s}const rC=f.forwardRef(function(t,n){return c.jsx(ip,{...t,ref:n,direction:"down"})}),oC=f.forwardRef(function(t,n){return c.jsx(ip,{...t,ref:n,direction:"up"})}),sC=N1;function iC({className:e,...t}){return c.jsx(K1,{"data-slot":"select-value",className:ge("flex flex-1 text-left",e),...t})}function aC({className:e,size:t="default",children:n,...r}){return c.jsxs(O1,{"data-slot":"select-trigger","data-size":t,className:ge("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,c.jsx(W1,{render:c.jsx(Pn,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function lC({className:e,children:t,side:n="bottom",sideOffset:r=4,align:o="center",alignOffset:s=0,alignItemWithTrigger:i=!0,...a}){return c.jsx(L1,{children:c.jsx(G1,{side:n,sideOffset:r,align:o,alignOffset:s,alignItemWithTrigger:i,className:"isolate z-50",children:c.jsxs(Z1,{"data-slot":"select-content","data-align-trigger":i,className:ge("cn-menu-target cn-menu-translucent relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...a,children:[c.jsx(cC,{}),c.jsx($1,{children:t}),c.jsx(uC,{})]})})})}function $s({className:e,children:t,...n}){return c.jsxs(X1,{"data-slot":"select-item",className:ge("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[c.jsx(tC,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),c.jsx(q1,{render:c.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:c.jsx(Gi,{className:"pointer-events-none"})})]})}function cC({className:e,...t}){return c.jsx(oC,{"data-slot":"select-scroll-up-button",className:ge("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:c.jsx(Yi,{})})}function uC({className:e,...t}){return c.jsx(rC,{"data-slot":"select-scroll-down-button",className:ge("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:c.jsx(Pn,{})})}const ap=f.createContext(void 0);function dC(){const e=f.useContext(ap);if(e===void 0)throw new Error(at(63));return e}const lp={...Hi,checked(e){return e?{"data-checked":""}:{"data-unchecked":""}}},fC=f.forwardRef(function(t,n){const{checked:r,className:o,defaultChecked:s,"aria-labelledby":i,form:a,id:l,inputRef:u,name:d,nativeButton:p=!1,onCheckedChange:A,readOnly:m=!1,required:h=!1,disabled:g=!1,render:x,uncheckedValue:b,value:v,style:y,...C}=t,{clearErrors:I}=Ki(),{state:w,setTouched:E,setDirty:S,validityData:D,setFilled:k,setFocused:j,validationMode:N,disabled:T,name:F,validation:R}=Yo(),{labelId:O}=Wi(),_=T||g,M=F??d,H=f.useRef(null),G=Ut(H,u,R.inputRef),B=f.useRef(null),P=wt(),W=Qi({id:l,implicit:!1,controlRef:B}),Y=p?void 0:W,[Z,Q]=ln({controlled:r,default:!!s,name:"Switch",state:"checked"});Li(B,P,Z,void 0,!_,d),le(()=>{H.current&&k(H.current.checked)},[k]),as(Z,()=>{I(M),S(Z!==D.initialValue),k(Z),R.change(Z)});const{getButtonProps:J,buttonRef:K}=Vt({disabled:_,native:p}),ee=Fu(i,O,H,!p,Y),ce={id:p?W:P,role:"switch","aria-checked":Z,"aria-readonly":m||void 0,"aria-required":h||void 0,"aria-labelledby":ee,onFocus(){_||j(!0)},onBlur(){const ne=H.current;!ne||_||(E(!0),j(!1),N==="onBlur"&&R.commit(ne.checked))},onClick(ne){if(m||_)return;ne.preventDefault();const de=H.current;de&&_i(de,ne)}},te={...R.getValidationProps(_),checked:Z,disabled:_,form:a,id:Y,name:M,required:h,style:M?la:qo,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:G,onChange(ne){if(ne.nativeEvent.defaultPrevented)return;if(m){ne.preventDefault();return}const de=ne.currentTarget.checked,fe=Ce(Pt,ne.nativeEvent);A?.(de,fe),!fe.isCanceled&&Q(de)},onClick(ne){ne.stopPropagation()},onFocus(){B.current?.focus()},...v!==void 0?{value:v}:dt},$=f.useMemo(()=>({...w,checked:Z,disabled:_,readOnly:m,required:h}),[w,Z,_,m,h]),X=Me("span",t,{state:$,ref:[n,B,K],props:[ce,C,J,ne=>R.getValidationProps(_,ne)],stateAttributesMapping:lp});return c.jsxs(ap.Provider,{value:$,children:[X,!Z&&M&&b!==void 0&&c.jsx("input",{type:"hidden",form:a,name:M,value:b,disabled:_}),c.jsx("input",{...te,suppressHydrationWarning:!0})]})}),pC=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=dC();return Me("span",t,{state:a,ref:n,stateAttributesMapping:lp,props:i})});function ur({className:e,size:t="default",...n}){return c.jsx(fC,{"data-slot":"switch","data-size":t,className:ge("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:c.jsx(pC,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}function hC({frozen:e,values:t,defaults:n,candidates:r,candidatesPort:o,candidatesGeneration:s,selectedIconRef:i,uploadedIconUrl:a,iconAnalysis:l,iconComposition:u,iconComposeError:d,iconBackground:p,iconScale:A,subjectExtracting:m,subjectStage:h,subjectSettings:g,onSubjectSettingsChange:x,onIconBackgroundChange:b,onIconScaleChange:v,selectedTrayRef:y,uploadedTrayUrl:C,selectedPort:I,targetDirExists:w,onPickIconCandidate:E,onUploadIcon:S,onClearIcon:D,onPickTray:k,onUploadTray:j,onClearTray:N,onPatch:T,onConfirm:F}){const{messages:R}=mt();return c.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[c.jsx(E1,{values:t,defaults:n,frozen:e,iconCandidates:r,iconCandidatesPort:o,iconCandidatesGeneration:s,uploadedIconUrl:a,selectedIconRef:i,iconAnalysis:l,iconComposition:u,iconComposeError:d,iconBackground:p,iconScale:A,subjectExtracting:m,...h===void 0?{}:{subjectStage:h},subjectSettings:g,onSubjectSettingsChange:x,onIconBackgroundChange:b,onIconScaleChange:v,onPickIconCandidate:E,onUploadIcon:S,onClearIcon:D,onPatch:T}),c.jsx(_a,{className:"mt-4 border-t border-border pt-1",children:c.jsxs(Oa,{value:"advanced",className:"border-b-0",children:[c.jsx(Ha,{children:R.advanced.title}),c.jsxs(Ka,{className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[c.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[c.jsx(ur,{id:"showStartupTerminal",checked:t.showStartupTerminal,disabled:e,onCheckedChange:O=>T({showStartupTerminal:O})}),c.jsxs("div",{children:[c.jsx(Ne,{htmlFor:"showStartupTerminal",className:"text-foreground",children:R.advanced.startupTerminal}),c.jsxs("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:[c.jsx(Sr,{className:"mr-0.5 inline size-3"}),R.advanced.startupTerminalHint]})]})]}),c.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[c.jsx(ur,{id:"showAddressBar",checked:t.showAddressBar,disabled:e,onCheckedChange:O=>T({showAddressBar:O})}),c.jsxs("div",{children:[c.jsx(Ne,{htmlFor:"showAddressBar",className:"text-foreground",children:R.advanced.addressBar}),c.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:R.advanced.addressBarHint})]})]}),c.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[c.jsx(ur,{id:"imageSmoothingEnabled",checked:t.imageSmoothingEnabled,disabled:e,onCheckedChange:O=>T({imageSmoothingEnabled:O})}),c.jsxs("div",{children:[c.jsx(Ne,{htmlFor:"imageSmoothingEnabled",className:"text-foreground",children:R.advanced.smoothing}),c.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:R.advanced.smoothingHint})]})]}),c.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[c.jsx(ur,{id:"developerMode",checked:t.developerMode,disabled:e,onCheckedChange:O=>T({developerMode:O})}),c.jsxs("div",{children:[c.jsx(Ne,{htmlFor:"developerMode",className:"text-foreground",children:R.advanced.developer}),c.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:R.advanced.developerHint})]})]})]}),c.jsxs("div",{children:[c.jsx(Ne,{children:R.advanced.tray}),c.jsx("p",{className:"mb-1.5 mt-0.5 text-[11px] text-muted-foreground",children:R.advanced.trayHint}),c.jsx(S1,{candidates:r,port:o,generation:s,disabled:e,selectedRef:y,uploadedUrl:C,includeVariants:!0,defaultLabel:R.icon.followApp,onPick:k,onUpload:j,onClear:N})]}),c.jsxs("div",{children:[c.jsx(Ne,{htmlFor:"pm",children:R.advanced.pm}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] leading-relaxed text-muted-foreground",children:R.advanced.pmHint}),c.jsxs(sC,{value:t.pm,disabled:e,onValueChange:O=>T({pm:O}),children:[c.jsx(aC,{id:"pm",className:"mt-0",children:c.jsx(iC,{})}),c.jsxs(lC,{children:[c.jsx($s,{value:"npm",children:"npm"}),c.jsx($s,{value:"pnpm",children:"pnpm"}),c.jsx($s,{value:"bun",children:"bun"})]})]})]}),c.jsxs("div",{className:"rounded-lg border border-border p-3",children:[c.jsx(Ne,{children:R.advanced.location}),c.jsx("p",{className:"mt-1 font-mono text-[11px] break-all text-muted-foreground",children:n.targetDir||R.advanced.locationDefault}),c.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-muted-foreground",children:R.advanced.locationHint}),w?c.jsx("p",{className:"mt-2 text-[11px] font-medium text-amber-400",children:R.advanced.dirExistsWarning}):null,c.jsxs("div",{className:"mt-3 flex items-start gap-3",children:[c.jsx(ur,{id:"force-overwrite",checked:t.force,disabled:e,onCheckedChange:O=>T({force:O})}),c.jsxs("div",{children:[c.jsx(Ne,{htmlFor:"force-overwrite",className:"text-foreground",children:R.advanced.force}),c.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:R.advanced.forceHint})]})]})]})]})]})}),c.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[c.jsx(He,{onClick:F,disabled:e,children:R.advanced.confirm}),c.jsx("span",{className:"text-xs text-muted-foreground",children:I!==void 0?Ye(R.advanced.serviceSelected,{port:I}):R.advanced.serviceNone})]})]})}var go={},Xs,ou;function AC(){if(ou)return Xs;ou=1;var e=["||","&&",";;","|&","<(","<<<",">>",">&","<&","&",";","(",")","|","<",">"],t=/[\n\r\u2028\u2029]/,n=/[\s#!"$&'():;<=>@\\^`|]/g;return Xs=function(o){return o.map(function(s){if(s==="")return"''";if(s&&typeof s=="object"){if("op"in s&&s.op==="glob"){if(typeof s.pattern!="string")throw new TypeError("glob token requires a string `pattern`");if(t.test(s.pattern))throw new TypeError("glob `pattern` must not contain line terminators");return s.pattern.replace(n,"\\$&")}if("op"in s&&typeof s.op=="string"){if(e.indexOf(s.op)<0)throw new TypeError("invalid `op` value: "+JSON.stringify(s.op));return s.op.replace(/[\s\S]/g,"\\$&")}if("comment"in s&&typeof s.comment=="string"){if(t.test(s.comment))throw new TypeError("`comment` must not contain line terminators");return"#"+s.comment}throw new TypeError("unrecognized object token shape")}return/["\s\\]/.test(s)&&!/'/.test(s)?"'"+s.replace(/(['])/g,"\\$1")+"'":/["'\s]/.test(s)?'"'+s.replace(/(["\\$`!])/g,"\\$1")+'"':String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,"$1\\$2")}).join(" ")},Xs}var qs,su;function gC(){if(su)return qs;su=1;for(var e="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",t=new RegExp("^"+e+"$"),n="|&;()<> \\t",r="'([^']*?)'",o='"((\\\\"|[^"])*?)"',s=/^#$/,i="'",a='"',l="$",u="",d=4294967296,p=0;p<4;p++)u+=(d*Math.random()).toString(16);var A=new RegExp("^"+u);function m(x,b){for(var v=b.lastIndex,y=[],C;C=b.exec(x);)y[y.length]=C,b.lastIndex===C.index&&(b.lastIndex+=1);return b.lastIndex=v,y}function h(x,b,v){var y=typeof x=="function"?x(v):x[v];return typeof y>"u"&&v!=""?y="":typeof y>"u"&&(y="$"),typeof y=="object"?b+u+JSON.stringify(y)+u:b+y}function g(x,b,v){v||(v={});var y=v.escape||"\\",C=v.splitUnquoted===!0?`
21
+ `:typeof v.splitUnquoted=="string"?v.splitUnquoted:"",I="(\\"+y+`['"`+n+`]|[^\\s'"`+n+"])+",w=new RegExp(["("+e+")","("+I+"|"+o+"|"+r+")+"].join("|"),"g"),E=m(x,w);if(E.length===0)return[];b||(b={});var S=!1;return E.map(function(D){var k=D[0];if(!k||S)return;if(t.test(k))return{op:k};var j=!1,N=!1,T="",F=[],R=!1,O=null,_=!1,M;function H(){M+=1;var J,K,ee=k.charAt(M);if(ee==="{"){if(M+=1,k.charAt(M)==="}")throw new Error("Bad substitution: "+k.slice(M-2,M+1));var ce=1;for(J=M;ce>0&&J<k.length;)k.charAt(J)==="{"&&k.charAt(J-1)==="$"?ce+=1:k.charAt(J)==="}"&&(ce-=1),J+=1;if(ce!==0)throw new Error("Bad substitution: "+k.slice(M));J-=1,K=k.slice(M,J),M=J}else if(/[*@#?$!_-]/.test(ee))K=ee,M+=1;else{var te=k.slice(M);J=te.match(/[^\w\d_]/),J?(K=te.slice(0,J.index),M+=J.index-1):(K=te,M=k.length)}return h(b,"",K)}function G(){if(O!==null){if(O===0)T!==""&&(F[F.length]=T,T="");else{F[F.length]=T,T="";for(var J=1;J<O;J+=1)F[F.length]=""}O=null}}for(M=0;M<k.length;M++){var B=k.charAt(M);if(C&&B!==l&&G(),_=_||!j&&(B==="*"||B==="?"),N)T+=B,N=!1;else if(j)B===j?j=!1:j==i?T+=B:B===y?(M+=1,B=k.charAt(M),B===a||B===y||B===l?T+=B:T+=y+B):B===l?T+=H():T+=B;else if(B===a||B===i)j=B,R=!0;else{if(t.test(B))return{op:k};if(s.test(B)){S=!0;var P={comment:x.slice(D.index+M+1)};return T.length?[T,P]:[P]}else if(B===y)N=!0;else if(B===l){var W=H();if(!C)T+=W;else for(var Y=0;Y<W.length;Y+=1){var Z=W.charAt(Y);C.indexOf(Z)<0?(G(),T+=Z):O===null?O=Z===" "||Z===" "||Z===`
22
+ `?0:1:Z!==" "&&Z!==" "&&Z!==`
23
+ `&&(O+=1)}}else T+=B}}if(_)return{op:"glob",pattern:T};if(C){if(O!==null&&O>0){F[F.length]=T,T="";for(var Q=1;Q<O;Q+=1)F[F.length]=""}return(T!==""||R&&F.length===0)&&(F[F.length]=T),F}return T}).reduce(function(D,k){return typeof k>"u"||[].concat(k).forEach(function(j){D[D.length]=j}),D},[])}return qs=function(b,v,y){var C=g(b,v,y);return typeof v!="function"?C:C.reduce(function(I,w){if(typeof w=="object")return I[I.length]=w,I;var E=w.split(RegExp("("+u+".*?"+u+")","g"));return E.length===1?(I[I.length]=E[0],I):(E.filter(Boolean).forEach(function(S){I[I.length]=A.test(S)?JSON.parse(S.split(u)[1]):S}),I)},[])},qs}var iu;function mC(){return iu||(iu=1,go.quote=AC(),go.parse=gC()),go}var xC=mC();const cp=["npm","go","rust","python","dotnet","custom"],bC={npm:"npm",go:"Go",rust:"Rust",python:"Python",dotnet:".NET",custom:"自定义"},vC={npm:"npmjs",go:"golang",rust:"rust",python:"python",dotnet:"dotnet"},up=["npx","pnpx","bunx","yarn dlx","nubx","deno run","vpx"],yC=["uvx","pipx run"],dp={family:"npm",runner:"npx",runnerFlags:"",pkg:"",version:"",args:"",binary:"",raw:""},el=e=>{if(/["']/.test(e)){const r=(e.match(/'/gu)??[]).length,o=(e.match(/"/gu)??[]).length;if(r%2===1||o%2===1)return[]}const t=xC.parse(e),n=[];for(const r of t){if(typeof r!="string")return[];n.push(r)}return n.length===0?[]:n},tl=e=>e.startsWith("-")&&e.length>1,Dn=e=>{const t=e.lastIndexOf("@");return t>0?{base:e.slice(0,t),version:e.slice(t+1)}:{base:e,version:""}},Gn=e=>e.map(t=>t.trim()).filter(t=>t.length>0).join(" "),dr=(e,t)=>{if(t.trim().length===0)return e;const{version:n}=Dn(e);return n.length>0?e:`${e}@${t.trim()}`},CC=e=>/^(npm|jsr):/.test(e)?e:`npm:${e}`,IC=/^[A-Za-z0-9@._/:+=-]+$/u,wC=e=>IC.test(e)&&e.length>0?e:`'${e.replaceAll("'","'\\''")}'`,Sn=e=>e.map(wC).join(" "),fr=e=>{const t=[];let n=0;for(;n<e.length&&tl(e[n]??"");)t.push(e[n]??""),n+=1;return{flags:t,rest:e.slice(n)}},kC=[new Set(["-A","--allow-all","--allow-read","--allow-write","--allow-net","--allow-env","--allow-run","--allow-sys","--allow-ffi","--allow-hrtime","--no-check","--no-remote","--quiet","-q","--cached-only"]),new Set(["-y","--yes"])],EC=e=>e.includes("=")?!1:kC.some(t=>t.has(e)),pr=e=>e.every(t=>EC(t)),SC=(e,t)=>{const n=t.split(" ");if(e.length<n.length)return-1;for(let r=0;r<n.length;r+=1)if((e[r]??"")!==(n[r]??""))return-1;return n.length},hn=e=>({...dp,...e}),hr=e=>hn({family:"custom",raw:Sn(e)}),RC=e=>{const t=e[0]??"",n=e[1]??"";for(const r of up){const o=SC(e,r);if(o>0){const{flags:s,rest:i}=fr(e.slice(o));if(!pr(s))return hr(e);const a=i[0]??"",{base:l,version:u}=a.length>0?Dn(a):{base:"",version:""};return hn({family:"npm",runner:r,runnerFlags:s.join(" "),pkg:l,version:u,args:Sn(i.slice(1)),raw:e.join(" ")})}}if(t==="go"&&n==="run"){const{flags:r,rest:o}=fr(e.slice(2));if(!pr(r))return hr(e);const s=o[0]??"",{base:i,version:a}=s.length>0?Dn(s):{base:"",version:""};return hn({family:"go",runner:"",runnerFlags:r.join(" "),pkg:i,version:a,args:Sn(o.slice(1)),raw:e.join(" ")})}if(t==="cargo"&&n==="install"){const{flags:r,rest:o}=fr(e.slice(2));if(!pr(r))return hr(e);const s=o[0]??"",i=s.length>0?Dn(s).base:"";return hn({family:"rust",runner:"",runnerFlags:r.join(" "),pkg:i,args:Sn(o.slice(1)),raw:e.join(" ")})}if(t==="uvx"||t==="pipx"&&n==="run"){const r=t==="uvx"?1:2,{flags:o,rest:s}=fr(e.slice(r));if(!pr(o))return hr(e);const i=s[0]??"",{base:a,version:l}=i.length>0?Dn(i):{base:"",version:""};return hn({family:"python",runner:t==="uvx"?"uvx":"pipx run",runnerFlags:o.join(" "),pkg:a,version:l,args:Sn(s.slice(1)),raw:e.join(" ")})}if(t==="dnx"){const{flags:r,rest:o}=fr(e.slice(1));if(!pr(r))return hr(e);const s=o[0]??"",{base:i,version:a}=s.length>0?Dn(s):{base:"",version:""};return hn({family:"dotnet",runner:"",runnerFlags:r.join(" "),pkg:i,version:a,args:Sn(o.slice(1)),raw:e.join(" ")})}return hn({family:"custom",raw:Sn(e)})},DC=e=>{const t=el(e);return t.length===0?hn({family:"custom",raw:e}):RC(t)},fp=e=>{const t=e.pkg.trim(),n=e.binary.trim().length>0?e.binary.trim():t;return{install:Gn(["cargo","install",e.runnerFlags,t]),run:Gn([n,e.args])}},Fi=e=>{switch(e.family){case"custom":return e.raw.trim();case"rust":return fp(e).run;case"npm":{const t=e.runner==="deno run"?CC(dr(e.pkg.trim(),e.version)):dr(e.pkg.trim(),e.version);return Gn([e.runner,e.runnerFlags,t,e.args])}case"go":return Gn(["go","run",e.runnerFlags,dr(e.pkg.trim(),e.version),e.args]);case"python":return Gn([e.runner,e.runnerFlags,dr(e.pkg.trim(),e.version),e.args]);case"dotnet":return Gn(["dnx",e.runnerFlags,dr(e.pkg.trim(),e.version),e.args])}},Ar=(e,t)=>{const n=e.trim().replace(/^(npm|jsr):/,""),r=n.split(/[/\\]/).filter(i=>i.length>0&&!i.startsWith("@")),o=r[r.length-1]??n;let s=Dn(o).base.toLowerCase();return t==="python"&&(s=s.replace(/[._]/g,"-")),s.replace(/[^a-z0-9-]/g,"")},gr=e=>{const t=[];for(const n of el(e)){if(tl(n))break;const r=n.toLowerCase().replace(/[^a-z0-9-]/g,"");if(r.length===0)break;t.push(r)}return t},FC=e=>{if(e.family==="custom"){const i=[];for(const u of el(e.raw)){if(tl(u))break;i.push(u)}const a=i.map(u=>{const d=u.split(/[/\\]/).filter(p=>p.length>0);if(d.some(p=>p.startsWith("@"))){const p=d.filter(A=>!A.startsWith("@"));return(p[p.length-1]??"").split("@")[0]??""}return(d[d.length-1]??u).split("@")[0]??""}).filter(u=>u.length>0).reverse(),l=a.length>0?a.join("."):"app.opentray";return{appId:l,appName:l==="app.opentray"?"Opentray App":l.split(".").filter(u=>u.length>0).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join(" "),identitySegments:a,tail:""}}const t=vC[e.family];let n;switch(e.family){case"npm":n=[...gr(e.args),Ar(e.pkg,"npm")];break;case"go":n=[...gr(e.args),Ar(e.pkg,"go")];break;case"rust":{const i=Ar(e.pkg,"rust"),a=e.binary.trim().length>0?e.binary.trim().toLowerCase().replace(/[^a-z0-9-]/g,""):i;n=[...gr(e.args),a];break}case"python":n=[...gr(e.args),Ar(e.pkg,"python")];break;case"dotnet":n=[...gr(e.args),Ar(e.pkg,"dotnet")];break}const r=n.filter(i=>i.length>0),o=r.length>0?`${r.join(".")}.${t}`:"app.opentray",s=r.length>0?r.map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" "):"Opentray App";return{appId:o,appName:s,identitySegments:r,tail:t}},BC=e=>{const t=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"opentray-app"},jC=(e,t)=>{let n;for(const r of e)r.key.trim()===t&&(n=r.value);return n},MC=e=>e.family==="npm"&&(e.runner==="npx"||e.runner==="pnpx")?[{key:"npm_config_yes",value:"true",note:"跳过 npm 安装确认(等效 -y),首次运行无需交互"}]:[],An=(e,t)=>e==="custom"?t.family.custom:bC[e],NC='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>.NET</title><path d="M24 8.77h-2.468v7.565h-1.425V8.77h-2.462V7.53H24zm-6.852 7.565h-4.821V7.53h4.63v1.24h-3.205v2.494h2.953v1.234h-2.953v2.604h3.396zm-6.708 0H8.882L4.78 9.863a2.896 2.896 0 0 1-.258-.51h-.036c.032.189.048.592.048 1.21v5.772H3.157V7.53h1.659l3.965 6.32c.167.261.275.442.323.54h.024c-.04-.233-.06-.629-.06-1.185V7.529h1.372zm-8.703-.693a.868.829 0 0 1-.869.829.868.829 0 0 1-.868-.83.868.829 0 0 1 .868-.828.868.829 0 0 1 .869.829Z"/></svg>',TC='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Go</title><path d="M1.811 10.231c-.047 0-.058-.023-.035-.059l.246-.315c.023-.035.081-.058.128-.058h4.172c.046 0 .058.035.035.07l-.199.303c-.023.036-.082.07-.117.07zM.047 11.306c-.047 0-.059-.023-.035-.058l.245-.316c.023-.035.082-.058.129-.058h5.328c.047 0 .07.035.058.07l-.093.28c-.012.047-.058.07-.105.07zm2.828 1.075c-.047 0-.059-.035-.035-.07l.163-.292c.023-.035.07-.07.117-.07h2.337c.047 0 .07.035.07.082l-.023.28c0 .047-.047.082-.082.082zm12.129-2.36c-.736.187-1.239.327-1.963.514-.176.046-.187.058-.34-.117-.174-.199-.303-.327-.548-.444-.737-.362-1.45-.257-2.115.175-.795.514-1.204 1.274-1.192 2.22.011.935.654 1.706 1.577 1.835.795.105 1.46-.175 1.987-.77.105-.13.198-.27.315-.434H10.47c-.245 0-.304-.152-.222-.35.152-.362.432-.97.596-1.274a.315.315 0 01.292-.187h4.253c-.023.316-.023.631-.07.947a4.983 4.983 0 01-.958 2.29c-.841 1.11-1.94 1.8-3.33 1.986-1.145.152-2.209-.07-3.143-.77-.865-.655-1.356-1.52-1.484-2.595-.152-1.274.222-2.419.993-3.424.83-1.086 1.928-1.776 3.272-2.02 1.098-.2 2.15-.07 3.096.571.62.41 1.063.97 1.356 1.648.07.105.023.164-.117.2m3.868 6.461c-1.064-.024-2.034-.328-2.852-1.029a3.665 3.665 0 01-1.262-2.255c-.21-1.32.152-2.489.947-3.529.853-1.122 1.881-1.706 3.272-1.95 1.192-.21 2.314-.095 3.33.595.923.63 1.496 1.484 1.648 2.605.198 1.578-.257 2.863-1.344 3.962-.771.783-1.718 1.273-2.805 1.495-.315.06-.63.07-.934.106zm2.78-4.72c-.011-.153-.011-.27-.034-.387-.21-1.157-1.274-1.81-2.384-1.554-1.087.245-1.788.935-2.045 2.033-.21.912.234 1.835 1.075 2.21.643.28 1.285.244 1.905-.07.923-.48 1.425-1.228 1.484-2.233z"/></svg>',PC='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>npm</title><path d="M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z"/></svg>',_C='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Python</title><path d="M14.25.18l.9.2.73.26.59.3.45.32.34.34.25.34.16.33.1.3.04.26.02.2-.01.13V8.5l-.05.63-.13.55-.21.46-.26.38-.3.31-.33.25-.35.19-.35.14-.33.1-.3.07-.26.04-.21.02H8.77l-.69.05-.59.14-.5.22-.41.27-.33.32-.27.35-.2.36-.15.37-.1.35-.07.32-.04.27-.02.21v3.06H3.17l-.21-.03-.28-.07-.32-.12-.35-.18-.36-.26-.36-.36-.35-.46-.32-.59-.28-.73-.21-.88-.14-1.05-.05-1.23.06-1.22.16-1.04.24-.87.32-.71.36-.57.4-.44.42-.33.42-.24.4-.16.36-.1.32-.05.24-.01h.16l.06.01h8.16v-.83H6.18l-.01-2.75-.02-.37.05-.34.11-.31.17-.28.25-.26.31-.23.38-.2.44-.18.51-.15.58-.12.64-.1.71-.06.77-.04.84-.02 1.27.05zm-6.3 1.98l-.23.33-.08.41.08.41.23.34.33.22.41.09.41-.09.33-.22.23-.34.08-.41-.08-.41-.23-.33-.33-.22-.41-.09-.41.09zm13.09 3.95l.28.06.32.12.35.18.36.27.36.35.35.47.32.59.28.73.21.88.14 1.04.05 1.23-.06 1.23-.16 1.04-.24.86-.32.71-.36.57-.4.45-.42.33-.42.24-.4.16-.36.09-.32.05-.24.02-.16-.01h-8.22v.82h5.84l.01 2.76.02.36-.05.34-.11.31-.17.29-.25.25-.31.24-.38.2-.44.17-.51.15-.58.13-.64.09-.71.07-.77.04-.84.01-1.27-.04-1.07-.14-.9-.2-.73-.25-.59-.3-.45-.33-.34-.34-.25-.34-.16-.33-.1-.3-.04-.25-.02-.2.01-.13v-5.34l.05-.64.13-.54.21-.46.26-.38.3-.32.33-.24.35-.2.35-.14.33-.1.3-.06.26-.04.21-.02.13-.01h5.84l.69-.05.59-.14.5-.21.41-.28.33-.32.27-.35.2-.36.15-.36.1-.35.07-.32.04-.28.02-.21V6.07h2.09l.14.01zm-6.47 14.25l-.23.33-.08.41.08.41.23.33.33.23.41.08.41-.08.33-.23.23-.33.08-.41-.08-.41-.23-.33-.33-.23-.41-.08-.41.08z"/></svg>',OC='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Rust</title><path d="M23.8346 11.7033l-1.0073-.6236a13.7268 13.7268 0 00-.0283-.2936l.8656-.8069a.3483.3483 0 00-.1154-.578l-1.1066-.414a8.4958 8.4958 0 00-.087-.2856l.6904-.9587a.3462.3462 0 00-.2257-.5446l-1.1663-.1894a9.3574 9.3574 0 00-.1407-.2622l.49-1.0761a.3437.3437 0 00-.0274-.3361.3486.3486 0 00-.3006-.154l-1.1845.0416a6.7444 6.7444 0 00-.1873-.2268l.2723-1.153a.3472.3472 0 00-.417-.4172l-1.1532.2724a14.0183 14.0183 0 00-.2278-.1873l.0415-1.1845a.3442.3442 0 00-.49-.328l-1.076.491c-.0872-.0476-.1742-.0952-.2623-.1407l-.1903-1.1673A.3483.3483 0 0016.256.955l-.9597.6905a8.4867 8.4867 0 00-.2855-.086l-.414-1.1066a.3483.3483 0 00-.5781-.1154l-.8069.8666a9.2936 9.2936 0 00-.2936-.0284L12.2946.1683a.3462.3462 0 00-.5892 0l-.6236 1.0073a13.7383 13.7383 0 00-.2936.0284L9.9803.3374a.3462.3462 0 00-.578.1154l-.4141 1.1065c-.0962.0274-.1903.0567-.2855.086L7.744.955a.3483.3483 0 00-.5447.2258L7.009 2.348a9.3574 9.3574 0 00-.2622.1407l-1.0762-.491a.3462.3462 0 00-.49.328l.0416 1.1845a7.9826 7.9826 0 00-.2278.1873L3.8413 3.425a.3472.3472 0 00-.4171.4171l.2713 1.1531c-.0628.075-.1255.1509-.1863.2268l-1.1845-.0415a.3462.3462 0 00-.328.49l.491 1.0761a9.167 9.167 0 00-.1407.2622l-1.1662.1894a.3483.3483 0 00-.2258.5446l.6904.9587a13.303 13.303 0 00-.087.2855l-1.1065.414a.3483.3483 0 00-.1155.5781l.8656.807a9.2936 9.2936 0 00-.0283.2935l-1.0073.6236a.3442.3442 0 000 .5892l1.0073.6236c.008.0982.0182.1964.0283.2936l-.8656.8079a.3462.3462 0 00.1155.578l1.1065.4141c.0273.0962.0567.1914.087.2855l-.6904.9587a.3452.3452 0 00.2268.5447l1.1662.1893c.0456.088.0922.1751.1408.2622l-.491 1.0762a.3462.3462 0 00.328.49l1.1834-.0415c.0618.0769.1235.1528.1873.2277l-.2713 1.1541a.3462.3462 0 00.4171.4161l1.153-.2713c.075.0638.151.1255.2279.1863l-.0415 1.1845a.3442.3442 0 00.49.327l1.0761-.49c.087.0486.1741.0951.2622.1407l.1903 1.1662a.3483.3483 0 00.5447.2268l.9587-.6904a9.299 9.299 0 00.2855.087l.414 1.1066a.3452.3452 0 00.5781.1154l.8079-.8656c.0972.0111.1954.0203.2936.0294l.6236 1.0073a.3472.3472 0 00.5892 0l.6236-1.0073c.0982-.0091.1964-.0183.2936-.0294l.8069.8656a.3483.3483 0 00.578-.1154l.4141-1.1066a8.4626 8.4626 0 00.2855-.087l.9587.6904a.3452.3452 0 00.5447-.2268l.1903-1.1662c.088-.0456.1751-.0931.2622-.1407l1.0762.49a.3472.3472 0 00.49-.327l-.0415-1.1845a6.7267 6.7267 0 00.2267-.1863l1.1531.2713a.3472.3472 0 00.4171-.416l-.2713-1.1542c.0628-.0749.1255-.1508.1863-.2278l1.1845.0415a.3442.3442 0 00.328-.49l-.49-1.076c.0475-.0872.0951-.1742.1407-.2623l1.1662-.1893a.3483.3483 0 00.2258-.5447l-.6904-.9587.087-.2855 1.1066-.414a.3462.3462 0 00.1154-.5781l-.8656-.8079c.0101-.0972.0202-.1954.0283-.2936l1.0073-.6236a.3442.3442 0 000-.5892zm-6.7413 8.3551a.7138.7138 0 01.2986-1.396.714.714 0 11-.2997 1.396zm-.3422-2.3142a.649.649 0 00-.7715.5l-.3573 1.6685c-1.1035.501-2.3285.7795-3.6193.7795a8.7368 8.7368 0 01-3.6951-.814l-.3574-1.6684a.648.648 0 00-.7714-.499l-1.473.3158a8.7216 8.7216 0 01-.7613-.898h7.1676c.081 0 .1356-.0141.1356-.088v-2.536c0-.074-.0536-.0881-.1356-.0881h-2.0966v-1.6077h2.2677c.2065 0 1.1065.0587 1.394 1.2088.0901.3533.2875 1.5044.4232 1.8729.1346.413.6833 1.2381 1.2685 1.2381h3.5716a.7492.7492 0 00.1296-.0131 8.7874 8.7874 0 01-.8119.9526zM6.8369 20.024a.714.714 0 11-.2997-1.396.714.714 0 01.2997 1.396zM4.1177 8.9972a.7137.7137 0 11-1.304.5791.7137.7137 0 011.304-.579zm-.8352 1.9813l1.5347-.6824a.65.65 0 00.33-.8585l-.3158-.7147h1.2432v5.6025H3.5669a8.7753 8.7753 0 01-.2834-3.348zm6.7343-.5437V8.7836h2.9601c.153 0 1.0792.1772 1.0792.8697 0 .575-.7107.7815-1.2948.7815zm10.7574 1.4862c0 .2187-.008.4363-.0243.651h-.9c-.09 0-.1265.0586-.1265.1477v.413c0 .973-.5487 1.1846-1.0296 1.2382-.4576.0517-.9648-.1913-1.0275-.4717-.2704-1.5186-.7198-1.8436-1.4305-2.4034.8817-.5599 1.799-1.386 1.799-2.4915 0-1.1936-.819-1.9458-1.3769-2.3153-.7825-.5163-1.6491-.6195-1.883-.6195H5.4682a8.7651 8.7651 0 014.907-2.7699l1.0974 1.151a.648.648 0 00.9182.0213l1.227-1.1743a8.7753 8.7753 0 016.0044 4.2762l-.8403 1.8982a.652.652 0 00.33.8585l1.6178.7188c.0283.2875.0425.577.0425.8717zm-9.3006-9.5993a.7128.7128 0 11.984 1.0316.7137.7137 0 01-.984-1.0316zm8.3389 6.71a.7107.7107 0 01.9395-.3625.7137.7137 0 11-.9405.3635z"/></svg>',mr=e=>{const t=e.replace(/<title>[\s\S]*?<\/title>/g,"");return({className:r})=>c.jsx("span",{"aria-hidden":"true",className:ge("inline-flex size-4 shrink-0 [&_svg]:size-full [&_svg]:fill-current",r),dangerouslySetInnerHTML:{__html:t}})},Ko={npm:mr(PC),go:mr(TC),rust:mr(OC),python:mr(_C),dotnet:mr(NC),custom:Su},HC=cp.filter(e=>e!=="custom"),au=(e,t,n)=>c.jsx(Wa,{variant:"outline",size:"sm",className:"flex max-w-full flex-wrap",value:[t],onValueChange:r=>{const o=r[0];o!==void 0&&e.includes(o)&&n(o)},children:e.map(r=>c.jsx(Br,{value:r,className:"px-2.5 text-xs",children:r},r))});function KC({open:e,draft:t,envPreset:n,onEnvPresetChange:r,onDraftChange:o,onFamilyChange:s,onCancel:i,onApply:a}){const{messages:l}=mt(),u=g=>{g||i()},d=g=>o({...t,...g}),p=FC(t),A=Fi(t),m=t.family==="rust"?fp(t):null,h=Ko[t.family];return c.jsx(La,{open:e,onOpenChange:u,children:c.jsxs(Qa,{className:"max-h-[85vh] overflow-y-auto sm:max-w-md",children:[c.jsxs(Ln,{children:[c.jsxs(Qn,{className:"flex items-center gap-2",children:[c.jsxs(jo,{children:[c.jsxs(Mo,{className:"flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring","aria-label":l.family.switchAria,title:l.family.switchAria,children:[c.jsx(h,{className:"size-4"}),c.jsx(Pn,{className:"size-3"})]}),c.jsx(No,{align:"start",className:"w-36",children:HC.map(g=>{const x=Ko[g];return c.jsxs(To,{onClick:()=>s(g),className:g===t.family?"bg-accent/60":void 0,children:[c.jsx(x,{className:"text-muted-foreground"}),An(g,l)]},g)})})]}),Ye(l.family.dialogTitle,{name:An(t.family,l)})]}),c.jsx(Ga,{children:l.family.dialogDescription})]}),c.jsxs("div",{className:"space-y-4",children:[t.family==="npm"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.runner}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:l.family.runnerHint}),au(up,t.runner,g=>d({runner:g}))]}),t.runnerFlags.length>0||t.runner==="deno run"?c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.runnerFlags}),c.jsx(et,{className:"mt-1.5 font-mono text-xs",placeholder:"-A",value:t.runnerFlags,onChange:g=>d({runnerFlags:g.target.value})})]}):null,c.jsxs("div",{className:"grid grid-cols-[1fr_110px] gap-3",children:[c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.pkg}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:l.family.pkgHint}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"@deepseek-ai/dsh",value:t.pkg,onChange:g=>d({pkg:g.target.value})})]}),c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.version}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:l.family.versionLatest}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"latest",value:t.version,onChange:g=>d({version:g.target.value})})]})]}),c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.args}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:l.family.argsHint}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"web --port 3000",value:t.args,onChange:g=>d({args:g.target.value})})]})]}):null,t.family==="go"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-[1fr_110px] gap-3",children:[c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.modulePath}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:l.family.modulePathHint}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"rsc.io/fortune",value:t.pkg,onChange:g=>d({pkg:g.target.value})})]}),c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.version}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:l.family.versionLocal}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"latest",value:t.version,onChange:g=>d({version:g.target.value})})]})]}),c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.args}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"serve --port 8080",value:t.args,onChange:g=>d({args:g.target.value})})]})]}):null,t.family==="rust"&&m!==null?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.crate}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:l.family.crateHint}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"ripgrep",value:t.pkg,onChange:g=>d({pkg:g.target.value})})]}),c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.binary}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:l.family.binaryHint}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:t.pkg.trim().length>0?t.pkg.trim():l.family.binaryPlaceholder,value:t.binary,onChange:g=>d({binary:g.target.value})})]})]}),c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.args}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"--json .",value:t.args,onChange:g=>d({args:g.target.value})})]}),c.jsxs("div",{className:"space-y-1 rounded-lg bg-muted/60 p-2.5 font-mono text-xs",children:[c.jsxs("p",{className:"text-muted-foreground",children:[c.jsx("span",{className:"mr-1.5 select-none",children:"$"}),m.install]}),c.jsxs("p",{children:[c.jsx("span",{className:"mr-1.5 select-none text-muted-foreground",children:"$"}),m.run]})]})]}):null,t.family==="python"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.runner}),au(yC,t.runner,g=>d({runner:g}))]}),c.jsxs("div",{className:"grid grid-cols-[1fr_110px] gap-3",children:[c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.pkg}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:l.family.pkgPythonHint}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"ruff",value:t.pkg,onChange:g=>d({pkg:g.target.value})})]}),c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.version}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"latest",value:t.version,onChange:g=>d({version:g.target.value})})]})]}),c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.args}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"format --check .",value:t.args,onChange:g=>d({args:g.target.value})})]})]}):null,t.family==="dotnet"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"grid grid-cols-[1fr_110px] gap-3",children:[c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.toolId}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:l.family.toolIdHint}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"dotnet-format",value:t.pkg,onChange:g=>d({pkg:g.target.value})})]}),c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.version}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"latest",value:t.version,onChange:g=>d({version:g.target.value})})]})]}),c.jsxs("div",{children:[c.jsx(Ne,{children:l.family.args}),c.jsx(et,{className:"mt-0 font-mono text-xs",placeholder:"--verify-no-changes",value:t.args,onChange:g=>d({args:g.target.value})})]})]}):null]},t.family),c.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/60 px-3 py-2",children:c.jsx("code",{className:"min-w-0 flex-1 font-mono text-xs break-all",children:A.length>0?A:c.jsx("span",{className:"text-muted-foreground",children:l.family.commandPreviewEmpty})})}),n!==null?c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[c.jsx("span",{className:"text-[11px] text-muted-foreground",children:l.family.envPresetTitle}),n.state==="off"?c.jsx("button",{type:"button",className:"rounded-md px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground underline-offset-2 transition-colors hover:bg-accent hover:text-foreground hover:underline",title:n.defaultNote,onClick:()=>r("enable"),children:Ye(l.family.presetEnable,{key:n.key})}):c.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-md border border-border bg-secondary/60 py-0.5 pr-1 pl-1.5 font-mono text-[11px]",title:l.family.envPresetSourceDialog,children:[n.key,"=",n.explicitValue??"",c.jsx("span",{className:"font-sans text-[10px] text-muted-foreground",children:l.family.presetConfigured}),c.jsx("button",{type:"button","aria-label":l.family.presetRemove,title:n.defaultNote,className:"rounded px-1 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>r("disable"),children:"×"})]})]}):c.jsx("p",{className:"text-[11px] text-muted-foreground",children:l.family.presetNone}),c.jsxs("div",{className:"space-y-1 rounded-lg border border-border bg-muted/40 p-3",children:[c.jsx("p",{className:"text-[11px] text-muted-foreground",children:l.family.appIdPreview}),c.jsx("code",{className:"font-mono text-sm font-medium break-all",children:p.appId}),c.jsx("p",{className:"text-[11px] text-muted-foreground",children:Ye(l.family.namePreview,{name:p.appName,dir:BC(p.appId)})})]}),c.jsxs(lb,{children:[c.jsx(ib,{render:c.jsx(He,{variant:"outline"}),children:l.common.cancel}),c.jsxs(He,{onClick:()=>{a(t)},children:[c.jsx(Gi,{}),l.family.apply]})]})]})})}const lu=e=>({...dp,family:e,runner:e==="python"?"uvx":e==="npm"?"npx":""}),cu=e=>e!=="custom",ei=(e,t)=>e.family===t.family&&e.runner===t.runner&&e.runnerFlags===t.runnerFlags&&e.pkg===t.pkg&&e.version===t.version&&e.args===t.args&&e.binary===t.binary&&e.raw===t.raw;function WC({command:e,onCommandChange:t,commandOptions:n,onCommandOptionsChange:r,disabled:o,onRun:s}){const{messages:i}=mt(),a=f.useMemo(()=>DC(e),[e]),l=n.family,u=f.useRef({}),[d,p]=f.useState(null),[A,m]=f.useState(l?.family??null);f.useEffect(()=>{if(l!==null){if(u.current[l.family]=l,d===null){m(B=>B===l.family?B:l.family);return}!cu(l.family)||d.currentFamily!==l.family||p(B=>{if(B===null||B.currentFamily!==l.family)return B;const P=B.drafts[l.family],W=B.bases[l.family];return P===void 0||W===void 0||!ei(P,W)?B:{...B,drafts:{...B.drafts,[l.family]:l},bases:{...B.bases,[l.family]:l}}})}},[l,d===null]);const h=A??a.family,g=B=>{if(l!==null&&l.family===B)return l;const P=u.current[B];return P!==void 0?P:a.family===B?a:lu(B)},[x,b]=f.useState(!1),[v,y]=f.useState(!1),[C,I]=f.useState(!1),w=d===null?void 0:d.drafts[d.currentFamily],E=w??n.family??a,S=MC(E)[0],D=S===void 0?void 0:jC(n.env,S.key),k=S===void 0?null:{key:S.key,defaultNote:S.note,state:D!==void 0?"explicit":"off",...D!==void 0?{explicitValue:D}:{}},j=D!==void 0,N=B=>{const P=S?.key??"npm_config_yes",W=B==="enable"?[...n.env.filter(Y=>Y.key.trim()!==P),{key:P,value:"true"}]:n.env.filter(Y=>Y.key.trim()!==P);r({...n,env:W})},T=B=>{if(B===h)return;m(B);const P={...n,...n.argsMode==="array"?{argsMode:"string"}:{}},W=g(B);u.current[B]===void 0&&(u.current[B]=W),r({...P,family:B==="custom"?null:W}),t(Fi(W))},F=()=>{if(!cu(h))return;const B=g(h);p({snapshot:{family:h,state:B},currentFamily:h,drafts:{[h]:B},bases:{[h]:B}})},R=B=>{p(P=>P===null||P.currentFamily!==B.family?P:{...P,drafts:{...P.drafts,[B.family]:B}})},O=B=>{p(P=>{if(P===null||P.currentFamily===B)return P;const W=P.drafts[B],Y=P.bases[B],Z=g(B),Q=W!==void 0&&Y!==void 0&&!ei(W,Y),J=Q?W:Z;return{...P,currentFamily:B,drafts:{...P.drafts,[B]:J},bases:{...P.bases,[B]:Q?Y:Z}}})},_=()=>{p(B=>{if(B===null)return B;const P=u.current[B.snapshot.family];return(P===void 0||ei(P,B.snapshot.state))&&(u.current[B.snapshot.family]=B.snapshot.state),null})},M=B=>{u.current[B.family]=B,m(B.family),t(Fi(B)),r({...n,...n.argsMode==="array"?{argsMode:"string"}:{},family:B}),p(null)},H=Ko[h],G=h==="custom";return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex h-8 w-full min-w-0 items-stretch rounded-lg border border-input bg-transparent transition-colors outline-none focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 disabled:opacity-50 dark:bg-input/30",children:[c.jsxs(jo,{children:[c.jsxs(Mo,{disabled:o,className:"flex w-11 items-center justify-between gap-1 rounded-l-lg border-r border-input transition-colors outline-none hover:bg-accent focus-visible:z-10 focus-visible:border-ring","aria-label":Ye(i.family.selectorAria,{name:An(h,i)}),title:Ye(i.family.selectorTitle,{name:An(h,i)}),children:[c.jsx(H,{className:"size-4 text-muted-foreground ms-2"}),c.jsx(Pn,{className:"size-3 text-muted-foreground/70 me-0.75"})]}),c.jsx(No,{align:"start",className:"w-36",children:cp.map(B=>{const P=Ko[B];return c.jsxs(To,{onClick:()=>T(B),className:B===h?"bg-accent/60":void 0,children:[c.jsx(P,{className:"text-muted-foreground"}),An(B,i)]},B)})})]}),G?c.jsx("input",{className:"h-full w-full min-w-0 flex-1 bg-transparent px-2.5 font-mono text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed",placeholder:"npx somecommand start --xx",disabled:o,value:e,onChange:B=>t(B.target.value),onKeyDown:B=>{B.key==="Enter"&&!o&&s()}}):c.jsx("button",{type:"button",className:"h-full min-w-0 flex-1 cursor-pointer truncate px-2.5 text-left font-mono text-sm outline-none select-none disabled:cursor-not-allowed disabled:opacity-60",disabled:o,title:e.length>0?e:Ye(i.family.configureTitle,{name:An(h,i)}),"aria-label":Ye(i.family.configureAria,{name:An(h,i)}),onClick:F,children:e.length>0?e:c.jsx("span",{className:"text-muted-foreground",children:Ye(i.family.configurePlaceholder,{name:An(h,i)})})}),j&&S!==void 0?c.jsxs(us,{open:x||v||C,onOpenChange:B=>{B||I(!1)},children:[c.jsx(ds,{render:c.jsx("span",{tabIndex:0,className:"mr-1 flex size-6 shrink-0 self-center cursor-help items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring","aria-label":i.family.envCarryAria,onPointerEnter:()=>b(!0),onPointerLeave:()=>b(!1),onFocus:()=>y(!0),onBlur:()=>y(!1),onClick:()=>I(B=>!B)}),children:c.jsx(Sr,{className:"size-3.5"})}),c.jsx(fs,{side:"top",children:c.jsxs("div",{className:"space-y-1 text-left",children:[c.jsx("p",{className:"text-[11px] opacity-70",children:i.family.envPresetTitle}),c.jsxs("p",{className:"font-mono text-xs",children:[S.key,"=",D]}),c.jsx("p",{className:"text-[11px] opacity-70",children:i.family.envPresetSource})]})})]}):null]}),c.jsx(KC,{open:d!==null,draft:w??lu(h),envPreset:k,onEnvPresetChange:N,onDraftChange:R,onFamilyChange:O,onCancel:_,onApply:M})]})}function LC({tags:e,onTagsChange:t,disabled:n=!1,placeholder:r,className:o,...s}){const{messages:i}=mt(),[a,l]=f.useState(""),u=()=>{a.length!==0&&(t([...e,a]),l(""))};return c.jsxs("div",{className:ge("flex min-h-9 w-full flex-wrap items-center gap-1.5 rounded-md border border-input bg-transparent px-2 py-1.5 font-mono text-xs shadow-xs focus-within:border-ring",n&&"opacity-50",o),children:[e.map((d,p)=>c.jsxs("span",{className:"flex items-center gap-1 rounded bg-accent px-1.5 py-0.5 text-accent-foreground",children:[c.jsx("span",{className:"max-w-56 truncate",title:d,children:d}),n?null:c.jsx("button",{type:"button","aria-label":Ye(i.command.argvRemove,{n:p+1}),className:"text-muted-foreground hover:text-foreground",onClick:()=>{t(e.filter((A,m)=>m!==p))},children:c.jsx(zi,{className:"size-3"})})]},`${p}:${d}`)),c.jsx("input",{className:"min-w-24 flex-1 bg-transparent font-mono text-xs outline-none placeholder:text-muted-foreground",value:a,disabled:n,placeholder:r??(e.length===0?i.command.argvProgram:i.command.argvArg),onChange:d=>l(d.target.value),onKeyDown:d=>{if(d.key==="Enter"){d.preventDefault(),u();return}d.key==="Backspace"&&a.length===0&&e.length>0&&(d.preventDefault(),t(e.slice(0,-1)))},onBlur:u,...s})]})}function QC({command:e,onCommandChange:t,argv:n,onArgvChange:r,runAlive:o,frozen:s,failedReason:i,commandOptions:a,defaultCwd:l,onCommandOptionsChange:u,onRun:d,onStop:p}){const{messages:A}=mt(),m=h=>{u({...a,...h})};return c.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[c.jsxs("div",{className:"flex gap-2",children:[a.argsMode==="array"?c.jsx(LC,{tags:n,onTagsChange:r,disabled:o,"aria-label":A.command.argvAria}):c.jsx(WC,{command:e,onCommandChange:t,commandOptions:a,onCommandOptionsChange:u,disabled:o||s,onRun:d}),o?c.jsxs(He,{variant:"destructive",onClick:p,"aria-label":A.command.stopAria,children:[c.jsx(oA,{}),A.command.stop]}):c.jsxs(He,{disabled:s,onClick:d,"aria-label":A.command.runAria,children:[c.jsx(Zh,{}),A.command.run]})]}),i!==void 0?c.jsx("p",{className:"mt-2 font-mono text-xs text-red-400",children:i}):null,c.jsx(_a,{defaultValue:["command"],className:"mt-3 border-t border-border pt-1",children:c.jsxs(Oa,{value:"command",className:"border-b-0",children:[c.jsx(Ha,{children:c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx(eA,{className:"size-4 text-muted-foreground"}),A.command.options]})}),c.jsxs(Ka,{className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[c.jsxs("div",{children:[c.jsx(Ne,{children:A.command.argsModeLabel}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:A.command.argsModeHint}),c.jsxs(Wa,{variant:"outline",size:"sm",spacing:0,value:[a.argsMode],onValueChange:h=>{const g=h[0];(g==="string"||g==="array")&&m({argsMode:g})},disabled:s,children:[c.jsx(Br,{value:"string",children:A.command.modeString}),c.jsx(Br,{value:"array",children:A.command.modeArray})]})]}),c.jsxs("div",{children:[c.jsx(Ne,{htmlFor:"cmd-cwd",children:A.command.cwdLabel}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:A.command.cwdHint}),c.jsx(et,{id:"cmd-cwd",className:"mt-0 font-mono text-xs",disabled:s,value:a.cwd,placeholder:l.length>0?Ye(A.command.cwdDefault,{path:l}):A.command.cwdDefaultHome,title:l,onChange:h=>m({cwd:h.target.value})}),l.length>0&&a.cwd.trim().length===0?c.jsx("p",{className:"mt-1 font-mono text-[11px] break-all text-muted-foreground",children:l}):null]})]}),c.jsxs("div",{children:[c.jsx(Ne,{children:A.command.envLabel}),c.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:A.command.envHint}),c.jsxs("div",{className:"space-y-1.5",children:[a.env.length===0?c.jsx("p",{className:"text-xs text-muted-foreground",children:A.command.envEmpty}):a.env.map((h,g)=>c.jsxs("div",{className:"flex gap-1.5",children:[c.jsx(et,{className:"font-mono text-xs",disabled:s,"aria-label":Ye(A.command.envName,{n:g+1}),value:h.key,placeholder:"NAME",onChange:x=>{const b=[...a.env];b[g]={...h,key:x.target.value},m({env:b})}}),c.jsx(et,{className:"font-mono text-xs",disabled:s,"aria-label":Ye(A.command.envValue,{n:g+1}),value:h.value,placeholder:"value",onChange:x=>{const b=[...a.env];b[g]={...h,value:x.target.value},m({env:b})}}),c.jsx(He,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":A.command.envRemove,onClick:()=>{m({env:a.env.filter((x,b)=>b!==g)})},children:"×"})]},g)),c.jsxs(He,{variant:"outline",size:"sm",disabled:s,onClick:()=>m({env:[...a.env,{key:"",value:""}]}),children:[c.jsx(Sr,{className:"size-3.5"}),A.command.envAdd]})]})]})]})]})})]})}const uu=e=>{const t=e.trim();return t.length===0?"":/^https?:\/\//iu.test(t)?t:`https://${t}`};function GC({value:e,onChange:t,activeSource:n,frozen:r,loading:o,failedReason:s,onSubmit:i}){const{messages:a}=mt();return c.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[c.jsxs("div",{className:"flex items-center gap-2 pb-3 text-sm font-medium text-muted-foreground",children:[c.jsx(Th,{className:"size-4"}),a.wizard.sourceUrl]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(si,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),c.jsx(et,{className:"pl-8 font-mono text-xs",value:e,placeholder:"https://example.com",disabled:r,onChange:l=>t(l.target.value),onKeyDown:l=>{if(l.key!=="Enter"||r||o)return;const u=uu(e);t(u),i(u)},"aria-label":a.wizard.sourceUrl})]}),c.jsxs(He,{size:"sm",disabled:r||o||e.trim().length===0,onClick:()=>{const l=uu(e);t(l),i(l)},children:[o?c.jsx(Hh,{className:"size-4 animate-spin"}):null,a.url.fetch]})]}),s!==void 0?c.jsx("p",{className:"pt-2 text-xs text-destructive",role:"alert",children:s}):null,n!==void 0?c.jsxs("p",{className:"pt-2 text-xs text-muted-foreground",children:[c.jsx("span",{children:a.url.sourcePrefix}),c.jsx("span",{className:"font-mono",children:n}),c.jsx("span",{children:a.url.activeSuffix})]}):c.jsx("p",{className:"pt-2 text-xs text-muted-foreground",children:a.url.idleNote})]})}const ti=["scaffold","icon","install"];function YC({open:e,phase:t,frozenValues:n,iconSrc:r,iconLabel:o,traySrc:s,trayLabel:i,selectedPort:a,currentStep:l,logs:u,error:d,result:p,onBack:A,onCreate:m,onShare:h,onOpenApp:g,onClose:x,confirmError:b,onOpenChange:v}){const{messages:y}=mt(),C={scaffold:y.dialog.stepScaffold,icon:y.dialog.stepIcon,install:y.dialog.stepInstall},I=f.useRef(null);f.useEffect(()=>{I.current?.scrollTo({top:I.current.scrollHeight})},[u.length]);const w=E=>{const S=ti.indexOf(E),D=ti.indexOf(l);return t==="success"||S<D?"done":S===D?"active":""};return c.jsx(La,{open:e,onOpenChange:E=>{t==="pending"&&E===!1||v(E)},children:c.jsx(Qa,{className:"max-w-xl",children:t==="confirm"?c.jsxs(c.Fragment,{children:[c.jsxs(Ln,{children:[c.jsx(Qn,{children:y.dialog.confirmTitle}),c.jsx(Ga,{children:y.dialog.confirmDescription})]}),c.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-sm",children:[c.jsx("dt",{className:"text-muted-foreground",children:"App ID"}),c.jsx("dd",{className:"font-mono break-all",children:n.appId}),c.jsx("dt",{className:"text-muted-foreground",children:y.form.appName}),c.jsx("dd",{className:"break-all",children:n.appName}),c.jsx("dt",{className:"text-muted-foreground",children:y.dialog.icon}),c.jsxs("dd",{className:"flex flex-wrap items-center gap-4",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"icon-checker flex size-10 items-center justify-center overflow-hidden rounded-md","aria-label":y.dialog.appIconPreview,children:r!==void 0?c.jsx("img",{src:r,alt:y.dialog.appIcon,className:"size-full object-contain"}):c.jsx("span",{className:"text-[10px] text-muted-foreground",children:y.common.none})}),c.jsxs("span",{className:"flex flex-col",children:[c.jsx("span",{className:"text-xs leading-tight",children:y.dialog.appIcon}),c.jsx("span",{className:"font-mono text-[10px] leading-tight text-muted-foreground",children:o})]})]}),c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"icon-checker flex size-10 items-center justify-center overflow-hidden rounded-md","aria-label":y.dialog.trayIconPreview,children:s!==void 0?c.jsx("img",{src:s,alt:y.dialog.trayIcon,className:"size-full object-contain"}):c.jsx("span",{className:"text-[10px] text-muted-foreground",children:y.dialog.textTray})}),c.jsxs("span",{className:"flex flex-col",children:[c.jsx("span",{className:"text-xs leading-tight",children:y.dialog.trayIcon}),c.jsx("span",{className:"font-mono text-[10px] leading-tight text-muted-foreground",children:i})]})]})]}),c.jsx("dt",{className:"text-muted-foreground",children:y.dialog.port}),c.jsx("dd",{className:"font-mono",children:a!==void 0?Ye(y.dialog.portSelected,{port:a}):y.dialog.portRuntime}),c.jsx("dt",{className:"text-muted-foreground",children:y.advanced.pm}),c.jsx("dd",{children:n.pm})]}),b!==void 0?c.jsx("p",{className:"text-xs font-medium text-red-400",children:b}):null,c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(He,{variant:"outline",onClick:A,children:y.dialog.back}),c.jsx(He,{variant:"outline",onClick:h,children:y.dialog.share}),c.jsx(He,{onClick:m,children:y.dialog.confirmCreate})]})]}):t==="pending"?c.jsxs(c.Fragment,{children:[c.jsx(Ln,{children:c.jsx(Qn,{children:y.dialog.pendingTitle})}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:ti.map(E=>c.jsx(Co,{variant:w(E)==="done"?"default":"secondary",children:C[E]},E))}),c.jsx("div",{ref:I,className:"h-48 overflow-y-auto rounded-md border border-border bg-[#05070b] p-3 font-mono text-[11px] leading-5 text-[#b7c3d8] whitespace-pre-wrap",children:u.join(`
24
+ `)})]}):t==="success"&&p!==void 0?c.jsxs(c.Fragment,{children:[c.jsx(Ln,{children:c.jsxs(Qn,{className:"flex items-center gap-2",children:[c.jsx(vh,{className:"size-5 text-emerald-400"}),y.dialog.successTitle]})}),c.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-sm",children:[c.jsx("dt",{className:"text-muted-foreground",children:y.dialog.projectDir}),c.jsx("dd",{className:"font-mono break-all",children:p.projectDir}),p.bundlePath?c.jsxs(c.Fragment,{children:[c.jsx("dt",{className:"text-muted-foreground",children:y.dialog.macosBundle}),c.jsx("dd",{className:"font-mono break-all",children:p.bundlePath})]}):null]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(He,{variant:"outline",onClick:x,children:y.dialog.done}),c.jsxs(He,{onClick:g,children:[c.jsx(Eu,{}),y.dialog.openApp]})]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:p.pinHint})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ln,{children:c.jsxs(Qn,{className:"flex items-center gap-2",children:[c.jsx(uA,{className:"size-5 text-red-400"}),y.dialog.failedTitle]})}),c.jsx("p",{className:"break-all font-mono text-xs text-red-400",children:d??y.dialog.unknownError}),c.jsx("div",{className:"flex justify-end",children:c.jsx(He,{variant:"outline",onClick:A,children:y.dialog.backRetry})})]})})})}const ni=(e,t)=>{const n=f.useRef(e);n.current=e;const r=f.useRef(void 0),o=f.useRef(void 0),s=f.useCallback(()=>{r.current!==void 0&&(clearTimeout(r.current),r.current=void 0);const d=o.current;o.current=void 0,d!==void 0&&n.current(...d)},[]),i=f.useCallback(()=>{r.current!==void 0&&(clearTimeout(r.current),r.current=void 0),o.current=void 0},[]),a=f.useCallback((...d)=>{o.current=d,r.current!==void 0&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=void 0;const p=o.current;o.current=void 0,p!==void 0&&n.current(...p)},t)},[t]);f.useEffect(()=>s,[s]);const l=f.useRef(a);l.current=a;const u=f.useCallback((...d)=>{l.current(...d)},[]);return u.flush=s,u.cancel=i,u},pp=f.createContext(void 0);function hp(){const e=f.useContext(pp);if(e===void 0)throw new Error(at(64));return e}const nl={tabActivationDirection:e=>({"data-activation-direction":e})},zC=f.forwardRef(function(t,n){const{className:r,defaultValue:o=0,onValueChange:s,orientation:i="horizontal",render:a,value:l,style:u,...d}=t,p=t.defaultValue!==void 0,A=f.useRef([]),[m,h]=f.useState(()=>new Map),[g,x]=ln({controlled:l,default:o,name:"Tabs",state:"value"}),b=l!==void 0,[v,y]=f.useState(()=>new Map),C=f.useRef(void 0),I=f.useCallback(K=>Bi(v,K),[v]),[w,E]=f.useState(()=>({previousValue:g,tabActivationDirection:"none"})),{previousValue:S,tabActivationDirection:D}=w;let k=D,j=!1;S!==g&&(k=du(S,g,i,v),j=S!=null&&g!=null&&I(g)==null);const N=j?S:g,T=S!==N||D!==k;le(()=>{T&&E({previousValue:N,tabActivationDirection:k})},[N,T,k]);const F=ue((K,ee)=>{const ce=du(g,K,i,v);ee.activationDirection=ce,s?.(K,ee),!ee.isCanceled&&x(K)}),R=ue((K,ee)=>{s?.(K,Ce(ee,void 0,void 0,{activationDirection:"none"}))}),O=ue((K,ee)=>(h(ce=>{const te=new Map(ce);return te.set(K,ee),te}),()=>{h(ce=>{if(ce.get(K)!==ee)return ce;const te=new Map(ce);return te.delete(K),te})})),_=f.useCallback(K=>m.get(K),[m]),M=f.useCallback(K=>{for(const ee of v.values())if(K===ee.value)return ee.id},[v]),H=f.useMemo(()=>({getTabElementBySelectedValue:I,getTabIdByPanelValue:M,getTabPanelIdByValue:_,onValueChange:F,orientation:i,registerMountedTabPanel:O,setTabMap:y,tabActivationDirection:k,value:g}),[I,M,_,F,i,O,y,k,g]),G=f.useMemo(()=>{for(const K of v.values())if(K.value===g)return K},[v,g]),B=f.useMemo(()=>{for(const K of v.values())if(!K.disabled)return K.value},[v]),P=f.useRef(!p),W=f.useRef(o),Y=f.useRef(p),Z=f.useRef(!1);le(()=>{if(b)return;function K($,X){x($),E({previousValue:$,tabActivationDirection:"none"}),R($,X),P.current=!1}if(v.size===0){Z.current&&g!==null&&!C.current?.isConnected&&K(null,yl);return}Z.current=!0,C.current=v.keys().next().value;const ee=G?.disabled,ce=G==null&&g!==null;if(!ee&&g===W.current&&(Y.current=!1),Y.current&&ee&&g===W.current)return;const te=P.current;if(ee||ce){const $=B??null;if(g===$){P.current=!1;return}let X=yl;te?X=vl:ee&&(X=Iu),K($,X);return}te&&G!=null&&(R(g,vl),P.current=!1)},[B,b,R,G,x,v,g]);const J=Me("div",t,{state:{orientation:i,tabActivationDirection:k},ref:n,props:d,stateAttributesMapping:nl});return c.jsx(pp.Provider,{value:H,children:c.jsx(Ur,{elementsRef:A,children:J})})});function Bi(e,t){for(const[n,r]of e.entries())if(t===r.value)return n;return null}function du(e,t,n,r){if(e==null||t==null)return"none";const[o,s,i]=n==="horizontal"?["left","left","right"]:["top","up","down"],a=Bi(r,e),l=Bi(r,t);if(a==null||l==null)return a!==l&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?t>e?i:s:"none";const u=a.getBoundingClientRect()[o],d=l.getBoundingClientRect()[o];return d<u?s:d>u?i:"none"}const Ap=f.createContext(void 0);function UC(){const e=f.useContext(Ap);if(e===void 0)throw new Error(at(65));return e}const VC=f.forwardRef(function(t,n){const{className:r,disabled:o=!1,render:s,value:i,id:a,nativeButton:l=!0,style:u,...d}=t,{value:p,getTabPanelIdByValue:A,onValueChange:m,orientation:h,tabActivationDirection:g}=hp(),{activateOnFocus:x,registerTabResizeObserverElement:b,tabsListElement:v}=UC(),{highlightedIndex:y,onHighlightedIndexChange:C}=Oi(),I=wt(a),w=f.useMemo(()=>({disabled:o,id:I,value:i}),[o,I,i]),{compositeProps:E,compositeRef:S,index:D}=Xd({metadata:w}),k=i===p,j=f.useRef(!1),N=f.useRef(null),T=ue(Z=>{N.current?.(),N.current=Z?b(Z):null});le(()=>{if(j.current){j.current=!1;return}if(!(k&&D>-1&&y!==D))return;const Z=v;if(Z!=null){const Q=yt(je(Z));if(Q&&ve(Z,Q))return}o||C(D)},[k,D,y,C,o,v]);const{getButtonProps:F,buttonRef:R}=Vt({disabled:o,native:l,focusableWhenDisabled:!0}),O=A(i),_=f.useRef(!1),M=f.useRef(!1);function H(Z){m(i,Ce(Pt,Z.nativeEvent,void 0,{activationDirection:"none"}))}function G(Z){k||o||H(Z)}function B(Z){k||o||x&&(!_.current||M.current)&&H(Z)}function P(Z){if(k||o)return;_.current=!0,M.current=Z.button===0;const Q=je(Z.currentTarget);function J(){_.current=!1,M.current=!1,Q.removeEventListener("pointerup",J),Q.removeEventListener("pointercancel",J)}Q.addEventListener("pointerup",J),Q.addEventListener("pointercancel",J)}return Me("button",t,{state:{disabled:o,active:k,orientation:h,tabActivationDirection:g},ref:[n,R,S,T],props:[E,{role:"tab","aria-controls":O,"aria-selected":k,id:I,onClick:G,onFocus:B,onPointerDown:P,[hf]:k?"":void 0,onKeyDownCapture(){j.current=!0}},d,F],stateAttributesMapping:nl})}),ZC=f.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:o,loopFocus:s=!0,render:i,style:a,...l}=t,{orientation:u,setTabMap:d,tabActivationDirection:p}=hp(),[A,m]=f.useState(0),[h,g]=f.useState(null),x=f.useRef(new Set),b=f.useRef(new Set),v=f.useRef(null);le(()=>{if(typeof ResizeObserver>"u")return;const S=new ResizeObserver(()=>{x.current.forEach(D=>{D()})});return v.current=S,h&&S.observe(h),b.current.forEach(D=>{S.observe(D)}),()=>{S.disconnect(),v.current=null}},[h]);const y=ue(S=>(x.current.add(S),()=>{x.current.delete(S)})),C=ue(S=>(b.current.add(S),v.current?.observe(S),()=>{b.current.delete(S),v.current?.unobserve(S)})),I={orientation:u,tabActivationDirection:p},w={"aria-orientation":u==="vertical"?"vertical":void 0,role:"tablist"},E=f.useMemo(()=>({activateOnFocus:r,registerIndicatorUpdateListener:y,registerTabResizeObserverElement:C,tabsListElement:h}),[r,y,C,h]);return c.jsx(Ap.Provider,{value:E,children:c.jsx(Af,{render:i,className:o,style:a,state:I,refs:[n,g],props:[w,l],stateAttributesMapping:nl,highlightedIndex:A,enableHomeAndEndKeys:!0,loopFocus:s,orientation:u,onHighlightedIndexChange:m,onMapChange:d,disabledIndices:Ht})})});function JC({className:e,orientation:t="horizontal",...n}){return c.jsx(zC,{"data-slot":"tabs","data-orientation":t,className:ge("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const $C=ji("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function XC({className:e,variant:t="default",...n}){return c.jsx(ZC,{"data-slot":"tabs-list","data-variant":t,className:ge($C({variant:t}),e),...n})}function fu({className:e,...t}){return c.jsx(VC,{"data-slot":"tabs-trigger",className:ge("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function pu({className:e,size:t="default",...n}){return c.jsx("div",{"data-slot":"card","data-size":t,className:ge("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...n})}function hu({className:e,...t}){return c.jsx("div",{"data-slot":"card-header",className:ge("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",e),...t})}function Au({className:e,...t}){return c.jsx("div",{"data-slot":"card-content",className:ge("px-(--card-spacing)",e),...t})}function qC({className:e,...t}){return c.jsx("div",{"data-slot":"card-footer",className:ge("flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",e),...t})}const gp=f.memo(({port:e,url:t,visible:n,className:r})=>{const o=f.useRef(null),s=f.useRef(t);return f.useEffect(()=>{const i=o.current;if(i===null){s.current=t;return}s.current!==t&&(s.current=t,i.src=t)},[t]),c.jsx("iframe",{ref:o,title:`service-${e}`,src:t,className:r,style:{width:"100%",height:"100%",border:0,background:"#fff",display:n?"block":"none"},sandbox:"allow-same-origin allow-scripts allow-forms"})});gp.displayName="StableIframe";const eI=e=>{const t=e.trim();if(t.length!==0)try{return new URL(/^https?:\/\//iu.test(t)?t:`http://${t}`).href}catch{return}},gu=({status:e,services:t,activeTab:n,onJumpToService:r})=>{const{messages:o}=mt();return c.jsxs(qC,{className:"h-8 shrink-0 gap-3 overflow-x-auto px-3 py-0 text-[11px] text-muted-foreground",children:[c.jsx("span",{className:"font-mono whitespace-nowrap",children:Ye(o.tabs.cursor,{y:e.cursorY,x:e.cursorX})}),c.jsxs("span",{className:"font-mono whitespace-nowrap",children:[e.cols,"×",e.rows]}),c.jsx("span",{className:"font-mono whitespace-nowrap",children:e.selection===void 0?o.tabs.noSelection:Ye(o.tabs.selection,{start:`${e.selection.start.y}:${e.selection.start.x}`,end:`${e.selection.end.y}:${e.selection.end.x}`})}),c.jsx("span",{className:"h-3 w-px bg-border"}),t.length===0?c.jsx("span",{children:o.tabs.sniffing}):t.map(s=>c.jsxs(Co,{variant:n===`svc-${s.port}`?"default":"secondary",className:"cursor-pointer font-mono whitespace-nowrap",onClick:()=>r(s.port),children:[":",s.port,s.title?` · ${s.title}`:""]},s.port))]})};function tI({command:e,terminalHostRef:t,terminalReady:n,interactive:r,status:o,services:s,iframeTabs:i,activeTab:a,onActiveTabChange:l,onIframeNavigate:u,onIframeHistoryMove:d,onJumpToService:p,hideTerminal:A=!1,className:m}){const{messages:h}=mt();return c.jsxs("div",{className:ge("flex min-h-0 flex-col gap-2",m),children:[c.jsx(JC,{value:a,onValueChange:l,children:c.jsxs(XC,{variant:"line",className:"w-full justify-start border-b px-2",children:[A?null:c.jsxs(fu,{value:"terminal",children:[c.jsx(Sr,{className:"size-3.5"}),h.tabs.terminal,!r&&n?c.jsx("span",{className:"text-[10px] text-amber-400",children:h.tabs.nonInteractive}):null]}),i.map(g=>c.jsxs(fu,{value:`svc-${g.port}`,children:[c.jsx(si,{className:"size-3.5"}),new URL(g.url).port===""?Si(g.url):`${Si(g.url)}:${new URL(g.url).port}`]},g.port))]})}),c.jsx("div",{className:"flex min-h-0 flex-1 flex-col",hidden:A||a!=="terminal",children:c.jsxs(pu,{size:"sm",className:"min-h-0 flex-1 gap-0",children:[c.jsx(hu,{className:"border-b [.border-b]:pb-2",children:c.jsxs("span",{className:"tech-ltr flex min-w-0 items-center gap-2 font-mono text-xs text-muted-foreground",children:[c.jsx(Sr,{className:"size-4 shrink-0"}),c.jsx("span",{className:"truncate",children:e||h.tabs.noCommand})]})}),c.jsxs(Au,{className:"min-h-0 flex-1 p-0",children:[c.jsx("div",{ref:t,className:"min-h-0 min-w-0 h-full bg-[#05070b] px-1"}),n?null:c.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:h.tabs.loadingRenderer})]}),c.jsx(gu,{status:o,services:s,activeTab:a,onJumpToService:p})]})}),i.map(g=>c.jsx("div",{className:"flex min-h-0 flex-1 flex-col",hidden:a!==`svc-${g.port}`,children:c.jsxs(pu,{size:"sm",className:"min-h-0 flex-1 gap-0",children:[c.jsx(hu,{className:"border-b [.border-b]:pb-2",children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(He,{variant:"ghost",size:"icon-sm",disabled:g.historyIndex===0,onClick:()=>d(g.port,-1),"aria-label":h.common.back,children:c.jsx(uh,{})}),c.jsx(He,{variant:"ghost",size:"icon-sm",disabled:g.historyIndex>=g.history.length-1,onClick:()=>d(g.port,1),"aria-label":h.common.forward,children:c.jsx(dh,{})}),c.jsx(He,{variant:"ghost",size:"icon-sm",onClick:()=>u(g.port,g.url,"replace"),"aria-label":h.common.reload,children:c.jsx(fh,{})}),c.jsx(si,{className:"size-4 shrink-0 text-muted-foreground"}),c.jsx(et,{className:"tech-ltr h-7 font-mono text-xs",defaultValue:g.url,placeholder:h.tabs.urlPlaceholder,onKeyDown:x=>{if(x.key!=="Enter")return;const b=x.target.value,v=eI(b);v!==void 0&&u(g.port,v,"push")}},`${g.port}:${g.historyIndex}:${g.url}`)]})}),c.jsx(Au,{className:"min-h-0 flex-1 p-0",children:c.jsx(gp,{port:g.port,url:g.url,visible:a===`svc-${g.port}`})}),c.jsx(gu,{status:o,services:s,activeTab:a,onJumpToService:p})]})},g.port))]})}const mp={model:"isnet_fp16",alphaThreshold:0,shrink:0},nI="1.7.0";let mo;const rI=async()=>(mo!==void 0||(mo=(await ph(()=>import("./index2.js"),__vite__mapDeps([0,1,2,3]))).removeBackground),mo),oI=()=>new URL(`/imgly-data/${nI}/`,window.location.origin).toString(),sI=(e,t)=>{if(t.alphaThreshold<=0&&t.shrink<=0)return e;const{width:n,height:r}=e;let o=new Uint8ClampedArray(n*r);for(let i=0;i<o.length;i+=1){const a=e.data[i*4+3]??0;o[i]=t.alphaThreshold>0&&a<t.alphaThreshold?0:a}for(let i=0;i<t.shrink;i+=1){const a=new Uint8ClampedArray(o.length);for(let l=0;l<r;l+=1)for(let u=0;u<n;u+=1){let d=o[l*n+u]??0;for(let p=-1;p<=1&&d>0;p+=1)for(let A=-1;A<=1&&d>0;A+=1){const m=l+p,h=u+A,g=m<0||m>=r||h<0||h>=n?0:o[m*n+h]??0;g<d&&(d=g)}a[l*n+u]=d}o=a}const s={data:new Uint8ClampedArray(e.data),width:n,height:r};for(let i=0;i<o.length;i+=1)s.data[i*4+3]=o[i]??0;return s},iI=async(e,t=mp,n)=>{try{const r=await rI(),o=(l,u,d)=>{if(d<=0)return;const p=Math.min(100,Math.round(u/d*100));n?.(l.startsWith("fetch:")?{kind:"download",percent:p}:{kind:"infer"})},s=await r(e,{model:t.model,device:"gpu",publicPath:oI(),progress:o});let i=s;const a=await createImageBitmap(s);try{if(t.alphaThreshold>0||t.shrink>0){const l=document.createElement("canvas");l.width=a.width,l.height=a.height;const u=l.getContext("2d");if(u!==null){u.drawImage(a,0,0);const d=u.getImageData(0,0,l.width,l.height),p=sI(d,t);d.data.set(p.data),u.putImageData(d,0,0);const A=await new Promise(m=>l.toBlob(m,"image/png"));A!==null&&(i=A)}}return{bytes:i,width:a.width,height:a.height}}finally{a.close()}}catch{return}},mu={appId:"",appName:"",iconPath:"",iconBackground:"transparent",iconScale:.8,trayIconPath:"",force:!1,pm:"npm",showStartupTerminal:!1,showAddressBar:!1,imageSmoothingEnabled:!0,developerMode:!1},aI={appId:"",appName:"",targetDir:"",iconPath:""};function lI(){const{messages:e}=mt(),{query:t}=rf(),n=t.get("edit"),[r,o]=f.useState(void 0),[s,i]=f.useState(""),[a,l]=f.useState([]),[u,d]=f.useState(w1),[p,A]=f.useState(""),[m,h]=f.useState(!1),[g,x]=f.useState(!1),b=f.useCallback(U=>{x(U),Zn.set(U)},[]);f.useEffect(()=>(Zn.set(g),()=>Zn.set(!1)),[g]);const[v,y]=f.useState(void 0),[C,I]=f.useState(!1),[w,E]=f.useState(""),[S,D]=f.useState(!1),[k,j]=f.useState("idle"),[N,T]=f.useState(),[F,R]=f.useState(""),[O,_]=f.useState(!0),[M,H]=f.useState(!1),[G,B]=f.useState(),[P,W]=f.useState(mu),[Y,Z]=f.useState(aI),[Q,J]=f.useState([]),[K,ee]=f.useState(),[ce,te]=f.useState(!1),[$,X]=f.useState([]),[ne,de]=f.useState(),[fe,ie]=f.useState(0),[he,oe]=f.useState(),[se,ae]=f.useState(),[xe,me]=f.useState(),[L,z]=f.useState(),[ye,q]=f.useState("transparent"),[re,Se]=f.useState(.8),ke=f.useRef(void 0),We=f.useRef(void 0),rt=f.useRef(!1),Ge=f.useRef(!1),[At,$e]=f.useState(),[Oe,lt]=f.useState(),[Ee,Le]=f.useState(),[Ze,ze]=f.useState("terminal"),[Re,Pe]=f.useState([]),[Je,qe]=f.useState({cursorX:0,cursorY:0,cols:0,rows:0}),[ft,ot]=f.useState(!1),[Ct,st]=f.useState("confirm"),[Et,St]=f.useState([]),[qt,Be]=f.useState(""),[Ue,bt]=f.useState(),[Rt,Bt]=f.useState(),[jt,Lt]=f.useState(mu),dn=f.useRef(null),Dt=f.useRef(void 0),en=f.useRef([]),rl=f.useRef(P);rl.current=P;const ol=f.useRef(k);ol.current=k;const Zr=(U,Ae,V)=>{if(Ae===void 0)return!1;const pe=Number.parseInt(Ae.split(":")[1]??"",10);return!U.some(Fe=>Fe.index===pe)||Ae.split(":")[0]!==String(V)},ms=f.useRef(void 0);f.useEffect(()=>{const U=P.iconPath.trim().length>0?P.iconPath.trim():Y.iconPath.trim().length>0?Y.iconPath.trim():void 0;if(ms.current=U,U===void 0){ae(void 0),z(void 0),ke.current=void 0;return}U===ke.current&&L!==void 0||(async()=>{try{me(void 0);const Ae=await _e("/api/icon-analyze",{path:U});if(!Ae.ok)throw new Error("analyze failed");const V=await Ae.json();if(ms.current!==U)return;ae(V),rt.current=!1,q(V.suggested),_e("/api/form",{iconBackground:V.suggested});const pe=await _e("/api/icon-compose",{foregroundPath:U,background:V.suggested,scale:re});if(!pe.ok)throw new Error("compose failed");const Fe=await pe.json();if(ms.current!==U)return;z(Fe),ke.current=U}catch{ae(void 0),z(void 0),me(e.icon.composeError)}})()},[P.iconPath,Y.iconPath]);const[xp,sl]=f.useState(!1),[bp,il]=f.useState(void 0),[xs,vp]=f.useState(mp),al=f.useRef(xs);al.current=xs;const Jr=f.useRef(new Set),bs=f.useRef(0),vs=f.useRef(!1),ys=f.useRef(!1),Cs=f.useCallback(async(U,Ae,V)=>{vs.current=!0,sl(!0);try{const pe=await(await fetch(Rn(Ae,U.index,V))).blob(),Fe=await iI(pe,al.current,Es=>il(Es.kind==="download"?Ye(e.icon.extractingDownload,{percent:Es.percent}):e.icon.extractingInfer));if(Fe===void 0||bs.current!==V)return;const _t=`token=${encodeURIComponent(new URLSearchParams(location.search).get("token")??"")}&port=${Ae}&variantOf=${U.index}&width=${Fe.width}&height=${Fe.height}`;await fetch(`/api/icon-candidate?${_t}`,{method:"POST",headers:{"content-type":"application/octet-stream"},body:Fe.bytes})}catch{}finally{vs.current=!1,sl(!1),il(void 0),ys.current&&(ys.current=!1,ll())}},[]),ll=ni(()=>{if(k==="frozen"||k==="materializing"||k==="success")return;const U=ne,Ae=$.find(V=>V.variant==="original");if(!(U===void 0||Ae===void 0)){if(vs.current){ys.current=!0;return}Cs(Ae,U,fe)}},500),yp=U=>{vp(U),ll()},Hn=f.useRef(void 0);f.useEffect(()=>{if(!(he===void 0&&Oe===void 0)&&ne!==void 0){if(Hn.current===void 0){Hn.current=fe;return}Hn.current!==fe&&(Hn.current=fe,he!==void 0&&!Zr($,he,ne)&&_e("/api/icon-select",{port:ne,index:Number.parseInt(he.split(":")[1]??"",10)}),Oe!==void 0&&!Zr($,Oe,ne)&&_e("/api/tray-icon-select",{port:ne,index:Number.parseInt(Oe.split(":")[1]??"",10)}))}},[fe,he,Oe,$,ne]),f.useEffect(()=>{const U=ne,Ae=$.find(pe=>pe.variant==="original");if(U===void 0||Ae===void 0||k==="frozen"||k==="materializing"||k==="success")return;bs.current!==fe&&(bs.current=fe,Jr.current=new Set);const V=`${U}:${Ae.index}`;Jr.current.has(V)||$.some(pe=>pe.variant==="subject"&&pe.variantOf===Ae.index)||(Jr.current=new Set([...Jr.current,V]),Cs(Ae,U,fe))},[$,ne,fe,k,Cs]);const cl=ni(U=>{_e("/api/form",{iconScale:U});const Ae=dl();fl(Ae,ye,U)},250),Cp=U=>{Se(U),cl(U)},ul=ni(U=>{_e("/api/form",{iconBackground:U});const Ae=dl();fl(Ae,U,re)},120),Ip=U=>{rt.current=!0,q(U),ul(U)},dl=()=>P.iconPath.trim().length>0?P.iconPath.trim():Y.iconPath.trim().length>0?Y.iconPath.trim():void 0,fl=f.useCallback(async(U,Ae,V)=>{if(U===void 0){ae(void 0),z(void 0),ke.current=void 0,We.current=void 0;return}We.current=U;try{const pe=await _e("/api/icon-analyze",{path:U});if(!pe.ok)throw new Error("analyze failed");const Fe=await pe.json();if(We.current!==U)return;ae(Fe);const xt=await _e("/api/icon-compose",{foregroundPath:U,background:Ae,scale:V});if(!xt.ok)throw new Error("compose failed");const _t=await xt.json();if(We.current!==U)return;z(_t),ke.current=U}catch{ae(void 0),z(void 0),me(e.icon.recomposeError)}},[]);f.useEffect(()=>{hh()},[]);const wp=f.useRef(!1);f.useEffect(()=>{n===null||r===n||(o(n),(async()=>{const U=await vu(n);if(U.status!==200||"code"in U.data)return;const Ae=U.data;if(Ae.command?.executable!==void 0&&i(Ae.command.executable),Ae.command?.args!==void 0&&l([...Ae.command.args]),Ae.command?.executable!==void 0&&d(V=>({...V,argsMode:"array"})),Ae.appName!==void 0){const V=Ae.appName;W(pe=>({...pe,appName:V}))}if(Ae.icons?.imageSmoothingEnabled!==void 0){const V=Ae.icons.imageSmoothingEnabled;W(pe=>({...pe,imageSmoothingEnabled:V}))}if(Ae.developerMode!==void 0){const V=Ae.developerMode;W(pe=>({...pe,developerMode:V,force:!0}))}if(Ae.command?.cwd!==void 0){const V=Ae.command.cwd;d(pe=>({...pe,cwd:V}))}if(Ae.command?.env!==void 0){const V=Object.entries(Ae.command.env).map(([pe,Fe])=>({key:pe,value:Fe}));d(pe=>({...pe,env:V}))}wp.current=!0})())},[n,r]),f.useEffect(()=>{if(!g)return;let U=!1;return(async()=>{const Ae=dn.current;if(Ae===null)return;const V=await Ah(Ae);if(U||V===void 0){U||B(e.tabs.ghosttyFallback);return}Dt.current=V,H(!0);const pe=en.current;en.current=[];for(const xt of pe)V.write(xt);V.onData(xt=>{pl.current&&_e("/api/terminal-input",{data:xt})}),V.onResize(({cols:xt,rows:_t})=>{_e("/api/terminal-resize",{cols:xt,rows:_t})});const Fe=window.setInterval(()=>{if(!(ol.current==="idle"&&!Dt.current))try{qe(V.readState())}catch{}},300);return()=>window.clearInterval(Fe)})(),()=>{U=!0,Dt.current?.dispose(),Dt.current=void 0}},[g]);const pl=f.useRef(!0);f.useEffect(()=>{pl.current=O},[O]),f.useEffect(()=>{const U=k1();return U.onmessage=Ae=>{const V=JSON.parse(Ae.data);switch(V.type){case"snapshot":{j(V.state),D(V.runAlive),y(V.urlSource),i(V.command),R(V.command),d(V.commandOptions),_(V.interactive),W(V.form),Z(V.defaults),h(V.targetDirExists),J(V.services),ee(V.selectedPort),X(V.icons??[]),de(V.iconsPort),ie(V.iconsGeneration??0),Pe(V.urlSource!==void 0?[{port:0,url:V.urlSource,history:[V.urlSource],historyIndex:0}]:V.services.map(Fe=>({port:Fe.port,url:Fe.url,history:[Fe.url],historyIndex:0})));const pe=V.runAlive||V.services.length>0||V.urlSource!==void 0;b(pe),ze(V.urlSource!==void 0?"svc-0":pe&&V.services.length>0?`svc-${V.services[0].port}`:"terminal");break}case"state":j(V.state),V.state==="failed"&&T(V.reason),V.state==="frozen"&&(st("confirm"),ot(!0)),V.state==="materializing"&&(st("pending"),St([])),V.state==="success"&&st("success"),V.state==="failed"&&Al.current&&(st("failed"),bt(V.reason));break;case"log":{Dt.current!==void 0?Dt.current.write(V.chunk):hl.current!==void 0?B(pe=>(pe??"")+V.chunk):en.current.push(V.chunk);break}case"term-mode":if(_(V.interactive),!V.interactive&&V.message!==void 0){const pe=`\x1B[33m${V.message}\x1B[0m\r
25
+ `;Dt.current!==void 0?Dt.current.write(pe):en.current.push(pe)}break;case"run-status":D(V.running);break;case"command-display":R(V.command);break;case"command-options":d(V.options),A(V.defaultCwd);break;case"services":{J(V.services),ee(V.selectedPort),Pe(pe=>{const Fe=[...pe];let xt;for(const _t of V.services)Fe.find(Op=>Op.port===_t.port)===void 0&&(Fe.push({port:_t.port,url:_t.url,history:[_t.url],historyIndex:0}),xt=_t.port);return xt!==void 0&&ze(`svc-${xt}`),Fe});break}case"icons":X(V.icons),de(V.port),ie(V.generation),Zr(V.icons,he,V.port)&&oe(void 0),Zr(V.icons,Oe,V.port)&&lt(void 0);break;case"scrape":te(V.hasIcon);break;case"form":{W(n!==null?Fe=>Fe:V.values),Z(V.defaults),h(V.targetDirExists),Ge.current||(Ge.current=!0,q(V.values.iconBackground),Se(V.values.iconScale));break}case"materialize-step":Be(V.step),St(pe=>[...pe,`[${V.step}] ${V.message}`]);break;case"materialize-log":St(pe=>[...pe,V.message]);break;case"success":Bt({projectDir:V.projectDir,...V.bundlePath===void 0?{}:{bundlePath:V.bundlePath},pinHint:V.pinHint}),window.dispatchEvent(new Event("create-opentray:apps-changed"));break}},()=>U.close()},[]);const hl=f.useRef(void 0);f.useEffect(()=>{hl.current=G},[G]);const Al=f.useRef(!1);f.useEffect(()=>{Al.current=ft},[ft]);const Is=he===void 0?void 0:Number.parseInt(he.split(":")[1]??"",10),kp=L!==void 0?Xf(L.key):At!==void 0?At:ne!==void 0&&Is!==void 0&&$.some(U=>U.index===Is)?Rn(ne,Is,fe):ne!==void 0&&$!==void 0&&$[0]!==void 0&&he===void 0?Rn(ne,$[0].index,fe):void 0,Ep=L!==void 0?Ye(e.icon.composed,{background:L.background==="transparent"?e.icon.bgNameTransparent:L.background==="black"?e.icon.bgNameBlack:e.icon.bgNameWhite}):At!==void 0?e.icon.localImage:$[0]!==void 0?`${$[0].width}×${$[0].height} ${$[0].format.toUpperCase()}`:e.icon.firstLetter,gl=(()=>{if(Ee!==void 0)return Ee;const U=P.trayIconPath.trim();if(U.length>0&&ne!==void 0){const V=$.find(pe=>pe.path===U);if(V!==void 0)return Rn(ne,V.index,fe)}const Ae=/^([^:]+):(\d+)$/.exec(Oe??"");if(Ae!==null){const V=Number(Ae[1]),pe=Number(Ae[2]);if(Number.isInteger(V)&&Number.isInteger(pe))return Rn(V,pe,fe)}U.length})(),Sp=Ee!==void 0?e.icon.localImage:gl!==void 0?e.icon.followSource:e.icon.followApp;f.useEffect(()=>{const U=s.trim();if(U.length===0)return;const Ae=window.setTimeout(()=>{_e("/api/prime",{command:U})},400);return()=>window.clearTimeout(Ae)},[s]);const Rp=async()=>{const U=s.trim();if(!(u.argsMode==="string"&&U.length===0)){if(b(!0),ze("terminal"),Dt.current?.reset(),Pe([]),J([]),te(!1),X([]),de(void 0),oe(void 0),$e(void 0),lt(void 0),Le(void 0),u.argsMode==="array"){if(a.length===0||(a[0]??"").trim().length===0)return;await _e("/api/command",{argv:a});return}await _e("/api/command",{command:U})}},Dp=U=>{if(Re.find(V=>V.port===U)===void 0){_e("/api/select-service",{port:U});return}_e("/api/select-service",{port:U}),ze(`svc-${U}`)},Fp=(U,Ae,V)=>{Pe(pe=>pe.map(Fe=>{if(Fe.port!==U)return Fe;if(V==="replace")return{...Fe,url:Ae};const xt=[...Fe.history.slice(0,Fe.historyIndex+1),Ae];return{...Fe,url:Ae,history:xt,historyIndex:xt.length-1}}))},Bp=(U,Ae)=>{Pe(V=>V.map(pe=>{if(pe.port!==U)return pe;const Fe=pe.historyIndex+Ae;return Fe<0||Fe>=pe.history.length?pe:{...pe,historyIndex:Fe,url:pe.history[Fe]}}))},[jp,ws]=f.useState(),Mp=async()=>{cl.flush(),ul.flush(),st("confirm"),ot(!0);try{const U=await _e("/api/confirm",{});if(!U.ok){const Ae=await U.json().catch(()=>({}));ws(Ae.error??Ye(e.dialog.confirmFailed,{status:U.status}));return}ws(void 0)}catch{ws(e.dialog.confirmRequestFailed)}};f.useEffect(()=>{k==="frozen"&&Lt({...rl.current,...P})},[k]);const Np=async()=>{await _e("/api/create",{})},[Tp,ml]=f.useState(!1),Pp=U=>Xp(U),ks=async()=>{ot(!1),(await _e("/api/cancel",{})).ok||j(Ae=>Ae==="frozen"?"discovered":Ae)},_p=g?"minmax(0, 520px) minmax(0, 1fr) minmax(0, 0fr)":"minmax(0, 1fr) minmax(0, var(--list-w)) minmax(0, 1fr)";return c.jsxs("div",{className:"grid h-full w-full overflow-hidden",style:{"--list-w":"min(520px, 100vw - 40px)",gridTemplateColumns:_p,transition:"grid-template-columns 450ms cubic-bezier(0.4, 0, 0.2, 1)"},children:[c.jsxs("div",{className:"flex w-full flex-col gap-4 overflow-y-auto p-5 pr-2 max-md:min-h-full "+(g?"md:border-r md:border-border":""),style:{gridColumn:g?"1":"2",gridRow:"1",transition:"border-color 450ms",scrollbarGutter:"stable"},children:[c.jsx("div",{className:"flex items-center justify-center",children:c.jsxs("div",{className:"inline-flex rounded-lg border border-border bg-card p-0.5 text-xs",children:[c.jsx("button",{type:"button",className:"rounded-md px-3 py-1.5 transition-colors "+(v===void 0&&!C?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),disabled:k==="materializing"||k==="success",onClick:()=>{I(!1),v!==void 0&&(E(""),y(void 0),Pe([]),b(!1),_e("/api/url",{url:"",exit:!0}))},children:e.wizard.sourceCommand}),c.jsx("button",{type:"button",className:"rounded-md px-3 py-1.5 transition-colors "+(v!==void 0||C?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),disabled:k==="materializing"||k==="success",onClick:()=>I(!0),children:e.wizard.sourceUrl})]})}),v!==void 0||C?c.jsx(GC,{value:w,onChange:E,activeSource:v,frozen:k==="materializing"||k==="frozen"||k==="success",loading:!1,failedReason:k==="failed"?N:void 0,onSubmit:U=>{_e("/api/url",{url:U}).then(Ae=>{Ae.ok&&(y(U),Pe([{port:0,url:U,history:[U],historyIndex:0}]),b(!0),ze("svc-0"))})}}):c.jsx(c.Fragment,{children:c.jsx(QC,{command:s,onCommandChange:i,argv:a,onArgvChange:U=>l([...U]),runAlive:S,frozen:k==="materializing"||k==="frozen"||k==="success",failedReason:k==="failed"?N:void 0,commandOptions:u,defaultCwd:p,onCommandOptionsChange:U=>{d(U),_e("/api/command-options",{cwd:U.cwd,env:U.env,argsMode:U.argsMode,family:U.family})},onRun:()=>{Rp()},onStop:()=>{_e("/api/stop",{})}})}),c.jsx(hC,{frozen:k==="frozen"||k==="materializing"||k==="success",values:P,defaults:Y,candidates:$,candidatesPort:ne,candidatesGeneration:fe,selectedIconRef:he,uploadedIconUrl:At,iconAnalysis:se,iconComposition:L,iconComposeError:xe,iconBackground:ye,iconScale:re,subjectExtracting:xp,subjectStage:bp,subjectSettings:xs,onSubjectSettingsChange:yp,onIconBackgroundChange:Ip,onIconScaleChange:Cp,selectedTrayRef:Oe,uploadedTrayUrl:Ee,selectedPort:K,targetDirExists:m,onPickIconCandidate:U=>{ne!==void 0&&(oe(`${ne}:${U.index}`),$e(void 0),Hn.current=fe,_e("/api/icon-select",{port:ne,index:U.index}))},onUploadIcon:U=>{const Ae=URL.createObjectURL(U);$e(Ae),oe(void 0),U.arrayBuffer().then(V=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":U.type||"application/octet-stream",authorization:`Bearer ${new URLSearchParams(location.search).get("token")??""}`},body:V}).then(pe=>pe.json()).then(({path:pe})=>{pe===void 0||pe.length===0||(W(Fe=>({...Fe,iconPath:pe})),_e("/api/form",{iconPath:pe}))}).catch(()=>{})})},onClearIcon:()=>{oe(void 0),$e(void 0),W(U=>({...U,iconPath:""})),_e("/api/form",{iconPath:""})},onPickTray:U=>{ne!==void 0&&(lt(`${ne}:${U.index}`),Le(void 0),Hn.current=fe,_e("/api/tray-icon-select",{port:ne,index:U.index}))},onUploadTray:U=>{const Ae=URL.createObjectURL(U);Le(Ae),lt(void 0),U.arrayBuffer().then(V=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":U.type||"application/octet-stream",authorization:`Bearer ${new URLSearchParams(location.search).get("token")??""}`},body:V}).then(pe=>pe.json()).then(({path:pe})=>{pe===void 0||pe.length===0||(W(Fe=>({...Fe,trayIconPath:pe})),_e("/api/form",{trayIconPath:pe}))}).catch(()=>{})})},onClearTray:()=>{lt(void 0),Le(void 0),W(U=>({...U,trayIconPath:""})),_e("/api/form",{trayIconPath:""})},onPatch:U=>{W(Ae=>({...Ae,...U})),_e("/api/form",U)},onConfirm:()=>{Mp()}})]}),c.jsx("div",{className:"flex min-h-0 min-w-0 flex-col gap-4 overflow-y-auto p-4 pr-1 max-md:hidden",style:{scrollbarGutter:"stable",gridColumn:g?"2":"3",gridRow:"1",opacity:g?1:0,visibility:g?"visible":"hidden",transition:"opacity 450ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear "+(g?"0s":"450ms")},children:g?c.jsxs(c.Fragment,{children:[c.jsx(tI,{command:F,terminalHostRef:dn,terminalReady:M,interactive:O,status:Je,services:v!==void 0?[{port:0,url:v,firstSeenAt:0,title:Si(v)}]:[...Q],hideTerminal:v!==void 0,iframeTabs:Re,activeTab:Ze,onActiveTabChange:ze,onIframeNavigate:Fp,onIframeHistoryMove:Bp,onJumpToService:Dp,className:"min-h-[480px] flex-1"}),G!==void 0?c.jsx("pre",{className:"max-h-56 overflow-auto rounded-xl border border-border bg-card p-3 font-mono text-xs whitespace-pre-wrap",children:G}):null]}):null}),c.jsx(YC,{open:ft,onOpenChange:U=>{if(U){ot(!0);return}if(Ct==="confirm"){ks();return}ot(!1)},phase:Ct,frozenValues:jt,iconSrc:kp,iconLabel:Ep,traySrc:gl,trayLabel:Sp,selectedPort:K,currentStep:qt,logs:Et,error:Ue??N,result:Rt,onBack:()=>{ks()},onCreate:()=>{Np()},onShare:()=>ml(!0),onOpenApp:()=>{_e("/api/open-app",{})},confirmError:jp,onClose:()=>{if(Ct==="confirm"){ks();return}ot(!1)}}),c.jsx(xf,{open:Tp,subtitle:jt?.appId??F,hasEnv:u.env.some(U=>U.key.trim().length>0),share:!0,runner:Pp,onClose:()=>ml(!1)})]})}function cI(){const{route:e}=of();return c.jsxs(c.Fragment,{children:[c.jsx("div",{hidden:e!=="add",className:"min-h-0 flex-1",children:c.jsx(lI,{})}),c.jsx("div",{hidden:e!=="applications",className:"min-h-0 flex-1",children:c.jsx(mb,{})}),c.jsx("div",{hidden:e!=="help",className:"min-h-0 flex-1",children:c.jsx(I1,{})})]})}const Zn={open:!1,listeners:new Set,set(e){if(this.open!==e){this.open=e;for(const t of this.listeners)t()}},subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}},uI=()=>{const[e,t]=f.useState(Zn.open);return f.useEffect(()=>Zn.subscribe(()=>t(Zn.open)),[]),e};function dI(){return c.jsx(Ex,{panelOpen:uI(),children:c.jsx(cI,{})})}const Wo=qp();eh(Wo.locale,Wo.theme);th.createRoot(document.getElementById("root")).render(c.jsx(nh.StrictMode,{children:c.jsx(rh,{initialLocale:Wo.locale,initialTheme:Wo.theme,children:c.jsx(dI,{})})}));