create-opentray 0.20.0 → 0.21.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.
@@ -1,21 +1,24 @@
1
- import{c as Ne,r as d,E as _t,u as Et,b as Yf,d as kc,f as nt,e as Me,j as u,N as pr,g as it,h as Qt,i as Ec,k as fe,m as Bt,l as Js,n as Uf,o as zf,R as Vf,a as Zf}from"./index.js";import{u as It,b as ie,i as Ve,c as Pe,d as ve,g as jt,o as Be,e as bt,f as wt,h as $s,j as de,k as Gt,l as Ce,m as Jf,n as Pt,p as Sn,q as Wn,r as $f,t as ot,s as yo,v as tt,w as At,x as Fn,y as Co,z as kn,C as Ln,D as Is,E as xn,F as Xs,H as Xf,J as Sc,K as qf,L as qs,M as Io,N as Rc,O as wa,P as jn,Q as ws,S as ei,B as Qe,T as Dc,U as ti,V as cr,W as rr,X as ni,Y as Fc,Z as ri,_ as oi,$ as wo,a0 as si,a1 as rn,a2 as ii,a3 as ep,I as wn,a4 as ai,a5 as tp,a6 as ka,a7 as Ea,G as Sa,A as np,a as rp,R as op}from"./input.js";import{u as Bc,B as no,T as ro,p as sp,c as ip}from"./terminal-pane.js";const ap=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Mc=Ne("check",ap);const lp=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Er=Ne("chevron-down",lp);const cp=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],li=Ne("chevron-up",cp);const up=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],dp=Ne("circle-check",up);const fp=[["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"}]],pp=Ne("circle-question-mark",fp);const Ap=[["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"}]],hp=Ne("copy",Ap);const gp=[["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"}]],mp=Ne("download",gp);const xp=[["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"}]],Pc=Ne("external-link",xp);const bp=[["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"}]],vp=Ne("file-text",bp);const yp=[["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"}]],Cp=Ne("folder-open",yp);const Ip=[["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"}]],wp=Ne("folder",Ip);const kp=[["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"}]],Ep=Ne("list",kp);const Sp=[["path",{d:"M5 12h14",key:"1ays0h"}]],Rp=Ne("minus",Sp);const Dp=[["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"}]],Fp=Ne("monitor",Dp);const Bp=[["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"}]],Mp=Ne("moon",Bp);const Pp=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Ra=Ne("panel-left",Pp);const Tp=[["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"}]],_p=Ne("pencil",Tp);const jp=[["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"}]],Np=Ne("play",jp);const Op=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Tc=Ne("plus",Op);const Hp=[["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"}]],Kp=Ne("refresh-cw",Hp);const Wp=[["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"}]],Lp=Ne("settings-2",Wp);const Qp=[["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"}]],Gp=Ne("share-2",Qp);const Yp=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Up=Ne("square",Yp);const zp=[["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"}]],Vp=Ne("sun",zp);const Zp=[["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"}]],Jp=Ne("trash-2",Zp);const $p=[["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"}]],Xp=Ne("triangle-alert",$p);const qp=[["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"}]],_c=Ne("upload",qp);const eA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ci=Ne("x",eA);function jc(e,t,n,r=!0,o){const[s,i]=d.useState(),a=It(o?`${o}-label`:void 0),l=e??t??s;return ie(()=>{const c=e||t||!r?void 0:tA(n.current,a);s!==c&&i(c)}),l}function tA(e,t){const n=nA(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function nA(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 rA(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:oA,platform:sA,maxTouchPoints:iA}=rA(),ko=oA.toLowerCase(),Ar=sA.toLowerCase(),Eo=/^i(os$|p)/.test(Ar)||Ar==="macintel"&&iA>1,Da="android",ks=Ar===Da||ko.includes(Da),ui=!Eo&&Ar.startsWith("mac");Ar.startsWith("win");const aA=ui||Eo,sn=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!sn&&ko.includes("firefox");!sn&&ko.includes("chrom");const lA=aA,di=/jsdom|happydom/.test(ko),Es="data-base-ui-focusable",Nc="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",So="ArrowLeft",Ro="ArrowRight",Oc="ArrowUp",fi="ArrowDown";function oo(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 $o(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 cA(e){return e.matches("html,body")}function Do(e){return Ve(e)&&e.matches(Nc)}function uA(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Nc}`)!=null}function Ss(e){return e?e.getAttribute("role")==="combobox"&&Do(e):!1}function dA(e){if(!e||di)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function so(e){return e?e.hasAttribute(Es)?e:e.querySelector(`[${Es}]`)||e:null}function hn(e,t,n=!0){return e.filter(o=>o.parentId===t).flatMap(o=>[...!n||o.context?.open?[o]:[],...hn(e,o.id,n)])}function Fa(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 fA(e){return"nativeEvent"in e}function pi(e){return e.pointerType===""&&e.isTrusted?!0:ks&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ai(e){return di?!1:!ks&&e.width===0&&e.height===0||ks&&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 An(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function pA(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const Qn=Math.min,tn=Math.max,io=Math.round,Tr=Math.floor,nn=e=>({x:e,y:e}),AA={left:"right",right:"left",bottom:"top",top:"bottom"};function Hc(e,t,n){return tn(e,Qn(t,n))}function gn(e,t){return typeof e=="function"?e(t):e}function Mt(e){return e.split("-")[0]}function bn(e){return e.split("-")[1]}function hi(e){return e==="x"?"y":"x"}function gi(e){return e==="y"?"height":"width"}function Ft(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function mi(e){return hi(Ft(e))}function hA(e,t,n){n===void 0&&(n=!1);const r=bn(e),o=mi(e),s=gi(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=ao(i)),[i,ao(i)]}function gA(e){const t=ao(e);return[Rs(e),t,Rs(t)]}function Rs(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ba=["left","right"],Ma=["right","left"],mA=["top","bottom"],xA=["bottom","top"];function bA(e,t,n){switch(e){case"top":case"bottom":return n?t?Ma:Ba:t?Ba:Ma;case"left":case"right":return t?mA:xA;default:return[]}}function vA(e,t,n,r){const o=bn(e);let s=bA(Mt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Rs)))),s}function ao(e){const t=Mt(e);return AA[t]+e.slice(t.length)}function yA(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 Kc(e){return typeof e!="number"?yA(e):{top:e,right:e,bottom:e,left:e}}function hr(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 ur(e,t){return t<0||t>=e.length}function Xr(e,t){return en(e.current,{disabledIndices:t})}function Ds(e,t){return en(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function en(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&&lo(e,s,r));return s}function lo(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;const o=e[t];return o?!Fo(o)||o.matches(":disabled")?!0:!n&&(o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true"):!1}function CA(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Fo(e,t=e?jt(e):null){return!e||!e.isConnected||!t||CA(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const IA='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function wA(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return $s(n)?n.host:null}function Fs(e){for(const t of Array.from(e.children))if(wt(t)==="summary")return t;return null}function kA(e,t){const n=Fs(t);return!!n&&(e===n||ve(n,e))}function Wc(e){const t=e?wt(e):"";return e!=null&&e.matches(IA)&&(t!=="summary"||e.parentElement!=null&&wt(e.parentElement)==="details"&&Fs(e.parentElement)===e)&&(t!=="details"||Fs(e)==null)&&(t!=="input"||e.type!=="hidden")}function Lc(e){if(!Wc(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=wA(t)){const n=t!==e,r=wt(t)==="slot";if(t.hasAttribute("inert")||n&&wt(t)==="details"&&!t.open&&!kA(e,t)||t.hasAttribute("hidden")||!r&&!EA(t,n))return!1}return!0}function EA(e,t){const n=jt(e);return t?n.display!=="none":Fo(e,n)}function Qc(e){const t=e.tabIndex;if(t<0){const n=wt(e);if(n==="details"||n==="audio"||n==="video"||Ve(e)&&e.isContentEditable)return 0}return t}function Xo(e){if(wt(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function SA(e,t){const n=Xo(e);if(!n)return!0;const r=t.find(o=>{const s=Xo(o);return s?.name===n.name&&s.form===n.form&&s.checked});return r?r===n:t.find(o=>{const s=Xo(o);return s?.name===n.name&&s.form===n.form})===n}function Gc(e){if(Ve(e)&&wt(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Ve(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Yc(e,t){Gc(e).forEach(n=>{Wc(n)&&t.push(n),Yc(n,t)})}function Uc(e,t,n){Gc(e).forEach(r=>{Ve(r)&&r.matches(t)&&n.push(r),Uc(r,t,n)})}function xi(e){return Lc(e)&&Qc(e)>=0}function zc(e){const t=[];return Yc(e,t),t.filter(Lc)}function Sr(e){const t=zc(e);return t.filter(n=>Qc(n)>=0&&SA(n,t))}function Vc(e,t){const n=Sr(e),r=n.length;if(r===0)return;const o=bt(Be(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function bi(e){return Vc(Be(e).body,1)||e}function Zc(e){return Vc(Be(e).body,-1)||e}function Jc(e,t){if(!e)return null;const n=Sr(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 RA(e){return Jc(e,1)}function DA(e){return Jc(e,-1)}function Nn(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!ve(n,r)}function FA(e){Sr(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Pa(e){const t=[];Uc(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 vi(e){d.useEffect(e,_t)}const qn=0;class Nt{static create(){return new Nt}currentId=qn;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=qn,n()},t)}isStarted(){return this.currentId!==qn}clear=()=>{this.currentId!==qn&&(clearTimeout(this.currentId),this.currentId=qn)};disposeEffect=()=>this.clear}function ut(){const e=Et(Nt.create).current;return vi(e.disposeEffect),e}const BA=d.createContext({disabled:!1});function MA(){return d.useContext(BA)}var on=Yf();const _r=null;class PA{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 jr=new PA;class Ct{static create(){return new Ct}static request(t){return jr.request(t)}static cancel(t){return jr.cancel(t)}currentId=_r;request(t){this.cancel(),this.currentId=jr.request(()=>{this.currentId=_r,t()})}cancel=()=>{this.currentId!==_r&&(jr.cancel(this.currentId),this.currentId=_r)};disposeEffect=()=>this.cancel}function Gn(){const e=Et(Ct.create).current;return vi(e.disposeEffect),e}function $t(e){return e==null?e:"current"in e?e.current:e}function yi(e,t=!1){const n=Gn();return de((r,o=null)=>{n.cancel();const s=$t(e);if(s==null)return;const i=s,a=()=>{on.flushSync(r)};if(typeof i.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function l(){Promise.all(i.getAnimations().map(c=>c.finished)).then(()=>{o?.aborted||a()},()=>{if(o?.aborted)return;if(i.getAnimations().some(f=>f.pending||f.playState!=="finished")){l();return}a()})}if(t){const c="data-starting-style";if(!i.hasAttribute(c)){n.request(l);return}const f=new MutationObserver(()=>{i.hasAttribute(c)||(f.disconnect(),l())});f.observe(i,{attributes:!0,attributeFilter:[c]}),o?.addEventListener("abort",()=>f.disconnect(),{once:!0});return}n.request(l)})}function Yt(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=de(o),i=yi(r,n);d.useEffect(()=>{if(!t)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[t,n,s,i])}let co=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const TA={"data-starting-style":""},_A={"data-ending-style":""},Bn={transitionStatus(e){return e==="starting"?TA:e==="ending"?_A:null}};function Jn(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 qo={exports:{}},es={};var Ta;function jA(){if(Ta)return es;Ta=1;var e=kc();function t(A,g){return A===g&&(A!==0||1/A===1/g)||A!==A&&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(A,g){var h=g(),p=r({inst:{value:h,getSnapshot:g}}),m=p[0].inst,x=p[1];return s(function(){m.value=h,m.getSnapshot=g,l(m)&&x({inst:m})},[A,h,g]),o(function(){return l(m)&&x({inst:m}),A(function(){l(m)&&x({inst:m})})},[A]),i(h),h}function l(A){var g=A.getSnapshot;A=A.value;try{var h=g();return!n(A,h)}catch{return!0}}function c(A,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return es.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,es}var _a;function $c(){return _a||(_a=1,qo.exports=jA()),qo.exports}var Bo=$c();const or={v:[]},ja=()=>or.v.forEach(e=>e()),NA=e=>(or.v.push(e)===1&&addEventListener("hashchange",ja),()=>{or.v=or.v.filter(t=>t!==e),or.v.length||removeEventListener("hashchange",ja)}),OA=()=>"/"+location.hash.replace(/^#?\/?/,""),HA=(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)},Xc=({ssrPath:e="/"}={})=>[Bo.useSyncExternalStore(NA,OA,()=>e),HA];Xc.hrefs=e=>"#"+e;const ts=768;function KA(){const[e,t]=d.useState(void 0);return d.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ts-1}px)`),r=()=>t(window.innerWidth<ts);return n.addEventListener("change",r),t(window.innerWidth<ts),()=>n.removeEventListener("change",r)},[]),!!e}const qc=d.createContext(void 0);function Mn(e){const t=d.useContext(qc);if(!e&&t===void 0)throw new Error(nt(27));return t}(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=co.startingStyle]="startingStyle",e[e.endingStyle=co.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const WA={"data-popup-open":""},LA={"data-popup-open":"","data-pressed":""},QA={"data-open":""},GA={"data-closed":""},YA={"data-anchor-hidden":""},eu={open(e){return e?WA:null}},Bs={open(e){return e?LA:null}},Rr={open(e){return e?QA:GA},anchorHidden(e){return e?YA:null}},Ci={...Rr,...Bn},Ii=d.forwardRef(function(t,n){const{render:r,className:o,style:s,forceRender:i=!1,...a}=t,l=Mn(),c=l.useState("open"),f=l.useState("nested"),A=l.useState("mounted"),g=l.useState("transitionStatus");return Me("div",t,{state:{open:c,transitionStatus:g},ref:[l.context.backdropRef,n],stateAttributesMapping:Ci,props:[{role:"presentation",hidden:!A,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:i||!f})}),wi=d.forwardRef(function(t,n){const{render:r,className:o,style:s,disabled:i=!1,nativeButton:a=!0,...l}=t,c=Mn(),f=c.useState("open"),{getButtonProps:A,buttonRef:g}=Gt({disabled:i,native:a}),h={disabled:i};function p(m){f&&c.setOpen(!1,Ce(Jf,m.nativeEvent))}return Me("button",t,{state:h,ref:[n,g],props:[{onClick:p},l,A]})}),ki=d.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,l=Mn(),c=It(i);return l.useSyncedValueWithCleanup("descriptionElementId",c),Me("p",t,{ref:n,props:[{id:c},a]})});function UA(e,t){return t!=null&&!An(t)?0:typeof e=="function"?e():e}function Yn(e,t,n){const r=UA(e,n);return typeof r=="number"?r:r?.[t]}function Na(e){return typeof e=="function"?e():e}function tu(e,t){return t||e==="click"||e==="mousedown"}function zA(e){return e?.includes("mouse")&&e!=="mousedown"}const VA=d.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Nt,currentIdRef:{current:null},currentContextRef:{current:null}});function ZA(e,t){e.current=t.current}function JA(e,t={open:!1}){const{open:n}=t,r="rootStore"in e?e.rootStore:e,o=r.useState("floatingId"),s=d.useContext(VA),{currentIdRef:i,delayRef:a,timeoutMs:l,initialDelayRef:c,currentContextRef:f,hasProvider:A,timeout:g}=s,[h,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=c.current,g.clear()}if(i.current&&!n&&i.current===o){if(p(!1),l){const I=o;return g.start(l,()=>{r.select("open")||i.current&&i.current!==I||x()}),()=>{(m.current||i.current!==I)&&g.clear()}}x()}},[n,o,i,a,l,c,f,g,r]),ie(()=>{if(!n)return;const x=f.current,I=i.current;g.clear(),f.current={onOpenChange:r.setOpen,setIsInstantPhase:p},i.current=o,a.current={open:0,close:Yn(c.current,"close")},I!==null&&I!==o?(p(!0),x?.setIsInstantPhase(!0),x?.onOpenChange(!1,Ce(Pt))):(p(!1),x?.setIsInstantPhase(!1))},[n,o,r,i,a,c,f,g]),ie(()=>()=>{if(i.current===o){if(f.current=null,!m.current)return;i.current=null,ZA(a,c),g.clear()}},[f,i,a,o,c,g]),d.useMemo(()=>({hasProvider:A,delayRef:a,isInstantPhase:h}),[A,a,h])}function Fe(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Lt(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function Xe(e){const t=Et($A,e).current;return t.next=e,ie(t.effect),t}function $A(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const nu={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Mo={...nu,position:"fixed",top:0,left:0},Ei={...nu,position:"absolute"},Un=d.forwardRef(function(t,n){const[r,o]=d.useState();ie(()=>{lA&&sn&&o("button")},[]);const s={tabIndex:0,role:r};return u.jsx("span",{...t,ref:n,style:Mo,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});function gr(e){return`data-base-ui-${e}`}let Nr=0;function qr(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:o}=t;cancelAnimationFrame(Nr);function s(){o&&!o()||e?.focus({preventScroll:n})}if(r)return s(),pr;const i=requestAnimationFrame(s);return Nr=i,()=>{Nr===i&&(cancelAnimationFrame(i),Nr=0)}}const ns={inert:new WeakMap,"aria-hidden":new WeakMap},Oa="data-base-ui-inert",Ms={inert:new WeakSet,"aria-hidden":new WeakSet};let er=new WeakMap,rs=0;function XA(e){return Ms[e]}function ru(e){return e?$s(e)?e.host:ru(e.parentNode):null}const Ha=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=ru(n);return e.contains(r)?r:null}).filter(n=>n!=null),Ka=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},Wa=(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 qA(e,t,n,r,{mark:o=!0}){let s=null;r?s="inert":n&&(s="aria-hidden");let i=null,a=null;const l=Ha(t,e),c=o?Wa(t,Ka(l),new Set(l)):[],f=[],A=[];if(s){const g=ns[s],h=XA(s);a=h,i=g;const p=Ha(t,Array.from(t.querySelectorAll("[aria-live]"))),m=l.concat(p);Wa(t,Ka(m),new Set(m)).forEach(I=>{const b=I.getAttribute(s),v=b!==null&&b!=="false",y=(g.get(I)||0)+1;g.set(I,y),f.push(I),y===1&&v&&h.add(I),v||I.setAttribute(s,s==="inert"?"":"true")})}return o&&c.forEach(g=>{const h=(er.get(g)||0)+1;er.set(g,h),A.push(g),h===1&&g.setAttribute(Oa,"")}),rs+=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&&A.forEach(g=>{const h=(er.get(g)||0)-1;er.set(g,h),h||g.removeAttribute(Oa)}),rs-=1,rs||(ns.inert=new WeakMap,ns["aria-hidden"]=new WeakMap,Ms.inert=new WeakSet,Ms["aria-hidden"]=new WeakSet,er=new WeakMap)}}function La(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0}=t,s=Be(e[0]).body;return qA(e,s,n,r,{mark:o})}const eh=500,th=500,nh={style:{transition:"none"}},rh="data-base-ui-click-trigger",ou={fallbackAxisSide:"none"},su={fallbackAxisSide:"end"},oh={clipPath:"inset(50%)",position:"fixed",top:0,left:0},iu=d.createContext(null),au=()=>d.useContext(iu),sh=gr("portal");function lu(e={}){const{ref:t,container:n,componentProps:r=it,elementProps:o}=e,s=Wn(),a=au()?.portalNode,[l,c]=d.useState(null),[f,A]=d.useState(null),g=de(x=>{x!==null&&A(x)}),h=d.useRef(null);ie(()=>{if(n===null){h.current&&(h.current=null,A(null),c(null));return}const x=(n&&($f(n)?n:n.current))??a??document.body;if(x==null){h.current&&(h.current=null,A(null),c(null));return}h.current!==x&&(h.current=x,A(null),c(x))},[n,a]);const p=Me("div",r,{ref:[t,g],props:[{id:s,[sh]:""},o]}),m=l&&p?on.createPortal(p,l):null;return{node:f,nodeId:d.isValidElement(p)?p.props.id:void 0,subtree:m}}const Si=d.forwardRef(function(t,n){const{render:r,className:o,style:s,children:i,container:a,...l}=t,{node:c,nodeId:f,subtree:A}=lu({container:a,ref:n,componentProps:t,elementProps:l}),g=d.useRef(null),h=d.useRef(null),p=d.useRef(null),m=d.useRef(null),[x,I]=d.useState(null),b=d.useRef(!1),v=x?.modal,y=x?.open,w=!!x&&!x.modal&&x.open&&!!c;d.useEffect(()=>{if(!c||v)return;function E(R){c&&R.relatedTarget&&Nn(R)&&(R.type==="focusin"?b.current&&(Pa(c),b.current=!1):(FA(c),b.current=!0))}return Lt(Fe(c,"focusin",E,!0),Fe(c,"focusout",E,!0))},[c,v]),ie(()=>{!c||y!==!0||!b.current||(Pa(c),b.current=!1)},[y,c]);const C=d.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:h,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:I}),[c]);return u.jsxs(d.Fragment,{children:[A,u.jsxs(iu.Provider,{value:C,children:[w&&c&&u.jsx(Un,{"data-type":"outside",ref:g,onFocus:E=>{if(Nn(E,c))p.current?.focus();else{const R=x?x.domReference:null;Zc(R)?.focus()}}}),w&&c&&u.jsx("span",{"aria-owns":f,style:oh}),c&&on.createPortal(i,c),w&&c&&u.jsx(Un,{"data-type":"outside",ref:h,onFocus:E=>{if(Nn(E,c))m.current?.focus();else{const R=x?x.domReference:null;bi(R)?.focus(),x?.closeOnFocusOut&&x?.onOpenChange(!1,Ce(Sn,E.nativeEvent))}}})]})]})});function cu(){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 Ri{nodesRef={current:[]};events=cu();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),du=d.createContext(null),vn=()=>d.useContext(uu)?.id||null,yn=e=>{const t=d.useContext(du);return e??t};function fu(e){const t=Wn(),n=yn(e),r=vn();return ie(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function ih(e){const{children:t,id:n}=e,r=vn();return u.jsx(uu.Provider,{value:d.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function ah(e){const{children:t,externalTree:n}=e,r=Et(()=>n??new Ri).current;return u.jsx(du.Provider,{value:r,children:t})}function lh(e,t){const n=tt(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 Qa=20;let pn=[];function Di(){pn=pn.filter(e=>e.deref()?.isConnected)}function Ga(e){Di(),e&&wt(e)!=="body"&&(pn.push(new WeakRef(e)),pn.length>Qa&&(pn=pn.slice(-Qa)))}function Ya(){return Di(),pn[pn.length-1]?.deref()}function ch(e){return e?xi(e)?e:Sr(e)[0]||e:null}function Ua(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=zc(e).filter(o=>{const s=o.getAttribute("data-tabindex")||"";return xi(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 Fi(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:c="",nextFocusableElement:f,previousFocusableElement:A,beforeContentFocusGuardRef:g,externalTree:h,getInsideElements:p}=e,m="rootStore"in t?t.rootStore:t,x=m.useState("open"),I=m.useState("domReferenceElement"),b=m.useState("floatingElement"),{events:v,dataRef:y}=m.context,w=de(()=>y.current.floatingContext?.nodeId),C=o===!1,E=Ss(I)&&C,R=Xe(o),S=Xe(s),k=Xe(c),F=Xe(x),B=yn(h),_=au(),M=d.useRef(!1),D=d.useRef(!1),j=d.useRef(!1),P=d.useRef(null),T=d.useRef(""),N=d.useRef(""),Q=d.useRef(null),O=d.useRef(null),H=Qt(Q,g,_?.beforeInsideRef),Y=Qt(O,_?.afterInsideRef),U=ut(),z=ut(),L=Gn(),Z=_!=null,K=so(b),ee=de(($=K)=>$?Sr($):[]),ce=de(()=>p?.().filter($=>$!=null)??[]);d.useEffect(()=>{if(r||!a)return;function $(ue){ue.key==="Tab"&&ve(K,bt(Be(K)))&&ee().length===0&&!E&&Ht(ue)}const q=Be(K);return Fe(q,"keydown",$)},[r,K,a,E,ee]),d.useEffect(()=>{if(r||!x)return;const $=Be(K);function q(){j.current=!1}function ue(Ae){const se=At(Ae),he=ce(),re=ve(b,se)||ve(I,se)||ve(_?.portalNode,se)||he.some(oe=>oe===se||ve(oe,se));j.current=!re,N.current=Ae.pointerType||"keyboard",se?.closest(`[${rh}]`)&&(D.current=!0,z.start(0,()=>{D.current=!1}))}function le(){N.current="keyboard"}return Lt(Fe($,"pointerdown",ue,!0),Fe($,"pointerup",q,!0),Fe($,"pointercancel",q,!0),Fe($,"keydown",le,!0),q)},[r,b,I,K,x,_,z,ce]),d.useEffect(()=>{if(r||!l)return;const $=Be(K);function q(){D.current=!0,z.start(0,()=>{D.current=!1})}function ue(he){const re=At(he);xi(re)&&(P.current=re)}function le(he){const re=he.relatedTarget,oe=he.currentTarget,ae=At(he);a&&re==null&&ae!=null&&ve(b,ae)&&Ga(ae),queueMicrotask(()=>{const ge=w(),me=m.context.triggerElements,W=ce(),G=re?.hasAttribute(gr("focus-guard"))&&[Q.current,O.current,_?.beforeInsideRef.current,_?.afterInsideRef.current,_?.beforeOutsideRef.current,_?.afterOutsideRef.current,$t(A),$t(f)].includes(re),be=!(ve(I,re)||ve(b,re)||ve(re,b)||ve(_?.portalNode,re)||W.some(X=>X===re||ve(X,re))||me.hasMatchingElement(X=>ve(X,re))||G||B&&(hn(B.nodesRef.current,ge).find(X=>ve(X.context?.elements.floating,re)||ve(X.context?.elements.domReference,re))||Fa(B.nodesRef.current,ge).find(X=>[X.context?.elements.floating,so(X.context?.elements.floating)].includes(re)||X.context?.elements.domReference===re)));if(oe===I&&K&&Ua(K),i&&oe!==I&&!Fo(ae)&&bt($)===$.body){if(Ve(K)&&(K.focus(),i==="popup")){L.request(()=>{K.focus()});return}const X=ee(),te=P.current,Ee=(te&&X.includes(te)?te:null)||X[X.length-1]||K;Ve(Ee)&&Ee.focus()}if(y.current.insideReactTree){y.current.insideReactTree=!1;return}(E||!a)&&re&&be&&!D.current&&(E||re!==Ya())&&(M.current=!0,m.setOpen(!1,Ce(Sn,he)))})}function Ae(){j.current||(y.current.insideReactTree=!0,U.start(0,()=>{y.current.insideReactTree=!1}))}const se=Ve(I)?I:null;if(!(!b&&!se))return Lt(se&&Fe(se,"focusout",le),se&&Fe(se,"pointerdown",q),b&&Fe(b,"focusin",ue),b&&Fe(b,"focusout",le),b&&_&&Fe(b,"focusout",Ae,!0))},[r,I,b,K,a,B,_,m,l,i,ee,E,w,y,U,z,L,f,A,ce]),d.useEffect(()=>{if(r||!b||!x)return;const $=Array.from(_?.portalNode?.querySelectorAll(`[${gr("portal")}]`)||[]),ue=(B?Fa(B.nodesRef.current,w()):[]).find(oe=>Ss(oe.context?.elements.domReference||null))?.context?.elements.domReference,Ae=[...[b,...$,Q.current,O.current,_?.beforeOutsideRef.current,_?.afterOutsideRef.current,...ce()],ue,$t(A),$t(f),E?I:null].filter(oe=>oe!=null),se=La(Ae,{ariaHidden:a||E,mark:!1}),he=[b,...$].filter(oe=>oe!=null),re=La(he);return()=>{re(),se()}},[x,r,I,b,a,_,E,B,w,f,A,ce]),ie(()=>{if(!x||r||!Ve(K))return;T.current="",N.current="";const $=Be(K),q=bt($);queueMicrotask(()=>{const ue=R.current,le=typeof ue=="function"?ue(k.current||""):ue;if(le===void 0||le===!1||ve(K,q))return;let se=null;const he=()=>(se==null&&(se=ee(K)),se[0]||K);let re;le===!0||le===null?re=he():re=$t(le),re=re||he();const oe=ve(K,bt($));qr(re,{preventScroll:re===K,shouldFocus(){if(!F.current)return!1;if(oe)return!0;const ae=bt($);return!(ae!==re&&ve(K,ae))}})})},[r,x,K,ee,R,k,F]),ie(()=>{if(r||!K)return;const $=Be(K),q=bt($),ue=k.current==null;Ga(q);function le(se){if(se.open||(T.current=lh(se.nativeEvent,N.current)),se.reason===ot&&se.nativeEvent.type==="mouseleave"&&(M.current=!0),se.reason===yo)if(se.nested)M.current=!1;else if(pi(se.nativeEvent)||Ai(se.nativeEvent))M.current=!1;else{let he=!1;Be(K).createElement("div").focus({get preventScroll(){return he=!0,!1}}),he?M.current=!1:M.current=!0}}v.on("openchange",le);function Ae(se){const he=S.current;let re=typeof he=="function"?he(se):he;if(re===void 0||re===!1)return null;re===null&&(re=!0);const oe=I?.isConnected?I:null,ae=q?.isConnected&&wt(q)!=="body"?q:null;let ge=ue?ae||oe:oe||ae;return ge||(ge=Ya()||null),typeof re=="boolean"?ge:$t(re)||ge||null}return()=>{v.off("openchange",le);const se=bt($),he=ce(),re=ve(b,se)||he.some(me=>me===se||ve(me,se))||B&&hn(B.nodesRef.current,w(),!1).some(me=>ve(me.context?.elements.floating,se)),oe=S.current,ae=T.current,ge=Ae(ae);queueMicrotask(()=>{const me=ch(ge),W=typeof oe!="boolean";if(oe&&!M.current&&Ve(me)&&(!(!W&&me!==se&&se!==$.body)||re)){const G={preventScroll:!0};ae==="keyboard"&&(G.focusVisible=!0),me.focus(G)}M.current=!1})}},[r,b,K,S,k,v,B,I,w,ce]),ie(()=>{if(!sn||x||!b)return;const $=bt(Be(b));!Ve($)||!Do($)||ve(b,$)&&$.blur()},[x,b]),ie(()=>{if(!(r||!_))return _.setFocusManagerState({modal:a,closeOnFocusOut:l,open:x,onOpenChange:m.setOpen,domReference:I}),()=>{_.setFocusManagerState(null)}},[r,_,a,x,m,l,I]),ie(()=>{if(!(r||!K))return Ua(K),()=>{queueMicrotask(Di)}},[r,K]);const ne=!r&&(a?!E:!0)&&(Z||a);return u.jsxs(d.Fragment,{children:[ne&&u.jsx(Un,{"data-type":"inside",ref:H,onFocus:$=>{if(a){const q=ee();qr(q[q.length-1])}else _?.portalNode&&(M.current=!1,Nn($,_.portalNode)?bi(I)?.focus():$t(A??_.beforeOutsideRef)?.focus())}}),n,ne&&u.jsx(Un,{"data-type":"inside",ref:Y,onFocus:$=>{a?qr(ee()[0]):_?.portalNode&&(l&&(M.current=!0),Nn($,_.portalNode)?Zc(I)?.focus():$t(f??_.afterOutsideRef)?.focus())}})]})}function pu(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:a=0,reason:l=Fn}=t,c="rootStore"in e?e.rootStore:e,f=c.context.dataRef,A=d.useRef(void 0),g=Gn(),h=ut(),p=d.useMemo(()=>{function m(I,b,v,y){const w=Ce(l,b,v);I&&y==="touch"&&a>0?h.start(a,()=>{c.setOpen(!0,w)}):c.setOpen(I,w)}function x(I,b,v){const y=f.current.openEvent,w=c.select("domReferenceElement")!==b;return I&&w||!I||!o?!0:y&&i?!v(y.type):!1}return{onPointerDown(I){A.current=An(I.pointerType,!0)&&Ai(I.nativeEvent)?"virtual":I.pointerType},onMouseDown(I){const b=A.current,v=I.nativeEvent,y=c.select("open");if(I.button!==0||r==="click"||An(b,!0)&&s)return;const w=x(y,I.currentTarget,R=>R==="click"||R==="mousedown"),C=At(v);if(Do(C)){m(w,v,C,b);return}const E=I.currentTarget;g.request(()=>{m(w,v,E,b)})},onClick(I){if(r==="mousedown-only")return;const b=A.current;if(r==="mousedown"&&b){A.current=void 0;return}if(An(b,!0)&&s)return;const v=c.select("open"),y=x(v,I.currentTarget,w=>w==="click"||w==="mousedown"||w==="keydown"||w==="keyup");m(y,I.nativeEvent,I.currentTarget,b)},onKeyDown(){A.current=void 0}}},[f,r,s,l,c,i,o,g,h,a]);return d.useMemo(()=>n?{reference:p}:it,[n,p])}function uh(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 c=s.width,f=s.height,A=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),A-=n||0,g-=r||0,c=0,f=0,!o||l?(c=t.axis==="y"?s.width:0,f=t.axis==="x"?s.height:0,A=i&&t.x!=null?t.x:A,g=a&&t.y!=null?t.y:g):o&&!l&&(f=t.axis==="x"?s.height:f,c=t.axis==="y"?s.width:c),o=!0,{width:c,height:f,x:A,y:g,top:g,right:A+c,bottom:g+f,left:A}}}}function za(e){return e!=null&&e.clientX!=null}function dh(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,c=d.useRef(!1),f=d.useRef(null),[A,g]=d.useState(),[h,p]=d.useState([]),m=de(y=>{o.set("positionReference",y)}),x=de((y,w,C)=>{c.current||l.current.openEvent&&!za(l.current.openEvent)||o.set("positionReference",uh(C??a,{x:y,y:w,axis:r,dataRef:l,pointerType:A}))}),I=de(y=>{s?f.current||(x(y.clientX,y.clientY,y.currentTarget),p([])):x(y.clientX,y.clientY,y.currentTarget)}),b=An(A)?i:s;d.useEffect(()=>{if(!n){m(a);return}if(!b)return;function y(){f.current?.(),f.current=null}const w=tt(i);function C(E){const R=At(E);ve(i,R)?y():x(E.clientX,E.clientY)}return!l.current.openEvent||za(l.current.openEvent)?f.current=Fe(w,"mousemove",C):m(a),y},[b,n,i,l,a,o,x,m,h]),d.useEffect(()=>()=>{o.set("positionReference",null)},[o]),d.useEffect(()=>{n&&!i&&(c.current=!1)},[n,i]),d.useEffect(()=>{!n&&s&&(c.current=!0)},[n,s]);const v=d.useMemo(()=>{function y(w){g(w.pointerType)}return{onPointerDown:y,onPointerEnter:y,onMouseMove:I,onMouseEnter:I}},[I]);return d.useMemo(()=>n?{reference:v,trigger:v}:{},[n,v])}function fh(){return!1}function ph(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Po(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:o=!0,outsidePressEvent:s="sloppy",referencePress:i=fh,bubbles:a,externalTree:l}=t,c="rootStore"in e?e.rootStore:e,f=c.useState("open"),A=c.useState("floatingElement"),{dataRef:g}=c.context,h=yn(l),p=de(typeof o=="function"?o:()=>!1),m=typeof o=="function"?p:o,x=m!==!1,I=de(()=>s),{escapeKey:b,outsidePress:v}=ph(a),y=d.useRef(!1),w=d.useRef(!1),C=d.useRef(!1),E=d.useRef(!1),R=d.useRef(""),S=d.useRef(null),k=ut(),F=ut(),B=de(()=>{F.clear(),g.current.insideReactTree=!1}),_=de(H=>{const Y=g.current.floatingContext?.nodeId;return(h?hn(h.nodesRef.current,Y):[]).some(z=>z.context?.open&&!z.context.dataRef.current[H])}),M=de(H=>$o(H,c.select("floatingElement"))||$o(H,c.select("domReferenceElement"))),D=de(H=>{i()&&c.setOpen(!1,Ce(Fn,H.nativeEvent))}),j=de(H=>{if(!f||!n||!r||H.key!=="Escape"||E.current||!b&&_("__escapeKeyBubbles"))return;const Y=fA(H)?H.nativeEvent:H,U=Ce(Co,Y);c.setOpen(!1,U),U.isCanceled||H.preventDefault(),!b&&!U.isPropagationAllowed&&H.stopPropagation()}),P=de(()=>{g.current.insideReactTree=!0,F.start(0,B)}),T=de(H=>{if(!f||!n||H.button!==0)return;const Y=At(H.nativeEvent);ve(c.select("floatingElement"),Y)&&(y.current||(y.current=!0,w.current=!1))}),N=de(H=>{!f||!n||(H.defaultPrevented||H.nativeEvent.defaultPrevented)&&y.current&&(w.current=!0)});d.useEffect(()=>{if(!f||!n)return B;g.current.__escapeKeyBubbles=b,g.current.__outsidePressBubbles=v;const H=new Nt,Y=new Nt;function U(){H.clear(),E.current=!0}function z(){H.start(sn?5:0,()=>{E.current=!1})}function L(){C.current=!0,Y.start(0,()=>{C.current=!1})}function Z(){y.current=!1,w.current=!1}function K(){const W=R.current,G=W==="pen"||!W?"mouse":W,be=I(),X=typeof be=="function"?be():be;return typeof X=="string"?X:X[G]}function ee(W){const G=K();return G==="intentional"&&W.type!=="click"||G==="sloppy"&&W.type==="click"}function ce(W){const G=g.current.floatingContext?.nodeId,be=h&&hn(h.nodesRef.current,G).some(X=>$o(W,X.context?.elements.floating));return M(W)||be}function ne(W){if(ee(W)){W.type!=="click"&&!M(W)&&(Y.clear(),C.current=!1),B();return}if(g.current.insideReactTree){B();return}const G=At(W),be=`[${gr("inert")}]`,X=Pe(G)?G.getRootNode():null,te=Array.from(($s(X)?X:Be(c.select("floatingElement"))).querySelectorAll(be)),Ee=c.context.triggerElements;if(G&&(Ee.hasElement(G)||Ee.hasMatchingElement(Le=>ve(Le,G))))return;let Se=Pe(G)?G:null;for(;Se&&!kn(Se);){const Le=Ln(Se);if(kn(Le)||!Pe(Le))break;Se=Le}if(!(te.length&&Pe(G)&&!cA(G)&&!ve(G,c.select("floatingElement"))&&te.every(Le=>!ve(Se,Le)))){if(Ve(G)&&!("touches"in W)){const Le=kn(G),Ye=jt(G),Oe=/auto|scroll/,at=Le||Oe.test(Ye.overflowX),qe=Le||Oe.test(Ye.overflowY),Ze=at&&G.clientWidth>0&&G.scrollWidth>G.clientWidth,dt=qe&&G.clientHeight>0&&G.scrollHeight>G.clientHeight,Ie=Ye.direction==="rtl",He=dt&&(Ie?W.offsetX<=G.offsetWidth-G.clientWidth:W.offsetX>G.clientWidth),_e=Ze&&W.offsetY>G.clientHeight;if(He||_e)return}if(!ce(W)){if(K()==="intentional"&&C.current){Y.clear(),C.current=!1;return}typeof m=="function"&&!m(W)||_("__outsidePressBubbles")||(c.setOpen(!1,Ce(yo,W)),B())}}}function $(W){K()!=="sloppy"||W.pointerType==="touch"||!c.select("open")||!n||M(W)||ne(W)}function q(W){if(K()!=="sloppy"||!c.select("open")||!n||M(W))return;const G=W.touches[0];G&&(S.current={startTime:Date.now(),startX:G.clientX,startY:G.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},k.start(1e3,()=>{S.current&&(S.current.dismissOnTouchEnd=!1,S.current.dismissOnMouseDown=!1)}))}function ue(W,G){const be=At(W);if(!be)return;const X=Fe(be,W.type,()=>{G(W),X()})}function le(W){R.current="touch",ue(W,q)}function Ae(W){k.clear(),W.type==="pointerdown"&&(R.current=W.pointerType),!(W.type==="mousedown"&&S.current&&!S.current.dismissOnMouseDown)&&ue(W,G=>{G.type==="pointerdown"?$(G):ne(G)})}function se(W){if(!y.current)return;const G=w.current;if(Z(),K()==="intentional"){if(W.type==="pointercancel"){G&&L();return}if(!ce(W)){if(G){L();return}typeof m=="function"&&!m(W)||(Y.clear(),C.current=!0,B())}}}function he(W){if(K()!=="sloppy"||!S.current||M(W))return;const G=W.touches[0];if(!G)return;const be=Math.abs(G.clientX-S.current.startX),X=Math.abs(G.clientY-S.current.startY),te=Math.sqrt(be*be+X*X);te>5&&(S.current.dismissOnTouchEnd=!0),te>10&&(ne(W),k.clear(),S.current=null)}function re(W){ue(W,he)}function oe(W){K()!=="sloppy"||!S.current||M(W)||(S.current.dismissOnTouchEnd&&ne(W),k.clear(),S.current=null)}function ae(W){ue(W,oe)}const ge=Be(A),me=Lt(r&&Lt(Fe(ge,"keydown",j),Fe(ge,"compositionstart",U),Fe(ge,"compositionend",z)),x&&Lt(Fe(ge,"click",Ae,!0),Fe(ge,"pointerdown",Ae,!0),Fe(ge,"pointerup",se,!0),Fe(ge,"pointercancel",se,!0),Fe(ge,"mousedown",Ae,!0),Fe(ge,"mouseup",se,!0),Fe(ge,"touchstart",le,!0),Fe(ge,"touchmove",re,!0),Fe(ge,"touchend",ae,!0)));return()=>{me(),H.clear(),Y.clear(),Z(),C.current=!1,B()}},[g,A,r,x,m,f,n,b,v,j,B,I,_,M,h,c,k]);const Q=d.useMemo(()=>({onKeyDown:j,onPointerDown:D,onClick:D}),[j,D]),O=d.useMemo(()=>({onKeyDown:j,onPointerDown:N,onMouseDown:N,onClickCapture:P,onMouseDownCapture(H){P(),T(H)},onPointerDownCapture(H){P(),T(H)},onMouseUpCapture:P,onTouchEndCapture:P,onTouchMoveCapture:P}),[j,P,T,N]);return d.useMemo(()=>n?{reference:Q,floating:O,trigger:Q}:{},[n,Q,O])}function Va(e,t,n){let{reference:r,floating:o}=e;const s=Ft(t),i=mi(t),a=gi(i),l=Mt(t),c=s==="y",f=r.x+r.width/2-o.width/2,A=r.y+r.height/2-o.height/2,g=r[a]/2-o[a]/2;let h;switch(l){case"top":h={x:f,y:r.y-o.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:A};break;case"left":h={x:r.x-o.width,y:A};break;default:h={x:r.x,y:r.y}}const p=bn(t);return p&&(h[i]+=g*(p==="end"?1:-1)*(n&&c?-1:1)),h}async function Ah(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:A="floating",altBoundary:g=!1,padding:h=0}=gn(t,e),p=Kc(h),x=a[g?A==="floating"?"reference":"floating":A],I=hr(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:c,rootBoundary:f,strategy:l})),b=A==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),y=await(s.isElement==null?void 0:s.isElement(v))&&await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1},w=hr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:v,strategy:l}):b);return{top:(I.top-w.top+p.top)/y.y,bottom:(w.bottom-I.bottom+p.bottom)/y.y,left:(I.left-w.left+p.left)/y.x,right:(w.right-I.right+p.right)/y.x}}const hh=50,gh=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:Ah},l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:A}=Va(c,r,l),g=r,h=0;const p={};for(let m=0;m<s.length;m++){const x=s[m];if(!x)continue;const{name:I,fn:b}=x,{x:v,y,data:w,reset:C}=await b({x:f,y:A,initialPlacement:r,placement:g,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});f=v??f,A=y??A,p[I]={...p[I],...w},C&&h<hh&&(h++,typeof C=="object"&&(C.placement&&(g=C.placement),C.rects&&(c=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:f,y:A}=Va(c,g,l)),m=-1)}return{x:f,y:A,placement:g,strategy:o,middlewareData:p}},mh=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:c}=t,{mainAxis:f=!0,crossAxis:A=!0,fallbackPlacements:g,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...x}=gn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const I=Mt(o),b=Ft(a),v=Mt(a)===a,y=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=g||(v||!m?[ao(a)]:gA(a)),C=p!=="none";!g&&C&&w.push(...vA(a,m,p,y));const E=[a,...w],R=await l.detectOverflow(t,x),S=[];let k=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&S.push(R[I]),A){const M=hA(o,i,y);S.push(R[M[0]],R[M[1]])}if(k=[...k,{placement:o,overflows:S}],!S.every(M=>M<=0)){var F,B;const M=(((F=s.flip)==null?void 0:F.index)||0)+1,D=E[M];if(D&&(!(A==="alignment"?b!==Ft(D):!1)||k.every(T=>Ft(T.placement)===b?T.overflows[0]>0:!0)))return{data:{index:M,overflows:k},reset:{placement:D}};let j=(B=k.filter(P=>P.overflows[0]<=0).sort((P,T)=>P.overflows[1]-T.overflows[1])[0])==null?void 0:B.placement;if(!j)switch(h){case"bestFit":{var _;const P=(_=k.filter(T=>{if(C){const N=Ft(T.placement);return N===b||N==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(N=>N>0).reduce((N,Q)=>N+Q,0)]).sort((T,N)=>T[1]-N[1])[0])==null?void 0:_[0];P&&(j=P);break}case"initialPlacement":j=a;break}if(o!==j)return{reset:{placement:j}}}return{}}}},Au=new Set(["left","top"]);async function xh(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Mt(n),a=bn(n),l=Ft(n)==="y",c=Au.has(i)?-1:1,f=s&&l?-1:1,A=gn(t,e);let{mainAxis:g,crossAxis:h,alignmentAxis:p}=typeof A=="number"?{mainAxis:A,crossAxis:0,alignmentAxis:null}:{mainAxis:A.mainAxis||0,crossAxis:A.crossAxis||0,alignmentAxis:A.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*f,y:g*c}:{x:g*c,y:h*f}}const bh=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 xh(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}}}}},vh=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:b=>{let{x:v,y}=b;return{x:v,y}}},...c}=gn(e,t),f={x:n,y:r},A=await s.detectOverflow(t,c),g=Ft(o),h=hi(g);let p=f[h],m=f[g];const x=(b,v)=>Hc(v+A[b==="y"?"top":"left"],v,v-A[b==="y"?"bottom":"right"]);i&&(p=x(h,p)),a&&(m=x(g,m));const I=l.fn({...t,[h]:p,[g]:m});return{...I,data:{x:I.x-n,y:I.y-r,enabled:{[h]:i,[g]:a}}}}}},yh=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:c=0,mainAxis:f=!0,crossAxis:A=!0}=gn(e,t),g={x:o,y:s},h=Ft(i),p=hi(h);let m=g[p],x=g[h];const I=gn(c,t),b=typeof I=="number"?{mainAxis:I,crossAxis:0}:{mainAxis:(n=I.mainAxis)!=null?n:0,crossAxis:(r=I.crossAxis)!=null?r:0};if(f){const w=p==="y"?"height":"width",C=a.reference[p]-a.floating[w]+b.mainAxis,E=a.reference[p]+a.reference[w]-b.mainAxis;m<C?m=C:m>E&&(m=E)}if(A){var v,y;const w=p==="y"?"width":"height",C=Au.has(Mt(i)),E=a.reference[h]-a.floating[w]+(C&&((v=l.offset)==null?void 0:v[h])||0)+(C?0:b.crossAxis),R=a.reference[h]+a.reference[w]+(C?0:((y=l.offset)==null?void 0:y[h])||0)-(C?b.crossAxis:0);x<E?x=E:x>R&&(x=R)}return{[p]:m,[h]:x}}}},Ch=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}=gn(e,t),l=await o.detectOverflow(t,a),c=Mt(n),f=bn(n),A=Ft(n)==="y",{width:g,height:h}=r.floating;let p,m;c==="top"||c==="bottom"?(p=c,m=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(m=c,p=f==="end"?"top":"bottom");const x=h-l.top-l.bottom,I=g-l.left-l.right,b=Qn(h-l[p],x),v=Qn(g-l[m],I),y=t.middlewareData.shift,w=!y;let C=b,E=v;y!=null&&y.enabled.x&&(E=I),y!=null&&y.enabled.y&&(C=x),w&&!f&&(A?E=g-2*tn(l.left,l.right):C=h-2*tn(l.top,l.bottom)),await i({...t,availableWidth:E,availableHeight:C});const R=await o.getDimensions(s.floating);return g!==R.width||h!==R.height?{reset:{rects:!0}}:{}}}};function hu(e){const t=jt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ve(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=io(n)!==s||io(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Bi(e){return Pe(e)?e:e.contextElement}function On(e){const t=Bi(e);if(!Ve(t))return nn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=hu(t);let i=(s?io(n.width):n.width)/r,a=(s?io(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Ih=nn(0);function gu(e){const t=tt(e);return!Rc()||!t.visualViewport?Ih:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function wh(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===tt(e)}function Rn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Bi(e);let i=nn(1);t&&(r?Pe(r)&&(i=On(r)):i=On(e));const a=wh(s,n,r)?gu(s):nn(0);let l=(o.left+a.x)/i.x,c=(o.top+a.y)/i.y,f=o.width/i.x,A=o.height/i.y;if(s&&r){const g=tt(s),h=Pe(r)?tt(r):r;let p=g,m=wa(p);for(;m&&h!==p;){const x=On(m),I=m.getBoundingClientRect(),b=jt(m),v=I.left+(m.clientLeft+parseFloat(b.paddingLeft))*x.x,y=I.top+(m.clientTop+parseFloat(b.paddingTop))*x.y;l*=x.x,c*=x.y,f*=x.x,A*=x.y,l+=v,c+=y,p=tt(m),m=wa(p)}}return hr({width:f,height:A,x:l,y:c})}function To(e,t){const n=Io(e).scrollLeft;return t?t.left+n:Rn(xn(e)).left+n}function mu(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-To(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function kh(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=xn(r),a=t?Xs(t.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=nn(1);const f=nn(0),A=Ve(r);if((A||!s)&&((wt(r)!=="body"||qs(i))&&(l=Io(r)),A)){const h=Rn(r);c=On(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}const g=i&&!A&&!s?mu(i,l):nn(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+g.x,y:n.y*c.y-l.scrollTop*c.y+f.y+g.y}}function Eh(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Sh(e){const t=Io(e),n=e.ownerDocument.body,r=tn(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=tn(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+To(e);const i=-t.scrollTop;return jt(n).direction==="rtl"&&(s+=tn(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:s,y:i}}const Rh=25;function Dh(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=tt(e),s=xn(e),i=o.visualViewport;let a=s.clientWidth,l=s.clientHeight,c=0,f=0;if(i){const g=!Rc()||t==="fixed";r?g||(c=-i.offsetLeft,f=-i.offsetTop):(a=i.width,l=i.height,g&&(c=i.offsetLeft,f=i.offsetTop))}if(To(s)<=0){const g=s.ownerDocument,h=g.body,p=getComputedStyle(h),m=g.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,x=Math.abs(s.clientWidth-h.clientWidth-m),I=getComputedStyle(s).scrollbarGutter==="stable both-edges"?x/2:x;I<=Rh&&(a-=I)}return{width:a,height:l,x:c,y:f}}function Fh(e,t){const n=Rn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=On(e),i=e.clientWidth*s.x,a=e.clientHeight*s.y,l=o*s.x,c=r*s.y;return{width:i,height:a,x:l,y:c}}function Za(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Dh(e,n,t);else if(t==="document")r=Sh(xn(e));else if(Pe(t))r=Fh(t,n);else{const o=gu(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return hr(r)}function Bh(e,t){const n=t.get(e);if(n)return n;let r=Is(e,[],!1).filter(a=>Pe(a)&&wt(a)!=="body"),o=null;const s=jt(e).position==="fixed";let i=s?Ln(e):e;for(;Pe(i)&&!kn(i);){const a=jt(i),l=Sc(i),c=o?o.position:s?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?r=r.filter(A=>A!==i):o=a,i=Ln(i)}return t.set(e,r),r}function Mh(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Xs(t)?[]:Bh(t,this._c):[].concat(n),r],a=Za(t,i[0],o);let l=a.top,c=a.right,f=a.bottom,A=a.left;for(let g=1;g<i.length;g++){const h=Za(t,i[g],o);l=tn(h.top,l),c=Qn(h.right,c),f=Qn(h.bottom,f),A=tn(h.left,A)}return{width:c-A,height:f-l,x:A,y:l}}function Ph(e){const{width:t,height:n}=hu(e);return{width:t,height:n}}function Th(e,t,n){const r=Ve(t),o=xn(t),s=n==="fixed",i=Rn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=nn(0);if((r||!s)&&((wt(t)!=="body"||qs(o))&&(a=Io(t)),r)){const g=Rn(t,!0,s,t);l.x=g.x+t.clientLeft,l.y=g.y+t.clientTop}!r&&o&&(l.x=To(o));const c=o&&!r&&!s?mu(o,a):nn(0),f=i.left+a.scrollLeft-l.x-c.x,A=i.top+a.scrollTop-l.y-c.y;return{x:f,y:A,width:i.width,height:i.height}}function os(e){return jt(e).position==="static"}function Ja(e,t){if(!Ve(e)||jt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return xn(e)===n&&(n=n.ownerDocument.body),n}function xu(e,t){const n=tt(e);if(Xs(e))return n;if(!Ve(e)){let o=Ln(e);for(;o&&!kn(o);){if(Pe(o)&&!os(o))return o;o=Ln(o)}return n}let r=Ja(e,t);for(;r&&Xf(r)&&os(r);)r=Ja(r,t);return r&&kn(r)&&os(r)&&!Sc(r)?n:r||qf(e)||n}const _h=async function(e){const t=this.getOffsetParent||xu,n=this.getDimensions,r=await n(e.floating);return{reference:Th(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function jh(e){return jt(e).direction==="rtl"}const bu={convertOffsetParentRelativeRectToViewportRelativeRect:kh,getDocumentElement:xn,getClippingRect:Mh,getOffsetParent:xu,getElementRects:_h,getClientRects:Eh,getDimensions:Ph,getScale:On,isElement:Pe,isRTL:jh};function vu(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Nh(e,t,n){let r=null,o;const s=xn(e);function i(){var f;clearTimeout(o),(f=r)==null||f.disconnect(),r=null}function a(f,A){f===void 0&&(f=!1),A===void 0&&(A=1),i();const g=e.getBoundingClientRect(),{left:h,top:p,width:m,height:x}=g;if(f||t(),!m||!x)return;const I=Tr(p),b=Tr(s.clientWidth-(h+m)),v=Tr(s.clientHeight-(p+x)),y=Tr(h),C={rootMargin:-I+"px "+-b+"px "+-v+"px "+-y+"px",threshold:tn(0,Qn(1,A))||1};let E=!0;function R(S){const k=S[0].intersectionRatio;if(!vu(g,e.getBoundingClientRect()))return a();if(k!==A){if(!E)return a();k?a(!1,k):o=setTimeout(()=>{a(!1,1e-7)},1e3)}E=!1}try{r=new IntersectionObserver(R,{...C,root:s.ownerDocument})}catch{r=new IntersectionObserver(R,C)}r.observe(e)}const l=tt(e),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),i()}}function $a(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,c=Bi(e),f=o||s?[...c?Is(c):[],...t?Is(t):[]]:[];f.forEach(I=>{o&&I.addEventListener("scroll",n),s&&I.addEventListener("resize",n)});const A=c&&a?Nh(c,n,s):null;let g=-1,h=null;i&&(h=new ResizeObserver(I=>{let[b]=I;b&&b.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var v;(v=h)==null||v.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let p,m=l?Rn(e):null;l&&x();function x(){const I=Rn(e);m&&!vu(m,I)&&n(),m=I,p=requestAnimationFrame(x)}return n(),()=>{var I;f.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),A?.(),(I=h)==null||I.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const Oh=bh,Hh=vh,Kh=mh,Wh=Ch,Lh=yh,Qh=(e,t,n)=>{const r=new Map,o=n??{},s={...bu,...o.platform,_c:r};return gh(e,t,{...o,platform:s})};var Gh=typeof document<"u",Yh=function(){},eo=Gh?d.useLayoutEffect:Yh;function uo(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(!uo(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)&&!uo(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function yu(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Xa(e,t){const n=yu(e);return Math.round(t*n)/n}function ss(e){const t=d.useRef(e);return eo(()=>{t.current=e}),t}function Uh(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:c}=e,[f,A]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,h]=d.useState(r);uo(g,r)||h(r);const[p,m]=d.useState(null),[x,I]=d.useState(null),b=d.useCallback(T=>{T!==C.current&&(C.current=T,m(T))},[]),v=d.useCallback(T=>{T!==E.current&&(E.current=T,I(T))},[]),y=s||p,w=i||x,C=d.useRef(null),E=d.useRef(null),R=d.useRef(f),S=l!=null,k=ss(l),F=ss(o),B=ss(c),_=d.useCallback(()=>{if(!C.current||!E.current)return;const T={placement:t,strategy:n,middleware:g};F.current&&(T.platform=F.current),Qh(C.current,E.current,T).then(N=>{const Q={...N,isPositioned:B.current!==!1};M.current&&!uo(R.current,Q)&&(R.current=Q,on.flushSync(()=>{A(Q)}))})},[g,t,n,F,B]);eo(()=>{c===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,A(T=>({...T,isPositioned:!1})))},[c]);const M=d.useRef(!1);eo(()=>(M.current=!0,()=>{M.current=!1}),[]),eo(()=>{if(y&&(C.current=y),w&&(E.current=w),y&&w){if(k.current)return k.current(y,w,_);_()}},[y,w,_,k,S]);const D=d.useMemo(()=>({reference:C,floating:E,setReference:b,setFloating:v}),[b,v]),j=d.useMemo(()=>({reference:y,floating:w}),[y,w]),P=d.useMemo(()=>{const T={position:n,left:0,top:0};if(!j.floating)return T;const N=Xa(j.floating,f.x),Q=Xa(j.floating,f.y);return a?{...T,transform:"translate("+N+"px, "+Q+"px)",...yu(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:N,top:Q}},[n,a,j.floating,f.x,f.y]);return d.useMemo(()=>({...f,update:_,refs:D,elements:j,floatingStyles:P}),[f,_,D,j,P])}const zh=(e,t)=>{const n=Oh(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vh=(e,t)=>{const n=Hh(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zh=(e,t)=>({fn:Lh(e).fn,options:[e,t]}),Jh=(e,t)=>{const n=Kh(e);return{name:n.name,fn:n.fn,options:[e,t]}},$h=(e,t)=>{const n=Wh(e);return{name:n.name,fn:n.fn,options:[e,t]}};var is={exports:{}},as={};var qa;function Xh(){if(qa)return as;qa=1;var e=kc(),t=$c();function n(c,f){return c===f&&(c!==0||1/c===1/f)||c!==c&&f!==f}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 as.useSyncExternalStoreWithSelector=function(c,f,A,g,h){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 I(C){if(!b){if(b=!0,v=C,C=g(C),h!==void 0&&m.hasValue){var E=m.value;if(h(E,C))return y=E}return y=C}if(E=y,r(v,C))return E;var R=g(C);return h!==void 0&&h(E,R)?(v=C,E):(v=C,y=R)}var b=!1,v,y,w=A===void 0?null:A;return[function(){return I(f())},w===null?void 0:function(){return I(w())}]},[f,A,g,h]);var x=o(c,p[0],p[1]);return i(function(){m.hasValue=!0,m.value=x},[x]),l(x),x},as}var el;function qh(){return el||(el=1,is.exports=Xh()),is.exports}var eg=qh();const Ps=[];let Ts;function tg(){return Ts}function ng(e){Ps.push(e)}function Mi(e){const t=(n,r)=>{const o=Et(rg).current;let s;try{Ts=o;for(const i of Ps)i.before(o);s=e(n,r);for(const i of Ps)i.after(o);o.didInitialize=!0}finally{Ts=void 0}return s};return t.displayName=e.displayName||e.name,t}function Cu(e){return d.forwardRef(Mi(e))}function rg(){return{didInitialize:!1}}const og=Ec(19),sg=og?ag:lg;function we(e,t,n,r,o){return sg(e,t,n,r,o)}function ig(e,t,n,r,o){const s=d.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return Bo.useSyncExternalStore(e.subscribe,s,s)}ng({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()}}),Bo.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function ag(e,t,n,r,o){const s=tg();if(!s)return ig(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 lg(e,t,n,r,o){return eg.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class cg{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 Dr extends cg{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??pr);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 ug={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 _o extends Dr{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:cu(),nested:r,triggerElements:s},ug),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&pA(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 Iu(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:o,nested:s,onOpenChange:i}=e,a=t.useState("open"),l=t.useState("activeTriggerElement"),c=t.useState(n?"popupElement":"positionerElement"),f=t.context.triggerElements,A=i,g=d.useRef(null);r===void 0&&g.current===null&&(g.current=new _o({open:a,transitionStatus:void 0,referenceElement:l,floatingElement:c,triggerElements:f,onOpenChange:A,floatingId:o,syncOnly:!0,nested:s}));const h=r??g.current;return t.useSyncedValue("floatingId",o),ie(()=>{const p={open:a,floatingId:o,referenceElement:l,floatingElement:c};Pe(l)&&(p.domReferenceElement=l),h.state.positionReference===h.state.referenceElement&&(p.positionReference=l),h.update(p)},[a,o,l,c,h]),h.context.onOpenChange=A,h.context.nested=s,h}const jo={tabIndex:-1,[Es]:""};function dg(e){return t=>t==="touch"?e.current:!0}function wu(e,t=!1){const n=Wn(),r=vn()!=null,o=Et(()=>e(n,r)).current;return Iu({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:o.setOpen}),o}function Pi({handle:e,store:t}){return ie(()=>e.attachStore(t),[e,t]),null}function fg(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,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 Ti(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 ku(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function pg(e,t,n,r={}){const o=n.reason,s=o===ot,i=t&&o===jn,a=!t&&(o===Fn||o===Co),l=ku(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);const c=()=>{const f={...r.extraState,open:t};i?f.instantType="focus":a?f.instantType="dismiss":s&&(f.instantType=void 0),Ti(f,t,n.trigger,l()),e.update(f)};s?on.flushSync(c):c()}function Eu(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=fg(e,n),i=de(l=>{const c=n.select("open"),f=n.select("activeTriggerId");if(f===e){n.update({activeTriggerElement:l,...c?r:null});return}f==null&&c&&n.update({activeTriggerId:e,activeTriggerElement:l,...r})}),a=d.useCallback(l=>{s(l),l&&i(l)},[s,i]);return ie(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:a,isMountedByThisTrigger:o}}function _i(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 l=e.context.triggerElements.size,c={};e.state.triggerCount!==l&&(c.triggerCount=l);const f=e.select("activeTriggerId");let A=null;if(f){const g=e.context.triggerElements.getById(f);if(g)r.current=f,g!==e.state.activeTriggerElement&&(c.activeTriggerElement=g);else{for(const[h,p]of e.context.triggerElements.entries())if(p===e.state.activeTriggerElement){c.activeTriggerId=h,c.activeTriggerElement=p,r.current=h;break}c.activeTriggerId===void 0&&(r.current===f?A=f:r.current=null)}}else r.current=null;if(!A&&!f&&l===1){const g=e.context.triggerElements.entries().next();if(!g.done){const[h,p]=g.value;c.activeTriggerId=h,c.activeTriggerElement=p,r.current=h}}(c.triggerCount!==void 0||c.activeTriggerId!==void 0||c.activeTriggerElement!==void 0)&&e.update(c),A&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===A&&!e.context.triggerElements.getById(A)){const g=Ce(Pt);e.setOpen(!1,g),g.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,s,i,a,n])}function ji(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=Jn(e),i=t.useState("preventUnmountingOnClose"),a=e?!1:i;t.useSyncedValues({mounted:r,transitionStatus:s,preventUnmountingOnClose:a});const l=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||l()}}),{forceUnmount:l,transitionStatus:s}}function Ni(e,t){e.useSyncedValues(t),ie(()=>()=>{e.update({activeTriggerProps:it,inactiveTriggerProps:it,popupProps:it})},[e])}function Ag(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 Fr{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 hg(){return new _o({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Fr,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function Oi(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:hg(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:it,inactiveTriggerProps:it,popupProps:it}}function Su(e,t,n=!1){return new _o({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}const dr=e=>e.triggerIdProp??e.activeTriggerId,Hi=e=>e.openProp??e.open,tl=e=>(e.popupElement?.id??e.floatingId)||void 0;function Ru(e,t){return t!==void 0&&Hi(e)&&dr(e)===t}function gg(e,t){return Ru(e,t)?!0:t!==void 0&&Hi(e)&&dr(e)==null&&e.triggerCount===1}const Ki={open:Hi,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:dr,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:tl,isTriggerActive:(e,t)=>t!==void 0&&dr(e)===t,isOpenedByTrigger:(e,t)=>Ru(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&dr(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>gg(e,t)?tl(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Du(e){const t=d.useCallback(r=>e===void 0?pr:e.subscribeStore(r),[e]),n=d.useCallback(()=>e===void 0?void 0:e.store,[e]);return Bo.useSyncExternalStore(t,n,()=>e?.serverStore)}function mg(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Wn(),s=vn()!=null,i=Et(()=>new _o({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Fr,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 xg(e){return bg(e,e.rootContext)}function bg(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"),[c,f]=d.useState(null),[A,g]=d.useState(void 0),[h,p]=d.useState(void 0),m=d.useRef(null),x=yn(r),I=d.useMemo(()=>({reference:o,floating:s,domReference:i}),[o,s,i]),b=Uh({...e,elements:{...I,...c&&{reference:c}}}),v=Pe(A)?A:null,y=h===void 0?t.state.floatingElement:h;t.useSyncedValue("referenceElement",A??null),t.useSyncedValue("domReferenceElement",A===void 0?i:v),t.useSyncedValue("floatingElement",y);const w=d.useCallback(F=>{const B=Pe(F)?{getBoundingClientRect:()=>F.getBoundingClientRect(),getClientRects:()=>F.getClientRects(),contextElement:F}:F;f(B),b.refs.setReference(B)},[b.refs]),C=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]),E=d.useCallback(F=>{p(F),b.refs.setFloating(F)},[b.refs]),R=d.useMemo(()=>({...b.refs,setReference:C,setFloating:E,setPositionReference:w,domReference:m}),[b.refs,C,E,w]),S=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:l,refs:R,elements:S,nodeId:n,rootStore:t}),[b,R,S,n,t,a,l]);return ie(()=>{i&&(m.current=i)},[i]),ie(()=>{t.context.dataRef.current.floatingContext=k;const F=x?.nodesRef.current.find(B=>B.id===n);F&&(F.context=k)}),d.useMemo(()=>({...b,context:k,refs:R,elements:S,rootStore:t}),[b,R,S,k,t])}const ls=ui&&sn;function Fu(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),l=d.useRef(null),c=d.useRef(!0),f=ut();d.useEffect(()=>{const g=o.select("domReferenceElement");if(!n)return;const h=tt(g);function p(){const I=o.select("domReferenceElement");!o.select("open")&&Ve(I)&&I===bt(Be(I))&&(a.current=!0)}function m(){c.current=!0}function x(){c.current=!1}return Lt(Fe(h,"blur",p),ls&&Fe(h,"keydown",m,!0),ls&&Fe(h,"pointerdown",x,!0))},[o,n]),d.useEffect(()=>{if(!n)return;function g(h){if(h.reason===Fn||h.reason===Co){const p=o.select("domReferenceElement");Pe(p)&&(l.current=p,a.current=!0)}}return s.on("openchange",g),()=>{s.off("openchange",g)}},[s,n,o]);const A=d.useMemo(()=>{function g(){a.current=!1,l.current=null}return{onMouseLeave(){g()},onFocus(h){const p=h.currentTarget;if(a.current){if(l.current===p)return;g()}const m=At(h.nativeEvent);if(Pe(m)){if(ls&&!h.relatedTarget){if(!c.current&&!Do(m))return}else if(!dA(m))return}const x=oo(h.relatedTarget,o.context.triggerElements),{nativeEvent:I,currentTarget:b}=h,v=typeof r=="function"?r():r;if(o.select("open")&&x||v===0||v===void 0){o.setOpen(!0,Ce(jn,I,b));return}f.start(v,()=>{a.current||o.setOpen(!0,Ce(jn,I,b))})},onBlur(h){g();const p=h.relatedTarget,m=h.nativeEvent,x=Pe(p)&&p.hasAttribute(gr("focus-guard"))&&p.getAttribute("data-type")==="outside";f.start(0,()=>{const I=o.select("domReferenceElement"),b=bt(Be(I));!p&&b===I||ve(i.current.floatingContext?.refs.floating.current,b)||ve(I,b)||x||oo(p??b,o.context.triggerElements)||o.setOpen(!1,Ce(jn,m))})}}},[i,r,o,f]);return d.useMemo(()=>n?{reference:A,trigger:A}:{},[n,A])}class Wi{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 Nt,this.restTimeout=new Nt,this.handleCloseOptions=void 0}static create(){return new Wi}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fo=new WeakMap;function po(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 Bu(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,s=fo.get(n);s&&s!==e&&po(s),po(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 Li(e){const t=e.context.dataRef.current,n=Et(()=>t.hoverInteractionState??Wi.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),vi(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Mu(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:c}=s.context,f=yn(),A=vn(),g=Li(s),h=ut(),p=de(()=>tu(c.current.openEvent?.type,g.interactedInside)),m=de(()=>zA(c.current.openEvent?.type)),x=de(()=>{po(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(l)&&a){const I=l,b=a,v=Be(a),y=f?.nodesRef.current.find(R=>R.id===A)?.context?.elements.floating;y&&(y.style.pointerEvents="");const w=g.pointerEventsScopeElement!==b?g.pointerEventsScopeElement:null,C=y!==b?y:null,E=g.handleCloseOptions?.getScope?.()??w??C??I.closest("[data-rootownerid]")??v.body;return Bu(g,{scopeElement:E,referenceElement:I,floatingElement:b}),()=>{x()}}},[n,i,l,a,g,m,f,A,x]),d.useEffect(()=>{if(!n)return;function I(){return!!(f&&A&&hn(f.nodesRef.current,A).length>0)}function b(R){const S=Yn(r,"close",g.pointerType),k=()=>{s.setOpen(!1,Ce(ot,R)),f?.events.emit("floating.closed",R)};S?g.openChangeTimeout.start(S,k):(g.openChangeTimeout.clear(),k())}function v(R){const S=At(R);if(!uA(S)){g.interactedInside=!1;return}g.interactedInside=S?.closest("[aria-haspopup]")!=null}function y(){g.openChangeTimeout.clear(),h.clear(),f?.events.off("floating.closed",C),x()}function w(R){if(I()&&f){f.events.on("floating.closed",C);return}if(oo(R.relatedTarget,s.context.triggerElements))return;const S=c.current.floatingContext?.nodeId??o,k=R.relatedTarget;if(!(f&&S&&Pe(k)&&hn(f.nodesRef.current,S,!1).some(B=>ve(B.context?.elements.floating,k)))){if(g.handler){g.handler(R);return}x(),m()&&!p()&&b(R)}}function C(R){!f||!A||I()||h.start(0,()=>{f.events.off("floating.closed",C),s.setOpen(!1,Ce(ot,R)),f.events.emit("floating.closed",R)})}const E=a;return Lt(E&&Fe(E,"mouseenter",y),E&&Fe(E,"mouseleave",w),E&&Fe(E,"pointerdown",v,!0),()=>{f?.events.off("floating.closed",C)})},[n,a,s,c,r,o,m,p,x,g,f,A,h])}const vg={current:null};function Pu(e,t={}){const{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:s=!1,restMs:i=0,move:a=!0,triggerElementRef:l=vg,externalTree:c,isActiveTrigger:f=!0,getHandleCloseContext:A,isClosing:g,shouldOpen:h,guardStaleOpen:p=!1}=t,m="rootStore"in e?e.rootStore:e,{dataRef:x,events:I}=m.context,b=yn(c),v=Li(m),y=d.useRef(!1),w=Xe(o),C=Xe(r),E=Xe(i),R=Xe(n),S=Xe(h),k=Xe(g),F=de(()=>tu(x.current.openEvent?.type,v.interactedInside)),B=de(()=>S.current?.()!==!1),_=de((j,P,T)=>{const N=m.context.triggerElements;if(N.hasElement(P))return!j||!ve(j,P);if(!Pe(T))return!1;const Q=T;return N.hasMatchingElement(O=>ve(O,Q))&&(!j||!ve(j,Q))}),M=de(()=>{if(!v.handler)return;Be(m.select("domReferenceElement")).removeEventListener("mousemove",v.handler),v.handler=void 0}),D=de(()=>{po(v)});return f&&(v.handleCloseOptions=w.current?.__options),d.useEffect(()=>M,[M]),d.useEffect(()=>{if(!n)return;function j(P){P.open?y.current=!1:(y.current=P.reason===ot,M(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return I.on("openchange",j),()=>{I.off("openchange",j)}},[n,I,v,M]),d.useEffect(()=>{if(!n)return;function j(H,Y=!0){const U=Yn(C.current,"close",v.pointerType);U?v.openChangeTimeout.start(U,()=>{m.setOpen(!1,Ce(ot,H)),b?.events.emit("floating.closed",H)}):Y&&(v.openChangeTimeout.clear(),m.setOpen(!1,Ce(ot,H)),b?.events.emit("floating.closed",H))}const P=l.current??(f?m.select("domReferenceElement"):null);if(!Pe(P))return;function T(H){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,s&&!An(v.pointerType))return;const Y=Na(E.current),U=Yn(C.current,"open",v.pointerType),z=At(H),L=H.currentTarget??null,Z=m.select("domReferenceElement");let K=L;if(Pe(z)&&!m.context.triggerElements.hasElement(z)){for(const se of m.context.triggerElements.elements())if(ve(se,z)){K=se;break}}Pe(L)&&Pe(Z)&&!m.context.triggerElements.hasElement(L)&&ve(L,Z)&&(K=Z);const ee=K==null?!1:_(Z,K,z),ce=m.select("open"),ne=k.current?.()??m.select("transitionStatus")==="ending",$=!ce&&ne&&y.current,q=!ee&&Pe(K)&&Pe(Z)&&ve(Z,K)&&$,ue=Y>0&&!U,le=ee&&(ce||$)||q,Ae=!ce||ee;if(le){B()&&m.setOpen(!0,Ce(ot,H,K));return}ue||(U?v.openChangeTimeout.start(U,()=>{Ae&&B()&&m.setOpen(!0,Ce(ot,H,K))}):Ae&&B()&&m.setOpen(!0,Ce(ot,H,K)))}function N(H){if(F()){D();return}M();const Y=m.select("domReferenceElement"),U=Be(Y);v.restTimeout.clear(),v.restTimeoutPending=!1;const z=x.current.floatingContext??A?.();if(oo(H.relatedTarget,m.context.triggerElements))return;if(w.current&&z){m.select("open")||v.openChangeTimeout.clear();const Z=l.current;v.handler=w.current({...z,tree:b,x:H.clientX,y:H.clientY,onClose(){D(),M(),R.current&&!F()&&Z===m.select("domReferenceElement")&&j(H,!0)}}),U.addEventListener("mousemove",v.handler),v.handler(H);return}(v.pointerType!=="touch"||!ve(m.select("floatingElement"),H.relatedTarget))&&j(H)}function Q(H){ve(P,H.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}const O=p?Fe(P,"mouseout",Q):void 0;return a?Lt(Fe(P,"mousemove",T,{once:!0}),Fe(P,"mouseenter",T),Fe(P,"mouseleave",N),O):Lt(Fe(P,"mouseenter",T),Fe(P,"mouseleave",N),O)},[M,D,x,C,m,n,w,v,f,_,F,s,a,E,l,b,R,A,k,B,p]),d.useMemo(()=>{if(!n)return;function j(P){v.pointerType=P.pointerType}return{onPointerDown:j,onPointerEnter:j,onMouseMove(P){const{nativeEvent:T}=P,N=P.currentTarget,Q=m.select("domReferenceElement"),O=m.select("open"),H=_(Q,N,P.target);if(s&&!An(v.pointerType))return;if(O&&H&&v.handleCloseOptions?.blockPointerEvents){const z=m.select("floatingElement");if(z){const L=v.handleCloseOptions?.getScope?.()??N.ownerDocument.body;Bu(v,{scopeElement:L,referenceElement:N,floatingElement:z})}}const Y=Na(E.current);if(O&&!H||Y===0||!H&&v.restTimeoutPending&&P.movementX**2+P.movementY**2<2)return;v.restTimeout.clear();function U(){if(v.restTimeoutPending=!1,F())return;const z=m.select("open");!v.blockMouseMove&&(!z||H)&&B()&&m.setOpen(!0,Ce(ot,T,N))}v.pointerType==="touch"?on.flushSync(()=>{U()}):H&&O?U():(v.restTimeoutPending=!0,v.restTimeout.start(Y,U))}}},[n,v,F,_,s,m,E,B])}const yg="Escape";function nl(e){return sn&&e.movementX===0&&e.movementY===0}function No(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Or(e,t){return No(t,e===Oc||e===fi,e===So||e===Ro)}function cs(e,t,n){return No(t,e===fi,n?e===So:e===Ro)||e==="Enter"||e===" "||e===""}function Cg(e,t,n){return No(t,n?e===So:e===Ro,e===fi)}function Ig(e,t,n,r){const o=n?e===Ro:e===So,s=e===Oc;return t==="both"||t==="horizontal"&&r?e===yg:No(t,o,s)}function Tu(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:a=!1,loopFocus:l=!1,nested:c=!1,rtl:f=!1,virtual:A=!1,focusItemOnOpen:g="auto",focusItemOnHover:h=!0,openOnArrowKeyDown:p=!0,disabledIndices:m=void 0,orientation:x="vertical",parentOrientation:I,id:b,resetOnPointerLeave:v=!0,externalTree:y,grid:w}=t,C=w!=null,E="rootStore"in e?e.rootStore:e,R=E.useState("open"),S=E.useState("floatingElement"),k=E.useState("domReferenceElement"),F=E.context.dataRef,B=so(S),_=Ss(k),M=Xe(B),D=vn(),j=yn(y),P=d.useRef(g),T=d.useRef(i??-1),N=d.useRef(null),Q=d.useRef(!0),O=de(W=>{o(T.current===-1?null:T.current,W)}),H=d.useRef(!!S),Y=d.useRef(R),U=d.useRef(!1),z=d.useRef(!1),L=d.useRef(null),Z=Xe(m),K=Xe(R),ee=Xe(i),ce=Xe(v),ne=Gn(),$=Gn(),q=de(()=>{function W(te){A?j?.events.emit("virtualfocus",te):L.current=qr(te,{sync:U.current,preventScroll:!0})}const G=n.current[T.current],be=z.current;G&&W(G),(U.current?te=>te():te=>ne.request(te))(()=>{const te=n.current[T.current]||G;if(!te)return;G||W(te),re&&(be||!Q.current)&&te.scrollIntoView?.({block:"nearest",inline:"nearest"})})});ie(()=>{F.current.orientation=x},[F,x]),ie(()=>{s&&(R&&S?(T.current=i??-1,P.current&&i!=null&&(z.current=!0,O())):H.current&&(T.current=-1,O()))},[s,R,S,i,O]),ie(()=>{if(s){if(!R){U.current=!1;return}if(S)if(r==null){if(U.current=!1,ee.current!=null)return;if(H.current&&(T.current=-1,q()),(!Y.current||!H.current)&&P.current&&(N.current!=null||P.current===!0&&N.current==null)){let W=0;const G=()=>{n.current[0]==null?(W<2&&(W?X=>$.request(X):queueMicrotask)(G),W+=1):(T.current=N.current==null||cs(N.current,x,f)||c?Xr(n):Ds(n),N.current=null,O())};G()}}else ur(n.current,r)||(T.current=r,q(),z.current=!1)}},[s,R,S,r,ee,c,n,x,f,O,q,$]),ie(()=>{if(!s||S||!j||A||!H.current)return;const W=j.nodesRef.current,G=W.find(te=>te.id===D)?.context?.elements.floating,be=bt(Be(k??G??null)),X=W.some(te=>te.context&&ve(te.context.elements.floating,be));G&&!X&&Q.current&&G.focus({preventScroll:!0})},[s,S,k,j,D,A]),ie(()=>{Y.current=R,H.current=!!S}),ie(()=>{R||(N.current=null,P.current=g)},[R,g]);const ue=r!=null,le=de(W=>{if(!K.current)return;const G=n.current.indexOf(W.currentTarget);G!==-1&&(T.current!==G||r!==G)&&(T.current=G,O(W))}),Ae=de(()=>I??j?.nodesRef.current.find(W=>W.id===D)?.context?.dataRef?.current.orientation),se=de(()=>Xr(n,Z.current)),he=de(W=>{if(Q.current=!1,U.current=!0,W.which===229||!K.current&&W.currentTarget===M.current)return;if(c&&Ig(W.key,x,f,C)){Or(W.key,Ae())||Ht(W),E.setOpen(!1,Ce(ws,W.nativeEvent)),Ve(k)&&(A?j?.events.emit("virtualfocus",k):k.focus());return}const G=T.current,be=Xr(n,m),X=Ds(n,m);if(_||(W.key==="Home"&&(Ht(W),T.current=be,O(W)),W.key==="End"&&(Ht(W),T.current=X,O(W))),w!=null){const te=w(W,T.current,n,x,l,f,m,be,X);if(te!=null&&(T.current=te,O(W)),x==="both")return}if(Or(W.key,x)){if(Ht(W),R&&!A&&bt(W.currentTarget.ownerDocument)===W.currentTarget){T.current=cs(W.key,x,f)?be:X,O(W);return}cs(W.key,x,f)?l?G>=X?a&&G!==n.current.length?T.current=-1:(U.current=!1,T.current=be):T.current=en(n.current,{startingIndex:G,disabledIndices:m}):T.current=Math.min(X,en(n.current,{startingIndex:G,disabledIndices:m})):l?G<=be?a&&G!==-1?T.current=n.current.length:(U.current=!1,T.current=X):T.current=en(n.current,{startingIndex:G,decrement:!0,disabledIndices:m}):T.current=Math.max(be,en(n.current,{startingIndex:G,decrement:!0,disabledIndices:m})),ur(n.current,T.current)&&(T.current=-1),O(W)}}),re=d.useMemo(()=>({onFocus(G){U.current=!0,le(G)},onClick:({currentTarget:G})=>G.focus({preventScroll:!0}),onMouseMove(G){nl(G)||(U.current=!0,z.current=!1,h&&le(G))},onPointerLeave(G){if(!K.current||!Q.current||G.pointerType==="touch")return;U.current=!0;const be=G.relatedTarget;if(!(!h||n.current.includes(be))&&ce.current&&(L.current?.(),L.current=null,T.current=-1,O(G),!A)){const X=M.current,te=bt(Be(X));X&&ve(X,te)&&X.focus({preventScroll:!0})}}}),[le,K,M,h,n,O,ce,A]),oe=d.useMemo(()=>A&&R&&ue&&{"aria-activedescendant":`${b}-${r}`},[A,R,ue,b,r]),ae=d.useMemo(()=>({"aria-orientation":x==="both"?void 0:x,..._?{}:oe,onKeyDown(W){if(W.key==="Tab"&&W.shiftKey&&R&&!A){const G=At(W.nativeEvent);if(G&&!ve(M.current,G))return;Ht(W),E.setOpen(!1,Ce(Sn,W.nativeEvent)),Ve(k)&&k.focus();return}he(W)},onPointerMove(W){nl(W)||(Q.current=!0)}}),[oe,he,M,x,_,E,R,A,k]),ge=d.useMemo(()=>{function W(X){E.setOpen(!0,Ce(ws,X.nativeEvent,X.currentTarget))}function G(X){g==="auto"&&pi(X.nativeEvent)&&(P.current=!A)}function be(X){P.current=g,g==="auto"&&Ai(X.nativeEvent)&&(P.current=!0)}return{onKeyDown(X){const te=E.select("open");Q.current=!1;const Ee=X.key.startsWith("Arrow"),Se=Cg(X.key,Ae(),f),Le=Or(X.key,x),Ye=(c?Se:Le)||X.key==="Enter"||X.key.trim()==="";if(A&&te)return he(X);if(!(!te&&!p&&Ee)){if(Ye){const Oe=Or(X.key,Ae());N.current=c&&Oe?null:X.key}if(c){Se&&(Ht(X),te?(T.current=se(),O(X)):W(X));return}Le&&(ee.current!=null&&(T.current=ee.current),Ht(X),!te&&p?W(X):he(X),te&&O(X))}},onFocus(X){E.select("open")&&!A&&(T.current=-1,O(X))},onPointerDown:be,onPointerEnter:be,onMouseDown:G,onClick:G}},[he,g,se,c,O,E,p,x,Ae,f,ee,A]),me=d.useMemo(()=>({...oe,...ge}),[oe,ge]);return d.useMemo(()=>s?{reference:me,floating:ae,item:re,trigger:ge}:{},[s,me,ae,ge,re])}function _u(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:s,disabledIndices:i,onTyping:a,enabled:l=!0,resetMs:c=750,selectedIndex:f=null}=t,A="rootStore"in e?e.rootStore:e,g=A.useState("open"),h=ut(),p=d.useRef(""),m=d.useRef(f??o??-1),x=d.useRef(null),I=de(y=>{function w(M){return r?.current[M]}function C(M){const D=w(M);return D&&!Fo(D)||D?.matches(":disabled")?!1:i==null||!lo(_t,M,i)}function E(M,D,j=0){if(M.length===0)return-1;const P=(j%M.length+M.length)%M.length,T=D.toLowerCase();for(let N=0;N<M.length;N+=1){const Q=(P+N)%M.length;if(!(!M[Q]?.toLowerCase().startsWith(T)||!C(Q)))return Q}return-1}const R=n.current;if(p.current.length>0&&y.key===" "&&(Ht(y),a?.(!0)),p.current.length>0&&p.current[0]!==" "&&E(R,p.current)===-1&&y.key!==" "&&a?.(!1),R==null||y.key.length!==1||y.ctrlKey||y.metaKey||y.altKey)return;g&&y.key!==" "&&(Ht(y),a?.(!0));const S=p.current==="";S&&(m.current=f??o??-1),R.every((M,D)=>M&&C(D)?M[0]?.toLowerCase()!==M[1]?.toLowerCase():!0)&&p.current===y.key&&(p.current="",m.current=x.current),p.current+=y.key,h.start(c,()=>{p.current="",m.current=x.current,a?.(!1)});const B=((S?f??o??-1:m.current)??0)+1,_=E(R,p.current,B);_!==-1?(s?.(_),x.current=_):y.key!==" "&&(p.current="",a?.(!1))}),b=de(y=>{const w=y.relatedTarget,C=A.select("domReferenceElement"),E=A.select("floatingElement");ve(C,w)||ve(E,w)||(h.clear(),p.current="",m.current=x.current,a?.(!1))});ie(()=>{!g&&f!==null||(h.clear(),x.current=null,p.current!==""&&(p.current=""))},[g,f,h]);const v=d.useMemo(()=>({onKeyDown:I,onBlur:b}),[I,b]);return d.useMemo(()=>l?{reference:v,floating:v}:{},[l,v])}const rl=.1,wg=rl*rl,je=.5;function Hr(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function Kr(e,t,n,r,o,s,i,a,l,c){let f=!1;return Hr(e,t,n,r,o,s)&&(f=!f),Hr(e,t,o,s,i,a)&&(f=!f),Hr(e,t,i,a,l,c)&&(f=!f),Hr(e,t,l,c,n,r)&&(f=!f),f}function kg(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Wr(e,t,n,r,o,s){const i=Math.min(n,o),a=Math.max(n,o),l=Math.min(r,s),c=Math.max(r,s);return e>=i&&e<=a&&t>=l&&t<=c}function ju(e={}){const{blockPointerEvents:t=!1}=e,n=new Nt,r=({x:o,y:s,placement:i,elements:a,onClose:l,nodeId:c,tree:f})=>{const A=i?.split("-")[0];let g=!1,h=null,p=null,m=typeof performance<"u"?performance.now():0;function x(b,v){const y=performance.now(),w=y-m;if(h===null||p===null||w===0)return h=b,p=v,m=y,!1;const C=b-h,E=v-p,R=C*C+E*E,S=w*w*wg;return h=b,p=v,m=y,R<S}function I(){n.clear(),l()}return function(v){n.clear();const y=a.domReference,w=a.floating;if(!y||!w||A==null||o==null||s==null)return;const{clientX:C,clientY:E}=v,R=At(v),S=v.type==="mouseleave",k=ve(w,R),F=ve(y,R);if(k&&(g=!0,!S))return;if(F&&(g=!1,!S)){g=!0;return}if(S&&Pe(v.relatedTarget)&&ve(w,v.relatedTarget))return;function B(){return!!(f&&hn(f.nodesRef.current,c).length>0)}function _(){B()||I()}if(B())return;const M=y.getBoundingClientRect(),D=w.getBoundingClientRect(),j=o>D.right-D.width/2,P=s>D.bottom-D.height/2,T=D.width>M.width,N=D.height>M.height,Q=(T?M:D).left,O=(T?M:D).right,H=(N?M:D).top,Y=(N?M:D).bottom;if(A==="top"&&s>=M.bottom-1||A==="bottom"&&s<=M.top+1||A==="left"&&o>=M.right-1||A==="right"&&o<=M.left+1){_();return}let U=!1;switch(A){case"top":U=Wr(C,E,Q,M.top+1,O,D.bottom-1);break;case"bottom":U=Wr(C,E,Q,D.top+1,O,M.bottom-1);break;case"left":U=Wr(C,E,D.right-1,Y,M.left+1,H);break;case"right":U=Wr(C,E,M.right-1,Y,D.left+1,H);break}if(U)return;if(g&&!kg(C,E,M)){_();return}if(!S&&x(C,E)){_();return}let z=!1;switch(A){case"top":{const L=T?je/2:je*4,Z=T||j?o+L:o-L,K=T?o-L:j?o+L:o-L,ee=s+je+1,ce=j||T?D.bottom-je:D.top,ne=j?T?D.bottom-je:D.top:D.bottom-je;z=Kr(C,E,Z,ee,K,ee,D.left,ce,D.right,ne);break}case"bottom":{const L=T?je/2:je*4,Z=T||j?o+L:o-L,K=T?o-L:j?o+L:o-L,ee=s-je,ce=j||T?D.top+je:D.bottom,ne=j?T?D.top+je:D.bottom:D.top+je;z=Kr(C,E,Z,ee,K,ee,D.left,ce,D.right,ne);break}case"left":{const L=N?je/2:je*4,Z=N||P?s+L:s-L,K=N?s-L:P?s+L:s-L,ee=o+je+1,ce=P||N?D.right-je:D.left,ne=P?N?D.right-je:D.left:D.right-je;z=Kr(C,E,ce,D.top,ne,D.bottom,ee,Z,ee,K);break}case"right":{const L=N?je/2:je*4,Z=N||P?s+L:s-L,K=N?s-L:P?s+L:s-L,ee=o-je,ce=P||N?D.left+je:D.right,ne=P?N?D.left+je:D.right:D.left+je;z=Kr(C,E,ee,Z,ee,K,ce,D.top,ne,D.bottom);break}}z?g||n.start(40,_):_()}};return r.__options={...e,blockPointerEvents:t},r}const Nu=d.createContext(void 0);function Eg(){const e=d.useContext(Nu);if(e===void 0)throw new Error(nt(26));return e}const _s="ArrowUp",js="ArrowDown",Ns="ArrowLeft",Os="ArrowRight",Hs="Home",Ks="End",Oo=new Set([_s,js,Ns,Os,Hs,Ks]),Sg="Shift",Rg=[Sg,"Control","Alt","Meta"];function Dg(e){return Ve(e)&&e.tagName==="INPUT"}function ol(e){return!!(Dg(e)&&e.selectionStart!=null||Ve(e)&&e.tagName==="TEXTAREA")}function sl(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=il(e,t,"left"),c=Lr(e),f=Lr(t);n==="ltr"&&(l+t.offsetWidth+f.scrollMarginRight>e.scrollLeft+e.clientWidth-c.scrollPaddingRight?o=l+t.offsetWidth+f.scrollMarginRight-e.clientWidth+c.scrollPaddingRight:l-f.scrollMarginLeft<e.scrollLeft+c.scrollPaddingLeft&&(o=l-f.scrollMarginLeft-c.scrollPaddingLeft)),n==="rtl"&&(l-f.scrollMarginLeft<e.scrollLeft+c.scrollPaddingLeft?o=l-f.scrollMarginLeft-c.scrollPaddingLeft:l+t.offsetWidth+f.scrollMarginRight>e.scrollLeft+e.clientWidth-c.scrollPaddingRight&&(o=l+t.offsetWidth+f.scrollMarginRight-e.clientWidth+c.scrollPaddingRight))}if(a&&r!=="horizontal"){const l=il(e,t,"top"),c=Lr(e),f=Lr(t);l-f.scrollMarginTop<e.scrollTop+c.scrollPaddingTop?s=l-f.scrollMarginTop-c.scrollPaddingTop:l+t.offsetHeight+f.scrollMarginBottom>e.scrollTop+e.clientHeight-c.scrollPaddingBottom&&(s=l+t.offsetHeight+f.scrollMarginBottom-e.clientHeight+c.scrollPaddingBottom)}e.scrollTo({left:o,top:s,behavior:"auto"})}function il(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 Lr(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 Fg={...Rr,...Bn,nestedDialogOpen(e){return e?{"data-nested-dialog-open":""}:null}},Qi=d.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,initialFocus:a,...l}=t,c=Mn(),f=c.useState("descriptionElementId"),A=c.useState("disablePointerDismissal"),g=c.useState("floatingRootContext"),h=c.useState("popupProps"),p=c.useState("modal"),m=c.useState("mounted"),x=c.useState("nested"),I=c.useState("nestedOpenDialogCount"),b=c.useState("open"),v=c.useState("openMethod"),y=c.useState("titleElementId"),w=c.useState("transitionStatus"),C=c.useState("role"),E=g.useState("floatingId");Eg(),Yt({open:b,ref:c.context.popupRef,onComplete(){b&&c.context.onOpenChangeComplete?.(!0)}});const R=a===void 0?dg(c.context.popupRef):a,S=I>0,k=c.useStateSetter("popupElement"),B=Me("div",t,{state:{open:b,nested:x,transitionStatus:w,nestedDialogOpen:S},props:[h,{id:E,"aria-labelledby":y,"aria-describedby":f,role:C,...jo,hidden:!m,onKeyDown(_){Oo.has(_.key)&&_.stopPropagation()},style:{"--nested-dialogs":I}},l],ref:[n,c.context.popupRef,k],stateAttributesMapping:Fg});return u.jsx(Fi,{context:g,openInteractionType:v,disabled:!m,closeOnFocusOut:!A,initialFocus:R,returnFocus:i,modal:p!==!1,restoreFocus:"popup",children:B})});function Gi(e){return Ec(19)?e:e?"true":void 0}const Yi=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 u.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),Ui=d.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,s=Mn(),i=s.useState("mounted"),a=s.useState("modal"),l=s.useState("open");return i||r?u.jsx(Nu.Provider,{value:r,children:u.jsxs(Si,{ref:n,...o,children:[i&&a===!0&&u.jsx(Yi,{ref:s.context.internalBackdropRef,inert:Gi(!l)}),t.children]})}):null});let al={},ll={},cl="";function Ho(e,t){return qs(e)?e:t}function ul(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Ho(t,n)).overflowY)}function Bg(e){if(typeof document>"u")return!1;const t=Be(e);return tt(t).innerWidth-t.documentElement.clientWidth>0}function Mg(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=Ho(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 c=s.offsetWidth;return s.style.overflowY=i,r.style.scrollbarGutter=a,l===c}function Pg(e){const t=Be(e),n=t.documentElement,r=t.body,o=Ho(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 Tg(e){const t=Be(e),n=t.documentElement,r=t.body,o=tt(n);let s=0,i=0,a=!1;const l=Ct.create();if(sn&&(o.visualViewport?.scale??1)!==1)return()=>{};function c(){const h=o.getComputedStyle(n),p=o.getComputedStyle(r),I=(h.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,al={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},cl=n.style.scrollBehavior,ll={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,v=n.scrollWidth>n.clientWidth,y=h.overflowY==="scroll"||p.overflowY==="scroll",w=h.overflowX==="scroll"||p.overflowX==="scroll",C=Math.max(0,o.innerWidth-r.clientWidth),E=Math.max(0,o.innerHeight-r.clientHeight),R=parseFloat(p.marginTop)+parseFloat(p.marginBottom),S=parseFloat(p.marginLeft)+parseFloat(p.marginRight),k=Ho(n,r);if(a=Mg(e),a){n.style.scrollbarGutter=I,k.style.overflowY="hidden",k.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:I,overflowY:"hidden",overflowX:"hidden"}),(b||y)&&(n.style.overflowY="scroll"),(v||w)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:R||E?`calc(100dvh - ${R+E}px)`:"100dvh",width:S||C?`calc(100vw - ${S+C}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,al),Object.assign(r.style,ll),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=cl)}function A(){f(),l.request(c)}c();const g=Fe(o,"resize",A);return()=>{l.cancel(),f(),typeof o.removeEventListener=="function"&&g()}}class _g{lockCount=0;restore=null;timeoutLock=Nt.create();timeoutUnlock=Nt.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=tt(r);if(ul(s,r,o)){const a=new s.MutationObserver(()=>{ul(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=Eo||!Bg(t);this.restore=i?Pg(t):Tg(t)}}const jg=new _g;function Ou(e=!0,t=null){ie(()=>{if(e)return jg.acquire(t)},[e,t])}function Ng({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,c]=d.useState(0),[f,A]=d.useState(0),g=l===0,h=Po(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,I=e.context.backdropRef.current;return x||I?x===m||I===m||ve(m,i)&&!m?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:g});return Ou(r&&s===!0,i),e.useContextCallback("onNestedDialogOpen",(p,m)=>{c(p),A(m)}),ie(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(l+1,f+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,f,t]),Ni(e,{activeTriggerProps:h.reference,inactiveTriggerProps:h.trigger,popupProps:h.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:f}),null}const Og={...Ki,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 Hg extends Dr{constructor(t,n,r){const o=new Fr,s=Kg(t,o,n,r);super(s,Wg(o),Og)}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};Ti(r,t,n.trigger),this.update(r)}}function Kg(e,t,n,r=!1){const o={...Oi(),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=Su(t,n,r),o}function Wg(e){return{popupRef:d.createRef(),backdropRef:d.createRef(),internalBackdropRef:d.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Hu(e,t){const{children:n,open:r,defaultOpen:o=!1,onOpenChange:s,onOpenChangeComplete:i,disablePointerDismissal:a=!1,modal:l=!0,actionsRef:c,handle:f,triggerId:A,defaultTriggerId:g=null}=t,h=e==="drawer",p=e==="alert-dialog",m=p?!0:l,x=p||a,I=p?"alertdialog":"dialog",b=Mn(!0),v=b!=null,y={modal:m,disablePointerDismissal:x,nested:v,role:I},w=wu((F,B)=>new Hg({open:o,openProp:r,activeTriggerId:g,triggerIdProp:A,...y},F,B),!0);w.useControlledProp("openProp",r),w.useControlledProp("triggerIdProp",A),w.useSyncedValues(y),w.useContextCallback("onOpenChange",s),w.useContextCallback("onOpenChangeComplete",i);const C=w.useState("open"),E=w.useState("mounted"),R=w.useState("payload");Ag(w,C),_i(w);const{forceUnmount:S}=ji(C,w);d.useImperativeHandle(c,()=>({unmount:S,close:()=>w.setOpen(!1,Ce(ei))}),[S,w]);const k=C||E;return u.jsxs(qc.Provider,{value:w,children:[f&&u.jsx(Pi,{handle:f,store:w}),k&&u.jsx(Ng,{store:w,parentContext:b?.context,isDrawer:h}),typeof n=="function"?n({payload:R}):n]})}function Ku(e){return Hu("dialog",e)}const zi=d.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,l=Mn(),c=It(i);return l.useSyncedValueWithCleanup("titleElementId",c),Me("h2",t,{ref:n,props:[{id:c},a]})});function Lg(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 Ko(e,t){const n=d.useRef(e),r=de(t);ie(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Qg(e,t){const n=de((s,i)=>{(typeof e=="function"?e():e)||t(i||(Eo?"touch":""))}),{onClick:r,onPointerDown:o}=Lg(n);return d.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function Wu(e){const[t,n]=d.useState(null),r=Qg(e,n);return Ko(e,o=>{o&&!e&&n(null)}),d.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Gg({...e}){return u.jsx(Ku,{"data-slot":"sheet",...e})}function Yg({...e}){return u.jsx(Ui,{"data-slot":"sheet-portal",...e})}function Ug({className:e,...t}){return u.jsx(Ii,{"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 zg({className:e,children:t,side:n="right",showCloseButton:r=!0,...o}){return u.jsxs(Yg,{children:[u.jsx(Ug,{}),u.jsxs(Qi,{"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&&u.jsxs(wi,{"data-slot":"sheet-close",render:u.jsx(Qe,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[u.jsx(ci,{}),u.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Vg({className:e,...t}){return u.jsx("div",{"data-slot":"sheet-header",className:fe("flex flex-col gap-0.5 p-4",e),...t})}function Zg({className:e,...t}){return u.jsx(zi,{"data-slot":"sheet-title",className:fe("cn-font-heading text-base font-medium text-foreground",e),...t})}function Jg({className:e,...t}){return u.jsx(ki,{"data-slot":"sheet-description",className:fe("text-sm text-muted-foreground",e),...t})}function Xt({className:e,...t}){return u.jsx("div",{"data-slot":"skeleton",className:fe("animate-pulse rounded-md bg-muted",e),...t})}const Lu=d.createContext(void 0);function Br(e){const t=d.useContext(Lu);if(t===void 0&&!e)throw new Error(nt(72));return t}const $g={...Ki,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 Xg extends Dr{constructor(t,n,r){const o=new Fr;super(qg(t,o,n,r),em(o),$g)}setOpen=(t,n)=>{pg(this,t,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,Ce(Fn,t))}}function qg(e,t,n,r=!1){const o={...Oi(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return o.floatingRootContext=Su(t,n,r),o}function em(e){return{popupRef:d.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const tm=Mi(function(t){const{disabled:n=!1,defaultOpen:r=!1,open:o,disableHoverablePopup:s=!1,trackCursorAxis:i="none",actionsRef:a,onOpenChange:l,onOpenChangeComplete:c,handle:f,triggerId:A,defaultTriggerId:g=null,children:h}=t,p=wu((F,B)=>new Xg({open:r,openProp:o,activeTriggerId:g,triggerIdProp:A},F,B));p.useControlledProp("openProp",o),p.useControlledProp("triggerIdProp",A),p.useContextCallback("onOpenChange",l),p.useContextCallback("onOpenChangeComplete",c);const m=p.useState("open"),x=!n&&m,I=p.useState("activeTriggerId"),b=p.useState("mounted"),v=p.useState("payload");p.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:s,disabled:n}),_i(p,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:y,transitionStatus:w}=ji(x,p),C=p.useState("isInstantPhase"),E=p.useState("instantType"),R=p.useState("lastOpenChangeReason"),S=d.useRef(null);ie(()=>{m&&n&&p.setOpen(!1,Ce(Dc))},[m,n,p]),ie(()=>{w==="ending"&&R===Pt||w!=="ending"&&C?(E!=="delay"&&(S.current=E),p.set("instantType","delay")):S.current!==null&&(p.set("instantType",S.current),S.current=null)},[w,C,R,E,p]),ie(()=>{x&&I==null&&p.set("payload",void 0)},[p,I,x]),d.useImperativeHandle(a,()=>({unmount:y,close:()=>p.setOpen(!1,Ce(ei))}),[y,p]);const k=x||b||!n&&i!=="none";return u.jsxs(Lu.Provider,{value:p,children:[f&&u.jsx(Pi,{handle:f,store:p}),k&&u.jsx(nm,{store:p,disabled:n,trackCursorAxis:i}),typeof h=="function"?h({payload:v}):h]})});function nm({store:e,disabled:t,trackCursorAxis:n}){const r=e.useState("floatingRootContext"),o=Po(r,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),s=dh(r,{enabled:!t&&n!=="none",axis:n==="none"?void 0:n}),i=d.useMemo(()=>Bt(s.reference,o.reference),[s.reference,o.reference]);return Ni(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:o.floating??it}),null}const rm=d.createContext(void 0);function om(){return d.useContext(rm)}const dl=600,Qu="data-base-ui-tooltip-trigger";function fl(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 sm(e){let t=e;for(;t;){const n=t.closest(`[${Qu}]`);if(n)return n;const r=t.getRootNode();t="host"in r&&Pe(r.host)?r.host:null}return null}const im=Cu(function(t,n){const{render:r,className:o,style:s,handle:i,payload:a,disabled:l,delay:c,closeOnClick:f=!0,closeDelay:A,id:g,...h}=t,p=Br(!0),x=Du(i)??p;if(!x)throw new Error(nt(82));const I=It(g),b=x.useState("isTriggerActive",I),v=x.useState("isOpenedByTrigger",I),y=x.useState("floatingRootContext"),w=d.useRef(null),C=c??dl,E=A??0,{registerTrigger:R,isMountedByThisTrigger:S}=Eu(I,w,x,{payload:a,closeOnClick:f,closeDelay:E}),k=om(),{delayRef:F,isInstantPhase:B,hasProvider:_}=JA(y,{open:v}),M=Li(y);x.useSyncedValue("isInstantPhase",B);const D=x.useState("disabled"),j=l??D,P=Xe(j),T=x.useState("trackCursorAxis"),N=x.useState("disableHoverablePopup"),Q=d.useRef(!1),O=ut(),H=d.useRef(void 0);function Y(){return _?Yn(F.current,"open")===0?0:c??k??dl:C}function U(q){const ue=w.current;if(!ue||!q)return!1;const le=sm(q);return le!==null&&le!==ue&&ve(ue,le)}function z(q){const ue=U(q);return Q.current=ue,ue&&(M.openChangeTimeout.clear(),M.restTimeout.clear(),M.restTimeoutPending=!1,O.clear()),ue}const L=Pu(y,{enabled:!j,mouseOnly:!0,move:!1,handleClose:!N&&T!=="both"?ju():null,restMs:Y,delay(){return A==null&&_?{close:Yn(F.current,"close")}:{close:E}},triggerElementRef:w,isActiveTrigger:b,isClosing:()=>x.select("transitionStatus")==="ending",shouldOpen(){return!Q.current}}),Z=Fu(y,{enabled:!j}).reference,K=q=>{const ue=Q.current,le=fl(q),Ae=z(le),se=w.current,he=se&&le&&ve(se,le);if(Ae&&x.select("open")&&x.select("lastOpenChangeReason")===ot){x.setOpen(!1,Ce(ot,q));return}if(ue&&!Ae&&he&&!P.current&&!x.select("open")&&se&&An(H.current)){const re=()=>{!Q.current&&!P.current&&!x.select("open")&&x.setOpen(!0,Ce(ot,q,se))},oe=Y();oe===0?(O.clear(),re()):O.start(oe,re)}},ee=x.useState("triggerProps",S);return Me("button",t,{state:{open:v},ref:[n,R,w],props:[L,Z,S||T!=="none"?ee:void 0,{onMouseOver(q){K(q.nativeEvent)},onFocus(q){U(fl(q.nativeEvent))&&q.preventBaseUIHandler()},onMouseLeave(){Q.current=!1,O.clear(),H.current=void 0},onPointerEnter(q){H.current=q.pointerType},onPointerDown(q){H.current=q.pointerType,x.set("closeOnClick",f),f&&!x.select("open")&&x.cancelPendingOpen(q.nativeEvent)},onClick(q){f&&!x.select("open")&&x.cancelPendingOpen(q.nativeEvent)},id:I,"data-trigger-disabled":j?"":void 0,[Qu]:j?void 0:""},h],stateAttributesMapping:eu})}),Gu=d.createContext(void 0);function am(){const e=d.useContext(Gu);if(e===void 0)throw new Error(nt(70));return e}const lm=d.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,style:a,...l}=t,{node:c,subtree:f}=lu({container:o,ref:n,componentProps:t,elementProps:l});return!f&&!c?null:u.jsxs(d.Fragment,{children:[f,c&&on.createPortal(r,c)]})}),cm=d.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return Br().useState("mounted")||r?u.jsx(Gu.Provider,{value:r,children:u.jsx(lm,{ref:n,...o})}):null}),Yu=d.createContext(void 0);function Uu(){const e=d.useContext(Yu);if(e===void 0)throw new Error(nt(71));return e}const um=d.createContext(void 0);function Wo(){return d.useContext(um)?.direction??"ltr"}const dm=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:c,padding:f=0,offsetParent:A="real"}=gn(e,t)||{};if(c==null)return{};const g=Kc(f),h={x:n,y:r},p=mi(o),m=gi(p),x=await i.getDimensions(c),I=p==="y",b=I?"top":"left",v=I?"bottom":"right",y=I?"clientHeight":"clientWidth",w=s.reference[m]+s.reference[p]-h[p]-s.floating[m],C=h[p]-s.reference[p],E=A==="real"?await i.getOffsetParent?.(c):a.floating;let R=a.floating[y]||s.floating[m];(!R||!await i.isElement?.(E))&&(R=a.floating[y]||s.floating[m]);const S=w/2-C/2,k=R/2-x[m]/2-1,F=Math.min(g[b],k),B=Math.min(g[v],k),_=F,M=R-x[m]-B,D=R/2-x[m]/2+S,j=Hc(_,D,M),P=!l.arrow&&bn(o)!=null&&D!==j&&s.reference[m]/2-(D<_?F:B)-x[m]/2<0,T=P?D<_?D-_:D-M:0;return{[p]:h[p]+T,data:{[p]:j,centerOffset:D-j-T,...P&&{alignmentOffset:T}},reset:P}}}),fm=(e,t)=>({...dm(e),options:[e,t]}),pm={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}}}},Am={sideX:"left",sideY:"top"},pl="--available-width",Al="--available-height";function zu(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 hl(e,t,n){const{rects:r,placement:o}=e;return{side:zu(t,Mt(o),n),align:bn(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Vi(e){return hm(e,xg)}function hm(e,t){const{anchor:n,positionMethod:r="absolute",side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,collisionBoundary:l,collisionPadding:c=5,sticky:f=!1,arrowPadding:A=5,disableAnchorTracking:g=!1,inline:h,keepMounted:p=!1,floatingRootContext:m,mounted:x,collisionAvoidance:I,shift:b,nodeId:v,adaptiveOrigin:y,lazyFlip:w=!1,externalTree:C}=e,[E,R]=d.useState(null);!x&&E!==null&&R(null);const S=I.side||"flip",k=I.align||"flip",F=I.fallbackAxisSide||"end",B=b?.crossAxis??!1,_=b?.rootBoundary,M=typeof n=="function"?n:void 0,D=de(M),j=M?D:n,P=Xe(n),T=Xe(x),Q=Wo()==="rtl",O=E||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":Q?"left":"right","inline-start":Q?"right":"left"}[o],H=i==="center"?O:`${O}-${i}`;let Y=c;typeof Y=="number"?Y={top:Y,right:Y,bottom:Y,left:Y}:Y&&(Y={top:Y.top||0,right:Y.right||0,bottom:Y.bottom||0,left:Y.left||0});const U=1,z=o==="bottom"?U:0,L=o==="top"?U:0,Z=o==="right"?U:0,K=o==="left"?U:0,ee={boundary:l==="clipping-ancestors"?"clippingAncestors":l,padding:Y},ce=d.useRef(null),ne=Xe(s),$=Xe(a),q=typeof s!="function"?s:0,ue=typeof a!="function"?a:0,le=[];h&&le.push(h),le.push(zh(Re=>{const Ue=hl(Re,o,Q),ze=typeof ne.current=="function"?ne.current(Ue):ne.current,Je=typeof $.current=="function"?$.current(Ue):$.current;return{mainAxis:ze,crossAxis:Je,alignmentAxis:Je}},[q,ue,Q,o]));const Ae=k==="none"&&S!=="shift",se=!Ae&&(f||B||S==="shift"),he=S==="none"?null:Jh({...ee,padding:{top:Y.top+U+z,right:Y.right+U+K,bottom:Y.bottom+U+L,left:Y.left+U+Z},mainAxis:!B&&S==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:F}),re=Ae?null:Vh({...ee,rootBoundary:_,mainAxis:k!=="none",crossAxis:se,limiter:f||B?void 0:Zh(Re=>{if(!ce.current)return{};const{width:Ue,height:ze}=ce.current.getBoundingClientRect(),Je=Ft(Mt(Re.placement)),ht=Je==="y"?Ue:ze,ft=Je==="y"?Y.left+Y.right:Y.top+Y.bottom;return{offset:ht/2+ft/2}})},[ee,f,B,_,Y,k]);S==="shift"||k==="shift"||i==="center"?le.push(re,he):le.push(he,re),le.push($h({...ee,apply({elements:{floating:Re},availableWidth:Ue,availableHeight:ze,rects:Je}){if(!T.current)return;const ht=Re.style;ht.setProperty(pl,`${Ue}px`),ht.setProperty(Al,`${ze}px`);const ft=tt(Re).devicePixelRatio||1,{x:St,y:rt,width:kt,height:Rt}=Je.reference,pt=(Math.round((St+kt)*ft)-Math.round(St*ft))/ft,De=(Math.round((rt+Rt)*ft)-Math.round(rt*ft))/ft;ht.setProperty("--anchor-width",`${pt}px`),ht.setProperty("--anchor-height",`${De}px`)}}),fm(Re=>({element:ce.current||Be(Re.elements.floating).createElement("div"),padding:A,offsetParent:"floating"}),[A]),{name:"transformOrigin",fn(Re){const{elements:Ue,middlewareData:ze,placement:Je,rects:ht,y:ft}=Re,St=Mt(Je),rt=Ft(St),kt=ce.current,Rt=ze.arrow?.x||0,pt=ze.arrow?.y||0,De=kt?.clientWidth||0,Ke=kt?.clientHeight||0,gt=Rt+De/2,vt=pt+Ke/2,yt=Math.abs(ze.shift?.y||0),Dt=ht.reference.height/2,Ot=typeof s=="function"?s(hl(Re,o,Q)):s,ln=yt>Ot,Xn={top:`${gt}px calc(100% + ${Ot}px)`,bottom:`${gt}px ${-Ot}px`,left:`calc(100% + ${Ot}px) ${vt}px`,right:`${-Ot}px ${vt}px`}[St],Cn=`${gt}px ${ht.reference.y+Dt-ft}px`;return Ue.floating.style.setProperty("--transform-origin",se&&rt==="y"&&ln?Cn:Xn),{}}},pm,y),ie(()=>{!x&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[x,m]);const oe=d.useMemo(()=>({elementResize:!g&&typeof ResizeObserver<"u",layoutShift:!g&&typeof IntersectionObserver<"u"}),[g]),{refs:ae,elements:ge,x:me,y:W,middlewareData:G,update:be,placement:X,context:te,isPositioned:Ee,floatingStyles:Se}=t({rootContext:m,open:p?x:void 0,placement:H,middleware:le,strategy:r,whileElementsMounted:p?void 0:(...Re)=>$a(...Re,oe),nodeId:v,externalTree:C}),{sideX:Le,sideY:Ye}=G.adaptiveOrigin||Am,Oe=Ee?r:"fixed",at=d.useMemo(()=>{let Re;return Ee?y?Re={position:Oe,[Le]:me,[Ye]:W}:Re={...Se,position:Oe}:Re={position:Oe,top:0,left:0},Re[pl]="100vw",Re[Al]="100vh",Ee||(Re.opacity=0),Re},[y,Oe,Le,me,Ye,W,Se,Ee]),qe=d.useRef(null);ie(()=>{if(!x)return;const Re=P.current,Ue=typeof Re=="function"?Re():Re,Je=(gl(Ue)?Ue.current:Ue)||null||null;Je!==qe.current&&(ae.setPositionReference(Je),qe.current=Je)},[x,ae,j,P]),d.useEffect(()=>{if(!x)return;const Re=P.current;typeof Re!="function"&&gl(Re)&&Re.current!==qe.current&&(ae.setPositionReference(Re.current),qe.current=Re.current)},[x,ae,j,P]),d.useEffect(()=>{if(p&&x&&ge.reference&&ge.floating)return $a(ge.reference,ge.floating,be,oe)},[p,x,ge,be,oe]);const Ze=Mt(X),dt=zu(o,Ze,Q),Ie=bn(X)||"center",He=!!G.hide?.referenceHidden;ie(()=>{w&&x&&Ee&&Ze!==O&&R(Ze)},[w,x,Ee,Ze,O]);const _e=d.useMemo(()=>({position:"absolute",top:G.arrow?.y,left:G.arrow?.x}),[G.arrow]),et=G.arrow?.centerOffset!==0;return d.useMemo(()=>({positionerStyles:at,arrowStyles:_e,arrowRef:ce,arrowUncentered:et,side:dt,align:Ie,physicalSide:Ze,anchorHidden:He,refs:ae,context:te,isPositioned:Ee,update:be}),[at,_e,ce,et,dt,Ie,Ze,He,ae,te,Ee,be])}function gl(e){return e!=null&&"current"in e}function Lo(e){return e==="starting"?nh:it}function Zi(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},Lo(r),o],stateAttributesMapping:Rr})}const gm=d.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:a="top",align:l="center",sideOffset:c=0,alignOffset:f=0,collisionBoundary:A="clipping-ancestors",collisionPadding:g=5,arrowPadding:h=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:x=su,style:I,...b}=t,v=Br(),y=am(),w=v.useState("open"),C=v.useState("mounted"),E=v.useState("trackCursorAxis"),R=v.useState("disableHoverablePopup"),S=v.useState("floatingRootContext"),k=v.useState("instantType"),F=v.useState("transitionStatus"),B=v.useState("adaptiveOrigin"),_=Vi({anchor:s,positionMethod:i,floatingRootContext:S,mounted:C,side:a,sideOffset:c,align:l,alignOffset:f,collisionBoundary:A,collisionPadding:g,sticky:p,arrowPadding:h,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:x,adaptiveOrigin:B}),M=d.useMemo(()=>({open:w,side:_.side,align:_.align,anchorHidden:_.anchorHidden,instant:E!=="none"?"tracking-cursor":k}),[w,_.side,_.align,_.anchorHidden,E,k]),D=Zi(t,M,{styles:_.positionerStyles,transitionStatus:F,props:b,refs:[n,v.useStateSetter("positionerElement")],hidden:!C,inert:!w||E==="both"||R});return u.jsx(Yu.Provider,{value:_,children:D})}),mm=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=Br(),{side:l,align:c}=Uu(),f=a.useState("open"),A=a.useState("instantType"),g=a.useState("transitionStatus"),h=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)}}),Mu(p,{enabled:!m,closeDelay:x});const I=a.useStateSetter("popupElement");return Me("div",t,{state:{open:f,side:l,align:c,instant:A,transitionStatus:g},ref:[n,a.context.popupRef,I],props:[jo,h,Lo(g),i],stateAttributesMapping:Ci})}),xm=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=Br(),{arrowRef:l,side:c,align:f,arrowUncentered:A,arrowStyles:g}=Uu(),h=a.useState("open"),p=a.useState("instantType");return Me("div",t,{state:{open:h,side:c,align:f,uncentered:A,instant:p},ref:[n,l],props:[{style:g,"aria-hidden":!0},i],stateAttributesMapping:Rr})});function bm(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 Ji({...e}){return u.jsx(tm,{"data-slot":"tooltip",...e})}function $i({...e}){return u.jsx(im,{"data-slot":"tooltip-trigger",...e})}function Xi({className:e,side:t="top",sideOffset:n=4,align:r="center",alignOffset:o=0,children:s,...i}){return u.jsx(cm,{children:u.jsx(gm,{align:r,alignOffset:o,side:t,sideOffset:n,className:"isolate z-50",children:u.jsxs(mm,{"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,u.jsx(xm,{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 vm="sidebar_state",ym=3600*24*7,Cm="16rem",Im="18rem",wm="3rem",km="b",Vu=d.createContext(null);function Qo(){const e=d.useContext(Vu);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Em({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:o,children:s,...i}){const a=KA(),[l,c]=d.useState(!1),[f,A]=d.useState(e),g=t??f,h=d.useCallback(I=>{const b=typeof I=="function"?I(g):I;n?n(b):A(b),document.cookie=`${vm}=${b}; path=/; max-age=${ym}`},[n,g]),p=d.useCallback(()=>a?c(I=>!I):h(I=>!I),[a,h,c]);d.useEffect(()=>{const I=b=>{b.key===km&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),p())};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[p]);const m=g?"expanded":"collapsed",x=d.useMemo(()=>({state:m,open:g,setOpen:h,isMobile:a,openMobile:l,setOpenMobile:c,toggleSidebar:p}),[m,g,h,a,l,c,p]);return u.jsx(Vu.Provider,{value:x,children:u.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Cm,"--sidebar-width-icon":wm,...o},className:fe("group/sidebar-wrapper flex h-svh w-full has-data-[variant=inset]:bg-sidebar",r),...i,children:s})})}function Sm({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:o,dir:s,...i}){const{isMobile:a,state:l,openMobile:c,setOpenMobile:f}=Qo();return n==="none"?u.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?u.jsx(Gg,{open:c,onOpenChange:f,...i,children:u.jsxs(zg,{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":Im},side:e,children:[u.jsxs(Vg,{className:"sr-only",children:[u.jsx(Zg,{children:"Sidebar"}),u.jsx(Jg,{children:"Displays the mobile sidebar."})]}),u.jsx("div",{className:"flex h-full w-full flex-col",children:o})]})}):u.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:[u.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)")}),u.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:u.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 Rm({className:e,...t}){const{toggleSidebar:n}=Qo();return u.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 Dm({className:e,...t}){return u.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:fe("flex flex-col gap-2 p-2",e),...t})}function Fm({className:e,...t}){return u.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:fe("flex flex-col gap-2 p-2",e),...t})}function Bm({className:e,...t}){return u.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 Mm({className:e,...t}){return u.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 Pm({className:e,...t}){return u.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:fe("w-full text-sm",e),...t})}function us({className:e,...t}){return u.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:fe("flex w-full min-w-0 flex-col gap-0",e),...t})}function Qr({className:e,...t}){return u.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:fe("group/menu-item relative",e),...t})}const Tm=Js("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 fr({render:e,isActive:t=!1,variant:n="default",size:r="default",tooltip:o,className:s,...i}){const{isMobile:a,state:l}=Qo(),c=Bc({defaultTagName:"button",props:Bt({className:fe(Tm({variant:n,size:r}),s)},i),render:o?u.jsx($i,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:r,active:t}});return o?(typeof o=="string"&&(o={children:o}),u.jsxs(Ji,{children:[c,u.jsx(Xi,{side:"right",align:"center",hidden:l!=="collapsed"||a,...o})]})):c}const Zu=d.createContext(void 0);function Ju(e){const t=d.useContext(Zu);if(t===void 0&&!e)throw new Error(nt(33));return t}const $u=d.createContext(void 0);function $n(e){const t=d.useContext($u);if(t===void 0&&!e)throw new Error(nt(36));return t}const _m=d.createContext(void 0);function qi(e=!0){const t=d.useContext(_m);if(t===void 0&&!e)throw new Error(nt(25));return t}function jm(e){const{closeOnClick:t,highlighted:n,id:r,nodeId:o,store:s,typingRef:i,itemRef:a,itemMetadata:l}=e,{events:c}=s.useState("floatingTreeRoot"),f=s.useState("open"),A=qi(!0),g=A!==void 0;return d.useMemo(()=>({id:r,role:"menuitem",tabIndex:f&&n?0:-1,onKeyDown(h){h.key===" "&&i?.current&&h.preventDefault()},onMouseMove(h){o&&c.emit("itemhover",{nodeId:o,target:h.currentTarget})},onClick(h){t&&c.emit("close",{domEvent:h,reason:cr})},onMouseUp(h){if(A){const p=A.initialCursorPointRef.current;if(A.initialCursorPointRef.current=null,g&&p&&Math.abs(h.clientX-p.x)<=1&&Math.abs(h.clientY-p.y)<=1||g&&!ui&&h.button===2)return}a.current&&s.context.allowMouseUpTriggerRef.current&&(!g||h.button===2)&&l.type==="regular-item"&&ti(a.current,h,{detail:1})}}),[t,n,r,c,o,f,s,i,a,A,g,l])}const Nm={type:"regular-item"};function Om(e){const{closeOnClick:t,disabled:n,highlighted:r,id:o,store:s,typingRef:i=s.context.typingRef,nativeButton:a,itemMetadata:l,nodeId:c}=e,f=d.useRef(null),{getButtonProps:A,buttonRef:g}=Gt({disabled:n,focusableWhenDisabled:!0,native:a,composite:!0}),h=jm({closeOnClick:t,highlighted:r,id:o,nodeId:c,store:s,typingRef:i,itemRef:f,itemMetadata:l}),p=d.useCallback(x=>Bt(h,{onMouseEnter(){l.type==="submenu-trigger"&&l.setActive()}},x,A),[h,A,l]),m=Qt(f,g);return d.useMemo(()=>({getItemProps:p,itemRef:m}),[p,m])}const Xu=d.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Hm(){return d.useContext(Xu)}function Go(e={}){const{guess:t,label:n,metadata:r,textRef:o,index:s}=e,{register:i,unregister:a,subscribeMapChange:l,nextIndexRef:c}=Hm(),f=d.useRef(-1),[A,g]=d.useState(s==null&&t?()=>{if(f.current===-1){const x=c.current;c.current+=1,f.current=x}return f.current}:-1),h=s??A,p=d.useRef(null),m=d.useCallback(x=>{const I=p.current;I&&a(I),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 l(x=>{const I=p.current?x.get(p.current)?.index:null;I!=null&&g(I)})},[s,l]),{ref:m,index:h}}const Km=d.forwardRef(function(t,n){const{render:r,className:o,id:s,label:i,nativeButton:a=!1,disabled:l=!1,closeOnClick:c=!0,style:f,...A}=t,g=Go({guess:!0,label:i}),h=Ju(!0),p=It(s),{store:m}=$n(),x=m.useState("disabled"),I=l||x,b=m.useState("isActive",g.index),v=m.useState("itemProps"),{getItemProps:y,itemRef:w}=Om({closeOnClick:c,disabled:I,highlighted:b,id:p,store:m,nativeButton:a,nodeId:h?.context.nodeId,itemMetadata:Nm});return Me("div",t,{state:{disabled:I,highlighted:b},props:[v,A,y],ref:[w,n,g.ref]})}),Wm=d.createContext(void 0);function ea(e){return d.useContext(Wm)}const Lm=d.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...a}=t,{store:l}=$n(),{side:c,align:f}=Ju(),A=ea()!=null,g=l.useState("open"),h=l.useState("transitionStatus"),p=l.useState("popupProps"),m=l.useState("mounted"),x=l.useState("instantType"),I=l.useState("activeTriggerElement"),b=l.useState("parent"),v=l.useState("lastOpenChangeReason"),y=l.useState("rootId"),w=l.useState("floatingRootContext"),C=l.useState("floatingTreeRoot"),E=l.useState("closeDelay"),R=l.useState("hoverEnabled"),S=l.useState("disabled"),k=l.useState("openMethod"),F=b.type==="context-menu";Yt({open:g,ref:l.context.popupRef,onComplete(){g&&l.context.onOpenChangeComplete?.(!0)}}),d.useEffect(()=>{function j(P){l.setOpen(!1,Ce(P.reason,P.domEvent))}return C.events.on("close",j),()=>{C.events.off("close",j)}},[C.events,l]),Mu(w,{enabled:R&&!S&&!F&&b.type!=="menubar",closeDelay:E});const B=l.useStateSetter("popupElement"),_={transitionStatus:h,side:c,align:f,open:g,nested:b.type==="menu",instant:x},M=Me("div",t,{state:_,ref:[n,l.context.popupRef,B],stateAttributesMapping:Ci,props:[p,{onKeyDown(j){A&&Oo.has(j.key)&&j.stopPropagation()}},Lo(h),a,{"data-rootownerid":y}]});let D=b.type===void 0||F;return(I||b.type==="menubar"&&v!==yo)&&(D=!0),u.jsx(Fi,{context:w,openInteractionType:k,modal:F,disabled:!m,returnFocus:i===void 0?D:i,initialFocus:b.type!=="menu",restoreFocus:!0,externalTree:b.type!=="menubar"?C:void 0,previousFocusableElement:I,nextFocusableElement:b.type===void 0?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:b.type===void 0?l.context.beforeContentFocusGuardRef:void 0,children:M})}),qu=d.createContext(void 0);function Qm(){const e=d.useContext(qu);if(e===void 0)throw new Error(nt(32));return e}const Gm=d.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=$n();return s.useState("mounted")||r?u.jsx(qu.Provider,{value:r,children:u.jsx(Si,{ref:n,...o})}):null});function Mr(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=de(o),[,i]=d.useState(!1),a=Et(Um).current,l=Et(Ym).current,c=d.useRef(0),f=d.useRef(!0),A=d.useRef([]),g=d.useRef(null),h=de(()=>{f.current||(f.current=!0,i(w=>!w))}),p=de((w,C)=>{l.set(w,C),h()}),m=de(w=>{l.delete(w),h()}),x=de(w=>{const C=new Map;return n.current.length=0,r&&(r.current.length=0),w.forEach(E=>{C.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)}),c.current=n.current.length,C});function I(w){if(g.current?.disconnect(),g.current=null,typeof MutationObserver!="function"||w.length<2)return;const C=new MutationObserver(R=>{if(!Zm(R))return;let S=null;for(const k of w)if(k.isConnected){if(S&&ed(S,k)>0){C.disconnect(),h();return}S=k}});g.current=C;const E=new Set;for(let R=1;R<w.length;R+=1){const S=Vm(w[R-1],w[R]);S&&E.add(S)}E.forEach(R=>C.observe(R,{childList:!0}))}const b=de(()=>{const[w,C]=zm(l),E=x(w);I(C),A.current=w,f.current=!1,a.forEach(R=>R(E)),s(E)});ie(()=>(f.current||x(A.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,x]),ie(()=>{f.current&&b()}),ie(()=>()=>{g.current?.disconnect(),f.current=!0},[]);const v=de(w=>(a.add(w),()=>{a.delete(w)})),y=d.useMemo(()=>({register:p,unregister:m,subscribeMapChange:v,nextIndexRef:c}),[p,m,v,c]);return u.jsx(Xu.Provider,{value:y,children:t})}function Ym(){return new Map}function Um(){return new Set}function zm(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)=>ed(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 Vm(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Zm(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 ed(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const Jm=20;function td(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-Jm)},[e,t,n]),Ou(e&&(!t||o),r)}const $m=d.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:a,align:l,sideOffset:c=0,alignOffset:f=0,collisionBoundary:A="clipping-ancestors",collisionPadding:g=5,arrowPadding:h=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:x=ou,style:I,...b}=t,{store:v}=$n(),y=Qm(),w=qi(!0),C=v.useState("parent"),E=v.useState("floatingRootContext"),R=v.useState("floatingTreeRoot"),S=v.useState("mounted"),k=v.useState("open"),F=v.useState("modal"),B=v.useState("openMethod"),_=v.useState("activeTriggerElement"),M=v.useState("transitionStatus"),D=v.useState("positionerElement"),j=v.useState("instantType"),P=v.useState("adaptiveOrigin"),T=v.useState("lastOpenChangeReason"),N=v.useState("floatingNodeId"),Q=v.useState("floatingParentNodeId"),O=E.useState("domReferenceElement"),H=d.useRef(null),Y=yi(D);let U=r,z=c,L=f,Z=l,K=x;C.type==="context-menu"&&(U=r??C.context?.anchor,Z=Z??"start",!a&&Z!=="center"&&(L=t.alignOffset??2,z=t.sideOffset??-5));let ee=a,ce=Z;C.type==="menu"?(ee=ee??"inline-end",ce=ce??"start",K=t.collisionAvoidance??su):C.type==="menubar"&&(ee=ee??(C.context.orientation==="vertical"?"inline-end":"bottom"),ce=ce??"start");const ne=C.type==="context-menu",$=Vi({anchor:U,floatingRootContext:E,positionMethod:w?"fixed":o,mounted:S,side:ee,sideOffset:z,align:ce,alignOffset:L,arrowPadding:ne?0:h,collisionBoundary:A,collisionPadding:g,sticky:p,nodeId:N,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:K,shift:ne?{crossAxis:!("side"in K&&K.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:R,adaptiveOrigin:P});d.useEffect(()=>{function oe(ae){ae.open&&(ae.parentNodeId===N&&v.set("hoverEnabled",!1),ae.nodeId!==N&&ae.parentNodeId===v.select("floatingParentNodeId")&&v.setOpen(!1,Ce(rr)))}return R.events.on("menuopenchange",oe),()=>{R.events.off("menuopenchange",oe)}},[v,R.events,N]),d.useEffect(()=>{if(v.select("floatingParentNodeId")==null)return;function oe(ae){if(ae.open||ae.nodeId!==v.select("floatingParentNodeId"))return;const ge=ae.reason??rr;v.setOpen(!1,Ce(ge))}return R.events.on("menuopenchange",oe),()=>{R.events.off("menuopenchange",oe)}},[R.events,v]);const q=ut();d.useEffect(()=>{k||q.clear()},[k,q]),d.useEffect(()=>{function oe(ae){if(!(!k||ae.nodeId!==v.select("floatingParentNodeId")))if(ae.target&&_&&_!==ae.target){const ge=v.select("closeDelay");ge>0?q.isStarted()||q.start(ge,()=>{v.setOpen(!1,Ce(rr))}):v.setOpen(!1,Ce(rr))}else q.clear()}return R.events.on("itemhover",oe),()=>{R.events.off("itemhover",oe)}},[R.events,k,_,v,q]),d.useEffect(()=>{const oe={open:k,nodeId:N,parentNodeId:Q,reason:v.select("lastOpenChangeReason")};R.events.emit("menuopenchange",oe)},[R.events,k,v,N,Q]),ie(()=>{const oe=O,ae=H.current;if(oe&&(H.current=oe),ae&&oe&&oe!==ae){v.set("instantType",void 0);const ge=new AbortController;return Y(()=>{v.set("instantType","trigger-change")},ge.signal),()=>{ge.abort()}}},[O,Y,v]);const ue={open:k,side:$.side,align:$.align,anchorHidden:$.anchorHidden,nested:C.type==="menu",instant:j},le=C.type==="menubar"&&C.context.modal;td(k&&(le||F&&T!==ot),B==="touch",D,_);const se=Zi(t,ue,{styles:$.positionerStyles,transitionStatus:M,props:b,refs:[n,v.useStateSetter("positionerElement")],hidden:!S,inert:!k}),he=S&&C.type!=="menu"&&(C.type!=="menubar"&&F&&T!==ot||C.type==="menubar"&&C.context.modal);let re=null;return C.type==="menubar"?re=C.context.contentElement:C.type===void 0&&(re=_),u.jsxs(Zu.Provider,{value:$,children:[he&&u.jsx(Yi,{ref:C.type==="context-menu"||C.type==="nested-context-menu"?C.context.internalBackdropRef:null,inert:Gi(!k),cutout:re}),u.jsx(ih,{id:N,children:u.jsx(Mr,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:se})})]})}),Xm=d.createContext(null);function nd(e){return d.useContext(Xm)}const qm={...Ki,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 ex extends Dr{constructor(t){super({...nx(),...t},tx(),qm),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 tx(){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 Fr}}function nx(){return{...Oi(),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 Ri,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:it,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}const rx=d.createContext(void 0);function ox(){return d.useContext(rx)}const sx=Mi(function(t){const{children:n,open:r,onOpenChange:o,onOpenChangeComplete:s,defaultOpen:i=!1,disabled:a=!1,modal:l,loopFocus:c=!0,orientation:f="vertical",actionsRef:A,closeParentOnEsc:g=!1,handle:h,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:x=!0}=t,I=qi(!0),b=$n(!0),v=nd(!0),y=ox(),w=d.useMemo(()=>y&&b?{type:"menu",store:b.store}:v?{type:"menubar",context:v}:I&&!b?{type:"context-menu",context:I}:{type:void 0},[I,b,v,y]),C=ix({open:i,openProp:r,activeTriggerId:m,triggerIdProp:p,parent:w});C.useControlledProp("openProp",r),C.useControlledProp("triggerIdProp",p),C.useContextCallback("onOpenChangeComplete",s);const E=Wn(),R=Wn(),S=C.useState("floatingTreeRoot"),k=fu(S),F=vn(),B=C.useState("open"),_=C.useState("activeTriggerElement"),M=C.useState("positionerElement"),D=C.useState("hoverEnabled"),j=C.useState("disabled"),P=C.useState("lastOpenChangeReason"),T=C.useState("parent"),N=C.useState("activeIndex"),Q=C.useState("payload"),O=C.useState("floatingParentNodeId"),H=d.useRef(null),Y=d.useRef(T.type!=="context-menu"),U=ut(),z=d.useRef(!0),L=ut(),Z=O!=null,{openMethod:K,triggerProps:ee}=Wu(B);C.useSyncedValues({disabled:a,highlightItemOnHover:x,modal:T.type===void 0?l:void 0,openMethod:K,rootId:E}),_i(C);const{forceUnmount:ce}=ji(B,C,()=>{C.set("allowMouseEnter",!1)});ie(()=>{I&&!b?C.update({parent:{type:"context-menu",context:I},floatingNodeId:k,floatingParentNodeId:F}):b&&C.update({floatingNodeId:k,floatingParentNodeId:F})},[I,b,k,F,C]),d.useEffect(()=>{if(B||(H.current=null),T.type==="context-menu"){if(!B){U.clear(),Y.current=!1;return}U.start(500,()=>{Y.current=!0})}},[U,B,T.type]),ie(()=>{!B&&!D&&C.set("hoverEnabled",!0)},[B,D,C]);const ne=de((te,Ee)=>{const Se=Ee.reason;if(!te&&!C.select("open")||B===te&&Ee.trigger===_&&P===Se)return;const Le=ku(Ee);if(!te&&Ee.trigger==null&&(Ee.trigger=_??void 0),o?.(te,Ee),Ee.isCanceled)return;C.state.floatingRootContext.dispatchOpenChange(te,Ee);const Ye=Ee.event;if(te===!1&&Ye?.type==="click"&&Ye.pointerType==="touch"&&!z.current)return;te&&Se===jn?(z.current=!1,L.start(300,()=>{z.current=!0})):(z.current=!0,L.clear());const Oe=(Se===Fn||Se===cr)&&Ye.detail===0,at=!te&&(Se===Co||Se==null),qe={open:te,openChangeReason:Se};H.current=Ee.event,Ti(qe,te,Ee.trigger,Le()),C.update(qe),T.type==="menubar"&&(Se===jn||Se===Sn||Se===ot||Se===ws||Se===rr)?C.set("instantType","group"):Oe||at?C.set("instantType",Oe?"click":"dismiss"):C.set("instantType",void 0)}),$=Iu({popupStore:C,floatingId:R,nested:F!=null,onOpenChange:ne}),q=$.context.events;ie(()=>{const te=({open:Ee,eventDetails:Se})=>ne(Ee,Se);return q.on("setOpen",te),()=>{q?.off("setOpen",te)}},[q,ne]);const ue=d.useCallback(()=>{C.setOpen(!1,Ce(ei))},[C]);d.useImperativeHandle(A,()=>({unmount:ce,close:ue}),[ce,ue]);let le;T.type==="context-menu"&&(le=T.context),d.useImperativeHandle(le?.positionerRef,()=>M,[M]),d.useImperativeHandle(le?.actionsRef,()=>({setOpen:ne}),[ne]);const Ae=Po($,{enabled:!j,bubbles:{escapeKey:g&&T.type==="menu"},outsidePress(){return T.type!=="context-menu"||H.current?.type==="contextmenu"?!0:Y.current},externalTree:Z?S:void 0}),se=Wo(),he=d.useCallback(te=>{C.select("activeIndex")!==te&&C.set("activeIndex",te)},[C]),re=Tu($,{enabled:!j,listRef:C.context.itemDomElements,activeIndex:N,nested:T.type!==void 0,loopFocus:c,orientation:f,parentOrientation:T.type==="menubar"?T.context.orientation:void 0,rtl:se==="rtl",disabledIndices:_t,onNavigate:he,openOnArrowKeyDown:T.type!=="context-menu",externalTree:Z?S:void 0,focusItemOnHover:x}),oe=d.useCallback(te=>{C.context.typingRef.current=te},[C]),ae=_u($,{enabled:!j,listRef:C.context.itemLabels,elementsRef:C.context.itemDomElements,activeIndex:N,resetMs:eh,onMatch:te=>{B&&te!==N&&C.set("activeIndex",te)},onTyping:oe}),ge=d.useMemo(()=>{const te=Bt(ae.reference,re.reference,Ae.reference,{onMouseMove(){C.set("allowMouseEnter",!0)}},ee);return te["aria-haspopup"]="menu",te["aria-expanded"]=B,te},[C,ae.reference,re.reference,Ae.reference,ee,B]),me=d.useMemo(()=>{const te=Bt(re.trigger,Ae.trigger,ee);return te["aria-haspopup"]="menu",te["aria-expanded"]=!1,te},[re.trigger,Ae.trigger,ee]),W=d.useMemo(()=>Bt(jo,{id:R,role:"menu","aria-labelledby":_?.id,onMouseMove(){C.set("allowMouseEnter",!0),T.type==="menu"&&C.set("hoverEnabled",!1)},onClick(){C.select("hoverEnabled")&&C.set("hoverEnabled",!1)},onKeyDown(te){const Ee=C.select("keyboardEventRelay");Ee&&!te.isPropagationStopped()&&Ee(te)}},ae.floating,re.floating,Ae.floating),[_,R,T.type,C,ae.floating,re.floating,Ae.floating]),G=re.item??it;Ni(C,{floatingRootContext:$,activeTriggerProps:ge,inactiveTriggerProps:me,popupProps:W,itemProps:G});const be=d.useMemo(()=>({store:C,parent:w}),[C,w]),X=u.jsxs($u.Provider,{value:be,children:[h&&u.jsx(Pi,{handle:h,store:C}),typeof n=="function"?n({payload:Q}):n]});return T.type===void 0||T.type==="context-menu"?u.jsx(ah,{externalTree:S,children:X}):X});function ix(e){return Et(()=>new ex(e)).current}const Gr=5;function rd(e,t){const n=ax(t);return e.clientX>=n.left-Gr&&e.clientX<=n.right+Gr&&e.clientY>=n.top-Gr&&e.clientY<=n.bottom+Gr}function ax(e){const t=e.getBoundingClientRect(),n=tt(e);if(di)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,c=parseFloat(o.height)||0,f=Math.max(t.width,i,l),A=Math.max(t.height,a,c),g=f-t.width,h=A-t.height;return{left:t.left-g/2,right:t.right+g/2,top:t.top-h/2,bottom:t.bottom+h/2}}function od(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=ni(),{ref:o,index:s}=Go(e),i=n===s,a=d.useRef(null),l=Qt(o,a);return{compositeProps:{tabIndex:i?0:-1,onFocus(){r(s)},onMouseMove(){const f=a.current;if(!t||!f)return;const A=f.hasAttribute("disabled")||f.ariaDisabled==="true";!i&&!A&&f.focus()}},compositeRef:l,index:s}}function sd(e){const{render:t,className:n,style:r,state:o=it,props:s=_t,refs:i=_t,metadata:a,stateAttributesMapping:l,tag:c="div",...f}=e,{compositeProps:A,compositeRef:g}=od({metadata:a});return Me(c,e,{state:o,ref:[g,...i],props:[A,...s,f],stateAttributesMapping:l})}function id(e){if(Ve(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!kn(e))return id(Ln(e))}function lx(e,t){const n=d.useRef(null);function r(s){on.flushSync(()=>{e.setOpen(!1,Ce(Sn,s.nativeEvent,s.currentTarget))}),DA(n.current)?.focus()}function o(s){const i=e.select("positionerElement");if(i&&Nn(s,i))e.context.beforeContentFocusGuardRef.current?.focus();else{on.flushSync(()=>{e.setOpen(!1,Ce(Sn,s.nativeEvent,s.currentTarget))});let a=RA(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&ve(i,a);){const l=a;if(a=bi(a),a===l)break}a?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:o}}function cx(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())}}:it,[t,n,r])}const ux=Cu(function(t,n){const{render:r,className:o,style:s,disabled:i=!1,nativeButton:a=!0,id:l,openOnHover:c,delay:f=100,closeDelay:A=0,handle:g,payload:h,...p}=t,m=$n(!0),I=Du(g)??m?.store;if(!I)throw new Error(nt(85));const b=It(l),v=I.useState("isTriggerActive",b),y=I.useState("floatingRootContext"),w=I.useState("isOpenedByTrigger",b),C=I.useState("triggerPopupId",b),E=d.useRef(null),R=fx(),S=ni(!0),k=yn(),F=d.useMemo(()=>k??new Ri,[k]),B=fu(F),_=vn(),{registerTrigger:M,isMountedByThisTrigger:D}=Eu(b,E,I,{payload:h,closeDelay:A,parent:R,floatingTreeRoot:F,floatingNodeId:B,floatingParentNodeId:_,keyboardEventRelay:S?.relayKeyboardEvent}),j=R.type==="menubar",P=I.useState("disabled"),T=i||P||j&&R.context.disabled,{getButtonProps:N,buttonRef:Q}=Gt({disabled:T,native:a});d.useEffect(()=>{!w&&R.type===void 0&&(I.context.allowMouseUpTriggerRef.current=!1)},[I,w,R.type]);const O=d.useRef(null),H=ut(),Y=de(oe=>{if(!O.current)return;H.clear(),I.context.allowMouseUpTriggerRef.current=!1;const ae=oe.target;ve(O.current,ae)||ve(I.select("positionerElement"),ae)||ae===O.current||ae!=null&&id(ae)===I.select("rootId")||rd(oe,O.current)||F.events.emit("close",{domEvent:oe,reason:Fc})});d.useEffect(()=>{w&&I.select("lastOpenChangeReason")===ot&&Be(O.current).addEventListener("mouseup",Y,{once:!0})},[w,Y,I]);const U=j&&R.context.hasSubmenuOpen,L=Pu(y,{enabled:(c??U)&&!T&&(!j||U&&!D),handleClose:ju({blockPointerEvents:!j}),mouseOnly:!0,move:!1,restMs:R.type===void 0?f:void 0,delay:{close:A},triggerElementRef:E,externalTree:F,isActiveTrigger:v,isClosing:()=>I.select("transitionStatus")==="ending"}),Z=dx(w,I.select("lastOpenChangeReason")),K=pu(y,{enabled:!T,event:w&&j?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:R.type===void 0?Z:!1}),ee=Fu(y,{enabled:!T&&U}),ce=cx({open:w,enabled:j,mouseDownAction:"open"}),ne=d.useMemo(()=>Bt(ee.reference,K.reference),[ee.reference,K.reference]),$=I.useState("triggerProps",D),{preFocusGuardRef:q,handlePreFocusGuardFocus:ue,handleFocusTargetFocus:le}=lx(I,E),Ae={disabled:T,open:w},se=[O,n,Q,M,E],he=[ne,L??it,$,{"aria-haspopup":"menu","aria-controls":C,id:b,onMouseDown:oe=>{if(I.select("open"))return;H.start(200,()=>{I.context.allowMouseUpTriggerRef.current=!0}),Be(oe.currentTarget).addEventListener("mouseup",Y,{once:!0})}},j?{role:"menuitem"}:{},ce,p,N],re=Me("button",t,{enabled:!j,stateAttributesMapping:Bs,state:Ae,ref:se,props:he});return j?u.jsx(sd,{tag:"button",render:r,className:o,style:s,state:Ae,refs:se,props:he,stateAttributesMapping:Bs}):w?u.jsxs(d.Fragment,{children:[u.jsx(Un,{ref:q,onFocus:ue},`${b}-pre-focus-guard`),u.jsx(d.Fragment,{children:re},b),u.jsx(Un,{ref:I.context.triggerFocusTargetRef,onFocus:le},`${b}-post-focus-guard`)]}):u.jsx(d.Fragment,{children:re},b)});function dx(e,t){const n=ut(),[r,o]=d.useState(!1);return ie(()=>{e&&t===ot?(o(!0),n.start(th,()=>{o(!1)})):e||(n.clear(),o(!1))},[e,t,n]),r}function fx(){const e=nd();return d.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}function ad(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function ml({...e}){return u.jsx(sx,{"data-slot":"dropdown-menu",...e})}function xl({...e}){return u.jsx(ux,{"data-slot":"dropdown-menu-trigger",...e})}function bl({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:o,...s}){return u.jsx(Gm,{children:u.jsx($m,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:u.jsx(Lm,{"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 vl({className:e,inset:t,variant:n="default",...r}){return u.jsx(Km,{"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 Ao=["zh-CN","ja","ko","en","ar","fr","es","de","ru"],px=["ar"],ld=e=>px.includes(e)?"rtl":"ltr",Ax=e=>({"zh-CN":"简体中文",ja:"日本語",ko:"한국어",en:"English",ar:"العربية",fr:"Français",es:"Español",de:"Deutsch",ru:"Русский"})[e],hx=e=>{for(const t of e){const n=t.toLowerCase(),r=Ao.find(i=>i.toLowerCase()===n);if(r!==void 0)return r;const o=n.split("-")[0],s=Ao.find(i=>i.toLowerCase().split("-")[0]===o);if(s!==void 0)return s;if(o==="zh")return"zh-CN"}return"en"},Jt={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:"}},cn=(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)},gx={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:"导出被阻止:"}},mx={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:"エクスポートをブロック:"}},xx={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:"내보내기 차단:"}},bx={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:"التصدير محجوب:"}},vx={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é :"}},yx={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:"}},Cx={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:"}},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:"Отсутствует 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:"Экспорт заблокирован:"}},wx={en:Jt,"zh-CN":cn(Jt,gx),ja:cn(Jt,mx),ko:cn(Jt,xx),ar:cn(Jt,bx),fr:cn(Jt,vx),es:cn(Jt,yx),de:cn(Jt,Cx),ru:cn(Jt,Ix)},kx=e=>wx[e],cd="create-opentray.locale",ud="create-opentray.theme",dd="lang",fd=new Set(Ao),Ex=()=>{try{const t=new URLSearchParams(window.location.search).get(dd);return t!==null&&fd.has(t)?t:null}catch{return null}},Sx=e=>{try{const t=new URL(window.location.href);t.searchParams.set(dd,e),window.history.replaceState(null,"",t)}catch{}},yl=e=>{try{return window.localStorage.getItem(e)}catch{return null}},Cl=(e,t)=>{try{window.localStorage.setItem(e,t)}catch{}},Rx=()=>window.matchMedia("(prefers-color-scheme: dark)").matches,Il=e=>e==="system"?Rx()?"dark":"light":e,Ws=(e,t)=>{const n=document.documentElement;n.lang=e,n.dir=ld(e),n.classList.toggle("dark",Il(t)==="dark"),n.style.colorScheme=Il(t)},Dx=()=>{const e=Ex(),t=e!==null?e:null,n=yl(cd),r=t!==null?t:n!==null&&fd.has(n)?n:hx(navigator.languages??[navigator.language]),o=yl(ud);return{locale:r,theme:o==="light"||o==="dark"||o==="system"?o:"system"}},pd=d.createContext(void 0),Fx=({initialLocale:e,initialTheme:t,children:n})=>{const[r,o]=d.useState(e),[s,i]=d.useState(t);d.useEffect(()=>{Ws(r,s)},[r,s]),d.useEffect(()=>{if(s!=="system")return;const f=window.matchMedia("(prefers-color-scheme: dark)"),A=()=>{Ws(r,"system")};return f.addEventListener("change",A),()=>f.removeEventListener("change",A)},[s,r]);const a=d.useCallback(f=>{Sx(f),Cl(cd,f),o(f)},[]),l=d.useCallback(f=>{Cl(ud,f),i(f)},[]),c=d.useMemo(()=>({locale:r,messages:kx(r),direction:ld(r),theme:s,setLocale:a,setTheme:l}),[r,s,a,l]);return u.jsx(pd.Provider,{value:c,children:n})},Yo=()=>{const e=d.useContext(pd);if(e===void 0)throw new Error("usePreferences must be used inside PreferencesProvider");return e},Ad=d.createContext(void 0),hd=()=>{const[e]=Xc(),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}},gd=()=>{const e=d.useContext(Ad);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"},Mx=({product:e})=>{const{state:t,toggleSidebar:n}=Qo(),r=t==="collapsed",o=`${e} · ${r?"展开":"收起"}`;return r?u.jsx(fr,{size:"lg",className:"group/brand relative justify-center",children:u.jsxs("span",{className:"relative grid size-8 shrink-0 place-items-center",children:[u.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"}),u.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:u.jsx(Ra,{"aria-hidden":!0,className:"size-4"})})]})}):u.jsxs(fr,{size:"lg",className:"justify-start pr-1",children:[u.jsx("img",{src:"/logo.png",alt:e,width:24,height:24,className:"size-6 shrink-0 rounded-md"}),u.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:e}),u.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:u.jsx(Ra,{"aria-hidden":!0,className:"size-4"})})]})},Px=({children:e,panelOpen:t})=>{const{locale:n,messages:r,setLocale:o,theme:s,setTheme:i}=Yo(),{route:a}=hd(),l=d.useCallback(m=>{window.location.hash=`#/${m}`},[]),[c,f]=d.useState(()=>window.innerWidth>=768),A=t===!0;d.useEffect(()=>{const m=window.matchMedia("(min-width: 768px)"),x=()=>{f(m.matches&&!A)};return x(),m.addEventListener("change",x),()=>m.removeEventListener("change",x)},[A]);const g=d.useMemo(()=>({route:a,navigate:l}),[a,l]),h=[{route:"add",icon:u.jsx(Tc,{"aria-hidden":!0}),label:r.nav.add},{route:"applications",icon:u.jsx(Ep,{"aria-hidden":!0}),label:r.nav.applications},{route:"help",icon:u.jsx(pp,{"aria-hidden":!0}),label:r.nav.help}],p=s==="system"?r.theme.system:s==="light"?r.theme.light:r.theme.dark;return u.jsx(Ad.Provider,{value:g,children:u.jsxs(Em,{open:c,onOpenChange:f,children:[u.jsxs(Sm,{collapsible:"icon",children:[u.jsx(Dm,{children:u.jsx(us,{children:u.jsx(Qr,{children:u.jsx(Mx,{product:r.shell.product})})})}),u.jsx(Bm,{children:u.jsx(Mm,{children:u.jsx(Pm,{children:u.jsx(us,{children:h.map(m=>u.jsx(Qr,{children:u.jsxs(Ji,{children:[u.jsxs($i,{render:u.jsx(fr,{isActive:a===m.route,tooltip:m.label,"aria-label":m.label,onClick:()=>{l(m.route)}}),children:[m.icon,u.jsx("span",{children:m.label})]}),u.jsx(Xi,{side:"right",children:m.label})]})},m.route))})})})}),u.jsx(Fm,{children:u.jsxs(us,{children:[u.jsx(Qr,{children:u.jsxs(ml,{children:[u.jsx(xl,{render:u.jsxs(fr,{tooltip:r.language.title,"aria-label":r.language.title,children:[u.jsx("span",{"aria-hidden":!0,className:"text-xs font-semibold",children:Bx[n]}),u.jsx("span",{children:r.language.title})]})}),u.jsx(bl,{side:"top",align:"start",children:Ao.map(m=>u.jsx(vl,{onClick:()=>{o(m)},children:Ax(m)},m))})]})}),u.jsx(Qr,{children:u.jsxs(ml,{children:[u.jsx(xl,{render:u.jsxs(fr,{tooltip:`${r.theme.title}: ${p}`,"aria-label":`${r.theme.title}: ${p}`,children:[s==="light"?u.jsx(Vp,{"aria-hidden":!0}):s==="dark"?u.jsx(Mp,{"aria-hidden":!0}):u.jsx(Fp,{"aria-hidden":!0}),u.jsx("span",{children:p})]})}),u.jsx(bl,{side:"top",align:"start",children:[["system",r.theme.system],["light",r.theme.light],["dark",r.theme.dark]].map(([m,x])=>u.jsx(vl,{onClick:()=>{i(m)},children:x},m))})]})})]})}),u.jsx(Rm,{"aria-label":r.shell.toggleSidebar})]}),u.jsx("main",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:e})]})})},Tx=()=>new URLSearchParams(window.location.search).get("token")??"",an=async(e,t={})=>{const n=await fetch(e,{method:t.method??"GET",headers:{authorization:`Bearer ${Tx()}`,...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}},_x=()=>an("/api/apps"),md=e=>an(`/api/apps/${encodeURIComponent(e)}/config`),jx=e=>an(`/api/apps/${encodeURIComponent(e)}/icon`),Nx=(e,t)=>an(`/api/apps/${encodeURIComponent(e)}/uninstall`,{method:"POST",body:{...t}}),Ox=()=>an("/api/skill/list"),Hx=e=>an(`/api/skill?path=${encodeURIComponent(e)}`),Kx=(e,t)=>an(`/api/apps/${encodeURIComponent(e)}/export`,{method:"POST",body:{...t}}),Wx=e=>an(`/api/apps/${encodeURIComponent(e)}/open`,{method:"POST",body:{}}),Lx=e=>an("/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 Qx(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 xd(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":""}:{"data-unchecked":""}},...ri}}const Gx=d.createContext(void 0);function Yx(){return d.useContext(Gx)}const bd=d.createContext(void 0);function Ux(){const e=d.useContext(bd);if(e===void 0)throw new Error(nt(14));return e}const zx="data-parent",Vx=d.forwardRef(function(t,n){const{checked:r,className:o,defaultChecked:s=!1,"aria-labelledby":i,disabled:a=!1,form:l,id:c,indeterminate:f=!1,inputRef:A,name:g,onCheckedChange:h,parent:p=!1,readOnly:m=!1,render:x,required:I=!1,uncheckedValue:b,value:v,nativeButton:y=!1,style:w,...C}=t,{clearErrors:E}=oi(),{disabled:R,name:S,setDirty:k,setFilled:F,setFocused:B,setTouched:_,state:M,validationMode:D,validityData:j,validation:P}=wo(),T=MA(),{labelId:N,controlId:Q,registerControlId:O,getDescriptionProps:H}=si(),Y=Yx(),U=Y?.allValues===void 0?void 0:Y.parent,z=U!==void 0,L=R||T.disabled||Y?.disabled||a,Z=S??g,K=v??Z,ee=It(),ce=It();let ne=c||Q;z&&(p?ne=ce:K!==void 0?ne=`${U.id}-${K}`:ne||=ce);let $={};z&&(p?$=U.getParentProps():K!==void 0&&($=U.getChildProps(K)));const{checked:q=r,indeterminate:ue=f,onCheckedChange:le,...Ae}=$,se=Y?.value,he=d.useRef(null),re=Et(()=>Symbol()),oe=d.useRef(!1),{getButtonProps:ae,buttonRef:ge}=Gt({disabled:L,native:y}),me=Y?.validation??P,[W,G]=rn({controlled:K!==void 0&&se!==void 0&&!p?se.includes(K):q,default:s,name:"Checkbox",state:"checked"}),be=z?!!q:W,X=z&&ue||f;ie(()=>{O!==pr&&(oe.current=!0,O(re.current,ne))},[ne,O,re]),d.useEffect(()=>{const Ie=re.current;return()=>{!oe.current||O===pr||(oe.current=!1,O(Ie,void 0))}},[O,re]),ii(he,ee,W,void 0,!Y&&!L,g);const te=d.useRef(null),Ee=me.registerInput,Se=Y?K:void 0,Le=d.useCallback(Ie=>Ee(Ie,{controlRef:he,value:Se}),[Ee,Se]),Ye=Qt(A,te,p?void 0:Le),Oe=jc(i,N,te,!y,ne??void 0);ie(()=>{te.current&&(te.current.indeterminate=X,W&&F(!0))},[W,X,F]),Ko(W,()=>{Y||(E(Z),F(W),k(W!==j.initialValue),me.change(W))});const at=Bt({checked:W,disabled:L,form:l,name:p?void 0:Z,id:y?void 0:ne??void 0,required:I,ref:Ye,style:Z?Ei:Mo,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Ie){if(Ie.nativeEvent.defaultPrevented)return;if(m){Ie.preventDefault();return}const He=Ie.currentTarget.checked,_e=Ce(Pt,Ie.nativeEvent);if(h?.(He,_e),!_e.isCanceled&&(le?.(He,_e),!_e.isCanceled&&(G(He),K!==void 0&&Y!==void 0&&!p&&!z))){const et=He?[...Y.value,K]:Y.value.filter(Re=>Re!==K);Y.setValue(et,_e)}},onClick(Ie){Ie.stopPropagation()},onFocus(){he.current?.focus()}},v!==void 0?{value:(Y?W&&v:v)||""}:it,H,Ie=>me.getValidationProps(L,Ie));d.useEffect(()=>{if(!U||K===void 0)return;const Ie=U.disabledStatesRef.current;return Ie.set(K,L),()=>{Ie.delete(K)}},[U,L,K]);const qe=d.useMemo(()=>({...M,checked:be,disabled:L,readOnly:m,required:I,indeterminate:X}),[M,be,L,m,I,X]),Ze=xd(qe),dt=Me("span",t,{state:qe,ref:[ge,he,n],props:[{id:y?ne??void 0:ee,role:"checkbox","aria-checked":X?"mixed":be,"aria-readonly":m||void 0,"aria-required":I||void 0,"aria-labelledby":Oe,[zx]:p?"":void 0,onFocus(){L||B(!0)},onBlur(){const Ie=te.current;Ie&&(_(!0),B(!1),D==="onBlur"&&me.commit(Y?se:Ie.checked))},onKeyDown(Ie){if(Ie.key!=="Enter"||(Ie.preventBaseUIHandler(),Ie.defaultPrevented))return;const He=te.current?.form??null,_e=Ie.currentTarget,et=Ie.nativeEvent,Re=Ie.preventDefault,Ue=et.preventDefault;let ze=!1;Ie.preventDefault=()=>{ze=!0,Re.call(Ie)},et.preventDefault=()=>{ze=!0,Ue.call(et)},Ue.call(et),tt(_e).queueMicrotask(()=>{Ie.preventDefault=Re,et.preventDefault=Ue,ze||Qx(He)?.click()})},onClick(Ie){if(m||L)return;Ie.preventDefault();const He=te.current;He&&ti(He,Ie)}},C,Ae,ae,H,Ie=>me.getValidationProps(L,Ie)],stateAttributesMapping:Ze});return u.jsxs(bd.Provider,{value:qe,children:[dt,!W&&!Y&&Z&&!p&&b!==void 0&&u.jsx("input",{type:"hidden",form:l,name:Z,value:b,disabled:L}),u.jsx("input",{...at,suppressHydrationWarning:!0})]})}),Zx=d.forwardRef(function(t,n){const{render:r,className:o,style:s,keepMounted:i=!1,...a}=t,l=Ux(),c=l.checked||l.indeterminate,{mounted:f,transitionStatus:A,setMounted:g}=Jn(c),h=d.useRef(null),p={...l,transitionStatus:A};Yt({open:c,ref:h,onComplete(){c||g(!1)}});const x={...xd(l),...Bn},I=i||f,b=Me("span",t,{ref:[n,h],state:p,stateAttributesMapping:x,props:a});return I?b:null});function Ls({className:e,...t}){return u.jsx(Vx,{"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:u.jsx(Zx,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:u.jsx(Mc,{})})})}function ct({className:e,...t}){return u.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 vd=d.createContext(void 0);function yd(){const e=d.useContext(vd);if(e===void 0)throw new Error(nt(10));return e}const Jx={value:()=>null},$x=d.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,hiddenUntilFound:i,keepMounted:a,loopFocus:l,onValueChange:c,multiple:f=!1,orientation:A="vertical",value:g,defaultValue:h,style:p,...m}=t,x=d.useMemo(()=>{if(g===void 0)return h??[]},[g,h]),I=d.useRef([]),[b,v]=rn({controlled:g,default:x,name:"Accordion",state:"value"}),y=de((R,S,k)=>{if(f)if(S){const F=b.slice();if(F.push(R),c?.(F,k),k.isCanceled)return;v(F)}else{const F=b.filter(B=>B!==R);if(c?.(F,k),k.isCanceled)return;v(F)}else{const F=b[0]===R?[]:[R];if(c?.(F,k),k.isCanceled)return;v(F)}}),w=d.useMemo(()=>({value:b,disabled:s,orientation:A}),[b,s,A]),C=d.useMemo(()=>({disabled:s,handleValueChange:y,hiddenUntilFound:i??!1,keepMounted:a??!1,state:w,value:b}),[s,y,i,a,w,b]),E=Me("div",t,{state:w,ref:n,props:m,stateAttributesMapping:Jx});return u.jsx(vd.Provider,{value:C,children:u.jsx(Mr,{elementsRef:I,children:E})})});function Xx(e){const{open:t,defaultOpen:n,onOpenChange:r,disabled:o}=e,[s,i]=rn({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:a,setMounted:l,transitionStatus:c}=Jn(s,!0,!0),f=It(),[A,g]=d.useState(),h=A===null?void 0:A??f,p=de(m=>{const x=!s,I=Ce(Fn,m.nativeEvent);r(x,I),!I.isCanceled&&i(x)});return d.useMemo(()=>({defaultPanelId:f,disabled:o,handleTrigger:p,mounted:a,open:s,panelId:h,setMounted:l,setOpen:i,setPanelIdState:g,transitionStatus:c}),[f,o,p,a,s,h,l,i,g,c])}const Cd=d.createContext(void 0);function Id(){const e=d.useContext(Cd);if(e===void 0)throw new Error(nt(15));return e}const wd=d.createContext(void 0);function ta(){const e=d.useContext(wd);if(e===void 0)throw new Error(nt(9));return e}let na=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=co.startingStyle]="startingStyle",e[e.endingStyle=co.endingStyle]="endingStyle",e})({}),qx=(function(e){return e.panelOpen="data-panel-open",e})({});const eb={[na.open]:""},tb={[na.closed]:""},nb={open(e){return e?{[qx.panelOpen]:""}:null}},rb={open(e){return e?eb:tb}};let ob=(function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e})({});const ra={...rb,index:e=>({[ob.index]:String(e)}),...Bn,value:()=>null},sb=d.forwardRef(function(t,n){const{className:r,disabled:o=!1,onOpenChange:s,render:i,value:a,style:l,...c}=t,{ref:f,index:A}=Go(),g=Qt(n,f),{disabled:h,handleValueChange:p,state:m,value:x}=yd(),I=It(),b=a??I,v=o||h,y=x.indexOf(b)!==-1,w=de((j,P)=>{s?.(j,P),!P.isCanceled&&p(b,j,P)}),C=Xx({open:y,onOpenChange:w,disabled:v}),E=d.useMemo(()=>({open:C.open,disabled:C.disabled,transitionStatus:C.transitionStatus}),[C.open,C.disabled,C.transitionStatus]),R=d.useMemo(()=>({...C,onOpenChange:w,state:E}),[C,E,w]),S=d.useMemo(()=>({...m,hidden:!y&&!C.mounted,index:A,disabled:v,open:y}),[C.mounted,v,A,y,m]),k=It(),[F,B]=d.useState(),_=F===null?void 0:F??k,M=d.useMemo(()=>({defaultTriggerId:k,open:y,state:S,setTriggerId:B,triggerId:_}),[k,y,S,B,_]),D=Me("div",t,{state:S,ref:g,props:c,stateAttributesMapping:ra});return u.jsx(Cd.Provider,{value:R,children:u.jsx(wd.Provider,{value:M,children:D})})}),ib=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{state:a}=ta();return Me("h3",t,{state:a,ref:n,props:i,stateAttributesMapping:ra})}),ab=d.forwardRef(function(t,n){const{disabled:r,className:o,id:s,render:i,nativeButton:a=!0,style:l,...c}=t,{panelId:f,open:A,handleTrigger:g,disabled:h}=Id(),p=r||h,{getButtonProps:m,buttonRef:x}=Gt({disabled:p,focusableWhenDisabled:!0,native:a}),{defaultTriggerId:I,state:b,setTriggerId:v}=ta(),y=s||void 0,w=y??I;return ie(()=>(v(R=>y??(R===null?void 0:R)),()=>{v(R=>R===y?null:R)}),[y,v]),Me("button",t,{state:b,ref:[n,x],props:[{"aria-controls":A?f:void 0,"aria-expanded":A,id:w,onClick:g},c,m],stateAttributesMapping:nb})}),tr={height:void 0,width:void 0};function lb(e){const{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:o,mounted:s,onOpenChange:i,open:a,setMounted:l,setOpen:c,transitionStatus:f}=e,A=d.useRef(null),g=d.useRef(null),[h,p]=d.useState(tr),m=d.useRef(tr),x=d.useRef(!1),I=d.useRef(a),b=d.useRef(!1),[v,y]=d.useState(!1),w=d.useRef(null),C=Qt(t,A),E=Xe(a),R=yi(A),S=!a&&!s,k=v?"idle":f,F=a&&(I.current||b.current),B=!a&&s&&g.current==="css-animation"&&h.height===void 0&&h.width===void 0?m.current:h,_=n&&S&&g.current!=="css-animation",M=de((N,Q=!0)=>{Q&&(m.current=N),p(N)}),D=de(()=>{w.current?.(),w.current=null}),j=de(N=>{D(),w.current=()=>{w.current=null,N()}}),P=de(()=>{a&&s&&g.current==="css-animation"&&(b.current=!0)});ie(()=>{!v||f==="starting"||y(!1)},[v,f]),d.useEffect(()=>()=>{P(),D()},[P,D]),ie(()=>{const N=A.current;if(!N)return;!a&&w.current&&D();const Q=cb(N,F);if(g.current=Q,a&&f==="idle"&&I.current&&Q==="css-animation"){m.current=Pn(N);return}if(a&&f==="starting"){const Y=x.current;if(x.current=!1,Q==="none"){M(Pn(N)),y(!0);return}if(Q==="css-transition"){const L=ub(N);if(M(Pn(N)),!Y)return L;const Z=Yr(N,"transition-duration","0s");return j(Z),y(!0),L}M(Pn(N));const U=Yr(N,"animation-name","none");if(!Y){U();return}const z=Yr(N,"animation-duration","0s");U(),j(z),y(!0);return}if(!a&&s&&(f==="idle"||f==="starting")){if(I.current=!1,b.current=!1,Q==="none"){M(tr,!1),l(!1);return}M(Pn(N));return}if(f!=="ending")return;if(Q==="none"){l(!1);return}const O=Pn(N);if(!(O.height>0||O.width>0)){l(!1);return}M(O),Q==="css-animation"&&Yr(N,"animation-name","none")()},[s,a,D,M,l,j,F,f]),Yt({enabled:a&&s&&k==="idle",open:!0,ref:A,onComplete(){a&&M(tr,!1)}}),d.useEffect(()=>{if(a||!s||k!=="ending"||!A.current)return;const Q=new AbortController;let O=-1;function H(){E.current||(l(!1),M(tr,!1))}return O=Ct.request(()=>{R(H,Q.signal)}),()=>{Ct.cancel(O),Q.abort()}},[E,s,a,k,R,M,l]),ie(()=>{const N=A.current;!N||!n||!S||N.setAttribute("hidden","until-found")},[S,n]),d.useEffect(function(){const Q=A.current;if(!Q)return;function O(H){const Y=Ce(Pt,H);i(!0,Y),!Y.isCanceled&&(x.current=!0,c(!0))}return Fe(Q,"beforematch",O)},[i,c]);const T=o||n||s||a;return{height:B.height,props:{..._?{[na.startingStyle]:""}:void 0,hidden:S,id:r},ref:C,shouldPreventOpenAnimation:F,shouldRender:T,transitionStatus:k,width:B.width}}function Pn(e){return{height:e.scrollHeight,width:e.scrollWidth}}function cb(e,t){const n=tt(e).getComputedStyle(e),r=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&wl(n.animationDuration),o=wl(n.transitionDuration);return r&&o||o?"css-transition":r?"css-animation":"none"}function wl(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function Yr(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 ub(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 kl=(function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e})({});const db=d.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,id:i,render:a,style:l,...c}=t,{hiddenUntilFound:f,keepMounted:A}=yd(),{defaultPanelId:g,mounted:h,onOpenChange:p,open:m,setMounted:x,setOpen:I,setPanelIdState:b,transitionStatus:v}=Id(),y=o??f,w=s??A,C=i||void 0,E=i??g;ie(()=>(b(Q=>C??(Q===null?void 0:Q)),()=>{b(Q=>Q===C?null:Q)}),[C,b]);const{height:R,props:S,ref:k,shouldPreventOpenAnimation:F,shouldRender:B,transitionStatus:_,width:M}=lb({externalRef:n,hiddenUntilFound:y,id:E,keepMounted:w,mounted:h,onOpenChange:p,open:m,setMounted:x,setOpen:I,transitionStatus:v}),{state:D,triggerId:j}=ta(),P={...D,transitionStatus:_},T=Uf(l,P),N=Me("div",{...t,style:void 0},{state:P,ref:k,props:[S,{"aria-labelledby":j,role:"region",style:{[kl.accordionPanelHeight]:R===void 0?"auto":`${R}px`,[kl.accordionPanelWidth]:M===void 0?"auto":`${M}px`}},c,T?{style:T}:void 0,F?{style:{animationName:"none"}}:void 0],stateAttributesMapping:ra});return B?N:null});function oa({className:e,...t}){return u.jsx($x,{"data-slot":"accordion",className:fe("flex w-full flex-col",e),...t})}function sa({className:e,...t}){return u.jsx(sb,{"data-slot":"accordion-item",className:fe("not-last:border-b",e),...t})}function ia({className:e,children:t,...n}){return u.jsx(ib,{className:"flex",children:u.jsxs(ab,{"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,u.jsx(Er,{className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),u.jsx(li,{className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function aa({className:e,children:t,...n}){return u.jsx(db,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...n,children:u.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 kd=d.createContext(void 0);function fb(){return d.useContext(kd)}const pb=d.forwardRef(function(t,n){const{className:r,defaultPressed:o=!1,disabled:s=!1,form:i,onPressedChange:a,pressed:l,render:c,type:f,value:A,nativeButton:g=!0,style:h,...p}=t,m=It(A||void 0),x=fb(),I=x?.value??[],b=x?void 0:o,v=(s||x?.disabled)??!1,[y,w]=rn({controlled:x?m!==void 0&&I.indexOf(m)>-1:l,default:b,name:"Toggle",state:"pressed"}),{getButtonProps:C,buttonRef:E}=Gt({disabled:v,native:g}),R={disabled:v,pressed:y},S=[E,n],k=[{"aria-pressed":y,onClick(_){const M=!y,D=Ce(Pt,_.nativeEvent);a?.(M,D),!D.isCanceled&&(m&&x?.setGroupValue?.(m,M,D),!D.isCanceled&&w(M))}},p,C],F=Me("button",t,{enabled:!x,state:R,ref:S,props:k}),B=d.useMemo(()=>({disabled:v,focusableWhenDisabled:!1}),[v]);return x?u.jsx(sd,{tag:"button",render:c,className:r,style:h,metadata:B,state:R,refs:S,props:k}):F}),Ed="data-composite-item-active",Ab=[];function hb(e){const{loopFocus:t=!0,orientation:n="both",grid:r,onLoop:o,direction:s,highlightedIndex:i,onHighlightedIndexChange:a,rootRef:l,enableHomeAndEndKeys:c=!1,stopEventPropagation:f,disabledIndices:A,modifierKeys:g=Ab}=e,[h,p]=d.useState(0),m=r!=null,x=d.useRef(null),I=Qt(x,l),b=d.useRef([]),v=d.useRef(!1),y=i??h,w=de((k,F=!1)=>{if((a??p)(k),F){const B=b.current[k];sl(x.current,B,s,n)}}),C=de(k=>{if(k.size===0||v.current)return;v.current=!0;const F=Array.from(k.keys()),B=F.find(M=>M?.hasAttribute(Ed))??null,_=B?k.get(B)?.index??-1:-1;if(_!==-1)w(_);else if(lo(F,y,A)){const M=en(F,{disabledIndices:A});ur(F,M)||w(M)}sl(x.current,B,s,n)});ie(()=>{if(A==null||i!=null||!v.current)return;const k=b.current;if(lo(k,y,A)){const F=en(k,{disabledIndices:A});ur(k,F)||w(F)}},[A,i,y,b,w]);const E=de((k,F,B)=>o?o(k,F,B,b):B),R=de(k=>{const F=k.key===Hs||k.key===Ks;if(!Oo.has(k.key)||!c&&F||gb(k,g)||!x.current)return;const _=s==="rtl",M=_?Ns:Os,D=_?Os:Ns,j=n==="vertical"?js:M,P=n==="vertical"?_s:D,T=At(k.nativeEvent);if(T!=null&&ol(T)&&!ad(T)){const U=T.selectionStart,z=T.selectionEnd,L=T.value;if(U==null||k.shiftKey||U!==z||k.key!==P&&U<L.length||k.key!==j&&U>0)return}let N=y;const Q=Xr(b,A),O=Ds(b,A);r!=null&&(N=r({disabledIndices:A,elementsRef:b,event:k,highlightedIndex:y,loopFocus:t,maxIndex:O,minIndex:Q,onLoop:E,orientation:n,rtl:_}));const H=n!=="vertical"&&k.key===M||n!=="horizontal"&&k.key===js,Y=n!=="vertical"&&k.key===D||n!=="horizontal"&&k.key===_s;c&&(k.key===Hs?N=Q:k.key===Ks&&(N=O)),N===y&&(H||Y)&&(t&&N===O&&H?(N=Q,o&&(N=o(k,y,N,b))):t&&N===Q&&Y?(N=O,o&&(N=o(k,y,N,b))):N=en(b.current,{startingIndex:N,decrement:Y,disabledIndices:A})),N!==y&&!ur(b.current,N)&&(f&&k.stopPropagation(),(m||F||H||Y)&&k.preventDefault(),w(N,!0),queueMicrotask(()=>{b.current[N]?.focus()}))});return{props:{ref:I,onFocus(k){const F=x.current,B=At(k.nativeEvent);!F||B==null||!ol(B)||B.setSelectionRange(0,B.value.length)},onKeyDown:R},highlightedIndex:y,onHighlightedIndexChange:w,elementsRef:b,onMapChange:C,relayKeyboardEvent:R}}function gb(e,t){for(const n of Rg)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Sd(e){const{render:t,className:n,style:r,refs:o=_t,props:s=_t,state:i=it,stateAttributesMapping:a,highlightedIndex:l,onHighlightedIndexChange:c,orientation:f,grid:A,loopFocus:g,onLoop:h,enableHomeAndEndKeys:p,onMapChange:m,stopEventPropagation:x=!0,rootRef:I,disabledIndices:b,modifierKeys:v,highlightItemOnHover:y=!1,tag:w="div",...C}=e,E=Wo(),{props:R,highlightedIndex:S,onHighlightedIndexChange:k,elementsRef:F,onMapChange:B,relayKeyboardEvent:_}=hb({grid:A,loopFocus:g,onLoop:h,orientation:f,highlightedIndex:l,onHighlightedIndexChange:c,rootRef:I,stopEventPropagation:x,enableHomeAndEndKeys:p,direction:E,disabledIndices:b,modifierKeys:v}),M=Me(w,e,{state:i,ref:o,props:[R,...s,C],stateAttributesMapping:a}),D=d.useMemo(()=>({highlightedIndex:S,onHighlightedIndexChange:k,highlightItemOnHover:y,relayKeyboardEvent:_}),[S,k,y,_]);return u.jsx(ep.Provider,{value:D,children:u.jsx(Mr,{elementsRef:F,onMapChange:j=>{m?.(j),B(j)},children:M})})}const mb=d.createContext(void 0);function xb(){return d.useContext(mb)}const bb=d.forwardRef(function(t,n){const{defaultValue:r,disabled:o=!1,loopFocus:s=!0,onValueChange:i,orientation:a="horizontal",multiple:l=!1,value:c,className:f,render:A,style:g,...h}=t,p=ea(),m=xb(),x=c!==void 0||r!==void 0,I=(p?.disabled??!1)||(m?.disabled??!1)||o,[b,v]=rn({controlled:c,default:c===void 0?r??_t:void 0,name:"ToggleGroup",state:"value"}),y=de((S,k,F)=>{let B;l?(B=b.slice(),k?B.push(S):B.splice(b.indexOf(S),1)):B=k?[S]:[],i?.(B,F),!F.isCanceled&&v(B)}),w={disabled:I,multiple:l,orientation:a},C=d.useMemo(()=>({disabled:I,setGroupValue:y,value:b,isValueInitialized:x}),[I,y,b,x]),E={role:"group"},R=Me("div",t,{enabled:!!p,state:w,ref:n,props:[E,h]});return u.jsx(kd.Provider,{value:C,children:p?R:u.jsx(Sd,{render:A,className:f,style:g,state:w,refs:[n],props:[E,h],loopFocus:s,enableHomeAndEndKeys:!0,orientation:a})})}),vb=Js("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"}}),Rd=d.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function Dd({className:e,variant:t,size:n,spacing:r=2,orientation:o="horizontal",children:s,...i}){return u.jsx(bb,{"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:u.jsx(Rd.Provider,{value:{variant:t,size:n,spacing:r,orientation:o},children:s})})}function ho({className:e,children:t,variant:n="default",size:r="default",...o}){const s=d.useContext(Rd);return u.jsx(pb,{"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",vb({variant:s.variant||n,size:s.size||r}),e),...o,children:t})}function Fd({...e}){return u.jsx(Ku,{"data-slot":"dialog",...e})}function yb({...e}){return u.jsx(Ui,{"data-slot":"dialog-portal",...e})}function Cb({className:e,...t}){return u.jsx(Ii,{"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 Bd({className:e,children:t,showCloseButton:n=!0,...r}){return u.jsxs(yb,{children:[u.jsx(Cb,{}),u.jsxs(Qi,{"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&&u.jsxs(wi,{"data-slot":"dialog-close",render:u.jsx(Qe,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[u.jsx(ci,{}),u.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function sr({className:e,...t}){return u.jsx("div",{"data-slot":"dialog-header",className:fe("flex flex-col gap-2",e),...t})}function ir({className:e,...t}){return u.jsx(zi,{"data-slot":"dialog-title",className:fe("cn-font-heading text-base leading-none font-medium",e),...t})}function Md({className:e,...t}){return u.jsx(ki,{"data-slot":"dialog-description",className:fe("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const Pd=new Set(["npx","create-opentray","create","set"]),qt={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"},Ib=(e,t)=>e.split(/(\s+|\$[A-Za-z_][A-Za-z0-9_]*)/g).map((r,o)=>{const s=`${t}-u${o}`;return r.startsWith("$")?u.jsx("span",{className:qt.variable,children:r},s):Pd.has(r)?u.jsx("span",{className:qt.keyword,children:r},s):r.startsWith("--")?u.jsx("span",{className:qt.flag,children:r},s):/^[A-Za-z_][A-Za-z0-9_]*=/.test(r)?u.jsx("span",{className:qt.env,children:r},s):u.jsx("span",{children:r},s)}),wb=(e,t)=>e.startsWith("#")?u.jsx("span",{className:qt.comment,children:e}):e.split(/('(?:[^']|'\\'')*')/g).map((r,o)=>{const s=`${t}-s${o}`;if(!r.startsWith("'"))return u.jsx("span",{children:Ib(r,s)},s);const i=r.slice(1,-1);return Pd.has(i)?u.jsx("span",{className:qt.keyword,children:r},s):i.startsWith("--")?u.jsx("span",{className:qt.flag,children:r},s):/^[A-Za-z_][A-Za-z0-9_]*=/.test(i)?u.jsx("span",{className:qt.env,children:r},s):u.jsx("span",{className:qt.string,children:r},s)}),kb=({content:e})=>u.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)=>u.jsx("div",{children:t.length===0?" ":wb(t,n)},n))}),Td=({open:e,subtitle:t,hasEnv:n,share:r=!1,runner:o,onClose:s})=>{const{messages:i}=Yo(),[a,l]=d.useState("sh"),[c,f]=d.useState(!1),[A,g]=d.useState(null),[h,p]=d.useState(null),[m,x]=d.useState(null),[I,b]=d.useState(!1),[v,y]=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&&!c){p(null),b(!1);return}let S=!1;return b(!0),y(!1),x(null),(async()=>{const k=await w.current({format:a,acknowledgeEnv:c,...A===null?{}:{inlineIcon:A}});if(S)return;if(b(!1),k.status===200){const B=k.data;"content"in B&&B.content!==void 0&&(A===null&&B.iconSharedAs!==void 0&&g(B.iconSharedAs==="embedded"),p({filename:B.filename??"create-opentray.sh",content:B.content,...B.commandLine===void 0?{}:{commandLine:B.commandLine},...B.iconReference===void 0?{}:{iconReference:B.iconReference}}));return}p(null);const F=k.data;"code"in F&&x(`${F.message??F.code}`)})(),()=>{S=!0}},[e,a,c,A,n]);const C=!n||c,E=()=>{if(h===null)return;const S=new Blob([h.content],{type:a==="sh"?"text/x-shellscript":"text/plain"}),k=URL.createObjectURL(S),F=document.createElement("a");F.href=k,F.download=h.filename,F.click(),URL.revokeObjectURL(k)},R=async()=>{h!==null&&(await navigator.clipboard.writeText(h.commandLine??h.content),y(!0))};return u.jsx(Fd,{open:e,onOpenChange:S=>{S||s()},children:u.jsxs(Bd,{children:[u.jsxs(sr,{children:[u.jsx(ir,{children:r?i.export.shareTitle:i.export.title}),u.jsxs(Md,{children:[u.jsx("span",{className:"tech-ltr block truncate",children:t}),r&&u.jsx("span",{className:"text-muted-foreground mt-1 block text-xs",children:i.export.shareSubtitle})]})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsxs(Dd,{variant:"outline",size:"sm",spacing:0,value:[a],onValueChange:S=>{const k=S[0];(k==="sh"||k==="ps1")&&l(k)},children:[u.jsx(ho,{value:"sh",children:i.export.scriptSh}),u.jsx(ho,{value:"ps1",children:i.export.scriptPs1})]}),I&&u.jsx("span",{className:"text-muted-foreground self-center text-xs",children:i.export.building})]}),n&&u.jsx("div",{className:"border-warning rounded-md border p-3",children:u.jsxs("div",{className:"flex items-start gap-2",children:[u.jsx(Ls,{id:"export-env-ack",checked:c,onCheckedChange:S=>f(S===!0)}),u.jsxs(ct,{htmlFor:"export-env-ack",className:"text-xs leading-snug",children:[i.export.envAck,u.jsx("span",{className:"text-muted-foreground block",children:i.export.envAckHint})]})]})}),h?.iconReference!==void 0&&h.iconReference!=="none"&&u.jsxs("div",{className:"flex items-start gap-2",children:[u.jsx(Ls,{id:"export-inline-icon",checked:A===!0,onCheckedChange:S=>g(S===!0)}),u.jsxs(ct,{htmlFor:"export-inline-icon",className:"text-xs leading-snug",children:[i.export.inlineIcon,u.jsx("span",{className:"text-muted-foreground block",children:i.export.inlineIconHint})]})]}),m!==null&&u.jsxs("p",{className:"text-destructive text-xs",role:"alert",children:[i.export.blocked," ",m]}),h!==null&&u.jsx(oa,{children:u.jsxs(sa,{value:"content",children:[u.jsx(ia,{className:"text-xs",children:i.export.viewFull}),u.jsx(aa,{children:u.jsx(kb,{content:h.content})})]})}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsxs(Qe,{size:"sm",variant:"outline",disabled:!C||h===null,onClick:()=>{R()},children:[u.jsx(hp,{width:14,height:14,"aria-hidden":!0}),v?i.common.copied:i.export.copyCommand]}),u.jsxs(Qe,{size:"sm",disabled:!C||h===null,onClick:E,children:[u.jsx(mp,{width:14,height:14,"aria-hidden":!0}),i.export.downloadFile]})]})]})})};function Eb(e){return Hu("alert-dialog",e)}function El({...e}){return u.jsx(Eb,{"data-slot":"alert-dialog",...e})}function Sb({...e}){return u.jsx(Ui,{"data-slot":"alert-dialog-portal",...e})}function Rb({className:e,...t}){return u.jsx(Ii,{"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 Sl({className:e,size:t="default",...n}){return u.jsxs(Sb,{children:[u.jsx(Rb,{}),u.jsx(Qi,{"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 Rl({className:e,...t}){return u.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 Dl({className:e,...t}){return u.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 Fl({className:e,...t}){return u.jsx(zi,{"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 Bl({className:e,...t}){return u.jsx(ki,{"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 Ml({className:e,...t}){return u.jsx(Qe,{"data-slot":"alert-dialog-action",className:fe(e),...t})}function Pl({className:e,variant:t="outline",size:n="default",...r}){return u.jsx(wi,{"data-slot":"alert-dialog-cancel",className:fe(e),render:u.jsx(Qe,{variant:t,size:n}),...r})}const Tl={healthy:"statusHealthy","invalid-config":"statusInvalidConfig","incompatible-version":"statusIncompatible","missing-payload":"statusMissingPayload","broken-link":"statusBrokenLink",running:"statusRunning"},_l=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}),Db=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}},un=({label:e,value:t})=>u.jsxs("div",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-1 text-xs",children:[u.jsx("span",{className:"text-muted-foreground",children:e}),u.jsx("span",{className:"tech-ltr break-all",children:t})]}),Fb=({app:e,dataUrl:t})=>{const n=(e.appName??e.key).trim().charAt(0).toUpperCase()||"A";return u.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?u.jsx("img",{src:t,alt:"",className:"size-full object-contain"}):n})},Bb=()=>{const{messages:e}=Yo(),{navigate:t,route:n}=gd(),[r,o]=d.useState([]),[s,i]=d.useState("loading"),[a,l]=d.useState(null),[c,f]=d.useState(null),[A,g]=d.useState(!1),[h,p]=d.useState(null),[m,x]=d.useState(null),[I,b]=d.useState(null),[v,y]=d.useState({}),[w,C]=d.useState({}),E=d.useCallback(async()=>{i(j=>j==="ready"?"stale":"loading");const D=await _x();D.status===200?(o(D.data),y({}),i("ready"),await Promise.all(D.data.filter(j=>j.hasIcon===!0).map(async j=>{const P=await jx(j.key),T=P.data;P.status===200&&"dataUrl"in T&&T.dataUrl!==void 0&&C(N=>({...N,[j.key]:T.dataUrl}))}))):i("stale")},[]);d.useEffect(()=>{n==="applications"&&E()},[n,E]),d.useEffect(()=>{const D=()=>{E()};return window.addEventListener("create-opentray:apps-changed",D),()=>window.removeEventListener("create-opentray:apps-changed",D)},[E]);const R=async D=>{if(I===D.key){b(null);return}if(b(D.key),v[D.key]===void 0){const j=await md(D.key);y(P=>({...P,[D.key]:j.status===200?Db(j.data):"error"}))}},S=async D=>{const j=await Wx(D.key),P=j.data;p(j.status===200&&"ok"in P&&P.ok===!0?P.detail:"message"in P?P.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,j)=>{const P=await Nx(D.key,{...j,purgeTarget:A});if(P.status===200)k(P.data);else{const T=P.data;if(P.status===409&&T.code==="app_running"&&(T.pids!==void 0||T.pid!==void 0)){const N=T.pids??(T.pid!==void 0?[T.pid]:[]);f({app:D,pids:N});return}p(T.message??e.common.error)}await E()},B=async()=>{const D=a;l(null),D!==null&&await F(D,{stopRunning:!1})},_=async()=>{const D=c;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"}}):Kx(m.key,D);return u.jsxs("section",{className:"flex h-full flex-col overflow-hidden","aria-label":e.applications.title,children:[u.jsxs("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[u.jsx("h1",{className:"text-sm font-semibold",children:e.applications.title}),u.jsx(Qe,{variant:"ghost",size:"icon-sm","aria-label":e.common.refresh,onClick:()=>{E()},children:u.jsx(Kp,{width:16,height:16,"aria-hidden":!0})})]}),u.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:[s==="loading"&&u.jsxs("div",{className:"space-y-2","aria-label":e.common.loading,children:[u.jsx(Xt,{className:"h-14 w-full"}),u.jsx(Xt,{className:"h-14 w-full"}),u.jsx(Xt,{className:"h-14 w-full"})]}),s!=="loading"&&r.length===0&&u.jsx("p",{className:"text-muted-foreground text-sm",children:e.applications.emptyHint}),r.length>0&&u.jsx("ul",{className:"space-y-2",children:r.map(D=>{const j=I===D.key,P=v[D.key],T=D.status!=="healthy";return u.jsxs("li",{className:"border-border bg-card text-card-foreground rounded-lg border px-3 py-2",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(Fb,{app:D,dataUrl:w[D.key]}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"truncate text-sm font-medium",children:D.appName??D.key}),T&&u.jsxs(Ji,{children:[u.jsx($i,{render:N=>u.jsx(no,{variant:"destructive",...N,children:_l(e)[Tl[D.status]]})}),u.jsx(Xi,{children:D.error?.message??_l(e)[Tl[D.status]]})]}),D.isLink&&u.jsx(no,{variant:"outline",children:e.applications.linked})]}),u.jsx("div",{className:"tech-ltr text-muted-foreground truncate text-xs",children:D.appId??D.key})]}),u.jsxs(Qe,{variant:"ghost",size:"sm","aria-expanded":j,onClick:()=>{R(D)},children:[j?u.jsx(li,{width:14,height:14,"aria-hidden":!0}):u.jsx(Er,{width:14,height:14,"aria-hidden":!0}),e.applications.details]}),u.jsxs(Qe,{variant:"outline",size:"sm",onClick:()=>{window.location.hash=`#/add?edit=${encodeURIComponent(D.key)}`},children:[u.jsx(_p,{width:14,height:14,"aria-hidden":!0}),e.applications.edit]}),u.jsxs(Qe,{variant:"outline",size:"sm",onClick:()=>{S(D)},children:[u.jsx(Pc,{width:14,height:14,"aria-hidden":!0}),e.applications.open]}),u.jsxs(Qe,{variant:"outline",size:"sm",onClick:()=>x(D),children:[u.jsx(Gp,{width:14,height:14,"aria-hidden":!0}),e.applications.share]}),u.jsxs(Qe,{variant:"destructive",size:"sm",onClick:()=>l(D),children:[u.jsx(Jp,{width:14,height:14,"aria-hidden":!0}),e.applications.uninstall]})]}),j&&u.jsxs("div",{className:"border-border mt-2 space-y-1 rounded-md border bg-muted/40 p-3",children:[P===void 0&&u.jsx("p",{className:"text-muted-foreground text-xs",children:e.common.loading}),P==="error"&&u.jsx("p",{className:"text-destructive text-xs",role:"alert",children:e.common.error}),P!==void 0&&P!=="error"&&u.jsxs(u.Fragment,{children:[u.jsx(un,{label:e.applications.source,value:D.source==="wizard"?e.applications.sourceWizard:e.applications.sourceRegistered}),u.jsx(un,{label:e.applications.detailsCommand,value:P.command}),u.jsx(un,{label:e.applications.detailsCwd,value:P.cwd}),u.jsx(un,{label:e.applications.detailsEnv,value:P.envKeys.length>0?P.envKeys.join(", "):"—"}),u.jsx(un,{label:e.applications.detailsPm,value:P.packageManager}),u.jsx(un,{label:e.applications.detailsWindow,value:P.window}),u.jsx(un,{label:e.applications.detailsDevMode,value:P.developerMode?"ON":"OFF"}),u.jsx(un,{label:e.applications.detailsProjectDir,value:D.projectDir??D.payloadPath??D.registrationDir})]})]})]},D.key)})}),s==="stale"&&u.jsx("p",{className:"text-warning mt-3 text-xs",role:"status",children:e.common.error}),h!==null&&u.jsx("p",{className:"text-muted-foreground bg-muted mt-3 whitespace-pre-line rounded-md p-3 text-xs",role:"status",children:h})]}),u.jsx(El,{open:a!==null,onOpenChange:D=>{D||l(null)},children:u.jsxs(Sl,{children:[u.jsxs(Rl,{children:[u.jsx(Fl,{children:e.applications.uninstallTitle}),u.jsxs(Bl,{children:[a?.source==="wizard"?e.applications.uninstallWizardDescription:e.applications.uninstallDescription,u.jsx("span",{className:"tech-ltr mt-2 block truncate",children:a?.appId??a?.key}),a?.projectDir!==void 0&&u.jsx("span",{className:"tech-ltr mt-1 block truncate",children:a.projectDir})]})]}),a?.isLink===!0&&u.jsxs("label",{className:"flex items-start gap-2 text-xs",children:[u.jsx(Ls,{checked:A,onCheckedChange:D=>g(D===!0)}),u.jsxs("span",{children:[e.applications.uninstallPurge,u.jsx("span",{className:"text-muted-foreground block",children:e.applications.uninstallPurgeHint})]})]}),u.jsx("p",{className:"text-muted-foreground text-xs",children:e.applications.uninstallPinHint}),u.jsxs(Dl,{children:[u.jsx(Pl,{children:e.common.cancel}),u.jsx(Ml,{onClick:()=>{B()},children:e.applications.uninstall})]})]})}),u.jsx(El,{open:c!==null,onOpenChange:D=>{D||f(null)},children:u.jsxs(Sl,{children:[u.jsxs(Rl,{children:[u.jsx(Fl,{children:e.applications.stopRunningTitle}),u.jsxs(Bl,{children:[e.applications.stopRunningDescription,u.jsxs("span",{className:"tech-ltr mt-2 block",children:[e.applications.stopRunningPids,": ",c?.pids.join(", ")]}),u.jsx("span",{className:"tech-ltr mt-1 block truncate",children:c?.app.appId??c?.app.key})]})]}),u.jsx("p",{className:"text-muted-foreground text-xs",children:e.applications.uninstallPinHint}),u.jsxs(Dl,{children:[u.jsx(Pl,{children:e.common.cancel}),u.jsx(Ml,{onClick:()=>{_()},children:e.applications.stopRunningConfirm})]})]})}),u.jsx(Td,{open:m!==null,subtitle:m?.appId??m?.key??"",hasEnv:m?.hasEnv===!0,runner:M,onClose:()=>x(null)})]})},la=d.createContext({indent:20,currentItem:void 0,tree:void 0,toggleIconType:"plus-minus"});function _d(){return d.useContext(la)}function Mb({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,c={...a,"--tree-indent":`${e}px`};return u.jsx(la.Provider,{value:{indent:e,tree:t,toggleIconType:r},children:u.jsx("div",{"data-slot":"tree",style:c,className:fe("flex flex-col",n),...l})})}function Pb({item:e,className:t,render:n,children:r,...o}){const s=_d(),{indent:i}=s,a=typeof e.getProps=="function"?e.getProps():{},l={...o,children:r,...a},{style:c,...f}=l,g={"data-slot":"tree-item",style:{...c,"--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 u.jsx(la.Provider,{value:{...s,currentItem:e},children:Bc({defaultTagName:"button",render:n,props:Bt(g,f)})})}function Tb({item:e,children:t,className:n,...r}){const{currentItem:o,toggleIconType:s}=_d(),i=e||o;return i?u.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()?u.jsx(Rp,{"aria-hidden":!0,className:"text-muted-foreground size-3.5",stroke:"currentColor",strokeWidth:"1"}):u.jsx(Tc,{"aria-hidden":!0,className:"text-muted-foreground size-3.5",stroke:"currentColor",strokeWidth:"1"}):u.jsx(Er,{"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 jl={};function _b(e){let t=jl[e];if(t)return t;t=jl[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 zn(e,t){typeof t!="string"&&(t=zn.defaultChars);const n=_b(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 c=a<<6&1984|l&63;c<128?o+="��":o+=String.fromCharCode(c),s+=3;continue}}if((a&240)===224&&s+6<i){const l=parseInt(r.slice(s+4,s+6),16),c=parseInt(r.slice(s+7,s+9),16);if((l&192)===128&&(c&192)===128){const f=a<<12&61440|l<<6&4032|c&63;f<2048||f>=55296&&f<=57343?o+="���":o+=String.fromCharCode(f),s+=6;continue}}if((a&248)===240&&s+9<i){const l=parseInt(r.slice(s+4,s+6),16),c=parseInt(r.slice(s+7,s+9),16),f=parseInt(r.slice(s+10,s+12),16);if((l&192)===128&&(c&192)===128&&(f&192)===128){let A=a<<18&1835008|l<<12&258048|c<<6&4032|f&63;A<65536||A>1114111?o+="����":(A-=65536,o+=String.fromCharCode(55296+(A>>10),56320+(A&1023))),s+=9;continue}}o+="�"}return o})}zn.defaultChars=";/?:@&=+$,#";zn.componentChars="";const Nl={};function jb(e){let t=Nl[e];if(t)return t;t=Nl[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 Pr(e,t,n){typeof t!="string"&&(n=t,t=Pr.defaultChars),typeof n>"u"&&(n=!0);const r=jb(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}Pr.defaultChars=";/?:@&=+$,-_.!~*'()#";Pr.componentChars="-_.!~*'()";function Qs(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 go(){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 Nb=/^([a-z0-9.+-]+:)/i,Ob=/:[0-9]*$/,Hb=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Kb=["<",">",'"',"`"," ","\r",`
4
- `," "],Wb=["{","}","|","\\","^","`"].concat(Kb),Lb=["'"].concat(Wb),Ol=["%","/","?",";","#"].concat(Lb),Hl=["/","?","#"],Qb=255,Kl=/^[+a-z0-9A-Z_-]{0,63}$/,Gb=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Wl={javascript:!0,"javascript:":!0},Ll={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Gs(e,t){if(e&&e instanceof go)return e;const n=new go;return n.parse(e,t),n}go.prototype.parse=function(e,t){let n,r,o,s=e;if(s=s.trim(),!t&&e.split("#").length===1){const c=Hb.exec(s);if(c)return this.pathname=c[1],c[2]&&(this.search=c[2]),this}let i=Nb.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&&Wl[i])&&(s=s.substr(2),this.slashes=!0)),!Wl[i]&&(o||i&&!Ll[i])){let c=-1;for(let p=0;p<Hl.length;p++)r=s.indexOf(Hl[p]),r!==-1&&(c===-1||r<c)&&(c=r);let f,A;c===-1?A=s.lastIndexOf("@"):A=s.lastIndexOf("@",c),A!==-1&&(f=s.slice(0,A),s=s.slice(A+1),this.auth=f),c=-1;for(let p=0;p<Ol.length;p++)r=s.indexOf(Ol[p]),r!==-1&&(c===-1||r<c)&&(c=r);c===-1&&(c=s.length),s[c-1]===":"&&c--;const g=s.slice(0,c);s=s.slice(c),this.parseHost(g),this.hostname=this.hostname||"";const h=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!h){const p=this.hostname.split(/\./);for(let m=0,x=p.length;m<x;m++){const I=p[m];if(I&&!I.match(Kl)){let b="";for(let v=0,y=I.length;v<y;v++)I.charCodeAt(v)>127?b+="x":b+=I[v];if(!b.match(Kl)){const v=p.slice(0,m),y=p.slice(m+1),w=I.match(Gb);w&&(v.push(w[1]),y.unshift(w[2])),y.length&&(s=y.join(".")+s),this.hostname=v.join(".");break}}}}this.hostname.length>Qb&&(this.hostname=""),h&&(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),Ll[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};go.prototype.parseHost=function(e){let t=Ob.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 Yb=Object.freeze(Object.defineProperty({__proto__:null,decode:zn,encode:Pr,format:Qs,parse:Gs},Symbol.toStringTag,{value:"Module"})),jd=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Nd=/[\0-\x1F\x7F-\x9F]/,Ub=/[\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]/,ca=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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]/,Od=/[\$\+<->\^`\|~\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-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\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]/,Hd=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,zb=Object.freeze(Object.defineProperty({__proto__:null,Any:jd,Cc:Nd,Cf:Ub,P:ca,S:Od,Z:Hd},Symbol.toStringTag,{value:"Module"})),Vb=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 Zb(e){return e>=55296&&e<=57343||e>1114111?65533:Vb.get(e)??e}function Jb(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=Jb("QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12Dnd5SF2ZdhiYwDyAOoAbSJwZXEAAKBOIgAHSE9hY2RlZmhpbG9yc3UXARoBHwE6AVIBVQFiAWQBZgGCAakB6QHtAfIBYwB5ACdkUABZADuAqQCpQIABY3B5ACUBKAE1AfUhdGUGYWmg0iJ0KGFsRGlmZmVyZW50aWFsRAAAoEUhbCJleXMAAKAtIQACYWVpb0EBR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=8192]="FLAG13",e[e.BRANCH_LENGTH=8064]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(xt||(xt={}));var $e;(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"})($e||($e={}));const Ql=32;function Ys(e){return e>=$e.ZERO&&e<=$e.NINE}function Xb(e){return e>=$e.UPPER_A&&e<=$e.UPPER_F||e>=$e.LOWER_A&&e<=$e.LOWER_F}function qb(e){return e>=$e.UPPER_A&&e<=$e.UPPER_Z||e>=$e.LOWER_A&&e<=$e.LOWER_Z||Ys(e)}function e0(e){return e===$e.EQUALS||qb(e)}var lt;(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"})(lt||(lt={}));var fn;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(fn||(fn={}));class t0{decodeTree;emitCodePoint;errors;constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r}state=lt.EntityStart;consumed=1;result=0;treeIndex=0;excess=1;decodeMode=fn.Strict;runConsumed=0;startEntity(t){this.decodeMode=t,this.state=lt.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(t,n){switch(this.state){case lt.EntityStart:return t.charCodeAt(n)===$e.NUM?(this.state=lt.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=lt.NamedEntity,this.stateNamedEntity(t,n));case lt.NumericStart:return this.stateNumericStart(t,n);case lt.NumericDecimal:return this.stateNumericDecimal(t,n);case lt.NumericHex:return this.stateNumericHex(t,n);case lt.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|Ql)===$e.LOWER_X?(this.state=lt.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=lt.NumericDecimal,this.stateNumericDecimal(t,n))}stateNumericHex(t,n){for(;n<t.length;){const r=t.charCodeAt(n);if(Ys(r)||Xb(r)){const o=r<=$e.NINE?r-$e.ZERO:(r|Ql)-$e.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(Ys(r))this.result=this.result*10+(r-$e.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===$e.SEMI)this.consumed+=1;else if(this.decodeMode===fn.Strict)return 0;return this.emitCodePoint(Zb(this.result),this.consumed),this.errors&&(t!==$e.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&xt.VALUE_LENGTH)>>14;for(;n<t.length;){if(s===0&&(o&xt.FLAG13)!==0){const a=(o&xt.BRANCH_LENGTH)>>7;if(this.runConsumed===0){const l=o&xt.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,c=r[this.treeIndex+1+(l>>1)],f=l%2===0?c&255:c>>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&xt.VALUE_LENGTH)>>14}if(n>=t.length)break;const i=t.charCodeAt(n);if(i===$e.SEMI&&s!==0&&(o&xt.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);if(this.treeIndex=r0(r,o,this.treeIndex+Math.max(1,s),i),this.treeIndex<0)return this.result===0||this.decodeMode===fn.Attribute&&(s===0||e0(i))?0:this.emitNotTerminatedNamedEntity();if(o=r[this.treeIndex],s=(o&xt.VALUE_LENGTH)>>14,s!==0){if(i===$e.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==fn.Strict&&(o&xt.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]&xt.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]&~(xt.VALUE_LENGTH|xt.FLAG13):o[t+1],r),n===3&&this.emitCodePoint(o[t+2],r),r}end(){switch(this.state){case lt.NamedEntity:return this.result!==0&&(this.decodeMode!==fn.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case lt.NumericDecimal:return this.emitNumericEntity(0,2);case lt.NumericHex:return this.emitNumericEntity(0,3);case lt.NumericStart:return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case lt.EntityStart:return 0}}}function n0(e){let t="";const n=new t0(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 c=n.write(o,a+1);if(c<0){i=a+n.end();break}i=a+c,a=c===0?i+1:i}const l=t+o.slice(i);return t="",l}}function r0(e,t,n,r){const o=(t&xt.BRANCH_LENGTH)>>7,s=t&xt.JUMP_TABLE;if(o===0)return s!==0&&r===s?n:-1;if(s){const c=r-s;return c<0||c>=o?-1:e[n+c]-1}const i=o+1>>1;let a=0,l=o-1;for(;a<=l;){const c=a+l>>>1,f=c>>1,g=e[n+f]>>(c&1)*8&255;if(g<r)a=c+1;else if(g>r)l=c-1;else return e[n+i+c]}return-1}const o0=n0($b);function Kd(e){return o0(e,fn.Strict)}var s0=class{src_Any=jd.source;src_Cc=Nd.source;src_Z=Hd.source;src_P=ca.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")}},ds={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)},i0={"http:":ds,"https:":ds,"ftp:":ds,"//":{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)}},a0="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",l0="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф";function c0(){const e=l0.split("|");return a0.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 u0={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:c0(),urlAuth:!1,maxLength:1e4},Gl=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}},d0=class{__opts__;__schemas__;re;constructor(e={}){const{rebuilder:t,...n}=e;this.__opts__={...u0,...n},this.__schemas__={...i0},this.re=t||new s0,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,c=!1,f=!1,A=!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 h=Math.max(g-1,0);if(o&&s&&!A&&(!a||a.index<g))for(o.lastIndex<h&&(o.lastIndex=h);;){const b=o.exec(e);if(!b){A=!0,a=void 0;break}const v=s.exec(e.slice(Math.max(0,b.index-65),b.index));if(v){if(a={schema:"mailto:",index:b.index-v[1].length,lastIndex:b.index+b[0].length},a.index>=g)break;o.lastIndex<h&&(o.lastIndex=h)}}if(r&&!f&&(!i||i.index<g))for(r.lastIndex<h&&(r.lastIndex=h);;){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<h&&(r.lastIndex=h)}let p=a;(!p||i&&(i.index<p.index||i.index===p.index&&i.lastIndex>p.lastIndex))&&(p=i);let m;if(!c)for(;;){if(!l){n.lastIndex<h&&(n.lastIndex=h);const y=n.exec(e);if(!y){c=!0;break}l={schema:y[2],index:y.index+y[1].length,lastIndex:y.index+y[0].length}}if(l.index<g){l=void 0;continue}if(p&&l.index>p.index)break;const b=l;l=void 0;const v=this.testSchemaAt(e,b.schema,b.lastIndex);if(v){m={schema:b.schema,index:b.index,lastIndex:b.lastIndex+v};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 I=new Gl(e,x.schema,x.index,x.lastIndex);I.schema?this.__schemas__[I.schema].normalize(I,this):this.normalize(I),t.push(I),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 Gl(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 Hn=2147483647,Kt=36,ua=1,mr=26,f0=38,p0=700,Wd=72,Ld=128,Qd="-",A0=/^xn--/,h0=/[^\0-\x7F]/,g0=/[\x2E\u3002\uFF0E\uFF61]/g,m0={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},fs=Kt-ua,Wt=Math.floor,ps=String.fromCharCode;function dn(e){throw new RangeError(m0[e])}function x0(e,t){const n=[];let r=e.length;for(;r--;)n[r]=t(e[r]);return n}function Gd(e,t){const n=e.split("@");let r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(g0,".");const o=e.split("."),s=x0(o,t).join(".");return r+s}function Yd(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 b0=e=>String.fromCodePoint(...e),v0=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:Kt},Yl=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},Ud=function(e,t,n){let r=0;for(e=n?Wt(e/p0):e>>1,e+=Wt(e/t);e>fs*mr>>1;r+=Kt)e=Wt(e/fs);return Wt(r+(fs+1)*e/(e+f0))},zd=function(e){const t=[],n=e.length;let r=0,o=Ld,s=Wd,i=e.lastIndexOf(Qd);i<0&&(i=0);for(let a=0;a<i;++a)e.charCodeAt(a)>=128&&dn("not-basic"),t.push(e.charCodeAt(a));for(let a=i>0?i+1:0;a<n;){const l=r;for(let f=1,A=Kt;;A+=Kt){a>=n&&dn("invalid-input");const g=v0(e.charCodeAt(a++));g>=Kt&&dn("invalid-input"),g>Wt((Hn-r)/f)&&dn("overflow"),r+=g*f;const h=A<=s?ua:A>=s+mr?mr:A-s;if(g<h)break;const p=Kt-h;f>Wt(Hn/p)&&dn("overflow"),f*=p}const c=t.length+1;s=Ud(r-l,c,l==0),Wt(r/c)>Hn-o&&dn("overflow"),o+=Wt(r/c),r%=c,t.splice(r++,0,o)}return String.fromCodePoint(...t)},Vd=function(e){const t=[];e=Yd(e);const n=e.length;let r=Ld,o=0,s=Wd;for(const l of e)l<128&&t.push(ps(l));const i=t.length;let a=i;for(i&&t.push(Qd);a<n;){let l=Hn;for(const f of e)f>=r&&f<l&&(l=f);const c=a+1;l-r>Wt((Hn-o)/c)&&dn("overflow"),o+=(l-r)*c,r=l;for(const f of e)if(f<r&&++o>Hn&&dn("overflow"),f===r){let A=o;for(let g=Kt;;g+=Kt){const h=g<=s?ua:g>=s+mr?mr:g-s;if(A<h)break;const p=A-h,m=Kt-h;t.push(ps(Yl(h+p%m,0))),A=Wt(p/m)}t.push(ps(Yl(A,0))),s=Ud(o,c,a===i),o=0,++a}++o,++r}return t.join("")},y0=function(e){return Gd(e,function(t){return A0.test(t)?zd(t.slice(4).toLowerCase()):t})},C0=function(e){return Gd(e,function(t){return h0.test(t)?"xn--"+Vd(t):t})},Ul={version:"2.3.1",ucs2:{decode:Yd,encode:b0},decode:zd,encode:Vd,toASCII:C0,toUnicode:y0};var zl=Object.defineProperty,Zd=(e,t)=>{let n={};for(var r in e)zl(n,r,{get:e[r],enumerable:!0});return zl(n,Symbol.toStringTag,{value:"Module"}),n},I0=Zd({arrayReplaceAt:()=>$d,asciiTrim:()=>zo,callable:()=>Jd,escapeHtml:()=>mn,escapeRE:()=>P0,fromCodePoint:()=>xr,isMdAsciiPunct:()=>yr,isPunctChar:()=>qd,isPunctCharCode:()=>vr,isSpace:()=>Ge,isValidEntityCode:()=>da,isWhiteSpace:()=>br,lib:()=>T0,normalizeReference:()=>Uo,unescapeAll:()=>Vn,unescapeMd:()=>S0});function Jd(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 $d(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function da(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 xr(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 Xd=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,w0=new RegExp(`${Xd.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`,"gi"),k0=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function E0(e,t){if(t.charCodeAt(0)===35&&k0.test(t)){const r=t[1].toLowerCase()==="x"?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return da(r)?xr(r):e}const n=Kd(e);return n!==e?n:e}function S0(e){return e.indexOf("\\")<0?e:e.replace(Xd,"$1")}function Vn(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(w0,function(t,n,r){return n||E0(t,r)})}var R0=/[&<>"]/,D0=/[&<>"]/g,F0={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function B0(e){return F0[e]}function mn(e){return R0.test(e)?e.replace(D0,B0):e}var M0=/[.?*+^$[\]\\(){}|-]/g;function P0(e){return e.replace(M0,"\\$&")}function Ge(e){switch(e){case 9:case 32:return!0}return!1}function br(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 qd(e){return ca.test(e)||Od.test(e)}function vr(e){return qd(xr(e))}function yr(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 Uo(e){return e=e.trim().replace(/\s+/g," "),e.toLowerCase().toUpperCase()}function Vl(e){return e===32||e===9||e===10||e===13}function zo(e){let t=0;for(;t<e.length&&Vl(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&Vl(e.charCodeAt(n));n--);return e.slice(t,n+1)}var T0={mdurl:Yb,ucmicro:zb};function _0(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 c=-1;return o&&(c=e.pos),e.pos=l,c}function j0(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=Vn(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=Vn(e.slice(t,o)),s.pos=o,s.ok=!0),s}function N0(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+=Vn(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+=Vn(e.slice(t,s)),i}var O0=Zd({parseLinkDestination:()=>j0,parseLinkLabel:()=>_0,parseLinkTitle:()=>N0});function Cr(e){"@babel/helpers - typeof";return Cr=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},Cr(e)}function H0(e,t){if(Cr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Cr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function K0(e){var t=H0(e,"string");return Cr(t)=="symbol"?t:t+""}function xe(e,t,n){return(t=K0(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var En=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}`}},Ir=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]||[]}},Ut={};Ut.code_inline=function(e,t,n,r,o){const s=e[t];return`<code${o.renderAttrs(s)}>${mn(s.content)}</code>`};Ut.code_block=function(e,t,n,r,o){const s=e[t];return`<pre${o.renderAttrs(s)}><code>${mn(e[t].content)}</code></pre>
5
- `};Ut.fence=function(e,t,n,r,o){const s=e[t],i=s.info?Vn(s.info).trim():"";let a="",l="";if(i){const f=i.split(/(\s+)/g);a=f[0],l=f.slice(2).join("")}let c;if(n.highlight?c=n.highlight(s.content,a,l)||mn(s.content):c=mn(s.content),c.indexOf("<pre")===0)return c+`
6
- `;if(i){const f=s.attrIndex("class"),A=s.attrs?s.attrs.slice():[];f<0?A.push(["class",`${n.langPrefix}${a}`]):(A[f]=[A[f][0],A[f][1]],A[f][1]+=` ${n.langPrefix}${a}`);const g={attrs:A};return`<pre><code${o.renderAttrs(g)}>${c}</code></pre>
7
- `}return`<pre><code${o.renderAttrs(s)}>${c}</code></pre>
1
+ import{c as He,r as d,E as Nt,u as St,b as Cp,d as nu,f as ot,e as Me,j as l,N as Er,g as lt,h as Gt,i as ru,k as fe,m as Mt,l as Ci,n as Ip,o as wp,R as kp,a as Ep}from"./index.js";import{u as wt,b as ie,i as Ze,c as Pe,d as ve,g as _t,o as Be,e as vt,f as kt,h as Ii,j as de,k as Yt,l as Ce,m as Sp,n as Pt,p as Bn,q as Zn,r as Rp,t as it,s as Lo,v as rt,w as At,x as Pn,y as Ko,z as Dn,C as Jn,D as Vs,E as yn,F as wi,H as Dp,J as ou,K as Fp,L as ki,M as Wo,N as su,O as qa,P as Gn,Q as Zs,S as Ei,B as _e,T as iu,U as Si,V as Cr,W as xr,X as Ri,Y as au,Z as Di,_ as Fi,$ as Qo,a0 as Bi,a1 as on,a2 as Mi,a3 as Bp,I as et,a4 as ji,a5 as Mp,a6 as el,a7 as tl,G as nl,A as jp,a as Pp,R as Tp}from"./input.js";import{u as lu,B as bo,T as Sr,p as Np,c as _p}from"./terminal-pane.js";const Op=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Pi=He("check",Op);const Hp=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Tn=He("chevron-down",Hp);const Lp=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ti=He("chevron-up",Lp);const Kp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Wp=He("circle-check",Kp);const Qp=[["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"}]],Gp=He("circle-question-mark",Qp);const Yp=[["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"}]],zp=He("copy",Yp);const Up=[["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"}]],Vp=He("download",Up);const Zp=[["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"}]],cu=He("external-link",Zp);const Jp=[["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"}]],$p=He("file-text",Jp);const Xp=[["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"}]],qp=He("folder-open",Xp);const eh=[["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"}]],th=He("folder",eh);const nh=[["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"}]],rh=He("list",nh);const oh=[["path",{d:"M5 12h14",key:"1ays0h"}]],sh=He("minus",oh);const ih=[["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"}]],ah=He("monitor",ih);const lh=[["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"}]],ch=He("moon",lh);const uh=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],rl=He("panel-left",uh);const dh=[["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"}]],uu=He("pencil",dh);const fh=[["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"}]],ph=He("play",fh);const hh=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],du=He("plus",hh);const Ah=[["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"}]],gh=He("refresh-cw",Ah);const mh=[["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"}]],xh=He("settings-2",mh);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"}]],vh=He("share-2",bh);const yh=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Ch=He("square",yh);const Ih=[["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"}]],wh=He("sun",Ih);const kh=[["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"}]],Eh=He("trash-2",kh);const Sh=[["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"}]],Rh=He("triangle-alert",Sh);const Dh=[["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"}]],fu=He("upload",Dh);const Fh=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ni=He("x",Fh);function pu(e,t,n,r=!0,o){const[s,i]=d.useState(),a=wt(o?`${o}-label`:void 0),c=e??t??s;return ie(()=>{const u=e||t||!r?void 0:Bh(n.current,a);s!==u&&i(u)}),c}function Bh(e,t){const n=Mh(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Mh(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 jh(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:Ph,platform:Th,maxTouchPoints:Nh}=jh(),Go=Ph.toLowerCase(),Rr=Th.toLowerCase(),Yo=/^i(os$|p)/.test(Rr)||Rr==="macintel"&&Nh>1,ol="android",Js=Rr===ol||Go.includes(ol),_i=!Yo&&Rr.startsWith("mac");Rr.startsWith("win");const _h=_i||Yo,an=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!an&&Go.includes("firefox");!an&&Go.includes("chrom");const Oh=_h,Oi=/jsdom|happydom/.test(Go),$s="data-base-ui-focusable",hu="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",zo="ArrowLeft",Uo="ArrowRight",Au="ArrowUp",Hi="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 bs(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 Hh(e){return e.matches("html,body")}function Vo(e){return Ze(e)&&e.matches(hu)}function Lh(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${hu}`)!=null}function Xs(e){return e?e.getAttribute("role")==="combobox"&&Vo(e):!1}function Kh(e){if(!e||Oi)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function yo(e){return e?e.hasAttribute($s)?e:e.querySelector(`[${$s}]`)||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 sl(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 Lt(e){e.preventDefault(),e.stopPropagation()}function Wh(e){return"nativeEvent"in e}function Li(e){return e.pointerType===""&&e.isTrusted?!0:Js&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ki(e){return Oi?!1:!Js&&e.width===0&&e.height===0||Js&&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 Qh(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const $n=Math.min,nn=Math.max,Co=Math.round,Zr=Math.floor,rn=e=>({x:e,y:e}),Gh={left:"right",right:"left",bottom:"top",top:"bottom"};function gu(e,t,n){return nn(e,$n(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 Wi(e){return e==="x"?"y":"x"}function Qi(e){return e==="y"?"height":"width"}function Bt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Gi(e){return Wi(Bt(e))}function Yh(e,t,n){n===void 0&&(n=!1);const r=Cn(e),o=Gi(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=Io(i)),[i,Io(i)]}function zh(e){const t=Io(e);return[qs(e),t,qs(t)]}function qs(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const il=["left","right"],al=["right","left"],Uh=["top","bottom"],Vh=["bottom","top"];function Zh(e,t,n){switch(e){case"top":case"bottom":return n?t?al:il:t?il:al;case"left":case"right":return t?Uh:Vh;default:return[]}}function Jh(e,t,n,r){const o=Cn(e);let s=Zh(jt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(qs)))),s}function Io(e){const t=jt(e);return Gh[t]+e.slice(t.length)}function $h(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 mu(e){return typeof e!="number"?$h(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 ei(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 Xh(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Zo(e,t=e?_t(e):null){return!e||!e.isConnected||!t||Xh(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const qh='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function eA(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return Ii(n)?n.host:null}function ti(e){for(const t of Array.from(e.children))if(kt(t)==="summary")return t;return null}function tA(e,t){const n=ti(t);return!!n&&(e===n||ve(n,e))}function xu(e){const t=e?kt(e):"";return e!=null&&e.matches(qh)&&(t!=="summary"||e.parentElement!=null&&kt(e.parentElement)==="details"&&ti(e.parentElement)===e)&&(t!=="details"||ti(e)==null)&&(t!=="input"||e.type!=="hidden")}function bu(e){if(!xu(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=eA(t)){const n=t!==e,r=kt(t)==="slot";if(t.hasAttribute("inert")||n&&kt(t)==="details"&&!t.open&&!tA(e,t)||t.hasAttribute("hidden")||!r&&!nA(t,n))return!1}return!0}function nA(e,t){const n=_t(e);return t?n.display!=="none":Zo(e,n)}function vu(e){const t=e.tabIndex;if(t<0){const n=kt(e);if(n==="details"||n==="audio"||n==="video"||Ze(e)&&e.isContentEditable)return 0}return t}function vs(e){if(kt(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function rA(e,t){const n=vs(e);if(!n)return!0;const r=t.find(o=>{const s=vs(o);return s?.name===n.name&&s.form===n.form&&s.checked});return r?r===n:t.find(o=>{const s=vs(o);return s?.name===n.name&&s.form===n.form})===n}function yu(e){if(Ze(e)&&kt(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Ze(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Cu(e,t){yu(e).forEach(n=>{xu(n)&&t.push(n),Cu(n,t)})}function Iu(e,t,n){yu(e).forEach(r=>{Ze(r)&&r.matches(t)&&n.push(r),Iu(r,t,n)})}function Yi(e){return bu(e)&&vu(e)>=0}function wu(e){const t=[];return Cu(e,t),t.filter(bu)}function Kr(e){const t=wu(e);return t.filter(n=>vu(n)>=0&&rA(n,t))}function ku(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 ku(Be(e).body,1)||e}function Eu(e){return ku(Be(e).body,-1)||e}function Su(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 oA(e){return Su(e,1)}function sA(e){return Su(e,-1)}function Yn(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!ve(n,r)}function iA(e){Kr(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function ll(e){const t=[];Iu(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 Ui(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 dt(){const e=St(Ot.create).current;return Ui(e.disposeEffect),e}const aA=d.createContext({disabled:!1});function lA(){return d.useContext(aA)}var sn=Cp();const Jr=null;class cA{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 cA;class It{static create(){return new It}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 Xn(){const e=St(It.create).current;return Ui(e.disposeEffect),e}function Xt(e){return e==null?e:"current"in e?e.current:e}function Vi(e,t=!1){const n=Xn();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 zt(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=de(o),i=Vi(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 uA={"data-starting-style":""},dA={"data-ending-style":""},Nn={transitionStatus(e){return e==="starting"?uA:e==="ending"?dA:null}};function or(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=It.request(()=>{o("ending")});return()=>{It.cancel(a)}}},[e,s,r,n]),ie(()=>{if(!e||t)return;const a=It.request(()=>{o(void 0)});return()=>{It.cancel(a)}},[t,e]),ie(()=>{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 ys={exports:{}},Cs={};var cl;function fA(){if(cl)return Cs;cl=1;var e=nu();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 Cs.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Cs}var ul;function Ru(){return ul||(ul=1,ys.exports=fA()),ys.exports}var Jo=Ru();const br={v:[]},dl=()=>br.v.forEach(e=>e()),pA=e=>(br.v.push(e)===1&&addEventListener("hashchange",dl),()=>{br.v=br.v.filter(t=>t!==e),br.v.length||removeEventListener("hashchange",dl)}),hA=()=>"/"+location.hash.replace(/^#?\/?/,""),AA=(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)},Du=({ssrPath:e="/"}={})=>[Jo.useSyncExternalStore(pA,hA,()=>e),AA];Du.hrefs=e=>"#"+e;const Is=768;function gA(){const[e,t]=d.useState(void 0);return d.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Is-1}px)`),r=()=>t(window.innerWidth<Is);return n.addEventListener("change",r),t(window.innerWidth<Is),()=>n.removeEventListener("change",r)},[]),!!e}const Fu=d.createContext(void 0);function _n(e){const t=d.useContext(Fu);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 mA={"data-popup-open":""},xA={"data-popup-open":"","data-pressed":""},bA={"data-open":""},vA={"data-closed":""},yA={"data-anchor-hidden":""},Bu={open(e){return e?mA:null}},ni={open(e){return e?xA:null}},Wr={open(e){return e?bA:vA},anchorHidden(e){return e?yA:null}},Zi={...Wr,...Nn},Ji=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 Me("div",t,{state:{open:u,transitionStatus:g},ref:[c.context.backdropRef,n],stateAttributesMapping:Zi,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}=Yt({disabled:i,native:a}),A={disabled:i};function p(m){f&&u.setOpen(!1,Ce(Sp,m.nativeEvent))}return Me("button",t,{state:A,ref:[n,g],props:[{onClick:p},c,h]})}),$i=d.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,c=_n(),u=wt(i);return c.useSyncedValueWithCleanup("descriptionElementId",u),Me("p",t,{ref:n,props:[{id:u},a]})});function CA(e,t){return t!=null&&!mn(t)?0:typeof e=="function"?e():e}function qn(e,t,n){const r=CA(e,n);return typeof r=="number"?r:r?.[t]}function fl(e){return typeof e=="function"?e():e}function Mu(e,t){return t||e==="click"||e==="mousedown"}function IA(e){return e?.includes("mouse")&&e!=="mousedown"}const wA=d.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Ot,currentIdRef:{current:null},currentContextRef:{current:null}});function kA(e,t){e.current=t.current}function EA(e,t={open:!1}){const{open:n}=t,r="rootStore"in e?e.rootStore:e,o=r.useState("floatingId"),s=d.useContext(wA),{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 C=o;return g.start(c,()=>{r.select("open")||i.current&&i.current!==C||x()}),()=>{(m.current||i.current!==C)&&g.clear()}}x()}},[n,o,i,a,c,u,f,g,r]),ie(()=>{if(!n)return;const x=f.current,C=i.current;g.clear(),f.current={onOpenChange:r.setOpen,setIsInstantPhase:p},i.current=o,a.current={open:0,close:qn(u.current,"close")},C!==null&&C!==o?(p(!0),x?.setIsInstantPhase(!0),x?.onOpenChange(!1,Ce(Pt))):(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,kA(a,u),g.clear()}},[f,i,a,o,u,g]),d.useMemo(()=>({hasProvider:h,delayRef:a,isInstantPhase:A}),[h,a,A])}function Fe(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Qt(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function qe(e){const t=St(SA,e).current;return t.next=e,ie(t.effect),t}function SA(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},$o={...ju,position:"fixed",top:0,left:0},Xi={...ju,position:"absolute"},er=d.forwardRef(function(t,n){const[r,o]=d.useState();ie(()=>{Oh&&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 ws={inert:new WeakMap,"aria-hidden":new WeakMap},pl="data-base-ui-inert",ri={inert:new WeakSet,"aria-hidden":new WeakSet};let lr=new WeakMap,ks=0;function RA(e){return ri[e]}function Pu(e){return e?Ii(e)?e.host:Pu(e.parentNode):null}const hl=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=Pu(n);return e.contains(r)?r:null}).filter(n=>n!=null),Al=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},gl=(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 DA(e,t,n,r,{mark:o=!0}){let s=null;r?s="inert":n&&(s="aria-hidden");let i=null,a=null;const c=hl(t,e),u=o?gl(t,Al(c),new Set(c)):[],f=[],h=[];if(s){const g=ws[s],A=RA(s);a=A,i=g;const p=hl(t,Array.from(t.querySelectorAll("[aria-live]"))),m=c.concat(p);gl(t,Al(m),new Set(m)).forEach(C=>{const b=C.getAttribute(s),v=b!==null&&b!=="false",y=(g.get(C)||0)+1;g.set(C,y),f.push(C),y===1&&v&&A.add(C),v||C.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(pl,"")}),ks+=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(pl)}),ks-=1,ks||(ws.inert=new WeakMap,ws["aria-hidden"]=new WeakMap,ri.inert=new WeakSet,ri["aria-hidden"]=new WeakSet,lr=new WeakMap)}}function ml(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0}=t,s=Be(e[0]).body;return DA(e,s,n,r,{mark:o})}const FA=500,BA=500,MA={style:{transition:"none"}},jA="data-base-ui-click-trigger",Tu={fallbackAxisSide:"none"},Nu={fallbackAxisSide:"end"},PA={clipPath:"inset(50%)",position:"fixed",top:0,left:0},_u=d.createContext(null),Ou=()=>d.useContext(_u),TA=Fr("portal");function Hu(e={}){const{ref:t,container:n,componentProps:r=lt,elementProps:o}=e,s=Zn(),a=Ou()?.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&&(Rp(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=Me("div",r,{ref:[t,g],props:[{id:s,[TA]:""},o]}),m=c&&p?sn.createPortal(p,c):null;return{node:f,nodeId:d.isValidElement(p)?p.props.id:void 0,subtree:m}}const qi=d.forwardRef(function(t,n){const{render:r,className:o,style:s,children:i,container:a,...c}=t,{node:u,nodeId:f,subtree:h}=Hu({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,C]=d.useState(null),b=d.useRef(!1),v=x?.modal,y=x?.open,w=!!x&&!x.modal&&x.open&&!!u;d.useEffect(()=>{if(!u||v)return;function E(S){u&&S.relatedTarget&&Yn(S)&&(S.type==="focusin"?b.current&&(ll(u),b.current=!1):(iA(u),b.current=!0))}return Qt(Fe(u,"focusin",E,!0),Fe(u,"focusout",E,!0))},[u,v]),ie(()=>{!u||y!==!0||!b.current||(ll(u),b.current=!1)},[y,u]);const I=d.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:A,beforeInsideRef:p,afterInsideRef:m,portalNode:u,setFocusManagerState:C}),[u]);return l.jsxs(d.Fragment,{children:[h,l.jsxs(_u.Provider,{value:I,children:[w&&u&&l.jsx(er,{"data-type":"outside",ref:g,onFocus:E=>{if(Yn(E,u))p.current?.focus();else{const S=x?x.domReference:null;Eu(S)?.focus()}}}),w&&u&&l.jsx("span",{"aria-owns":f,style:PA}),u&&sn.createPortal(i,u),w&&u&&l.jsx(er,{"data-type":"outside",ref:A,onFocus:E=>{if(Yn(E,u))m.current?.focus();else{const S=x?x.domReference:null;zi(S)?.focus(),x?.closeOnFocusOut&&x?.onOpenChange(!1,Ce(Bn,E.nativeEvent))}}})]})]})});function Lu(){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 ea{nodesRef={current:[]};events=Lu();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 Ku=d.createContext(null),Wu=d.createContext(null),In=()=>d.useContext(Ku)?.id||null,wn=e=>{const t=d.useContext(Wu);return e??t};function Qu(e){const t=Zn(),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 NA(e){const{children:t,id:n}=e,r=In();return l.jsx(Ku.Provider,{value:d.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function _A(e){const{children:t,externalTree:n}=e,r=St(()=>n??new ea).current;return l.jsx(Wu.Provider,{value:r,children:t})}function OA(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 xl=20;let gn=[];function ta(){gn=gn.filter(e=>e.deref()?.isConnected)}function bl(e){ta(),e&&kt(e)!=="body"&&(gn.push(new WeakRef(e)),gn.length>xl&&(gn=gn.slice(-xl)))}function vl(){return ta(),gn[gn.length-1]?.deref()}function HA(e){return e?Yi(e)?e:Kr(e)[0]||e:null}function yl(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 Yi(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 na(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"),C=m.useState("domReferenceElement"),b=m.useState("floatingElement"),{events:v,dataRef:y}=m.context,w=de(()=>y.current.floatingContext?.nodeId),I=o===!1,E=Xs(C)&&I,S=qe(o),R=qe(s),k=qe(u),F=qe(x),T=wn(A),N=Ou(),j=d.useRef(!1),D=d.useRef(!1),O=d.useRef(!1),_=d.useRef(null),B=d.useRef(""),H=d.useRef(""),P=d.useRef(null),M=d.useRef(null),L=Gt(P,g,N?.beforeInsideRef),G=Gt(M,N?.afterInsideRef),V=dt(),Y=dt(),Q=Xn(),z=N!=null,K=yo(b),X=de(($=K)=>$?Kr($):[]),ae=de(()=>p?.().filter($=>$!=null)??[]);d.useEffect(()=>{if(r||!a)return;function $(ue){ue.key==="Tab"&&ve(K,vt(Be(K)))&&X().length===0&&!E&&Lt(ue)}const ee=Be(K);return Fe(ee,"keydown",$)},[r,K,a,E,X]),d.useEffect(()=>{if(r||!x)return;const $=Be(K);function ee(){O.current=!1}function ue(he){const se=At(he),Ae=ae(),re=ve(b,se)||ve(C,se)||ve(N?.portalNode,se)||Ae.some(oe=>oe===se||ve(oe,se));O.current=!re,H.current=he.pointerType||"keyboard",se?.closest(`[${jA}]`)&&(D.current=!0,Y.start(0,()=>{D.current=!1}))}function ce(){H.current="keyboard"}return Qt(Fe($,"pointerdown",ue,!0),Fe($,"pointerup",ee,!0),Fe($,"pointercancel",ee,!0),Fe($,"keydown",ce,!0),ee)},[r,b,C,K,x,N,Y,ae]),d.useEffect(()=>{if(r||!c)return;const $=Be(K);function ee(){D.current=!0,Y.start(0,()=>{D.current=!1})}function ue(Ae){const re=At(Ae);Yi(re)&&(_.current=re)}function ce(Ae){const re=Ae.relatedTarget,oe=Ae.currentTarget,le=At(Ae);a&&re==null&&le!=null&&ve(b,le)&&bl(le),queueMicrotask(()=>{const ge=w(),me=m.context.triggerElements,W=ae(),U=re?.hasAttribute(Fr("focus-guard"))&&[P.current,M.current,N?.beforeInsideRef.current,N?.afterInsideRef.current,N?.beforeOutsideRef.current,N?.afterOutsideRef.current,Xt(h),Xt(f)].includes(re),be=!(ve(C,re)||ve(b,re)||ve(re,b)||ve(N?.portalNode,re)||W.some(q=>q===re||ve(q,re))||me.hasMatchingElement(q=>ve(q,re))||U||T&&(xn(T.nodesRef.current,ge).find(q=>ve(q.context?.elements.floating,re)||ve(q.context?.elements.domReference,re))||sl(T.nodesRef.current,ge).find(q=>[q.context?.elements.floating,yo(q.context?.elements.floating)].includes(re)||q.context?.elements.domReference===re)));if(oe===C&&K&&yl(K),i&&oe!==C&&!Zo(le)&&vt($)===$.body){if(Ze(K)&&(K.focus(),i==="popup")){Q.request(()=>{K.focus()});return}const q=X(),ne=_.current,Ee=(ne&&q.includes(ne)?ne:null)||q[q.length-1]||K;Ze(Ee)&&Ee.focus()}if(y.current.insideReactTree){y.current.insideReactTree=!1;return}(E||!a)&&re&&be&&!D.current&&(E||re!==vl())&&(j.current=!0,m.setOpen(!1,Ce(Bn,Ae)))})}function he(){O.current||(y.current.insideReactTree=!0,V.start(0,()=>{y.current.insideReactTree=!1}))}const se=Ze(C)?C:null;if(!(!b&&!se))return Qt(se&&Fe(se,"focusout",ce),se&&Fe(se,"pointerdown",ee),b&&Fe(b,"focusin",ue),b&&Fe(b,"focusout",ce),b&&N&&Fe(b,"focusout",he,!0))},[r,C,b,K,a,T,N,m,c,i,X,E,w,y,V,Y,Q,f,h,ae]),d.useEffect(()=>{if(r||!b||!x)return;const $=Array.from(N?.portalNode?.querySelectorAll(`[${Fr("portal")}]`)||[]),ue=(T?sl(T.nodesRef.current,w()):[]).find(oe=>Xs(oe.context?.elements.domReference||null))?.context?.elements.domReference,he=[...[b,...$,P.current,M.current,N?.beforeOutsideRef.current,N?.afterOutsideRef.current,...ae()],ue,Xt(h),Xt(f),E?C:null].filter(oe=>oe!=null),se=ml(he,{ariaHidden:a||E,mark:!1}),Ae=[b,...$].filter(oe=>oe!=null),re=ml(Ae);return()=>{re(),se()}},[x,r,C,b,a,N,E,T,w,f,h,ae]),ie(()=>{if(!x||r||!Ze(K))return;B.current="",H.current="";const $=Be(K),ee=vt($);queueMicrotask(()=>{const ue=S.current,ce=typeof ue=="function"?ue(k.current||""):ue;if(ce===void 0||ce===!1||ve(K,ee))return;let se=null;const Ae=()=>(se==null&&(se=X(K)),se[0]||K);let re;ce===!0||ce===null?re=Ae():re=Xt(ce),re=re||Ae();const oe=ve(K,vt($));go(re,{preventScroll:re===K,shouldFocus(){if(!F.current)return!1;if(oe)return!0;const le=vt($);return!(le!==re&&ve(K,le))}})})},[r,x,K,X,S,k,F]),ie(()=>{if(r||!K)return;const $=Be(K),ee=vt($),ue=k.current==null;bl(ee);function ce(se){if(se.open||(B.current=OA(se.nativeEvent,H.current)),se.reason===it&&se.nativeEvent.type==="mouseleave"&&(j.current=!0),se.reason===Lo)if(se.nested)j.current=!1;else if(Li(se.nativeEvent)||Ki(se.nativeEvent))j.current=!1;else{let Ae=!1;Be(K).createElement("div").focus({get preventScroll(){return Ae=!0,!1}}),Ae?j.current=!1:j.current=!0}}v.on("openchange",ce);function he(se){const Ae=R.current;let re=typeof Ae=="function"?Ae(se):Ae;if(re===void 0||re===!1)return null;re===null&&(re=!0);const oe=C?.isConnected?C:null,le=ee?.isConnected&&kt(ee)!=="body"?ee:null;let ge=ue?le||oe:oe||le;return ge||(ge=vl()||null),typeof re=="boolean"?ge:Xt(re)||ge||null}return()=>{v.off("openchange",ce);const se=vt($),Ae=ae(),re=ve(b,se)||Ae.some(me=>me===se||ve(me,se))||T&&xn(T.nodesRef.current,w(),!1).some(me=>ve(me.context?.elements.floating,se)),oe=R.current,le=B.current,ge=he(le);queueMicrotask(()=>{const me=HA(ge),W=typeof oe!="boolean";if(oe&&!j.current&&Ze(me)&&(!(!W&&me!==se&&se!==$.body)||re)){const U={preventScroll:!0};le==="keyboard"&&(U.focusVisible=!0),me.focus(U)}j.current=!1})}},[r,b,K,R,k,v,T,C,w,ae]),ie(()=>{if(!an||x||!b)return;const $=vt(Be(b));!Ze($)||!Vo($)||ve(b,$)&&$.blur()},[x,b]),ie(()=>{if(!(r||!N))return N.setFocusManagerState({modal:a,closeOnFocusOut:c,open:x,onOpenChange:m.setOpen,domReference:C}),()=>{N.setFocusManagerState(null)}},[r,N,a,x,m,c,C]),ie(()=>{if(!(r||!K))return yl(K),()=>{queueMicrotask(ta)}},[r,K]);const te=!r&&(a?!E:!0)&&(z||a);return l.jsxs(d.Fragment,{children:[te&&l.jsx(er,{"data-type":"inside",ref:L,onFocus:$=>{if(a){const ee=X();go(ee[ee.length-1])}else N?.portalNode&&(j.current=!1,Yn($,N.portalNode)?zi(C)?.focus():Xt(h??N.beforeOutsideRef)?.focus())}}),n,te&&l.jsx(er,{"data-type":"inside",ref:G,onFocus:$=>{a?go(X()[0]):N?.portalNode&&(c&&(j.current=!0),Yn($,N.portalNode)?Eu(C)?.focus():Xt(f??N.afterOutsideRef)?.focus())}})]})}function Gu(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=Xn(),A=dt(),p=d.useMemo(()=>{function m(C,b,v,y){const w=Ce(c,b,v);C&&y==="touch"&&a>0?A.start(a,()=>{u.setOpen(!0,w)}):u.setOpen(C,w)}function x(C,b,v){const y=f.current.openEvent,w=u.select("domReferenceElement")!==b;return C&&w||!C||!o?!0:y&&i?!v(y.type):!1}return{onPointerDown(C){h.current=mn(C.pointerType,!0)&&Ki(C.nativeEvent)?"virtual":C.pointerType},onMouseDown(C){const b=h.current,v=C.nativeEvent,y=u.select("open");if(C.button!==0||r==="click"||mn(b,!0)&&s)return;const w=x(y,C.currentTarget,S=>S==="click"||S==="mousedown"),I=At(v);if(Vo(I)){m(w,v,I,b);return}const E=C.currentTarget;g.request(()=>{m(w,v,E,b)})},onClick(C){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 v=u.select("open"),y=x(v,C.currentTarget,w=>w==="click"||w==="mousedown"||w==="keydown"||w==="keyup");m(y,C.nativeEvent,C.currentTarget,b)},onKeyDown(){h.current=void 0}}},[f,r,s,c,u,i,o,g,A,a]);return d.useMemo(()=>n?{reference:p}:lt,[n,p])}function LA(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 Cl(e){return e!=null&&e.clientX!=null}function KA(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(y=>{o.set("positionReference",y)}),x=de((y,w,I)=>{u.current||c.current.openEvent&&!Cl(c.current.openEvent)||o.set("positionReference",LA(I??a,{x:y,y:w,axis:r,dataRef:c,pointerType:h}))}),C=de(y=>{s?f.current||(x(y.clientX,y.clientY,y.currentTarget),p([])):x(y.clientX,y.clientY,y.currentTarget)}),b=mn(h)?i:s;d.useEffect(()=>{if(!n){m(a);return}if(!b)return;function y(){f.current?.(),f.current=null}const w=rt(i);function I(E){const S=At(E);ve(i,S)?y():x(E.clientX,E.clientY)}return!c.current.openEvent||Cl(c.current.openEvent)?f.current=Fe(w,"mousemove",I):m(a),y},[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 v=d.useMemo(()=>{function y(w){g(w.pointerType)}return{onPointerDown:y,onPointerEnter:y,onMouseMove:C,onMouseEnter:C}},[C]);return d.useMemo(()=>n?{reference:v,trigger:v}:{},[n,v])}function WA(){return!1}function QA(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=WA,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,C=de(()=>s),{escapeKey:b,outsidePress:v}=QA(a),y=d.useRef(!1),w=d.useRef(!1),I=d.useRef(!1),E=d.useRef(!1),S=d.useRef(""),R=d.useRef(null),k=dt(),F=dt(),T=de(()=>{F.clear(),g.current.insideReactTree=!1}),N=de(L=>{const G=g.current.floatingContext?.nodeId;return(A?xn(A.nodesRef.current,G):[]).some(Y=>Y.context?.open&&!Y.context.dataRef.current[L])}),j=de(L=>bs(L,u.select("floatingElement"))||bs(L,u.select("domReferenceElement"))),D=de(L=>{i()&&u.setOpen(!1,Ce(Pn,L.nativeEvent))}),O=de(L=>{if(!f||!n||!r||L.key!=="Escape"||E.current||!b&&N("__escapeKeyBubbles"))return;const G=Wh(L)?L.nativeEvent:L,V=Ce(Ko,G);u.setOpen(!1,V),V.isCanceled||L.preventDefault(),!b&&!V.isPropagationAllowed&&L.stopPropagation()}),_=de(()=>{g.current.insideReactTree=!0,F.start(0,T)}),B=de(L=>{if(!f||!n||L.button!==0)return;const G=At(L.nativeEvent);ve(u.select("floatingElement"),G)&&(y.current||(y.current=!0,w.current=!1))}),H=de(L=>{!f||!n||(L.defaultPrevented||L.nativeEvent.defaultPrevented)&&y.current&&(w.current=!0)});d.useEffect(()=>{if(!f||!n)return T;g.current.__escapeKeyBubbles=b,g.current.__outsidePressBubbles=v;const L=new Ot,G=new Ot;function V(){L.clear(),E.current=!0}function Y(){L.start(an?5:0,()=>{E.current=!1})}function Q(){I.current=!0,G.start(0,()=>{I.current=!1})}function z(){y.current=!1,w.current=!1}function K(){const W=S.current,U=W==="pen"||!W?"mouse":W,be=C(),q=typeof be=="function"?be():be;return typeof q=="string"?q:q[U]}function X(W){const U=K();return U==="intentional"&&W.type!=="click"||U==="sloppy"&&W.type==="click"}function ae(W){const U=g.current.floatingContext?.nodeId,be=A&&xn(A.nodesRef.current,U).some(q=>bs(W,q.context?.elements.floating));return j(W)||be}function te(W){if(X(W)){W.type!=="click"&&!j(W)&&(G.clear(),I.current=!1),T();return}if(g.current.insideReactTree){T();return}const U=At(W),be=`[${Fr("inert")}]`,q=Pe(U)?U.getRootNode():null,ne=Array.from((Ii(q)?q:Be(u.select("floatingElement"))).querySelectorAll(be)),Ee=u.context.triggerElements;if(U&&(Ee.hasElement(U)||Ee.hasMatchingElement(Ge=>ve(Ge,U))))return;let Se=Pe(U)?U:null;for(;Se&&!Dn(Se);){const Ge=Jn(Se);if(Dn(Ge)||!Pe(Ge))break;Se=Ge}if(!(ne.length&&Pe(U)&&!Hh(U)&&!ve(U,u.select("floatingElement"))&&ne.every(Ge=>!ve(Se,Ge)))){if(Ze(U)&&!("touches"in W)){const Ge=Dn(U),ze=_t(U),Le=/auto|scroll/,ct=Ge||Le.test(ze.overflowX),tt=Ge||Le.test(ze.overflowY),Je=ct&&U.clientWidth>0&&U.scrollWidth>U.clientWidth,ft=tt&&U.clientHeight>0&&U.scrollHeight>U.clientHeight,Ie=ze.direction==="rtl",Ke=ft&&(Ie?W.offsetX<=U.offsetWidth-U.clientWidth:W.offsetX>U.clientWidth),Ne=Je&&W.offsetY>U.clientHeight;if(Ke||Ne)return}if(!ae(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 $(W){K()!=="sloppy"||W.pointerType==="touch"||!u.select("open")||!n||j(W)||te(W)}function ee(W){if(K()!=="sloppy"||!u.select("open")||!n||j(W))return;const U=W.touches[0];U&&(R.current={startTime:Date.now(),startX:U.clientX,startY:U.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},k.start(1e3,()=>{R.current&&(R.current.dismissOnTouchEnd=!1,R.current.dismissOnMouseDown=!1)}))}function ue(W,U){const be=At(W);if(!be)return;const q=Fe(be,W.type,()=>{U(W),q()})}function ce(W){S.current="touch",ue(W,ee)}function he(W){k.clear(),W.type==="pointerdown"&&(S.current=W.pointerType),!(W.type==="mousedown"&&R.current&&!R.current.dismissOnMouseDown)&&ue(W,U=>{U.type==="pointerdown"?$(U):te(U)})}function se(W){if(!y.current)return;const U=w.current;if(z(),K()==="intentional"){if(W.type==="pointercancel"){U&&Q();return}if(!ae(W)){if(U){Q();return}typeof m=="function"&&!m(W)||(G.clear(),I.current=!0,T())}}}function Ae(W){if(K()!=="sloppy"||!R.current||j(W))return;const U=W.touches[0];if(!U)return;const be=Math.abs(U.clientX-R.current.startX),q=Math.abs(U.clientY-R.current.startY),ne=Math.sqrt(be*be+q*q);ne>5&&(R.current.dismissOnTouchEnd=!0),ne>10&&(te(W),k.clear(),R.current=null)}function re(W){ue(W,Ae)}function oe(W){K()!=="sloppy"||!R.current||j(W)||(R.current.dismissOnTouchEnd&&te(W),k.clear(),R.current=null)}function le(W){ue(W,oe)}const ge=Be(h),me=Qt(r&&Qt(Fe(ge,"keydown",O),Fe(ge,"compositionstart",V),Fe(ge,"compositionend",Y)),x&&Qt(Fe(ge,"click",he,!0),Fe(ge,"pointerdown",he,!0),Fe(ge,"pointerup",se,!0),Fe(ge,"pointercancel",se,!0),Fe(ge,"mousedown",he,!0),Fe(ge,"mouseup",se,!0),Fe(ge,"touchstart",ce,!0),Fe(ge,"touchmove",re,!0),Fe(ge,"touchend",le,!0)));return()=>{me(),L.clear(),G.clear(),z(),I.current=!1,T()}},[g,h,r,x,m,f,n,b,v,O,T,C,N,j,A,u,k]);const P=d.useMemo(()=>({onKeyDown:O,onPointerDown:D,onClick:D}),[O,D]),M=d.useMemo(()=>({onKeyDown:O,onPointerDown:H,onMouseDown:H,onClickCapture:_,onMouseDownCapture(L){_(),B(L)},onPointerDownCapture(L){_(),B(L)},onMouseUpCapture:_,onTouchEndCapture:_,onTouchMoveCapture:_}),[O,_,B,H]);return d.useMemo(()=>n?{reference:P,floating:M,trigger:P}:{},[n,P,M])}function Il(e,t,n){let{reference:r,floating:o}=e;const s=Bt(t),i=Gi(t),a=Qi(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 GA(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=mu(A),x=a[g?h==="floating"?"reference":"floating":h],C=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,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),y=await(s.isElement==null?void 0:s.isElement(v))&&await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1},w=Dr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:v,strategy:c}):b);return{top:(C.top-w.top+p.top)/y.y,bottom:(w.bottom-C.bottom+p.bottom)/y.y,left:(C.left-w.left+p.left)/y.x,right:(w.right-C.right+p.right)/y.x}}const YA=50,zA=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:GA},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}=Il(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:C,fn:b}=x,{x:v,y,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=v??f,h=y??h,p[C]={...p[C],...w},I&&A<YA&&(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}=Il(u,g,c)),m=-1)}return{x:f,y:h,placement:g,strategy:o,middlewareData:p}},UA=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 C=jt(o),b=Bt(a),v=jt(a)===a,y=await(c.isRTL==null?void 0:c.isRTL(u.floating)),w=g||(v||!m?[Io(a)]:zh(a)),I=p!=="none";!g&&I&&w.push(...Jh(a,m,p,y));const E=[a,...w],S=await c.detectOverflow(t,x),R=[];let k=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&R.push(S[C]),h){const j=Yh(o,i,y);R.push(S[j[0]],S[j[1]])}if(k=[...k,{placement:o,overflows:R}],!R.every(j=>j<=0)){var F,T;const j=(((F=s.flip)==null?void 0:F.index)||0)+1,D=E[j];if(D&&(!(h==="alignment"?b!==Bt(D):!1)||k.every(B=>Bt(B.placement)===b?B.overflows[0]>0:!0)))return{data:{index:j,overflows:k},reset:{placement:D}};let O=(T=k.filter(_=>_.overflows[0]<=0).sort((_,B)=>_.overflows[1]-B.overflows[1])[0])==null?void 0:T.placement;if(!O)switch(A){case"bestFit":{var N;const _=(N=k.filter(B=>{if(I){const H=Bt(B.placement);return H===b||H==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(H=>H>0).reduce((H,P)=>H+P,0)]).sort((B,H)=>B[1]-H[1])[0])==null?void 0:N[0];_&&(O=_);break}case"initialPlacement":O=a;break}if(o!==O)return{reset:{placement:O}}}return{}}}},Yu=new Set(["left","top"]);async function VA(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=Bt(n)==="y",u=Yu.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 ZA=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 VA(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}}}}},JA=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:v,y}=b;return{x:v,y}}},...u}=bn(e,t),f={x:n,y:r},h=await s.detectOverflow(t,u),g=Bt(o),A=Wi(g);let p=f[A],m=f[g];const x=(b,v)=>gu(v+h[b==="y"?"top":"left"],v,v-h[b==="y"?"bottom":"right"]);i&&(p=x(A,p)),a&&(m=x(g,m));const C=c.fn({...t,[A]:p,[g]:m});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[A]:i,[g]:a}}}}}},$A=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=Bt(i),p=Wi(A);let m=g[p],x=g[A];const C=bn(u,t),b=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:(n=C.mainAxis)!=null?n:0,crossAxis:(r=C.crossAxis)!=null?r:0};if(f){const w=p==="y"?"height":"width",I=a.reference[p]-a.floating[w]+b.mainAxis,E=a.reference[p]+a.reference[w]-b.mainAxis;m<I?m=I:m>E&&(m=E)}if(h){var v,y;const w=p==="y"?"width":"height",I=Yu.has(jt(i)),E=a.reference[A]-a.floating[w]+(I&&((v=c.offset)==null?void 0:v[A])||0)+(I?0:b.crossAxis),S=a.reference[A]+a.reference[w]+(I?0:((y=c.offset)==null?void 0:y[A])||0)-(I?b.crossAxis:0);x<E?x=E:x>S&&(x=S)}return{[p]:m,[A]:x}}}},XA=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=Bt(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,C=g-c.left-c.right,b=$n(A-c[p],x),v=$n(g-c[m],C),y=t.middlewareData.shift,w=!y;let I=b,E=v;y!=null&&y.enabled.x&&(E=C),y!=null&&y.enabled.y&&(I=x),w&&!f&&(h?E=g-2*nn(c.left,c.right):I=A-2*nn(c.top,c.bottom)),await i({...t,availableWidth:E,availableHeight:I});const S=await o.getDimensions(s.floating);return g!==S.width||A!==S.height?{reset:{rects:!0}}:{}}}};function zu(e){const t=_t(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ze(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 ra(e){return Pe(e)?e:e.contextElement}function zn(e){const t=ra(e);if(!Ze(t))return rn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=zu(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 qA=rn(0);function Uu(e){const t=rt(e);return!su()||!t.visualViewport?qA:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function eg(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===rt(e)}function Mn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ra(e);let i=rn(1);t&&(r?Pe(r)&&(i=zn(r)):i=zn(e));const a=eg(s,n,r)?Uu(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=qa(p);for(;m&&A!==p;){const x=zn(m),C=m.getBoundingClientRect(),b=_t(m),v=C.left+(m.clientLeft+parseFloat(b.paddingLeft))*x.x,y=C.top+(m.clientTop+parseFloat(b.paddingTop))*x.y;c*=x.x,u*=x.y,f*=x.x,h*=x.y,c+=v,u+=y,p=rt(m),m=qa(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:Mn(yn(e)).left+n}function Vu(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 tg(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=yn(r),a=t?wi(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=rn(1);const f=rn(0),h=Ze(r);if((h||!s)&&((kt(r)!=="body"||ki(i))&&(c=Wo(r)),h)){const A=Mn(r);u=zn(r),f.x=A.x+r.clientLeft,f.y=A.y+r.clientTop}const g=i&&!h&&!s?Vu(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 ng(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function rg(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 og=25;function sg(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=!su()||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),C=getComputedStyle(s).scrollbarGutter==="stable both-edges"?x/2:x;C<=og&&(a-=C)}return{width:a,height:c,x:u,y:f}}function ig(e,t){const n=Mn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=zn(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 wl(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=sg(e,n,t);else if(t==="document")r=rg(yn(e));else if(Pe(t))r=ig(t,n);else{const o=Uu(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Dr(r)}function ag(e,t){const n=t.get(e);if(n)return n;let r=Vs(e,[],!1).filter(a=>Pe(a)&&kt(a)!=="body"),o=null;const s=_t(e).position==="fixed";let i=s?Jn(e):e;for(;Pe(i)&&!Dn(i);){const a=_t(i),c=ou(i),u=o?o.position:s?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&a.position==="static")?r=r.filter(h=>h!==i):o=a,i=Jn(i)}return t.set(e,r),r}function lg(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?wi(t)?[]:ag(t,this._c):[].concat(n),r],a=wl(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=wl(t,i[g],o);c=nn(A.top,c),u=$n(A.right,u),f=$n(A.bottom,f),h=nn(A.left,h)}return{width:u-h,height:f-c,x:h,y:c}}function cg(e){const{width:t,height:n}=zu(e);return{width:t,height:n}}function ug(e,t,n){const r=Ze(t),o=yn(t),s=n==="fixed",i=Mn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=rn(0);if((r||!s)&&((kt(t)!=="body"||ki(o))&&(a=Wo(t)),r)){const g=Mn(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?Vu(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 Es(e){return _t(e).position==="static"}function kl(e,t){if(!Ze(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 Zu(e,t){const n=rt(e);if(wi(e))return n;if(!Ze(e)){let o=Jn(e);for(;o&&!Dn(o);){if(Pe(o)&&!Es(o))return o;o=Jn(o)}return n}let r=kl(e,t);for(;r&&Dp(r)&&Es(r);)r=kl(r,t);return r&&Dn(r)&&Es(r)&&!ou(r)?n:r||Fp(e)||n}const dg=async function(e){const t=this.getOffsetParent||Zu,n=this.getDimensions,r=await n(e.floating);return{reference:ug(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function fg(e){return _t(e).direction==="rtl"}const Ju={convertOffsetParentRelativeRectToViewportRelativeRect:tg,getDocumentElement:yn,getClippingRect:lg,getOffsetParent:Zu,getElementRects:dg,getClientRects:ng,getDimensions:cg,getScale:zn,isElement:Pe,isRTL:fg};function $u(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pg(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 C=Zr(p),b=Zr(s.clientWidth-(A+m)),v=Zr(s.clientHeight-(p+x)),y=Zr(A),I={rootMargin:-C+"px "+-b+"px "+-v+"px "+-y+"px",threshold:nn(0,$n(1,h))||1};let E=!0;function S(R){const k=R[0].intersectionRatio;if(!$u(g,e.getBoundingClientRect()))return a();if(k!==h){if(!E)return a();k?a(!1,k):o=setTimeout(()=>{a(!1,1e-7)},1e3)}E=!1}try{r=new IntersectionObserver(S,{...I,root:s.ownerDocument})}catch{r=new IntersectionObserver(S,I)}r.observe(e)}const c=rt(e),u=()=>a(n);return c.addEventListener("resize",u),a(!0),()=>{c.removeEventListener("resize",u),i()}}function El(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=ra(e),f=o||s?[...u?Vs(u):[],...t?Vs(t):[]]:[];f.forEach(C=>{o&&C.addEventListener("scroll",n),s&&C.addEventListener("resize",n)});const h=u&&a?pg(u,n,s):null;let g=-1,A=null;i&&(A=new ResizeObserver(C=>{let[b]=C;b&&b.target===u&&A&&t&&(A.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var v;(v=A)==null||v.observe(t)})),n()}),u&&!c&&A.observe(u),t&&A.observe(t));let p,m=c?Mn(e):null;c&&x();function x(){const C=Mn(e);m&&!$u(m,C)&&n(),m=C,p=requestAnimationFrame(x)}return n(),()=>{var C;f.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),h?.(),(C=A)==null||C.disconnect(),A=null,c&&cancelAnimationFrame(p)}}const hg=ZA,Ag=JA,gg=UA,mg=XA,xg=$A,bg=(e,t,n)=>{const r=new Map,o=n??{},s={...Ju,...o.platform,_c:r};return zA(e,t,{...o,platform:s})};var vg=typeof document<"u",yg=function(){},mo=vg?d.useLayoutEffect:yg;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 Xu(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Sl(e,t){const n=Xu(e);return Math.round(t*n)/n}function Ss(e){const t=d.useRef(e);return mo(()=>{t.current=e}),t}function Cg(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,C]=d.useState(null),b=d.useCallback(B=>{B!==I.current&&(I.current=B,m(B))},[]),v=d.useCallback(B=>{B!==E.current&&(E.current=B,C(B))},[]),y=s||p,w=i||x,I=d.useRef(null),E=d.useRef(null),S=d.useRef(f),R=c!=null,k=Ss(c),F=Ss(o),T=Ss(u),N=d.useCallback(()=>{if(!I.current||!E.current)return;const B={placement:t,strategy:n,middleware:g};F.current&&(B.platform=F.current),bg(I.current,E.current,B).then(H=>{const P={...H,isPositioned:T.current!==!1};j.current&&!Eo(S.current,P)&&(S.current=P,sn.flushSync(()=>{h(P)}))})},[g,t,n,F,T]);mo(()=>{u===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,h(B=>({...B,isPositioned:!1})))},[u]);const j=d.useRef(!1);mo(()=>(j.current=!0,()=>{j.current=!1}),[]),mo(()=>{if(y&&(I.current=y),w&&(E.current=w),y&&w){if(k.current)return k.current(y,w,N);N()}},[y,w,N,k,R]);const D=d.useMemo(()=>({reference:I,floating:E,setReference:b,setFloating:v}),[b,v]),O=d.useMemo(()=>({reference:y,floating:w}),[y,w]),_=d.useMemo(()=>{const B={position:n,left:0,top:0};if(!O.floating)return B;const H=Sl(O.floating,f.x),P=Sl(O.floating,f.y);return a?{...B,transform:"translate("+H+"px, "+P+"px)",...Xu(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:P}},[n,a,O.floating,f.x,f.y]);return d.useMemo(()=>({...f,update:N,refs:D,elements:O,floatingStyles:_}),[f,N,D,O,_])}const Ig=(e,t)=>{const n=hg(e);return{name:n.name,fn:n.fn,options:[e,t]}},wg=(e,t)=>{const n=Ag(e);return{name:n.name,fn:n.fn,options:[e,t]}},kg=(e,t)=>({fn:xg(e).fn,options:[e,t]}),Eg=(e,t)=>{const n=gg(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sg=(e,t)=>{const n=mg(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Rs={exports:{}},Ds={};var Rl;function Rg(){if(Rl)return Ds;Rl=1;var e=nu(),t=Ru();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 Ds.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 C(I){if(!b){if(b=!0,v=I,I=g(I),A!==void 0&&m.hasValue){var E=m.value;if(A(E,I))return y=E}return y=I}if(E=y,r(v,I))return E;var S=g(I);return A!==void 0&&A(E,S)?(v=I,E):(v=I,y=S)}var b=!1,v,y,w=h===void 0?null:h;return[function(){return C(f())},w===null?void 0:function(){return C(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},Ds}var Dl;function Dg(){return Dl||(Dl=1,Rs.exports=Rg()),Rs.exports}var Fg=Dg();const oi=[];let si;function Bg(){return si}function Mg(e){oi.push(e)}function oa(e){const t=(n,r)=>{const o=St(jg).current;let s;try{si=o;for(const i of oi)i.before(o);s=e(n,r);for(const i of oi)i.after(o);o.didInitialize=!0}finally{si=void 0}return s};return t.displayName=e.displayName||e.name,t}function qu(e){return d.forwardRef(oa(e))}function jg(){return{didInitialize:!1}}const Pg=ru(19),Tg=Pg?_g:Og;function we(e,t,n,r,o){return Tg(e,t,n,r,o)}function Ng(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)}Mg({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 _g(e,t,n,r,o){const s=Bg();if(!s)return Ng(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 Og(e,t,n,r,o){return Fg.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class Hg{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 Hg{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 Lg={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:Lu(),nested:r,triggerElements:s},Lg),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&Qh(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 ed(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,[$s]:""};function Kg(e){return t=>t==="touch"?e.current:!0}function td(e,t=!1){const n=Zn(),r=In()!=null,o=St(()=>e(n,r)).current;return ed({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:o.setOpen}),o}function sa({handle:e,store:t}){return ie(()=>e.attachStore(t),[e,t]),null}function Wg(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 ia(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 nd(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Qg(e,t,n,r={}){const o=n.reason,s=o===it,i=t&&o===Gn,a=!t&&(o===Pn||o===Ko),c=nd(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),ia(f,t,n.trigger,c()),e.update(f)};s?sn.flushSync(u):u()}function rd(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=Wg(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 aa(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(Pt);e.setOpen(!1,g),g.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,s,i,a,n])}function la(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=or(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 zt({enabled:r&&!e&&!a,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:s}}function ca(e,t){e.useSyncedValues(t),ie(()=>()=>{e.update({activeTriggerProps:lt,inactiveTriggerProps:lt,popupProps:lt})},[e])}function Gg(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 Yg(){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 ua(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Yg(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:lt,inactiveTriggerProps:lt,popupProps:lt}}function od(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,da=e=>e.openProp??e.open,Fl=e=>(e.popupElement?.id??e.floatingId)||void 0;function sd(e,t){return t!==void 0&&da(e)&&wr(e)===t}function zg(e,t){return sd(e,t)?!0:t!==void 0&&da(e)&&wr(e)==null&&e.triggerCount===1}const fa={open:da,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:Fl,isTriggerActive:(e,t)=>t!==void 0&&wr(e)===t,isOpenedByTrigger:(e,t)=>sd(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&wr(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>zg(e,t)?Fl(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function id(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 Ug(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Zn(),s=In()!=null,i=St(()=>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 Vg(e){return Zg(e,e.rootContext)}function Zg(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),C=d.useMemo(()=>({reference:o,floating:s,domReference:i}),[o,s,i]),b=Cg({...e,elements:{...C,...u&&{reference:u}}}),v=Pe(h)?h:null,y=A===void 0?t.state.floatingElement:A;t.useSyncedValue("referenceElement",h??null),t.useSyncedValue("domReferenceElement",h===void 0?i:v),t.useSyncedValue("floatingElement",y);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]),E=d.useCallback(F=>{p(F),b.refs.setFloating(F)},[b.refs]),S=d.useMemo(()=>({...b.refs,setReference:I,setFloating:E,setPositionReference:w,domReference:m}),[b.refs,I,E,w]),R=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:S,elements:R,nodeId:n,rootStore:t}),[b,S,R,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:S,elements:R,rootStore:t}),[b,S,R,k,t])}const Fs=_i&&an;function ad(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=dt();d.useEffect(()=>{const g=o.select("domReferenceElement");if(!n)return;const A=rt(g);function p(){const C=o.select("domReferenceElement");!o.select("open")&&Ze(C)&&C===vt(Be(C))&&(a.current=!0)}function m(){u.current=!0}function x(){u.current=!1}return Qt(Fe(A,"blur",p),Fs&&Fe(A,"keydown",m,!0),Fs&&Fe(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(Fs&&!A.relatedTarget){if(!u.current&&!Vo(m))return}else if(!Kh(m))return}const x=vo(A.relatedTarget,o.context.triggerElements),{nativeEvent:C,currentTarget:b}=A,v=typeof r=="function"?r():r;if(o.select("open")&&x||v===0||v===void 0){o.setOpen(!0,Ce(Gn,C,b));return}f.start(v,()=>{a.current||o.setOpen(!0,Ce(Gn,C,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 C=o.select("domReferenceElement"),b=vt(Be(C));!p&&b===C||ve(i.current.floatingContext?.refs.floating.current,b)||ve(C,b)||x||vo(p??b,o.context.triggerElements)||o.setOpen(!1,Ce(Gn,m))})}}},[i,r,o,f]);return d.useMemo(()=>n?{reference:h,trigger:h}:{},[n,h])}class pa{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 pa}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 ld(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 ha(e){const t=e.context.dataRef.current,n=St(()=>t.hoverInteractionState??pa.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),Ui(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function cd(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=ha(s),A=dt(),p=de(()=>Mu(u.current.openEvent?.type,g.interactedInside)),m=de(()=>IA(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 C=c,b=a,v=Be(a),y=f?.nodesRef.current.find(S=>S.id===h)?.context?.elements.floating;y&&(y.style.pointerEvents="");const w=g.pointerEventsScopeElement!==b?g.pointerEventsScopeElement:null,I=y!==b?y:null,E=g.handleCloseOptions?.getScope?.()??w??I??C.closest("[data-rootownerid]")??v.body;return ld(g,{scopeElement:E,referenceElement:C,floatingElement:b}),()=>{x()}}},[n,i,c,a,g,m,f,h,x]),d.useEffect(()=>{if(!n)return;function C(){return!!(f&&h&&xn(f.nodesRef.current,h).length>0)}function b(S){const R=qn(r,"close",g.pointerType),k=()=>{s.setOpen(!1,Ce(it,S)),f?.events.emit("floating.closed",S)};R?g.openChangeTimeout.start(R,k):(g.openChangeTimeout.clear(),k())}function v(S){const R=At(S);if(!Lh(R)){g.interactedInside=!1;return}g.interactedInside=R?.closest("[aria-haspopup]")!=null}function y(){g.openChangeTimeout.clear(),A.clear(),f?.events.off("floating.closed",I),x()}function w(S){if(C()&&f){f.events.on("floating.closed",I);return}if(vo(S.relatedTarget,s.context.triggerElements))return;const R=u.current.floatingContext?.nodeId??o,k=S.relatedTarget;if(!(f&&R&&Pe(k)&&xn(f.nodesRef.current,R,!1).some(T=>ve(T.context?.elements.floating,k)))){if(g.handler){g.handler(S);return}x(),m()&&!p()&&b(S)}}function I(S){!f||!h||C()||A.start(0,()=>{f.events.off("floating.closed",I),s.setOpen(!1,Ce(it,S)),f.events.emit("floating.closed",S)})}const E=a;return Qt(E&&Fe(E,"mouseenter",y),E&&Fe(E,"mouseleave",w),E&&Fe(E,"pointerdown",v,!0),()=>{f?.events.off("floating.closed",I)})},[n,a,s,u,r,o,m,p,x,g,f,h,A])}const Jg={current:null};function ud(e,t={}){const{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:s=!1,restMs:i=0,move:a=!0,triggerElementRef:c=Jg,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:C}=m.context,b=wn(u),v=ha(m),y=d.useRef(!1),w=qe(o),I=qe(r),E=qe(i),S=qe(n),R=qe(A),k=qe(g),F=de(()=>Mu(x.current.openEvent?.type,v.interactedInside)),T=de(()=>R.current?.()!==!1),N=de((O,_,B)=>{const H=m.context.triggerElements;if(H.hasElement(_))return!O||!ve(O,_);if(!Pe(B))return!1;const P=B;return H.hasMatchingElement(M=>ve(M,P))&&(!O||!ve(O,P))}),j=de(()=>{if(!v.handler)return;Be(m.select("domReferenceElement")).removeEventListener("mousemove",v.handler),v.handler=void 0}),D=de(()=>{Ro(v)});return f&&(v.handleCloseOptions=w.current?.__options),d.useEffect(()=>j,[j]),d.useEffect(()=>{if(!n)return;function O(_){_.open?y.current=!1:(y.current=_.reason===it,j(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return C.on("openchange",O),()=>{C.off("openchange",O)}},[n,C,v,j]),d.useEffect(()=>{if(!n)return;function O(L,G=!0){const V=qn(I.current,"close",v.pointerType);V?v.openChangeTimeout.start(V,()=>{m.setOpen(!1,Ce(it,L)),b?.events.emit("floating.closed",L)}):G&&(v.openChangeTimeout.clear(),m.setOpen(!1,Ce(it,L)),b?.events.emit("floating.closed",L))}const _=c.current??(f?m.select("domReferenceElement"):null);if(!Pe(_))return;function B(L){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,s&&!mn(v.pointerType))return;const G=fl(E.current),V=qn(I.current,"open",v.pointerType),Y=At(L),Q=L.currentTarget??null,z=m.select("domReferenceElement");let K=Q;if(Pe(Y)&&!m.context.triggerElements.hasElement(Y)){for(const se of m.context.triggerElements.elements())if(ve(se,Y)){K=se;break}}Pe(Q)&&Pe(z)&&!m.context.triggerElements.hasElement(Q)&&ve(Q,z)&&(K=z);const X=K==null?!1:N(z,K,Y),ae=m.select("open"),te=k.current?.()??m.select("transitionStatus")==="ending",$=!ae&&te&&y.current,ee=!X&&Pe(K)&&Pe(z)&&ve(z,K)&&$,ue=G>0&&!V,ce=X&&(ae||$)||ee,he=!ae||X;if(ce){T()&&m.setOpen(!0,Ce(it,L,K));return}ue||(V?v.openChangeTimeout.start(V,()=>{he&&T()&&m.setOpen(!0,Ce(it,L,K))}):he&&T()&&m.setOpen(!0,Ce(it,L,K)))}function H(L){if(F()){D();return}j();const G=m.select("domReferenceElement"),V=Be(G);v.restTimeout.clear(),v.restTimeoutPending=!1;const Y=x.current.floatingContext??h?.();if(vo(L.relatedTarget,m.context.triggerElements))return;if(w.current&&Y){m.select("open")||v.openChangeTimeout.clear();const z=c.current;v.handler=w.current({...Y,tree:b,x:L.clientX,y:L.clientY,onClose(){D(),j(),S.current&&!F()&&z===m.select("domReferenceElement")&&O(L,!0)}}),V.addEventListener("mousemove",v.handler),v.handler(L);return}(v.pointerType!=="touch"||!ve(m.select("floatingElement"),L.relatedTarget))&&O(L)}function P(L){ve(_,L.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}const M=p?Fe(_,"mouseout",P):void 0;return a?Qt(Fe(_,"mousemove",B,{once:!0}),Fe(_,"mouseenter",B),Fe(_,"mouseleave",H),M):Qt(Fe(_,"mouseenter",B),Fe(_,"mouseleave",H),M)},[j,D,x,I,m,n,w,v,f,N,F,s,a,E,c,b,S,h,k,T,p]),d.useMemo(()=>{if(!n)return;function O(_){v.pointerType=_.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(_){const{nativeEvent:B}=_,H=_.currentTarget,P=m.select("domReferenceElement"),M=m.select("open"),L=N(P,H,_.target);if(s&&!mn(v.pointerType))return;if(M&&L&&v.handleCloseOptions?.blockPointerEvents){const Y=m.select("floatingElement");if(Y){const Q=v.handleCloseOptions?.getScope?.()??H.ownerDocument.body;ld(v,{scopeElement:Q,referenceElement:H,floatingElement:Y})}}const G=fl(E.current);if(M&&!L||G===0||!L&&v.restTimeoutPending&&_.movementX**2+_.movementY**2<2)return;v.restTimeout.clear();function V(){if(v.restTimeoutPending=!1,F())return;const Y=m.select("open");!v.blockMouseMove&&(!Y||L)&&T()&&m.setOpen(!0,Ce(it,B,H))}v.pointerType==="touch"?sn.flushSync(()=>{V()}):L&&M?V():(v.restTimeoutPending=!0,v.restTimeout.start(G,V))}}},[n,v,F,N,s,m,E,T])}const $g="Escape";function Bl(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===Au||e===Hi,e===zo||e===Uo)}function Bs(e,t,n){return ns(t,e===Hi,n?e===zo:e===Uo)||e==="Enter"||e===" "||e===""}function Xg(e,t,n){return ns(t,n?e===zo:e===Uo,e===Hi)}function qg(e,t,n,r){const o=n?e===Uo:e===zo,s=e===Au;return t==="both"||t==="horizontal"&&r?e===$g:ns(t,o,s)}function dd(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:C,id:b,resetOnPointerLeave:v=!0,externalTree:y,grid:w}=t,I=w!=null,E="rootStore"in e?e.rootStore:e,S=E.useState("open"),R=E.useState("floatingElement"),k=E.useState("domReferenceElement"),F=E.context.dataRef,T=yo(R),N=Xs(k),j=qe(T),D=In(),O=wn(y),_=d.useRef(g),B=d.useRef(i??-1),H=d.useRef(null),P=d.useRef(!0),M=de(W=>{o(B.current===-1?null:B.current,W)}),L=d.useRef(!!R),G=d.useRef(S),V=d.useRef(!1),Y=d.useRef(!1),Q=d.useRef(null),z=qe(m),K=qe(S),X=qe(i),ae=qe(v),te=Xn(),$=Xn(),ee=de(()=>{function W(ne){h?O?.events.emit("virtualfocus",ne):Q.current=go(ne,{sync:V.current,preventScroll:!0})}const U=n.current[B.current],be=Y.current;U&&W(U),(V.current?ne=>ne():ne=>te.request(ne))(()=>{const ne=n.current[B.current]||U;if(!ne)return;U||W(ne),re&&(be||!P.current)&&ne.scrollIntoView?.({block:"nearest",inline:"nearest"})})});ie(()=>{F.current.orientation=x},[F,x]),ie(()=>{s&&(S&&R?(B.current=i??-1,_.current&&i!=null&&(Y.current=!0,M())):L.current&&(B.current=-1,M()))},[s,S,R,i,M]),ie(()=>{if(s){if(!S){V.current=!1;return}if(R)if(r==null){if(V.current=!1,X.current!=null)return;if(L.current&&(B.current=-1,ee()),(!G.current||!L.current)&&_.current&&(H.current!=null||_.current===!0&&H.current==null)){let W=0;const U=()=>{n.current[0]==null?(W<2&&(W?q=>$.request(q):queueMicrotask)(U),W+=1):(B.current=H.current==null||Bs(H.current,x,f)||u?Ao(n):ei(n),H.current=null,M())};U()}}else Ir(n.current,r)||(B.current=r,ee(),Y.current=!1)}},[s,S,R,r,X,u,n,x,f,M,ee,$]),ie(()=>{if(!s||R||!O||h||!L.current)return;const W=O.nodesRef.current,U=W.find(ne=>ne.id===D)?.context?.elements.floating,be=vt(Be(k??U??null)),q=W.some(ne=>ne.context&&ve(ne.context.elements.floating,be));U&&!q&&P.current&&U.focus({preventScroll:!0})},[s,R,k,O,D,h]),ie(()=>{G.current=S,L.current=!!R}),ie(()=>{S||(H.current=null,_.current=g)},[S,g]);const ue=r!=null,ce=de(W=>{if(!K.current)return;const U=n.current.indexOf(W.currentTarget);U!==-1&&(B.current!==U||r!==U)&&(B.current=U,M(W))}),he=de(()=>C??O?.nodesRef.current.find(W=>W.id===D)?.context?.dataRef?.current.orientation),se=de(()=>Ao(n,z.current)),Ae=de(W=>{if(P.current=!1,V.current=!0,W.which===229||!K.current&&W.currentTarget===j.current)return;if(u&&qg(W.key,x,f,I)){qr(W.key,he())||Lt(W),E.setOpen(!1,Ce(Zs,W.nativeEvent)),Ze(k)&&(h?O?.events.emit("virtualfocus",k):k.focus());return}const U=B.current,be=Ao(n,m),q=ei(n,m);if(N||(W.key==="Home"&&(Lt(W),B.current=be,M(W)),W.key==="End"&&(Lt(W),B.current=q,M(W))),w!=null){const ne=w(W,B.current,n,x,c,f,m,be,q);if(ne!=null&&(B.current=ne,M(W)),x==="both")return}if(qr(W.key,x)){if(Lt(W),S&&!h&&vt(W.currentTarget.ownerDocument)===W.currentTarget){B.current=Bs(W.key,x,f)?be:q,M(W);return}Bs(W.key,x,f)?c?U>=q?a&&U!==n.current.length?B.current=-1:(V.current=!1,B.current=be):B.current=tn(n.current,{startingIndex:U,disabledIndices:m}):B.current=Math.min(q,tn(n.current,{startingIndex:U,disabledIndices:m})):c?U<=be?a&&U!==-1?B.current=n.current.length:(V.current=!1,B.current=q):B.current=tn(n.current,{startingIndex:U,decrement:!0,disabledIndices:m}):B.current=Math.max(be,tn(n.current,{startingIndex:U,decrement:!0,disabledIndices:m})),Ir(n.current,B.current)&&(B.current=-1),M(W)}}),re=d.useMemo(()=>({onFocus(U){V.current=!0,ce(U)},onClick:({currentTarget:U})=>U.focus({preventScroll:!0}),onMouseMove(U){Bl(U)||(V.current=!0,Y.current=!1,A&&ce(U))},onPointerLeave(U){if(!K.current||!P.current||U.pointerType==="touch")return;V.current=!0;const be=U.relatedTarget;if(!(!A||n.current.includes(be))&&ae.current&&(Q.current?.(),Q.current=null,B.current=-1,M(U),!h)){const q=j.current,ne=vt(Be(q));q&&ve(q,ne)&&q.focus({preventScroll:!0})}}}),[ce,K,j,A,n,M,ae,h]),oe=d.useMemo(()=>h&&S&&ue&&{"aria-activedescendant":`${b}-${r}`},[h,S,ue,b,r]),le=d.useMemo(()=>({"aria-orientation":x==="both"?void 0:x,...N?{}:oe,onKeyDown(W){if(W.key==="Tab"&&W.shiftKey&&S&&!h){const U=At(W.nativeEvent);if(U&&!ve(j.current,U))return;Lt(W),E.setOpen(!1,Ce(Bn,W.nativeEvent)),Ze(k)&&k.focus();return}Ae(W)},onPointerMove(W){Bl(W)||(P.current=!0)}}),[oe,Ae,j,x,N,E,S,h,k]),ge=d.useMemo(()=>{function W(q){E.setOpen(!0,Ce(Zs,q.nativeEvent,q.currentTarget))}function U(q){g==="auto"&&Li(q.nativeEvent)&&(_.current=!h)}function be(q){_.current=g,g==="auto"&&Ki(q.nativeEvent)&&(_.current=!0)}return{onKeyDown(q){const ne=E.select("open");P.current=!1;const Ee=q.key.startsWith("Arrow"),Se=Xg(q.key,he(),f),Ge=qr(q.key,x),ze=(u?Se:Ge)||q.key==="Enter"||q.key.trim()==="";if(h&&ne)return Ae(q);if(!(!ne&&!p&&Ee)){if(ze){const Le=qr(q.key,he());H.current=u&&Le?null:q.key}if(u){Se&&(Lt(q),ne?(B.current=se(),M(q)):W(q));return}Ge&&(X.current!=null&&(B.current=X.current),Lt(q),!ne&&p?W(q):Ae(q),ne&&M(q))}},onFocus(q){E.select("open")&&!h&&(B.current=-1,M(q))},onPointerDown:be,onPointerEnter:be,onMouseDown:U,onClick:U}},[Ae,g,se,u,M,E,p,x,he,f,X,h]),me=d.useMemo(()=>({...oe,...ge}),[oe,ge]);return d.useMemo(()=>s?{reference:me,floating:le,item:re,trigger:ge}:{},[s,me,le,ge,re])}function fd(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=dt(),p=d.useRef(""),m=d.useRef(f??o??-1),x=d.useRef(null),C=de(y=>{function w(j){return r?.current[j]}function I(j){const D=w(j);return D&&!Zo(D)||D?.matches(":disabled")?!1:i==null||!wo(Nt,j,i)}function E(j,D,O=0){if(j.length===0)return-1;const _=(O%j.length+j.length)%j.length,B=D.toLowerCase();for(let H=0;H<j.length;H+=1){const P=(_+H)%j.length;if(!(!j[P]?.toLowerCase().startsWith(B)||!I(P)))return P}return-1}const S=n.current;if(p.current.length>0&&y.key===" "&&(Lt(y),a?.(!0)),p.current.length>0&&p.current[0]!==" "&&E(S,p.current)===-1&&y.key!==" "&&a?.(!1),S==null||y.key.length!==1||y.ctrlKey||y.metaKey||y.altKey)return;g&&y.key!==" "&&(Lt(y),a?.(!0));const R=p.current==="";R&&(m.current=f??o??-1),S.every((j,D)=>j&&I(D)?j[0]?.toLowerCase()!==j[1]?.toLowerCase():!0)&&p.current===y.key&&(p.current="",m.current=x.current),p.current+=y.key,A.start(u,()=>{p.current="",m.current=x.current,a?.(!1)});const T=((R?f??o??-1:m.current)??0)+1,N=E(S,p.current,T);N!==-1?(s?.(N),x.current=N):y.key!==" "&&(p.current="",a?.(!1))}),b=de(y=>{const w=y.relatedTarget,I=h.select("domReferenceElement"),E=h.select("floatingElement");ve(I,w)||ve(E,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 v=d.useMemo(()=>({onKeyDown:C,onBlur:b}),[C,b]);return d.useMemo(()=>c?{reference:v,floating:v}:{},[c,v])}const Ml=.1,em=Ml*Ml,Oe=.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 tm(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 pd(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,v){const y=performance.now(),w=y-m;if(A===null||p===null||w===0)return A=b,p=v,m=y,!1;const I=b-A,E=v-p,S=I*I+E*E,R=w*w*em;return A=b,p=v,m=y,S<R}function C(){n.clear(),c()}return function(v){n.clear();const y=a.domReference,w=a.floating;if(!y||!w||h==null||o==null||s==null)return;const{clientX:I,clientY:E}=v,S=At(v),R=v.type==="mouseleave",k=ve(w,S),F=ve(y,S);if(k&&(g=!0,!R))return;if(F&&(g=!1,!R)){g=!0;return}if(R&&Pe(v.relatedTarget)&&ve(w,v.relatedTarget))return;function T(){return!!(f&&xn(f.nodesRef.current,u).length>0)}function N(){T()||C()}if(T())return;const j=y.getBoundingClientRect(),D=w.getBoundingClientRect(),O=o>D.right-D.width/2,_=s>D.bottom-D.height/2,B=D.width>j.width,H=D.height>j.height,P=(B?j:D).left,M=(B?j:D).right,L=(H?j:D).top,G=(H?j:D).bottom;if(h==="top"&&s>=j.bottom-1||h==="bottom"&&s<=j.top+1||h==="left"&&o>=j.right-1||h==="right"&&o<=j.left+1){N();return}let V=!1;switch(h){case"top":V=no(I,E,P,j.top+1,M,D.bottom-1);break;case"bottom":V=no(I,E,P,D.top+1,M,j.bottom-1);break;case"left":V=no(I,E,D.right-1,G,j.left+1,L);break;case"right":V=no(I,E,j.right-1,G,D.left+1,L);break}if(V)return;if(g&&!tm(I,E,j)){N();return}if(!R&&x(I,E)){N();return}let Y=!1;switch(h){case"top":{const Q=B?Oe/2:Oe*4,z=B||O?o+Q:o-Q,K=B?o-Q:O?o+Q:o-Q,X=s+Oe+1,ae=O||B?D.bottom-Oe:D.top,te=O?B?D.bottom-Oe:D.top:D.bottom-Oe;Y=to(I,E,z,X,K,X,D.left,ae,D.right,te);break}case"bottom":{const Q=B?Oe/2:Oe*4,z=B||O?o+Q:o-Q,K=B?o-Q:O?o+Q:o-Q,X=s-Oe,ae=O||B?D.top+Oe:D.bottom,te=O?B?D.top+Oe:D.bottom:D.top+Oe;Y=to(I,E,z,X,K,X,D.left,ae,D.right,te);break}case"left":{const Q=H?Oe/2:Oe*4,z=H||_?s+Q:s-Q,K=H?s-Q:_?s+Q:s-Q,X=o+Oe+1,ae=_||H?D.right-Oe:D.left,te=_?H?D.right-Oe:D.left:D.right-Oe;Y=to(I,E,ae,D.top,te,D.bottom,X,z,X,K);break}case"right":{const Q=H?Oe/2:Oe*4,z=H||_?s+Q:s-Q,K=H?s-Q:_?s+Q:s-Q,X=o-Oe,ae=_||H?D.left+Oe:D.right,te=_?H?D.left+Oe:D.right:D.left+Oe;Y=to(I,E,X,z,X,K,ae,D.top,te,D.bottom);break}}Y?g||n.start(40,N):N()}};return r.__options={...e,blockPointerEvents:t},r}const hd=d.createContext(void 0);function nm(){const e=d.useContext(hd);if(e===void 0)throw new Error(ot(26));return e}const ii="ArrowUp",ai="ArrowDown",li="ArrowLeft",ci="ArrowRight",ui="Home",di="End",rs=new Set([ii,ai,li,ci,ui,di]),rm="Shift",om=[rm,"Control","Alt","Meta"];function sm(e){return Ze(e)&&e.tagName==="INPUT"}function jl(e){return!!(sm(e)&&e.selectionStart!=null||Ze(e)&&e.tagName==="TEXTAREA")}function Pl(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=Tl(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=Tl(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 Tl(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 im={...Wr,...Nn,nestedDialogOpen(e){return e?{"data-nested-dialog-open":""}:null}},Aa=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"),C=u.useState("nestedOpenDialogCount"),b=u.useState("open"),v=u.useState("openMethod"),y=u.useState("titleElementId"),w=u.useState("transitionStatus"),I=u.useState("role"),E=g.useState("floatingId");nm(),zt({open:b,ref:u.context.popupRef,onComplete(){b&&u.context.onOpenChangeComplete?.(!0)}});const S=a===void 0?Kg(u.context.popupRef):a,R=C>0,k=u.useStateSetter("popupElement"),T=Me("div",t,{state:{open:b,nested:x,transitionStatus:w,nestedDialogOpen:R},props:[A,{id:E,"aria-labelledby":y,"aria-describedby":f,role:I,...ts,hidden:!m,onKeyDown(N){rs.has(N.key)&&N.stopPropagation()},style:{"--nested-dialogs":C}},c],ref:[n,u.context.popupRef,k],stateAttributesMapping:im});return l.jsx(na,{context:g,openInteractionType:v,disabled:!m,closeOnFocusOut:!h,initialFocus:S,returnFocus:i,modal:p!==!1,restoreFocus:"popup",children:T})});function ga(e){return ru(19)?e:e?"true":void 0}const ma=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}})}),xa=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(hd.Provider,{value:r,children:l.jsxs(qi,{ref:n,...o,children:[i&&a===!0&&l.jsx(ma,{ref:s.context.internalBackdropRef,inert:ga(!c)}),t.children]})}):null});let Nl={},_l={},Ol="";function os(e,t){return ki(e)?e:t}function Hl(e,t,n){return/hidden|clip/.test(e.getComputedStyle(os(t,n)).overflowY)}function am(e){if(typeof document>"u")return!1;const t=Be(e);return rt(t).innerWidth-t.documentElement.clientWidth>0}function lm(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 cm(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 um(e){const t=Be(e),n=t.documentElement,r=t.body,o=rt(n);let s=0,i=0,a=!1;const c=It.create();if(an&&(o.visualViewport?.scale??1)!==1)return()=>{};function u(){const A=o.getComputedStyle(n),p=o.getComputedStyle(r),C=(A.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,Nl={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Ol=n.style.scrollBehavior,_l={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,v=n.scrollWidth>n.clientWidth,y=A.overflowY==="scroll"||p.overflowY==="scroll",w=A.overflowX==="scroll"||p.overflowX==="scroll",I=Math.max(0,o.innerWidth-r.clientWidth),E=Math.max(0,o.innerHeight-r.clientHeight),S=parseFloat(p.marginTop)+parseFloat(p.marginBottom),R=parseFloat(p.marginLeft)+parseFloat(p.marginRight),k=os(n,r);if(a=lm(e),a){n.style.scrollbarGutter=C,k.style.overflowY="hidden",k.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:C,overflowY:"hidden",overflowX:"hidden"}),(b||y)&&(n.style.overflowY="scroll"),(v||w)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:S||E?`calc(100dvh - ${S+E}px)`:"100dvh",width:R||I?`calc(100vw - ${R+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,Nl),Object.assign(r.style,_l),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Ol)}function h(){f(),c.request(u)}u();const g=Fe(o,"resize",h);return()=>{c.cancel(),f(),typeof o.removeEventListener=="function"&&g()}}class dm{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(Hl(s,r,o)){const a=new s.MutationObserver(()=>{Hl(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||!am(t);this.restore=i?cm(t):um(t)}}const fm=new dm;function Ad(e=!0,t=null){ie(()=>{if(e)return fm.acquire(t)},[e,t])}function pm({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,C=e.context.backdropRef.current;return x||C?x===m||C===m||ve(m,i)&&!m?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:g});return Ad(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]),ca(e,{activeTriggerProps:A.reference,inactiveTriggerProps:A.trigger,popupProps:A.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:f}),null}const hm={...fa,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 Am extends Gr{constructor(t,n,r){const o=new Yr,s=gm(t,o,n,r);super(s,mm(o),hm)}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};ia(r,t,n.trigger),this.update(r)}}function gm(e,t,n,r=!1){const o={...ua(),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=od(t,n,r),o}function mm(e){return{popupRef:d.createRef(),backdropRef:d.createRef(),internalBackdropRef:d.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function gd(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,C=p?"alertdialog":"dialog",b=_n(!0),v=b!=null,y={modal:m,disablePointerDismissal:x,nested:v,role:C},w=td((F,T)=>new Am({open:o,openProp:r,activeTriggerId:g,triggerIdProp:h,...y},F,T),!0);w.useControlledProp("openProp",r),w.useControlledProp("triggerIdProp",h),w.useSyncedValues(y),w.useContextCallback("onOpenChange",s),w.useContextCallback("onOpenChangeComplete",i);const I=w.useState("open"),E=w.useState("mounted"),S=w.useState("payload");Gg(w,I),aa(w);const{forceUnmount:R}=la(I,w);d.useImperativeHandle(u,()=>({unmount:R,close:()=>w.setOpen(!1,Ce(Ei))}),[R,w]);const k=I||E;return l.jsxs(Fu.Provider,{value:w,children:[f&&l.jsx(sa,{handle:f,store:w}),k&&l.jsx(pm,{store:w,parentContext:b?.context,isDrawer:A}),typeof n=="function"?n({payload:S}):n]})}function md(e){return gd("dialog",e)}const ba=d.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,c=_n(),u=wt(i);return c.useSyncedValueWithCleanup("titleElementId",u),Me("h2",t,{ref:n,props:[{id:u},a]})});function xm(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}=xm(n);return d.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function xd(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 vm({...e}){return l.jsx(md,{"data-slot":"sheet",...e})}function ym({...e}){return l.jsx(xa,{"data-slot":"sheet-portal",...e})}function Cm({className:e,...t}){return l.jsx(Ji,{"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 Im({className:e,children:t,side:n="right",showCloseButton:r=!0,...o}){return l.jsxs(ym,{children:[l.jsx(Cm,{}),l.jsxs(Aa,{"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(_e,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[l.jsx(Ni,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function wm({className:e,...t}){return l.jsx("div",{"data-slot":"sheet-header",className:fe("flex flex-col gap-0.5 p-4",e),...t})}function km({className:e,...t}){return l.jsx(ba,{"data-slot":"sheet-title",className:fe("cn-font-heading text-base font-medium text-foreground",e),...t})}function Em({className:e,...t}){return l.jsx($i,{"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 bd=d.createContext(void 0);function zr(e){const t=d.useContext(bd);if(t===void 0&&!e)throw new Error(ot(72));return t}const Sm={...fa,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 Rm extends Gr{constructor(t,n,r){const o=new Yr;super(Dm(t,o,n,r),Fm(o),Sm)}setOpen=(t,n)=>{Qg(this,t,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,Ce(Pn,t))}}function Dm(e,t,n,r=!1){const o={...ua(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return o.floatingRootContext=od(t,n,r),o}function Fm(e){return{popupRef:d.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const Bm=oa(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=td((F,T)=>new Rm({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,C=p.useState("activeTriggerId"),b=p.useState("mounted"),v=p.useState("payload");p.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:s,disabled:n}),aa(p,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:y,transitionStatus:w}=la(x,p),I=p.useState("isInstantPhase"),E=p.useState("instantType"),S=p.useState("lastOpenChangeReason"),R=d.useRef(null);ie(()=>{m&&n&&p.setOpen(!1,Ce(iu))},[m,n,p]),ie(()=>{w==="ending"&&S===Pt||w!=="ending"&&I?(E!=="delay"&&(R.current=E),p.set("instantType","delay")):R.current!==null&&(p.set("instantType",R.current),R.current=null)},[w,I,S,E,p]),ie(()=>{x&&C==null&&p.set("payload",void 0)},[p,C,x]),d.useImperativeHandle(a,()=>({unmount:y,close:()=>p.setOpen(!1,Ce(Ei))}),[y,p]);const k=x||b||!n&&i!=="none";return l.jsxs(bd.Provider,{value:p,children:[f&&l.jsx(sa,{handle:f,store:p}),k&&l.jsx(Mm,{store:p,disabled:n,trackCursorAxis:i}),typeof A=="function"?A({payload:v}):A]})});function Mm({store:e,disabled:t,trackCursorAxis:n}){const r=e.useState("floatingRootContext"),o=Xo(r,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),s=KA(r,{enabled:!t&&n!=="none",axis:n==="none"?void 0:n}),i=d.useMemo(()=>Mt(s.reference,o.reference),[s.reference,o.reference]);return ca(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:o.floating??lt}),null}const jm=d.createContext(void 0);function Pm(){return d.useContext(jm)}const Ll=600,vd="data-base-ui-tooltip-trigger";function Kl(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 Tm(e){let t=e;for(;t;){const n=t.closest(`[${vd}]`);if(n)return n;const r=t.getRootNode();t="host"in r&&Pe(r.host)?r.host:null}return null}const Nm=qu(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=id(i)??p;if(!x)throw new Error(ot(82));const C=wt(g),b=x.useState("isTriggerActive",C),v=x.useState("isOpenedByTrigger",C),y=x.useState("floatingRootContext"),w=d.useRef(null),I=u??Ll,E=h??0,{registerTrigger:S,isMountedByThisTrigger:R}=rd(C,w,x,{payload:a,closeOnClick:f,closeDelay:E}),k=Pm(),{delayRef:F,isInstantPhase:T,hasProvider:N}=EA(y,{open:v}),j=ha(y);x.useSyncedValue("isInstantPhase",T);const D=x.useState("disabled"),O=c??D,_=qe(O),B=x.useState("trackCursorAxis"),H=x.useState("disableHoverablePopup"),P=d.useRef(!1),M=dt(),L=d.useRef(void 0);function G(){return N?qn(F.current,"open")===0?0:u??k??Ll:I}function V(ee){const ue=w.current;if(!ue||!ee)return!1;const ce=Tm(ee);return ce!==null&&ce!==ue&&ve(ue,ce)}function Y(ee){const ue=V(ee);return P.current=ue,ue&&(j.openChangeTimeout.clear(),j.restTimeout.clear(),j.restTimeoutPending=!1,M.clear()),ue}const Q=ud(y,{enabled:!O,mouseOnly:!0,move:!1,handleClose:!H&&B!=="both"?pd():null,restMs:G,delay(){return h==null&&N?{close:qn(F.current,"close")}:{close:E}},triggerElementRef:w,isActiveTrigger:b,isClosing:()=>x.select("transitionStatus")==="ending",shouldOpen(){return!P.current}}),z=ad(y,{enabled:!O}).reference,K=ee=>{const ue=P.current,ce=Kl(ee),he=Y(ce),se=w.current,Ae=se&&ce&&ve(se,ce);if(he&&x.select("open")&&x.select("lastOpenChangeReason")===it){x.setOpen(!1,Ce(it,ee));return}if(ue&&!he&&Ae&&!_.current&&!x.select("open")&&se&&mn(L.current)){const re=()=>{!P.current&&!_.current&&!x.select("open")&&x.setOpen(!0,Ce(it,ee,se))},oe=G();oe===0?(M.clear(),re()):M.start(oe,re)}},X=x.useState("triggerProps",R);return Me("button",t,{state:{open:v},ref:[n,S,w],props:[Q,z,R||B!=="none"?X:void 0,{onMouseOver(ee){K(ee.nativeEvent)},onFocus(ee){V(Kl(ee.nativeEvent))&&ee.preventBaseUIHandler()},onMouseLeave(){P.current=!1,M.clear(),L.current=void 0},onPointerEnter(ee){L.current=ee.pointerType},onPointerDown(ee){L.current=ee.pointerType,x.set("closeOnClick",f),f&&!x.select("open")&&x.cancelPendingOpen(ee.nativeEvent)},onClick(ee){f&&!x.select("open")&&x.cancelPendingOpen(ee.nativeEvent)},id:C,"data-trigger-disabled":O?"":void 0,[vd]:O?void 0:""},A],stateAttributesMapping:Bu})}),yd=d.createContext(void 0);function _m(){const e=d.useContext(yd);if(e===void 0)throw new Error(ot(70));return e}const Om=d.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,style:a,...c}=t,{node:u,subtree:f}=Hu({container:o,ref:n,componentProps:t,elementProps:c});return!f&&!u?null:l.jsxs(d.Fragment,{children:[f,u&&sn.createPortal(r,u)]})}),Hm=d.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return zr().useState("mounted")||r?l.jsx(yd.Provider,{value:r,children:l.jsx(Om,{ref:n,...o})}):null}),Cd=d.createContext(void 0);function Id(){const e=d.useContext(Cd);if(e===void 0)throw new Error(ot(71));return e}const Lm=d.createContext(void 0);function is(){return d.useContext(Lm)?.direction??"ltr"}const Km=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=mu(f),A={x:n,y:r},p=Gi(o),m=Qi(p),x=await i.getDimensions(u),C=p==="y",b=C?"top":"left",v=C?"bottom":"right",y=C?"clientHeight":"clientWidth",w=s.reference[m]+s.reference[p]-A[p]-s.floating[m],I=A[p]-s.reference[p],E=h==="real"?await i.getOffsetParent?.(u):a.floating;let S=a.floating[y]||s.floating[m];(!S||!await i.isElement?.(E))&&(S=a.floating[y]||s.floating[m]);const R=w/2-I/2,k=S/2-x[m]/2-1,F=Math.min(g[b],k),T=Math.min(g[v],k),N=F,j=S-x[m]-T,D=S/2-x[m]/2+R,O=gu(N,D,j),_=!c.arrow&&Cn(o)!=null&&D!==O&&s.reference[m]/2-(D<N?F:T)-x[m]/2<0,B=_?D<N?D-N:D-j:0;return{[p]:A[p]+B,data:{[p]:O,centerOffset:D-O-B,..._&&{alignmentOffset:B}},reset:_}}}),Wm=(e,t)=>({...Km(e),options:[e,t]}),Qm={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}}}},Gm={sideX:"left",sideY:"top"},Wl="--available-width",Ql="--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 Gl(e,t,n){const{rects:r,placement:o}=e;return{side:wd(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 va(e){return Ym(e,Vg)}function Ym(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:C,shift:b,nodeId:v,adaptiveOrigin:y,lazyFlip:w=!1,externalTree:I}=e,[E,S]=d.useState(null);!x&&E!==null&&S(null);const R=C.side||"flip",k=C.align||"flip",F=C.fallbackAxisSide||"end",T=b?.crossAxis??!1,N=b?.rootBoundary,j=typeof n=="function"?n:void 0,D=de(j),O=j?D:n,_=qe(n),B=qe(x),P=is()==="rtl",M=E||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":P?"left":"right","inline-start":P?"right":"left"}[o],L=i==="center"?M:`${M}-${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 V=1,Y=o==="bottom"?V:0,Q=o==="top"?V:0,z=o==="right"?V:0,K=o==="left"?V:0,X={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:G},ae=d.useRef(null),te=qe(s),$=qe(a),ee=typeof s!="function"?s:0,ue=typeof a!="function"?a:0,ce=[];A&&ce.push(A),ce.push(Ig(Re=>{const Ue=Gl(Re,o,P),Ve=typeof te.current=="function"?te.current(Ue):te.current,$e=typeof $.current=="function"?$.current(Ue):$.current;return{mainAxis:Ve,crossAxis:$e,alignmentAxis:$e}},[ee,ue,P,o]));const he=k==="none"&&R!=="shift",se=!he&&(f||T||R==="shift"),Ae=R==="none"?null:Eg({...X,padding:{top:G.top+V+Y,right:G.right+V+K,bottom:G.bottom+V+Q,left:G.left+V+z},mainAxis:!T&&R==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:F}),re=he?null:wg({...X,rootBoundary:N,mainAxis:k!=="none",crossAxis:se,limiter:f||T?void 0:kg(Re=>{if(!ae.current)return{};const{width:Ue,height:Ve}=ae.current.getBoundingClientRect(),$e=Bt(jt(Re.placement)),gt=$e==="y"?Ue:Ve,pt=$e==="y"?G.left+G.right:G.top+G.bottom;return{offset:gt/2+pt/2}})},[X,f,T,N,G,k]);R==="shift"||k==="shift"||i==="center"?ce.push(re,Ae):ce.push(Ae,re),ce.push(Sg({...X,apply({elements:{floating:Re},availableWidth:Ue,availableHeight:Ve,rects:$e}){if(!B.current)return;const gt=Re.style;gt.setProperty(Wl,`${Ue}px`),gt.setProperty(Ql,`${Ve}px`);const pt=rt(Re).devicePixelRatio||1,{x:Rt,y:st,width:Et,height:Dt}=$e.reference,ht=(Math.round((Rt+Et)*pt)-Math.round(Rt*pt))/pt,De=(Math.round((st+Dt)*pt)-Math.round(st*pt))/pt;gt.setProperty("--anchor-width",`${ht}px`),gt.setProperty("--anchor-height",`${De}px`)}}),Wm(Re=>({element:ae.current||Be(Re.elements.floating).createElement("div"),padding:h,offsetParent:"floating"}),[h]),{name:"transformOrigin",fn(Re){const{elements:Ue,middlewareData:Ve,placement:$e,rects:gt,y:pt}=Re,Rt=jt($e),st=Bt(Rt),Et=ae.current,Dt=Ve.arrow?.x||0,ht=Ve.arrow?.y||0,De=Et?.clientWidth||0,We=Et?.clientHeight||0,mt=Dt+De/2,yt=ht+We/2,Ct=Math.abs(Ve.shift?.y||0),Ft=gt.reference.height/2,Ht=typeof s=="function"?s(Gl(Re,o,P)):s,cn=Ct>Ht,ir={top:`${mt}px calc(100% + ${Ht}px)`,bottom:`${mt}px ${-Ht}px`,left:`calc(100% + ${Ht}px) ${yt}px`,right:`${-Ht}px ${yt}px`}[Rt],kn=`${mt}px ${gt.reference.y+Ft-pt}px`;return Ue.floating.style.setProperty("--transform-origin",se&&st==="y"&&cn?kn:ir),{}}},Qm,y),ie(()=>{!x&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[x,m]);const oe=d.useMemo(()=>({elementResize:!g&&typeof ResizeObserver<"u",layoutShift:!g&&typeof IntersectionObserver<"u"}),[g]),{refs:le,elements:ge,x:me,y:W,middlewareData:U,update:be,placement:q,context:ne,isPositioned:Ee,floatingStyles:Se}=t({rootContext:m,open:p?x:void 0,placement:L,middleware:ce,strategy:r,whileElementsMounted:p?void 0:(...Re)=>El(...Re,oe),nodeId:v,externalTree:I}),{sideX:Ge,sideY:ze}=U.adaptiveOrigin||Gm,Le=Ee?r:"fixed",ct=d.useMemo(()=>{let Re;return Ee?y?Re={position:Le,[Ge]:me,[ze]:W}:Re={...Se,position:Le}:Re={position:Le,top:0,left:0},Re[Wl]="100vw",Re[Ql]="100vh",Ee||(Re.opacity=0),Re},[y,Le,Ge,me,ze,W,Se,Ee]),tt=d.useRef(null);ie(()=>{if(!x)return;const Re=_.current,Ue=typeof Re=="function"?Re():Re,$e=(Yl(Ue)?Ue.current:Ue)||null||null;$e!==tt.current&&(le.setPositionReference($e),tt.current=$e)},[x,le,O,_]),d.useEffect(()=>{if(!x)return;const Re=_.current;typeof Re!="function"&&Yl(Re)&&Re.current!==tt.current&&(le.setPositionReference(Re.current),tt.current=Re.current)},[x,le,O,_]),d.useEffect(()=>{if(p&&x&&ge.reference&&ge.floating)return El(ge.reference,ge.floating,be,oe)},[p,x,ge,be,oe]);const Je=jt(q),ft=wd(o,Je,P),Ie=Cn(q)||"center",Ke=!!U.hide?.referenceHidden;ie(()=>{w&&x&&Ee&&Je!==M&&S(Je)},[w,x,Ee,Je,M]);const Ne=d.useMemo(()=>({position:"absolute",top:U.arrow?.y,left:U.arrow?.x}),[U.arrow]),nt=U.arrow?.centerOffset!==0;return d.useMemo(()=>({positionerStyles:ct,arrowStyles:Ne,arrowRef:ae,arrowUncentered:nt,side:ft,align:Ie,physicalSide:Je,anchorHidden:Ke,refs:le,context:ne,isPositioned:Ee,update:be}),[ct,Ne,ae,nt,ft,Ie,Je,Ke,le,ne,Ee,be])}function Yl(e){return e!=null&&"current"in e}function as(e){return e==="starting"?MA:lt}function ya(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:a=!1}){const c={...n};return a&&(c.pointerEvents="none"),Me("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:c},as(r),o],stateAttributesMapping:Wr})}const zm=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=Nu,style:C,...b}=t,v=zr(),y=_m(),w=v.useState("open"),I=v.useState("mounted"),E=v.useState("trackCursorAxis"),S=v.useState("disableHoverablePopup"),R=v.useState("floatingRootContext"),k=v.useState("instantType"),F=v.useState("transitionStatus"),T=v.useState("adaptiveOrigin"),N=va({anchor:s,positionMethod:i,floatingRootContext:R,mounted:I,side:a,sideOffset:u,align:c,alignOffset:f,collisionBoundary:h,collisionPadding:g,sticky:p,arrowPadding:A,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:x,adaptiveOrigin:T}),j=d.useMemo(()=>({open:w,side:N.side,align:N.align,anchorHidden:N.anchorHidden,instant:E!=="none"?"tracking-cursor":k}),[w,N.side,N.align,N.anchorHidden,E,k]),D=ya(t,j,{styles:N.positionerStyles,transitionStatus:F,props:b,refs:[n,v.useStateSetter("positionerElement")],hidden:!I,inert:!w||E==="both"||S});return l.jsx(Cd.Provider,{value:N,children:D})}),Um=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=zr(),{side:c,align:u}=Id(),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");zt({open:f,ref:a.context.popupRef,onComplete(){f&&a.context.onOpenChangeComplete?.(!0)}}),cd(p,{enabled:!m,closeDelay:x});const C=a.useStateSetter("popupElement");return Me("div",t,{state:{open:f,side:c,align:u,instant:h,transitionStatus:g},ref:[n,a.context.popupRef,C],props:[ts,A,as(g),i],stateAttributesMapping:Zi})}),Vm=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}=Id(),A=a.useState("open"),p=a.useState("instantType");return Me("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 Zm(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(Bm,{"data-slot":"tooltip",...e})}function cs({...e}){return l.jsx(Nm,{"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(Hm,{children:l.jsx(zm,{align:r,alignOffset:o,side:t,sideOffset:n,className:"isolate z-50",children:l.jsxs(Um,{"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(Vm,{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 Jm="sidebar_state",$m=3600*24*7,Xm="16rem",qm="18rem",e0="3rem",t0="b",kd=d.createContext(null);function ds(){const e=d.useContext(kd);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function n0({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:o,children:s,...i}){const a=gA(),[c,u]=d.useState(!1),[f,h]=d.useState(e),g=t??f,A=d.useCallback(C=>{const b=typeof C=="function"?C(g):C;n?n(b):h(b),document.cookie=`${Jm}=${b}; path=/; max-age=${$m}`},[n,g]),p=d.useCallback(()=>a?u(C=>!C):A(C=>!C),[a,A,u]);d.useEffect(()=>{const C=b=>{b.key===t0&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),p())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[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(kd.Provider,{value:x,children:l.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Xm,"--sidebar-width-icon":e0,...o},className:fe("group/sidebar-wrapper flex h-svh w-full has-data-[variant=inset]:bg-sidebar",r),...i,children:s})})}function r0({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(vm,{open:u,onOpenChange:f,...i,children:l.jsxs(Im,{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":qm},side:e,children:[l.jsxs(wm,{className:"sr-only",children:[l.jsx(km,{children:"Sidebar"}),l.jsx(Em,{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 o0({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 s0({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 i0({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 a0({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 l0({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 c0({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 u0=Ci("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=lu({defaultTagName:"button",props:Mt({className:fe(u0({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 Ed=d.createContext(void 0);function Sd(e){const t=d.useContext(Ed);if(t===void 0&&!e)throw new Error(ot(33));return t}const Rd=d.createContext(void 0);function sr(e){const t=d.useContext(Rd);if(t===void 0&&!e)throw new Error(ot(36));return t}const d0=d.createContext(void 0);function Ca(e=!0){const t=d.useContext(d0);if(t===void 0&&!e)throw new Error(ot(25));return t}function f0(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=Ca(!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&&!_i&&A.button===2)return}a.current&&s.context.allowMouseUpTriggerRef.current&&(!g||A.button===2)&&c.type==="regular-item"&&Si(a.current,A,{detail:1})}}),[t,n,r,u,o,f,s,i,a,h,g,c])}const p0={type:"regular-item"};function h0(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}=Yt({disabled:n,focusableWhenDisabled:!0,native:a,composite:!0}),A=f0({closeOnClick:t,highlighted:r,id:o,nodeId:u,store:s,typingRef:i,itemRef:f,itemMetadata:c}),p=d.useCallback(x=>Mt(A,{onMouseEnter(){c.type==="submenu-trigger"&&c.setActive()}},x,h),[A,h,c]),m=Gt(f,g);return d.useMemo(()=>({getItemProps:p,itemRef:m}),[p,m])}const Dd=d.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function A0(){return d.useContext(Dd)}function fs(e={}){const{guess:t,label:n,metadata:r,textRef:o,index:s}=e,{register:i,unregister:a,subscribeMapChange:c,nextIndexRef:u}=A0(),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 C=p.current;C&&a(C),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 C=p.current?x.get(p.current)?.index:null;C!=null&&g(C)})},[s,c]),{ref:m,index:A}}const g0=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=Sd(!0),p=wt(s),{store:m}=sr(),x=m.useState("disabled"),C=c||x,b=m.useState("isActive",g.index),v=m.useState("itemProps"),{getItemProps:y,itemRef:w}=h0({closeOnClick:u,disabled:C,highlighted:b,id:p,store:m,nativeButton:a,nodeId:A?.context.nodeId,itemMetadata:p0});return Me("div",t,{state:{disabled:C,highlighted:b},props:[v,h,y],ref:[w,n,g.ref]})}),m0=d.createContext(void 0);function Ia(e){return d.useContext(m0)}const x0=d.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...a}=t,{store:c}=sr(),{side:u,align:f}=Sd(),h=Ia()!=null,g=c.useState("open"),A=c.useState("transitionStatus"),p=c.useState("popupProps"),m=c.useState("mounted"),x=c.useState("instantType"),C=c.useState("activeTriggerElement"),b=c.useState("parent"),v=c.useState("lastOpenChangeReason"),y=c.useState("rootId"),w=c.useState("floatingRootContext"),I=c.useState("floatingTreeRoot"),E=c.useState("closeDelay"),S=c.useState("hoverEnabled"),R=c.useState("disabled"),k=c.useState("openMethod"),F=b.type==="context-menu";zt({open:g,ref:c.context.popupRef,onComplete(){g&&c.context.onOpenChangeComplete?.(!0)}}),d.useEffect(()=>{function O(_){c.setOpen(!1,Ce(_.reason,_.domEvent))}return I.events.on("close",O),()=>{I.events.off("close",O)}},[I.events,c]),cd(w,{enabled:S&&!R&&!F&&b.type!=="menubar",closeDelay:E});const T=c.useStateSetter("popupElement"),N={transitionStatus:A,side:u,align:f,open:g,nested:b.type==="menu",instant:x},j=Me("div",t,{state:N,ref:[n,c.context.popupRef,T],stateAttributesMapping:Zi,props:[p,{onKeyDown(O){h&&rs.has(O.key)&&O.stopPropagation()}},as(A),a,{"data-rootownerid":y}]});let D=b.type===void 0||F;return(C||b.type==="menubar"&&v!==Lo)&&(D=!0),l.jsx(na,{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:C,nextFocusableElement:b.type===void 0?c.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:b.type===void 0?c.context.beforeContentFocusGuardRef:void 0,children:j})}),Fd=d.createContext(void 0);function b0(){const e=d.useContext(Fd);if(e===void 0)throw new Error(ot(32));return e}const v0=d.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=sr();return s.useState("mounted")||r?l.jsx(Fd.Provider,{value:r,children:l.jsx(qi,{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=St(C0).current,c=St(y0).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(E=>{I.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,I});function C(w){if(g.current?.disconnect(),g.current=null,typeof MutationObserver!="function"||w.length<2)return;const I=new MutationObserver(S=>{if(!k0(S))return;let R=null;for(const k of w)if(k.isConnected){if(R&&Bd(R,k)>0){I.disconnect(),A();return}R=k}});g.current=I;const E=new Set;for(let S=1;S<w.length;S+=1){const R=w0(w[S-1],w[S]);R&&E.add(R)}E.forEach(S=>I.observe(S,{childList:!0}))}const b=de(()=>{const[w,I]=I0(c),E=x(w);C(I),h.current=w,f.current=!1,a.forEach(S=>S(E)),s(E)});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 v=de(w=>(a.add(w),()=>{a.delete(w)})),y=d.useMemo(()=>({register:p,unregister:m,subscribeMapChange:v,nextIndexRef:u}),[p,m,v,u]);return l.jsx(Dd.Provider,{value:y,children:t})}function y0(){return new Map}function C0(){return new Set}function I0(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)=>Bd(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 w0(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function k0(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 Bd(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const E0=20;function Md(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-E0)},[e,t,n]),Ad(e&&(!t||o),r)}const S0=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=Tu,style:C,...b}=t,{store:v}=sr(),y=b0(),w=Ca(!0),I=v.useState("parent"),E=v.useState("floatingRootContext"),S=v.useState("floatingTreeRoot"),R=v.useState("mounted"),k=v.useState("open"),F=v.useState("modal"),T=v.useState("openMethod"),N=v.useState("activeTriggerElement"),j=v.useState("transitionStatus"),D=v.useState("positionerElement"),O=v.useState("instantType"),_=v.useState("adaptiveOrigin"),B=v.useState("lastOpenChangeReason"),H=v.useState("floatingNodeId"),P=v.useState("floatingParentNodeId"),M=E.useState("domReferenceElement"),L=d.useRef(null),G=Vi(D);let V=r,Y=u,Q=f,z=c,K=x;I.type==="context-menu"&&(V=r??I.context?.anchor,z=z??"start",!a&&z!=="center"&&(Q=t.alignOffset??2,Y=t.sideOffset??-5));let X=a,ae=z;I.type==="menu"?(X=X??"inline-end",ae=ae??"start",K=t.collisionAvoidance??Nu):I.type==="menubar"&&(X=X??(I.context.orientation==="vertical"?"inline-end":"bottom"),ae=ae??"start");const te=I.type==="context-menu",$=va({anchor:V,floatingRootContext:E,positionMethod:w?"fixed":o,mounted:R,side:X,sideOffset:Y,align:ae,alignOffset:Q,arrowPadding:te?0:A,collisionBoundary:h,collisionPadding:g,sticky:p,nodeId:H,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:K,shift:te?{crossAxis:!("side"in K&&K.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:S,adaptiveOrigin:_});d.useEffect(()=>{function oe(le){le.open&&(le.parentNodeId===H&&v.set("hoverEnabled",!1),le.nodeId!==H&&le.parentNodeId===v.select("floatingParentNodeId")&&v.setOpen(!1,Ce(xr)))}return S.events.on("menuopenchange",oe),()=>{S.events.off("menuopenchange",oe)}},[v,S.events,H]),d.useEffect(()=>{if(v.select("floatingParentNodeId")==null)return;function oe(le){if(le.open||le.nodeId!==v.select("floatingParentNodeId"))return;const ge=le.reason??xr;v.setOpen(!1,Ce(ge))}return S.events.on("menuopenchange",oe),()=>{S.events.off("menuopenchange",oe)}},[S.events,v]);const ee=dt();d.useEffect(()=>{k||ee.clear()},[k,ee]),d.useEffect(()=>{function oe(le){if(!(!k||le.nodeId!==v.select("floatingParentNodeId")))if(le.target&&N&&N!==le.target){const ge=v.select("closeDelay");ge>0?ee.isStarted()||ee.start(ge,()=>{v.setOpen(!1,Ce(xr))}):v.setOpen(!1,Ce(xr))}else ee.clear()}return S.events.on("itemhover",oe),()=>{S.events.off("itemhover",oe)}},[S.events,k,N,v,ee]),d.useEffect(()=>{const oe={open:k,nodeId:H,parentNodeId:P,reason:v.select("lastOpenChangeReason")};S.events.emit("menuopenchange",oe)},[S.events,k,v,H,P]),ie(()=>{const oe=M,le=L.current;if(oe&&(L.current=oe),le&&oe&&oe!==le){v.set("instantType",void 0);const ge=new AbortController;return G(()=>{v.set("instantType","trigger-change")},ge.signal),()=>{ge.abort()}}},[M,G,v]);const ue={open:k,side:$.side,align:$.align,anchorHidden:$.anchorHidden,nested:I.type==="menu",instant:O},ce=I.type==="menubar"&&I.context.modal;Md(k&&(ce||F&&B!==it),T==="touch",D,N);const se=ya(t,ue,{styles:$.positionerStyles,transitionStatus:j,props:b,refs:[n,v.useStateSetter("positionerElement")],hidden:!R,inert:!k}),Ae=R&&I.type!=="menu"&&(I.type!=="menubar"&&F&&B!==it||I.type==="menubar"&&I.context.modal);let re=null;return I.type==="menubar"?re=I.context.contentElement:I.type===void 0&&(re=N),l.jsxs(Ed.Provider,{value:$,children:[Ae&&l.jsx(ma,{ref:I.type==="context-menu"||I.type==="nested-context-menu"?I.context.internalBackdropRef:null,inert:ga(!k),cutout:re}),l.jsx(NA,{id:H,children:l.jsx(Ur,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:se})})]})}),R0=d.createContext(null);function jd(e){return d.useContext(R0)}const D0={...fa,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 F0 extends Gr{constructor(t){super({...M0(),...t},B0(),D0),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 B0(){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 M0(){return{...ua(),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 ea,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:lt,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}const j0=d.createContext(void 0);function P0(){return d.useContext(j0)}const T0=oa(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,C=Ca(!0),b=sr(!0),v=jd(!0),y=P0(),w=d.useMemo(()=>y&&b?{type:"menu",store:b.store}:v?{type:"menubar",context:v}:C&&!b?{type:"context-menu",context:C}:{type:void 0},[C,b,v,y]),I=N0({open:i,openProp:r,activeTriggerId:m,triggerIdProp:p,parent:w});I.useControlledProp("openProp",r),I.useControlledProp("triggerIdProp",p),I.useContextCallback("onOpenChangeComplete",s);const E=Zn(),S=Zn(),R=I.useState("floatingTreeRoot"),k=Qu(R),F=In(),T=I.useState("open"),N=I.useState("activeTriggerElement"),j=I.useState("positionerElement"),D=I.useState("hoverEnabled"),O=I.useState("disabled"),_=I.useState("lastOpenChangeReason"),B=I.useState("parent"),H=I.useState("activeIndex"),P=I.useState("payload"),M=I.useState("floatingParentNodeId"),L=d.useRef(null),G=d.useRef(B.type!=="context-menu"),V=dt(),Y=d.useRef(!0),Q=dt(),z=M!=null,{openMethod:K,triggerProps:X}=xd(T);I.useSyncedValues({disabled:a,highlightItemOnHover:x,modal:B.type===void 0?c:void 0,openMethod:K,rootId:E}),aa(I);const{forceUnmount:ae}=la(T,I,()=>{I.set("allowMouseEnter",!1)});ie(()=>{C&&!b?I.update({parent:{type:"context-menu",context:C},floatingNodeId:k,floatingParentNodeId:F}):b&&I.update({floatingNodeId:k,floatingParentNodeId:F})},[C,b,k,F,I]),d.useEffect(()=>{if(T||(L.current=null),B.type==="context-menu"){if(!T){V.clear(),G.current=!1;return}V.start(500,()=>{G.current=!0})}},[V,T,B.type]),ie(()=>{!T&&!D&&I.set("hoverEnabled",!0)},[T,D,I]);const te=de((ne,Ee)=>{const Se=Ee.reason;if(!ne&&!I.select("open")||T===ne&&Ee.trigger===N&&_===Se)return;const Ge=nd(Ee);if(!ne&&Ee.trigger==null&&(Ee.trigger=N??void 0),o?.(ne,Ee),Ee.isCanceled)return;I.state.floatingRootContext.dispatchOpenChange(ne,Ee);const ze=Ee.event;if(ne===!1&&ze?.type==="click"&&ze.pointerType==="touch"&&!Y.current)return;ne&&Se===Gn?(Y.current=!1,Q.start(300,()=>{Y.current=!0})):(Y.current=!0,Q.clear());const Le=(Se===Pn||Se===Cr)&&ze.detail===0,ct=!ne&&(Se===Ko||Se==null),tt={open:ne,openChangeReason:Se};L.current=Ee.event,ia(tt,ne,Ee.trigger,Ge()),I.update(tt),B.type==="menubar"&&(Se===Gn||Se===Bn||Se===it||Se===Zs||Se===xr)?I.set("instantType","group"):Le||ct?I.set("instantType",Le?"click":"dismiss"):I.set("instantType",void 0)}),$=ed({popupStore:I,floatingId:S,nested:F!=null,onOpenChange:te}),ee=$.context.events;ie(()=>{const ne=({open:Ee,eventDetails:Se})=>te(Ee,Se);return ee.on("setOpen",ne),()=>{ee?.off("setOpen",ne)}},[ee,te]);const ue=d.useCallback(()=>{I.setOpen(!1,Ce(Ei))},[I]);d.useImperativeHandle(h,()=>({unmount:ae,close:ue}),[ae,ue]);let ce;B.type==="context-menu"&&(ce=B.context),d.useImperativeHandle(ce?.positionerRef,()=>j,[j]),d.useImperativeHandle(ce?.actionsRef,()=>({setOpen:te}),[te]);const he=Xo($,{enabled:!O,bubbles:{escapeKey:g&&B.type==="menu"},outsidePress(){return B.type!=="context-menu"||L.current?.type==="contextmenu"?!0:G.current},externalTree:z?R:void 0}),se=is(),Ae=d.useCallback(ne=>{I.select("activeIndex")!==ne&&I.set("activeIndex",ne)},[I]),re=dd($,{enabled:!O,listRef:I.context.itemDomElements,activeIndex:H,nested:B.type!==void 0,loopFocus:u,orientation:f,parentOrientation:B.type==="menubar"?B.context.orientation:void 0,rtl:se==="rtl",disabledIndices:Nt,onNavigate:Ae,openOnArrowKeyDown:B.type!=="context-menu",externalTree:z?R:void 0,focusItemOnHover:x}),oe=d.useCallback(ne=>{I.context.typingRef.current=ne},[I]),le=fd($,{enabled:!O,listRef:I.context.itemLabels,elementsRef:I.context.itemDomElements,activeIndex:H,resetMs:FA,onMatch:ne=>{T&&ne!==H&&I.set("activeIndex",ne)},onTyping:oe}),ge=d.useMemo(()=>{const ne=Mt(le.reference,re.reference,he.reference,{onMouseMove(){I.set("allowMouseEnter",!0)}},X);return ne["aria-haspopup"]="menu",ne["aria-expanded"]=T,ne},[I,le.reference,re.reference,he.reference,X,T]),me=d.useMemo(()=>{const ne=Mt(re.trigger,he.trigger,X);return ne["aria-haspopup"]="menu",ne["aria-expanded"]=!1,ne},[re.trigger,he.trigger,X]),W=d.useMemo(()=>Mt(ts,{id:S,role:"menu","aria-labelledby":N?.id,onMouseMove(){I.set("allowMouseEnter",!0),B.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)}},le.floating,re.floating,he.floating),[N,S,B.type,I,le.floating,re.floating,he.floating]),U=re.item??lt;ca(I,{floatingRootContext:$,activeTriggerProps:ge,inactiveTriggerProps:me,popupProps:W,itemProps:U});const be=d.useMemo(()=>({store:I,parent:w}),[I,w]),q=l.jsxs(Rd.Provider,{value:be,children:[A&&l.jsx(sa,{handle:A,store:I}),typeof n=="function"?n({payload:P}):n]});return B.type===void 0||B.type==="context-menu"?l.jsx(_A,{externalTree:R,children:q}):q});function N0(e){return St(()=>new F0(e)).current}const so=5;function Pd(e,t){const n=_0(t);return e.clientX>=n.left-so&&e.clientX<=n.right+so&&e.clientY>=n.top-so&&e.clientY<=n.bottom+so}function _0(e){const t=e.getBoundingClientRect(),n=rt(e);if(Oi)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 Td(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Ri(),{ref:o,index:s}=fs(e),i=n===s,a=d.useRef(null),c=Gt(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 Nd(e){const{render:t,className:n,style:r,state:o=lt,props:s=Nt,refs:i=Nt,metadata:a,stateAttributesMapping:c,tag:u="div",...f}=e,{compositeProps:h,compositeRef:g}=Td({metadata:a});return Me(u,e,{state:o,ref:[g,...i],props:[h,...s,f],stateAttributesMapping:c})}function _d(e){if(Ze(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!Dn(e))return _d(Jn(e))}function O0(e,t){const n=d.useRef(null);function r(s){sn.flushSync(()=>{e.setOpen(!1,Ce(Bn,s.nativeEvent,s.currentTarget))}),sA(n.current)?.focus()}function o(s){const i=e.select("positionerElement");if(i&&Yn(s,i))e.context.beforeContentFocusGuardRef.current?.focus();else{sn.flushSync(()=>{e.setOpen(!1,Ce(Bn,s.nativeEvent,s.currentTarget))});let a=oA(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 H0(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())}}:lt,[t,n,r])}const L0=qu(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=sr(!0),C=id(g)??m?.store;if(!C)throw new Error(ot(85));const b=wt(c),v=C.useState("isTriggerActive",b),y=C.useState("floatingRootContext"),w=C.useState("isOpenedByTrigger",b),I=C.useState("triggerPopupId",b),E=d.useRef(null),S=W0(),R=Ri(!0),k=wn(),F=d.useMemo(()=>k??new ea,[k]),T=Qu(F),N=In(),{registerTrigger:j,isMountedByThisTrigger:D}=rd(b,E,C,{payload:A,closeDelay:h,parent:S,floatingTreeRoot:F,floatingNodeId:T,floatingParentNodeId:N,keyboardEventRelay:R?.relayKeyboardEvent}),O=S.type==="menubar",_=C.useState("disabled"),B=i||_||O&&S.context.disabled,{getButtonProps:H,buttonRef:P}=Yt({disabled:B,native:a});d.useEffect(()=>{!w&&S.type===void 0&&(C.context.allowMouseUpTriggerRef.current=!1)},[C,w,S.type]);const M=d.useRef(null),L=dt(),G=de(oe=>{if(!M.current)return;L.clear(),C.context.allowMouseUpTriggerRef.current=!1;const le=oe.target;ve(M.current,le)||ve(C.select("positionerElement"),le)||le===M.current||le!=null&&_d(le)===C.select("rootId")||Pd(oe,M.current)||F.events.emit("close",{domEvent:oe,reason:au})});d.useEffect(()=>{w&&C.select("lastOpenChangeReason")===it&&Be(M.current).addEventListener("mouseup",G,{once:!0})},[w,G,C]);const V=O&&S.context.hasSubmenuOpen,Q=ud(y,{enabled:(u??V)&&!B&&(!O||V&&!D),handleClose:pd({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?f:void 0,delay:{close:h},triggerElementRef:E,externalTree:F,isActiveTrigger:v,isClosing:()=>C.select("transitionStatus")==="ending"}),z=K0(w,C.select("lastOpenChangeReason")),K=Gu(y,{enabled:!B,event:w&&O?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0?z:!1}),X=ad(y,{enabled:!B&&V}),ae=H0({open:w,enabled:O,mouseDownAction:"open"}),te=d.useMemo(()=>Mt(X.reference,K.reference),[X.reference,K.reference]),$=C.useState("triggerProps",D),{preFocusGuardRef:ee,handlePreFocusGuardFocus:ue,handleFocusTargetFocus:ce}=O0(C,E),he={disabled:B,open:w},se=[M,n,P,j,E],Ae=[te,Q??lt,$,{"aria-haspopup":"menu","aria-controls":I,id:b,onMouseDown:oe=>{if(C.select("open"))return;L.start(200,()=>{C.context.allowMouseUpTriggerRef.current=!0}),Be(oe.currentTarget).addEventListener("mouseup",G,{once:!0})}},O?{role:"menuitem"}:{},ae,p,H],re=Me("button",t,{enabled:!O,stateAttributesMapping:ni,state:he,ref:se,props:Ae});return O?l.jsx(Nd,{tag:"button",render:r,className:o,style:s,state:he,refs:se,props:Ae,stateAttributesMapping:ni}):w?l.jsxs(d.Fragment,{children:[l.jsx(er,{ref:ee,onFocus:ue},`${b}-pre-focus-guard`),l.jsx(d.Fragment,{children:re},b),l.jsx(er,{ref:C.context.triggerFocusTargetRef,onFocus:ce},`${b}-post-focus-guard`)]}):l.jsx(d.Fragment,{children:re},b)});function K0(e,t){const n=dt(),[r,o]=d.useState(!1);return ie(()=>{e&&t===it?(o(!0),n.start(BA,()=>{o(!1)})):e||(n.clear(),o(!1))},[e,t,n]),r}function W0(){const e=jd();return d.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}function Od(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Do({...e}){return l.jsx(T0,{"data-slot":"dropdown-menu",...e})}function Fo({...e}){return l.jsx(L0,{"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(v0,{children:l.jsx(S0,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:l.jsx(x0,{"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 Mo({className:e,inset:t,variant:n="default",...r}){return l.jsx(g0,{"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 jo=["zh-CN","ja","ko","en","ar","fr","es","de","ru"],Q0=["ar"],Hd=e=>Q0.includes(e)?"rtl":"ltr",G0=e=>({"zh-CN":"简体中文",ja:"日本語",ko:"한국어",en:"English",ar:"العربية",fr:"Français",es:"Español",de:"Deutsch",ru:"Русский"})[e],Y0=e=>{for(const t of e){const n=t.toLowerCase(),r=jo.find(i=>i.toLowerCase()===n);if(r!==void 0)return r;const o=n.split("-")[0],s=jo.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)},z0={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:"导出被阻止:"}},U0={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:"エクスポートをブロック:"}},V0={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:"내보내기 차단:"}},Z0={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:"التصدير محجوب:"}},J0={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é :"}},$0={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:"}},X0={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:"}},q0={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:"Экспорт заблокирован:"}},ex={en:$t,"zh-CN":un($t,z0),ja:un($t,U0),ko:un($t,V0),ar:un($t,Z0),fr:un($t,J0),es:un($t,$0),de:un($t,X0),ru:un($t,q0)},tx=e=>ex[e],Ld="create-opentray.locale",Kd="create-opentray.theme",Wd="lang",Qd=new Set(jo),nx=()=>{try{const t=new URLSearchParams(window.location.search).get(Wd);return t!==null&&Qd.has(t)?t:null}catch{return null}},rx=e=>{try{const t=new URL(window.location.href);t.searchParams.set(Wd,e),window.history.replaceState(null,"",t)}catch{}},zl=e=>{try{return window.localStorage.getItem(e)}catch{return null}},Ul=(e,t)=>{try{window.localStorage.setItem(e,t)}catch{}},ox=()=>window.matchMedia("(prefers-color-scheme: dark)").matches,Vl=e=>e==="system"?ox()?"dark":"light":e,fi=(e,t)=>{const n=document.documentElement;n.lang=e,n.dir=Hd(e),n.classList.toggle("dark",Vl(t)==="dark"),n.style.colorScheme=Vl(t)},sx=()=>{const e=nx(),t=e!==null?e:null,n=zl(Ld),r=t!==null?t:n!==null&&Qd.has(n)?n:Y0(navigator.languages??[navigator.language]),o=zl(Kd);return{locale:r,theme:o==="light"||o==="dark"||o==="system"?o:"system"}},Gd=d.createContext(void 0),ix=({initialLocale:e,initialTheme:t,children:n})=>{const[r,o]=d.useState(e),[s,i]=d.useState(t);d.useEffect(()=>{fi(r,s)},[r,s]),d.useEffect(()=>{if(s!=="system")return;const f=window.matchMedia("(prefers-color-scheme: dark)"),h=()=>{fi(r,"system")};return f.addEventListener("change",h),()=>f.removeEventListener("change",h)},[s,r]);const a=d.useCallback(f=>{rx(f),Ul(Ld,f),o(f)},[]),c=d.useCallback(f=>{Ul(Kd,f),i(f)},[]),u=d.useMemo(()=>({locale:r,messages:tx(r),direction:Hd(r),theme:s,setLocale:a,setTheme:c}),[r,s,a,c]);return l.jsx(Gd.Provider,{value:u,children:n})},ps=()=>{const e=d.useContext(Gd);if(e===void 0)throw new Error("usePreferences must be used inside PreferencesProvider");return e},Yd=d.createContext(void 0),zd=()=>{const[e]=Du(),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}},Ud=()=>{const e=d.useContext(Yd);if(e===void 0)throw new Error("useWorkbenchNavigation must be used inside WorkbenchShell");return e},ax={"zh-CN":"中",ja:"日",ko:"한",en:"EN",ar:"ع",fr:"FR",es:"ES",de:"DE",ru:"RU"},lx=({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(rl,{"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(rl,{"aria-hidden":!0,className:"size-4"})})]})},cx=({children:e,panelOpen:t})=>{const{locale:n,messages:r,setLocale:o,theme:s,setTheme:i}=ps(),{route:a}=zd(),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(du,{"aria-hidden":!0}),label:r.nav.add},{route:"applications",icon:l.jsx(rh,{"aria-hidden":!0}),label:r.nav.applications},{route:"help",icon:l.jsx(Gp,{"aria-hidden":!0}),label:r.nav.help}],p=s==="system"?r.theme.system:s==="light"?r.theme.light:r.theme.dark;return l.jsx(Yd.Provider,{value:g,children:l.jsxs(n0,{open:u,onOpenChange:f,children:[l.jsxs(r0,{collapsible:"icon",children:[l.jsx(s0,{children:l.jsx(Ms,{children:l.jsx(oo,{children:l.jsx(lx,{product:r.shell.product})})})}),l.jsx(a0,{children:l.jsx(l0,{children:l.jsx(c0,{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(i0,{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:ax[n]}),l.jsx("span",{children:r.language.title})]})}),l.jsx(Bo,{side:"top",align:"start",children:jo.map(m=>l.jsx(Mo,{onClick:()=>{o(m)},children:G0(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(wh,{"aria-hidden":!0}):s==="dark"?l.jsx(ch,{"aria-hidden":!0}):l.jsx(ah,{"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(Mo,{onClick:()=>{i(m)},children:x},m))})]})})]})}),l.jsx(o0,{"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})]})})},ux=()=>new URLSearchParams(window.location.search).get("token")??"",ln=async(e,t={})=>{const n=await fetch(e,{method:t.method??"GET",headers:{authorization:`Bearer ${ux()}`,...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}},dx=()=>ln("/api/apps"),Vd=e=>ln(`/api/apps/${encodeURIComponent(e)}/config`),fx=e=>ln(`/api/apps/${encodeURIComponent(e)}/icon`),px=(e,t)=>ln(`/api/apps/${encodeURIComponent(e)}/uninstall`,{method:"POST",body:{...t}}),hx=()=>ln("/api/skill/list"),Ax=e=>ln(`/api/skill?path=${encodeURIComponent(e)}`),gx=(e,t)=>ln(`/api/apps/${encodeURIComponent(e)}/export`,{method:"POST",body:{...t}}),mx=e=>ln(`/api/apps/${encodeURIComponent(e)}/open`,{method:"POST",body:{}}),xx=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 Zd(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":""}:{"data-unchecked":""}},...Di}}const vx=d.createContext(void 0);function yx(){return d.useContext(vx)}const Jd=d.createContext(void 0);function Cx(){const e=d.useContext(Jd);if(e===void 0)throw new Error(ot(14));return e}const Ix="data-parent",wx=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:C=!1,uncheckedValue:b,value:v,nativeButton:y=!1,style:w,...I}=t,{clearErrors:E}=Fi(),{disabled:S,name:R,setDirty:k,setFilled:F,setFocused:T,setTouched:N,state:j,validationMode:D,validityData:O,validation:_}=Qo(),B=lA(),{labelId:H,controlId:P,registerControlId:M,getDescriptionProps:L}=Bi(),G=yx(),V=G?.allValues===void 0?void 0:G.parent,Y=V!==void 0,Q=S||B.disabled||G?.disabled||a,z=R??g,K=v??z,X=wt(),ae=wt();let te=u||P;Y&&(p?te=ae:K!==void 0?te=`${V.id}-${K}`:te||=ae);let $={};Y&&(p?$=V.getParentProps():K!==void 0&&($=V.getChildProps(K)));const{checked:ee=r,indeterminate:ue=f,onCheckedChange:ce,...he}=$,se=G?.value,Ae=d.useRef(null),re=St(()=>Symbol()),oe=d.useRef(!1),{getButtonProps:le,buttonRef:ge}=Yt({disabled:Q,native:y}),me=G?.validation??_,[W,U]=on({controlled:K!==void 0&&se!==void 0&&!p?se.includes(K):ee,default:s,name:"Checkbox",state:"checked"}),be=Y?!!ee:W,q=Y&&ue||f;ie(()=>{M!==Er&&(oe.current=!0,M(re.current,te))},[te,M,re]),d.useEffect(()=>{const Ie=re.current;return()=>{!oe.current||M===Er||(oe.current=!1,M(Ie,void 0))}},[M,re]),Mi(Ae,X,W,void 0,!G&&!Q,g);const ne=d.useRef(null),Ee=me.registerInput,Se=G?K:void 0,Ge=d.useCallback(Ie=>Ee(Ie,{controlRef:Ae,value:Se}),[Ee,Se]),ze=Gt(h,ne,p?void 0:Ge),Le=pu(i,H,ne,!y,te??void 0);ie(()=>{ne.current&&(ne.current.indeterminate=q,W&&F(!0))},[W,q,F]),ss(W,()=>{G||(E(z),F(W),k(W!==O.initialValue),me.change(W))});const ct=Mt({checked:W,disabled:Q,form:c,name:p?void 0:z,id:y?void 0:te??void 0,required:C,ref:ze,style:z?Xi:$o,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Ie){if(Ie.nativeEvent.defaultPrevented)return;if(m){Ie.preventDefault();return}const Ke=Ie.currentTarget.checked,Ne=Ce(Pt,Ie.nativeEvent);if(A?.(Ke,Ne),!Ne.isCanceled&&(ce?.(Ke,Ne),!Ne.isCanceled&&(U(Ke),K!==void 0&&G!==void 0&&!p&&!Y))){const nt=Ke?[...G.value,K]:G.value.filter(Re=>Re!==K);G.setValue(nt,Ne)}},onClick(Ie){Ie.stopPropagation()},onFocus(){Ae.current?.focus()}},v!==void 0?{value:(G?W&&v:v)||""}:lt,L,Ie=>me.getValidationProps(Q,Ie));d.useEffect(()=>{if(!V||K===void 0)return;const Ie=V.disabledStatesRef.current;return Ie.set(K,Q),()=>{Ie.delete(K)}},[V,Q,K]);const tt=d.useMemo(()=>({...j,checked:be,disabled:Q,readOnly:m,required:C,indeterminate:q}),[j,be,Q,m,C,q]),Je=Zd(tt),ft=Me("span",t,{state:tt,ref:[ge,Ae,n],props:[{id:y?te??void 0:X,role:"checkbox","aria-checked":q?"mixed":be,"aria-readonly":m||void 0,"aria-required":C||void 0,"aria-labelledby":Le,[Ix]:p?"":void 0,onFocus(){Q||T(!0)},onBlur(){const Ie=ne.current;Ie&&(N(!0),T(!1),D==="onBlur"&&me.commit(G?se:Ie.checked))},onKeyDown(Ie){if(Ie.key!=="Enter"||(Ie.preventBaseUIHandler(),Ie.defaultPrevented))return;const Ke=ne.current?.form??null,Ne=Ie.currentTarget,nt=Ie.nativeEvent,Re=Ie.preventDefault,Ue=nt.preventDefault;let Ve=!1;Ie.preventDefault=()=>{Ve=!0,Re.call(Ie)},nt.preventDefault=()=>{Ve=!0,Ue.call(nt)},Ue.call(nt),rt(Ne).queueMicrotask(()=>{Ie.preventDefault=Re,nt.preventDefault=Ue,Ve||bx(Ke)?.click()})},onClick(Ie){if(m||Q)return;Ie.preventDefault();const Ke=ne.current;Ke&&Si(Ke,Ie)}},I,he,le,L,Ie=>me.getValidationProps(Q,Ie)],stateAttributesMapping:Je});return l.jsxs(Jd.Provider,{value:tt,children:[ft,!W&&!G&&z&&!p&&b!==void 0&&l.jsx("input",{type:"hidden",form:c,name:z,value:b,disabled:Q}),l.jsx("input",{...ct,suppressHydrationWarning:!0})]})}),kx=d.forwardRef(function(t,n){const{render:r,className:o,style:s,keepMounted:i=!1,...a}=t,c=Cx(),u=c.checked||c.indeterminate,{mounted:f,transitionStatus:h,setMounted:g}=or(u),A=d.useRef(null),p={...c,transitionStatus:h};zt({open:u,ref:A,onComplete(){u||g(!1)}});const x={...Zd(c),...Nn},C=i||f,b=Me("span",t,{ref:[n,A],state:p,stateAttributesMapping:x,props:a});return C?b:null});function pi({className:e,...t}){return l.jsx(wx,{"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(kx,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:l.jsx(Pi,{})})})}function je({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 $d=d.createContext(void 0);function Xd(){const e=d.useContext($d);if(e===void 0)throw new Error(ot(10));return e}const Ex={value:()=>null},Sx=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]),C=d.useRef([]),[b,v]=on({controlled:g,default:x,name:"Accordion",state:"value"}),y=de((S,R,k)=>{if(f)if(R){const F=b.slice();if(F.push(S),u?.(F,k),k.isCanceled)return;v(F)}else{const F=b.filter(T=>T!==S);if(u?.(F,k),k.isCanceled)return;v(F)}else{const F=b[0]===S?[]:[S];if(u?.(F,k),k.isCanceled)return;v(F)}}),w=d.useMemo(()=>({value:b,disabled:s,orientation:h}),[b,s,h]),I=d.useMemo(()=>({disabled:s,handleValueChange:y,hiddenUntilFound:i??!1,keepMounted:a??!1,state:w,value:b}),[s,y,i,a,w,b]),E=Me("div",t,{state:w,ref:n,props:m,stateAttributesMapping:Ex});return l.jsx($d.Provider,{value:I,children:l.jsx(Ur,{elementsRef:C,children:E})})});function Rx(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}=or(s,!0,!0),f=wt(),[h,g]=d.useState(),A=h===null?void 0:h??f,p=de(m=>{const x=!s,C=Ce(Pn,m.nativeEvent);r(x,C),!C.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 qd=d.createContext(void 0);function ef(){const e=d.useContext(qd);if(e===void 0)throw new Error(ot(15));return e}const tf=d.createContext(void 0);function wa(){const e=d.useContext(tf);if(e===void 0)throw new Error(ot(9));return e}let ka=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=ko.startingStyle]="startingStyle",e[e.endingStyle=ko.endingStyle]="endingStyle",e})({}),Dx=(function(e){return e.panelOpen="data-panel-open",e})({});const Fx={[ka.open]:""},Bx={[ka.closed]:""},Mx={open(e){return e?{[Dx.panelOpen]:""}:null}},jx={open(e){return e?Fx:Bx}};let Px=(function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e})({});const Ea={...jx,index:e=>({[Px.index]:String(e)}),...Nn,value:()=>null},Tx=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=Gt(n,f),{disabled:A,handleValueChange:p,state:m,value:x}=Xd(),C=wt(),b=a??C,v=o||A,y=x.indexOf(b)!==-1,w=de((O,_)=>{s?.(O,_),!_.isCanceled&&p(b,O,_)}),I=Rx({open:y,onOpenChange:w,disabled:v}),E=d.useMemo(()=>({open:I.open,disabled:I.disabled,transitionStatus:I.transitionStatus}),[I.open,I.disabled,I.transitionStatus]),S=d.useMemo(()=>({...I,onOpenChange:w,state:E}),[I,E,w]),R=d.useMemo(()=>({...m,hidden:!y&&!I.mounted,index:h,disabled:v,open:y}),[I.mounted,v,h,y,m]),k=wt(),[F,T]=d.useState(),N=F===null?void 0:F??k,j=d.useMemo(()=>({defaultTriggerId:k,open:y,state:R,setTriggerId:T,triggerId:N}),[k,y,R,T,N]),D=Me("div",t,{state:R,ref:g,props:u,stateAttributesMapping:Ea});return l.jsx(qd.Provider,{value:S,children:l.jsx(tf.Provider,{value:j,children:D})})}),Nx=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{state:a}=wa();return Me("h3",t,{state:a,ref:n,props:i,stateAttributesMapping:Ea})}),_x=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}=ef(),p=r||A,{getButtonProps:m,buttonRef:x}=Yt({disabled:p,focusableWhenDisabled:!0,native:a}),{defaultTriggerId:C,state:b,setTriggerId:v}=wa(),y=s||void 0,w=y??C;return ie(()=>(v(S=>y??(S===null?void 0:S)),()=>{v(S=>S===y?null:S)}),[y,v]),Me("button",t,{state:b,ref:[n,x],props:[{"aria-controls":h?f:void 0,"aria-expanded":h,id:w,onClick:g},u,m],stateAttributesMapping:Mx})}),cr={height:void 0,width:void 0};function Ox(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),C=d.useRef(a),b=d.useRef(!1),[v,y]=d.useState(!1),w=d.useRef(null),I=Gt(t,h),E=qe(a),S=Vi(h),R=!a&&!s,k=v?"idle":f,F=a&&(C.current||b.current),T=!a&&s&&g.current==="css-animation"&&A.height===void 0&&A.width===void 0?m.current:A,N=n&&R&&g.current!=="css-animation",j=de((H,P=!0)=>{P&&(m.current=H),p(H)}),D=de(()=>{w.current?.(),w.current=null}),O=de(H=>{D(),w.current=()=>{w.current=null,H()}}),_=de(()=>{a&&s&&g.current==="css-animation"&&(b.current=!0)});ie(()=>{!v||f==="starting"||y(!1)},[v,f]),d.useEffect(()=>()=>{_(),D()},[_,D]),ie(()=>{const H=h.current;if(!H)return;!a&&w.current&&D();const P=Hx(H,F);if(g.current=P,a&&f==="idle"&&C.current&&P==="css-animation"){m.current=On(H);return}if(a&&f==="starting"){const G=x.current;if(x.current=!1,P==="none"){j(On(H)),y(!0);return}if(P==="css-transition"){const Q=Lx(H);if(j(On(H)),!G)return Q;const z=io(H,"transition-duration","0s");return O(z),y(!0),Q}j(On(H));const V=io(H,"animation-name","none");if(!G){V();return}const Y=io(H,"animation-duration","0s");V(),O(Y),y(!0);return}if(!a&&s&&(f==="idle"||f==="starting")){if(C.current=!1,b.current=!1,P==="none"){j(cr,!1),c(!1);return}j(On(H));return}if(f!=="ending")return;if(P==="none"){c(!1);return}const M=On(H);if(!(M.height>0||M.width>0)){c(!1);return}j(M),P==="css-animation"&&io(H,"animation-name","none")()},[s,a,D,j,c,O,F,f]),zt({enabled:a&&s&&k==="idle",open:!0,ref:h,onComplete(){a&&j(cr,!1)}}),d.useEffect(()=>{if(a||!s||k!=="ending"||!h.current)return;const P=new AbortController;let M=-1;function L(){E.current||(c(!1),j(cr,!1))}return M=It.request(()=>{S(L,P.signal)}),()=>{It.cancel(M),P.abort()}},[E,s,a,k,S,j,c]),ie(()=>{const H=h.current;!H||!n||!R||H.setAttribute("hidden","until-found")},[R,n]),d.useEffect(function(){const P=h.current;if(!P)return;function M(L){const G=Ce(Pt,L);i(!0,G),!G.isCanceled&&(x.current=!0,u(!0))}return Fe(P,"beforematch",M)},[i,u]);const B=o||n||s||a;return{height:T.height,props:{...N?{[ka.startingStyle]:""}:void 0,hidden:R,id:r},ref:I,shouldPreventOpenAnimation:F,shouldRender:B,transitionStatus:k,width:T.width}}function On(e){return{height:e.scrollHeight,width:e.scrollWidth}}function Hx(e,t){const n=rt(e).getComputedStyle(e),r=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&Zl(n.animationDuration),o=Zl(n.transitionDuration);return r&&o||o?"css-transition":r?"css-animation":"none"}function Zl(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 Lx(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 Jl=(function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e})({});const Kx=d.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,id:i,render:a,style:c,...u}=t,{hiddenUntilFound:f,keepMounted:h}=Xd(),{defaultPanelId:g,mounted:A,onOpenChange:p,open:m,setMounted:x,setOpen:C,setPanelIdState:b,transitionStatus:v}=ef(),y=o??f,w=s??h,I=i||void 0,E=i??g;ie(()=>(b(P=>I??(P===null?void 0:P)),()=>{b(P=>P===I?null:P)}),[I,b]);const{height:S,props:R,ref:k,shouldPreventOpenAnimation:F,shouldRender:T,transitionStatus:N,width:j}=Ox({externalRef:n,hiddenUntilFound:y,id:E,keepMounted:w,mounted:A,onOpenChange:p,open:m,setMounted:x,setOpen:C,transitionStatus:v}),{state:D,triggerId:O}=wa(),_={...D,transitionStatus:N},B=Ip(c,_),H=Me("div",{...t,style:void 0},{state:_,ref:k,props:[R,{"aria-labelledby":O,role:"region",style:{[Jl.accordionPanelHeight]:S===void 0?"auto":`${S}px`,[Jl.accordionPanelWidth]:j===void 0?"auto":`${j}px`}},u,B?{style:B}:void 0,F?{style:{animationName:"none"}}:void 0],stateAttributesMapping:Ea});return T?H:null});function Sa({className:e,...t}){return l.jsx(Sx,{"data-slot":"accordion",className:fe("flex w-full flex-col",e),...t})}function Ra({className:e,...t}){return l.jsx(Tx,{"data-slot":"accordion-item",className:fe("not-last:border-b",e),...t})}function Da({className:e,children:t,...n}){return l.jsx(Nx,{className:"flex",children:l.jsxs(_x,{"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(Ti,{className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function Fa({className:e,children:t,...n}){return l.jsx(Kx,{"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 nf=d.createContext(void 0);function Wx(){return d.useContext(nf)}const Qx=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=wt(h||void 0),x=Wx(),C=x?.value??[],b=x?void 0:o,v=(s||x?.disabled)??!1,[y,w]=on({controlled:x?m!==void 0&&C.indexOf(m)>-1:c,default:b,name:"Toggle",state:"pressed"}),{getButtonProps:I,buttonRef:E}=Yt({disabled:v,native:g}),S={disabled:v,pressed:y},R=[E,n],k=[{"aria-pressed":y,onClick(N){const j=!y,D=Ce(Pt,N.nativeEvent);a?.(j,D),!D.isCanceled&&(m&&x?.setGroupValue?.(m,j,D),!D.isCanceled&&w(j))}},p,I],F=Me("button",t,{enabled:!x,state:S,ref:R,props:k}),T=d.useMemo(()=>({disabled:v,focusableWhenDisabled:!1}),[v]);return x?l.jsx(Nd,{tag:"button",render:u,className:r,style:A,metadata:T,state:S,refs:R,props:k}):F}),rf="data-composite-item-active",Gx=[];function Yx(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=Gx}=e,[A,p]=d.useState(0),m=r!=null,x=d.useRef(null),C=Gt(x,c),b=d.useRef([]),v=d.useRef(!1),y=i??A,w=de((k,F=!1)=>{if((a??p)(k),F){const T=b.current[k];Pl(x.current,T,s,n)}}),I=de(k=>{if(k.size===0||v.current)return;v.current=!0;const F=Array.from(k.keys()),T=F.find(j=>j?.hasAttribute(rf))??null,N=T?k.get(T)?.index??-1:-1;if(N!==-1)w(N);else if(wo(F,y,h)){const j=tn(F,{disabledIndices:h});Ir(F,j)||w(j)}Pl(x.current,T,s,n)});ie(()=>{if(h==null||i!=null||!v.current)return;const k=b.current;if(wo(k,y,h)){const F=tn(k,{disabledIndices:h});Ir(k,F)||w(F)}},[h,i,y,b,w]);const E=de((k,F,T)=>o?o(k,F,T,b):T),S=de(k=>{const F=k.key===ui||k.key===di;if(!rs.has(k.key)||!u&&F||zx(k,g)||!x.current)return;const N=s==="rtl",j=N?li:ci,D=N?ci:li,O=n==="vertical"?ai:j,_=n==="vertical"?ii:D,B=At(k.nativeEvent);if(B!=null&&jl(B)&&!Od(B)){const V=B.selectionStart,Y=B.selectionEnd,Q=B.value;if(V==null||k.shiftKey||V!==Y||k.key!==_&&V<Q.length||k.key!==O&&V>0)return}let H=y;const P=Ao(b,h),M=ei(b,h);r!=null&&(H=r({disabledIndices:h,elementsRef:b,event:k,highlightedIndex:y,loopFocus:t,maxIndex:M,minIndex:P,onLoop:E,orientation:n,rtl:N}));const L=n!=="vertical"&&k.key===j||n!=="horizontal"&&k.key===ai,G=n!=="vertical"&&k.key===D||n!=="horizontal"&&k.key===ii;u&&(k.key===ui?H=P:k.key===di&&(H=M)),H===y&&(L||G)&&(t&&H===M&&L?(H=P,o&&(H=o(k,y,H,b))):t&&H===P&&G?(H=M,o&&(H=o(k,y,H,b))):H=tn(b.current,{startingIndex:H,decrement:G,disabledIndices:h})),H!==y&&!Ir(b.current,H)&&(f&&k.stopPropagation(),(m||F||L||G)&&k.preventDefault(),w(H,!0),queueMicrotask(()=>{b.current[H]?.focus()}))});return{props:{ref:C,onFocus(k){const F=x.current,T=At(k.nativeEvent);!F||T==null||!jl(T)||T.setSelectionRange(0,T.value.length)},onKeyDown:S},highlightedIndex:y,onHighlightedIndexChange:w,elementsRef:b,onMapChange:I,relayKeyboardEvent:S}}function zx(e,t){for(const n of om)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function of(e){const{render:t,className:n,style:r,refs:o=Nt,props:s=Nt,state:i=lt,stateAttributesMapping:a,highlightedIndex:c,onHighlightedIndexChange:u,orientation:f,grid:h,loopFocus:g,onLoop:A,enableHomeAndEndKeys:p,onMapChange:m,stopEventPropagation:x=!0,rootRef:C,disabledIndices:b,modifierKeys:v,highlightItemOnHover:y=!1,tag:w="div",...I}=e,E=is(),{props:S,highlightedIndex:R,onHighlightedIndexChange:k,elementsRef:F,onMapChange:T,relayKeyboardEvent:N}=Yx({grid:h,loopFocus:g,onLoop:A,orientation:f,highlightedIndex:c,onHighlightedIndexChange:u,rootRef:C,stopEventPropagation:x,enableHomeAndEndKeys:p,direction:E,disabledIndices:b,modifierKeys:v}),j=Me(w,e,{state:i,ref:o,props:[S,...s,I],stateAttributesMapping:a}),D=d.useMemo(()=>({highlightedIndex:R,onHighlightedIndexChange:k,highlightItemOnHover:y,relayKeyboardEvent:N}),[R,k,y,N]);return l.jsx(Bp.Provider,{value:D,children:l.jsx(Ur,{elementsRef:F,onMapChange:O=>{m?.(O),T(O)},children:j})})}const Ux=d.createContext(void 0);function Vx(){return d.useContext(Ux)}const Zx=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=Ia(),m=Vx(),x=u!==void 0||r!==void 0,C=(p?.disabled??!1)||(m?.disabled??!1)||o,[b,v]=on({controlled:u,default:u===void 0?r??Nt:void 0,name:"ToggleGroup",state:"value"}),y=de((R,k,F)=>{let T;c?(T=b.slice(),k?T.push(R):T.splice(b.indexOf(R),1)):T=k?[R]:[],i?.(T,F),!F.isCanceled&&v(T)}),w={disabled:C,multiple:c,orientation:a},I=d.useMemo(()=>({disabled:C,setGroupValue:y,value:b,isValueInitialized:x}),[C,y,b,x]),E={role:"group"},S=Me("div",t,{enabled:!!p,state:w,ref:n,props:[E,A]});return l.jsx(nf.Provider,{value:I,children:p?S:l.jsx(of,{render:h,className:f,style:g,state:w,refs:[n],props:[E,A],loopFocus:s,enableHomeAndEndKeys:!0,orientation:a})})}),Jx=Ci("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"}}),sf=d.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function Ba({className:e,variant:t,size:n,spacing:r=2,orientation:o="horizontal",children:s,...i}){return l.jsx(Zx,{"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(sf.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(sf);return l.jsx(Qx,{"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",Jx({variant:s.variant||n,size:s.size||r}),e),...o,children:t})}function Ma({...e}){return l.jsx(md,{"data-slot":"dialog",...e})}function $x({...e}){return l.jsx(xa,{"data-slot":"dialog-portal",...e})}function Xx({...e}){return l.jsx(Qr,{"data-slot":"dialog-close",...e})}function qx({className:e,...t}){return l.jsx(Ji,{"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 ja({className:e,children:t,showCloseButton:n=!0,...r}){return l.jsxs($x,{children:[l.jsx(qx,{}),l.jsxs(Aa,{"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(_e,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[l.jsx(Ni,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ln({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:fe("flex flex-col gap-2",e),...t})}function eb({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(_e,{variant:"outline"}),children:"Close"})]})}function Kn({className:e,...t}){return l.jsx(ba,{"data-slot":"dialog-title",className:fe("cn-font-heading text-base leading-none font-medium",e),...t})}function Pa({className:e,...t}){return l.jsx($i,{"data-slot":"dialog-description",className:fe("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const af=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"},tb=(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):af.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)}),nb=(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:tb(r,s)},s);const i=r.slice(1,-1);return af.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)}),rb=({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?" ":nb(t,n)},n))}),lf=({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),[C,b]=d.useState(!1),[v,y]=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 R=!1;return b(!0),y(!1),x(null),(async()=>{const k=await w.current({format:a,acknowledgeEnv:u,...h===null?{}:{inlineIcon:h}});if(R)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}`)})(),()=>{R=!0}},[e,a,u,h,n]);const I=!n||u,E=()=>{if(A===null)return;const R=new Blob([A.content],{type:a==="sh"?"text/x-shellscript":"text/plain"}),k=URL.createObjectURL(R),F=document.createElement("a");F.href=k,F.download=A.filename,F.click(),URL.revokeObjectURL(k)},S=async()=>{A!==null&&(await navigator.clipboard.writeText(A.commandLine??A.content),y(!0))};return l.jsx(Ma,{open:e,onOpenChange:R=>{R||s()},children:l.jsxs(ja,{children:[l.jsxs(Ln,{children:[l.jsx(Kn,{children:r?i.export.shareTitle:i.export.title}),l.jsxs(Pa,{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(Ba,{variant:"outline",size:"sm",spacing:0,value:[a],onValueChange:R=>{const k=R[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})]}),C&&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(pi,{id:"export-env-ack",checked:u,onCheckedChange:R=>f(R===!0)}),l.jsxs(je,{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(pi,{id:"export-inline-icon",checked:h===!0,onCheckedChange:R=>g(R===!0)}),l.jsxs(je,{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(Sa,{children:l.jsxs(Ra,{value:"content",children:[l.jsx(Da,{className:"text-xs",children:i.export.viewFull}),l.jsx(Fa,{children:l.jsx(rb,{content:A.content})})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(_e,{size:"sm",variant:"outline",disabled:!I||A===null,onClick:()=>{S()},children:[l.jsx(zp,{width:14,height:14,"aria-hidden":!0}),v?i.common.copied:i.export.copyCommand]}),l.jsxs(_e,{size:"sm",disabled:!I||A===null,onClick:E,children:[l.jsx(Vp,{width:14,height:14,"aria-hidden":!0}),i.export.downloadFile]})]})]})})};function ob(e){return gd("alert-dialog",e)}function $l({...e}){return l.jsx(ob,{"data-slot":"alert-dialog",...e})}function sb({...e}){return l.jsx(xa,{"data-slot":"alert-dialog-portal",...e})}function ib({className:e,...t}){return l.jsx(Ji,{"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 Xl({className:e,size:t="default",...n}){return l.jsxs(sb,{children:[l.jsx(ib,{}),l.jsx(Aa,{"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 ql({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 ec({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 tc({className:e,...t}){return l.jsx(ba,{"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 nc({className:e,...t}){return l.jsx($i,{"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 rc({className:e,...t}){return l.jsx(_e,{"data-slot":"alert-dialog-action",className:fe(e),...t})}function oc({className:e,variant:t="outline",size:n="default",...r}){return l.jsx(Qr,{"data-slot":"alert-dialog-cancel",className:fe(e),render:l.jsx(_e,{variant:t,size:n}),...r})}const sc={healthy:"statusHealthy","invalid-config":"statusInvalidConfig","incompatible-version":"statusIncompatible","missing-payload":"statusMissingPayload","broken-link":"statusBrokenLink",running:"statusRunning"},ic=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}},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})]}),lb=({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})},cb=()=>{const{messages:e}=ps(),{navigate:t,route:n}=Ud(),[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),[C,b]=d.useState(null),[v,y]=d.useState({}),[w,I]=d.useState({}),E=d.useCallback(async()=>{i(O=>O==="ready"?"stale":"loading");const D=await dx();D.status===200?(o(D.data),y({}),i("ready"),await Promise.all(D.data.filter(O=>O.hasIcon===!0).map(async O=>{const _=await fx(O.key),B=_.data;_.status===200&&"dataUrl"in B&&B.dataUrl!==void 0&&I(H=>({...H,[O.key]:B.dataUrl}))}))):i("stale")},[]);d.useEffect(()=>{n==="applications"&&E()},[n,E]),d.useEffect(()=>{const D=()=>{E()};return window.addEventListener("create-opentray:apps-changed",D),()=>window.removeEventListener("create-opentray:apps-changed",D)},[E]);const S=async D=>{if(C===D.key){b(null);return}if(b(D.key),v[D.key]===void 0){const O=await Vd(D.key);y(_=>({..._,[D.key]:O.status===200?ab(O.data):"error"}))}},R=async D=>{const O=await mx(D.key),_=O.data;p(O.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,O)=>{const _=await px(D.key,{...O,purgeTarget:h});if(_.status===200)k(_.data);else{const B=_.data;if(_.status===409&&B.code==="app_running"&&(B.pids!==void 0||B.pid!==void 0)){const H=B.pids??(B.pid!==void 0?[B.pid]:[]);f({app:D,pids:H});return}p(B.message??e.common.error)}await E()},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})},j=D=>m===null?Promise.resolve({status:400,data:{code:"state_error",message:"no target"}}):gx(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(_e,{variant:"ghost",size:"icon-sm","aria-label":e.common.refresh,onClick:()=>{E()},children:l.jsx(gh,{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 O=C===D.key,_=v[D.key],B=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(lb,{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}),B&&l.jsxs(ls,{children:[l.jsx(cs,{render:H=>l.jsx(bo,{variant:"destructive",...H,children:ic(e)[sc[D.status]]})}),l.jsx(us,{children:D.error?.message??ic(e)[sc[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(_e,{variant:"ghost",size:"sm","aria-expanded":O,onClick:()=>{S(D)},children:[O?l.jsx(Ti,{width:14,height:14,"aria-hidden":!0}):l.jsx(Tn,{width:14,height:14,"aria-hidden":!0}),e.applications.details]}),l.jsxs(_e,{variant:"outline",size:"sm",onClick:()=>{window.location.hash=`#/add?edit=${encodeURIComponent(D.key)}`},children:[l.jsx(uu,{width:14,height:14,"aria-hidden":!0}),e.applications.edit]}),l.jsxs(_e,{variant:"outline",size:"sm",onClick:()=>{R(D)},children:[l.jsx(cu,{width:14,height:14,"aria-hidden":!0}),e.applications.open]}),l.jsxs(_e,{variant:"outline",size:"sm",onClick:()=>x(D),children:[l.jsx(vh,{width:14,height:14,"aria-hidden":!0}),e.applications.share]}),l.jsxs(_e,{variant:"destructive",size:"sm",onClick:()=>c(D),children:[l.jsx(Eh,{width:14,height:14,"aria-hidden":!0}),e.applications.uninstall]})]}),O&&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($l,{open:a!==null,onOpenChange:D=>{D||c(null)},children:l.jsxs(Xl,{children:[l.jsxs(ql,{children:[l.jsx(tc,{children:e.applications.uninstallTitle}),l.jsxs(nc,{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(pi,{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(ec,{children:[l.jsx(oc,{children:e.common.cancel}),l.jsx(rc,{onClick:()=>{T()},children:e.applications.uninstall})]})]})}),l.jsx($l,{open:u!==null,onOpenChange:D=>{D||f(null)},children:l.jsxs(Xl,{children:[l.jsxs(ql,{children:[l.jsx(tc,{children:e.applications.stopRunningTitle}),l.jsxs(nc,{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(ec,{children:[l.jsx(oc,{children:e.common.cancel}),l.jsx(rc,{onClick:()=>{N()},children:e.applications.stopRunningConfirm})]})]})}),l.jsx(lf,{open:m!==null,subtitle:m?.appId??m?.key??"",hasEnv:m?.hasEnv===!0,runner:j,onClose:()=>x(null)})]})},Ta=d.createContext({indent:20,currentItem:void 0,tree:void 0,toggleIconType:"plus-minus"});function cf(){return d.useContext(Ta)}function ub({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(Ta.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 db({item:e,className:t,render:n,children:r,...o}){const s=cf(),{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(Ta.Provider,{value:{...s,currentItem:e},children:lu({defaultTagName:"button",render:n,props:Mt(g,f)})})}function fb({item:e,children:t,className:n,...r}){const{currentItem:o,toggleIconType:s}=cf(),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(sh,{"aria-hidden":!0,className:"text-muted-foreground size-3.5",stroke:"currentColor",strokeWidth:"1"}):l.jsx(du,{"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 ac={};function pb(e){let t=ac[e];if(t)return t;t=ac[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 tr(e,t){typeof t!="string"&&(t=tr.defaultChars);const n=pb(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})}tr.defaultChars=";/?:@&=+$,#";tr.componentChars="";const lc={};function hb(e){let t=lc[e];if(t)return t;t=lc[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=hb(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 hi(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 Ab=/^([a-z0-9.+-]+:)/i,gb=/:[0-9]*$/,mb=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,xb=["<",">",'"',"`"," ","\r",`
4
+ `," "],bb=["{","}","|","\\","^","`"].concat(xb),vb=["'"].concat(bb),cc=["%","/","?",";","#"].concat(vb),uc=["/","?","#"],yb=255,dc=/^[+a-z0-9A-Z_-]{0,63}$/,Cb=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,fc={javascript:!0,"javascript:":!0},pc={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Ai(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=mb.exec(s);if(u)return this.pathname=u[1],u[2]&&(this.search=u[2]),this}let i=Ab.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&&fc[i])&&(s=s.substr(2),this.slashes=!0)),!fc[i]&&(o||i&&!pc[i])){let u=-1;for(let p=0;p<uc.length;p++)r=s.indexOf(uc[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<cc.length;p++)r=s.indexOf(cc[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 C=p[m];if(C&&!C.match(dc)){let b="";for(let v=0,y=C.length;v<y;v++)C.charCodeAt(v)>127?b+="x":b+=C[v];if(!b.match(dc)){const v=p.slice(0,m),y=p.slice(m+1),w=C.match(Cb);w&&(v.push(w[1]),y.unshift(w[2])),y.length&&(s=y.join(".")+s),this.hostname=v.join(".");break}}}}this.hostname.length>yb&&(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),pc[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Po.prototype.parseHost=function(e){let t=gb.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 Ib=Object.freeze(Object.defineProperty({__proto__:null,decode:tr,encode:Vr,format:hi,parse:Ai},Symbol.toStringTag,{value:"Module"})),uf=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,df=/[\0-\x1F\x7F-\x9F]/,wb=/[\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]/,Na=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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]/,ff=/[\$\+<->\^`\|~\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-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\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]/,pf=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,kb=Object.freeze(Object.defineProperty({__proto__:null,Any:uf,Cc:df,Cf:wb,P:Na,S:ff,Z:pf},Symbol.toStringTag,{value:"Module"})),Eb=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 Sb(e){return e>=55296&&e<=57343||e>1114111?65533:Eb.get(e)??e}function Rb(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 Db=Rb("QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCS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gQCJhAHQA6ABqD2MAcgAA4DXYzNzjCuQRUC4AAFQuAABYLmIuAAAAAGMubS5wLnQuAAAAAIguki4AAJouJxIqEnQAcgDpAB0ScgAA4DXYNd0AAUFhWy5eLnIA8gDnAnIA8gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/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 Xe;(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"})(Xe||(Xe={}));const hc=32;function gi(e){return e>=Xe.ZERO&&e<=Xe.NINE}function Fb(e){return e>=Xe.UPPER_A&&e<=Xe.UPPER_F||e>=Xe.LOWER_A&&e<=Xe.LOWER_F}function Bb(e){return e>=Xe.UPPER_A&&e<=Xe.UPPER_Z||e>=Xe.LOWER_A&&e<=Xe.LOWER_Z||gi(e)}function Mb(e){return e===Xe.EQUALS||Bb(e)}var ut;(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"})(ut||(ut={}));var An;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(An||(An={}));class jb{decodeTree;emitCodePoint;errors;constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r}state=ut.EntityStart;consumed=1;result=0;treeIndex=0;excess=1;decodeMode=An.Strict;runConsumed=0;startEntity(t){this.decodeMode=t,this.state=ut.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(t,n){switch(this.state){case ut.EntityStart:return t.charCodeAt(n)===Xe.NUM?(this.state=ut.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=ut.NamedEntity,this.stateNamedEntity(t,n));case ut.NumericStart:return this.stateNumericStart(t,n);case ut.NumericDecimal:return this.stateNumericDecimal(t,n);case ut.NumericHex:return this.stateNumericHex(t,n);case ut.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|hc)===Xe.LOWER_X?(this.state=ut.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=ut.NumericDecimal,this.stateNumericDecimal(t,n))}stateNumericHex(t,n){for(;n<t.length;){const r=t.charCodeAt(n);if(gi(r)||Fb(r)){const o=r<=Xe.NINE?r-Xe.ZERO:(r|hc)-Xe.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(gi(r))this.result=this.result*10+(r-Xe.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===Xe.SEMI)this.consumed+=1;else if(this.decodeMode===An.Strict)return 0;return this.emitCodePoint(Sb(this.result),this.consumed),this.errors&&(t!==Xe.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===Xe.SEMI&&s!==0&&(o&bt.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);if(this.treeIndex=Tb(r,o,this.treeIndex+Math.max(1,s),i),this.treeIndex<0)return this.result===0||this.decodeMode===An.Attribute&&(s===0||Mb(i))?0:this.emitNotTerminatedNamedEntity();if(o=r[this.treeIndex],s=(o&bt.VALUE_LENGTH)>>14,s!==0){if(i===Xe.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 ut.NamedEntity:return this.result!==0&&(this.decodeMode!==An.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ut.NumericDecimal:return this.emitNumericEntity(0,2);case ut.NumericHex:return this.emitNumericEntity(0,3);case ut.NumericStart:return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case ut.EntityStart:return 0}}}function Pb(e){let t="";const n=new jb(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 Tb(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 Nb=Pb(Db);function hf(e){return Nb(e,An.Strict)}var _b=class{src_Any=uf.source;src_Cc=df.source;src_Z=pf.source;src_P=Na.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")}},js={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)},Ob={"http:":js,"https:":js,"ftp:":js,"//":{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)}},Hb="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",Lb="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф";function Kb(){const e=Lb.split("|");return Hb.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 Wb={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:Kb(),urlAuth:!1,maxLength:1e4},Ac=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}},Qb=class{__opts__;__schemas__;re;constructor(e={}){const{rebuilder:t,...n}=e;this.__opts__={...Wb,...n},this.__schemas__={...Ob},this.re=t||new _b,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 v=s.exec(e.slice(Math.max(0,b.index-65),b.index));if(v){if(a={schema:"mailto:",index:b.index-v[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 y=n.exec(e);if(!y){u=!0;break}c={schema:y[2],index:y.index+y[1].length,lastIndex:y.index+y[0].length}}if(c.index<g){c=void 0;continue}if(p&&c.index>p.index)break;const b=c;c=void 0;const v=this.testSchemaAt(e,b.schema,b.lastIndex);if(v){m={schema:b.schema,index:b.index,lastIndex:b.lastIndex+v};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 C=new Ac(e,x.schema,x.index,x.lastIndex);C.schema?this.__schemas__[C.schema].normalize(C,this):this.normalize(C),t.push(C),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 Ac(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 Un=2147483647,Kt=36,_a=1,Mr=26,Gb=38,Yb=700,Af=72,gf=128,mf="-",zb=/^xn--/,Ub=/[^\0-\x7F]/,Vb=/[\x2E\u3002\uFF0E\uFF61]/g,Zb={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Ps=Kt-_a,Wt=Math.floor,Ts=String.fromCharCode;function fn(e){throw new RangeError(Zb[e])}function Jb(e,t){const n=[];let r=e.length;for(;r--;)n[r]=t(e[r]);return n}function xf(e,t){const n=e.split("@");let r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(Vb,".");const o=e.split("."),s=Jb(o,t).join(".");return r+s}function bf(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 $b=e=>String.fromCodePoint(...e),Xb=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:Kt},gc=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},vf=function(e,t,n){let r=0;for(e=n?Wt(e/Yb):e>>1,e+=Wt(e/t);e>Ps*Mr>>1;r+=Kt)e=Wt(e/Ps);return Wt(r+(Ps+1)*e/(e+Gb))},yf=function(e){const t=[],n=e.length;let r=0,o=gf,s=Af,i=e.lastIndexOf(mf);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=Kt;;h+=Kt){a>=n&&fn("invalid-input");const g=Xb(e.charCodeAt(a++));g>=Kt&&fn("invalid-input"),g>Wt((Un-r)/f)&&fn("overflow"),r+=g*f;const A=h<=s?_a:h>=s+Mr?Mr:h-s;if(g<A)break;const p=Kt-A;f>Wt(Un/p)&&fn("overflow"),f*=p}const u=t.length+1;s=vf(r-c,u,c==0),Wt(r/u)>Un-o&&fn("overflow"),o+=Wt(r/u),r%=u,t.splice(r++,0,o)}return String.fromCodePoint(...t)},Cf=function(e){const t=[];e=bf(e);const n=e.length;let r=gf,o=0,s=Af;for(const c of e)c<128&&t.push(Ts(c));const i=t.length;let a=i;for(i&&t.push(mf);a<n;){let c=Un;for(const f of e)f>=r&&f<c&&(c=f);const u=a+1;c-r>Wt((Un-o)/u)&&fn("overflow"),o+=(c-r)*u,r=c;for(const f of e)if(f<r&&++o>Un&&fn("overflow"),f===r){let h=o;for(let g=Kt;;g+=Kt){const A=g<=s?_a:g>=s+Mr?Mr:g-s;if(h<A)break;const p=h-A,m=Kt-A;t.push(Ts(gc(A+p%m,0))),h=Wt(p/m)}t.push(Ts(gc(h,0))),s=vf(o,u,a===i),o=0,++a}++o,++r}return t.join("")},qb=function(e){return xf(e,function(t){return zb.test(t)?yf(t.slice(4).toLowerCase()):t})},ev=function(e){return xf(e,function(t){return Ub.test(t)?"xn--"+Cf(t):t})},mc={version:"2.3.1",ucs2:{decode:bf,encode:$b},decode:yf,encode:Cf,toASCII:ev,toUnicode:qb};var xc=Object.defineProperty,If=(e,t)=>{let n={};for(var r in e)xc(n,r,{get:e[r],enumerable:!0});return xc(n,Symbol.toStringTag,{value:"Module"}),n},tv=If({arrayReplaceAt:()=>kf,asciiTrim:()=>As,callable:()=>wf,escapeHtml:()=>vn,escapeRE:()=>dv,fromCodePoint:()=>jr,isMdAsciiPunct:()=>Nr,isPunctChar:()=>Sf,isPunctCharCode:()=>Tr,isSpace:()=>Ye,isValidEntityCode:()=>Oa,isWhiteSpace:()=>Pr,lib:()=>fv,normalizeReference:()=>hs,unescapeAll:()=>nr,unescapeMd:()=>sv});function wf(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 kf(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function Oa(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 jr(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 Ef=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,nv=new RegExp(`${Ef.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`,"gi"),rv=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function ov(e,t){if(t.charCodeAt(0)===35&&rv.test(t)){const r=t[1].toLowerCase()==="x"?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Oa(r)?jr(r):e}const n=hf(e);return n!==e?n:e}function sv(e){return e.indexOf("\\")<0?e:e.replace(Ef,"$1")}function nr(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(nv,function(t,n,r){return n||ov(t,r)})}var iv=/[&<>"]/,av=/[&<>"]/g,lv={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function cv(e){return lv[e]}function vn(e){return iv.test(e)?e.replace(av,cv):e}var uv=/[.?*+^$[\]\\(){}|-]/g;function dv(e){return e.replace(uv,"\\$&")}function Ye(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 Sf(e){return Na.test(e)||ff.test(e)}function Tr(e){return Sf(jr(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 bc(e){return e===32||e===9||e===10||e===13}function As(e){let t=0;for(;t<e.length&&bc(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&bc(e.charCodeAt(n));n--);return e.slice(t,n+1)}var fv={mdurl:Ib,ucmicro:kb};function pv(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 hv(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=nr(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=nr(e.slice(t,o)),s.pos=o,s.ok=!0),s}function Av(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+=nr(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+=nr(e.slice(t,s)),i}var gv=If({parseLinkDestination:()=>hv,parseLinkLabel:()=>pv,parseLinkTitle:()=>Av});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 mv(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 xv(e){var t=mv(e,"string");return _r(t)=="symbol"?t:t+""}function xe(e,t,n){return(t=xv(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]||[]}},Ut={};Ut.code_inline=function(e,t,n,r,o){const s=e[t];return`<code${o.renderAttrs(s)}>${vn(s.content)}</code>`};Ut.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
+ `};Ut.fence=function(e,t,n,r,o){const s=e[t],i=s.info?nr(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>
7
+ `}return`<pre><code${o.renderAttrs(s)}>${u}</code></pre>
8
8
  `};Ut.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)};Ut.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
9
9
  `:`<br>
10
10
  `};Ut.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
11
11
  `:`<br>
12
12
  `:`
13
- `};Ut.text=function(e,t){return mn(e[t].content)};Ut.html_block=function(e,t){return e[t].content};Ut.html_inline=function(e,t){return e[t].content};var ef=class{constructor(){xe(this,"rules",Object.assign({},Ut))}renderAttrs(e){let t,n,r;if(!e.attrs)return"";for(r="",t=0,n=e.attrs.length;t<n;t++)r+=` ${mn(e.attrs[t][0])}="${mn(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 l=e[a];(l.type==="inline"||l.hidden||l.nesting===-1&&l.tag===r.tag)&&(i=!1)}}return o+=i?`>
13
+ `};Ut.text=function(e,t){return vn(e[t].content)};Ut.html_block=function(e,t){return e[t].content};Ut.html_inline=function(e,t){return e[t].content};var Rf=class{constructor(){xe(this,"rules",Object.assign({},Ut))}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?`>
15
15
  `:">",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",En),this.src=e,this.env=n,this.md=t}},W0=/\r\n?|\n/g,L0=/\0/g;function Q0(e){let t;t=e.src.replace(W0,`
17
- `),t=t.replace(L0,"�"),e.src=t}function G0(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 Y0(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 U0(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 z0(e){return/^<a[>\s]/i.test(e)}function V0(e){return/^<\/a\s*>/i.test(e)}function Z0(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"&&(z0(a.content)&&s>0&&s--,V0(a.content)&&s++),!(s>0)&&a.type==="text"&&e.md.linkify.test(a.content)){const l=a.content;let c=e.md.linkify.match(l);const f=[];let A=a.level,g=0;c.length>0&&c[0].index===0&&i>0&&o[i-1].type==="text_special"&&(c=c.slice(1));for(let h=0;h<c.length;h++){const p=c[h].url,m=e.md.normalizeLink(p);if(!e.md.validateLink(m))continue;let x=c[h].text;c[h].schema?c[h].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 I=c[h].index;if(I>g){const w=new e.Token("text","",0);w.content=l.slice(g,I),w.level=A,f.push(w)}const b=new e.Token("link_open","a",1);b.attrs=[["href",m]],b.level=A++,b.markup="linkify",b.info="auto",f.push(b);const v=new e.Token("text","",0);v.content=x,v.level=A,f.push(v);const y=new e.Token("link_close","a",-1);y.level=--A,y.markup="linkify",y.info="auto",f.push(y),g=c[h].lastIndex}if(g<l.length){const h=new e.Token("text","",0);h.content=l.slice(g),h.level=A,f.push(h)}t[n].children=o=$d(o,i,f)}}}}var nf=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,J0=/\((c|tm|r)\)/i,$0=/\((c|tm|r)\)/gi,X0={c:"©",r:"®",tm:"™"};function q0(e,t){return X0[t.toLowerCase()]}function ev(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($0,q0)),r.type==="link_open"&&r.info==="auto"&&t--,r.type==="link_close"&&r.info==="auto"&&t++}}function tv(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 nv(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(J0.test(e.tokens[t].content)&&ev(e.tokens[t].children),nf.test(e.tokens[t].content)&&tv(e.tokens[t].children))}var rv=/['"]/,Zl=/['"]/g,Jl="’";function Ur(e,t,n,r){e[t]||(e[t]=[]),e[t].push({pos:n,ch:r})}function ov(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 sv(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 c=0;const f=l.length;e:for(;c<f;){Zl.lastIndex=c;const A=Zl.exec(l);if(!A)break;let g=!0,h=!0;c=A.index+1;const p=A[0]==="'";let m=32;if(A.index-1>=0)m=l.charCodeAt(A.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(c<f)x=l.charCodeAt(c);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 I=yr(m)||vr(m),b=yr(x)||vr(x),v=br(m),y=br(x);if(y?g=!1:b&&(v||I||(g=!1)),v?h=!1:I&&(y||b||(h=!1)),x===34&&A[0]==='"'&&m>=48&&m<=57&&(h=g=!1),g&&h&&(g=I,h=b),!g&&!h){p&&Ur(o,s,A.index,Jl);continue}if(h)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 C,E;p?(C=t.md.options.quotes[2],E=t.md.options.quotes[3]):(C=t.md.options.quotes[0],E=t.md.options.quotes[1]),Ur(o,s,A.index,E),Ur(o,w.token,w.pos,C),r.length=n;continue e}}g?r.push({token:s,pos:A.index,single:p,level:a}):h&&p&&Ur(o,s,A.index,Jl)}}Object.keys(o).forEach(function(s){const i=Number(s);e[i].content=ov(e[i].content,o[s])})}function iv(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!=="inline"||!rv.test(e.tokens[t].content)||sv(e.tokens[t].children,e)}function av(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 lv(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&&av(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 As=[["normalize",Q0],["block",G0],["strip_references",Y0],["inline",U0],["linkify",Z0],["replacements",nv],["smartquotes",iv],["text_join",lv]],rf=class{constructor(){xe(this,"ruler",new Ir),xe(this,"State",tf);for(let e=0;e<As.length;e++)this.ruler.push(As[e][0],As[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",En),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,c=o.length,f=!1;i<c;i++){const A=o.charCodeAt(i);if(!f)if(Ge(A)){a++,A===9?l+=4-l%4:l++;continue}else f=!0;(A===10||i===c-1)&&(A!==10&&i++,this.bMarks.push(s),this.eMarks.push(i),this.tShift.push(a),this.sCount.push(l),this.bsCount.push(0),f=!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 En(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&&Ge(this.src.charCodeAt(e));e++);return e}skipSpacesBack(e,t){if(e<=t)return e;for(;e>t;)if(!Ge(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 c=l,f;for(i+1<t||r?f=this.eMarks[i]+1:f=this.eMarks[i];c<f&&a<n;){const A=this.src.charCodeAt(c);if(Ge(A))A===9?a+=4-(a+this.bsCount[i])%4:a++;else if(c-l<this.tShift[i])a++;else break;c++}a>n?o[s]=new Array(a-n+1).join(" ")+this.src.slice(c,f):o[s]=this.src.slice(c,f)}return o.join("")}},cv=65536;function hs(e,t){const n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function $l(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 uv(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&&!Ge(a)||i===45&&Ge(a))return!1;for(;s<e.eMarks[o];){const y=e.src.charCodeAt(s);if(y!==124&&y!==45&&y!==58&&!Ge(y))return!1;s++}let l=hs(e,t+1),c=l.split("|");const f=[];for(let y=0;y<c.length;y++){const w=c[y].trim();if(!w){if(y===0||y===c.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(l=hs(e,t).trim(),l.indexOf("|")===-1||e.sCount[t]-e.blkIndent>=4)return!1;c=$l(l),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop();const A=c.length;if(A===0||A!==f.length)return!1;if(r)return!0;const g=e.parentType;e.parentType="table";const h=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 I=e.push("tr_open","tr",1);I.map=[t,t+1];for(let y=0;y<c.length;y++){const w=e.push("th_open","th",1);f[y]&&(w.attrs=[["style",`text-align:${f[y]}`]]);const C=e.push("inline","",0);C.content=c[y].trim(),C.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let b,v=0;for(o=t+2;o<n&&!(e.sCount[o]<e.blkIndent);o++){let y=!1;for(let C=0,E=h.length;C<E;C++)if(h[C](e,o,n,!0)){y=!0;break}if(y||(l=hs(e,o).trim(),!l)||e.sCount[o]-e.blkIndent>=4||(c=$l(l),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop(),v+=A-c.length,v>cv))break;if(o===t+2){const C=e.push("tbody_open","tbody",1);C.map=b=[t+2,0]}const w=e.push("tr_open","tr",1);w.map=[o,o+1];for(let C=0;C<A;C++){const E=e.push("td_open","td",1);f[C]&&(E.attrs=[["style",`text-align:${f[C]}`]]);const R=e.push("inline","",0);R.content=c[C]?c[C].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 dv(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 fv(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 c=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 A=t,g=!1;for(;A++,!(A>=n||(o=a=e.bMarks[A]+e.tShift[A],s=e.eMarks[A],o<s&&e.sCount[A]<e.blkIndent));)if(e.src.charCodeAt(o)===i&&!(e.sCount[A]-e.blkIndent>=4)&&(o=e.skipChars(o,i),!(o-a<l)&&(o=e.skipSpaces(o),!(o<s)))){g=!0;break}l=e.sCount[t],e.line=A+(g?1:0);const h=e.push("fence","code",0);return h.info=f,h.content=e.getLines(t+1,A,l,!0),h.markup=c,h.map=[t,e.line],!0}function pv(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=[],c=[],f=[],A=e.md.block.ruler.getRules("blockquote"),g=e.parentType;e.parentType="blockquote";let h=!1,p;for(p=t;p<n;p++){const v=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&&!v){let w=e.sCount[p]+1,C,E;e.src.charCodeAt(o)===32?(o++,w++,E=!1,C=!0):e.src.charCodeAt(o)===9?(C=!0,(e.bsCount[p]+w)%4===3?(o++,w++,E=!1):E=!0):C=!1;let R=w;for(a.push(e.bMarks[p]),e.bMarks[p]=o;o<s;){const S=e.src.charCodeAt(o);if(Ge(S))S===9?R+=4-(R+e.bsCount[p]+(E?1:0))%4:R++;else break;o++}h=o>=s,l.push(e.bsCount[p]),e.bsCount[p]=e.sCount[p]+1+(C?1:0),c.push(e.sCount[p]),e.sCount[p]=R-w,f.push(e.tShift[p]),e.tShift[p]=o-e.bMarks[p];continue}if(h)break;let y=!1;for(let w=0,C=A.length;w<C;w++)if(A[w](e,p,n,!0)){y=!0;break}if(y){e.lineMax=p,e.blkIndent!==0&&(a.push(e.bMarks[p]),l.push(e.bsCount[p]),f.push(e.tShift[p]),c.push(e.sCount[p]),e.sCount[p]-=e.blkIndent);break}a.push(e.bMarks[p]),l.push(e.bsCount[p]),f.push(e.tShift[p]),c.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 I=[t,0];x.map=I,e.md.block.tokenize(e,t,p);const b=e.push("blockquote_close","blockquote",-1);b.markup=">",e.lineMax=i,e.parentType=g,I[1]=e.line;for(let v=0;v<f.length;v++)e.bMarks[v+t]=a[v],e.tShift[v+t]=f[v],e.sCount[v+t]=c[v],e.bsCount[v+t]=l[v];return e.blkIndent=m,!0}function Av(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 c=e.src.charCodeAt(s++);if(c!==i&&!Ge(c))return!1;c===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 Xl(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&&!Ge(e.src.charCodeAt(r))?-1:r}function ql(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),!Ge(s))?-1:o}function hv(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 gv(e,t,n,r){let o,s,i,a,l=t,c=!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 f=!1;r&&e.parentType==="paragraph"&&e.sCount[l]>=e.blkIndent&&(f=!0);let A,g,h;if((h=ql(e,l))>=0){if(A=!0,i=e.bMarks[l]+e.tShift[l],g=Number(e.src.slice(i,h-1)),f&&g!==1)return!1}else if((h=Xl(e,l))>=0)A=!1;else return!1;if(f&&e.skipSpaces(h)>=e.eMarks[l])return!1;if(r)return!0;const p=e.src.charCodeAt(h-1),m=e.tokens.length;A?(a=e.push("ordered_list_open","ol",1),g!==1&&(a.attrs=[["start",g]])):a=e.push("bullet_list_open","ul",1);const x=[l,0];a.map=x,a.markup=String.fromCharCode(p);let I=!1;const b=e.md.block.ruler.getRules("list"),v=e.parentType;for(e.parentType="list";l<n;){s=h,o=e.eMarks[l];const y=e.sCount[l]+h-(e.bMarks[l]+e.tShift[l]);let w=y;for(;s<o;){const D=e.src.charCodeAt(s);if(D===9)w+=4-(w+e.bsCount[l])%4;else if(D===32)w++;else break;s++}const C=s;let E;C>=o?E=1:E=w-y,E>4&&(E=1);const R=y+E;a=e.push("list_item_open","li",1),a.markup=String.fromCharCode(p);const S=[l,0];a.map=S,A&&(a.info=e.src.slice(i,h-1));const k=e.tight,F=e.tShift[l],B=e.sCount[l],_=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=R,e.tight=!0,e.tShift[l]=C-e.bMarks[l],e.sCount[l]=w,C>=o&&e.isEmpty(l+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,l,n),(!e.tight||I)&&(c=!1),I=e.line-l>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=_,e.tShift[l]=F,e.sCount[l]=B,e.tight=k,a=e.push("list_item_close","li",-1),a.markup=String.fromCharCode(p),l=e.line,S[1]=l,l>=n||e.sCount[l]<e.blkIndent||e.sCount[l]-e.blkIndent>=4)break;let M=!1;for(let D=0,j=b.length;D<j;D++)if(b[D](e,l,n,!0)){M=!0;break}if(M)break;if(A){if(h=ql(e,l),h<0)break;i=e.bMarks[l]+e.tShift[l]}else if(h=Xl(e,l),h<0)break;if(p!==e.src.charCodeAt(h-1))break}return A?a=e.push("ordered_list_close","ol",-1):a=e.push("bullet_list_close","ul",-1),a.markup=String.fromCharCode(p),x[1]=l,e.line=l,e.parentType=v,c&&hv(e,m),!0}function mv(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(y){const w=e.lineMax;if(y>=w||e.isEmpty(y))return null;let C=!1;if(e.sCount[y]-e.blkIndent>3&&(C=!0),e.sCount[y]<0&&(C=!0),!C){const S=e.md.block.ruler.getRules("reference"),k=e.parentType;e.parentType="reference";let F=!1;for(let B=0,_=S.length;B<_;B++)if(S[B](e,y,w,!0)){F=!0;break}if(e.parentType=k,F)return null}const E=e.bMarks[y]+e.tShift[y],R=e.eMarks[y];return e.src.slice(E,R+1)}let l=e.src.slice(o,s+1);s=l.length;let c=-1;for(o=1;o<s;o++){const y=l.charCodeAt(o);if(y===91)return!1;if(y===93){c=o;break}else if(y===10){const w=a(i);w!==null&&(l+=w,s=l.length,i++)}else if(y===92&&(o++,o<s&&l.charCodeAt(o)===10)){const w=a(i);w!==null&&(l+=w,s=l.length,i++)}}if(c<0||l.charCodeAt(c+1)!==58)return!1;for(o=c+2;o<s;o++){const y=l.charCodeAt(o);if(y===10){const w=a(i);w!==null&&(l+=w,s=l.length,i++)}else if(!Ge(y))break}const f=e.md.helpers.parseLinkDestination(l,o,s);if(!f.ok)return!1;const A=e.md.normalizeLink(f.str);if(!e.md.validateLink(A))return!1;o=f.pos;const g=o,h=i,p=o;for(;o<s;o++){const y=l.charCodeAt(o);if(y===10){const w=a(i);w!==null&&(l+=w,s=l.length,i++)}else if(!Ge(y))break}let m=e.md.helpers.parseLinkTitle(l,o,s);for(;m.can_continue;){const y=a(i);if(y===null)break;l+=y,o=s,s=l.length,i++,m=e.md.helpers.parseLinkTitle(l,o,s,m)}let x;for(o<s&&p!==o&&m.ok?(x=m.str,o=m.pos):(x="",o=g,i=h);o<s&&Ge(l.charCodeAt(o));)o++;if(o<s&&l.charCodeAt(o)!==10&&x)for(x="",o=g,i=h;o<s&&Ge(l.charCodeAt(o));)o++;if(o<s&&l.charCodeAt(o)!==10)return!1;const I=Uo(l.slice(1,c));if(!I)return!1;if(r)return!0;typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[I]>"u"&&(e.env.references[I]={title:x,href:A});const b=e.push("reference_definition","",0);b.map=[t,i],b.hidden=!0;const v=Object.create(null);return v.label=I,b.meta=v,e.line=i,!0}var xv=["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"],sf=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,af="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",bv=new RegExp(`^(?:${sf}|${af}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),vv=new RegExp(`^(?:${sf}|${af})`),In=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Za-z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp(`^</?(${xv.join("|")})(?=(\\s|/?>|$))`,"i"),/^$/,!0],[new RegExp(`${vv.source}\\s*$`),/^$/,!1]];function yv(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<In.length&&!In[a][0].test(i);a++);if(a===In.length)return!1;if(r)return In[a][2];let l=t+1;const c=In[a][1].test("");if(!In[a][1].test(i)){for(;l<n&&!(e.sCount[l]<e.blkIndent&&(c||!e.isEmpty(l)));l++)if(o=e.bMarks[l]+e.tShift[l],s=e.eMarks[l],i=e.src.slice(o,s),In[a][1].test(i)){i.length!==0&&l++;break}}e.line=l;const f=e.push("html_block","",0);return f.map=[t,l],f.content=e.getLines(t,l,e.blkIndent,!0),!0}function Cv(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&&!Ge(i))return!1;if(r)return!0;s=e.skipSpacesBack(s,o);const l=e.skipCharsBack(s,35,o);l>o&&Ge(e.src.charCodeAt(l-1))&&(s=l),e.line=t+1;const c=e.push("heading_open",`h${a}`,1);c.markup="########".slice(0,a),c.map=[t,e.line];const f=e.push("inline","",0);f.content=zo(e.src.slice(o,s)),f.map=[t,e.line],f.children=[];const A=e.push("heading_close",`h${a}`,-1);return A.markup="########".slice(0,a),!0}function Iv(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 h=e.bMarks[a]+e.tShift[a];const p=e.eMarks[a];if(h<p&&(i=e.src.charCodeAt(h),(i===45||i===61)&&(h=e.skipChars(h,i),h=e.skipSpaces(h),h>=p))){s=i===61?1:2;break}}if(e.sCount[a]<0)continue;let g=!1;for(let h=0,p=r.length;h<p;h++)if(r[h](e,a,n,!0)){g=!0;break}if(g)break}if(!s)return e.parentType=o,!1;const l=zo(e.getLines(t,a,e.blkIndent,!1));e.line=a+1;const c=e.push("heading_open",`h${s}`,1);c.markup=String.fromCharCode(i),c.map=[t,e.line];const f=e.push("inline","",0);f.content=l,f.map=[t,e.line-1],f.children=[];const A=e.push("heading_close",`h${s}`,-1);return A.markup=String.fromCharCode(i),e.parentType=o,!0}function wv(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 c=!1;for(let f=0,A=r.length;f<A;f++)if(r[f](e,s,n,!0)){c=!0;break}if(c)break}const i=zo(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 zr=[["table",uv,["paragraph","reference"]],["code",dv],["fence",fv,["paragraph","reference","blockquote","list"]],["blockquote",pv,["paragraph","reference","blockquote","list"]],["hr",Av,["paragraph","reference","blockquote","list"]],["list",gv,["paragraph","reference","blockquote"]],["reference",mv],["html_block",yv,["paragraph","reference","blockquote"]],["heading",Cv,["paragraph","reference","blockquote"]],["lheading",Iv],["paragraph",wv]],lf=class{constructor(){xe(this,"ruler",new Ir),xe(this,"State",of);for(let e=0;e<zr.length;e++)this.ruler.push(zr[e][0],zr[e][1],{alt:(zr[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 c=!1;for(let f=0;f<o;f++)if(c=r[f](e,i,n,!1),c){if(l>=e.line)throw new Error("block rule didn't increment state.line");break}if(!c)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)}},cf=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",En),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 En("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 En(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 l=yr(o)||vr(o),c=yr(a)||vr(a),f=br(o),A=br(a),g=!A&&(!c||f||l),h=!f&&(!l||A||c);return{can_open:g&&(t||!h||l),can_close:h&&(t||!g||c),length:i}}};function kv(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 Ev(e,t){let n=e.pos;for(;n<e.posMax&&!kv(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var Sv=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function Rv(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(Sv);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 c=e.md.normalizeLink(a);if(!e.md.validateLink(c))return!1;if(!t){e.pending=e.pending.slice(0,-s.length);const f=e.push("link_open","a",1);f.attrs=[["href",c]],f.markup="linkify",f.info="auto";const A=e.push("text","",0);A.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 Dv(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&&Ge(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var fa=[];for(let e=0;e<256;e++)fa.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){fa[e.charCodeAt(0)]=1});function Fv(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),!!Ge(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&&fa[o]!==0?a.content=s:a.content=i,a.markup=i,a.info="escape"}return e.pos=n+1,!0}function Bv(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 c=a-l;if(c===i){if(!t){const f=e.push("code_inline","code",0);f.markup=s,f.content=e.src.slice(n,l).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return e.pos=a,!0}e.backticks[c]=l}return e.backticksScanned=!0,t||(e.pending+=s),e.pos+=i,!0}function Mv(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 ec(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 Pv(e){const t=e.tokens_meta,n=e.tokens_meta.length;ec(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&&ec(e,s)}}var uf={tokenize:Mv,postProcess:Pv};function Tv(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 tc(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 c=e.tokens[s.token];c.type=i?"strong_close":"em_close",c.tag=i?"strong":"em",c.nesting=-1,c.markup=i?a+a:a,c.content="",i&&(e.tokens[t[r-1].token].content="",e.tokens[t[o.end+1].token].content="",r--)}}function _v(e){const t=e.tokens_meta,n=e.tokens_meta.length;tc(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&&tc(e,s)}}var df={tokenize:Tv,postProcess:_v};function jv(e,t){let n,r,o,s,i="",a="",l=e.pos,c=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;const f=e.pos,A=e.posMax,g=e.pos+1,h=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(h<0)return!1;let p=h+1;if(p<A&&e.src.charCodeAt(p)===40){for(c=!1,p++;p<A&&(n=e.src.charCodeAt(p),!(!Ge(n)&&n!==10));p++);if(p>=A)return!1;if(l=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="",l=p;p<A&&(n=e.src.charCodeAt(p),!(!Ge(n)&&n!==10));p++);if(o=e.md.helpers.parseLinkTitle(e.src,p,e.posMax),p<A&&l!==p&&o.ok)for(a=o.str,p=o.pos;p<A&&(n=e.src.charCodeAt(p),!(!Ge(n)&&n!==10));p++);}(p>=A||e.src.charCodeAt(p)!==41)&&(c=!0),p++}if(c){if(typeof e.env.references>"u")return!1;if(p<A&&e.src.charCodeAt(p)===91?(l=p+1,p=e.md.helpers.parseLinkLabel(e,p),p>=0?r=e.src.slice(l,p++):p=h+1):p=h+1,r||(r=e.src.slice(g,h)),r=Uo(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=h;const m=e.push("link_open","a",1),x=[["href",i]];if(m.attrs=x,a&&x.push(["title",a]),r){const I=Object.create(null);I.label=r,m.meta=I}e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=p,e.posMax=A,!0}function Nv(e,t){let n,r,o,s,i,a,l,c,f="";const A=e.pos,g=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const h=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),!(!Ge(n)&&n!==10));s++);if(s>=g)return!1;for(c=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=""),c=s;s<g&&(n=e.src.charCodeAt(s),!(!Ge(n)&&n!==10));s++);if(a=e.md.helpers.parseLinkTitle(e.src,s,e.posMax),s<g&&c!==s&&a.ok)for(l=a.str,s=a.pos;s<g&&(n=e.src.charCodeAt(s),!(!Ge(n)&&n!==10));s++);else l="";if(s>=g||e.src.charCodeAt(s)!==41)return e.pos=A,!1;s++}else{if(typeof e.env.references>"u")return!1;if(s<g&&e.src.charCodeAt(s)===91?(c=s+1,s=e.md.helpers.parseLinkLabel(e,s),s>=0?o=e.src.slice(c,s++):s=p+1):s=p+1,o||(o=e.src.slice(h,p)),o=Uo(o),i=e.env.references[o],!i)return e.pos=A,!1;f=i.href,l=i.title}if(!t){r=e.src.slice(h,p);const m=[];e.md.inline.parse(r,e.md,e.env,m);const x=e.push("image","img",0),I=[["src",f],["alt",""]];if(x.attrs=I,x.children=m,x.content=r,l&&I.push(["title",l]),o){const b=Object.create(null);b.label=o,x.meta=b}}return e.pos=s,e.posMax=g,!0}var Ov=/^([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])?)*)$/,Hv=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Kv(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(Hv.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 c=e.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return e.pos+=s.length+2,!0}if(Ov.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 c=e.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return e.pos+=s.length+2,!0}return!1}function Wv(e){return/^<a[>\s]/i.test(e)}function Lv(e){return/^<\/a\s*>/i.test(e)}function Qv(e){const t=e|32;return t>=97&&t<=122}function Gv(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&&!Qv(o))return!1;const s=e.src.slice(r).match(bv);if(!s)return!1;if(!t){const i=e.push("html_inline","",0);i.content=s[0],Wv(i.content)&&e.linkLevel++,Lv(i.content)&&e.linkLevel--}return e.pos+=s[0].length,!0}var Yv=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Uv=/^&([a-z][a-z0-9]{1,31});/i;function zv(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(Yv);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=da(s)?xr(s):xr(65533),i.markup=o[0],i.info="entity"}return e.pos+=o[0].length,!0}}else{const o=e.src.slice(n).match(Uv);if(o){const s=Kd(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 nc(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 c=r-s[r]-1,f=c;for(;c>l;c-=s[c]+1){const A=e[c];if(A.marker===a.marker&&A.open&&A.end<0){let g=!1;if((A.close||a.open)&&(A.length+a.length)%3===0&&(A.length%3!==0||a.length%3!==0)&&(g=!0),!g){const h=c>0&&!e[c-1].open?s[c-1]+1:0;s[i]=i-c+h,s[c]=h,a.open=!1,A.end=i,A.close=!1,f=-1,o=-2;break}}}f!==-1&&(t[a.marker][(a.open?3:0)+(a.length||0)%3]=f)}}function Vv(e){const t=e.tokens_meta,n=e.tokens_meta.length;nc(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&&nc(s)}}function Zv(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 gs=[["text",Ev],["linkify",Rv],["newline",Dv],["escape",Fv],["backticks",Bv],["strikethrough",uf.tokenize],["emphasis",df.tokenize],["link",jv],["image",Nv],["autolink",Kv],["html_inline",Gv],["entity",zv]],ms=[["balance_pairs",Vv],["strikethrough",uf.postProcess],["emphasis",df.postProcess],["fragments_join",Zv]],ff=class{constructor(){xe(this,"ruler",new Ir),xe(this,"ruler2",new Ir),xe(this,"State",cf);for(let e=0;e<gs.length;e++)this.ruler.push(gs[e][0],gs[e][1]);for(let e=0;e<ms.length;e++)this.ruler2.push(ms[e][0],ms[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)}},Jv={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"]}}}},$v=/^(vbscript|javascript|file|data):/,Xv=/^data:image\/(gif|png|jpeg|webp);/,rc=["http:","https:","mailto:"],zt=class{validateLink(e){const t=e.trim().toLowerCase();return $v.test(t)?Xv.test(t):!0}normalizeLink(e){const t=Gs(e,!0);if(t.hostname&&(!t.protocol||rc.indexOf(t.protocol)>=0))try{t.hostname=Ul.toASCII(t.hostname)}catch{}return Pr(Qs(t))}normalizeLinkText(e){const t=Gs(e,!0);if(t.hostname&&(!t.protocol||rc.indexOf(t.protocol)>=0))try{t.hostname=Ul.toUnicode(t.hostname)}catch{}return zn(Qs(t),zn.defaultChars+"%")}constructor(...e){xe(this,"inline",new ff),xe(this,"block",new lf),xe(this,"core",new rf),xe(this,"renderer",new ef),xe(this,"linkify",new d0),xe(this,"utils",I0),xe(this,"helpers",Object.assign({},O0));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=Jv[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(zt,"Token",En);xe(zt,"Ruler",Ir);xe(zt,"Renderer",ef);xe(zt,"ParserCore",rf);xe(zt,"StateCore",tf);xe(zt,"ParserBlock",lf);xe(zt,"StateBlock",of);xe(zt,"ParserInline",ff);xe(zt,"StateInline",cf);var qv=Jd(zt),xs,oc;function ey(){return oc||(oc=1,xs=function(t,n){var r=3,o="-",s=o.charCodeAt(0),i=o.length;function a(l,c,f,A){var g,h,p,m,x,I,b,v=!1,y=l.bMarks[c]+l.tShift[c],w=l.eMarks[c];if(c!==0||s!==l.src.charCodeAt(0))return!1;for(g=y+1;g<=w;g++)if(o[(g-y)%i]!==l.src[g]){b=g+1;break}if(p=Math.floor((g-y)/i),p<r)return!1;if(g-=(g-y)%i,A)return!0;for(h=c;h++,!(h>=f||l.src.slice(y,w)==="..."||(y=l.bMarks[h]+l.tShift[h],w=l.eMarks[h],y<w&&l.sCount[h]<l.blkIndent));)if(s===l.src.charCodeAt(y)&&!(l.sCount[h]-l.blkIndent>=4)){for(g=y+1;g<=w&&o[(g-y)%i]===l.src[g];g++);if(!(Math.floor((g-y)/i)<p)&&(g-=(g-y)%i,g=l.skipSpaces(g),!(g<w))){v=!0;break}}return x=l.parentType,I=l.lineMax,l.parentType="container",l.lineMax=h,m=l.push("front_matter",null,0),m.hidden=!0,m.markup=l.src.slice(c,g),m.block=!0,m.map=[c,h+(v?1:0)],m.meta=l.src.slice(b,y-1),l.parentType=x,l.lineMax=I,l.line=h+(v?1:0),n(m.meta),!0}t.block.ruler.before("table","front_matter",a,{alt:["paragraph","reference","blockquote","list"]})}),xs}var ty=ey();const ny=zf(ty);var ry=Object.defineProperty,oy=Object.defineProperties,sy=Object.getOwnPropertyDescriptors,sc=Object.getOwnPropertySymbols,iy=Object.prototype.hasOwnProperty,ay=Object.prototype.propertyIsEnumerable,ic=(e,t,n)=>t in e?ry(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,st=(e,t)=>{for(var n in t||(t={}))iy.call(t,n)&&ic(e,n,t[n]);if(sc)for(var n of sc(t))ay.call(t,n)&&ic(e,n,t[n]);return e},wr=(e,t)=>oy(e,sy(t)),mo=(e,t,n)=>new Promise((r,o)=>{var s=l=>{try{a(n.next(l))}catch(c){o(c)}},i=l=>{try{a(n.throw(l))}catch(c){o(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,i);a((n=n.apply(e,t)).next())});function ly(e,t){return typeof e=="function"?e(t):e}function kr(e,t){return n=>{t.setState(r=>wr(st({},r),{[e]:ly(n,r[e])}))}}var ac=(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)}),pf="Headless Tree: ",Us=e=>Error(pf+e),cy=e=>console.warn(pf+e),uy={key:"tree",getInitialState:e=>st({expandedItems:[],focusedItem:null},e),getDefaultConfig:(e,t)=>st({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,c,f,A,g)=>{var h;if(c.includes(l)){cy(`Circular reference for ${c.join(".")}`);return}if(r.push({itemId:l,level:f,index:r.length,parentId:c.at(-1),setSize:A,posInSet:g}),o.has(l)){const p=(h=e.retrieveChildrenIds(l))!=null?h:[];let m=0;for(const x of p)s(x,c.concat(l),f+1,p.length,m++)}},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(()=>mo(null,null,function*(){var t,n,r,o,s;const i=e.getFocusedItem();(n=(t=e.getConfig()).scrollToItem)==null||n.call(t,i),yield ac(()=>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)=>wr(st({},e?.()),{role:"tree","aria-label":n??"",ref:t.registerElement}),isSearchOpen:()=>!1},itemInstance:{scrollTo:(e,t)=>mo(null,[e,t],function*({tree:n,item:r},o){var s,i,a;(i=(s=n.getConfig()).scrollToItem)==null||i.call(s,r),yield ac(()=>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 wr(st({},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()}}}},dy=(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,c]of Object.entries(a)){if(!c)continue t;const f=r[l];r[l]=(...A)=>c(wr(st({},s),{prev:f}),...A)}}}]},fy=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 Us(`${r.key} needs ${o}`)}},py=(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},Ay=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)},hy=(e=[])=>py(e,Ay(e)),gy=e=>{var t,n,r,o;const s=(t=e.instanceBuilder)!=null?t:dy,i=[uy,...hy(e.features)];fy(i);const a=[...i],[l,c]=s(a,"treeInstance",S=>({tree:S}));let f=i.reduce((S,k)=>{var F,B;return(B=(F=k.getInitialState)==null?void 0:F.call(k,S,l))!=null?B:S},(r=(n=e.initialState)!=null?n:e.state)!=null?r:{}),A=i.reduce((S,k)=>{var F,B;return(B=(F=k.getDefaultConfig)==null?void 0:F.call(k,S,l))!=null?B:S},e);const g=i.reduce((S,k)=>st(st({},S),k.stateHandlerNames),{});let h;const p={current:{}};let m=!1;const x={};let I=[];const b={},v={};let y={};const w={},C=()=>{I=[],y={};const[S,k]=s(a,"itemInstance",F=>({item:F,tree:l,itemId:A.rootItemId}));k(),x[A.rootItemId]=S,y[A.rootItemId]={itemId:A.rootItemId,index:-1,parentId:null,level:-1,posInSet:0,setSize:1};for(const F of l.getItemsMeta())if(y[F.itemId]=F,x[F.itemId])I.push(x[F.itemId]);else{const[B,_]=s(a,"itemInstance",M=>({item:M,tree:l,itemId:F.itemId}));_(),x[F.itemId]=B,I.push(B)}m=!1},E=S=>{for(const k of i)S(k)},R={key:"main",treeInstance:{getState:()=>f,setState:({},S)=>{var k;(k=A.setState)==null||k.call(A,f)},setMounted:({},S)=>{var k;const F=p.current;F.isMounted=S,S&&((k=F.waitingForMount)==null||k.forEach(B=>B()),F.waitingForMount=[])},applySubStateUpdate:({},S,k)=>{var F;const B=()=>{f[S]=typeof k=="function"?k(f[S]):k;const M=A[g[S]];M?.(f[S])},_=p.current;_.isMounted?B():((F=_.waitingForMount)!=null||(_.waitingForMount=[]),_.waitingForMount.push(B))},rebuildTree:()=>{var S,k;const F=p.current;F.isMounted?(C(),(S=A.setState)==null||S.call(A,f)):((k=F.waitingForMount)!=null||(F.waitingForMount=[]),F.waitingForMount.push(()=>{var B;C(),(B=A.setState)==null||B.call(A,f)}))},scheduleRebuildTree:()=>{m=!0},getConfig:()=>A,setConfig:(S,k)=>{var F,B,_;const M=typeof k=="function"?k(A):k,D=((F=M.state)==null?void 0:F.expandedItems)&&((B=M.state)==null?void 0:B.expandedItems)!==f.expandedItems;A=M,M.state&&(f=st(st({},f),M.state)),D&&(C(),(_=A.setState)==null||_.call(A,f))},getItemInstance:({},S)=>{const k=x[S];if(!k){const[F,B]=s(a,"itemInstance",_=>({item:_,tree:l,itemId:S}));return B(),F}return k},getItems:()=>(m&&C(),I),registerElement:({},S)=>{h!==S&&(h&&!S?E(k=>{var F;return(F=k.onTreeUnmount)==null?void 0:F.call(k,l,h)}):!h&&S&&E(k=>{var F;return(F=k.onTreeMount)==null?void 0:F.call(k,l,S)}),h=S)},getElement:()=>h,getDataRef:()=>p,getHotkeyPresets:()=>w},itemInstance:{registerElement:({itemId:S,item:k},F)=>{if(b[S]===F)return;const B=b[S];B&&!F?E(_=>{var M;return(M=_.onItemUnmount)==null?void 0:M.call(_,k,B,l)}):!B&&F&&E(_=>{var M;return(M=_.onItemMount)==null?void 0:M.call(_,k,F,l)}),b[S]=F},getElement:({itemId:S})=>b[S],getDataRef:({itemId:S})=>{var k;return(k=v[S])!=null?k:v[S]={current:{}}},getItemMeta:({itemId:S})=>{var k;return(k=y[S])!=null?k:{itemId:S,parentId:null,level:-1,index:-1,posInSet:0,setSize:1}}}};a.unshift(R);for(const S of a)Object.assign(w,(o=S.hotkeys)!=null?o:{});return c(),l},my={key:"selection",getInitialState:e=>st({selectedItems:[]},e),getDefaultConfig:(e,t)=>st({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,c]=o<a?[o,a]:[a,o],f=e.getItems().slice(l,c+1).map(h=>h.getItemMeta().itemId);if(!r){e.setSelectedItems(f);return}const{selectedItems:A}=e.getState(),g=[...new Set([...A,...f])];e.setSelectedItems(g)},toggleSelect:({item:e})=>{e.isSelected()?e.deselect():e.select()},getProps:({tree:e,item:t,itemId:n,prev:r})=>wr(st({},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()))}}}},lc=e=>e.code!==""&&e.code!=="Unidentified"?e.code:e.key,cc={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)$/},uc=new Set(["MetaLeft","MetaRight","Meta","ControlLeft","ControlRight","Control","AltLeft","AltRight","Alt","ShiftLeft","ShiftRight","Shift"]),xy=(e,t,n)=>{const r=n.hotkey.toLowerCase().split("+"),o=r.every(i=>{if(i in cc)return[...e].some(l=>cc[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},by=(e,t,n,r)=>{var o;return(o=Object.entries(st(st({},n),r)).find(([,s])=>xy(e,t,s)))==null?void 0:o[0]},bs={clearPressedKeys:e=>{e.current.pressedKeys=new Set},dispatchKeyDown:(e,t,n,r={})=>{var o,s,i,a,l;const{isInputFocused:c=!1,releaseAfterDispatch:f=!1}=r,{ignoreHotkeysOnInputs:A,onTreeHotkey:g,hotkeys:h}=e.getConfig();if(c&&A)return;const p=lc({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=by(t.current.pressedKeys,e,e.getHotkeyPresets(),h);if(f&&p&&t.current.pressedKeys.delete(p),!x)return;const I=st(st({},e.getHotkeyPresets()[x]),h?.[x]);I&&(!I.allowWhenInputFocused&&c||!I.canRepeat&&!m||(I.preventDefault&&((l=n.preventDefault)==null||l.call(n)),I.handler(n,e),g?.(x,n)))},dispatchKeyUp:(e,t)=>{var n,r,o,s;const i=lc({code:(n=t.code)!=null?n:"",key:(r=t.key)!=null?r:""});i&&((s=(o=e.current).pressedKeys)!=null||(o.pressedKeys=new Set),uc.has(i)&&(e.current.pressedKeys=new Set([...e.current.pressedKeys].filter(a=>uc.has(a)))),e.current.pressedKeys.delete(i))}},vy={key:"hotkeys-core",onTreeMount:(e,t)=>{const n=e.getDataRef(),r=i=>{const a=i.target instanceof HTMLInputElement;bs.dispatchKeyDown(e,n,i,{isInputFocused:a,releaseAfterDispatch:a})},o=i=>{bs.dispatchKeyUp(n,i)},s=()=>{bs.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)}},yy="sync dataLoader returned undefined",Cy="sync dataLoader returned promise",vs=e=>{if(!e)throw Us(yy);if(typeof e=="object"&&"then"in e)throw Us(Cy);return e},Iy={key:"sync-data-loader",getInitialState:e=>st({loadingItemData:[],loadingItemChildrens:[]},e),getDefaultConfig:(e,t)=>st({setLoadingItemData:kr("loadingItemData",t),setLoadingItemChildrens:kr("loadingItemChildrens",t)},e),stateHandlerNames:{loadingItemData:"setLoadingItemData",loadingItemChildrens:"setLoadingItemChildrens"},treeInstance:{waitForItemDataLoaded:()=>mo(null,null,function*(){}),waitForItemChildrenLoaded:()=>mo(null,null,function*(){}),retrieveItemData:({tree:e},t)=>vs(e.getConfig().dataLoader.getItem(t)),retrieveChildrenIds:({tree:e},t)=>{const{dataLoader:n}=e.getConfig();return"getChildren"in n?vs(n.getChildren(t)):vs(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}},wy=Object.defineProperty,ky=Object.defineProperties,Ey=Object.getOwnPropertyDescriptors,dc=Object.getOwnPropertySymbols,Sy=Object.prototype.hasOwnProperty,Ry=Object.prototype.propertyIsEnumerable,fc=(e,t,n)=>t in e?wy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vr=(e,t)=>{for(var n in t||(t={}))Sy.call(t,n)&&fc(e,n,t[n]);if(dc)for(var n of dc(t))Ry.call(t,n)&&fc(e,n,t[n]);return e},Dy=(e,t)=>ky(e,Ey(t)),Fy=e=>{const[t]=d.useState(()=>({current:gy(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=>Dy(Vr(Vr({},o),e),{state:Vr(Vr({},n),e.state),setState:s=>{var i;r(s),(i=e.setState)==null||i.call(e,s)}})),t.current};const By=/^(https?:|mailto:|#|\.\/|#\/)/iu,My=e=>e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;"),Dn=qv({html:!1,linkify:!0,typographer:!1,breaks:!1});ny(Dn,()=>{});Dn.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});Dn.validateLink=e=>By.test(e.trim());const Af=e=>{for(const t of e)t.type==="link_open"&&(t.attrSet("rel","noreferrer noopener"),t.attrSet("target","_blank")),t.children!==null&&Af(t.children)};Dn.core.ruler.push("external_links",e=>(Af(e.tokens),!0));Dn.renderer.rules.fence=(e,t)=>{const n=e[t];return`<pre class="tech-ltr"><code${n.info.trim().length>0?` class="language-${My(n.info.trim())}"`:""}>${Dn.utils.escapeHtml(n.content)}</code></pre>
19
- `};const Py=e=>Dn.render(e),Ty=["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(" "),_y=(e,t)=>e.children!==void 0?t?u.jsx(Cp,{"aria-hidden":!0,className:"pointer-events-none size-4 text-amber-500"}):u.jsx(wp,{"aria-hidden":!0,className:"pointer-events-none size-4 text-amber-500"}):u.jsx(vp,{"aria-hidden":!0,className:"pointer-events-none size-4 text-muted-foreground"}),pc=16,jy=({entries:e,selected:t,onSelect:n})=>{const r=d.useMemo(()=>{const l=new Map;for(const f of e){const A=f.path.split("/"),g=A[A.length-1]??f.path;f.type==="directory"?l.set(f.path,{name:g,path:f.path,children:[]}):l.set(f.path,{name:g,path:f.path})}for(const f of e){const A=f.path.split("/");for(let g=1;g<A.length;g+=1){const h=A.slice(0,g).join("/");l.has(h)||l.set(h,{name:A[g-1]??h,path:h,children:[]})}}for(const f of l.values())f.children!==void 0&&(f.children=[...l.values()].filter(A=>A.path!==""&&A.path.split("/").slice(0,-1).join("/")===f.path).map(A=>A.path));const c={name:"skill",path:"",children:[]};return c.children=[...l.values()].filter(f=>f.path!==""&&f.path.split("/").length===1).map(f=>f.path),l.set("root",c),Object.fromEntries(l)},[e]),o=d.useMemo(()=>Object.values(r).filter(l=>l.children!==void 0&&l.path!=="").map(l=>l.path),[r]),[s,i]=d.useState([t]),a=Fy({initialState:{selectedItems:[t],expandedItems:o},setSelectedItems:l=>{i(c=>{const f=typeof l=="function"?l(c):l,A=f[0];return A!==void 0&&r[A]?.children===void 0&&A!=="root"&&n(A),f})},indent:pc,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:[Iy,my,vy]});return u.jsx(Mb,{indent:pc,tree:a,children:a.getItems().map(l=>{const c=l.getItemData(),f=c.children===void 0&&c.path!=="";return u.jsx(Pb,{item:l,onClick:()=>{f&&n(c.path)},children:u.jsx(Tb,{className:"tech-ltr relative before:bg-background before:absolute before:inset-x-0 before:-inset-y-0.5 before:-z-10",children:u.jsxs("span",{className:"flex items-center gap-2",children:[_y(c,l.isExpanded()),l.getItemName()]})})},l.getId())})})},Ny=()=>{const{messages:e}=Yo(),[t,n]=d.useState([]),[r,o]=d.useState("SKILL.md"),[s,i]=d.useState(null),[a,l]=d.useState(null),[c,f]=d.useState(!0),[A,g]=d.useState(!1);d.useEffect(()=>{(async()=>{const p=await Ox();p.status===200?n(p.data):l(e.help.readError),f(!1)})()},[e.help.readError]),d.useEffect(()=>{g(!0),l(null),(async()=>{const p=await Hx(r);p.status===200&&"content"in p.data?i(p.data.content):(i(null),l(e.help.readError)),g(!1)})()},[r,e.help.readError]);const h=d.useMemo(()=>s===null?"":Py(s),[s]);return u.jsxs("section",{className:"flex h-full min-h-0 overflow-hidden","aria-label":e.help.title,children:[u.jsx("nav",{className:"w-64 shrink-0 overflow-y-auto border-e border-border p-2","aria-label":e.help.listTitle,children:c?u.jsxs("div",{className:"space-y-2",children:[u.jsx(Xt,{className:"h-5 w-full"}),u.jsx(Xt,{className:"h-5 w-4/5"}),u.jsx(Xt,{className:"h-5 w-3/5"})]}):t.length===0?u.jsx("p",{className:"text-muted-foreground px-2 text-xs",children:e.help.empty}):u.jsx(jy,{entries:t,selected:r,onSelect:o})}),u.jsx("article",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-6","aria-live":"polite",children:A?u.jsxs("div",{className:"space-y-2",children:[u.jsx(Xt,{className:"h-6 w-1/2"}),u.jsx(Xt,{className:"h-4 w-full"}),u.jsx(Xt,{className:"h-4 w-5/6"})]}):a!==null?u.jsx("p",{className:"text-destructive text-sm",children:a}):u.jsx("div",{className:Ty,dangerouslySetInnerHTML:{__html:h}})})]})},hf=e=>`/api/icon-composed/${e}?token=${encodeURIComponent(new URLSearchParams(location.search).get("token")??"")}`,Oy={cwd:"",env:[],argsMode:"string"},pa=new URLSearchParams(location.search).get("token")??"",We=(e,t={})=>fetch(e,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${pa}`},body:JSON.stringify(t)}),Hy=()=>new EventSource(`/api/events?token=${encodeURIComponent(pa)}`),_n=(e,t)=>`/api/icon-data/${e}/${t}?token=${encodeURIComponent(pa)}`,Ky=e=>{try{return new URL(e).hostname}catch{return e}};function Wy({values:e,defaults:t,frozen:n,iconCandidates:r,iconCandidatesPort:o,uploadedIconUrl:s,selectedIconRef:i,iconAnalysis:a,iconComposition:l,iconComposeError:c,iconBackground:f,iconScale:A,onIconBackgroundChange:g,onIconScaleChange:h,onPickIconCandidate:p,onUploadIcon:m,onClearIcon:x,onPatch:I}){const b=n,v=d.useRef(null),[y,w]=d.useState(!1);return u.jsxs("div",{className:"grid grid-cols-1 gap-y-1",children:[u.jsxs("div",{children:[u.jsx(ct,{children:"应用图标"}),u.jsxs("div",{className:"mt-1.5 flex flex-wrap items-start gap-3",children:[u.jsx("button",{type:"button",disabled:b,"aria-label":"选择本地图片作为应用图标",onClick:()=>v.current?.click(),onDragOver:C=>{C.preventDefault(),b||w(!0)},onDragLeave:()=>w(!1),onDrop:C=>{if(C.preventDefault(),w(!1),b)return;const E=C.dataTransfer.files[0];E!==void 0&&m(E)},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",y&&"border-primary bg-primary/10"),children:s!==void 0?u.jsx("img",{src:s,alt:"已选图标",className:"icon-checker size-full rounded object-contain"}):u.jsxs("span",{className:"flex flex-col items-center gap-1 text-muted-foreground",children:[u.jsx(_c,{className:"size-4"}),u.jsx("span",{className:"text-[10px] leading-tight",children:"点击或拖入图片"})]})}),u.jsx("input",{ref:v,type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden",disabled:b,onChange:C=>{const E=C.target.files?.[0];E!==void 0&&m(E),C.target.value=""}}),u.jsx("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:r.length===0?u.jsx("span",{className:"text-xs text-muted-foreground",children:"未抓取到候选图标;将使用首字母图标"}):r.map(C=>{const E=o===void 0?void 0:_n(o,C.index),R=i===`${o}:${C.index}`,S=i===void 0&&C.index===0;return u.jsx("button",{type:"button",disabled:b,title:`${C.width}×${C.height} ${C.format.toUpperCase()}`,onClick:()=>p(C),className:fe("icon-checker flex size-14 items-center justify-center overflow-hidden rounded-lg border p-1 transition-all",R||S?"border-primary ring-2 ring-primary/60":"border-border hover:border-primary/60",b&&"opacity-50"),children:E!==void 0?u.jsx("img",{src:E,alt:`候选图标 ${C.width}×${C.height}`,className:"size-full object-contain"}):null},C.index)})}),i!==void 0||s!==void 0?u.jsx("button",{type:"button",disabled:b,onClick:x,className:"text-[11px] text-muted-foreground underline-offset-2 hover:underline",children:"清除选择(回到默认)"}):null]}),u.jsx("div",{className:"mt-3 rounded-lg border border-border p-3",children:u.jsxs("div",{className:"flex items-start gap-3",children:[u.jsx("div",{role:"img",className:"icon-checker size-14 shrink-0 overflow-hidden rounded-[10px]","aria-label":"图标合成预览",children:l!==void 0?u.jsx("img",{src:hf(l.key),alt:"图标合成预览",className:"size-full object-contain",onError:C=>{C.currentTarget.style.display="none"}}):u.jsx("span",{className:"flex size-full items-center justify-center text-[10px] text-muted-foreground",children:"预览"})}),u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsx(ct,{children:"图标背景"}),u.jsx("div",{className:"mt-1.5 flex gap-1.5",children:["black","white","transparent"].map(C=>u.jsxs("button",{type:"button",disabled:b,"aria-pressed":f===C,onClick:()=>g(C),className:fe("flex h-7 items-center gap-1.5 rounded-md border px-2.5 text-[11px] transition-colors",f===C?"border-foreground bg-secondary text-secondary-foreground":"border-border text-muted-foreground hover:border-foreground/40"),children:[C==="black"?"黑色":C==="white"?"白色":"透明",a!==void 0&&a.suggested===C?u.jsx("span",{className:"text-[10px] text-muted-foreground/70",children:"自动"}):null]},C))}),u.jsxs("div",{className:"mt-2.5",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx(ct,{className:"text-[11px]",children:"前景缩放"}),u.jsxs("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[Math.round(A*100),"%"]})]}),u.jsx("input",{type:"range",min:50,max:95,step:5,value:Math.round(A*100),disabled:b,onChange:C=>h(Number(C.target.value)/100),className:"mt-1 w-full accent-foreground","aria-label":"前景图标缩放"})]}),c!==void 0?u.jsx("p",{role:"alert",className:"mt-1.5 text-[11px] font-medium text-red-400",children:c}):null,a!==void 0?u.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]})]})})]}),u.jsxs("div",{children:[u.jsx(ct,{htmlFor:"appId",children:"App ID"}),u.jsx(wn,{id:"appId",className:"mt-1 font-mono",disabled:b,value:e.appId,placeholder:t.appId||"由命令推导(如 start.somecommand.npx)",onChange:C=>I({appId:C.target.value})})]}),u.jsxs("div",{children:[u.jsx(ct,{htmlFor:"appName",children:"应用名称"}),u.jsx(wn,{id:"appName",className:"mt-1",disabled:b,value:e.appName,placeholder:t.appName||"从服务页面标题抓取",onChange:C=>I({appName:C.target.value})})]})]})}function Ly({candidates:e,port:t,disabled:n,selectedRef:r,uploadedUrl:o,includeVariants:s,defaultLabel:i,onPick:a,onUpload:l,onClear:c}){const f=d.useRef(null),[A,g]=d.useState(!1),h=s?e:e.filter(m=>m.variant==="original"),p=e.filter(m=>m.variant==="original");return u.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[u.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&&l(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",A&&"border-primary bg-primary/10"),children:o!==void 0?u.jsx("img",{src:o,alt:"已选图标",className:"icon-checker size-full rounded object-contain"}):u.jsxs("span",{className:"flex flex-col items-center gap-1 text-muted-foreground",children:[u.jsx(_c,{className:"size-4"}),u.jsx("span",{className:"text-[10px] leading-tight",children:"上传"})]})}),u.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&&l(x),m.target.value=""}}),u.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[h.length===0?u.jsx("span",{className:"text-xs text-muted-foreground",children:"暂无候选图标"}):h.map(m=>{const x=t===void 0?void 0:_n(t,m.index),I=r===`${t}:${m.index}`,b=r===void 0&&m.variant==="original"&&m.index===(p[0]?.index??-1);return u.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",I||b?"border-primary ring-2 ring-primary/60":"border-border hover:border-primary/60",n&&"opacity-50"),children:x!==void 0?u.jsx("img",{src:x,alt:`候选 ${m.variant}`,className:"size-full object-contain"}):null},`${m.variant}:${m.index}`)}),i!==void 0&&r===void 0&&h.length>0?u.jsx("span",{className:"text-[11px] text-muted-foreground",children:i}):null]}),r!==void 0||o!==void 0?u.jsx("button",{type:"button",disabled:n,onClick:c,className:"text-[11px] text-muted-foreground underline-offset-2 hover:underline",children:"清除"}):null]})}function Qy(e){const t=d.useRef(!0);t.current&&(t.current=!1,e())}const gf=d.createContext(null);function Vt(){const e=d.useContext(gf);if(e===null)throw new Error(nt(60));return e}const Gy=(e,t)=>Object.is(e,t);function Zn(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function to(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:Zn(r,t,n))}function Yy(e,t,n){return e.filter(r=>!Zn(t,r,n))}function zs(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function mf(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Uy(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(mf(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 xf(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 zs(e)}function Tn(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?zs(e.value):zs(e)}function bf(e,t,n){function r(){return xf(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=mf(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 zy(e,t,n){return e.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(u.jsx(d.Fragment,{children:bf(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:Tn(t,r)!==""},hasNullItemLabel:(e,t)=>t?Uy(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=>Zn(t,o,n)):Zn(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 Vy(e,t,n=(r,o)=>r===o){return e.length===t.length&&e.every((r,o)=>n(r,t[o]))}function ar(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const Tt=1;function Aa(e,t){return Math.max(0,e-t)}function xo(e,t){if(t<=0)return 0;const n=ar(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 Zy(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:a,name:l,form:c,autoComplete:f,disabled:A=!1,readOnly:g=!1,required:h=!1,modal:p=!0,actionsRef:m,inputRef:x,onOpenChangeComplete:I,items:b,multiple:v=!1,itemToStringLabel:y,itemToStringValue:w,isItemEqualToValue:C=Gy,highlightItemOnHover:E=!0,children:R}=e,{clearErrors:S}=oi(),{setDirty:k,setTouched:F,setFocused:B,validityData:_,setFilled:M,name:D,disabled:j,validation:P,validationMode:T}=wo(),N=ai({id:t}),Q=j||A,O=D??l,[H,Y]=rn({controlled:n,default:v?r??_t:r,name:"Select",state:"value"}),[U,z]=rn({controlled:s,default:i,name:"Select",state:"open"}),L=d.useRef([]),Z=d.useRef([]),K=d.useRef(null),ee=d.useRef(null),ce=d.useRef(0),ne=d.useRef(null),$=d.useRef([]),q=d.useRef(!1),ue=d.useRef(null),le=d.useRef(null),Ae=d.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),se=d.useRef(!1),{mounted:he,setMounted:re,transitionStatus:oe}=Jn(U),{openMethod:ae,triggerProps:ge}=Wu(U),me=Et(()=>new Dr({id:N,labelId:void 0,modal:p,multiple:v,itemToStringLabel:y,itemToStringValue:w,isItemEqualToValue:C,value:H,open:U,mounted:he,transitionStatus:oe,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),G=we(me,ke.selectedIndex),be=we(me,ke.triggerElement),X=we(me,ke.positionerElement),te=bm(ae),Ee=ae??te,Se=d.useMemo(()=>v?"":Tn(H,w),[v,H,w]),Le=d.useMemo(()=>v&&Array.isArray(H)?H.map(De=>Tn(De,w)):Tn(H,w),[v,H,w]),Ye=Xe(be),Oe=de(()=>Le);ii(Ye,N,H,Oe,!Q,l);const at=d.useRef(H),qe=v?Array.isArray(H)&&H.length>0:H!=null&&Se!=="";ie(()=>{M(qe)},[qe,M]),ie(function(){let Ke=H,gt=!1;if(v){const Dt=Array.isArray(H)?H:[];gt=Dt.length===0,Ke=Dt[Dt.length-1]}const vt=gt?-1:to($.current,Ke,C),yt=vt===-1?null:vt;yt===null&&(le.current=null),!U&&me.set("selectedIndex",yt)},[v,U,H,C,me]);function Ze(De){const Ke=_.initialValue;return Array.isArray(De)&&Array.isArray(Ke)?!Vy(De,Ke,(gt,vt)=>Zn(gt,vt,C)):De!==Ke}Ko(H,()=>{S(O),k(Ze(H)),P.change(H)});const dt=de((De,Ke)=>{a?.(De,Ke),!Ke.isCanceled&&(z(De),!De&&(Ke.reason===Sn||Ke.reason===yo)&&(F(!0),B(!1),T==="onBlur"&&P.commit(H)))}),Ie=de(()=>{re(!1),me.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),I?.(!1)});Yt({enabled:!m,open:U,ref:K,onComplete(){U||Ie()}}),d.useImperativeHandle(m,()=>({unmount:Ie}),[Ie]);const He=de((De,Ke)=>{o?.(De,Ke),!Ke.isCanceled&&Y(De)}),_e=de(De=>{const Ke=Aa(De.scrollHeight,De.clientHeight),gt=xo(De.scrollTop,Ke),vt=gt>0,yt=gt<Ke;me.set("scrollUpArrowVisible",vt),me.set("scrollDownArrowVisible",yt)}),et=mg({open:U,onOpenChange:dt,elements:{reference:be,floating:X}}),Re=pu(et,{enabled:!g&&!Q,event:"mousedown"}),Ue=Po(et),ze=Tu(et,{enabled:!g&&!Q,listRef:L,activeIndex:W,selectedIndex:G,disabledIndices:_t,onNavigate(De){De===null&&!U||me.set("activeIndex",De)},focusItemOnHover:E}),Je=_u(et,{enabled:!g&&!Q&&(U||!v),listRef:Z,activeIndex:W,selectedIndex:G,disabledIndices:De=>ad(L.current[De]),onMatch(De){U?me.set("activeIndex",De):He($.current[De],Ce(Pt))},onTyping(De){q.current=De}}),ht=d.useMemo(()=>Bt(Je.reference,ze.reference,Ue.reference,Re.reference,ge),[Re.reference,Je.reference,ze.reference,Ue.reference,ge]),ft=d.useMemo(()=>Bt(jo,Je.floating,ze.floating,Ue.floating),[Je.floating,ze.floating,Ue.floating]),St=ze.item??it;Qy(()=>{me.update({popupProps:ft,triggerProps:ht})}),me.useSyncedValues({id:N,modal:p,multiple:v,value:H,open:U,mounted:he,transitionStatus:oe,popupProps:ft,triggerProps:ht,items:b,itemToStringLabel:y,itemToStringValue:w,isItemEqualToValue:C,openMethod:Ee});const rt=d.useMemo(()=>({store:me,floatingContext:et,required:h,disabled:Q,readOnly:g,multiple:v,highlightItemOnHover:E,setValue:He,setOpen:dt,listRef:L,popupRef:K,scrollHandlerRef:ee,handleScrollArrowVisibility:_e,scrollArrowsMountedCountRef:ce,itemProps:St,valueRef:ne,valuesRef:$,labelsRef:Z,typingRef:q,selectionRef:Ae,firstItemTextRef:ue,selectedItemTextRef:le,validation:P,onOpenChangeComplete:I,alignItemWithTriggerActiveRef:se,initialValueRef:at}),[me,et,h,Q,g,v,E,He,dt,St,P,I,_e]),kt=Qt(x,P.inputRef),Rt=v?void 0:O,pt=d.useMemo(()=>!v||!Array.isArray(H)||!O?null:H.map(De=>{const Ke=Tn(De,w);return u.jsx("input",{type:"hidden",form:c,name:O,value:Ke,disabled:Q},Ke)}),[v,H,c,O,w,Q]);return u.jsxs(gf.Provider,{value:rt,children:[R,u.jsx("input",{...P.getValidationProps(Q,{onFocus(){me.state.triggerElement?.focus({focusVisible:!0})},onChange(De){if(De.nativeEvent.defaultPrevented||Q||g)return;const Ke=De.currentTarget.value,gt=Ce(Pt,De.nativeEvent);function vt(){if(v)return;const yt=Ke.toLowerCase();let Dt=$.current.findIndex(ln=>Tn(ln,w).toLowerCase()===yt||xf(ln,y).toLowerCase()===yt);Dt===-1&&(Dt=$.current.findIndex((ln,Xn)=>{const Cn=Z.current[Xn];return Cn!=null&&Cn.toLowerCase()===yt}));const Ot=$.current[Dt];Ot!=null&&He(Ot,gt)}me.set("forceMount",!0),queueMicrotask(vt)}}),id:N&&Rt==null?`${N}-hidden-input`:void 0,form:c,name:Rt,autoComplete:f,value:Se,disabled:Q,required:h&&!(v&&qe),readOnly:g,ref:kt,style:O?Ei:Mo,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),pt]})}function Jy(e,t){return e??t}const $y=400,Xy={...Bs,...ri,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},qy=d.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:a=!0,style:l,...c}=t,{setTouched:f,setFocused:A,validationMode:g,state:h,disabled:p}=wo(),{labelId:m}=si(),{store:x,setOpen:I,selectionRef:b,validation:v,readOnly:y,required:w,alignItemWithTriggerActiveRef:C,disabled:E}=Vt(),R=p||E||i,S=we(x,ke.open),k=we(x,ke.mounted),F=we(x,ke.value),B=we(x,ke.triggerProps),_=we(x,ke.positionerElement),M=we(x,ke.listElement),D=we(x,ke.popupSide),j=we(x,ke.id),P=we(x,ke.labelId),T=we(x,ke.hasSelectedValue),N=k&&_?D:null,Q=s??j,O=Jy(m,P);ai({id:Q});const H=Xe(_),Y=d.useRef(null),{getButtonProps:U,buttonRef:z}=Gt({disabled:R,native:a}),L=x.useStateSetter("triggerElement"),Z=ut(),K=ut(),ee=ut();d.useEffect(()=>{if(S)return ee.start($y,()=>{b.current.allowUnselectedMouseUp=!0,b.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},K.clear()},[S,b,K,ee]);const ce=Bt(B,{id:Q,role:"combobox","aria-expanded":S,"aria-haspopup":"listbox","aria-controls":S?M?.id??so(_)?.id:void 0,"aria-labelledby":O,"aria-readonly":y||void 0,"aria-required":w||void 0,tabIndex:R?-1:0,onFocus(q){A(!0),S&&C.current&&I(!1,Ce(Pt,q.nativeEvent)),Z.start(0,()=>{x.set("forceMount",!0)})},onBlur(q){ve(_,q.relatedTarget)||(f(!0),A(!1),g==="onBlur"&&v.commit(F))},onMouseDown(q){if(S)return;const ue=Be(q.currentTarget);function le(Ae){if(!Y.current)return;const se=Ae.target;ve(Y.current,se)||ve(H.current,se)||rd(Ae,Y.current)||I(!1,Ce(Fc,Ae))}K.start(0,()=>{ue.addEventListener("mouseup",le,{once:!0})})}},c,U),ne=v.getValidationProps(R,ce);ne.role="combobox";const $={...h,open:S,disabled:R,value:F,readOnly:y,popupSide:N,placeholder:!T};return Me("button",t,{ref:[n,Y,z,L],state:$,stateAttributesMapping:Xy,props:ne})}),eC={value:()=>null},tC=d.forwardRef(function(t,n){const{className:r,render:o,children:s,placeholder:i,style:a,...l}=t,{store:c,valueRef:f}=Vt(),A=we(c,ke.value),g=we(c,ke.items),h=we(c,ke.itemToStringLabel),p=we(c,ke.hasSelectedValue),m=!p&&i!=null&&s==null,x=we(c,ke.hasNullItemLabel,m),I={value:A,placeholder:!p};let b=null;return typeof s=="function"?b=s(A):s!=null?b=s:m&&!x?b=i:Array.isArray(A)?b=zy(A,g,h):b=bf(A,g,h),Me("span",t,{state:I,ref:[n,f],props:[{children:b},l],stateAttributesMapping:eC})}),nC=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a}=Vt(),c={open:we(a,ke.open)};return Me("span",t,{state:c,ref:n,props:[{"aria-hidden":!0,children:"▼"},i],stateAttributesMapping:eu})}),rC=d.forwardRef(function(t,n){const{store:r}=Vt(),o=we(r,ke.mounted),s=we(r,ke.forceMount);return o||s?u.jsx(Si,{ref:n,...t}):null}),vf=d.createContext(void 0);function ha(){const e=d.useContext(vf);if(!e)throw new Error(nt(59));return e}function bo(e,t){e&&Object.assign(e.style,t)}const yf={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},oC={position:"fixed"},sC=d.forwardRef(function(t,n){const{anchor:r,className:o,render:s,positionMethod:i,side:a,align:l,sideOffset:c,alignOffset:f,collisionBoundary:A="clipping-ancestors",collisionPadding:g,arrowPadding:h,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:x=!0,collisionAvoidance:I=ou,style:b,...v}=t,{store:y,listRef:w,labelsRef:C,alignItemWithTriggerActiveRef:E,selectedItemTextRef:R,valuesRef:S,initialValueRef:k,popupRef:F,setValue:B,floatingContext:_}=Vt(),M=we(y,ke.open),D=we(y,ke.mounted),j=we(y,ke.modal),P=we(y,ke.value),T=we(y,ke.openMethod),N=we(y,ke.positionerElement),Q=we(y,ke.triggerElement),O=we(y,ke.isItemEqualToValue),H=we(y,ke.transitionStatus),Y=d.useRef(null),U=d.useRef(null),[z,L]=d.useState(x),Z=D&&z&&T!=="touch";!D&&z!==x&&L(x),d.useImperativeHandle(E,()=>Z),td((Z||j)&&M,T==="touch",N,Q);const K=Vi({anchor:r,floatingRootContext:_,positionMethod:i,mounted:D,side:a,sideOffset:c,align:l,alignOffset:f,arrowPadding:h,collisionBoundary:A,collisionPadding:g,sticky:p,disableAnchorTracking:m??Z,collisionAvoidance:I,keepMounted:!0}),ee=Z?"none":K.side,ce=Z?oC:K.positionerStyles,ne={open:M,side:ee,align:K.align,anchorHidden:K.anchorHidden};ie(()=>{y.set("popupSide",K.side)},[y,K.side]);const $=y.useStateSetter("positionerElement"),q=Zi(t,ne,{styles:ce,transitionStatus:H,props:v,refs:[n,$],hidden:!D,inert:!M}),ue=d.useRef(0),le=de(se=>{if(S.current.length===0)return;const he=ue.current;if(ue.current=se.size,se.size===he)return;const re=Ce(Pt);if(he!==0&&!y.state.multiple&&P!==null&&to(S.current,P,O)===-1){const ae=k.current,me=ae!=null&&to(S.current,ae,O)!==-1?ae:null;B(me,re),me===null&&(y.set("selectedIndex",null),R.current=null)}if(he!==0&&y.state.multiple&&Array.isArray(P)){const oe=P.filter(ae=>to(S.current,ae,O)!==-1);oe.length!==P.length&&(B(oe,re),oe.length===0&&(y.set("selectedIndex",null),R.current=null))}if(M&&Z){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const oe={height:""};bo(N,oe),bo(F.current,oe)}}),Ae=d.useMemo(()=>({...K,side:ee,alignItemWithTriggerActive:Z,setControlledAlignItemWithTrigger:L,scrollUpArrowRef:Y,scrollDownArrowRef:U}),[K,ee,Z,L]);return u.jsx(Mr,{elementsRef:w,labelsRef:C,onMapChange:le,children:u.jsxs(vf.Provider,{value:Ae,children:[D&&j&&u.jsx(Yi,{inert:Gi(!M),cutout:Q}),q]})})}),Zr="base-ui-disable-scrollbar",Vs={className:Zr,getElement(e){return u.jsx("style",{nonce:e,href:Zr,precedence:"base-ui:low",children:`.${Zr}{scrollbar-width:none}.${Zr}::-webkit-scrollbar{display:none}`})}},iC=d.createContext(void 0),aC={disableStyleElements:!1};function lC(){return d.useContext(iC)??aC}const cC={...Rr,...Bn},uC=d.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...a}=t,{store:l,popupRef:c,onOpenChangeComplete:f,setOpen:A,valueRef:g,firstItemTextRef:h,selectedItemTextRef:p,multiple:m,handleScrollArrowVisibility:x,scrollHandlerRef:I,listRef:b,highlightItemOnHover:v,floatingContext:y}=Vt(),{side:w,align:C,alignItemWithTriggerActive:E,isPositioned:R,setControlledAlignItemWithTrigger:S}=ha(),k=ea()!=null,F=Wo(),{nonce:B,disableStyleElements:_}=lC(),M=we(l,ke.id),D=we(l,ke.open),j=we(l,ke.openMethod),P=we(l,ke.mounted),T=we(l,ke.popupProps),N=we(l,ke.transitionStatus),Q=we(l,ke.triggerElement),O=we(l,ke.positionerElement),H=we(l,ke.listElement),Y=d.useRef(!1),U=d.useRef(!1),z=d.useRef({}),L=Gn(),Z=de(ne=>{if(!O||!c.current||!U.current)return;const $=O.style.top==="0px",q=O.style.bottom==="0px";if(Y.current||!E||!$&&!q){x(ne);return}const ue=hc(O),le=lr(O.getBoundingClientRect().height,"y",ue),Ae=Be(O),se=tt(O),he=se.getComputedStyle(O),re=parseFloat(he.marginTop),oe=parseFloat(he.marginBottom),ae=Ac(se.getComputedStyle(c.current)),ge=Math.min(Ae.documentElement.clientHeight-re-oe,ae),me=ne.scrollTop,W=Jr(ne);let G=null;const be=Se=>{O.style.height=`${Se}px`},X=$?W-me:me,te=Math.min(le+X,ge);if(X<=Tt){const Se=ar(X,0,ge-le);Se>0&&be(le+Se),ne.scrollTop=$?W:0,ge-(le+Se)<=Tt&&(Y.current=!0),x(ne);return}if(ge-te>Tt)G=$?1/0:0;else if(q&&me<W){const Se=le+X-ge;G=me-(X-Se)}const Ee=Math.ceil(te);if(Ee!==0&&be(Ee),G!=null){const Se=ar(G,0,Jr(ne));Math.abs(ne.scrollTop-Se)>Tt&&(ne.scrollTop=Se)}Ee>=ge-Tt&&(Y.current=!0),x(ne)});d.useImperativeHandle(I,()=>Z,[Z]),Yt({open:D,ref:c,onComplete(){D&&f?.(!0)}});const K={open:D,transitionStatus:N,side:w,align:C};ie(()=>{!O||!c.current||Object.keys(z.current).length||(z.current={top:O.style.top||"0",left:O.style.left||"0",right:O.style.right,height:O.style.height,bottom:O.style.bottom,minHeight:O.style.minHeight,maxHeight:O.style.maxHeight,marginTop:O.style.marginTop,marginBottom:O.style.marginBottom})},[c,O]),ie(()=>{D||E||(U.current=!1,Y.current=!1,bo(O,z.current))},[D,E,O,c]),ie(()=>{const ne=c.current;if(!D||!Q||!O||!ne||E&&!R||l.state.transitionStatus==="ending")return;if(U.current=!0,ne.style.removeProperty("--transform-origin"),!E){L.request(()=>x(H||ne));return}const $=dC(ne);try{let q=p.current;q?.isConnected||(q=!ke.hasSelectedValue(l.state)&&h.current?.isConnected?h.current:null);const ue=g.current,le=tt(O),Ae=le.getComputedStyle(O),se=le.getComputedStyle(ne),he=Be(Q),re=hc(Q),oe=$r(Q.getBoundingClientRect(),re),ae=$r(O.getBoundingClientRect(),re),ge=oe.height,me=H||ne,W=me.scrollHeight,G=parseFloat(se.borderBottomWidth),be=parseFloat(Ae.marginTop)||10,X=parseFloat(Ae.marginBottom)||10,te=parseFloat(Ae.minHeight)||100,Ee=Ac(se),Se=5,Le=5,Ye=20,Oe=he.documentElement.clientHeight-be-X,at=he.documentElement.clientWidth,qe=Oe-oe.bottom+ge;let Ze,dt=F==="rtl"?oe.right-ae.width:oe.left,Ie=0;if(q&&ue){const rt=$r(ue.getBoundingClientRect(),re);Ze=$r(q.getBoundingClientRect(),re),dt=ae.left+(F==="rtl"?rt.right-Ze.right:rt.left-Ze.left);const kt=rt.top-oe.top+rt.height/2;Ie=Ze.top-ae.top+Ze.height/2-kt}const He=qe+Ie+X+G;let _e=Math.min(Oe,He);const et=Oe-be-X,Re=He-_e,Ue=at-Le;O.style.left=`${ar(dt,Se,Ue-ae.width)}px`,O.style.height=`${_e}px`,O.style.maxHeight="none",O.style.marginTop=`${be}px`,O.style.marginBottom=`${X}px`,ne.style.height="100%";const ze=Jr(me),Je=Re>=ze-Tt;Je&&(_e=Math.min(Oe,ae.height)-(Re-ze));const ht=oe.top<Ye||oe.bottom>Oe-Ye||Math.ceil(_e)+Tt<Math.min(W,te),ft=(le.visualViewport?.scale??1)!==1&&sn;if(ht||ft){bo(O,z.current),S(!1);return}const St=Math.max(te,_e);if(Je){const rt=Math.max(0,Oe-He);O.style.top=ae.height>=et?"0":`${rt}px`,O.style.height=`${_e}px`,me.scrollTop=Jr(me)}else O.style.bottom="0",me.scrollTop=Re;if(Ze){const rt=ae.top,kt=ae.height,Rt=Ze.top+Ze.height/2,pt=ar(kt>0?(Rt-rt)/kt*100:50,0,100);ne.style.setProperty("--transform-origin",`50% ${pt}%`)}(St===Oe||_e>=Ee)&&(Y.current=!0),x(me),v&&l.state.selectedIndex===null&&l.state.activeIndex===null&&b.current[0]!=null&&l.set("activeIndex",0)}finally{$()}},[l,D,O,Q,g,h,p,c,x,E,S,L,H,b,v,F,R]),d.useEffect(()=>{if(!E||!O||!D)return;const ne=tt(O);function $(q){A(!1,Ce(tp,q))}return Fe(ne,"resize",$)},[A,E,O,D]);const ee={...H?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":m||void 0,id:`${M}-list`},onKeyDown(ne){k&&Oo.has(ne.key)&&ne.stopPropagation()},onScroll(ne){H||Z(ne.currentTarget)},...E&&{style:H?{height:"100%"}:yf},className:!H&&E?Vs.className:void 0},ce=Me("div",t,{ref:[n,c],state:K,stateAttributesMapping:cC,props:[T,ee,Lo(N),a]});return u.jsxs(d.Fragment,{children:[!_&&Vs.getElement(B),u.jsx(Fi,{context:y,modal:!1,disabled:!P,openInteractionType:j,returnFocus:i,restoreFocus:!0,children:ce})]})});function Ac(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Jr(e){return Aa(e.scrollHeight,e.clientHeight)}function hc(e){return bu.getScale(e)}function lr(e,t,n){return e/n[t]}function $r(e,t){return hr({x:lr(e.x,"x",t),y:lr(e.y,"y",t),width:lr(e.width,"x",t),height:lr(e.height,"y",t)})}const gc=[["transform","none"],["scale","1"],["translate","0 0"]];function dC(e){const{style:t}=e,n={};for(const[r,o]of gc)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of gc){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}const fC=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a,scrollHandlerRef:l,multiple:c}=Vt(),{alignItemWithTriggerActive:f}=ha(),A=we(a,ke.hasScrollArrows),g=we(a,ke.openMethod),p={id:`${we(a,ke.id)}-list`,role:"listbox","aria-multiselectable":c||void 0,onScroll(x){l.current?.(x.currentTarget)},...f&&{style:yf},className:A&&g!=="touch"?Vs.className:void 0},m=a.useStateSetter("listElement");return Me("div",t,{ref:[n,m],props:[p,i]})}),Cf=d.createContext(void 0);function ga(){const e=d.useContext(Cf);if(!e)throw new Error(nt(57));return e}const pC=d.memo(d.forwardRef(function(t,n){const{render:r,className:o,style:s,value:i=null,label:a,disabled:l=!1,nativeButton:c=!1,...f}=t,A=d.useRef(null),g=Go({guess:!0,label:a,textRef:A}),{store:h,itemProps:p,setOpen:m,setValue:x,selectionRef:I,typingRef:b,valuesRef:v,multiple:y,selectedItemTextRef:w,disabled:C,readOnly:E}=Vt(),R=C||l,S=we(h,ke.isActive,g.index),k=we(h,ke.open),F=we(h,ke.isSelected,i),B=we(h,ke.isSelectedByFocus,g.index),_=we(h,ke.isItemEqualToValue),M=g.index,D=d.useRef(null);ie(()=>{const L=v.current;return L[M]=i,()=>{delete L[M]}},[M,i,v]),ie(()=>{const L=h.state.value;let Z=L;y&&Array.isArray(L)&&(Z=L.length>0?L[L.length-1]:void 0),Z!==void 0&&Zn(i,Z,_)&&(h.set("selectedIndex",M),A.current&&(w.current=A.current))},[M,y,_,h,i,w]);const j=d.useRef("mouse"),P=d.useRef(!1),{getButtonProps:T,buttonRef:N}=Gt({disabled:R,focusableWhenDisabled:!0,native:c,composite:!0}),Q={disabled:R,selected:F,highlighted:S};function O(L){if(C||E)return;const Z=h.state.value;if(y){const K=Array.isArray(Z)?Z:[],ee=F?Yy(K,i,_):[...K,i];x(ee,Ce(cr,L))}else x(i,Ce(cr,L)),m(!1,Ce(cr,L))}function H(){I.current.dragY=0}const Y={role:"option","aria-selected":F,tabIndex:k&&S?0:-1,onKeyDown(L){h.set("activeIndex",M),L.key===" "&&b.current&&L.preventDefault()},onClick(L){const Z=j.current!=="touch",K=L.nativeEvent.pointerType,ee=Z&&pi(L.nativeEvent)&&(K!==void 0||S),ce=Z&&!ee&&!P.current;P.current=!1,!(R||ce)&&O(L.nativeEvent)},onPointerEnter(L){j.current=L.pointerType},onPointerMove(L){if(L.pointerType==="mouse"&&L.buttons===1){const Z=I.current;Z.dragY+=L.movementY,Z.dragY**2>=64&&(Z.allowUnselectedMouseUp=!0)}},onPointerDown(L){j.current=L.pointerType,P.current=!0,H()},onMouseUp(){if(H(),R||j.current==="touch"||P.current)return;const L=!I.current.allowSelectedMouseUp&&F,Z=!I.current.allowUnselectedMouseUp&&!F;L||Z||(P.current=!0,D.current?.click(),P.current=!1)}},U=Me("div",t,{ref:[N,n,g.ref,D],state:Q,props:[p,Y,f,T]}),z=d.useMemo(()=>({selected:F,index:M,textRef:A,selectedByFocus:B}),[F,M,A,B]);return u.jsx(Cf.Provider,{value:z,children:U})})),AC=d.forwardRef(function(t,n){const{selected:r}=ga();return t.keepMounted||r?u.jsx(hC,{...t,ref:n}):null}),hC=d.memo(d.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:a}=ga(),l=d.useRef(null),{transitionStatus:c,setMounted:f}=Jn(a),g=Me("span",e,{ref:[t,l],state:{selected:a,transitionStatus:c},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:Bn});return Yt({open:a,ref:l,onComplete(){a||f(!1)}}),g})),gC=d.memo(d.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:s}=ga(),{firstItemTextRef:i,selectedItemTextRef:a}=Vt(),{render:l,className:c,style:f,...A}=t,g=d.useCallback(p=>{p&&(r===0&&(i.current=p),s&&(a.current=p))},[i,a,r,s]);return Me("div",t,{ref:[g,n,o],props:A})})),If=d.forwardRef(function(t,n){const{render:r,className:o,style:s,direction:i,keepMounted:a,...l}=t,c=i==="up",{store:f,popupRef:A,listRef:g,handleScrollArrowVisibility:h,scrollArrowsMountedCountRef:p}=Vt(),{side:m,scrollDownArrowRef:x,scrollUpArrowRef:I}=ha(),b=c?ke.scrollUpArrowVisible:ke.scrollDownArrowVisible,v=we(f,b),y=we(f,ke.openMethod),w=v&&y!=="touch",C=ut(),E=c?I:x,{mounted:R,transitionStatus:S,setMounted:k}=Jn(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:E,onComplete(){w||k(!1)}});const _=Me("div",t,{ref:[n,E],state:{direction:i,visible:w,side:m,transitionStatus:S},props:[{"aria-hidden":!0,children:c?"▲":"▼",style:{position:"absolute"},onMouseMove(D){if(D.movementX===0&&D.movementY===0||C.isStarted())return;f.set("activeIndex",null);function j(){const P=f.state.listElement??A.current;if(!P)return;f.set("activeIndex",null),h(P);const T=Aa(P.scrollHeight,P.clientHeight),N=xo(P.scrollTop,T),Q=N===(c?0:T),O=g.current;if(N!==P.scrollTop&&(P.scrollTop=N),Q){C.clear();return}if(O.length>0){const H=E.current?.offsetHeight||0;P.scrollTop=mC(O,c,N,P.clientHeight,H,T)}C.start(40,j)}C.start(40,j)},onMouseLeave(){C.clear()}},l],stateAttributesMapping:Bn});return R||a?_:null});function mC(e,t,n,r,o,s){if(t){let f=0;const A=n+o-Tt;for(let p=0;p<e.length;p+=1){const m=e[p];if(m&&m.offsetTop>=A){f=p;break}}const g=Math.max(0,f-1),h=e[g];return g<f&&h?xo(h.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 A=e[f];if(A&&A.offsetTop+A.offsetHeight>a){i=Math.max(0,f-1);break}}const l=Math.min(e.length-1,i+1),c=e[l];return l>i&&c?xo(c.offsetTop+c.offsetHeight-r+o,s):s}const xC=d.forwardRef(function(t,n){return u.jsx(If,{...t,ref:n,direction:"down"})}),bC=d.forwardRef(function(t,n){return u.jsx(If,{...t,ref:n,direction:"up"})}),vC=Zy;function yC({className:e,...t}){return u.jsx(tC,{"data-slot":"select-value",className:fe("flex flex-1 text-left",e),...t})}function CC({className:e,size:t="default",children:n,...r}){return u.jsxs(qy,{"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,u.jsx(nC,{render:u.jsx(Er,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function IC({className:e,children:t,side:n="bottom",sideOffset:r=4,align:o="center",alignOffset:s=0,alignItemWithTrigger:i=!0,...a}){return u.jsx(rC,{children:u.jsx(sC,{side:n,sideOffset:r,align:o,alignOffset:s,alignItemWithTrigger:i,className:"isolate z-50",children:u.jsxs(uC,{"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:[u.jsx(wC,{}),u.jsx(fC,{children:t}),u.jsx(kC,{})]})})})}function ys({className:e,children:t,...n}){return u.jsxs(pC,{"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:[u.jsx(gC,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),u.jsx(AC,{render:u.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:u.jsx(Mc,{className:"pointer-events-none"})})]})}function wC({className:e,...t}){return u.jsx(bC,{"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:u.jsx(li,{})})}function kC({className:e,...t}){return u.jsx(xC,{"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:u.jsx(Er,{})})}const wf=d.createContext(void 0);function EC(){const e=d.useContext(wf);if(e===void 0)throw new Error(nt(63));return e}const kf={...ri,checked(e){return e?{"data-checked":""}:{"data-unchecked":""}}},SC=d.forwardRef(function(t,n){const{checked:r,className:o,defaultChecked:s,"aria-labelledby":i,form:a,id:l,inputRef:c,name:f,nativeButton:A=!1,onCheckedChange:g,readOnly:h=!1,required:p=!1,disabled:m=!1,render:x,uncheckedValue:I,value:b,style:v,...y}=t,{clearErrors:w}=oi(),{state:C,setTouched:E,setDirty:R,validityData:S,setFilled:k,setFocused:F,validationMode:B,disabled:_,name:M,validation:D}=wo(),{labelId:j}=si(),P=_||m,T=M??f,N=d.useRef(null),Q=Qt(N,c,D.inputRef),O=d.useRef(null),H=It(),Y=ai({id:l,implicit:!1,controlRef:O}),U=A?void 0:Y,[z,L]=rn({controlled:r,default:!!s,name:"Switch",state:"checked"});ii(O,H,z,void 0,!P,f),ie(()=>{N.current&&k(N.current.checked)},[k]),Ko(z,()=>{w(T),R(z!==S.initialValue),k(z),D.change(z)});const{getButtonProps:Z,buttonRef:K}=Gt({disabled:P,native:A}),ee=jc(i,j,N,!A,U),ce={id:A?Y:H,role:"switch","aria-checked":z,"aria-readonly":h||void 0,"aria-required":p||void 0,"aria-labelledby":ee,onFocus(){P||F(!0)},onBlur(){const ue=N.current;!ue||P||(E(!0),F(!1),B==="onBlur"&&D.commit(ue.checked))},onClick(ue){if(h||P)return;ue.preventDefault();const le=N.current;le&&ti(le,ue)}},ne={...D.getValidationProps(P),checked:z,disabled:P,form:a,id:U,name:T,required:p,style:T?Ei:Mo,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:Q,onChange(ue){if(ue.nativeEvent.defaultPrevented)return;if(h){ue.preventDefault();return}const le=ue.currentTarget.checked,Ae=Ce(Pt,ue.nativeEvent);g?.(le,Ae),!Ae.isCanceled&&L(le)},onClick(ue){ue.stopPropagation()},onFocus(){O.current?.focus()},...b!==void 0?{value:b}:it},$=d.useMemo(()=>({...C,checked:z,disabled:P,readOnly:h,required:p}),[C,z,P,h,p]),q=Me("span",t,{state:$,ref:[n,O,K],props:[ce,y,Z,ue=>D.getValidationProps(P,ue)],stateAttributesMapping:kf});return u.jsxs(wf.Provider,{value:$,children:[q,!z&&T&&I!==void 0&&u.jsx("input",{type:"hidden",form:a,name:T,value:I,disabled:P}),u.jsx("input",{...ne,suppressHydrationWarning:!0})]})}),RC=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=EC();return Me("span",t,{state:a,ref:n,stateAttributesMapping:kf,props:i})});function nr({className:e,size:t="default",...n}){return u.jsx(SC,{"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:u.jsx(RC,{"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 DC({frozen:e,values:t,defaults:n,candidates:r,candidatesPort:o,selectedIconRef:s,uploadedIconUrl:i,iconAnalysis:a,iconComposition:l,iconComposeError:c,iconBackground:f,iconScale:A,onIconBackgroundChange:g,onIconScaleChange:h,selectedTrayRef:p,uploadedTrayUrl:m,selectedPort:x,targetDirExists:I,onPickIconCandidate:b,onUploadIcon:v,onClearIcon:y,onPickTray:w,onUploadTray:C,onClearTray:E,onPatch:R,onConfirm:S}){return u.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[u.jsx(Wy,{values:t,defaults:n,frozen:e,iconCandidates:r,iconCandidatesPort:o,uploadedIconUrl:i,selectedIconRef:s,iconAnalysis:a,iconComposition:l,iconComposeError:c,iconBackground:f,iconScale:A,onIconBackgroundChange:g,onIconScaleChange:h,onPickIconCandidate:b,onUploadIcon:v,onClearIcon:y,onPatch:R}),u.jsx(oa,{className:"mt-4 border-t border-border pt-1",children:u.jsxs(sa,{value:"advanced",className:"border-b-0",children:[u.jsx(ia,{children:"高级选项"}),u.jsxs(aa,{className:"space-y-4",children:[u.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[u.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[u.jsx(nr,{id:"showStartupTerminal",checked:t.showStartupTerminal,disabled:e,onCheckedChange:k=>R({showStartupTerminal:k})}),u.jsxs("div",{children:[u.jsx(ct,{htmlFor:"showStartupTerminal",className:"text-foreground",children:"显示启动终端"}),u.jsxs("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:[u.jsx(ro,{className:"mr-0.5 inline size-3"}),"应用启动时打开独立终端窗口,实时显示命令的 PTY 输出(可交互)。"]})]})]}),u.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[u.jsx(nr,{id:"showAddressBar",checked:t.showAddressBar,disabled:e,onCheckedChange:k=>R({showAddressBar:k})}),u.jsxs("div",{children:[u.jsx(ct,{htmlFor:"showAddressBar",className:"text-foreground",children:"显示地址栏"}),u.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"服务窗口顶部显示地址栏(Web Navigation API 管理导航)。"})]})]}),u.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[u.jsx(nr,{id:"imageSmoothingEnabled",checked:t.imageSmoothingEnabled,disabled:e,onCheckedChange:k=>R({imageSmoothingEnabled:k})}),u.jsxs("div",{children:[u.jsx(ct,{htmlFor:"imageSmoothingEnabled",className:"text-foreground",children:"平滑缩放(imageSmoothingEnabled)"}),u.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"默认开启高质量缩放;上传低分辨率像素风图标时关闭可保留硬边锯齿(等比放大应用到应用图标前景与托盘图标)。"})]})]}),u.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[u.jsx(nr,{id:"developerMode",checked:t.developerMode,disabled:e,onCheckedChange:k=>R({developerMode:k})}),u.jsxs("div",{children:[u.jsx(ct,{htmlFor:"developerMode",className:"text-foreground",children:"允许开发者模式"}),u.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"仅表示生成应用内的 WebView DevTools 准入;不改变其它行为。"})]})]})]}),u.jsxs("div",{children:[u.jsx(ct,{children:"托盘图标"}),u.jsx("p",{className:"mb-1.5 mt-0.5 text-[11px] text-muted-foreground",children:"默认与应用图标一致;纯色候选适合系统托盘(macOS 模板风格)。"}),u.jsx(Ly,{candidates:r,port:o,disabled:e,selectedRef:p,uploadedUrl:m,includeVariants:!0,defaultLabel:"默认跟随应用图标",onPick:w,onUpload:C,onClear:E})]}),u.jsxs("div",{children:[u.jsx(ct,{htmlFor:"pm",children:"包管理器"}),u.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] leading-relaxed text-muted-foreground",children:"仅为生成的应用安装依赖时使用的工具(决定 install 命令与锁文件形态),不影响应用本身的运行方式——生成的应用始终以 Node 启动。默认自动跟随你启动向导所用的包管理器,一般无需修改。"}),u.jsxs(vC,{value:t.pm,disabled:e,onValueChange:k=>R({pm:k}),children:[u.jsx(CC,{id:"pm",className:"mt-0",children:u.jsx(yC,{})}),u.jsxs(IC,{children:[u.jsx(ys,{value:"npm",children:"npm"}),u.jsx(ys,{value:"pnpm",children:"pnpm"}),u.jsx(ys,{value:"bun",children:"bun"})]})]})]}),u.jsxs("div",{className:"rounded-lg border border-border p-3",children:[u.jsx(ct,{children:"生成位置"}),u.jsx("p",{className:"mt-1 font-mono text-[11px] break-all text-muted-foreground",children:n.targetDir||"~/.opentray/create/<应用名>"}),u.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-muted-foreground",children:"生成的项目默认落在 OpenTray 主目录下,同一命令重复创建会落到同一位置; 也可在启动向导时通过位置参数指定其他目录。"}),I?u.jsx("p",{className:"mt-2 text-[11px] font-medium text-amber-400",children:"目标目录已存在且非空——继续生成会失败,或开启下方强制覆盖。"}):null,u.jsxs("div",{className:"mt-3 flex items-start gap-3",children:[u.jsx(nr,{id:"force-overwrite",checked:t.force,disabled:e,onCheckedChange:k=>R({force:k})}),u.jsxs("div",{children:[u.jsx(ct,{htmlFor:"force-overwrite",className:"text-foreground",children:"强制覆盖已存在的目录"}),u.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"开启后将清空目标目录内的现有内容并重新生成(等同 --force)。请确认目录中没有你需要的文件。"})]})]})]})]})]})}),u.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[u.jsx(Qe,{onClick:S,disabled:e,children:"确定创建应用"}),u.jsx("span",{className:"text-xs text-muted-foreground",children:x!==void 0?`已选服务 :${x}(点击状态栏服务可切换)`:"未运行也不影响:应用启动时会自行嗅探命令的监听端口"})]})]})}function FC({tags:e,onTagsChange:t,disabled:n=!1,placeholder:r,className:o,...s}){const[i,a]=d.useState(""),l=()=>{i.length!==0&&(t([...e,i]),a(""))};return u.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((c,f)=>u.jsxs("span",{className:"flex items-center gap-1 rounded bg-accent px-1.5 py-0.5 text-accent-foreground",children:[u.jsx("span",{className:"max-w-56 truncate",title:c,children:c}),n?null:u.jsx("button",{type:"button","aria-label":`移除参数 ${f+1}`,className:"text-muted-foreground hover:text-foreground",onClick:()=>{t(e.filter((A,g)=>g!==f))},children:u.jsx(ci,{className:"size-3"})})]},`${f}:${c}`)),u.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:c=>a(c.target.value),onKeyDown:c=>{if(c.key==="Enter"){c.preventDefault(),l();return}c.key==="Backspace"&&i.length===0&&e.length>0&&(c.preventDefault(),t(e.slice(0,-1)))},onBlur:l,...s})]})}function BC({command:e,onCommandChange:t,argv:n,onArgvChange:r,runAlive:o,frozen:s,failedReason:i,commandOptions:a,defaultCwd:l,onCommandOptionsChange:c,onRun:f,onStop:A}){const g=h=>{c({...a,...h})};return u.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[u.jsxs("div",{className:"flex gap-2",children:[a.argsMode==="array"?u.jsx(FC,{tags:n,onTagsChange:r,disabled:o,"aria-label":"命令参数(argv)"}):u.jsx(wn,{className:"font-mono",placeholder:"npx somecommand start --xx",value:e,disabled:o,onChange:h=>t(h.target.value),onKeyDown:h=>{h.key==="Enter"&&!o&&f()}}),o?u.jsxs(Qe,{variant:"destructive",onClick:A,"aria-label":"中断命令",children:[u.jsx(Up,{}),"中断"]}):u.jsxs(Qe,{disabled:s,onClick:f,"aria-label":"运行命令",children:[u.jsx(Np,{}),"运行"]})]}),i!==void 0?u.jsx("p",{className:"mt-2 font-mono text-xs text-red-400",children:i}):null,u.jsx(oa,{defaultValue:["command"],className:"mt-3 border-t border-border pt-1",children:u.jsxs(sa,{value:"command",className:"border-b-0",children:[u.jsx(ia,{children:u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx(Lp,{className:"size-4 text-muted-foreground"}),"命令选项"]})}),u.jsxs(aa,{className:"space-y-4",children:[u.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[u.jsxs("div",{children:[u.jsx(ct,{children:"参数输入模式"}),u.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"数组模式逐个输入参数(回车添加),原样传递、绝不拆分。"}),u.jsxs(Dd,{variant:"outline",size:"sm",spacing:0,value:[a.argsMode],onValueChange:h=>{const p=h[0];(p==="string"||p==="array")&&g({argsMode:p})},disabled:s,children:[u.jsx(ho,{value:"string",children:"字符串"}),u.jsx(ho,{value:"array",children:"数组 (argv)"})]})]}),u.jsxs("div",{children:[u.jsx(ct,{htmlFor:"cmd-cwd",children:"工作目录 (cwd)"}),u.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空使用用户主目录(下方完整路径);相对路径按主目录解析。"}),u.jsx(wn,{id:"cmd-cwd",className:"mt-0 font-mono text-xs",disabled:s,value:a.cwd,placeholder:l.length>0?`默认:${l}`:"默认:用户主目录",title:l,onChange:h=>g({cwd:h.target.value})}),l.length>0&&a.cwd.trim().length===0?u.jsx("p",{className:"mt-1 font-mono text-[11px] break-all text-muted-foreground",children:l}):null]})]}),u.jsxs("div",{children:[u.jsx(ct,{children:"环境变量 (env)"}),u.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"启动命令时叠加在当前环境之上;同时写入生成的应用。"}),u.jsxs("div",{className:"space-y-1.5",children:[a.env.length===0?u.jsx("p",{className:"text-xs text-muted-foreground",children:"未配置"}):a.env.map((h,p)=>u.jsxs("div",{className:"flex gap-1.5",children:[u.jsx(wn,{className:"font-mono text-xs",disabled:s,"aria-label":`env 名称 ${p+1}`,value:h.key,placeholder:"NAME",onChange:m=>{const x=[...a.env];x[p]={...h,key:m.target.value},g({env:x})}}),u.jsx(wn,{className:"font-mono text-xs",disabled:s,"aria-label":`env 值 ${p+1}`,value:h.value,placeholder:"value",onChange:m=>{const x=[...a.env];x[p]={...h,value:m.target.value},g({env:x})}}),u.jsx(Qe,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":"删除环境变量",onClick:()=>{g({env:a.env.filter((m,x)=>x!==p)})},children:"×"})]},p)),u.jsxs(Qe,{variant:"outline",size:"sm",disabled:s,onClick:()=>g({env:[...a.env,{key:"",value:""}]}),children:[u.jsx(ro,{className:"size-3.5"}),"添加变量"]})]})]})]})]})})]})}const Cs=["scaffold","icon","install"];function MC({open:e,phase:t,frozenValues:n,iconSrc:r,iconLabel:o,traySrc:s,trayLabel:i,selectedPort:a,currentStep:l,logs:c,error:f,result:A,onBack:g,onCreate:h,onShare:p,onOpenApp:m,onClose:x,confirmError:I,onOpenChange:b}){const v=d.useRef(null);d.useEffect(()=>{v.current?.scrollTo({top:v.current.scrollHeight})},[c.length]);const y=w=>{const C=Cs.indexOf(w),E=Cs.indexOf(l);return t==="success"||C<E?"done":C===E?"active":""};return u.jsx(Fd,{open:e,onOpenChange:w=>{t==="pending"&&w===!1||b(w)},children:u.jsx(Bd,{className:"max-w-xl",children:t==="confirm"?u.jsxs(u.Fragment,{children:[u.jsxs(sr,{children:[u.jsx(ir,{children:"确认应用信息"}),u.jsx(Md,{children:"表单已固定,以下值将用于生成应用。"})]}),u.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-sm",children:[u.jsx("dt",{className:"text-muted-foreground",children:"App ID"}),u.jsx("dd",{className:"font-mono break-all",children:n.appId}),u.jsx("dt",{className:"text-muted-foreground",children:"应用名称"}),u.jsx("dd",{className:"break-all",children:n.appName}),u.jsx("dt",{className:"text-muted-foreground",children:"图标"}),u.jsxs("dd",{className:"flex flex-wrap items-center gap-4",children:[u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"icon-checker flex size-10 items-center justify-center overflow-hidden rounded-md","aria-label":"应用图标预览",children:r!==void 0?u.jsx("img",{src:r,alt:"应用图标",className:"size-full object-contain"}):u.jsx("span",{className:"text-[10px] text-muted-foreground",children:"无"})}),u.jsxs("span",{className:"flex flex-col",children:[u.jsx("span",{className:"text-xs leading-tight",children:"应用图标"}),u.jsx("span",{className:"font-mono text-[10px] leading-tight text-muted-foreground",children:o})]})]}),u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"icon-checker flex size-10 items-center justify-center overflow-hidden rounded-md","aria-label":"托盘图标预览",children:s!==void 0?u.jsx("img",{src:s,alt:"托盘图标",className:"size-full object-contain"}):u.jsx("span",{className:"text-[10px] text-muted-foreground",children:"文字"})}),u.jsxs("span",{className:"flex flex-col",children:[u.jsx("span",{className:"text-xs leading-tight",children:"托盘图标"}),u.jsx("span",{className:"font-mono text-[10px] leading-tight text-muted-foreground",children:i})]})]})]}),u.jsx("dt",{className:"text-muted-foreground",children:"服务端口"}),u.jsx("dd",{className:"font-mono",children:a!==void 0?`:${a}(生成后运行时重新嗅探)`:"运行时嗅探"}),u.jsx("dt",{className:"text-muted-foreground",children:"包管理器"}),u.jsx("dd",{children:n.pm})]}),I!==void 0?u.jsx("p",{className:"text-xs font-medium text-red-400",children:I}):null,u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(Qe,{variant:"outline",onClick:g,children:"返回修改"}),u.jsx(Qe,{variant:"outline",onClick:p,children:"分享"}),u.jsx(Qe,{onClick:h,children:"确认生成"})]})]}):t==="pending"?u.jsxs(u.Fragment,{children:[u.jsx(sr,{children:u.jsx(ir,{children:"正在生成应用…"})}),u.jsx("div",{className:"flex flex-wrap gap-1.5",children:Cs.map(w=>u.jsx(no,{variant:y(w)==="done"?"default":"secondary",children:w},w))}),u.jsx("div",{ref:v,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:c.join(`
20
- `)})]}):t==="success"&&A!==void 0?u.jsxs(u.Fragment,{children:[u.jsx(sr,{children:u.jsxs(ir,{className:"flex items-center gap-2",children:[u.jsx(dp,{className:"size-5 text-emerald-400"}),"应用已生成"]})}),u.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-sm",children:[u.jsx("dt",{className:"text-muted-foreground",children:"项目目录"}),u.jsx("dd",{className:"font-mono break-all",children:A.projectDir}),A.bundlePath?u.jsxs(u.Fragment,{children:[u.jsx("dt",{className:"text-muted-foreground",children:"macOS Bundle"}),u.jsx("dd",{className:"font-mono break-all",children:A.bundlePath})]}):null]}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(Qe,{variant:"outline",onClick:x,children:"完成"}),u.jsxs(Qe,{onClick:m,children:[u.jsx(Pc,{}),"打开应用"]})]}),u.jsx("p",{className:"text-xs text-muted-foreground",children:A.pinHint})]}):u.jsxs(u.Fragment,{children:[u.jsx(sr,{children:u.jsxs(ir,{className:"flex items-center gap-2",children:[u.jsx(Xp,{className:"size-5 text-red-400"}),"生成失败"]})}),u.jsx("p",{className:"break-all font-mono text-xs text-red-400",children:f??"未知错误"}),u.jsx("div",{className:"flex justify-end",children:u.jsx(Qe,{variant:"outline",onClick:g,children:"返回重试"})})]})})})}const mc=(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 A=o.current;o.current=void 0,A!==void 0&&n.current(...A)},t)},[t]);d.useEffect(()=>s,[s]);const l=d.useRef(a);l.current=a;const c=d.useCallback((...f)=>{l.current(...f)},[]);return c.flush=s,c.cancel=i,c},Ef=d.createContext(void 0);function Sf(){const e=d.useContext(Ef);if(e===void 0)throw new Error(nt(64));return e}const ma={tabActivationDirection:e=>({"data-activation-direction":e})},PC=d.forwardRef(function(t,n){const{className:r,defaultValue:o=0,onValueChange:s,orientation:i="horizontal",render:a,value:l,style:c,...f}=t,A=t.defaultValue!==void 0,g=d.useRef([]),[h,p]=d.useState(()=>new Map),[m,x]=rn({controlled:l,default:o,name:"Tabs",state:"value"}),I=l!==void 0,[b,v]=d.useState(()=>new Map),y=d.useRef(void 0),w=d.useCallback(K=>Zs(b,K),[b]),[C,E]=d.useState(()=>({previousValue:m,tabActivationDirection:"none"})),{previousValue:R,tabActivationDirection:S}=C;let k=S,F=!1;R!==m&&(k=xc(R,m,i,b),F=R!=null&&m!=null&&w(m)==null);const B=F?R:m,_=R!==B||S!==k;ie(()=>{_&&E({previousValue:B,tabActivationDirection:k})},[B,_,k]);const M=de((K,ee)=>{const ce=xc(m,K,i,b);ee.activationDirection=ce,s?.(K,ee),!ee.isCanceled&&x(K)}),D=de((K,ee)=>{s?.(K,Ce(ee,void 0,void 0,{activationDirection:"none"}))}),j=de((K,ee)=>(p(ce=>{const ne=new Map(ce);return ne.set(K,ee),ne}),()=>{p(ce=>{if(ce.get(K)!==ee)return ce;const ne=new Map(ce);return ne.delete(K),ne})})),P=d.useCallback(K=>h.get(K),[h]),T=d.useCallback(K=>{for(const ee of b.values())if(K===ee.value)return ee.id},[b]),N=d.useMemo(()=>({getTabElementBySelectedValue:w,getTabIdByPanelValue:T,getTabPanelIdByValue:P,onValueChange:M,orientation:i,registerMountedTabPanel:j,setTabMap:v,tabActivationDirection:k,value:m}),[w,T,P,M,i,j,v,k,m]),Q=d.useMemo(()=>{for(const K of b.values())if(K.value===m)return K},[b,m]),O=d.useMemo(()=>{for(const K of b.values())if(!K.disabled)return K.value},[b]),H=d.useRef(!A),Y=d.useRef(o),U=d.useRef(A),z=d.useRef(!1);ie(()=>{if(I)return;function K($,q){x($),E({previousValue:$,tabActivationDirection:"none"}),D($,q),H.current=!1}if(b.size===0){z.current&&m!==null&&!y.current?.isConnected&&K(null,Ea);return}z.current=!0,y.current=b.keys().next().value;const ee=Q?.disabled,ce=Q==null&&m!==null;if(!ee&&m===Y.current&&(U.current=!1),U.current&&ee&&m===Y.current)return;const ne=H.current;if(ee||ce){const $=O??null;if(m===$){H.current=!1;return}let q=Ea;ne?q=ka:ee&&(q=Dc),K($,q);return}ne&&Q!=null&&(D(m,ka),H.current=!1)},[O,I,D,Q,x,b,m]);const Z=Me("div",t,{state:{orientation:i,tabActivationDirection:k},ref:n,props:f,stateAttributesMapping:ma});return u.jsx(Ef.Provider,{value:N,children:u.jsx(Mr,{elementsRef:g,children:Z})})});function Zs(e,t){for(const[n,r]of e.entries())if(t===r.value)return n;return null}function xc(e,t,n,r){if(e==null||t==null)return"none";const[o,s,i]=n==="horizontal"?["left","left","right"]:["top","up","down"],a=Zs(r,e),l=Zs(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 c=a.getBoundingClientRect()[o],f=l.getBoundingClientRect()[o];return f<c?s:f>c?i:"none"}const Rf=d.createContext(void 0);function TC(){const e=d.useContext(Rf);if(e===void 0)throw new Error(nt(65));return e}const _C=d.forwardRef(function(t,n){const{className:r,disabled:o=!1,render:s,value:i,id:a,nativeButton:l=!0,style:c,...f}=t,{value:A,getTabPanelIdByValue:g,onValueChange:h,orientation:p,tabActivationDirection:m}=Sf(),{activateOnFocus:x,registerTabResizeObserverElement:I,tabsListElement:b}=TC(),{highlightedIndex:v,onHighlightedIndexChange:y}=ni(),w=It(a),C=d.useMemo(()=>({disabled:o,id:w,value:i}),[o,w,i]),{compositeProps:E,compositeRef:R,index:S}=od({metadata:C}),k=i===A,F=d.useRef(!1),B=d.useRef(null),_=de(z=>{B.current?.(),B.current=z?I(z):null});ie(()=>{if(F.current){F.current=!1;return}if(!(k&&S>-1&&v!==S))return;const z=b;if(z!=null){const L=bt(Be(z));if(L&&ve(z,L))return}o||y(S)},[k,S,v,y,o,b]);const{getButtonProps:M,buttonRef:D}=Gt({disabled:o,native:l,focusableWhenDisabled:!0}),j=g(i),P=d.useRef(!1),T=d.useRef(!1);function N(z){h(i,Ce(Pt,z.nativeEvent,void 0,{activationDirection:"none"}))}function Q(z){k||o||N(z)}function O(z){k||o||x&&(!P.current||T.current)&&N(z)}function H(z){if(k||o)return;P.current=!0,T.current=z.button===0;const L=Be(z.currentTarget);function Z(){P.current=!1,T.current=!1,L.removeEventListener("pointerup",Z),L.removeEventListener("pointercancel",Z)}L.addEventListener("pointerup",Z),L.addEventListener("pointercancel",Z)}return Me("button",t,{state:{disabled:o,active:k,orientation:p,tabActivationDirection:m},ref:[n,D,R,_],props:[E,{role:"tab","aria-controls":j,"aria-selected":k,id:w,onClick:Q,onFocus:O,onPointerDown:H,[Ed]:k?"":void 0,onKeyDownCapture(){F.current=!0}},f,M],stateAttributesMapping:ma})}),jC=d.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:o,loopFocus:s=!0,render:i,style:a,...l}=t,{orientation:c,setTabMap:f,tabActivationDirection:A}=Sf(),[g,h]=d.useState(0),[p,m]=d.useState(null),x=d.useRef(new Set),I=d.useRef(new Set),b=d.useRef(null);ie(()=>{if(typeof ResizeObserver>"u")return;const R=new ResizeObserver(()=>{x.current.forEach(S=>{S()})});return b.current=R,p&&R.observe(p),I.current.forEach(S=>{R.observe(S)}),()=>{R.disconnect(),b.current=null}},[p]);const v=de(R=>(x.current.add(R),()=>{x.current.delete(R)})),y=de(R=>(I.current.add(R),b.current?.observe(R),()=>{I.current.delete(R),b.current?.unobserve(R)})),w={orientation:c,tabActivationDirection:A},C={"aria-orientation":c==="vertical"?"vertical":void 0,role:"tablist"},E=d.useMemo(()=>({activateOnFocus:r,registerIndicatorUpdateListener:v,registerTabResizeObserverElement:y,tabsListElement:p}),[r,v,y,p]);return u.jsx(Rf.Provider,{value:E,children:u.jsx(Sd,{render:i,className:o,style:a,state:w,refs:[n,m],props:[C,l],stateAttributesMapping:ma,highlightedIndex:g,enableHomeAndEndKeys:!0,loopFocus:s,orientation:c,onHighlightedIndexChange:h,onMapChange:f,disabledIndices:_t})})});function NC({className:e,orientation:t="horizontal",...n}){return u.jsx(PC,{"data-slot":"tabs","data-orientation":t,className:fe("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const OC=Js("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 HC({className:e,variant:t="default",...n}){return u.jsx(jC,{"data-slot":"tabs-list","data-variant":t,className:fe(OC({variant:t}),e),...n})}function bc({className:e,...t}){return u.jsx(_C,{"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 vc({className:e,size:t="default",...n}){return u.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 yc({className:e,...t}){return u.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 Cc({className:e,...t}){return u.jsx("div",{"data-slot":"card-content",className:fe("px-(--card-spacing)",e),...t})}function KC({className:e,...t}){return u.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 Df=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]),u.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"})});Df.displayName="StableIframe";const WC=e=>{const t=e.trim();if(t.length!==0)try{return new URL(/^https?:\/\//iu.test(t)?t:`http://${t}`).href}catch{return}},Ic=({status:e,services:t,activeTab:n,onJumpToService:r})=>u.jsxs(KC,{className:"h-8 shrink-0 gap-3 overflow-x-auto px-3 py-0 text-[11px] text-muted-foreground",children:[u.jsxs("span",{className:"font-mono whitespace-nowrap",children:["光标 ",e.cursorY,":",e.cursorX]}),u.jsxs("span",{className:"font-mono whitespace-nowrap",children:[e.cols,"×",e.rows]}),u.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}`}),u.jsx("span",{className:"h-3 w-px bg-border"}),t.length===0?u.jsx("span",{children:"嗅探 HTTP 服务中…(未发现不影响创建应用)"}):t.map(o=>u.jsxs(no,{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 LC({command:e,terminalHostRef:t,terminalReady:n,interactive:r,status:o,services:s,iframeTabs:i,activeTab:a,onActiveTabChange:l,onIframeNavigate:c,onIframeHistoryMove:f,onJumpToService:A,className:g}){return u.jsxs("div",{className:fe("flex min-h-0 flex-col gap-2",g),children:[u.jsx(NC,{value:a,onValueChange:l,children:u.jsxs(HC,{variant:"line",className:"w-full justify-start border-b px-2",children:[u.jsxs(bc,{value:"terminal",children:[u.jsx(ro,{className:"size-3.5"}),"终端",!r&&n?u.jsx("span",{className:"text-[10px] text-amber-400",children:"非交互"}):null]}),i.map(h=>u.jsxs(bc,{value:`svc-${h.port}`,children:[u.jsx(Sa,{className:"size-3.5"}),Ky(h.url),":",new URL(h.url).port]},h.port))]})}),u.jsx("div",{className:"flex min-h-0 flex-1 flex-col",hidden:a!=="terminal",children:u.jsxs(vc,{size:"sm",className:"min-h-0 flex-1 gap-0",children:[u.jsx(yc,{className:"border-b [.border-b]:pb-2",children:u.jsxs("span",{className:"tech-ltr flex min-w-0 items-center gap-2 font-mono text-xs text-muted-foreground",children:[u.jsx(ro,{className:"size-4 shrink-0"}),u.jsx("span",{className:"truncate",children:e||"尚未运行命令"})]})}),u.jsxs(Cc,{className:"min-h-0 flex-1 p-0",children:[u.jsx("div",{ref:t,className:"min-h-0 min-w-0 h-full bg-[#05070b] px-1"}),n?null:u.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"正在加载终端渲染器…"})]}),u.jsx(Ic,{status:o,services:s,activeTab:a,onJumpToService:A})]})}),i.map(h=>u.jsx("div",{className:"flex min-h-0 flex-1 flex-col",hidden:a!==`svc-${h.port}`,children:u.jsxs(vc,{size:"sm",className:"min-h-0 flex-1 gap-0",children:[u.jsx(yc,{className:"border-b [.border-b]:pb-2",children:u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx(Qe,{variant:"ghost",size:"icon-sm",disabled:h.historyIndex===0,onClick:()=>f(h.port,-1),"aria-label":"后退",children:u.jsx(np,{})}),u.jsx(Qe,{variant:"ghost",size:"icon-sm",disabled:h.historyIndex>=h.history.length-1,onClick:()=>f(h.port,1),"aria-label":"前进",children:u.jsx(rp,{})}),u.jsx(Qe,{variant:"ghost",size:"icon-sm",onClick:()=>c(h.port,h.url,"replace"),"aria-label":"重新加载",children:u.jsx(op,{})}),u.jsx(Sa,{className:"size-4 shrink-0 text-muted-foreground"}),u.jsx(wn,{className:"tech-ltr h-7 font-mono text-xs",defaultValue:h.url,placeholder:"输入 URL 跳转",onKeyDown:p=>{if(p.key!=="Enter")return;const m=p.target.value,x=WC(m);x!==void 0&&c(h.port,x,"push")}},`${h.port}:${h.historyIndex}:${h.url}`)]})}),u.jsx(Cc,{className:"min-h-0 flex-1 p-0",children:u.jsx(Df,{port:h.port,url:h.url,visible:a===`svc-${h.port}`})}),u.jsx(Ic,{status:o,services:s,activeTab:a,onJumpToService:A})]})},h.port))]})}const wc={appId:"",appName:"",iconPath:"",iconBackground:"transparent",iconScale:.8,trayIconPath:"",force:!1,pm:"npm",showStartupTerminal:!1,showAddressBar:!1,imageSmoothingEnabled:!0,developerMode:!1},QC={appId:"",appName:"",targetDir:"",iconPath:""};function GC(){const{query:e}=hd(),t=e.get("edit"),[n,r]=d.useState(void 0),[o,s]=d.useState(""),[i,a]=d.useState([]),[l,c]=d.useState(Oy),[f,A]=d.useState(""),[g,h]=d.useState(!1),[p,m]=d.useState(!1),x=d.useCallback(J=>{m(J),Kn.set(J)},[]);d.useEffect(()=>(Kn.set(p),()=>Kn.set(!1)),[p]);const[I,b]=d.useState(!1),[v,y]=d.useState("idle"),[w,C]=d.useState(),[E,R]=d.useState(""),[S,k]=d.useState(!0),[F,B]=d.useState(!1),[_,M]=d.useState(),[D,j]=d.useState(wc),[P,T]=d.useState(QC),[N,Q]=d.useState([]),[O,H]=d.useState(),[Y,U]=d.useState(!1),[z,L]=d.useState([]),[Z,K]=d.useState(),[ee,ce]=d.useState(),[ne,$]=d.useState(),[q,ue]=d.useState(),[le,Ae]=d.useState(),[se,he]=d.useState("transparent"),[re,oe]=d.useState(.8),ae=d.useRef(void 0),ge=d.useRef(void 0),me=d.useRef(!1),W=d.useRef(!1),[G,be]=d.useState(),[X,te]=d.useState(),[Ee,Se]=d.useState(),[Le,Ye]=d.useState("terminal"),[Oe,at]=d.useState([]),[qe,Ze]=d.useState({cursorX:0,cursorY:0,cols:0,rows:0}),[dt,Ie]=d.useState(!1),[He,_e]=d.useState("confirm"),[et,Re]=d.useState([]),[Ue,ze]=d.useState(""),[Je,ht]=d.useState(),[ft,St]=d.useState(),[rt,kt]=d.useState(wc),Rt=d.useRef(null),pt=d.useRef(void 0),De=d.useRef([]),Ke=d.useRef(D);Ke.current=D;const gt=d.useRef(v);gt.current=v;const vt=(J,ye,V)=>{if(ye===void 0)return!1;const pe=Number.parseInt(ye.split(":")[1]??"",10);return!J.some(Te=>Te.index===pe)||ye.split(":")[0]!==String(V)},yt=d.useRef(void 0);d.useEffect(()=>{const J=D.iconPath.trim().length>0?D.iconPath.trim():P.iconPath.trim().length>0?P.iconPath.trim():void 0;if(yt.current=J,J===void 0){$(void 0),Ae(void 0),ae.current=void 0;return}J===ae.current&&le!==void 0||(async()=>{try{ue(void 0);const ye=await We("/api/icon-analyze",{path:J});if(!ye.ok)throw new Error("analyze failed");const V=await ye.json();if(yt.current!==J)return;$(V),me.current=!1,he(V.suggested),We("/api/form",{iconBackground:V.suggested});const pe=await We("/api/icon-compose",{foregroundPath:J,background:V.suggested,scale:re});if(!pe.ok)throw new Error("compose failed");const Te=await pe.json();if(yt.current!==J)return;Ae(Te),ae.current=J}catch{$(void 0),Ae(void 0),ue("图标分析或合成失败,预览不可用")}})()},[D.iconPath,P.iconPath]);const Dt=mc(J=>{We("/api/form",{iconScale:J});const ye=Cn();xa(ye,se,J)},250),Ot=J=>{oe(J),Dt(J)},ln=mc(J=>{We("/api/form",{iconBackground:J});const ye=Cn();xa(ye,J,re)},120),Xn=J=>{me.current=!0,he(J),ln(J)},Cn=()=>D.iconPath.trim().length>0?D.iconPath.trim():P.iconPath.trim().length>0?P.iconPath.trim():void 0,xa=d.useCallback(async(J,ye,V)=>{if(J===void 0){$(void 0),Ae(void 0),ae.current=void 0,ge.current=void 0;return}ge.current=J;try{const pe=await We("/api/icon-analyze",{path:J});if(!pe.ok)throw new Error("analyze failed");const Te=await pe.json();if(ge.current!==J)return;$(Te);const mt=await We("/api/icon-compose",{foregroundPath:J,background:ye,scale:V});if(!mt.ok)throw new Error("compose failed");const Zt=await mt.json();if(ge.current!==J)return;Ae(Zt),ae.current=J}catch{$(void 0),Ae(void 0),ue("图标合成失败,预览未更新")}},[]);d.useEffect(()=>{sp()},[]);const Ff=d.useRef(!1);d.useEffect(()=>{t===null||n===t||(r(t),(async()=>{const J=await md(t);if(J.status!==200||"code"in J.data)return;const ye=J.data;if(ye.command?.executable!==void 0&&s(ye.command.executable),ye.command?.args!==void 0&&a([...ye.command.args]),ye.command?.executable!==void 0&&c(V=>({...V,argsMode:"array"})),ye.appName!==void 0){const V=ye.appName;j(pe=>({...pe,appName:V}))}if(ye.icons?.imageSmoothingEnabled!==void 0){const V=ye.icons.imageSmoothingEnabled;j(pe=>({...pe,imageSmoothingEnabled:V}))}if(ye.developerMode!==void 0){const V=ye.developerMode;j(pe=>({...pe,developerMode:V,force:!0}))}if(ye.command?.cwd!==void 0){const V=ye.command.cwd;c(pe=>({...pe,cwd:V}))}if(ye.command?.env!==void 0){const V=Object.entries(ye.command.env).map(([pe,Te])=>({key:pe,value:Te}));c(pe=>({...pe,env:V}))}Ff.current=!0})())},[t,n]),d.useEffect(()=>{if(!p)return;let J=!1;return(async()=>{const ye=Rt.current;if(ye===null)return;const V=await ip(ye);if(J||V===void 0){J||M("ghostty-web 加载失败,输出将以纯文本显示");return}pt.current=V,B(!0);const pe=De.current;De.current=[];for(const mt of pe)V.write(mt);V.onData(mt=>{ba.current&&We("/api/terminal-input",{data:mt})}),V.onResize(({cols:mt,rows:Zt})=>{We("/api/terminal-resize",{cols:mt,rows:Zt})});const Te=window.setInterval(()=>{if(!(gt.current==="idle"&&!pt.current))try{Ze(V.readState())}catch{}},300);return()=>window.clearInterval(Te)})(),()=>{J=!0,pt.current?.dispose(),pt.current=void 0}},[p]);const ba=d.useRef(!0);d.useEffect(()=>{ba.current=S},[S]),d.useEffect(()=>{const J=Hy();return J.onmessage=ye=>{const V=JSON.parse(ye.data);switch(V.type){case"snapshot":{y(V.state),b(V.runAlive),s(V.command),R(V.command),c(V.commandOptions),k(V.interactive),j(V.form),T(V.defaults),h(V.targetDirExists),Q(V.services),H(V.selectedPort),L(V.icons??[]),K(V.iconsPort),at(V.services.map(Te=>({port:Te.port,url:Te.url,history:[Te.url],historyIndex:0})));const pe=V.runAlive||V.services.length>0;x(pe),Ye(pe&&V.services.length>0?`svc-${V.services[0].port}`:"terminal");break}case"state":y(V.state),V.state==="failed"&&C(V.reason),V.state==="frozen"&&(_e("confirm"),Ie(!0)),V.state==="materializing"&&(_e("pending"),Re([])),V.state==="success"&&_e("success"),V.state==="failed"&&ya.current&&(_e("failed"),ht(V.reason));break;case"log":{pt.current!==void 0?pt.current.write(V.chunk):va.current!==void 0?M(pe=>(pe??"")+V.chunk):De.current.push(V.chunk);break}case"term-mode":if(k(V.interactive),!V.interactive&&V.message!==void 0){const pe=`\x1B[33m${V.message}\x1B[0m\r
21
- `;pt.current!==void 0?pt.current.write(pe):De.current.push(pe)}break;case"run-status":b(V.running);break;case"command-display":R(V.command);break;case"command-options":c(V.options),A(V.defaultCwd);break;case"services":{Q(V.services),H(V.selectedPort),at(pe=>{const Te=[...pe];let mt;for(const Zt of V.services)Te.find(Gf=>Gf.port===Zt.port)===void 0&&(Te.push({port:Zt.port,url:Zt.url,history:[Zt.url],historyIndex:0}),mt=Zt.port);return mt!==void 0&&Ye(`svc-${mt}`),Te});break}case"icons":L(V.icons),K(V.port),vt(V.icons,ee,V.port)&&ce(void 0),vt(V.icons,X,V.port)&&te(void 0);break;case"scrape":U(V.hasIcon);break;case"form":{j(t!==null?Te=>Te:V.values),T(V.defaults),h(V.targetDirExists),W.current||(W.current=!0,he(V.values.iconBackground),oe(V.values.iconScale));break}case"materialize-step":ze(V.step),Re(pe=>[...pe,`[${V.step}] ${V.message}`]);break;case"materialize-log":Re(pe=>[...pe,V.message]);break;case"success":St({projectDir:V.projectDir,...V.bundlePath===void 0?{}:{bundlePath:V.bundlePath},pinHint:V.pinHint}),window.dispatchEvent(new Event("create-opentray:apps-changed"));break}},()=>J.close()},[]);const va=d.useRef(void 0);d.useEffect(()=>{va.current=_},[_]);const ya=d.useRef(!1);d.useEffect(()=>{ya.current=dt},[dt]);const Vo=ee===void 0?void 0:Number.parseInt(ee.split(":")[1]??"",10),Bf=le!==void 0?hf(le.key):G!==void 0?G:Z!==void 0&&Vo!==void 0&&z.some(J=>J.index===Vo)?_n(Z,Vo):Z!==void 0&&z!==void 0&&z[0]!==void 0&&ee===void 0?_n(Z,z[0].index):void 0,Mf=le!==void 0?`合成 ${le.background==="transparent"?"透明底":le.background==="black"?"黑底":"白底"}`:G!==void 0?"本地图片":z[0]!==void 0?`${z[0].width}×${z[0].height} ${z[0].format.toUpperCase()}`:"首字母图标",Ca=(()=>{if(Ee!==void 0)return Ee;const J=D.trayIconPath.trim();if(J.length>0&&Z!==void 0){const V=z.find(pe=>pe.path===J);if(V!==void 0)return _n(Z,V.index)}const ye=/^([^:]+):(\d+)$/.exec(X??"");if(ye!==null){const V=Number(ye[1]),pe=Number(ye[2]);if(Number.isInteger(V)&&Number.isInteger(pe))return _n(V,pe)}J.length})(),Pf=Ee!==void 0?"本地图片":Ca!==void 0?"跟随源图":"跟随应用图标";d.useEffect(()=>{const J=o.trim();if(J.length===0)return;const ye=window.setTimeout(()=>{We("/api/prime",{command:J})},400);return()=>window.clearTimeout(ye)},[o]);const Tf=async()=>{const J=o.trim();if(!(l.argsMode==="string"&&J.length===0)){if(x(!0),Ye("terminal"),pt.current?.reset(),at([]),Q([]),U(!1),L([]),K(void 0),ce(void 0),be(void 0),te(void 0),Se(void 0),l.argsMode==="array"){if(i.length===0||(i[0]??"").trim().length===0)return;await We("/api/command",{argv:i});return}await We("/api/command",{command:J})}},_f=J=>{if(Oe.find(V=>V.port===J)===void 0){We("/api/select-service",{port:J});return}We("/api/select-service",{port:J}),Ye(`svc-${J}`)},jf=(J,ye,V)=>{at(pe=>pe.map(Te=>{if(Te.port!==J)return Te;if(V==="replace")return{...Te,url:ye};const mt=[...Te.history.slice(0,Te.historyIndex+1),ye];return{...Te,url:ye,history:mt,historyIndex:mt.length-1}}))},Nf=(J,ye)=>{at(V=>V.map(pe=>{if(pe.port!==J)return pe;const Te=pe.historyIndex+ye;return Te<0||Te>=pe.history.length?pe:{...pe,historyIndex:Te,url:pe.history[Te]}}))},[Of,Zo]=d.useState(),Hf=async()=>{Dt.flush(),ln.flush(),_e("confirm"),Ie(!0);try{const J=await We("/api/confirm",{});if(!J.ok){const ye=await J.json().catch(()=>({}));Zo(ye.error??`确认失败(${J.status})`);return}Zo(void 0)}catch{Zo("确认请求失败")}};d.useEffect(()=>{v==="frozen"&&kt({...Ke.current,...D})},[v]);const Kf=async()=>{await We("/api/create",{})},[Wf,Ia]=d.useState(!1),Lf=J=>Lx(J),Jo=async()=>{Ie(!1),(await We("/api/cancel",{})).ok||y(ye=>ye==="frozen"?"discovered":ye)},Qf=p?"minmax(0, 520px) minmax(0, 1fr) minmax(0, 0fr)":"minmax(0, 1fr) minmax(0, var(--list-w)) minmax(0, 1fr)";return u.jsxs("div",{className:"grid h-full w-full overflow-hidden",style:{"--list-w":"min(520px, 100vw - 40px)",gridTemplateColumns:Qf,transition:"grid-template-columns 450ms cubic-bezier(0.4, 0, 0.2, 1)"},children:[u.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:[u.jsx(BC,{command:o,onCommandChange:s,argv:i,onArgvChange:J=>a([...J]),runAlive:I,frozen:v==="materializing"||v==="frozen"||v==="success",failedReason:v==="failed"?w:void 0,commandOptions:l,defaultCwd:f,onCommandOptionsChange:J=>{c(J),We("/api/command-options",{cwd:J.cwd,env:J.env,argsMode:J.argsMode})},onRun:()=>{Tf()},onStop:()=>{We("/api/stop",{})}}),u.jsx(DC,{frozen:v==="frozen"||v==="materializing"||v==="success",values:D,defaults:P,candidates:z,candidatesPort:Z,selectedIconRef:ee,uploadedIconUrl:G,iconAnalysis:ne,iconComposition:le,iconComposeError:q,iconBackground:se,iconScale:re,onIconBackgroundChange:Xn,onIconScaleChange:Ot,selectedTrayRef:X,uploadedTrayUrl:Ee,selectedPort:O,targetDirExists:g,onPickIconCandidate:J=>{Z!==void 0&&(ce(`${Z}:${J.index}`),be(void 0),We("/api/icon-select",{port:Z,index:J.index}))},onUploadIcon:J=>{const ye=URL.createObjectURL(J);be(ye),ce(void 0),J.arrayBuffer().then(V=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":J.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||(j(Te=>({...Te,iconPath:pe})),We("/api/form",{iconPath:pe}))}).catch(()=>{})})},onClearIcon:()=>{ce(void 0),be(void 0),j(J=>({...J,iconPath:""})),We("/api/form",{iconPath:""})},onPickTray:J=>{Z!==void 0&&(te(`${Z}:${J.index}`),Se(void 0),We("/api/tray-icon-select",{port:Z,index:J.index}))},onUploadTray:J=>{const ye=URL.createObjectURL(J);Se(ye),te(void 0),J.arrayBuffer().then(V=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":J.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||(j(Te=>({...Te,trayIconPath:pe})),We("/api/form",{trayIconPath:pe}))}).catch(()=>{})})},onClearTray:()=>{te(void 0),Se(void 0),j(J=>({...J,trayIconPath:""})),We("/api/form",{trayIconPath:""})},onPatch:J=>{j(ye=>({...ye,...J})),We("/api/form",J)},onConfirm:()=>{Hf()}})]}),u.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?u.jsxs(u.Fragment,{children:[u.jsx(LC,{command:E,terminalHostRef:Rt,terminalReady:F,interactive:S,status:qe,services:[...N],iframeTabs:Oe,activeTab:Le,onActiveTabChange:Ye,onIframeNavigate:jf,onIframeHistoryMove:Nf,onJumpToService:_f,className:"min-h-[480px] flex-1"}),_!==void 0?u.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:_}):null]}):null}),u.jsx(MC,{open:dt,onOpenChange:J=>{if(J){Ie(!0);return}if(He==="confirm"){Jo();return}Ie(!1)},phase:He,frozenValues:rt,iconSrc:Bf,iconLabel:Mf,traySrc:Ca,trayLabel:Pf,selectedPort:O,currentStep:Ue,logs:et,error:Je??w,result:ft,onBack:()=>{Jo()},onCreate:()=>{Kf()},onShare:()=>Ia(!0),onOpenApp:()=>{We("/api/open-app",{})},confirmError:Of,onClose:()=>{if(He==="confirm"){Jo();return}Ie(!1)}}),u.jsx(Td,{open:Wf,subtitle:rt?.appId??E,hasEnv:l.env.some(J=>J.key.trim().length>0),share:!0,runner:Lf,onClose:()=>Ia(!1)})]})}function YC(){const{route:e}=gd();return u.jsxs(u.Fragment,{children:[u.jsx("div",{hidden:e!=="add",className:"min-h-0 flex-1",children:u.jsx(GC,{})}),u.jsx("div",{hidden:e!=="applications",className:"min-h-0 flex-1",children:u.jsx(Bb,{})}),u.jsx("div",{hidden:e!=="help",className:"min-h-0 flex-1",children:u.jsx(Ny,{})})]})}const Kn={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)}},UC=()=>{const[e,t]=d.useState(Kn.open);return d.useEffect(()=>Kn.subscribe(()=>t(Kn.open)),[]),e};function zC(){return u.jsx(Px,{panelOpen:UC(),children:u.jsx(YC,{})})}const vo=Dx();Ws(vo.locale,vo.theme);Vf.createRoot(document.getElementById("root")).render(u.jsx(Zf.StrictMode,{children:u.jsx(Fx,{initialLocale:vo.locale,initialTheme:vo.theme,children:u.jsx(zC,{})})}));
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}},Df=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,vv=/\0/g;function yv(e){let t;t=e.src.replace(bv,`
17
+ `),t=t.replace(vv,"�"),e.src=t}function Cv(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 Iv(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 wv(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 kv(e){return/^<a[>\s]/i.test(e)}function Ev(e){return/^<\/a\s*>/i.test(e)}function Sv(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"&&(kv(a.content)&&s>0&&s--,Ev(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 C=u[A].index;if(C>g){const w=new e.Token("text","",0);w.content=c.slice(g,C),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 v=new e.Token("text","",0);v.content=x,v.level=h,f.push(v);const y=new e.Token("link_close","a",-1);y.level=--h,y.markup="linkify",y.info="auto",f.push(y),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=kf(o,i,f)}}}}var Ff=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Rv=/\((c|tm|r)\)/i,Dv=/\((c|tm|r)\)/gi,Fv={c:"©",r:"®",tm:"™"};function Bv(e,t){return Fv[t.toLowerCase()]}function Mv(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(Dv,Bv)),r.type==="link_open"&&r.info==="auto"&&t--,r.type==="link_close"&&r.info==="auto"&&t++}}function jv(e){let t=0;for(let n=e.length-1;n>=0;n--){const r=e[n];r.type==="text"&&!t&&Ff.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 Pv(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(Rv.test(e.tokens[t].content)&&Mv(e.tokens[t].children),Ff.test(e.tokens[t].content)&&jv(e.tokens[t].children))}var Tv=/['"]/,vc=/['"]/g,yc="’";function ao(e,t,n,r){e[t]||(e[t]=[]),e[t].push({pos:n,ch:r})}function Nv(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 _v(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;){vc.lastIndex=u;const h=vc.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 C=Nr(m)||Tr(m),b=Nr(x)||Tr(x),v=Pr(m),y=Pr(x);if(y?g=!1:b&&(v||C||(g=!1)),v?A=!1:C&&(y||b||(A=!1)),x===34&&h[0]==='"'&&m>=48&&m<=57&&(A=g=!1),g&&A&&(g=C,A=b),!g&&!A){p&&ao(o,s,h.index,yc);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,E;p?(I=t.md.options.quotes[2],E=t.md.options.quotes[3]):(I=t.md.options.quotes[0],E=t.md.options.quotes[1]),ao(o,s,h.index,E),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,yc)}}Object.keys(o).forEach(function(s){const i=Number(s);e[i].content=Nv(e[i].content,o[s])})}function Ov(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!=="inline"||!Tv.test(e.tokens[t].content)||_v(e.tokens[t].children,e)}function Hv(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 Lv(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&&Hv(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 Ns=[["normalize",yv],["block",Cv],["strip_references",Iv],["inline",wv],["linkify",Sv],["replacements",Pv],["smartquotes",Ov],["text_join",Lv]],Bf=class{constructor(){xe(this,"ruler",new Or),xe(this,"State",Df);for(let e=0;e<Ns.length;e++)this.ruler.push(Ns[e][0],Ns[e][1])}process(e){const t=this.ruler.getRules("");for(let n=0,r=t.length;n<r;n++)t[n](e)}},Mf=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(Ye(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&&Ye(this.src.charCodeAt(e));e++);return e}skipSpacesBack(e,t){if(e<=t)return e;for(;e>t;)if(!Ye(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(Ye(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("")}},Kv=65536;function _s(e,t){const n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function Cc(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 Wv(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&&!Ye(a)||i===45&&Ye(a))return!1;for(;s<e.eMarks[o];){const y=e.src.charCodeAt(s);if(y!==124&&y!==45&&y!==58&&!Ye(y))return!1;s++}let c=_s(e,t+1),u=c.split("|");const f=[];for(let y=0;y<u.length;y++){const w=u[y].trim();if(!w){if(y===0||y===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=_s(e,t).trim(),c.indexOf("|")===-1||e.sCount[t]-e.blkIndent>=4)return!1;u=Cc(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 C=e.push("tr_open","tr",1);C.map=[t,t+1];for(let y=0;y<u.length;y++){const w=e.push("th_open","th",1);f[y]&&(w.attrs=[["style",`text-align:${f[y]}`]]);const I=e.push("inline","",0);I.content=u[y].trim(),I.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let b,v=0;for(o=t+2;o<n&&!(e.sCount[o]<e.blkIndent);o++){let y=!1;for(let I=0,E=A.length;I<E;I++)if(A[I](e,o,n,!0)){y=!0;break}if(y||(c=_s(e,o).trim(),!c)||e.sCount[o]-e.blkIndent>=4||(u=Cc(c),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop(),v+=h-u.length,v>Kv))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 E=e.push("td_open","td",1);f[I]&&(E.attrs=[["style",`text-align:${f[I]}`]]);const S=e.push("inline","",0);S.content=u[I]?u[I].trim():"",S.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 Qv(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 Gv(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 Yv(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 v=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&&!v){let w=e.sCount[p]+1,I,E;e.src.charCodeAt(o)===32?(o++,w++,E=!1,I=!0):e.src.charCodeAt(o)===9?(I=!0,(e.bsCount[p]+w)%4===3?(o++,w++,E=!1):E=!0):I=!1;let S=w;for(a.push(e.bMarks[p]),e.bMarks[p]=o;o<s;){const R=e.src.charCodeAt(o);if(Ye(R))R===9?S+=4-(S+e.bsCount[p]+(E?1:0))%4:S++;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]=S-w,f.push(e.tShift[p]),e.tShift[p]=o-e.bMarks[p];continue}if(A)break;let y=!1;for(let w=0,I=h.length;w<I;w++)if(h[w](e,p,n,!0)){y=!0;break}if(y){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 C=[t,0];x.map=C,e.md.block.tokenize(e,t,p);const b=e.push("blockquote_close","blockquote",-1);b.markup=">",e.lineMax=i,e.parentType=g,C[1]=e.line;for(let v=0;v<f.length;v++)e.bMarks[v+t]=a[v],e.tShift[v+t]=f[v],e.sCount[v+t]=u[v],e.bsCount[v+t]=c[v];return e.blkIndent=m,!0}function zv(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&&!Ye(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 Ic(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&&!Ye(e.src.charCodeAt(r))?-1:r}function wc(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),!Ye(s))?-1:o}function Uv(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 Vv(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=wc(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=Ic(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 C=!1;const b=e.md.block.ruler.getRules("list"),v=e.parentType;for(e.parentType="list";c<n;){s=A,o=e.eMarks[c];const y=e.sCount[c]+A-(e.bMarks[c]+e.tShift[c]);let w=y;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 E;I>=o?E=1:E=w-y,E>4&&(E=1);const S=y+E;a=e.push("list_item_open","li",1),a.markup=String.fromCharCode(p);const R=[c,0];a.map=R,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=S,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||C)&&(u=!1),C=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,R[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let j=!1;for(let D=0,O=b.length;D<O;D++)if(b[D](e,c,n,!0)){j=!0;break}if(j)break;if(h){if(A=wc(e,c),A<0)break;i=e.bMarks[c]+e.tShift[c]}else if(A=Ic(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=v,u&&Uv(e,m),!0}function Zv(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(y){const w=e.lineMax;if(y>=w||e.isEmpty(y))return null;let I=!1;if(e.sCount[y]-e.blkIndent>3&&(I=!0),e.sCount[y]<0&&(I=!0),!I){const R=e.md.block.ruler.getRules("reference"),k=e.parentType;e.parentType="reference";let F=!1;for(let T=0,N=R.length;T<N;T++)if(R[T](e,y,w,!0)){F=!0;break}if(e.parentType=k,F)return null}const E=e.bMarks[y]+e.tShift[y],S=e.eMarks[y];return e.src.slice(E,S+1)}let c=e.src.slice(o,s+1);s=c.length;let u=-1;for(o=1;o<s;o++){const y=c.charCodeAt(o);if(y===91)return!1;if(y===93){u=o;break}else if(y===10){const w=a(i);w!==null&&(c+=w,s=c.length,i++)}else if(y===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 y=c.charCodeAt(o);if(y===10){const w=a(i);w!==null&&(c+=w,s=c.length,i++)}else if(!Ye(y))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 y=c.charCodeAt(o);if(y===10){const w=a(i);w!==null&&(c+=w,s=c.length,i++)}else if(!Ye(y))break}let m=e.md.helpers.parseLinkTitle(c,o,s);for(;m.can_continue;){const y=a(i);if(y===null)break;c+=y,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&&Ye(c.charCodeAt(o));)o++;if(o<s&&c.charCodeAt(o)!==10&&x)for(x="",o=g,i=A;o<s&&Ye(c.charCodeAt(o));)o++;if(o<s&&c.charCodeAt(o)!==10)return!1;const C=hs(c.slice(1,u));if(!C)return!1;if(r)return!0;typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[C]>"u"&&(e.env.references[C]={title:x,href:h});const b=e.push("reference_definition","",0);b.map=[t,i],b.hidden=!0;const v=Object.create(null);return v.label=C,b.meta=v,e.line=i,!0}var Jv=["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"],jf=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,Pf="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",$v=new RegExp(`^(?:${jf}|${Pf}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),Xv=new RegExp(`^(?:${jf}|${Pf})`),En=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Za-z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp(`^</?(${Jv.join("|")})(?=(\\s|/?>|$))`,"i"),/^$/,!0],[new RegExp(`${Xv.source}\\s*$`),/^$/,!1]];function qv(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 ey(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&&!Ye(i))return!1;if(r)return!0;s=e.skipSpacesBack(s,o);const c=e.skipCharsBack(s,35,o);c>o&&Ye(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 ty(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 ny(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",Wv,["paragraph","reference"]],["code",Qv],["fence",Gv,["paragraph","reference","blockquote","list"]],["blockquote",Yv,["paragraph","reference","blockquote","list"]],["hr",zv,["paragraph","reference","blockquote","list"]],["list",Vv,["paragraph","reference","blockquote"]],["reference",Zv],["html_block",qv,["paragraph","reference","blockquote"]],["heading",ey,["paragraph","reference","blockquote"]],["lheading",ty],["paragraph",ny]],Tf=class{constructor(){xe(this,"ruler",new Or),xe(this,"State",Mf);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)}},Nf=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 ry(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 oy(e,t){let n=e.pos;for(;n<e.posMax&&!ry(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var sy=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function iy(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(sy);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 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&&Ye(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var Ha=[];for(let e=0;e<256;e++)Ha.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){Ha[e.charCodeAt(0)]=1});function ly(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),!!Ye(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&&Ha[o]!==0?a.content=s:a.content=i,a.markup=i,a.info="escape"}return e.pos=n+1,!0}function cy(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 uy(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 kc(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 dy(e){const t=e.tokens_meta,n=e.tokens_meta.length;kc(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&&kc(e,s)}}var _f={tokenize:uy,postProcess:dy};function fy(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 Ec(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 py(e){const t=e.tokens_meta,n=e.tokens_meta.length;Ec(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&&Ec(e,s)}}var Of={tokenize:fy,postProcess:py};function hy(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),!(!Ye(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),!(!Ye(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),!(!Ye(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 C=Object.create(null);C.label=r,m.meta=C}e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=p,e.posMax=h,!0}function Ay(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),!(!Ye(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),!(!Ye(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),!(!Ye(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),C=[["src",f],["alt",""]];if(x.attrs=C,x.children=m,x.content=r,c&&C.push(["title",c]),o){const b=Object.create(null);b.label=o,x.meta=b}}return e.pos=s,e.posMax=g,!0}var gy=/^([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])?)*)$/,my=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function xy(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(my.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(gy.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 vy(e){return/^<\/a\s*>/i.test(e)}function yy(e){const t=e|32;return t>=97&&t<=122}function Cy(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&&!yy(o))return!1;const s=e.src.slice(r).match($v);if(!s)return!1;if(!t){const i=e.push("html_inline","",0);i.content=s[0],by(i.content)&&e.linkLevel++,vy(i.content)&&e.linkLevel--}return e.pos+=s[0].length,!0}var Iy=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,wy=/^&([a-z][a-z0-9]{1,31});/i;function ky(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(Iy);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=Oa(s)?jr(s):jr(65533),i.markup=o[0],i.info="entity"}return e.pos+=o[0].length,!0}}else{const o=e.src.slice(n).match(wy);if(o){const s=hf(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 Sc(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 Ey(e){const t=e.tokens_meta,n=e.tokens_meta.length;Sc(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&&Sc(s)}}function Sy(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 Os=[["text",oy],["linkify",iy],["newline",ay],["escape",ly],["backticks",cy],["strikethrough",_f.tokenize],["emphasis",Of.tokenize],["link",hy],["image",Ay],["autolink",xy],["html_inline",Cy],["entity",ky]],Hs=[["balance_pairs",Ey],["strikethrough",_f.postProcess],["emphasis",Of.postProcess],["fragments_join",Sy]],Hf=class{constructor(){xe(this,"ruler",new Or),xe(this,"ruler2",new Or),xe(this,"State",Nf);for(let e=0;e<Os.length;e++)this.ruler.push(Os[e][0],Os[e][1]);for(let e=0;e<Hs.length;e++)this.ruler2.push(Hs[e][0],Hs[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)}},Ry={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"]}}}},Dy=/^(vbscript|javascript|file|data):/,Fy=/^data:image\/(gif|png|jpeg|webp);/,Rc=["http:","https:","mailto:"],Vt=class{validateLink(e){const t=e.trim().toLowerCase();return Dy.test(t)?Fy.test(t):!0}normalizeLink(e){const t=Ai(e,!0);if(t.hostname&&(!t.protocol||Rc.indexOf(t.protocol)>=0))try{t.hostname=mc.toASCII(t.hostname)}catch{}return Vr(hi(t))}normalizeLinkText(e){const t=Ai(e,!0);if(t.hostname&&(!t.protocol||Rc.indexOf(t.protocol)>=0))try{t.hostname=mc.toUnicode(t.hostname)}catch{}return tr(hi(t),tr.defaultChars+"%")}constructor(...e){xe(this,"inline",new Hf),xe(this,"block",new Tf),xe(this,"core",new Bf),xe(this,"renderer",new Rf),xe(this,"linkify",new Qb),xe(this,"utils",tv),xe(this,"helpers",Object.assign({},gv));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=Ry[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(Vt,"Token",Fn);xe(Vt,"Ruler",Or);xe(Vt,"Renderer",Rf);xe(Vt,"ParserCore",Bf);xe(Vt,"StateCore",Df);xe(Vt,"ParserBlock",Tf);xe(Vt,"StateBlock",Mf);xe(Vt,"ParserInline",Hf);xe(Vt,"StateInline",Nf);var By=wf(Vt),Ls,Dc;function My(){return Dc||(Dc=1,Ls=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,C,b,v=!1,y=c.bMarks[u]+c.tShift[u],w=c.eMarks[u];if(u!==0||s!==c.src.charCodeAt(0))return!1;for(g=y+1;g<=w;g++)if(o[(g-y)%i]!==c.src[g]){b=g+1;break}if(p=Math.floor((g-y)/i),p<r)return!1;if(g-=(g-y)%i,h)return!0;for(A=u;A++,!(A>=f||c.src.slice(y,w)==="..."||(y=c.bMarks[A]+c.tShift[A],w=c.eMarks[A],y<w&&c.sCount[A]<c.blkIndent));)if(s===c.src.charCodeAt(y)&&!(c.sCount[A]-c.blkIndent>=4)){for(g=y+1;g<=w&&o[(g-y)%i]===c.src[g];g++);if(!(Math.floor((g-y)/i)<p)&&(g-=(g-y)%i,g=c.skipSpaces(g),!(g<w))){v=!0;break}}return x=c.parentType,C=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+(v?1:0)],m.meta=c.src.slice(b,y-1),c.parentType=x,c.lineMax=C,c.line=A+(v?1:0),n(m.meta),!0}t.block.ruler.before("table","front_matter",a,{alt:["paragraph","reference","blockquote","list"]})}),Ls}var jy=My();const Py=wp(jy);var Ty=Object.defineProperty,Ny=Object.defineProperties,_y=Object.getOwnPropertyDescriptors,Fc=Object.getOwnPropertySymbols,Oy=Object.prototype.hasOwnProperty,Hy=Object.prototype.propertyIsEnumerable,Bc=(e,t,n)=>t in e?Ty(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,at=(e,t)=>{for(var n in t||(t={}))Oy.call(t,n)&&Bc(e,n,t[n]);if(Fc)for(var n of Fc(t))Hy.call(t,n)&&Bc(e,n,t[n]);return e},Hr=(e,t)=>Ny(e,_y(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 Ly(e,t){return typeof e=="function"?e(t):e}function Lr(e,t){return n=>{t.setState(r=>Hr(at({},r),{[e]:Ly(n,r[e])}))}}var Mc=(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)}),Lf="Headless Tree: ",mi=e=>Error(Lf+e),Ky=e=>console.warn(Lf+e),Wy={key:"tree",getInitialState:e=>at({expandedItems:[],focusedItem:null},e),getDefaultConfig:(e,t)=>at({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)){Ky(`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 Mc(()=>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(at({},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 Mc(()=>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(at({},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()}}}},Qy=(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(at({},s),{prev:f}),...h)}}}]},Gy=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 mi(`${r.key} needs ${o}`)}},Yy=(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},zy=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)},Uy=(e=[])=>Yy(e,zy(e)),Vy=e=>{var t,n,r,o;const s=(t=e.instanceBuilder)!=null?t:Qy,i=[Wy,...Uy(e.features)];Gy(i);const a=[...i],[c,u]=s(a,"treeInstance",R=>({tree:R}));let f=i.reduce((R,k)=>{var F,T;return(T=(F=k.getInitialState)==null?void 0:F.call(k,R,c))!=null?T:R},(r=(n=e.initialState)!=null?n:e.state)!=null?r:{}),h=i.reduce((R,k)=>{var F,T;return(T=(F=k.getDefaultConfig)==null?void 0:F.call(k,R,c))!=null?T:R},e);const g=i.reduce((R,k)=>at(at({},R),k.stateHandlerNames),{});let A;const p={current:{}};let m=!1;const x={};let C=[];const b={},v={};let y={};const w={},I=()=>{C=[],y={};const[R,k]=s(a,"itemInstance",F=>({item:F,tree:c,itemId:h.rootItemId}));k(),x[h.rootItemId]=R,y[h.rootItemId]={itemId:h.rootItemId,index:-1,parentId:null,level:-1,posInSet:0,setSize:1};for(const F of c.getItemsMeta())if(y[F.itemId]=F,x[F.itemId])C.push(x[F.itemId]);else{const[T,N]=s(a,"itemInstance",j=>({item:j,tree:c,itemId:F.itemId}));N(),x[F.itemId]=T,C.push(T)}m=!1},E=R=>{for(const k of i)R(k)},S={key:"main",treeInstance:{getState:()=>f,setState:({},R)=>{var k;(k=h.setState)==null||k.call(h,f)},setMounted:({},R)=>{var k;const F=p.current;F.isMounted=R,R&&((k=F.waitingForMount)==null||k.forEach(T=>T()),F.waitingForMount=[])},applySubStateUpdate:({},R,k)=>{var F;const T=()=>{f[R]=typeof k=="function"?k(f[R]):k;const j=h[g[R]];j?.(f[R])},N=p.current;N.isMounted?T():((F=N.waitingForMount)!=null||(N.waitingForMount=[]),N.waitingForMount.push(T))},rebuildTree:()=>{var R,k;const F=p.current;F.isMounted?(I(),(R=h.setState)==null||R.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:(R,k)=>{var F,T,N;const j=typeof k=="function"?k(h):k,D=((F=j.state)==null?void 0:F.expandedItems)&&((T=j.state)==null?void 0:T.expandedItems)!==f.expandedItems;h=j,j.state&&(f=at(at({},f),j.state)),D&&(I(),(N=h.setState)==null||N.call(h,f))},getItemInstance:({},R)=>{const k=x[R];if(!k){const[F,T]=s(a,"itemInstance",N=>({item:N,tree:c,itemId:R}));return T(),F}return k},getItems:()=>(m&&I(),C),registerElement:({},R)=>{A!==R&&(A&&!R?E(k=>{var F;return(F=k.onTreeUnmount)==null?void 0:F.call(k,c,A)}):!A&&R&&E(k=>{var F;return(F=k.onTreeMount)==null?void 0:F.call(k,c,R)}),A=R)},getElement:()=>A,getDataRef:()=>p,getHotkeyPresets:()=>w},itemInstance:{registerElement:({itemId:R,item:k},F)=>{if(b[R]===F)return;const T=b[R];T&&!F?E(N=>{var j;return(j=N.onItemUnmount)==null?void 0:j.call(N,k,T,c)}):!T&&F&&E(N=>{var j;return(j=N.onItemMount)==null?void 0:j.call(N,k,F,c)}),b[R]=F},getElement:({itemId:R})=>b[R],getDataRef:({itemId:R})=>{var k;return(k=v[R])!=null?k:v[R]={current:{}}},getItemMeta:({itemId:R})=>{var k;return(k=y[R])!=null?k:{itemId:R,parentId:null,level:-1,index:-1,posInSet:0,setSize:1}}}};a.unshift(S);for(const R of a)Object.assign(w,(o=R.hotkeys)!=null?o:{});return u(),c},Zy={key:"selection",getInitialState:e=>at({selectedItems:[]},e),getDefaultConfig:(e,t)=>at({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(at({},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()))}}}},jc=e=>e.code!==""&&e.code!=="Unidentified"?e.code:e.key,Pc={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)$/},Tc=new Set(["MetaLeft","MetaRight","Meta","ControlLeft","ControlRight","Control","AltLeft","AltRight","Alt","ShiftLeft","ShiftRight","Shift"]),Jy=(e,t,n)=>{const r=n.hotkey.toLowerCase().split("+"),o=r.every(i=>{if(i in Pc)return[...e].some(c=>Pc[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},$y=(e,t,n,r)=>{var o;return(o=Object.entries(at(at({},n),r)).find(([,s])=>Jy(e,t,s)))==null?void 0:o[0]},Ks={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=jc({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=$y(t.current.pressedKeys,e,e.getHotkeyPresets(),A);if(f&&p&&t.current.pressedKeys.delete(p),!x)return;const C=at(at({},e.getHotkeyPresets()[x]),A?.[x]);C&&(!C.allowWhenInputFocused&&u||!C.canRepeat&&!m||(C.preventDefault&&((c=n.preventDefault)==null||c.call(n)),C.handler(n,e),g?.(x,n)))},dispatchKeyUp:(e,t)=>{var n,r,o,s;const i=jc({code:(n=t.code)!=null?n:"",key:(r=t.key)!=null?r:""});i&&((s=(o=e.current).pressedKeys)!=null||(o.pressedKeys=new Set),Tc.has(i)&&(e.current.pressedKeys=new Set([...e.current.pressedKeys].filter(a=>Tc.has(a)))),e.current.pressedKeys.delete(i))}},Xy={key:"hotkeys-core",onTreeMount:(e,t)=>{const n=e.getDataRef(),r=i=>{const a=i.target instanceof HTMLInputElement;Ks.dispatchKeyDown(e,n,i,{isInputFocused:a,releaseAfterDispatch:a})},o=i=>{Ks.dispatchKeyUp(n,i)},s=()=>{Ks.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)}},qy="sync dataLoader returned undefined",eC="sync dataLoader returned promise",Ws=e=>{if(!e)throw mi(qy);if(typeof e=="object"&&"then"in e)throw mi(eC);return e},tC={key:"sync-data-loader",getInitialState:e=>at({loadingItemData:[],loadingItemChildrens:[]},e),getDefaultConfig:(e,t)=>at({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)=>Ws(e.getConfig().dataLoader.getItem(t)),retrieveChildrenIds:({tree:e},t)=>{const{dataLoader:n}=e.getConfig();return"getChildren"in n?Ws(n.getChildren(t)):Ws(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}},nC=Object.defineProperty,rC=Object.defineProperties,oC=Object.getOwnPropertyDescriptors,Nc=Object.getOwnPropertySymbols,sC=Object.prototype.hasOwnProperty,iC=Object.prototype.propertyIsEnumerable,_c=(e,t,n)=>t in e?nC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,co=(e,t)=>{for(var n in t||(t={}))sC.call(t,n)&&_c(e,n,t[n]);if(Nc)for(var n of Nc(t))iC.call(t,n)&&_c(e,n,t[n]);return e},aC=(e,t)=>rC(e,oC(t)),lC=e=>{const[t]=d.useState(()=>({current:Vy(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=>aC(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 cC=/^(https?:|mailto:|#|\.\/|#\/)/iu,uC=e=>e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;"),jn=By({html:!1,linkify:!0,typographer:!1,breaks:!1});Py(jn,()=>{});jn.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});jn.validateLink=e=>cC.test(e.trim());const Kf=e=>{for(const t of e)t.type==="link_open"&&(t.attrSet("rel","noreferrer noopener"),t.attrSet("target","_blank")),t.children!==null&&Kf(t.children)};jn.core.ruler.push("external_links",e=>(Kf(e.tokens),!0));jn.renderer.rules.fence=(e,t)=>{const n=e[t];return`<pre class="tech-ltr"><code${n.info.trim().length>0?` class="language-${uC(n.info.trim())}"`:""}>${jn.utils.escapeHtml(n.content)}</code></pre>
19
+ `};const dC=e=>jn.render(e),fC=["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(" "),pC=(e,t)=>e.children!==void 0?t?l.jsx(qp,{"aria-hidden":!0,className:"pointer-events-none size-4 text-amber-500"}):l.jsx(th,{"aria-hidden":!0,className:"pointer-events-none size-4 text-amber-500"}):l.jsx($p,{"aria-hidden":!0,className:"pointer-events-none size-4 text-muted-foreground"}),Oc=16,hC=({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=lC({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:Oc,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:[tC,Zy,Xy]});return l.jsx(ub,{indent:Oc,tree:a,children:a.getItems().map(c=>{const u=c.getItemData(),f=u.children===void 0&&u.path!=="";return l.jsx(db,{item:c,onClick:()=>{f&&n(u.path)},children:l.jsx(fb,{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:[pC(u,c.isExpanded()),c.getItemName()]})})},c.getId())})})},AC=()=>{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 hx();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 Ax(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?"":dC(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(hC,{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:fC,dangerouslySetInnerHTML:{__html:A}})})]})},Wf=e=>`/api/icon-composed/${e}?token=${encodeURIComponent(new URLSearchParams(location.search).get("token")??"")}`,gC={cwd:"",env:[],argsMode:"string",family:null},La=new URLSearchParams(location.search).get("token")??"",Qe=(e,t={})=>fetch(e,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${La}`},body:JSON.stringify(t)}),mC=()=>new EventSource(`/api/events?token=${encodeURIComponent(La)}`),Wn=(e,t)=>`/api/icon-data/${e}/${t}?token=${encodeURIComponent(La)}`,xC=e=>{try{return new URL(e).hostname}catch{return e}};function bC({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:C}){const b=n,v=d.useRef(null),[y,w]=d.useState(!1);return l.jsxs("div",{className:"grid grid-cols-1 gap-y-1",children:[l.jsxs("div",{children:[l.jsx(je,{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:()=>v.current?.click(),onDragOver:I=>{I.preventDefault(),b||w(!0)},onDragLeave:()=>w(!1),onDrop:I=>{if(I.preventDefault(),w(!1),b)return;const E=I.dataTransfer.files[0];E!==void 0&&m(E)},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",y&&"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(fu,{className:"size-4"}),l.jsx("span",{className:"text-[10px] leading-tight",children:"点击或拖入图片"})]})}),l.jsx("input",{ref:v,type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden",disabled:b,onChange:I=>{const E=I.target.files?.[0];E!==void 0&&m(E),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 E=o===void 0?void 0:Wn(o,I.index),S=i===`${o}:${I.index}`,R=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",S||R?"border-primary ring-2 ring-primary/60":"border-border hover:border-primary/60",b&&"opacity-50"),children:E!==void 0?l.jsx("img",{src:E,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:Wf(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(je,{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(je,{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(je,{htmlFor:"appId",children:"App ID"}),l.jsx(et,{id:"appId",className:"mt-1 font-mono",disabled:b,value:e.appId,placeholder:t.appId||"由命令推导(如 start.somecommand.npx)",onChange:I=>C({appId:I.target.value})})]}),l.jsxs("div",{children:[l.jsx(je,{htmlFor:"appName",children:"应用名称"}),l.jsx(et,{id:"appName",className:"mt-1",disabled:b,value:e.appName,placeholder:t.appName||"从服务页面标题抓取",onChange:I=>C({appName:I.target.value})})]})]})}function vC({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(fu,{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:Wn(t,m.index),C=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",C||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 yC(e){const t=d.useRef(!0);t.current&&(t.current=!1,e())}const Qf=d.createContext(null);function Zt(){const e=d.useContext(Qf);if(e===null)throw new Error(ot(60));return e}const CC=(e,t)=>Object.is(e,t);function rr(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:rr(r,t,n))}function IC(e,t,n){return e.filter(r=>!rr(t,r,n))}function xi(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Gf(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function wC(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Gf(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 Yf(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 xi(e)}function Hn(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?xi(e.value):xi(e)}function zf(e,t,n){function r(){return Yf(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=Gf(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 kC(e,t,n){return e.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(l.jsx(d.Fragment,{children:zf(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:Hn(t,r)!==""},hasNullItemLabel:(e,t)=>t?wC(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=>rr(t,o,n)):rr(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 EC(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 Ka(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 SC(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:C,items:b,multiple:v=!1,itemToStringLabel:y,itemToStringValue:w,isItemEqualToValue:I=CC,highlightItemOnHover:E=!0,children:S}=e,{clearErrors:R}=Fi(),{setDirty:k,setTouched:F,setFocused:T,validityData:N,setFilled:j,name:D,disabled:O,validation:_,validationMode:B}=Qo(),H=ji({id:t}),P=O||h,M=D??c,[L,G]=on({controlled:n,default:v?r??Nt:r,name:"Select",state:"value"}),[V,Y]=on({controlled:s,default:i,name:"Select",state:"open"}),Q=d.useRef([]),z=d.useRef([]),K=d.useRef(null),X=d.useRef(null),ae=d.useRef(0),te=d.useRef(null),$=d.useRef([]),ee=d.useRef(!1),ue=d.useRef(null),ce=d.useRef(null),he=d.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),se=d.useRef(!1),{mounted:Ae,setMounted:re,transitionStatus:oe}=or(V),{openMethod:le,triggerProps:ge}=xd(V),me=St(()=>new Gr({id:H,labelId:void 0,modal:p,multiple:v,itemToStringLabel:y,itemToStringValue:w,isItemEqualToValue:I,value:L,open:V,mounted:Ae,transitionStatus:oe,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),U=we(me,ke.selectedIndex),be=we(me,ke.triggerElement),q=we(me,ke.positionerElement),ne=Zm(le),Ee=le??ne,Se=d.useMemo(()=>v?"":Hn(L,w),[v,L,w]),Ge=d.useMemo(()=>v&&Array.isArray(L)?L.map(De=>Hn(De,w)):Hn(L,w),[v,L,w]),ze=qe(be),Le=de(()=>Ge);Mi(ze,H,L,Le,!P,c);const ct=d.useRef(L),tt=v?Array.isArray(L)&&L.length>0:L!=null&&Se!=="";ie(()=>{j(tt)},[tt,j]),ie(function(){let We=L,mt=!1;if(v){const Ft=Array.isArray(L)?L:[];mt=Ft.length===0,We=Ft[Ft.length-1]}const yt=mt?-1:xo($.current,We,I),Ct=yt===-1?null:yt;Ct===null&&(ce.current=null),!V&&me.set("selectedIndex",Ct)},[v,V,L,I,me]);function Je(De){const We=N.initialValue;return Array.isArray(De)&&Array.isArray(We)?!EC(De,We,(mt,yt)=>rr(mt,yt,I)):De!==We}ss(L,()=>{R(M),k(Je(L)),_.change(L)});const ft=de((De,We)=>{a?.(De,We),!We.isCanceled&&(Y(De),!De&&(We.reason===Bn||We.reason===Lo)&&(F(!0),T(!1),B==="onBlur"&&_.commit(L)))}),Ie=de(()=>{re(!1),me.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),C?.(!1)});zt({enabled:!m,open:V,ref:K,onComplete(){V||Ie()}}),d.useImperativeHandle(m,()=>({unmount:Ie}),[Ie]);const Ke=de((De,We)=>{o?.(De,We),!We.isCanceled&&G(De)}),Ne=de(De=>{const We=Ka(De.scrollHeight,De.clientHeight),mt=No(De.scrollTop,We),yt=mt>0,Ct=mt<We;me.set("scrollUpArrowVisible",yt),me.set("scrollDownArrowVisible",Ct)}),nt=Ug({open:V,onOpenChange:ft,elements:{reference:be,floating:q}}),Re=Gu(nt,{enabled:!g&&!P,event:"mousedown"}),Ue=Xo(nt),Ve=dd(nt,{enabled:!g&&!P,listRef:Q,activeIndex:W,selectedIndex:U,disabledIndices:Nt,onNavigate(De){De===null&&!V||me.set("activeIndex",De)},focusItemOnHover:E}),$e=fd(nt,{enabled:!g&&!P&&(V||!v),listRef:z,activeIndex:W,selectedIndex:U,disabledIndices:De=>Od(Q.current[De]),onMatch(De){V?me.set("activeIndex",De):Ke($.current[De],Ce(Pt))},onTyping(De){ee.current=De}}),gt=d.useMemo(()=>Mt($e.reference,Ve.reference,Ue.reference,Re.reference,ge),[Re.reference,$e.reference,Ve.reference,Ue.reference,ge]),pt=d.useMemo(()=>Mt(ts,$e.floating,Ve.floating,Ue.floating),[$e.floating,Ve.floating,Ue.floating]),Rt=Ve.item??lt;yC(()=>{me.update({popupProps:pt,triggerProps:gt})}),me.useSyncedValues({id:H,modal:p,multiple:v,value:L,open:V,mounted:Ae,transitionStatus:oe,popupProps:pt,triggerProps:gt,items:b,itemToStringLabel:y,itemToStringValue:w,isItemEqualToValue:I,openMethod:Ee});const st=d.useMemo(()=>({store:me,floatingContext:nt,required:A,disabled:P,readOnly:g,multiple:v,highlightItemOnHover:E,setValue:Ke,setOpen:ft,listRef:Q,popupRef:K,scrollHandlerRef:X,handleScrollArrowVisibility:Ne,scrollArrowsMountedCountRef:ae,itemProps:Rt,valueRef:te,valuesRef:$,labelsRef:z,typingRef:ee,selectionRef:he,firstItemTextRef:ue,selectedItemTextRef:ce,validation:_,onOpenChangeComplete:C,alignItemWithTriggerActiveRef:se,initialValueRef:ct}),[me,nt,A,P,g,v,E,Ke,ft,Rt,_,C,Ne]),Et=Gt(x,_.inputRef),Dt=v?void 0:M,ht=d.useMemo(()=>!v||!Array.isArray(L)||!M?null:L.map(De=>{const We=Hn(De,w);return l.jsx("input",{type:"hidden",form:u,name:M,value:We,disabled:P},We)}),[v,L,u,M,w,P]);return l.jsxs(Qf.Provider,{value:st,children:[S,l.jsx("input",{..._.getValidationProps(P,{onFocus(){me.state.triggerElement?.focus({focusVisible:!0})},onChange(De){if(De.nativeEvent.defaultPrevented||P||g)return;const We=De.currentTarget.value,mt=Ce(Pt,De.nativeEvent);function yt(){if(v)return;const Ct=We.toLowerCase();let Ft=$.current.findIndex(cn=>Hn(cn,w).toLowerCase()===Ct||Yf(cn,y).toLowerCase()===Ct);Ft===-1&&(Ft=$.current.findIndex((cn,ir)=>{const kn=z.current[ir];return kn!=null&&kn.toLowerCase()===Ct}));const Ht=$.current[Ft];Ht!=null&&Ke(Ht,mt)}me.set("forceMount",!0),queueMicrotask(yt)}}),id:H&&Dt==null?`${H}-hidden-input`:void 0,form:u,name:Dt,autoComplete:f,value:Se,disabled:P,required:A&&!(v&&tt),readOnly:g,ref:Et,style:M?Xi:$o,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ht]})}function RC(e,t){return e??t}const DC=400,FC={...ni,...Di,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},BC=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}=Bi(),{store:x,setOpen:C,selectionRef:b,validation:v,readOnly:y,required:w,alignItemWithTriggerActiveRef:I,disabled:E}=Zt(),S=p||E||i,R=we(x,ke.open),k=we(x,ke.mounted),F=we(x,ke.value),T=we(x,ke.triggerProps),N=we(x,ke.positionerElement),j=we(x,ke.listElement),D=we(x,ke.popupSide),O=we(x,ke.id),_=we(x,ke.labelId),B=we(x,ke.hasSelectedValue),H=k&&N?D:null,P=s??O,M=RC(m,_);ji({id:P});const L=qe(N),G=d.useRef(null),{getButtonProps:V,buttonRef:Y}=Yt({disabled:S,native:a}),Q=x.useStateSetter("triggerElement"),z=dt(),K=dt(),X=dt();d.useEffect(()=>{if(R)return X.start(DC,()=>{b.current.allowUnselectedMouseUp=!0,b.current.allowSelectedMouseUp=!0}),()=>{X.clear()};b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},K.clear()},[R,b,K,X]);const ae=Mt(T,{id:P,role:"combobox","aria-expanded":R,"aria-haspopup":"listbox","aria-controls":R?j?.id??yo(N)?.id:void 0,"aria-labelledby":M,"aria-readonly":y||void 0,"aria-required":w||void 0,tabIndex:S?-1:0,onFocus(ee){h(!0),R&&I.current&&C(!1,Ce(Pt,ee.nativeEvent)),z.start(0,()=>{x.set("forceMount",!0)})},onBlur(ee){ve(N,ee.relatedTarget)||(f(!0),h(!1),g==="onBlur"&&v.commit(F))},onMouseDown(ee){if(R)return;const ue=Be(ee.currentTarget);function ce(he){if(!G.current)return;const se=he.target;ve(G.current,se)||ve(L.current,se)||Pd(he,G.current)||C(!1,Ce(au,he))}K.start(0,()=>{ue.addEventListener("mouseup",ce,{once:!0})})}},u,V),te=v.getValidationProps(S,ae);te.role="combobox";const $={...A,open:R,disabled:S,value:F,readOnly:y,popupSide:H,placeholder:!B};return Me("button",t,{ref:[n,G,Y,Q],state:$,stateAttributesMapping:FC,props:te})}),MC={value:()=>null},jC=d.forwardRef(function(t,n){const{className:r,render:o,children:s,placeholder:i,style:a,...c}=t,{store:u,valueRef:f}=Zt(),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),C={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=kC(h,g,A):b=zf(h,g,A),Me("span",t,{state:C,ref:[n,f],props:[{children:b},c],stateAttributesMapping:MC})}),PC=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a}=Zt(),u={open:we(a,ke.open)};return Me("span",t,{state:u,ref:n,props:[{"aria-hidden":!0,children:"▼"},i],stateAttributesMapping:Bu})}),TC=d.forwardRef(function(t,n){const{store:r}=Zt(),o=we(r,ke.mounted),s=we(r,ke.forceMount);return o||s?l.jsx(qi,{ref:n,...t}):null}),Uf=d.createContext(void 0);function Wa(){const e=d.useContext(Uf);if(!e)throw new Error(ot(59));return e}function _o(e,t){e&&Object.assign(e.style,t)}const Vf={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},NC={position:"fixed"},_C=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:C=Tu,style:b,...v}=t,{store:y,listRef:w,labelsRef:I,alignItemWithTriggerActiveRef:E,selectedItemTextRef:S,valuesRef:R,initialValueRef:k,popupRef:F,setValue:T,floatingContext:N}=Zt(),j=we(y,ke.open),D=we(y,ke.mounted),O=we(y,ke.modal),_=we(y,ke.value),B=we(y,ke.openMethod),H=we(y,ke.positionerElement),P=we(y,ke.triggerElement),M=we(y,ke.isItemEqualToValue),L=we(y,ke.transitionStatus),G=d.useRef(null),V=d.useRef(null),[Y,Q]=d.useState(x),z=D&&Y&&B!=="touch";!D&&Y!==x&&Q(x),d.useImperativeHandle(E,()=>z),Md((z||O)&&j,B==="touch",H,P);const K=va({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:C,keepMounted:!0}),X=z?"none":K.side,ae=z?NC:K.positionerStyles,te={open:j,side:X,align:K.align,anchorHidden:K.anchorHidden};ie(()=>{y.set("popupSide",K.side)},[y,K.side]);const $=y.useStateSetter("positionerElement"),ee=ya(t,te,{styles:ae,transitionStatus:L,props:v,refs:[n,$],hidden:!D,inert:!j}),ue=d.useRef(0),ce=de(se=>{if(R.current.length===0)return;const Ae=ue.current;if(ue.current=se.size,se.size===Ae)return;const re=Ce(Pt);if(Ae!==0&&!y.state.multiple&&_!==null&&xo(R.current,_,M)===-1){const le=k.current,me=le!=null&&xo(R.current,le,M)!==-1?le:null;T(me,re),me===null&&(y.set("selectedIndex",null),S.current=null)}if(Ae!==0&&y.state.multiple&&Array.isArray(_)){const oe=_.filter(le=>xo(R.current,le,M)!==-1);oe.length!==_.length&&(T(oe,re),oe.length===0&&(y.set("selectedIndex",null),S.current=null))}if(j&&z){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const oe={height:""};_o(H,oe),_o(F.current,oe)}}),he=d.useMemo(()=>({...K,side:X,alignItemWithTriggerActive:z,setControlledAlignItemWithTrigger:Q,scrollUpArrowRef:G,scrollDownArrowRef:V}),[K,X,z,Q]);return l.jsx(Ur,{elementsRef:w,labelsRef:I,onMapChange:ce,children:l.jsxs(Uf.Provider,{value:he,children:[D&&O&&l.jsx(ma,{inert:ga(!j),cutout:P}),ee]})})}),uo="base-ui-disable-scrollbar",bi={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}`})}},OC=d.createContext(void 0),HC={disableStyleElements:!1};function LC(){return d.useContext(OC)??HC}const KC={...Wr,...Nn},WC=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:C,listRef:b,highlightItemOnHover:v,floatingContext:y}=Zt(),{side:w,align:I,alignItemWithTriggerActive:E,isPositioned:S,setControlledAlignItemWithTrigger:R}=Wa(),k=Ia()!=null,F=is(),{nonce:T,disableStyleElements:N}=LC(),j=we(c,ke.id),D=we(c,ke.open),O=we(c,ke.openMethod),_=we(c,ke.mounted),B=we(c,ke.popupProps),H=we(c,ke.transitionStatus),P=we(c,ke.triggerElement),M=we(c,ke.positionerElement),L=we(c,ke.listElement),G=d.useRef(!1),V=d.useRef(!1),Y=d.useRef({}),Q=Xn(),z=de(te=>{if(!M||!u.current||!V.current)return;const $=M.style.top==="0px",ee=M.style.bottom==="0px";if(G.current||!E||!$&&!ee){x(te);return}const ue=Lc(M),ce=yr(M.getBoundingClientRect().height,"y",ue),he=Be(M),se=rt(M),Ae=se.getComputedStyle(M),re=parseFloat(Ae.marginTop),oe=parseFloat(Ae.marginBottom),le=Hc(se.getComputedStyle(u.current)),ge=Math.min(he.documentElement.clientHeight-re-oe,le),me=te.scrollTop,W=fo(te);let U=null;const be=Se=>{M.style.height=`${Se}px`},q=$?W-me:me,ne=Math.min(ce+q,ge);if(q<=Tt){const Se=vr(q,0,ge-ce);Se>0&&be(ce+Se),te.scrollTop=$?W:0,ge-(ce+Se)<=Tt&&(G.current=!0),x(te);return}if(ge-ne>Tt)U=$?1/0:0;else if(ee&&me<W){const Se=ce+q-ge;U=me-(q-Se)}const Ee=Math.ceil(ne);if(Ee!==0&&be(Ee),U!=null){const Se=vr(U,0,fo(te));Math.abs(te.scrollTop-Se)>Tt&&(te.scrollTop=Se)}Ee>=ge-Tt&&(G.current=!0),x(te)});d.useImperativeHandle(C,()=>z,[z]),zt({open:D,ref:u,onComplete(){D&&f?.(!0)}});const K={open:D,transitionStatus:H,side:w,align:I};ie(()=>{!M||!u.current||Object.keys(Y.current).length||(Y.current={top:M.style.top||"0",left:M.style.left||"0",right:M.style.right,height:M.style.height,bottom:M.style.bottom,minHeight:M.style.minHeight,maxHeight:M.style.maxHeight,marginTop:M.style.marginTop,marginBottom:M.style.marginBottom})},[u,M]),ie(()=>{D||E||(V.current=!1,G.current=!1,_o(M,Y.current))},[D,E,M,u]),ie(()=>{const te=u.current;if(!D||!P||!M||!te||E&&!S||c.state.transitionStatus==="ending")return;if(V.current=!0,te.style.removeProperty("--transform-origin"),!E){Q.request(()=>x(L||te));return}const $=QC(te);try{let ee=p.current;ee?.isConnected||(ee=!ke.hasSelectedValue(c.state)&&A.current?.isConnected?A.current:null);const ue=g.current,ce=rt(M),he=ce.getComputedStyle(M),se=ce.getComputedStyle(te),Ae=Be(P),re=Lc(P),oe=po(P.getBoundingClientRect(),re),le=po(M.getBoundingClientRect(),re),ge=oe.height,me=L||te,W=me.scrollHeight,U=parseFloat(se.borderBottomWidth),be=parseFloat(he.marginTop)||10,q=parseFloat(he.marginBottom)||10,ne=parseFloat(he.minHeight)||100,Ee=Hc(se),Se=5,Ge=5,ze=20,Le=Ae.documentElement.clientHeight-be-q,ct=Ae.documentElement.clientWidth,tt=Le-oe.bottom+ge;let Je,ft=F==="rtl"?oe.right-le.width:oe.left,Ie=0;if(ee&&ue){const st=po(ue.getBoundingClientRect(),re);Je=po(ee.getBoundingClientRect(),re),ft=le.left+(F==="rtl"?st.right-Je.right:st.left-Je.left);const Et=st.top-oe.top+st.height/2;Ie=Je.top-le.top+Je.height/2-Et}const Ke=tt+Ie+q+U;let Ne=Math.min(Le,Ke);const nt=Le-be-q,Re=Ke-Ne,Ue=ct-Ge;M.style.left=`${vr(ft,Se,Ue-le.width)}px`,M.style.height=`${Ne}px`,M.style.maxHeight="none",M.style.marginTop=`${be}px`,M.style.marginBottom=`${q}px`,te.style.height="100%";const Ve=fo(me),$e=Re>=Ve-Tt;$e&&(Ne=Math.min(Le,le.height)-(Re-Ve));const gt=oe.top<ze||oe.bottom>Le-ze||Math.ceil(Ne)+Tt<Math.min(W,ne),pt=(ce.visualViewport?.scale??1)!==1&&an;if(gt||pt){_o(M,Y.current),R(!1);return}const Rt=Math.max(ne,Ne);if($e){const st=Math.max(0,Le-Ke);M.style.top=le.height>=nt?"0":`${st}px`,M.style.height=`${Ne}px`,me.scrollTop=fo(me)}else M.style.bottom="0",me.scrollTop=Re;if(Je){const st=le.top,Et=le.height,Dt=Je.top+Je.height/2,ht=vr(Et>0?(Dt-st)/Et*100:50,0,100);te.style.setProperty("--transform-origin",`50% ${ht}%`)}(Rt===Le||Ne>=Ee)&&(G.current=!0),x(me),v&&c.state.selectedIndex===null&&c.state.activeIndex===null&&b.current[0]!=null&&c.set("activeIndex",0)}finally{$()}},[c,D,M,P,g,A,p,u,x,E,R,Q,L,b,v,F,S]),d.useEffect(()=>{if(!E||!M||!D)return;const te=rt(M);function $(ee){h(!1,Ce(Mp,ee))}return Fe(te,"resize",$)},[h,E,M,D]);const X={...L?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":m||void 0,id:`${j}-list`},onKeyDown(te){k&&rs.has(te.key)&&te.stopPropagation()},onScroll(te){L||z(te.currentTarget)},...E&&{style:L?{height:"100%"}:Vf},className:!L&&E?bi.className:void 0},ae=Me("div",t,{ref:[n,u],state:K,stateAttributesMapping:KC,props:[B,X,as(H),a]});return l.jsxs(d.Fragment,{children:[!N&&bi.getElement(T),l.jsx(na,{context:y,modal:!1,disabled:!_,openInteractionType:O,returnFocus:i,restoreFocus:!0,children:ae})]})});function Hc(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function fo(e){return Ka(e.scrollHeight,e.clientHeight)}function Lc(e){return Ju.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 Kc=[["transform","none"],["scale","1"],["translate","0 0"]];function QC(e){const{style:t}=e,n={};for(const[r,o]of Kc)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Kc){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}const GC=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a,scrollHandlerRef:c,multiple:u}=Zt(),{alignItemWithTriggerActive:f}=Wa(),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:Vf},className:h&&g!=="touch"?bi.className:void 0},m=a.useStateSetter("listElement");return Me("div",t,{ref:[n,m],props:[p,i]})}),Zf=d.createContext(void 0);function Qa(){const e=d.useContext(Zf);if(!e)throw new Error(ot(57));return e}const YC=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:C,typingRef:b,valuesRef:v,multiple:y,selectedItemTextRef:w,disabled:I,readOnly:E}=Zt(),S=I||c,R=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),j=g.index,D=d.useRef(null);ie(()=>{const Q=v.current;return Q[j]=i,()=>{delete Q[j]}},[j,i,v]),ie(()=>{const Q=A.state.value;let z=Q;y&&Array.isArray(Q)&&(z=Q.length>0?Q[Q.length-1]:void 0),z!==void 0&&rr(i,z,N)&&(A.set("selectedIndex",j),h.current&&(w.current=h.current))},[j,y,N,A,i,w]);const O=d.useRef("mouse"),_=d.useRef(!1),{getButtonProps:B,buttonRef:H}=Yt({disabled:S,focusableWhenDisabled:!0,native:u,composite:!0}),P={disabled:S,selected:F,highlighted:R};function M(Q){if(I||E)return;const z=A.state.value;if(y){const K=Array.isArray(z)?z:[],X=F?IC(K,i,N):[...K,i];x(X,Ce(Cr,Q))}else x(i,Ce(Cr,Q)),m(!1,Ce(Cr,Q))}function L(){C.current.dragY=0}const G={role:"option","aria-selected":F,tabIndex:k&&R?0:-1,onKeyDown(Q){A.set("activeIndex",j),Q.key===" "&&b.current&&Q.preventDefault()},onClick(Q){const z=O.current!=="touch",K=Q.nativeEvent.pointerType,X=z&&Li(Q.nativeEvent)&&(K!==void 0||R),ae=z&&!X&&!_.current;_.current=!1,!(S||ae)&&M(Q.nativeEvent)},onPointerEnter(Q){O.current=Q.pointerType},onPointerMove(Q){if(Q.pointerType==="mouse"&&Q.buttons===1){const z=C.current;z.dragY+=Q.movementY,z.dragY**2>=64&&(z.allowUnselectedMouseUp=!0)}},onPointerDown(Q){O.current=Q.pointerType,_.current=!0,L()},onMouseUp(){if(L(),S||O.current==="touch"||_.current)return;const Q=!C.current.allowSelectedMouseUp&&F,z=!C.current.allowUnselectedMouseUp&&!F;Q||z||(_.current=!0,D.current?.click(),_.current=!1)}},V=Me("div",t,{ref:[H,n,g.ref,D],state:P,props:[p,G,f,B]}),Y=d.useMemo(()=>({selected:F,index:j,textRef:h,selectedByFocus:T}),[F,j,h,T]);return l.jsx(Zf.Provider,{value:Y,children:V})})),zC=d.forwardRef(function(t,n){const{selected:r}=Qa();return t.keepMounted||r?l.jsx(UC,{...t,ref:n}):null}),UC=d.memo(d.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:a}=Qa(),c=d.useRef(null),{transitionStatus:u,setMounted:f}=or(a),g=Me("span",e,{ref:[t,c],state:{selected:a,transitionStatus:u},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:Nn});return zt({open:a,ref:c,onComplete(){a||f(!1)}}),g})),VC=d.memo(d.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:s}=Qa(),{firstItemTextRef:i,selectedItemTextRef:a}=Zt(),{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 Me("div",t,{ref:[g,n,o],props:h})})),Jf=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}=Zt(),{side:m,scrollDownArrowRef:x,scrollUpArrowRef:C}=Wa(),b=u?ke.scrollUpArrowVisible:ke.scrollDownArrowVisible,v=we(f,b),y=we(f,ke.openMethod),w=v&&y!=="touch",I=dt(),E=u?C:x,{mounted:S,transitionStatus:R,setMounted:k}=or(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]),zt({open:w,ref:E,onComplete(){w||k(!1)}});const N=Me("div",t,{ref:[n,E],state:{direction:i,visible:w,side:m,transitionStatus:R},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 O(){const _=f.state.listElement??h.current;if(!_)return;f.set("activeIndex",null),A(_);const B=Ka(_.scrollHeight,_.clientHeight),H=No(_.scrollTop,B),P=H===(u?0:B),M=g.current;if(H!==_.scrollTop&&(_.scrollTop=H),P){I.clear();return}if(M.length>0){const L=E.current?.offsetHeight||0;_.scrollTop=ZC(M,u,H,_.clientHeight,L,B)}I.start(40,O)}I.start(40,O)},onMouseLeave(){I.clear()}},c],stateAttributesMapping:Nn});return S||a?N:null});function ZC(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 JC=d.forwardRef(function(t,n){return l.jsx(Jf,{...t,ref:n,direction:"down"})}),$C=d.forwardRef(function(t,n){return l.jsx(Jf,{...t,ref:n,direction:"up"})}),XC=SC;function qC({className:e,...t}){return l.jsx(jC,{"data-slot":"select-value",className:fe("flex flex-1 text-left",e),...t})}function e1({className:e,size:t="default",children:n,...r}){return l.jsxs(BC,{"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(PC,{render:l.jsx(Tn,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function t1({className:e,children:t,side:n="bottom",sideOffset:r=4,align:o="center",alignOffset:s=0,alignItemWithTrigger:i=!0,...a}){return l.jsx(TC,{children:l.jsx(_C,{side:n,sideOffset:r,align:o,alignOffset:s,alignItemWithTrigger:i,className:"isolate z-50",children:l.jsxs(WC,{"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(n1,{}),l.jsx(GC,{children:t}),l.jsx(r1,{})]})})})}function Qs({className:e,children:t,...n}){return l.jsxs(YC,{"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(VC,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),l.jsx(zC,{render:l.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:l.jsx(Pi,{className:"pointer-events-none"})})]})}function n1({className:e,...t}){return l.jsx($C,{"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(Ti,{})})}function r1({className:e,...t}){return l.jsx(JC,{"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 $f=d.createContext(void 0);function o1(){const e=d.useContext($f);if(e===void 0)throw new Error(ot(63));return e}const Xf={...Di,checked(e){return e?{"data-checked":""}:{"data-unchecked":""}}},s1=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:C,value:b,style:v,...y}=t,{clearErrors:w}=Fi(),{state:I,setTouched:E,setDirty:S,validityData:R,setFilled:k,setFocused:F,validationMode:T,disabled:N,name:j,validation:D}=Qo(),{labelId:O}=Bi(),_=N||m,B=j??f,H=d.useRef(null),P=Gt(H,u,D.inputRef),M=d.useRef(null),L=wt(),G=ji({id:c,implicit:!1,controlRef:M}),V=h?void 0:G,[Y,Q]=on({controlled:r,default:!!s,name:"Switch",state:"checked"});Mi(M,L,Y,void 0,!_,f),ie(()=>{H.current&&k(H.current.checked)},[k]),ss(Y,()=>{w(B),S(Y!==R.initialValue),k(Y),D.change(Y)});const{getButtonProps:z,buttonRef:K}=Yt({disabled:_,native:h}),X=pu(i,O,H,!h,V),ae={id:h?G:L,role:"switch","aria-checked":Y,"aria-readonly":A||void 0,"aria-required":p||void 0,"aria-labelledby":X,onFocus(){_||F(!0)},onBlur(){const ue=H.current;!ue||_||(E(!0),F(!1),T==="onBlur"&&D.commit(ue.checked))},onClick(ue){if(A||_)return;ue.preventDefault();const ce=H.current;ce&&Si(ce,ue)}},te={...D.getValidationProps(_),checked:Y,disabled:_,form:a,id:V,name:B,required:p,style:B?Xi:$o,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:P,onChange(ue){if(ue.nativeEvent.defaultPrevented)return;if(A){ue.preventDefault();return}const ce=ue.currentTarget.checked,he=Ce(Pt,ue.nativeEvent);g?.(ce,he),!he.isCanceled&&Q(ce)},onClick(ue){ue.stopPropagation()},onFocus(){M.current?.focus()},...b!==void 0?{value:b}:lt},$=d.useMemo(()=>({...I,checked:Y,disabled:_,readOnly:A,required:p}),[I,Y,_,A,p]),ee=Me("span",t,{state:$,ref:[n,M,K],props:[ae,y,z,ue=>D.getValidationProps(_,ue)],stateAttributesMapping:Xf});return l.jsxs($f.Provider,{value:$,children:[ee,!Y&&B&&C!==void 0&&l.jsx("input",{type:"hidden",form:a,name:B,value:C,disabled:_}),l.jsx("input",{...te,suppressHydrationWarning:!0})]})}),i1=d.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,a=o1();return Me("span",t,{state:a,ref:n,stateAttributesMapping:Xf,props:i})});function ur({className:e,size:t="default",...n}){return l.jsx(s1,{"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(i1,{"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 a1({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:C,onPickIconCandidate:b,onUploadIcon:v,onClearIcon:y,onPickTray:w,onUploadTray:I,onClearTray:E,onPatch:S,onConfirm:R}){return l.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[l.jsx(bC,{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:v,onClearIcon:y,onPatch:S}),l.jsx(Sa,{className:"mt-4 border-t border-border pt-1",children:l.jsxs(Ra,{value:"advanced",className:"border-b-0",children:[l.jsx(Da,{children:"高级选项"}),l.jsxs(Fa,{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=>S({showStartupTerminal:k})}),l.jsxs("div",{children:[l.jsx(je,{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=>S({showAddressBar:k})}),l.jsxs("div",{children:[l.jsx(je,{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=>S({imageSmoothingEnabled:k})}),l.jsxs("div",{children:[l.jsx(je,{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=>S({developerMode:k})}),l.jsxs("div",{children:[l.jsx(je,{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(je,{children:"托盘图标"}),l.jsx("p",{className:"mb-1.5 mt-0.5 text-[11px] text-muted-foreground",children:"默认与应用图标一致;纯色候选适合系统托盘(macOS 模板风格)。"}),l.jsx(vC,{candidates:r,port:o,disabled:e,selectedRef:p,uploadedUrl:m,includeVariants:!0,defaultLabel:"默认跟随应用图标",onPick:w,onUpload:I,onClear:E})]}),l.jsxs("div",{children:[l.jsx(je,{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(XC,{value:t.pm,disabled:e,onValueChange:k=>S({pm:k}),children:[l.jsx(e1,{id:"pm",className:"mt-0",children:l.jsx(qC,{})}),l.jsxs(t1,{children:[l.jsx(Qs,{value:"npm",children:"npm"}),l.jsx(Qs,{value:"pnpm",children:"pnpm"}),l.jsx(Qs,{value:"bun",children:"bun"})]})]})]}),l.jsxs("div",{className:"rounded-lg border border-border p-3",children:[l.jsx(je,{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 主目录下,同一命令重复创建会落到同一位置; 也可在启动向导时通过位置参数指定其他目录。"}),C?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=>S({force:k})}),l.jsxs("div",{children:[l.jsx(je,{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(_e,{onClick:R,disabled:e,children:"确定创建应用"}),l.jsx("span",{className:"text-xs text-muted-foreground",children:x!==void 0?`已选服务 :${x}(点击状态栏服务可切换)`:"未运行也不影响:应用启动时会自行嗅探命令的监听端口"})]})]})}var ho={},Gs,Wc;function l1(){if(Wc)return Gs;Wc=1;var e=["||","&&",";;","|&","<(","<<<",">>",">&","<&","&",";","(",")","|","<",">"],t=/[\n\r\u2028\u2029]/,n=/[\s#!"$&'():;<=>@\\^`|]/g;return Gs=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(" ")},Gs}var Ys,Qc;function c1(){if(Qc)return Ys;Qc=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,C){for(var b=C.lastIndex,v=[],y;y=C.exec(x);)v[v.length]=y,C.lastIndex===y.index&&(C.lastIndex+=1);return C.lastIndex=b,v}function p(x,C,b){var v=typeof x=="function"?x(b):x[b];return typeof v>"u"&&b!=""?v="":typeof v>"u"&&(v="$"),typeof v=="object"?C+u+JSON.stringify(v)+u:C+v}function m(x,C,b){b||(b={});var v=b.escape||"\\",y=b.splitUnquoted===!0?`
20
+ `:typeof b.splitUnquoted=="string"?b.splitUnquoted:"",w="(\\"+v+`['"`+n+`]|[^\\s'"`+n+"])+",I=new RegExp(["("+e+")","("+w+"|"+o+"|"+r+")+"].join("|"),"g"),E=A(x,I);if(E.length===0)return[];C||(C={});var S=!1;return E.map(function(R){var k=R[0];if(!k||S)return;if(t.test(k))return{op:k};var F=!1,T=!1,N="",j=[],D=!1,O=null,_=!1,B;function H(){B+=1;var z,K,X=k.charAt(B);if(X==="{"){if(B+=1,k.charAt(B)==="}")throw new Error("Bad substitution: "+k.slice(B-2,B+1));var ae=1;for(z=B;ae>0&&z<k.length;)k.charAt(z)==="{"&&k.charAt(z-1)==="$"?ae+=1:k.charAt(z)==="}"&&(ae-=1),z+=1;if(ae!==0)throw new Error("Bad substitution: "+k.slice(B));z-=1,K=k.slice(B,z),B=z}else if(/[*@#?$!_-]/.test(X))K=X,B+=1;else{var te=k.slice(B);z=te.match(/[^\w\d_]/),z?(K=te.slice(0,z.index),B+=z.index-1):(K=te,B=k.length)}return p(C,"",K)}function P(){if(O!==null){if(O===0)N!==""&&(j[j.length]=N,N="");else{j[j.length]=N,N="";for(var z=1;z<O;z+=1)j[j.length]=""}O=null}}for(B=0;B<k.length;B++){var M=k.charAt(B);if(y&&M!==c&&P(),_=_||!F&&(M==="*"||M==="?"),T)N+=M,T=!1;else if(F)M===F?F=!1:F==i?N+=M:M===v?(B+=1,M=k.charAt(B),M===a||M===v||M===c?N+=M:N+=v+M):M===c?N+=H():N+=M;else if(M===a||M===i)F=M,D=!0;else{if(t.test(M))return{op:k};if(s.test(M)){S=!0;var L={comment:x.slice(R.index+B+1)};return N.length?[N,L]:[L]}else if(M===v)T=!0;else if(M===c){var G=H();if(!y)N+=G;else for(var V=0;V<G.length;V+=1){var Y=G.charAt(V);y.indexOf(Y)<0?(P(),N+=Y):O===null?O=Y===" "||Y===" "||Y===`
21
+ `?0:1:Y!==" "&&Y!==" "&&Y!==`
22
+ `&&(O+=1)}}else N+=M}}if(_)return{op:"glob",pattern:N};if(y){if(O!==null&&O>0){j[j.length]=N,N="";for(var Q=1;Q<O;Q+=1)j[j.length]=""}return(N!==""||D&&j.length===0)&&(j[j.length]=N),j}return N}).reduce(function(R,k){return typeof k>"u"||[].concat(k).forEach(function(F){R[R.length]=F}),R},[])}return Ys=function(C,b,v){var y=m(C,b,v);return typeof b!="function"?y:y.reduce(function(w,I){if(typeof I=="object")return w[w.length]=I,w;var E=I.split(RegExp("("+u+".*?"+u+")","g"));return E.length===1?(w[w.length]=E[0],w):(E.filter(Boolean).forEach(function(S){w[w.length]=g.test(S)?JSON.parse(S.split(u)[1]):S}),w)},[])},Ys}var Gc;function u1(){return Gc||(Gc=1,ho.quote=l1(),ho.parse=c1()),ho}var d1=u1();const qf=["npm","go","rust","python","dotnet","custom"],pn={npm:"npm",go:"Go",rust:"Rust",python:"Python",dotnet:".NET",custom:"自定义"},f1={npm:"npmjs",go:"golang",rust:"rust",python:"python",dotnet:"dotnet"},ep=["npx","pnpx","bunx","yarn dlx","nubx","deno run","vpx"],p1=["uvx","pipx run"],tp={family:"npm",runner:"npx",runnerFlags:"",pkg:"",version:"",args:"",binary:"",raw:""},Ga=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=d1.parse(e),n=[];for(const r of t){if(typeof r!="string")return[];n.push(r)}return n.length===0?[]:n},Ya=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:""}},Qn=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()}`},h1=e=>/^(npm|jsr):/.test(e)?e:`npm:${e}`,A1=/^[A-Za-z0-9@._/:+=-]+$/u,g1=e=>A1.test(e)&&e.length>0?e:`'${e.replaceAll("'","'\\''")}'`,Sn=e=>e.map(g1).join(" "),fr=e=>{const t=[];let n=0;for(;n<e.length&&Ya(e[n]??"");)t.push(e[n]??""),n+=1;return{flags:t,rest:e.slice(n)}},m1=[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"])],x1=e=>e.includes("=")?!1:m1.some(t=>t.has(e)),pr=e=>e.every(t=>x1(t)),b1=(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=>({...tp,...e}),hr=e=>hn({family:"custom",raw:Sn(e)}),v1=e=>{const t=e[0]??"",n=e[1]??"";for(const r of ep){const o=b1(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)})},y1=e=>{const t=Ga(e);return t.length===0?hn({family:"custom",raw:e}):v1(t)},np=e=>{const t=e.pkg.trim(),n=e.binary.trim().length>0?e.binary.trim():t;return{install:Qn(["cargo","install",e.runnerFlags,t]),run:Qn([n,e.args])}},vi=e=>{switch(e.family){case"custom":return e.raw.trim();case"rust":return np(e).run;case"npm":{const t=e.runner==="deno run"?h1(dr(e.pkg.trim(),e.version)):dr(e.pkg.trim(),e.version);return Qn([e.runner,e.runnerFlags,t,e.args])}case"go":return Qn(["go","run",e.runnerFlags,dr(e.pkg.trim(),e.version),e.args]);case"python":return Qn([e.runner,e.runnerFlags,dr(e.pkg.trim(),e.version),e.args]);case"dotnet":return Qn(["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 Ga(e)){if(Ya(n))break;const r=n.toLowerCase().replace(/[^a-z0-9-]/g,"");if(r.length===0)break;t.push(r)}return t},C1=e=>{if(e.family==="custom"){const i=[];for(const u of Ga(e.raw)){if(Ya(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=f1[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}},I1=e=>{const t=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"opentray-app"},w1=(e,t)=>{let n;for(const r of e)r.key.trim()===t&&(n=r.value);return n},k1=e=>e.family==="npm"&&(e.runner==="npx"||e.runner==="pnpx")?[{key:"npm_config_yes",value:"true",note:"跳过 npm 安装确认(等效 -y),首次运行无需交互"}]:[],E1='<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>',S1='<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>',R1='<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>',D1='<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>',F1='<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(R1),go:mr(S1),rust:mr(F1),python:mr(D1),dotnet:mr(E1),custom:uu},B1=qf.filter(e=>e!=="custom"),Yc=(e,t,n)=>l.jsx(Ba,{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 M1({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=C1(t),h=vi(t),g=t.family==="rust"?np(t):null,A=Oo[t.family];return l.jsx(Ma,{open:e,onOpenChange:c,children:l.jsxs(ja,{className:"max-h-[85vh] overflow-y-auto sm:max-w-md",children:[l.jsxs(Ln,{children:[l.jsxs(Kn,{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:B1.map(p=>{const m=Oo[p];return l.jsxs(Mo,{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(Pa,{children:"修改字段实时预览命令与默认应用标识;确定后写回命令行。"})]}),l.jsxs("div",{className:"space-y-4",children:[t.family==="npm"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx(je,{children:"Runner"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"同一包换 runner 推导结果不变;deno run 自动补 npm: 前缀。"}),Yc(ep,t.runner,p=>u({runner:p}))]}),t.runnerFlags.length>0||t.runner==="deno run"?l.jsxs("div",{children:[l.jsx(je,{children:"Runner 参数"}),l.jsx(et,{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(je,{children:"包名"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"支持 @scope/name 与 npm: 前缀。"}),l.jsx(et,{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(je,{children:"版本"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空 = latest。"}),l.jsx(et,{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(je,{children:"运行参数"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"追加在包名之后;子命令参与 appId 推导。"}),l.jsx(et,{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(je,{children:"Module 路径"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"取末段作为身份,如 rsc.io/fortune → fortune。"}),l.jsx(et,{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(je,{children:"版本"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空 = 本地/默认。"}),l.jsx(et,{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(je,{children:"运行参数"}),l.jsx(et,{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(je,{children:"安装 crate"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"cargo install 目标;Rust 不能直跑,需先安装。"}),l.jsx(et,{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(je,{children:"运行二进制"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空默认与 crate 同名。"}),l.jsx(et,{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(je,{children:"运行参数"}),l.jsx(et,{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(je,{children:"Runner"}),Yc(p1,t.runner,p=>u({runner:p}))]}),l.jsxs("div",{className:"grid grid-cols-[1fr_110px] gap-3",children:[l.jsxs("div",{children:[l.jsx(je,{children:"包名"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"包名中的 . _ 归一为 - 参与推导。"}),l.jsx(et,{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(je,{children:"版本"}),l.jsx(et,{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(je,{children:"运行参数"}),l.jsx(et,{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(je,{children:"工具 ID"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:".NET 10 dnx:NuGet 工具临时运行,无需安装。"}),l.jsx(et,{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(je,{children:"版本"}),l.jsx(et,{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(je,{children:"运行参数"}),l.jsx(et,{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/",I1(f.appId),"/"]})]}),l.jsxs(eb,{children:[l.jsx(Xx,{render:l.jsx(_e,{variant:"outline"}),children:"取消"}),l.jsxs(_e,{onClick:()=>{a(t)},children:[l.jsx(Pi,{}),"确定"]})]})]})})}const zc=e=>({...tp,family:e,runner:e==="python"?"uvx":e==="npm"?"npx":""}),Uc=e=>e!=="custom",zs=(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 j1({command:e,onCommandChange:t,commandOptions:n,onCommandOptionsChange:r,disabled:o,onRun:s}){const i=d.useMemo(()=>y1(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}!Uc(a.family)||u.currentFamily!==a.family||f(P=>{if(P===null||P.currentFamily!==a.family)return P;const M=P.drafts[a.family],L=P.bases[a.family];return M===void 0||L===void 0||!zs(M,L)?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 M=c.current[P];return M!==void 0?M:i.family===P?i:zc(P)},[m,x]=d.useState(!1),[C,b]=d.useState(!1),[v,y]=d.useState(!1),w=u===null?void 0:u.drafts[u.currentFamily],I=w??n.family??i,E=k1(I)[0],S=E===void 0?void 0:w1(n.env,E.key),R=E===void 0?null:{key:E.key,defaultNote:E.note,state:S!==void 0?"explicit":"off",...S!==void 0?{explicitValue:S}:{}},k=S!==void 0,F=P=>{const M=E?.key??"npm_config_yes",L=P==="enable"?[...n.env.filter(G=>G.key.trim()!==M),{key:M,value:"true"}]:n.env.filter(G=>G.key.trim()!==M);r({...n,env:L})},T=P=>{if(P===A)return;g(P);const M={...n,...n.argsMode==="array"?{argsMode:"string"}:{}},L=p(P);c.current[P]===void 0&&(c.current[P]=L),r({...M,family:P==="custom"?null:L}),t(vi(L))},N=()=>{if(!Uc(A))return;const P=p(A);f({snapshot:{family:A,state:P},currentFamily:A,drafts:{[A]:P},bases:{[A]:P}})},j=P=>{f(M=>M===null||M.currentFamily!==P.family?M:{...M,drafts:{...M.drafts,[P.family]:P}})},D=P=>{f(M=>{if(M===null||M.currentFamily===P)return M;const L=M.drafts[P],G=M.bases[P],V=p(P),Y=L!==void 0&&G!==void 0&&!zs(L,G),Q=Y?L:V;return{...M,currentFamily:P,drafts:{...M.drafts,[P]:Q},bases:{...M.bases,[P]:Y?G:V}}})},O=()=>{f(P=>{if(P===null)return P;const M=c.current[P.snapshot.family];return(M===void 0||zs(M,P.snapshot.state))&&(c.current[P.snapshot.family]=P.snapshot.state),null})},_=P=>{c.current[P.family]=P,g(P.family),t(vi(P)),r({...n,...n.argsMode==="array"?{argsMode:"string"}:{},family:P}),f(null)},B=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(B,{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:qf.map(P=>{const M=Oo[P];return l.jsxs(Mo,{onClick:()=>T(P),className:P===A?"bg-accent/60":void 0,children:[l.jsx(M,{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&&E!==void 0?l.jsxs(ls,{open:m||C||v,onOpenChange:P=>{P||y(!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:()=>y(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:[E.key,"=",S]}),l.jsx("p",{className:"text-[11px] opacity-70",children:"来自「命令选项 → 环境变量」配置(唯一可信源,两侧同步)"})]})})]}):null]}),l.jsx(M1,{open:u!==null,draft:w??zc(A),envPreset:R,onEnvPresetChange:F,onDraftChange:j,onFamilyChange:D,onCancel:O,onApply:_})]})}function P1({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(Ni,{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 T1({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(P1,{tags:n,onTagsChange:r,disabled:o,"aria-label":"命令参数(argv)"}):l.jsx(j1,{command:e,onCommandChange:t,commandOptions:a,onCommandOptionsChange:u,disabled:o||s,onRun:f}),o?l.jsxs(_e,{variant:"destructive",onClick:h,"aria-label":"中断命令",children:[l.jsx(Ch,{}),"中断"]}):l.jsxs(_e,{disabled:s,onClick:f,"aria-label":"运行命令",children:[l.jsx(ph,{}),"运行"]})]}),i!==void 0?l.jsx("p",{className:"mt-2 font-mono text-xs text-red-400",children:i}):null,l.jsx(Sa,{defaultValue:["command"],className:"mt-3 border-t border-border pt-1",children:l.jsxs(Ra,{value:"command",className:"border-b-0",children:[l.jsx(Da,{children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(xh,{className:"size-4 text-muted-foreground"}),"命令选项"]})}),l.jsxs(Fa,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[l.jsxs("div",{children:[l.jsx(je,{children:"参数输入模式"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"数组模式逐个输入参数(回车添加),原样传递、绝不拆分。"}),l.jsxs(Ba,{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(je,{htmlFor:"cmd-cwd",children:"工作目录 (cwd)"}),l.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空使用用户主目录(下方完整路径);相对路径按主目录解析。"}),l.jsx(et,{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(je,{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(et,{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(et,{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(_e,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":"删除环境变量",onClick:()=>{g({env:a.env.filter((m,x)=>x!==p)})},children:"×"})]},p)),l.jsxs(_e,{variant:"outline",size:"sm",disabled:s,onClick:()=>g({env:[...a.env,{key:"",value:""}]}),children:[l.jsx(Sr,{className:"size-3.5"}),"添加变量"]})]})]})]})]})})]})}const Us=["scaffold","icon","install"];function N1({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:C,onOpenChange:b}){const v=d.useRef(null);d.useEffect(()=>{v.current?.scrollTo({top:v.current.scrollHeight})},[u.length]);const y=w=>{const I=Us.indexOf(w),E=Us.indexOf(c);return t==="success"||I<E?"done":I===E?"active":""};return l.jsx(Ma,{open:e,onOpenChange:w=>{t==="pending"&&w===!1||b(w)},children:l.jsx(ja,{className:"max-w-xl",children:t==="confirm"?l.jsxs(l.Fragment,{children:[l.jsxs(Ln,{children:[l.jsx(Kn,{children:"确认应用信息"}),l.jsx(Pa,{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})]}),C!==void 0?l.jsx("p",{className:"text-xs font-medium text-red-400",children:C}):null,l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(_e,{variant:"outline",onClick:g,children:"返回修改"}),l.jsx(_e,{variant:"outline",onClick:p,children:"分享"}),l.jsx(_e,{onClick:A,children:"确认生成"})]})]}):t==="pending"?l.jsxs(l.Fragment,{children:[l.jsx(Ln,{children:l.jsx(Kn,{children:"正在生成应用…"})}),l.jsx("div",{className:"flex flex-wrap gap-1.5",children:Us.map(w=>l.jsx(bo,{variant:y(w)==="done"?"default":"secondary",children:w},w))}),l.jsx("div",{ref:v,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(Ln,{children:l.jsxs(Kn,{className:"flex items-center gap-2",children:[l.jsx(Wp,{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(_e,{variant:"outline",onClick:x,children:"完成"}),l.jsxs(_e,{onClick:m,children:[l.jsx(cu,{}),"打开应用"]})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:h.pinHint})]}):l.jsxs(l.Fragment,{children:[l.jsx(Ln,{children:l.jsxs(Kn,{className:"flex items-center gap-2",children:[l.jsx(Rh,{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(_e,{variant:"outline",onClick:g,children:"返回重试"})})]})})})}const Vc=(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},rp=d.createContext(void 0);function op(){const e=d.useContext(rp);if(e===void 0)throw new Error(ot(64));return e}const za={tabActivationDirection:e=>({"data-activation-direction":e})},_1=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"}),C=c!==void 0,[b,v]=d.useState(()=>new Map),y=d.useRef(void 0),w=d.useCallback(K=>yi(b,K),[b]),[I,E]=d.useState(()=>({previousValue:m,tabActivationDirection:"none"})),{previousValue:S,tabActivationDirection:R}=I;let k=R,F=!1;S!==m&&(k=Zc(S,m,i,b),F=S!=null&&m!=null&&w(m)==null);const T=F?S:m,N=S!==T||R!==k;ie(()=>{N&&E({previousValue:T,tabActivationDirection:k})},[T,N,k]);const j=de((K,X)=>{const ae=Zc(m,K,i,b);X.activationDirection=ae,s?.(K,X),!X.isCanceled&&x(K)}),D=de((K,X)=>{s?.(K,Ce(X,void 0,void 0,{activationDirection:"none"}))}),O=de((K,X)=>(p(ae=>{const te=new Map(ae);return te.set(K,X),te}),()=>{p(ae=>{if(ae.get(K)!==X)return ae;const te=new Map(ae);return te.delete(K),te})})),_=d.useCallback(K=>A.get(K),[A]),B=d.useCallback(K=>{for(const X of b.values())if(K===X.value)return X.id},[b]),H=d.useMemo(()=>({getTabElementBySelectedValue:w,getTabIdByPanelValue:B,getTabPanelIdByValue:_,onValueChange:j,orientation:i,registerMountedTabPanel:O,setTabMap:v,tabActivationDirection:k,value:m}),[w,B,_,j,i,O,v,k,m]),P=d.useMemo(()=>{for(const K of b.values())if(K.value===m)return K},[b,m]),M=d.useMemo(()=>{for(const K of b.values())if(!K.disabled)return K.value},[b]),L=d.useRef(!h),G=d.useRef(o),V=d.useRef(h),Y=d.useRef(!1);ie(()=>{if(C)return;function K($,ee){x($),E({previousValue:$,tabActivationDirection:"none"}),D($,ee),L.current=!1}if(b.size===0){Y.current&&m!==null&&!y.current?.isConnected&&K(null,tl);return}Y.current=!0,y.current=b.keys().next().value;const X=P?.disabled,ae=P==null&&m!==null;if(!X&&m===G.current&&(V.current=!1),V.current&&X&&m===G.current)return;const te=L.current;if(X||ae){const $=M??null;if(m===$){L.current=!1;return}let ee=tl;te?ee=el:X&&(ee=iu),K($,ee);return}te&&P!=null&&(D(m,el),L.current=!1)},[M,C,D,P,x,b,m]);const z=Me("div",t,{state:{orientation:i,tabActivationDirection:k},ref:n,props:f,stateAttributesMapping:za});return l.jsx(rp.Provider,{value:H,children:l.jsx(Ur,{elementsRef:g,children:z})})});function yi(e,t){for(const[n,r]of e.entries())if(t===r.value)return n;return null}function Zc(e,t,n,r){if(e==null||t==null)return"none";const[o,s,i]=n==="horizontal"?["left","left","right"]:["top","up","down"],a=yi(r,e),c=yi(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 sp=d.createContext(void 0);function O1(){const e=d.useContext(sp);if(e===void 0)throw new Error(ot(65));return e}const H1=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}=op(),{activateOnFocus:x,registerTabResizeObserverElement:C,tabsListElement:b}=O1(),{highlightedIndex:v,onHighlightedIndexChange:y}=Ri(),w=wt(a),I=d.useMemo(()=>({disabled:o,id:w,value:i}),[o,w,i]),{compositeProps:E,compositeRef:S,index:R}=Td({metadata:I}),k=i===h,F=d.useRef(!1),T=d.useRef(null),N=de(Y=>{T.current?.(),T.current=Y?C(Y):null});ie(()=>{if(F.current){F.current=!1;return}if(!(k&&R>-1&&v!==R))return;const Y=b;if(Y!=null){const Q=vt(Be(Y));if(Q&&ve(Y,Q))return}o||y(R)},[k,R,v,y,o,b]);const{getButtonProps:j,buttonRef:D}=Yt({disabled:o,native:c,focusableWhenDisabled:!0}),O=g(i),_=d.useRef(!1),B=d.useRef(!1);function H(Y){A(i,Ce(Pt,Y.nativeEvent,void 0,{activationDirection:"none"}))}function P(Y){k||o||H(Y)}function M(Y){k||o||x&&(!_.current||B.current)&&H(Y)}function L(Y){if(k||o)return;_.current=!0,B.current=Y.button===0;const Q=Be(Y.currentTarget);function z(){_.current=!1,B.current=!1,Q.removeEventListener("pointerup",z),Q.removeEventListener("pointercancel",z)}Q.addEventListener("pointerup",z),Q.addEventListener("pointercancel",z)}return Me("button",t,{state:{disabled:o,active:k,orientation:p,tabActivationDirection:m},ref:[n,D,S,N],props:[E,{role:"tab","aria-controls":O,"aria-selected":k,id:w,onClick:P,onFocus:M,onPointerDown:L,[rf]:k?"":void 0,onKeyDownCapture(){F.current=!0}},f,j],stateAttributesMapping:za})}),L1=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}=op(),[g,A]=d.useState(0),[p,m]=d.useState(null),x=d.useRef(new Set),C=d.useRef(new Set),b=d.useRef(null);ie(()=>{if(typeof ResizeObserver>"u")return;const S=new ResizeObserver(()=>{x.current.forEach(R=>{R()})});return b.current=S,p&&S.observe(p),C.current.forEach(R=>{S.observe(R)}),()=>{S.disconnect(),b.current=null}},[p]);const v=de(S=>(x.current.add(S),()=>{x.current.delete(S)})),y=de(S=>(C.current.add(S),b.current?.observe(S),()=>{C.current.delete(S),b.current?.unobserve(S)})),w={orientation:u,tabActivationDirection:h},I={"aria-orientation":u==="vertical"?"vertical":void 0,role:"tablist"},E=d.useMemo(()=>({activateOnFocus:r,registerIndicatorUpdateListener:v,registerTabResizeObserverElement:y,tabsListElement:p}),[r,v,y,p]);return l.jsx(sp.Provider,{value:E,children:l.jsx(of,{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 K1({className:e,orientation:t="horizontal",...n}){return l.jsx(_1,{"data-slot":"tabs","data-orientation":t,className:fe("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const W1=Ci("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 Q1({className:e,variant:t="default",...n}){return l.jsx(L1,{"data-slot":"tabs-list","data-variant":t,className:fe(W1({variant:t}),e),...n})}function Jc({className:e,...t}){return l.jsx(H1,{"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 $c({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 Xc({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 qc({className:e,...t}){return l.jsx("div",{"data-slot":"card-content",className:fe("px-(--card-spacing)",e),...t})}function G1({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 ip=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"})});ip.displayName="StableIframe";const Y1=e=>{const t=e.trim();if(t.length!==0)try{return new URL(/^https?:\/\//iu.test(t)?t:`http://${t}`).href}catch{return}},eu=({status:e,services:t,activeTab:n,onJumpToService:r})=>l.jsxs(G1,{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 z1({command:e,terminalHostRef:t,terminalReady:n,interactive:r,status:o,services:s,iframeTabs:i,activeTab:a,onActiveTabChange:c,onIframeNavigate:u,onIframeHistoryMove:f,onJumpToService:h,className:g}){return l.jsxs("div",{className:fe("flex min-h-0 flex-col gap-2",g),children:[l.jsx(K1,{value:a,onValueChange:c,children:l.jsxs(Q1,{variant:"line",className:"w-full justify-start border-b px-2",children:[l.jsxs(Jc,{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(A=>l.jsxs(Jc,{value:`svc-${A.port}`,children:[l.jsx(nl,{className:"size-3.5"}),xC(A.url),":",new URL(A.url).port]},A.port))]})}),l.jsx("div",{className:"flex min-h-0 flex-1 flex-col",hidden:a!=="terminal",children:l.jsxs($c,{size:"sm",className:"min-h-0 flex-1 gap-0",children:[l.jsx(Xc,{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(qc,{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(eu,{status:o,services:s,activeTab:a,onJumpToService:h})]})}),i.map(A=>l.jsx("div",{className:"flex min-h-0 flex-1 flex-col",hidden:a!==`svc-${A.port}`,children:l.jsxs($c,{size:"sm",className:"min-h-0 flex-1 gap-0",children:[l.jsx(Xc,{className:"border-b [.border-b]:pb-2",children:l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(_e,{variant:"ghost",size:"icon-sm",disabled:A.historyIndex===0,onClick:()=>f(A.port,-1),"aria-label":"后退",children:l.jsx(jp,{})}),l.jsx(_e,{variant:"ghost",size:"icon-sm",disabled:A.historyIndex>=A.history.length-1,onClick:()=>f(A.port,1),"aria-label":"前进",children:l.jsx(Pp,{})}),l.jsx(_e,{variant:"ghost",size:"icon-sm",onClick:()=>u(A.port,A.url,"replace"),"aria-label":"重新加载",children:l.jsx(Tp,{})}),l.jsx(nl,{className:"size-4 shrink-0 text-muted-foreground"}),l.jsx(et,{className:"tech-ltr h-7 font-mono text-xs",defaultValue:A.url,placeholder:"输入 URL 跳转",onKeyDown:p=>{if(p.key!=="Enter")return;const m=p.target.value,x=Y1(m);x!==void 0&&u(A.port,x,"push")}},`${A.port}:${A.historyIndex}:${A.url}`)]})}),l.jsx(qc,{className:"min-h-0 flex-1 p-0",children:l.jsx(ip,{port:A.port,url:A.url,visible:a===`svc-${A.port}`})}),l.jsx(eu,{status:o,services:s,activeTab:a,onJumpToService:h})]})},A.port))]})}const tu={appId:"",appName:"",iconPath:"",iconBackground:"transparent",iconScale:.8,trayIconPath:"",force:!1,pm:"npm",showStartupTerminal:!1,showAddressBar:!1,imageSmoothingEnabled:!0,developerMode:!1},U1={appId:"",appName:"",targetDir:"",iconPath:""};function V1(){const{query:e}=zd(),t=e.get("edit"),[n,r]=d.useState(void 0),[o,s]=d.useState(""),[i,a]=d.useState([]),[c,u]=d.useState(gC),[f,h]=d.useState(""),[g,A]=d.useState(!1),[p,m]=d.useState(!1),x=d.useCallback(Z=>{m(Z),Vn.set(Z)},[]);d.useEffect(()=>(Vn.set(p),()=>Vn.set(!1)),[p]);const[C,b]=d.useState(!1),[v,y]=d.useState("idle"),[w,I]=d.useState(),[E,S]=d.useState(""),[R,k]=d.useState(!0),[F,T]=d.useState(!1),[N,j]=d.useState(),[D,O]=d.useState(tu),[_,B]=d.useState(U1),[H,P]=d.useState([]),[M,L]=d.useState(),[G,V]=d.useState(!1),[Y,Q]=d.useState([]),[z,K]=d.useState(),[X,ae]=d.useState(),[te,$]=d.useState(),[ee,ue]=d.useState(),[ce,he]=d.useState(),[se,Ae]=d.useState("transparent"),[re,oe]=d.useState(.8),le=d.useRef(void 0),ge=d.useRef(void 0),me=d.useRef(!1),W=d.useRef(!1),[U,be]=d.useState(),[q,ne]=d.useState(),[Ee,Se]=d.useState(),[Ge,ze]=d.useState("terminal"),[Le,ct]=d.useState([]),[tt,Je]=d.useState({cursorX:0,cursorY:0,cols:0,rows:0}),[ft,Ie]=d.useState(!1),[Ke,Ne]=d.useState("confirm"),[nt,Re]=d.useState([]),[Ue,Ve]=d.useState(""),[$e,gt]=d.useState(),[pt,Rt]=d.useState(),[st,Et]=d.useState(tu),Dt=d.useRef(null),ht=d.useRef(void 0),De=d.useRef([]),We=d.useRef(D);We.current=D;const mt=d.useRef(v);mt.current=v;const yt=(Z,ye,J)=>{if(ye===void 0)return!1;const pe=Number.parseInt(ye.split(":")[1]??"",10);return!Z.some(Te=>Te.index===pe)||ye.split(":")[0]!==String(J)},Ct=d.useRef(void 0);d.useEffect(()=>{const Z=D.iconPath.trim().length>0?D.iconPath.trim():_.iconPath.trim().length>0?_.iconPath.trim():void 0;if(Ct.current=Z,Z===void 0){$(void 0),he(void 0),le.current=void 0;return}Z===le.current&&ce!==void 0||(async()=>{try{ue(void 0);const ye=await Qe("/api/icon-analyze",{path:Z});if(!ye.ok)throw new Error("analyze failed");const J=await ye.json();if(Ct.current!==Z)return;$(J),me.current=!1,Ae(J.suggested),Qe("/api/form",{iconBackground:J.suggested});const pe=await Qe("/api/icon-compose",{foregroundPath:Z,background:J.suggested,scale:re});if(!pe.ok)throw new Error("compose failed");const Te=await pe.json();if(Ct.current!==Z)return;he(Te),le.current=Z}catch{$(void 0),he(void 0),ue("图标分析或合成失败,预览不可用")}})()},[D.iconPath,_.iconPath]);const Ft=Vc(Z=>{Qe("/api/form",{iconScale:Z});const ye=kn();Ua(ye,se,Z)},250),Ht=Z=>{oe(Z),Ft(Z)},cn=Vc(Z=>{Qe("/api/form",{iconBackground:Z});const ye=kn();Ua(ye,Z,re)},120),ir=Z=>{me.current=!0,Ae(Z),cn(Z)},kn=()=>D.iconPath.trim().length>0?D.iconPath.trim():_.iconPath.trim().length>0?_.iconPath.trim():void 0,Ua=d.useCallback(async(Z,ye,J)=>{if(Z===void 0){$(void 0),he(void 0),le.current=void 0,ge.current=void 0;return}ge.current=Z;try{const pe=await Qe("/api/icon-analyze",{path:Z});if(!pe.ok)throw new Error("analyze failed");const Te=await pe.json();if(ge.current!==Z)return;$(Te);const xt=await Qe("/api/icon-compose",{foregroundPath:Z,background:ye,scale:J});if(!xt.ok)throw new Error("compose failed");const Jt=await xt.json();if(ge.current!==Z)return;he(Jt),le.current=Z}catch{$(void 0),he(void 0),ue("图标合成失败,预览未更新")}},[]);d.useEffect(()=>{Np()},[]);const ap=d.useRef(!1);d.useEffect(()=>{t===null||n===t||(r(t),(async()=>{const Z=await Vd(t);if(Z.status!==200||"code"in Z.data)return;const ye=Z.data;if(ye.command?.executable!==void 0&&s(ye.command.executable),ye.command?.args!==void 0&&a([...ye.command.args]),ye.command?.executable!==void 0&&u(J=>({...J,argsMode:"array"})),ye.appName!==void 0){const J=ye.appName;O(pe=>({...pe,appName:J}))}if(ye.icons?.imageSmoothingEnabled!==void 0){const J=ye.icons.imageSmoothingEnabled;O(pe=>({...pe,imageSmoothingEnabled:J}))}if(ye.developerMode!==void 0){const J=ye.developerMode;O(pe=>({...pe,developerMode:J,force:!0}))}if(ye.command?.cwd!==void 0){const J=ye.command.cwd;u(pe=>({...pe,cwd:J}))}if(ye.command?.env!==void 0){const J=Object.entries(ye.command.env).map(([pe,Te])=>({key:pe,value:Te}));u(pe=>({...pe,env:J}))}ap.current=!0})())},[t,n]),d.useEffect(()=>{if(!p)return;let Z=!1;return(async()=>{const ye=Dt.current;if(ye===null)return;const J=await _p(ye);if(Z||J===void 0){Z||j("ghostty-web 加载失败,输出将以纯文本显示");return}ht.current=J,T(!0);const pe=De.current;De.current=[];for(const xt of pe)J.write(xt);J.onData(xt=>{Va.current&&Qe("/api/terminal-input",{data:xt})}),J.onResize(({cols:xt,rows:Jt})=>{Qe("/api/terminal-resize",{cols:xt,rows:Jt})});const Te=window.setInterval(()=>{if(!(mt.current==="idle"&&!ht.current))try{Je(J.readState())}catch{}},300);return()=>window.clearInterval(Te)})(),()=>{Z=!0,ht.current?.dispose(),ht.current=void 0}},[p]);const Va=d.useRef(!0);d.useEffect(()=>{Va.current=R},[R]),d.useEffect(()=>{const Z=mC();return Z.onmessage=ye=>{const J=JSON.parse(ye.data);switch(J.type){case"snapshot":{y(J.state),b(J.runAlive),s(J.command),S(J.command),u(J.commandOptions),k(J.interactive),O(J.form),B(J.defaults),A(J.targetDirExists),P(J.services),L(J.selectedPort),Q(J.icons??[]),K(J.iconsPort),ct(J.services.map(Te=>({port:Te.port,url:Te.url,history:[Te.url],historyIndex:0})));const pe=J.runAlive||J.services.length>0;x(pe),ze(pe&&J.services.length>0?`svc-${J.services[0].port}`:"terminal");break}case"state":y(J.state),J.state==="failed"&&I(J.reason),J.state==="frozen"&&(Ne("confirm"),Ie(!0)),J.state==="materializing"&&(Ne("pending"),Re([])),J.state==="success"&&Ne("success"),J.state==="failed"&&Ja.current&&(Ne("failed"),gt(J.reason));break;case"log":{ht.current!==void 0?ht.current.write(J.chunk):Za.current!==void 0?j(pe=>(pe??"")+J.chunk):De.current.push(J.chunk);break}case"term-mode":if(k(J.interactive),!J.interactive&&J.message!==void 0){const pe=`\x1B[33m${J.message}\x1B[0m\r
24
+ `;ht.current!==void 0?ht.current.write(pe):De.current.push(pe)}break;case"run-status":b(J.running);break;case"command-display":S(J.command);break;case"command-options":u(J.options),h(J.defaultCwd);break;case"services":{P(J.services),L(J.selectedPort),ct(pe=>{const Te=[...pe];let xt;for(const Jt of J.services)Te.find(yp=>yp.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&&ze(`svc-${xt}`),Te});break}case"icons":Q(J.icons),K(J.port),yt(J.icons,X,J.port)&&ae(void 0),yt(J.icons,q,J.port)&&ne(void 0);break;case"scrape":V(J.hasIcon);break;case"form":{O(t!==null?Te=>Te:J.values),B(J.defaults),A(J.targetDirExists),W.current||(W.current=!0,Ae(J.values.iconBackground),oe(J.values.iconScale));break}case"materialize-step":Ve(J.step),Re(pe=>[...pe,`[${J.step}] ${J.message}`]);break;case"materialize-log":Re(pe=>[...pe,J.message]);break;case"success":Rt({projectDir:J.projectDir,...J.bundlePath===void 0?{}:{bundlePath:J.bundlePath},pinHint:J.pinHint}),window.dispatchEvent(new Event("create-opentray:apps-changed"));break}},()=>Z.close()},[]);const Za=d.useRef(void 0);d.useEffect(()=>{Za.current=N},[N]);const Ja=d.useRef(!1);d.useEffect(()=>{Ja.current=ft},[ft]);const gs=X===void 0?void 0:Number.parseInt(X.split(":")[1]??"",10),lp=ce!==void 0?Wf(ce.key):U!==void 0?U:z!==void 0&&gs!==void 0&&Y.some(Z=>Z.index===gs)?Wn(z,gs):z!==void 0&&Y!==void 0&&Y[0]!==void 0&&X===void 0?Wn(z,Y[0].index):void 0,cp=ce!==void 0?`合成 ${ce.background==="transparent"?"透明底":ce.background==="black"?"黑底":"白底"}`:U!==void 0?"本地图片":Y[0]!==void 0?`${Y[0].width}×${Y[0].height} ${Y[0].format.toUpperCase()}`:"首字母图标",$a=(()=>{if(Ee!==void 0)return Ee;const Z=D.trayIconPath.trim();if(Z.length>0&&z!==void 0){const J=Y.find(pe=>pe.path===Z);if(J!==void 0)return Wn(z,J.index)}const ye=/^([^:]+):(\d+)$/.exec(q??"");if(ye!==null){const J=Number(ye[1]),pe=Number(ye[2]);if(Number.isInteger(J)&&Number.isInteger(pe))return Wn(J,pe)}Z.length})(),up=Ee!==void 0?"本地图片":$a!==void 0?"跟随源图":"跟随应用图标";d.useEffect(()=>{const Z=o.trim();if(Z.length===0)return;const ye=window.setTimeout(()=>{Qe("/api/prime",{command:Z})},400);return()=>window.clearTimeout(ye)},[o]);const dp=async()=>{const Z=o.trim();if(!(c.argsMode==="string"&&Z.length===0)){if(x(!0),ze("terminal"),ht.current?.reset(),ct([]),P([]),V(!1),Q([]),K(void 0),ae(void 0),be(void 0),ne(void 0),Se(void 0),c.argsMode==="array"){if(i.length===0||(i[0]??"").trim().length===0)return;await Qe("/api/command",{argv:i});return}await Qe("/api/command",{command:Z})}},fp=Z=>{if(Le.find(J=>J.port===Z)===void 0){Qe("/api/select-service",{port:Z});return}Qe("/api/select-service",{port:Z}),ze(`svc-${Z}`)},pp=(Z,ye,J)=>{ct(pe=>pe.map(Te=>{if(Te.port!==Z)return Te;if(J==="replace")return{...Te,url:ye};const xt=[...Te.history.slice(0,Te.historyIndex+1),ye];return{...Te,url:ye,history:xt,historyIndex:xt.length-1}}))},hp=(Z,ye)=>{ct(J=>J.map(pe=>{if(pe.port!==Z)return pe;const Te=pe.historyIndex+ye;return Te<0||Te>=pe.history.length?pe:{...pe,historyIndex:Te,url:pe.history[Te]}}))},[Ap,ms]=d.useState(),gp=async()=>{Ft.flush(),cn.flush(),Ne("confirm"),Ie(!0);try{const Z=await Qe("/api/confirm",{});if(!Z.ok){const ye=await Z.json().catch(()=>({}));ms(ye.error??`确认失败(${Z.status})`);return}ms(void 0)}catch{ms("确认请求失败")}};d.useEffect(()=>{v==="frozen"&&Et({...We.current,...D})},[v]);const mp=async()=>{await Qe("/api/create",{})},[xp,Xa]=d.useState(!1),bp=Z=>xx(Z),xs=async()=>{Ie(!1),(await Qe("/api/cancel",{})).ok||y(ye=>ye==="frozen"?"discovered":ye)},vp=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:vp,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(T1,{command:o,onCommandChange:s,argv:i,onArgvChange:Z=>a([...Z]),runAlive:C,frozen:v==="materializing"||v==="frozen"||v==="success",failedReason:v==="failed"?w:void 0,commandOptions:c,defaultCwd:f,onCommandOptionsChange:Z=>{u(Z),Qe("/api/command-options",{cwd:Z.cwd,env:Z.env,argsMode:Z.argsMode,family:Z.family})},onRun:()=>{dp()},onStop:()=>{Qe("/api/stop",{})}}),l.jsx(a1,{frozen:v==="frozen"||v==="materializing"||v==="success",values:D,defaults:_,candidates:Y,candidatesPort:z,selectedIconRef:X,uploadedIconUrl:U,iconAnalysis:te,iconComposition:ce,iconComposeError:ee,iconBackground:se,iconScale:re,onIconBackgroundChange:ir,onIconScaleChange:Ht,selectedTrayRef:q,uploadedTrayUrl:Ee,selectedPort:M,targetDirExists:g,onPickIconCandidate:Z=>{z!==void 0&&(ae(`${z}:${Z.index}`),be(void 0),Qe("/api/icon-select",{port:z,index:Z.index}))},onUploadIcon:Z=>{const ye=URL.createObjectURL(Z);be(ye),ae(void 0),Z.arrayBuffer().then(J=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":Z.type||"application/octet-stream",authorization:`Bearer ${new URLSearchParams(location.search).get("token")??""}`},body:J}).then(pe=>pe.json()).then(({path:pe})=>{pe===void 0||pe.length===0||(O(Te=>({...Te,iconPath:pe})),Qe("/api/form",{iconPath:pe}))}).catch(()=>{})})},onClearIcon:()=>{ae(void 0),be(void 0),O(Z=>({...Z,iconPath:""})),Qe("/api/form",{iconPath:""})},onPickTray:Z=>{z!==void 0&&(ne(`${z}:${Z.index}`),Se(void 0),Qe("/api/tray-icon-select",{port:z,index:Z.index}))},onUploadTray:Z=>{const ye=URL.createObjectURL(Z);Se(ye),ne(void 0),Z.arrayBuffer().then(J=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":Z.type||"application/octet-stream",authorization:`Bearer ${new URLSearchParams(location.search).get("token")??""}`},body:J}).then(pe=>pe.json()).then(({path:pe})=>{pe===void 0||pe.length===0||(O(Te=>({...Te,trayIconPath:pe})),Qe("/api/form",{trayIconPath:pe}))}).catch(()=>{})})},onClearTray:()=>{ne(void 0),Se(void 0),O(Z=>({...Z,trayIconPath:""})),Qe("/api/form",{trayIconPath:""})},onPatch:Z=>{O(ye=>({...ye,...Z})),Qe("/api/form",Z)},onConfirm:()=>{gp()}})]}),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(z1,{command:E,terminalHostRef:Dt,terminalReady:F,interactive:R,status:tt,services:[...H],iframeTabs:Le,activeTab:Ge,onActiveTabChange:ze,onIframeNavigate:pp,onIframeHistoryMove:hp,onJumpToService:fp,className:"min-h-[480px] flex-1"}),N!==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:N}):null]}):null}),l.jsx(N1,{open:ft,onOpenChange:Z=>{if(Z){Ie(!0);return}if(Ke==="confirm"){xs();return}Ie(!1)},phase:Ke,frozenValues:st,iconSrc:lp,iconLabel:cp,traySrc:$a,trayLabel:up,selectedPort:M,currentStep:Ue,logs:nt,error:$e??w,result:pt,onBack:()=>{xs()},onCreate:()=>{mp()},onShare:()=>Xa(!0),onOpenApp:()=>{Qe("/api/open-app",{})},confirmError:Ap,onClose:()=>{if(Ke==="confirm"){xs();return}Ie(!1)}}),l.jsx(lf,{open:xp,subtitle:st?.appId??E,hasEnv:c.env.some(Z=>Z.key.trim().length>0),share:!0,runner:bp,onClose:()=>Xa(!1)})]})}function Z1(){const{route:e}=Ud();return l.jsxs(l.Fragment,{children:[l.jsx("div",{hidden:e!=="add",className:"min-h-0 flex-1",children:l.jsx(V1,{})}),l.jsx("div",{hidden:e!=="applications",className:"min-h-0 flex-1",children:l.jsx(cb,{})}),l.jsx("div",{hidden:e!=="help",className:"min-h-0 flex-1",children:l.jsx(AC,{})})]})}const Vn={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)}},J1=()=>{const[e,t]=d.useState(Vn.open);return d.useEffect(()=>Vn.subscribe(()=>t(Vn.open)),[]),e};function $1(){return l.jsx(cx,{panelOpen:J1(),children:l.jsx(Z1,{})})}const Ho=sx();fi(Ho.locale,Ho.theme);kp.createRoot(document.getElementById("root")).render(l.jsx(Ep.StrictMode,{children:l.jsx(ix,{initialLocale:Ho.locale,initialTheme:Ho.theme,children:l.jsx($1,{})})}));