create-opentray 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -133
- package/assets/create-opentray-logo.png +0 -0
- package/dist/bin-sZB5nWq0.mjs +2142 -0
- package/dist/bin-sZB5nWq0.mjs.map +1 -0
- package/dist/bin.d.mts +15 -2
- package/dist/bin.d.mts.map +1 -0
- package/dist/bin.mjs +1 -1
- package/dist/index.d.mts +62 -351
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/shell/assets/browse.js +1 -1
- package/dist/shell/assets/index.css +1 -1
- package/dist/shell/assets/index.js +7 -7
- package/dist/shell/assets/input.js +1 -1
- package/dist/shell/assets/main.js +21 -43
- package/dist/shell/assets/terminal-pane.js +1 -1
- package/dist/shell/browse.html +3 -0
- package/dist/shell/favicon-16.png +0 -0
- package/dist/shell/favicon-32.png +0 -0
- package/dist/shell/favicon-64.png +0 -0
- package/dist/shell/index.html +3 -0
- package/dist/shell/logo.png +0 -0
- package/dist/shell/terminal.html +3 -0
- package/dist/skill/SKILL.md +156 -0
- package/dist/skill/references/cli-reference.md +77 -0
- package/dist/skill/references/how-it-works.md +49 -0
- package/dist/webui/assets/browse.js +1 -1
- package/dist/webui/assets/index.css +1 -1
- package/dist/webui/assets/index.js +7 -7
- package/dist/webui/assets/input.js +1 -1
- package/dist/webui/assets/main.js +21 -43
- package/dist/webui/assets/terminal-pane.js +1 -1
- package/dist/webui/browse.html +3 -0
- package/dist/webui/favicon-16.png +0 -0
- package/dist/webui/favicon-32.png +0 -0
- package/dist/webui/favicon-64.png +0 -0
- package/dist/webui/index.html +3 -0
- package/dist/webui/logo.png +0 -0
- package/dist/webui/terminal.html +3 -0
- package/package.json +12 -6
- package/skill/SKILL.md +156 -0
- package/skill/references/cli-reference.md +77 -0
- package/skill/references/how-it-works.md +49 -0
- package/dist/bin-BT_kcLuP.mjs +0 -3823
- package/dist/bin-BT_kcLuP.mjs.map +0 -1
- package/dist/bin-CeFW1wxR.d.mts +0 -15
- package/dist/bin-CeFW1wxR.d.mts.map +0 -1
- package/dist/icon-codec-BQ3cGV1n.mjs +0 -13
- package/dist/icon-codec-BQ3cGV1n.mjs.map +0 -1
|
@@ -1,43 +1,21 @@
|
|
|
1
|
-
var so=e=>{throw TypeError(e)};var io=(e,t,n)=>t.has(e)||so("Cannot "+n);var ce=(e,t,n)=>(io(e,t,"read from private field"),n?n.call(e):t.get(e)),ao=(e,t,n)=>t.has(e)?so("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),In=(e,t,n,r)=>(io(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{c as _e,b as ua,r as c,j as i,d as Q,e as At,R as da,a as fa}from"./index.js";import{c as tt,I as et,u as ne,B as de,G as co,A as pa,a as ma,R as ha}from"./input.js";import{T as nn,B as ar,p as va,c as ga}from"./terminal-pane.js";const xa=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ba=_e("check",xa);const ya=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],$o=_e("chevron-down",ya);const wa=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ca=_e("circle-check",wa);const Sa=[["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"}]],Ra=_e("external-link",Sa);const Ea=[["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"}]],Pa=_e("play",Ea);const ja=[["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"}]],Na=_e("settings-2",ja);const Ia=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Aa=_e("square",Ia);const Ta=[["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"}]],Oa=_e("triangle-alert",Ta);const _a=[["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"}]],Fo=_e("upload",_a);const Da=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Lo=_e("x",Da);var Tt=ua(),ka=Object.defineProperty,Ma=(e,t)=>ka(e,"name",{value:t,configurable:!0}),$a=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],H=$a.reduce((e,t)=>{const n=tt(`Primitive.${t}`),r=c.forwardRef((o,s)=>{const{asChild:a,...l}=o,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(u,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Bo(e,t){e&&Tt.flushSync(()=>e.dispatchEvent(t))}Ma(Bo,"dispatchDiscreteCustomEvent");var Fa=Object.defineProperty,La=(e,t)=>Fa(e,"name",{value:t,configurable:!0}),Ba=c.forwardRef(La(function(t,n){return i.jsx(H.label,{...t,ref:n,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}})},"Label")),zo=Ba;const fe=c.forwardRef(({className:e,...t},n)=>i.jsx(zo,{ref:n,className:Q("text-xs font-medium text-muted-foreground leading-none",e),...t}));fe.displayName=zo.displayName;const Vo=e=>`/api/icon-composed/${e}?token=${encodeURIComponent(new URLSearchParams(location.search).get("token")??"")}`,za={cwd:"",env:[],argsMode:"string"},cr=new URLSearchParams(location.search).get("token")??"",J=(e,t={})=>fetch(e,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${cr}`},body:JSON.stringify(t)}),Va=()=>new EventSource(`/api/events?token=${encodeURIComponent(cr)}`),pt=(e,t)=>`/api/icon-data/${e}/${t}?token=${encodeURIComponent(cr)}`,Ha=e=>{try{return new URL(e).hostname}catch{return e}};function Ua({values:e,defaults:t,frozen:n,iconCandidates:r,iconCandidatesPort:o,uploadedIconUrl:s,selectedIconRef:a,iconAnalysis:l,iconComposition:u,iconComposeError:f,iconBackground:p,iconScale:d,onIconBackgroundChange:h,onIconScaleChange:x,onPickIconCandidate:g,onUploadIcon:v,onClearIcon:m,onPatch:C}){const b=n,y=c.useRef(null),[w,R]=c.useState(!1);return i.jsxs("div",{className:"grid grid-cols-1 gap-y-1",children:[i.jsxs("div",{children:[i.jsx(fe,{children:"应用图标"}),i.jsxs("div",{className:"mt-1.5 flex flex-wrap items-start gap-3",children:[i.jsx("button",{type:"button",disabled:b,"aria-label":"选择本地图片作为应用图标",onClick:()=>y.current?.click(),onDragOver:S=>{S.preventDefault(),b||R(!0)},onDragLeave:()=>R(!1),onDrop:S=>{if(S.preventDefault(),R(!1),b)return;const P=S.dataTransfer.files[0];P!==void 0&&v(P)},className:Q("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",w&&"border-primary bg-primary/10"),children:s!==void 0?i.jsx("img",{src:s,alt:"已选图标",className:"icon-checker size-full rounded object-contain"}):i.jsxs("span",{className:"flex flex-col items-center gap-1 text-muted-foreground",children:[i.jsx(Fo,{className:"size-4"}),i.jsx("span",{className:"text-[10px] leading-tight",children:"点击或拖入图片"})]})}),i.jsx("input",{ref:y,type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden",disabled:b,onChange:S=>{const P=S.target.files?.[0];P!==void 0&&v(P),S.target.value=""}}),i.jsx("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:r.length===0?i.jsx("span",{className:"text-xs text-muted-foreground",children:"未抓取到候选图标;将使用首字母图标"}):r.map(S=>{const P=o===void 0?void 0:pt(o,S.index),I=a===`${o}:${S.index}`,N=a===void 0&&S.index===0;return i.jsx("button",{type:"button",disabled:b,title:`${S.width}×${S.height} ${S.format.toUpperCase()}`,onClick:()=>g(S),className:Q("icon-checker flex size-14 items-center justify-center overflow-hidden rounded-lg border p-1 transition-all",I||N?"border-primary ring-2 ring-primary/60":"border-border hover:border-primary/60",b&&"opacity-50"),children:P!==void 0?i.jsx("img",{src:P,alt:`候选图标 ${S.width}×${S.height}`,className:"size-full object-contain"}):null},S.index)})}),a!==void 0||s!==void 0?i.jsx("button",{type:"button",disabled:b,onClick:m,className:"text-[11px] text-muted-foreground underline-offset-2 hover:underline",children:"清除选择(回到默认)"}):null]}),i.jsx("div",{className:"mt-3 rounded-lg border border-border p-3",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{role:"img",className:"icon-checker size-14 shrink-0 overflow-hidden rounded-[10px]","aria-label":"图标合成预览",children:u!==void 0?i.jsx("img",{src:Vo(u.key),alt:"图标合成预览",className:"size-full object-contain",onError:S=>{S.currentTarget.style.display="none"}}):i.jsx("span",{className:"flex size-full items-center justify-center text-[10px] text-muted-foreground",children:"预览"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx(fe,{children:"图标背景"}),i.jsx("div",{className:"mt-1.5 flex gap-1.5",children:["black","white","transparent"].map(S=>i.jsxs("button",{type:"button",disabled:b,"aria-pressed":p===S,onClick:()=>h(S),className:Q("flex h-7 items-center gap-1.5 rounded-md border px-2.5 text-[11px] transition-colors",p===S?"border-foreground bg-secondary text-secondary-foreground":"border-border text-muted-foreground hover:border-foreground/40"),children:[S==="black"?"黑色":S==="white"?"白色":"透明",l!==void 0&&l.suggested===S?i.jsx("span",{className:"text-[10px] text-muted-foreground/70",children:"自动"}):null]},S))}),i.jsxs("div",{className:"mt-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(fe,{className:"text-[11px]",children:"前景缩放"}),i.jsxs("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[Math.round(d*100),"%"]})]}),i.jsx("input",{type:"range",min:50,max:95,step:5,value:Math.round(d*100),disabled:b,onChange:S=>x(Number(S.target.value)/100),className:"mt-1 w-full accent-foreground","aria-label":"前景图标缩放"})]}),f!==void 0?i.jsx("p",{role:"alert",className:"mt-1.5 text-[11px] font-medium text-red-400",children:f}):null,l!==void 0?i.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-muted-foreground",children:p==="transparent"?"透明背景:原始像素直接透出。":`已按明暗自动选择${l.suggested===p?"":"(已手动覆盖)"}:${l.luminance===void 0?"无法分析明暗":`前景明度 ${l.luminance.toFixed(2)}、覆盖率 ${(l.coverage*100).toFixed(0)}%`}。`}):null]})]})})]}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"appId",children:"App ID"}),i.jsx(et,{id:"appId",className:"mt-1 font-mono",disabled:b,value:e.appId,placeholder:t.appId||"由命令推导(如 start.somecommand.npx)",onChange:S=>C({appId:S.target.value})})]}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"appName",children:"应用名称"}),i.jsx(et,{id:"appName",className:"mt-1",disabled:b,value:e.appName,placeholder:t.appName||"从服务页面标题抓取",onChange:S=>C({appName:S.target.value})})]})]})}function Wa({candidates:e,port:t,disabled:n,selectedRef:r,uploadedUrl:o,includeVariants:s,defaultLabel:a,onPick:l,onUpload:u,onClear:f}){const p=c.useRef(null),[d,h]=c.useState(!1),x=s?e:e.filter(v=>v.variant==="original"),g=e.filter(v=>v.variant==="original");return i.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[i.jsx("button",{type:"button",disabled:n,"aria-label":"选择本地图片",onClick:()=>p.current?.click(),onDragOver:v=>{v.preventDefault(),n||h(!0)},onDragLeave:()=>h(!1),onDrop:v=>{if(v.preventDefault(),h(!1),n)return;const m=v.dataTransfer.files[0];m!==void 0&&u(m)},className:Q("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",d&&"border-primary bg-primary/10"),children:o!==void 0?i.jsx("img",{src:o,alt:"已选图标",className:"icon-checker size-full rounded object-contain"}):i.jsxs("span",{className:"flex flex-col items-center gap-1 text-muted-foreground",children:[i.jsx(Fo,{className:"size-4"}),i.jsx("span",{className:"text-[10px] leading-tight",children:"上传"})]})}),i.jsx("input",{ref:p,type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden",disabled:n,onChange:v=>{const m=v.target.files?.[0];m!==void 0&&u(m),v.target.value=""}}),i.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[x.length===0?i.jsx("span",{className:"text-xs text-muted-foreground",children:"暂无候选图标"}):x.map(v=>{const m=t===void 0?void 0:pt(t,v.index),C=r===`${t}:${v.index}`,b=r===void 0&&v.variant==="original"&&v.index===(g[0]?.index??-1);return i.jsx("button",{type:"button",disabled:n,title:v.variant==="original"?`${v.width}×${v.height} ${v.format.toUpperCase()}`:`${v.variant==="solid-black"?"黑色":"白色"}纯色 ${v.format.toUpperCase()}`,onClick:()=>l(v),className:Q("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:m!==void 0?i.jsx("img",{src:m,alt:`候选 ${v.variant}`,className:"size-full object-contain"}):null},`${v.variant}:${v.index}`)}),a!==void 0&&r===void 0&&x.length>0?i.jsx("span",{className:"text-[11px] text-muted-foreground",children:a}):null]}),r!==void 0||o!==void 0?i.jsx("button",{type:"button",disabled:n,onClick:f,className:"text-[11px] text-muted-foreground underline-offset-2 hover:underline",children:"清除"}):null]})}var Ka=Object.defineProperty,Ce=(e,t)=>Ka(e,"name",{value:t,configurable:!0});function Ga(e,t){const n=c.createContext(t);n.displayName=e+"Context";const r=Ce(s=>{const{children:a,...l}=s,u=c.useMemo(()=>l,Object.values(l));return i.jsx(n.Provider,{value:u,children:a})},"Provider");r.displayName=e+"Provider";function o(s,a={}){const{optional:l=!1}=a,u=c.useContext(n);if(u)return u;if(t!==void 0)return t;if(!l)throw new Error(`\`${s}\` must be used within \`${e}\``)}return Ce(o,"useContext"),[r,o]}Ce(Ga,"createContext");function Pe(e,t=[]){let n=[];function r(s,a){const l=c.createContext(a);l.displayName=s+"Context";const u=n.length;n=[...n,a];const f=Ce(d=>{const{scope:h,children:x,...g}=d,v=h?.[e]?.[u]||l,m=c.useMemo(()=>g,Object.values(g));return i.jsx(v.Provider,{value:m,children:x})},"Provider");f.displayName=s+"Provider";function p(d,h,x={}){const{optional:g=!1}=x,v=h?.[e]?.[u]||l,m=c.useContext(v);if(m)return m;if(a!==void 0)return a;if(!g)throw new Error(`\`${d}\` must be used within \`${s}\``)}return Ce(p,"useContext"),[f,p]}Ce(r,"createContext");const o=Ce(()=>{const s=n.map(a=>c.createContext(a));return Ce(function(l){const u=l?.[e]||s;return c.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])},"useScope")},"createScope");return o.scopeName=e,[r,Ho(o,...t)]}Ce(Pe,"createContextScope");function Ho(...e){const t=e[0];if(e.length===1)return t;const n=Ce(()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return Ce(function(s){const a=r.reduce((l,{useScope:u,scopeName:f})=>{const d=u(s)[`__scope${f}`];return{...l,...d}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Ce(Ho,"composeContextScopes");var Ya=Object.defineProperty,ie=(e,t)=>Ya(e,"name",{value:t,configurable:!0});function cn(e){const t=e+"CollectionProvider",[n,r]=Pe(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=ie(v=>{const{scope:m,children:C}=v,b=c.useRef(null),y=c.useRef(new Map).current;return i.jsx(o,{scope:m,itemMap:y,collectionRef:b,children:C})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",u=tt(l),f=c.forwardRef((v,m)=>{const{scope:C,children:b}=v,y=s(l,C),w=ne(m,y.collectionRef);return i.jsx(u,{ref:w,children:b})});f.displayName=l;const p=e+"CollectionItemSlot",d="data-radix-collection-item",h=tt(p),x=c.forwardRef((v,m)=>{const{scope:C,children:b,...y}=v,w=c.useRef(null),R=ne(m,w),S=s(p,C);return c.useEffect(()=>(S.itemMap.set(w,{ref:w,...y}),()=>{S.itemMap.delete(w)})),i.jsx(h,{[d]:"",ref:R,children:b})});x.displayName=p;function g(v){const m=s(e+"CollectionConsumer",v);return c.useCallback(()=>{const b=m.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${d}]`));return Array.from(m.itemMap.values()).sort((S,P)=>y.indexOf(S.ref.current)-y.indexOf(P.ref.current))},[m.collectionRef,m.itemMap])}return ie(g,"useCollection"),[{Provider:a,Slot:f,ItemSlot:x},g,r]}ie(cn,"createCollection");var lo=new WeakMap,re,be,An=(be=class extends Map{constructor(n){super(n);ao(this,re);In(this,re,[...super.keys()]),lo.set(this,!0)}set(n,r){return lo.get(this)&&(this.has(n)?ce(this,re)[ce(this,re).indexOf(n)]=n:ce(this,re).push(n)),super.set(n,r),this}insert(n,r,o){const s=this.has(r),a=ce(this,re).length,l=lr(n);let u=l>=0?l:a+l;const f=u<0||u>=a?-1:u;if(f===this.size||s&&f===this.size-1||f===-1)return this.set(r,o),this;const p=this.size+(s?0:1);l<0&&u++;const d=[...ce(this,re)];let h,x=!1;for(let g=u;g<p;g++)if(u===g){let v=d[g];d[g]===r&&(v=d[g+1]),s&&this.delete(r),h=this.get(v),this.set(r,o)}else{!x&&d[g-1]===r&&(x=!0);const v=d[x?g:g-1],m=h;h=this.get(v),this.delete(v),this.set(v,m)}return this}with(n,r,o){const s=new be(this);return s.insert(n,r,o),s}before(n){const r=ce(this,re).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,o){const s=ce(this,re).indexOf(n);return s===-1?this:this.insert(s,r,o)}after(n){let r=ce(this,re).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,o){const s=ce(this,re).indexOf(n);return s===-1?this:this.insert(s+1,r,o)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return In(this,re,[]),super.clear()}delete(n){const r=super.delete(n);return r&&ce(this,re).splice(ce(this,re).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=Xt(ce(this,re),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=Xt(ce(this,re),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return ce(this,re).indexOf(n)}keyAt(n){return Xt(ce(this,re),n)}from(n,r){const o=this.indexOf(n);if(o===-1)return;let s=o+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,r){const o=this.indexOf(n);if(o===-1)return;let s=o+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return s;o++}}findIndex(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return o;o++}return-1}filter(n,r){const o=[];let s=0;for(const a of this)Reflect.apply(n,r,[a,s,this])&&o.push(a),s++;return new be(o)}map(n,r){const o=[];let s=0;for(const a of this)o.push([a[0],Reflect.apply(n,r,[a,s,this])]),s++;return new be(o)}reduce(...n){const[r,o]=n;let s=0,a=o??this.at(0);for(const l of this)s===0&&n.length===1?a=l:a=Reflect.apply(r,this,[a,l,s,this]),s++;return a}reduceRight(...n){const[r,o]=n;let s=o??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&n.length===1?s=l:s=Reflect.apply(r,this,[s,l,a,this])}return s}toSorted(n){const r=[...this.entries()].sort(n);return new be(r)}toReversed(){const n=new be;for(let r=this.size-1;r>=0;r--){const o=this.keyAt(r),s=this.get(o);n.set(o,s)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new be(r)}slice(n,r){const o=new be;let s=this.size-1;if(n===void 0)return o;n<0&&(n=n+this.size),r!==void 0&&r>0&&(s=r-1);for(let a=n;a<=s;a++){const l=this.keyAt(a),u=this.get(l);o.set(l,u)}return o}every(n,r){let o=0;for(const s of this){if(!Reflect.apply(n,r,[s,o,this]))return!1;o++}return!0}some(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return!0;o++}return!1}},re=new WeakMap,ie(be,"OrderedDict"),be);function Xt(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=Uo(e,t);return n===-1?void 0:e[n]}ie(Xt,"at");function Uo(e,t){const n=e.length,r=lr(t),o=r>=0?r:n+r;return o<0||o>=n?-1:o}ie(Uo,"toSafeIndex");function lr(e){return e!==e||e===0?0:Math.trunc(e)}ie(lr,"toSafeInteger");function qa(e){const t=e+"CollectionProvider",[n,r]=Pe(t),[o,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new An,setItemMap:ie(()=>{},"setItemMap")}),a=ie(({state:y,...w})=>y?i.jsx(u,{...w,state:y}):i.jsx(l,{...w}),"CollectionProvider");a.displayName=t;const l=ie(y=>{const w=m();return i.jsx(u,{...y,state:w})},"CollectionInit");l.displayName=t+"Init";const u=ie(y=>{const{scope:w,children:R,state:S}=y,P=c.useRef(null),[I,N]=c.useState(null),A=ne(P,N),[_,T]=S;return c.useEffect(()=>{if(!I)return;const D=Go(()=>{});return D.observe(I,{childList:!0,subtree:!0}),()=>{D.disconnect()}},[I]),i.jsx(o,{scope:w,itemMap:_,setItemMap:T,collectionRef:A,collectionRefObject:P,collectionElement:I,children:R})},"CollectionProviderImpl");u.displayName=t+"Impl";const f=e+"CollectionSlot",p=tt(f),d=c.forwardRef((y,w)=>{const{scope:R,children:S}=y,P=s(f,R),I=ne(w,P.collectionRef);return i.jsx(p,{ref:I,children:S})});d.displayName=f;const h=e+"CollectionItemSlot",x="data-radix-collection-item",g=tt(h),v=c.forwardRef((y,w)=>{const{scope:R,children:S,...P}=y,I=c.useRef(null),[N,A]=c.useState(null),_=ne(w,I,A),T=s(h,R),{setItemMap:D}=T,$=c.useRef(P);Wo($.current,P)||($.current=P);const K=$.current;return c.useEffect(()=>{const L=K;return D(k=>N?k.has(N)?k.set(N,{...L,element:N}).toSorted(Hn):(k.set(N,{...L,element:N}),k.toSorted(Hn)):k),()=>{D(k=>!N||!k.has(N)?k:(k.delete(N),new An(k)))}},[N,K,D]),i.jsx(g,{[x]:"",ref:_,children:S})});v.displayName=h;function m(){return c.useState(new An)}ie(m,"useInitCollection");function C(y){const{itemMap:w}=s(e+"CollectionConsumer",y);return w}return ie(C,"useCollection"),[{Provider:a,Slot:d,ItemSlot:v},{createCollectionScope:r,useCollection:C,useInitCollection:m}]}ie(qa,"createCollection");function Wo(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||e[o]!==t[o])return!1;return!0}ie(Wo,"shallowEqual");function Ko(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ie(Ko,"isElementPreceding");function Hn(e,t){return!e[1].element||!t[1].element?0:Ko(e[1].element,t[1].element)?-1:1}ie(Hn,"sortByDocumentPosition");function Go(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}ie(Go,"getChildListObserver");var Xa=Object.defineProperty,gt=(e,t)=>Xa(e,"name",{value:t,configurable:!0}),Yo=!!(typeof window<"u"&&window.document&&window.document.createElement);function z(e,t,{checkForDefaultPrevented:n=!0}={}){return gt(function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)},"handleEvent")}gt(z,"composeEventHandlers");function Za(e){if(!Yo)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}gt(Za,"getOwnerWindow");function Un(e){if(!Yo)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}gt(Un,"getOwnerDocument");function qo(e,t=!1){const{activeElement:n}=Un(e);if(!n?.nodeName)return null;if(Xo(n)&&n.contentDocument)return qo(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const o=Un(n).getElementById(r);if(o)return o}}return n}gt(qo,"getActiveElement");function Xo(e){return e.tagName==="IFRAME"}gt(Xo,"isFrame");var oe=globalThis?.document?c.useLayoutEffect:()=>{},Ja=Object.defineProperty,Qa=(e,t)=>Ja(e,"name",{value:t,configurable:!0}),uo=At[" useEffectEvent ".trim().toString()],fo=At[" useInsertionEffect ".trim().toString()];function Zo(e){if(typeof uo=="function")return uo(e);const t=c.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof fo=="function"?fo(()=>{t.current=e}):oe(()=>{t.current=e}),c.useMemo(()=>((...n)=>t.current?.(...n)),[])}Qa(Zo,"useEffectEvent");var ec=Object.defineProperty,Ot=(e,t)=>ec(e,"name",{value:t,configurable:!0}),tc=At[" useInsertionEffect ".trim().toString()]||oe;function Ae({prop:e,defaultProp:t,onChange:n=Ot(()=>{},"onChange"),caller:r}){const[o,s,a]=Jo({defaultProp:t,onChange:n}),l=e!==void 0,u=l?e:o,f=c.useCallback(p=>{if(l){const d=Qo(p)?p(e):p;d!==e&&a.current?.(d)}else s(p)},[l,e,s,a]);return[u,f]}Ot(Ae,"useControllableState");function Jo({defaultProp:e,onChange:t}){const[n,r]=c.useState(e),o=c.useRef(n),s=c.useRef(t);return tc(()=>{s.current=t},[t]),c.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}Ot(Jo,"useUncontrolledState");function Qo(e){return typeof e=="function"}Ot(Qo,"isFunction");var po=Symbol("RADIX:SYNC_STATE");function nc(e,t,n,r){const{prop:o,defaultProp:s,onChange:a,caller:l}=t,u=o!==void 0,f=Zo(a),p=[{...n,state:s}];r&&p.push(r);const[d,h]=c.useReducer((m,C)=>{if(C.type===po)return{...m,state:C.state};const b=e(m,C);return u&&!Object.is(b.state,m.state)&&f(b.state),b},...p),x=d.state,g=c.useRef(x);c.useEffect(()=>{g.current!==x&&(g.current=x,u||f(x))},[x,g,u]);const v=c.useMemo(()=>o!==void 0?{...d,state:o}:d,[d,o]);return c.useEffect(()=>{u&&!Object.is(o,d.state)&&h({type:po,state:o})},[o,d.state,u]),[v,h]}Ot(nc,"useControllableStateReducer");var rc=Object.defineProperty,Ve=(e,t)=>rc(e,"name",{value:t,configurable:!0});function es(e,t){return c.useReducer((n,r)=>t[n][r]??n,e)}Ve(es,"useStateMachine");var xt=Ve(e=>{const{present:t,children:n}=e,r=ts(t),o=typeof n=="function"?n({present:r.isPresent}):c.Children.only(n),s=ns(r.ref,rs(o));return typeof n=="function"||r.isPresent?c.cloneElement(o,{ref:s}):null},"Presence");function ts(e){const[t,n]=c.useState(),r=c.useRef(null),o=c.useRef(e),s=c.useRef("none"),a=c.useRef(void 0),l=e?"mounted":"unmounted",[u,f]=es(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return c.useEffect(()=>{u==="mounted"?(s.current=a.current??ft(r.current),a.current=void 0):s.current="none"},[u]),oe(()=>{const p=r.current,d=o.current;if(d!==e){const x=s.current,g=ft(p);e?(a.current=g,f("MOUNT")):g==="none"||p?.display==="none"?f("UNMOUNT"):f(d&&x!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,f]),oe(()=>{if(t){let p;const d=t.ownerDocument.defaultView??window,h=Ve(g=>{const m=ft(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&m&&(f("ANIMATION_END"),!o.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",p=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},"handleAnimationEnd"),x=Ve(g=>{g.target===t&&(s.current=ft(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{d.clearTimeout(p),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:c.useCallback(p=>{if(p){const d=getComputedStyle(p);r.current=d,a.current=ft(d)}else r.current=null;n(p)},[])}}Ve(ts,"usePresence");function Wn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Ve(Wn,"setRef");function ns(...e){const t=c.useRef(e);return t.current=e,c.useCallback(n=>{const r=t.current;let o=!1;const s=r.map(a=>{const l=Wn(a,n);return!o&&typeof l=="function"&&(o=!0),l});if(o)return()=>{for(let a=0;a<s.length;a++){const l=s[a];typeof l=="function"?l():Wn(r[a],null)}}},[])}Ve(ns,"useStableComposedRefs");function ft(e){return e?.animationName||"none"}Ve(ft,"getAnimationName");function rs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ve(rs,"getElementRef");var oc=Object.defineProperty,sc=(e,t)=>oc(e,"name",{value:t,configurable:!0}),ic=At[" useId ".trim().toString()]||(()=>{}),ac=0;function Ie(e){const[t,n]=c.useState(ic());return oe(()=>{e||n(r=>r??String(ac++))},[e]),e||(t?`radix-${t}`:"")}sc(Ie,"useId");var cc=Object.defineProperty,_t=(e,t)=>cc(e,"name",{value:t,configurable:!0}),ur="Collapsible",[lc,os]=Pe(ur),[uc,dr]=lc(ur),dc=c.forwardRef(_t(function(t,n){const{__scopeCollapsible:r,open:o,defaultOpen:s,disabled:a,onOpenChange:l,...u}=t,[f,p]=Ae({prop:o,defaultProp:s??!1,onChange:l,caller:ur});return i.jsx(uc,{scope:r,disabled:a,contentId:Ie(),open:f,onOpenToggle:c.useCallback(()=>p(d=>!d),[p]),children:i.jsx(H.div,{"data-state":ln(f),"data-disabled":a?"":void 0,...u,ref:n})})},"Collapsible")),fc="CollapsibleTrigger",pc=c.forwardRef(_t(function(t,n){const{__scopeCollapsible:r,...o}=t,s=dr(fc,r);return i.jsx(H.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":ln(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...o,ref:n,onClick:z(t.onClick,s.onOpenToggle)})},"CollapsibleTrigger")),ss="CollapsibleContent",mc=c.forwardRef(_t(function(t,n){const{forceMount:r,...o}=t,s=dr(ss,t.__scopeCollapsible);return i.jsx(xt,{present:r||s.open,children:({present:a})=>i.jsx(hc,{...o,ref:n,present:a})})},"CollapsibleContent")),hc=c.forwardRef(_t(function(t,n){const{__scopeCollapsible:r,present:o,children:s,...a}=t,l=dr(ss,r),[u,f]=c.useState(o),p=c.useRef(null),d=ne(n,p),h=c.useRef(0),x=h.current,g=c.useRef(0),v=g.current,m=l.open||u,C=c.useRef(m),b=c.useRef(void 0);return c.useEffect(()=>{const y=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(y)},[]),oe(()=>{const y=p.current;if(y){b.current=b.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const w=y.getBoundingClientRect();h.current=w.height,g.current=w.width,C.current||(y.style.transitionDuration=b.current.transitionDuration,y.style.animationName=b.current.animationName),f(o)}},[l.open,o]),i.jsx(H.div,{"data-state":ln(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!m,...a,ref:d,style:{"--radix-collapsible-content-height":x?`${x}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...t.style},children:m&&s})},"CollapsibleContentImpl"));function ln(e){return e?"open":"closed"}_t(ln,"getState");var vc=dc,gc=pc,xc=mc,bc=Object.defineProperty,yc=(e,t)=>bc(e,"name",{value:t,configurable:!0}),wc=c.createContext(void 0);function Dt(e){const t=c.useContext(wc);return e||t||"ltr"}yc(Dt,"useDirection");var Cc=Object.defineProperty,ye=(e,t)=>Cc(e,"name",{value:t,configurable:!0}),De="Accordion",Sc=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[fr,Rc,Ec]=cn(De),[un,Xf]=Pe(De,[Ec,os]),pr=os(),Pc=c.forwardRef(ye(function(t,n){const{type:r,...o}=t,s=o,a=o;return i.jsx(fr.Provider,{scope:t.__scopeAccordion,children:r==="multiple"?i.jsx(Ac,{...a,ref:n}):i.jsx(Ic,{...s,ref:n})})},"Accordion")),[is,jc]=un(De),[as,Nc]=un(De,{collapsible:!1}),Ic=c.forwardRef(ye(function(t,n){const{value:r,defaultValue:o,onValueChange:s=ye(()=>{},"onValueChange"),collapsible:a=!1,...l}=t,[u,f]=Ae({prop:r,defaultProp:o??"",onChange:s,caller:De});return i.jsx(is,{scope:t.__scopeAccordion,value:c.useMemo(()=>u?[u]:[],[u]),onItemOpen:f,onItemClose:c.useCallback(()=>a&&f(""),[a,f]),children:i.jsx(as,{scope:t.__scopeAccordion,collapsible:a,children:i.jsx(cs,{...l,ref:n})})})},"AccordionImplSingle")),Ac=c.forwardRef(ye(function(t,n){const{value:r,defaultValue:o,onValueChange:s=ye(()=>{},"onValueChange"),...a}=t,[l,u]=Ae({prop:r,defaultProp:o??[],onChange:s,caller:De}),f=c.useCallback(d=>u((h=[])=>[...h,d]),[u]),p=c.useCallback(d=>u((h=[])=>h.filter(x=>x!==d)),[u]);return i.jsx(is,{scope:t.__scopeAccordion,value:l,onItemOpen:f,onItemClose:p,children:i.jsx(as,{scope:t.__scopeAccordion,collapsible:!0,children:i.jsx(cs,{...a,ref:n})})})},"AccordionImplMultiple")),[Tc,dn]=un(De),cs=c.forwardRef(ye(function(t,n){const{__scopeAccordion:r,disabled:o,dir:s,orientation:a="vertical",...l}=t,u=c.useRef(null),f=ne(u,n),p=Rc(r),h=Dt(s)==="ltr",x=z(t.onKeyDown,g=>{if(!Sc.includes(g.key))return;const v=g.target,m=p().filter(N=>!N.ref.current?.disabled),C=m.findIndex(N=>N.ref.current===v),b=m.length;if(C===-1)return;g.preventDefault();let y=C;const w=0,R=b-1,S=ye(()=>{y=C+1,y>R&&(y=w)},"moveNext"),P=ye(()=>{y=C-1,y<w&&(y=R)},"movePrev");switch(g.key){case"Home":y=w;break;case"End":y=R;break;case"ArrowRight":a==="horizontal"&&(h?S():P());break;case"ArrowDown":a==="vertical"&&S();break;case"ArrowLeft":a==="horizontal"&&(h?P():S());break;case"ArrowUp":a==="vertical"&&P();break}const I=y%b;m[I].ref.current?.focus()});return i.jsx(Tc,{scope:r,disabled:o,direction:s,orientation:a,children:i.jsx(fr.Slot,{scope:r,children:i.jsx(H.div,{...l,"data-orientation":a,ref:f,onKeyDown:o?void 0:x})})})},"AccordionImpl")),Kn="AccordionItem",[Oc,mr]=un(Kn),_c=c.forwardRef(ye(function(t,n){const{__scopeAccordion:r,value:o,...s}=t,a=dn(Kn,r),l=jc(Kn,r),u=pr(r),f=Ie(),p=o&&l.value.includes(o)||!1,d=a.disabled||t.disabled;return i.jsx(Oc,{scope:r,open:p,disabled:d,triggerId:f,children:i.jsx(vc,{"data-orientation":a.orientation,"data-state":hr(p),...u,...s,ref:n,disabled:d,open:p,onOpenChange:h=>{h?l.onItemOpen(o):l.onItemClose(o)}})})},"AccordionItem")),Dc="AccordionHeader",kc=c.forwardRef(ye(function(t,n){const{__scopeAccordion:r,...o}=t,s=dn(De,r),a=mr(Dc,r);return i.jsx(H.h3,{"data-orientation":s.orientation,"data-state":hr(a.open),"data-disabled":a.disabled?"":void 0,...o,ref:n})},"AccordionHeader")),mo="AccordionTrigger",Mc=c.forwardRef(ye(function(t,n){const{__scopeAccordion:r,...o}=t,s=dn(De,r),a=mr(mo,r),l=Nc(mo,r),u=pr(r);return i.jsx(fr.ItemSlot,{scope:r,children:i.jsx(gc,{"aria-disabled":a.open&&!l.collapsible||void 0,"data-orientation":s.orientation,id:a.triggerId,...u,...o,ref:n})})},"AccordionTrigger")),$c="AccordionContent",Fc=c.forwardRef(ye(function(t,n){const{__scopeAccordion:r,...o}=t,s=dn(De,r),a=mr($c,r),l=pr(r);return i.jsx(xc,{role:"region","aria-labelledby":a.triggerId,"data-orientation":s.orientation,...l,...o,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})},"AccordionContent"));function hr(e){return e?"open":"closed"}ye(hr,"getState");var Lc=Pc,Bc=_c,zc=kc,ls=Mc,us=Fc;const ds=Lc,vr=c.forwardRef(({className:e,...t},n)=>i.jsx(Bc,{className:Q("border-b border-border",e),...t,ref:n}));vr.displayName="AccordionItem";const gr=c.forwardRef(({className:e,children:t,...n},r)=>i.jsx(zc,{className:"flex",children:i.jsxs(ls,{className:Q("flex flex-1 items-center justify-between gap-2 py-3 text-left text-sm font-semibold transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,ref:r,children:[t,i.jsx($o,{className:"size-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));gr.displayName=ls.displayName;const xr=c.forwardRef(({className:e,children:t,...n},r)=>i.jsx(us,{forceMount:!0,className:"grid overflow-hidden text-sm transition-[grid-template-rows] duration-300 ease-out data-[state=closed]:grid-rows-[0fr] data-[state=open]:grid-rows-[1fr]",...n,ref:r,children:i.jsx("div",{className:"min-h-0 overflow-hidden",children:i.jsx("div",{className:Q("pb-4 pt-0",e),children:t})})}));xr.displayName=us.displayName;var Vc=Object.defineProperty,Hc=(e,t)=>Vc(e,"name",{value:t,configurable:!0});function Gn(e,[t,n]){return Math.min(n,Math.max(t,e))}Hc(Gn,"clamp");var Uc=Object.defineProperty,Wc=(e,t)=>Uc(e,"name",{value:t,configurable:!0});function Ee(e){const t=c.useRef(e);return c.useEffect(()=>{t.current=e}),c.useMemo(()=>((...n)=>t.current?.(...n)),[])}Wc(Ee,"useCallbackRef");var Kc=Object.defineProperty,se=(e,t)=>Kc(e,"name",{value:t,configurable:!0}),Yn="dismissableLayer.update",Gc="dismissableLayer.pointerDownOutside",Yc="dismissableLayer.focusOutside",ho,fs=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ps=c.forwardRef(se(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:u,onDismiss:f,...p}=t,d=c.useContext(fs),[h,x]=c.useState(null),g=h?.ownerDocument??globalThis?.document,[,v]=c.useState({}),m=ne(n,x),C=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=b?C.indexOf(b):-1,w=h?C.indexOf(h):-1,R=d.layersWithOutsidePointerEventsDisabled.size>0,S=w>=y,P=c.useRef(!1),I=hs(T=>{a?.(T),u?.(T),T.defaultPrevented||f?.()},{ownerDocument:g,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:P,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:c.useCallback(T=>{if(!(T instanceof Node))return!1;const D=[...d.branches].some($=>$.contains(T));return S&&!D},[d.branches,S])}),N=vs(T=>{if(o&&P.current)return;const D=T.target;[...d.branches].some(K=>K.contains(D))||(l?.(T),u?.(T),T.defaultPrevented||f?.())},g),A=h?w===C.length-1:!1,_=Ee(T=>{T.key==="Escape"&&(s?.(T),!T.defaultPrevented&&f&&(T.preventDefault(),f()))});return c.useEffect(()=>{if(A)return g.addEventListener("keydown",_,{capture:!0}),()=>g.removeEventListener("keydown",_,{capture:!0})},[g,A,_]),c.useEffect(()=>{if(h)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(ho=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),qn(),()=>{r&&(d.layersWithOutsidePointerEventsDisabled.delete(h),d.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=ho))}},[h,g,r,d]),c.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),qn())},[h,d]),c.useEffect(()=>{const T=se(()=>v({}),"handleUpdate");return document.addEventListener(Yn,T),()=>document.removeEventListener(Yn,T)},[]),i.jsx(H.div,{...p,ref:m,style:{pointerEvents:R?S?"auto":"none":void 0,...t.style},onFocusCapture:z(t.onFocusCapture,N.onFocusCapture),onBlurCapture:z(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:z(t.onPointerDownCapture,I.onPointerDownCapture)})},"DismissableLayer"));function ms(){const e=c.useContext(fs),[t,n]=c.useState(null);return c.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}se(ms,"useDismissableLayerSurface");var qc=se(()=>!0,"IS_TRUE");function hs(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:s,shouldHandlePointerDownOutside:a=qc}=t,l=Ee(e),u=c.useRef(!1),f=c.useRef(!1),p=c.useRef(new Map),d=c.useRef(()=>{});return c.useEffect(()=>{function h(){f.current=!1,o.current=!1,p.current.clear()}se(h,"resetOutsideInteraction");function x(){return Array.from(p.current.values()).some(Boolean)}se(x,"isOutsideInteractionIntercepted");function g(y){if(!f.current)return;const w=y.target;w instanceof Node&&[...s].some(S=>S.contains(w))||p.current.set(y.type,!0),y.type==="click"&&window.setTimeout(()=>{f.current&&d.current()},0)}se(g,"handleInteractionCapture");function v(y){f.current&&p.current.set(y.type,!1)}se(v,"handleInteractionBubble");const m=se(y=>{if(y.target&&!u.current){let w=function(){n.removeEventListener("click",d.current);const S=x();h(),S||br(Gc,l,R,{discrete:!0})};if(se(w,"handleAndDispatchPointerDownOutsideEvent"),!a(y.target)){n.removeEventListener("click",d.current),h(),u.current=!1;return}const R={originalEvent:y};f.current=!0,o.current=r&&y.button===0,p.current.clear(),!r||y.button!==0?w():(n.removeEventListener("click",d.current),d.current=w,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),h();u.current=!1},"handlePointerDown"),C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const y of C)n.addEventListener(y,g,!0),n.addEventListener(y,v);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",m)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",m),n.removeEventListener("click",d.current);for(const y of C)n.removeEventListener(y,g,!0),n.removeEventListener(y,v)}},[n,l,r,o,s,a]),{onPointerDownCapture:se(()=>u.current=!0,"onPointerDownCapture")}}se(hs,"usePointerDownOutside");function vs(e,t=globalThis?.document){const n=Ee(e),r=c.useRef(!1);return c.useEffect(()=>{const o=se(s=>{s.target&&!r.current&&br(Yc,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:se(()=>r.current=!0,"onFocusCapture"),onBlurCapture:se(()=>r.current=!1,"onBlurCapture")}}se(vs,"useFocusOutside");function qn(){const e=new CustomEvent(Yn);document.dispatchEvent(e)}se(qn,"dispatchUpdate");function br(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Bo(o,s):o.dispatchEvent(s)}se(br,"handleAndDispatchCustomEvent");var Xc=Object.defineProperty,yr=(e,t)=>Xc(e,"name",{value:t,configurable:!0}),Ht=0,ct=null;function Zc(e){return fn(),e.children}yr(Zc,"FocusGuards");function fn(){c.useEffect(()=>{ct||(ct={start:Xn(),end:Xn()});const{start:e,end:t}=ct;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Ht++,()=>{Ht===1&&(ct?.start.remove(),ct?.end.remove(),ct=null),Ht=Math.max(0,Ht-1)}},[])}yr(fn,"useFocusGuards");function Xn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}yr(Xn,"createFocusGuard");var Jc=Object.defineProperty,pe=(e,t)=>Jc(e,"name",{value:t,configurable:!0}),Tn="focusScope.autoFocusOnMount",On="focusScope.autoFocusOnUnmount",vo={bubbles:!1,cancelable:!0},gs=c.forwardRef(pe(function(t,n){const{loop:r=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=t,[u,f]=c.useState(null),p=Ee(s),d=Ee(a),h=c.useRef(null),x=ne(n,f),g=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(o){let m=function(w){if(g.paused||!u)return;const R=w.target;u.contains(R)?h.current=R:Le(h.current,{select:!0})},C=function(w){if(g.paused||!u)return;const R=w.relatedTarget;R!==null&&(u.contains(R)||Le(h.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&Le(u)};pe(m,"handleFocusIn"),pe(C,"handleFocusOut"),pe(b,"handleMutations"),document.addEventListener("focusin",m),document.addEventListener("focusout",C);const y=new MutationObserver(b);return u&&y.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",C),y.disconnect()}}},[o,u,g.paused]),c.useEffect(()=>{if(u){go.add(g);const m=document.activeElement;if(!u.contains(m)){const b=new CustomEvent(Tn,vo);u.addEventListener(Tn,p),u.dispatchEvent(b),b.defaultPrevented||(xs(Ss(wr(u)),{select:!0}),document.activeElement===m&&Le(u))}return()=>{u.removeEventListener(Tn,p),setTimeout(()=>{const b=new CustomEvent(On,vo);u.addEventListener(On,d),u.dispatchEvent(b),b.defaultPrevented||Le(m??document.body,{select:!0}),u.removeEventListener(On,d),go.remove(g)},0)}}},[u,p,d,g]);const v=c.useCallback(m=>{if(!r&&!o||g.paused)return;const C=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(C&&b){const y=m.currentTarget,[w,R]=bs(y);w&&R?!m.shiftKey&&b===R?(m.preventDefault(),r&&Le(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),r&&Le(R,{select:!0})):b===y&&m.preventDefault()}},[r,o,g.paused]);return i.jsx(H.div,{tabIndex:-1,...l,ref:x,onKeyDown:v})},"FocusScope"));function xs(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Le(r,{select:t}),document.activeElement!==n)return}pe(xs,"focusFirst");function bs(e){const t=wr(e),n=Zn(t,e),r=Zn(t.reverse(),e);return[n,r]}pe(bs,"getTabbableEdges");function wr(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:pe(r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}pe(wr,"getTabbableCandidates");function Zn(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ys(r,{upTo:t})))return r}pe(Zn,"findVisible");function ys(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}pe(ys,"isHidden");function ws(e){return e instanceof HTMLInputElement&&"select"in e}pe(ws,"isSelectableInput");function Le(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ws(e)&&t&&e.select()}}pe(Le,"focus");var go=Cs();function Cs(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Jn(e,t),e.unshift(t)},remove(t){e=Jn(e,t),e[0]?.resume()}}}pe(Cs,"createFocusScopesStack");function Jn(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}pe(Jn,"arrayRemove");function Ss(e){return e.filter(t=>t.tagName!=="A")}pe(Ss,"removeLinks");const Qc=["top","right","bottom","left"],Ye=Math.min,Be=Math.max,rn=Math.round,Ut=Math.floor,ze=e=>({x:e,y:e}),el={left:"right",right:"left",bottom:"top",top:"bottom"};function Rs(e,t,n){return Be(e,Ye(t,n))}function He(e,t){return typeof e=="function"?e(t):e}function qe(e){return e.split("-")[0]}function bt(e){return e.split("-")[1]}function Cr(e){return e==="x"?"y":"x"}function Sr(e){return e==="y"?"height":"width"}function Ne(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Rr(e){return Cr(Ne(e))}function tl(e,t,n){n===void 0&&(n=!1);const r=bt(e),o=Rr(e),s=Sr(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=on(a)),[a,on(a)]}function nl(e){const t=on(e);return[Qn(e),t,Qn(t)]}function Qn(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const xo=["left","right"],bo=["right","left"],rl=["top","bottom"],ol=["bottom","top"];function sl(e,t,n){switch(e){case"top":case"bottom":return n?t?bo:xo:t?xo:bo;case"left":case"right":return t?rl:ol;default:return[]}}function il(e,t,n,r){const o=bt(e);let s=sl(qe(e),n==="start",r);return o&&(s=s.map(a=>a+"-"+o),t&&(s=s.concat(s.map(Qn)))),s}function on(e){const t=qe(e);return el[t]+e.slice(t.length)}function al(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 Es(e){return typeof e!="number"?al(e):{top:e,right:e,bottom:e,left:e}}function sn(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 yo(e,t,n){let{reference:r,floating:o}=e;const s=Ne(t),a=Rr(t),l=Sr(a),u=qe(t),f=s==="y",p=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[l]/2-o[l]/2;let x;switch(u){case"top":x={x:p,y:r.y-o.height};break;case"bottom":x={x:p,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:d};break;case"left":x={x:r.x-o.width,y:d};break;default:x={x:r.x,y:r.y}}const g=bt(t);return g&&(x[a]+=h*(g==="end"?1:-1)*(n&&f?-1:1)),x}async function cl(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:a,elements:l,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:d="floating",altBoundary:h=!1,padding:x=0}=He(t,e),g=Es(x),m=l[h?d==="floating"?"reference":"floating":d],C=sn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(m)))==null||n?m:m.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:f,rootBoundary:p,strategy:u})),b=d==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),w=await(s.isElement==null?void 0:s.isElement(y))&&await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1},R=sn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:y,strategy:u}):b);return{top:(C.top-R.top+g.top)/w.y,bottom:(R.bottom-C.bottom+g.bottom)/w.y,left:(C.left-R.left+g.left)/w.x,right:(R.right-C.right+g.right)/w.x}}const ll=50,ul=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:cl},u=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y:d}=yo(f,r,u),h=r,x=0;const g={};for(let v=0;v<s.length;v++){const m=s[v];if(!m)continue;const{name:C,fn:b}=m,{x:y,y:w,data:R,reset:S}=await b({x:p,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:g,rects:f,platform:l,elements:{reference:e,floating:t}});p=y??p,d=w??d,g[C]={...g[C],...R},S&&x<ll&&(x++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(f=S.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:p,y:d}=yo(f,h,u)),v=-1)}return{x:p,y:d,placement:h,strategy:o,middlewareData:g}},dl=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:l,middlewareData:u}=t,{element:f,padding:p=0}=He(e,t)||{};if(f==null)return{};const d=Es(p),h={x:n,y:r},x=Rr(o),g=Sr(x),v=await a.getDimensions(f),m=x==="y",C=m?"top":"left",b=m?"bottom":"right",y=m?"clientHeight":"clientWidth",w=s.reference[g]+s.reference[x]-h[x]-s.floating[g],R=h[x]-s.reference[x],S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let P=S?S[y]:0;(!P||!await(a.isElement==null?void 0:a.isElement(S)))&&(P=l.floating[y]||s.floating[g]);const I=w/2-R/2,N=P/2-v[g]/2-1,A=Ye(d[C],N),_=Ye(d[b],N),T=P-v[g]-_,D=P/2-v[g]/2+I,$=Rs(A,D,T),K=!u.arrow&&bt(o)!=null&&D!==$&&s.reference[g]/2-(D<A?A:_)-v[g]/2<0,L=K?D<A?D-A:D-T:0;return{[x]:h[x]+L,data:{[x]:$,centerOffset:D-$-L,...K&&{alignmentOffset:L}},reset:K}}}),fl=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:a,initialPlacement:l,platform:u,elements:f}=t,{mainAxis:p=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...m}=He(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=qe(o),b=Ne(l),y=qe(l)===l,w=await(u.isRTL==null?void 0:u.isRTL(f.floating)),R=h||(y||!v?[on(l)]:nl(l)),S=g!=="none";!h&&S&&R.push(...il(l,v,g,w));const P=[l,...R],I=await u.detectOverflow(t,m),N=[];let A=((r=s.flip)==null?void 0:r.overflows)||[];if(p&&N.push(I[C]),d){const $=tl(o,a,w);N.push(I[$[0]],I[$[1]])}if(A=[...A,{placement:o,overflows:N}],!N.every($=>$<=0)){var _,T;const $=(((_=s.flip)==null?void 0:_.index)||0)+1,K=P[$];if(K&&(!(d==="alignment"?b!==Ne(K):!1)||A.every(F=>Ne(F.placement)===b?F.overflows[0]>0:!0)))return{data:{index:$,overflows:A},reset:{placement:K}};let L=(T=A.filter(k=>k.overflows[0]<=0).sort((k,F)=>k.overflows[1]-F.overflows[1])[0])==null?void 0:T.placement;if(!L)switch(x){case"bestFit":{var D;const k=(D=A.filter(F=>{if(S){const U=Ne(F.placement);return U===b||U==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(U=>U>0).reduce((U,V)=>U+V,0)]).sort((F,U)=>F[1]-U[1])[0])==null?void 0:D[0];k&&(L=k);break}case"initialPlacement":L=l;break}if(o!==L)return{reset:{placement:L}}}return{}}}};function wo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Co(e){return Qc.some(t=>e[t]>=0)}const pl=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=He(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=wo(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Co(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),l=wo(a,n.floating);return{data:{escapedOffsets:l,escaped:Co(l)}}}default:return{}}}}},Ps=new Set(["left","top"]);async function ml(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=qe(n),l=bt(n),u=Ne(n)==="y",f=Ps.has(a)?-1:1,p=s&&u?-1:1,d=He(t,e);let{mainAxis:h,crossAxis:x,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof g=="number"&&(x=l==="end"?g*-1:g),u?{x:x*p,y:h*f}:{x:h*f,y:x*p}}const hl=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:l}=t,u=await ml(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:s+u.y,data:{...u,placement:a}}}}},vl=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:a=!0,crossAxis:l=!1,limiter:u={fn:b=>{let{x:y,y:w}=b;return{x:y,y:w}}},...f}=He(e,t),p={x:n,y:r},d=await s.detectOverflow(t,f),h=Ne(o),x=Cr(h);let g=p[x],v=p[h];const m=(b,y)=>Rs(y+d[b==="y"?"top":"left"],y,y-d[b==="y"?"bottom":"right"]);a&&(g=m(x,g)),l&&(v=m(h,v));const C=u.fn({...t,[x]:g,[h]:v});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[x]:a,[h]:l}}}}}},gl=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:s,placement:a,rects:l,middlewareData:u}=t,{offset:f=0,mainAxis:p=!0,crossAxis:d=!0}=He(e,t),h={x:o,y:s},x=Ne(a),g=Cr(x);let v=h[g],m=h[x];const C=He(f,t),b=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:(n=C.mainAxis)!=null?n:0,crossAxis:(r=C.crossAxis)!=null?r:0};if(p){const R=g==="y"?"height":"width",S=l.reference[g]-l.floating[R]+b.mainAxis,P=l.reference[g]+l.reference[R]-b.mainAxis;v<S?v=S:v>P&&(v=P)}if(d){var y,w;const R=g==="y"?"width":"height",S=Ps.has(qe(a)),P=l.reference[x]-l.floating[R]+(S&&((y=u.offset)==null?void 0:y[x])||0)+(S?0:b.crossAxis),I=l.reference[x]+l.reference[R]+(S?0:((w=u.offset)==null?void 0:w[x])||0)-(S?b.crossAxis:0);m<P?m=P:m>I&&(m=I)}return{[g]:v,[x]:m}}}},xl=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:a=()=>{},...l}=He(e,t),u=await o.detectOverflow(t,l),f=qe(n),p=bt(n),d=Ne(n)==="y",{width:h,height:x}=r.floating;let g,v;f==="top"||f==="bottom"?(g=f,v=p===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(v=f,g=p==="end"?"top":"bottom");const m=x-u.top-u.bottom,C=h-u.left-u.right,b=Ye(x-u[g],m),y=Ye(h-u[v],C),w=t.middlewareData.shift,R=!w;let S=b,P=y;w!=null&&w.enabled.x&&(P=C),w!=null&&w.enabled.y&&(S=m),R&&!p&&(d?P=h-2*Be(u.left,u.right):S=x-2*Be(u.top,u.bottom)),await a({...t,availableWidth:P,availableHeight:S});const I=await o.getDimensions(s.floating);return h!==I.width||x!==I.height?{reset:{rects:!0}}:{}}}};function pn(){return typeof window<"u"}function yt(e){return js(e)?(e.nodeName||"").toLowerCase():"#document"}function ge(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ue(e){var t;return(t=(js(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function js(e){return pn()?e instanceof Node||e instanceof ge(e).Node:!1}function Te(e){return pn()?e instanceof Element||e instanceof ge(e).Element:!1}function Ze(e){return pn()?e instanceof HTMLElement||e instanceof ge(e).HTMLElement:!1}function So(e){return!pn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ge(e).ShadowRoot}function mn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Oe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function bl(e){return/^(table|td|th)$/.test(yt(e))}function hn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const yl=/transform|translate|scale|rotate|perspective|filter/,wl=/paint|layout|strict|content/,Qe=e=>!!e&&e!=="none";let _n;function Er(e){const t=Te(e)?Oe(e):e;return Qe(t.transform)||Qe(t.translate)||Qe(t.scale)||Qe(t.rotate)||Qe(t.perspective)||!Pr()&&(Qe(t.backdropFilter)||Qe(t.filter))||yl.test(t.willChange||"")||wl.test(t.contain||"")}function Cl(e){let t=nt(e);for(;Ze(t)&&!jt(t);){if(Er(t))return t;if(hn(t))return null;t=nt(t)}return null}function Pr(){return _n==null&&(_n=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),_n}function jt(e){return/^(html|body|#document)$/.test(yt(e))}function Oe(e){return ge(e).getComputedStyle(e)}function vn(e){return Te(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nt(e){if(yt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||So(e)&&e.host||Ue(e);return So(t)?t.host:t}function Ns(e){const t=nt(e);return jt(t)?(e.ownerDocument||e).body:Ze(t)&&mn(t)?t:Ns(t)}function Nt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ns(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),a=ge(o);if(s){const l=er(a);return t.concat(a,a.visualViewport||[],mn(o)?o:[],l&&n?Nt(l):[])}else return t.concat(o,Nt(o,[],n))}function er(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Is(e){const t=Oe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ze(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=rn(n)!==s||rn(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function jr(e){return Te(e)?e:e.contextElement}function mt(e){const t=jr(e);if(!Ze(t))return ze(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Is(t);let a=(s?rn(n.width):n.width)/r,l=(s?rn(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Sl=ze(0);function As(e){const t=ge(e);return!Pr()||!t.visualViewport?Sl:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Rl(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===ge(e)}function rt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=jr(e);let a=ze(1);t&&(r?Te(r)&&(a=mt(r)):a=mt(e));const l=Rl(s,n,r)?As(s):ze(0);let u=(o.left+l.x)/a.x,f=(o.top+l.y)/a.y,p=o.width/a.x,d=o.height/a.y;if(s&&r){const h=ge(s),x=Te(r)?ge(r):r;let g=h,v=er(g);for(;v&&x!==g;){const m=mt(v),C=v.getBoundingClientRect(),b=Oe(v),y=C.left+(v.clientLeft+parseFloat(b.paddingLeft))*m.x,w=C.top+(v.clientTop+parseFloat(b.paddingTop))*m.y;u*=m.x,f*=m.y,p*=m.x,d*=m.y,u+=y,f+=w,g=ge(v),v=er(g)}}return sn({width:p,height:d,x:u,y:f})}function gn(e,t){const n=vn(e).scrollLeft;return t?t.left+n:rt(Ue(e)).left+n}function Ts(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-gn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function El(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",a=Ue(r),l=t?hn(t.floating):!1;if(r===a||l&&s)return n;let u={scrollLeft:0,scrollTop:0},f=ze(1);const p=ze(0),d=Ze(r);if((d||!s)&&((yt(r)!=="body"||mn(a))&&(u=vn(r)),d)){const x=rt(r);f=mt(r),p.x=x.x+r.clientLeft,p.y=x.y+r.clientTop}const h=a&&!d&&!s?Ts(a,u):ze(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+p.x+h.x,y:n.y*f.y-u.scrollTop*f.y+p.y+h.y}}function Pl(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function jl(e){const t=vn(e),n=e.ownerDocument.body,r=Be(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=Be(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+gn(e);const a=-t.scrollTop;return Oe(n).direction==="rtl"&&(s+=Be(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:s,y:a}}const Nl=25;function Il(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=ge(e),s=Ue(e),a=o.visualViewport;let l=s.clientWidth,u=s.clientHeight,f=0,p=0;if(a){const h=!Pr()||t==="fixed";r?h||(f=-a.offsetLeft,p=-a.offsetTop):(l=a.width,u=a.height,h&&(f=a.offsetLeft,p=a.offsetTop))}if(gn(s)<=0){const h=s.ownerDocument,x=h.body,g=getComputedStyle(x),v=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,m=Math.abs(s.clientWidth-x.clientWidth-v),C=getComputedStyle(s).scrollbarGutter==="stable both-edges"?m/2:m;C<=Nl&&(l-=C)}return{width:l,height:u,x:f,y:p}}function Al(e,t){const n=rt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=mt(e),a=e.clientWidth*s.x,l=e.clientHeight*s.y,u=o*s.x,f=r*s.y;return{width:a,height:l,x:u,y:f}}function Ro(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Il(e,n,t);else if(t==="document")r=jl(Ue(e));else if(Te(t))r=Al(t,n);else{const o=As(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return sn(r)}function Tl(e,t){const n=t.get(e);if(n)return n;let r=Nt(e,[],!1).filter(l=>Te(l)&&yt(l)!=="body"),o=null;const s=Oe(e).position==="fixed";let a=s?nt(e):e;for(;Te(a)&&!jt(a);){const l=Oe(a),u=Er(a),f=o?o.position:s?"fixed":"";!u&&(f==="fixed"||f==="absolute"&&l.position==="static")?r=r.filter(d=>d!==a):o=l,a=nt(a)}return t.set(e,r),r}function Ol(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?hn(t)?[]:Tl(t,this._c):[].concat(n),r],l=Ro(t,a[0],o);let u=l.top,f=l.right,p=l.bottom,d=l.left;for(let h=1;h<a.length;h++){const x=Ro(t,a[h],o);u=Be(x.top,u),f=Ye(x.right,f),p=Ye(x.bottom,p),d=Be(x.left,d)}return{width:f-d,height:p-u,x:d,y:u}}function _l(e){const{width:t,height:n}=Is(e);return{width:t,height:n}}function Dl(e,t,n){const r=Ze(t),o=Ue(t),s=n==="fixed",a=rt(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=ze(0);if((r||!s)&&((yt(t)!=="body"||mn(o))&&(l=vn(t)),r)){const h=rt(t,!0,s,t);u.x=h.x+t.clientLeft,u.y=h.y+t.clientTop}!r&&o&&(u.x=gn(o));const f=o&&!r&&!s?Ts(o,l):ze(0),p=a.left+l.scrollLeft-u.x-f.x,d=a.top+l.scrollTop-u.y-f.y;return{x:p,y:d,width:a.width,height:a.height}}function Dn(e){return Oe(e).position==="static"}function Eo(e,t){if(!Ze(e)||Oe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ue(e)===n&&(n=n.ownerDocument.body),n}function Os(e,t){const n=ge(e);if(hn(e))return n;if(!Ze(e)){let o=nt(e);for(;o&&!jt(o);){if(Te(o)&&!Dn(o))return o;o=nt(o)}return n}let r=Eo(e,t);for(;r&&bl(r)&&Dn(r);)r=Eo(r,t);return r&&jt(r)&&Dn(r)&&!Er(r)?n:r||Cl(e)||n}const kl=async function(e){const t=this.getOffsetParent||Os,n=this.getDimensions,r=await n(e.floating);return{reference:Dl(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ml(e){return Oe(e).direction==="rtl"}const $l={convertOffsetParentRelativeRectToViewportRelativeRect:El,getDocumentElement:Ue,getClippingRect:Ol,getOffsetParent:Os,getElementRects:kl,getClientRects:Pl,getDimensions:_l,getScale:mt,isElement:Te,isRTL:Ml};function _s(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Fl(e,t,n){let r=null,o;const s=Ue(e);function a(){var p;clearTimeout(o),(p=r)==null||p.disconnect(),r=null}function l(p,d){p===void 0&&(p=!1),d===void 0&&(d=1),a();const h=e.getBoundingClientRect(),{left:x,top:g,width:v,height:m}=h;if(p||t(),!v||!m)return;const C=Ut(g),b=Ut(s.clientWidth-(x+v)),y=Ut(s.clientHeight-(g+m)),w=Ut(x),S={rootMargin:-C+"px "+-b+"px "+-y+"px "+-w+"px",threshold:Be(0,Ye(1,d))||1};let P=!0;function I(N){const A=N[0].intersectionRatio;if(!_s(h,e.getBoundingClientRect()))return l();if(A!==d){if(!P)return l();A?l(!1,A):o=setTimeout(()=>{l(!1,1e-7)},1e3)}P=!1}try{r=new IntersectionObserver(I,{...S,root:s.ownerDocument})}catch{r=new IntersectionObserver(I,S)}r.observe(e)}const u=ge(e),f=()=>l(n);return u.addEventListener("resize",f),l(!0),()=>{u.removeEventListener("resize",f),a()}}function Ll(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=jr(e),p=o||s?[...f?Nt(f):[],...t?Nt(t):[]]:[];p.forEach(C=>{o&&C.addEventListener("scroll",n),s&&C.addEventListener("resize",n)});const d=f&&l?Fl(f,n,s):null;let h=-1,x=null;a&&(x=new ResizeObserver(C=>{let[b]=C;b&&b.target===f&&x&&t&&(x.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var y;(y=x)==null||y.observe(t)})),n()}),f&&!u&&x.observe(f),t&&x.observe(t));let g,v=u?rt(e):null;u&&m();function m(){const C=rt(e);v&&!_s(v,C)&&n(),v=C,g=requestAnimationFrame(m)}return n(),()=>{var C;p.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),d?.(),(C=x)==null||C.disconnect(),x=null,u&&cancelAnimationFrame(g)}}const Bl=hl,zl=vl,Vl=fl,Hl=xl,Ul=pl,Po=dl,Wl=gl,Kl=(e,t,n)=>{const r=new Map,o=n??{},s={...$l,...o.platform,_c:r};return ul(e,t,{...o,platform:s})};var Gl=typeof document<"u",Yl=function(){},Zt=Gl?c.useLayoutEffect:Yl;function an(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(!an(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)&&!an(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ds(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function jo(e,t){const n=Ds(e);return Math.round(t*n)/n}function kn(e){const t=c.useRef(e);return Zt(()=>{t.current=e}),t}function ql(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:u,open:f}=e,[p,d]=c.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,x]=c.useState(r);an(h,r)||x(r);const[g,v]=c.useState(null),[m,C]=c.useState(null),b=c.useCallback(F=>{F!==S.current&&(S.current=F,v(F))},[]),y=c.useCallback(F=>{F!==P.current&&(P.current=F,C(F))},[]),w=s||g,R=a||m,S=c.useRef(null),P=c.useRef(null),I=c.useRef(p),N=u!=null,A=kn(u),_=kn(o),T=kn(f),D=c.useCallback(()=>{if(!S.current||!P.current)return;const F={placement:t,strategy:n,middleware:h};_.current&&(F.platform=_.current),Kl(S.current,P.current,F).then(U=>{const V={...U,isPositioned:T.current!==!1};$.current&&!an(I.current,V)&&(I.current=V,Tt.flushSync(()=>{d(V)}))})},[h,t,n,_,T]);Zt(()=>{f===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,d(F=>({...F,isPositioned:!1})))},[f]);const $=c.useRef(!1);Zt(()=>($.current=!0,()=>{$.current=!1}),[]),Zt(()=>{if(w&&(S.current=w),R&&(P.current=R),w&&R){if(A.current)return A.current(w,R,D);D()}},[w,R,D,A,N]);const K=c.useMemo(()=>({reference:S,floating:P,setReference:b,setFloating:y}),[b,y]),L=c.useMemo(()=>({reference:w,floating:R}),[w,R]),k=c.useMemo(()=>{const F={position:n,left:0,top:0};if(!L.floating)return F;const U=jo(L.floating,p.x),V=jo(L.floating,p.y);return l?{...F,transform:"translate("+U+"px, "+V+"px)",...Ds(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:V}},[n,l,L.floating,p.x,p.y]);return c.useMemo(()=>({...p,update:D,refs:K,elements:L,floatingStyles:k}),[p,D,K,L,k])}const Xl=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Po({element:r.current,padding:o}).fn(n):{}:r?Po({element:r,padding:o}).fn(n):{}}}},Zl=(e,t)=>{const n=Bl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jl=(e,t)=>{const n=zl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ql=(e,t)=>({fn:Wl(e).fn,options:[e,t]}),eu=(e,t)=>{const n=Vl(e);return{name:n.name,fn:n.fn,options:[e,t]}},tu=(e,t)=>{const n=Hl(e);return{name:n.name,fn:n.fn,options:[e,t]}},nu=(e,t)=>{const n=Ul(e);return{name:n.name,fn:n.fn,options:[e,t]}},ru=(e,t)=>{const n=Xl(e);return{name:n.name,fn:n.fn,options:[e,t]}};var ou=Object.defineProperty,su=(e,t)=>ou(e,"name",{value:t,configurable:!0});function Nr(e){const[t,n]=c.useState(void 0);return oe(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let a,l;if("borderBoxSize"in s){const u=s.borderBoxSize,f=Array.isArray(u)?u[0]:u;a=f.inlineSize,l=f.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}su(Nr,"useSize");var iu=Object.defineProperty,Ge=(e,t)=>iu(e,"name",{value:t,configurable:!0}),ks="Popper",[Ms,$s]=Pe(ks),[au,Fs]=Ms(ks),cu=Ge(e=>{const{__scopePopper:t,children:n}=e,[r,o]=c.useState(null),[s,a]=c.useState(void 0);return i.jsx(au,{scope:t,anchor:r,onAnchorChange:o,placementState:s,setPlacementState:a,children:n})},"Popper"),lu="PopperAnchor",uu=c.forwardRef(Ge(function(t,n){const{__scopePopper:r,virtualRef:o,...s}=t,a=Fs(lu,r),l=c.useRef(null),u=a.onAnchorChange,f=c.useCallback(v=>{l.current=v,v&&u(v)},[u]),p=ne(n,f),d=c.useRef(null);c.useEffect(()=>{if(!o)return;const v=d.current;d.current=o.current,v!==d.current&&u(d.current)});const h=a.placementState&&xn(a.placementState),x=h?.[0],g=h?.[1];return o?null:i.jsx(H.div,{"data-radix-popper-side":x,"data-radix-popper-align":g,...s,ref:p})},"PopperAnchor")),Ls="PopperContent",[du,Zf]=Ms(Ls),fu=c.forwardRef(Ge(function(t,n){const{__scopePopper:r,side:o="bottom",sideOffset:s=0,align:a="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:f=!0,collisionBoundary:p=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:x=!1,updatePositionStrategy:g="optimized",onPlaced:v,...m}=t,C=Fs(Ls,r),[b,y]=c.useState(null),w=ne(n,y),[R,S]=c.useState(null),P=Nr(R),I=P?.width??0,N=P?.height??0,A=o+(a!=="center"?"-"+a:""),_=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(p)?p:[p],D=T.length>0,$={padding:_,boundary:T.filter(Bs),altBoundary:D},{refs:K,floatingStyles:L,placement:k,isPositioned:F,middlewareData:U}=ql({strategy:"fixed",placement:A,whileElementsMounted:Ge((...q)=>Ll(...q,{animationFrame:g==="always"}),"whileElementsMounted"),elements:{reference:C.anchor},middleware:[Zl({mainAxis:s+N,alignmentAxis:l}),f&&Jl({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Ql():void 0,...$}),f&&eu({...$}),tu({...$,apply:Ge(({elements:q,rects:ee,availableWidth:W,availableHeight:X})=>{const{width:te,height:xe}=ee.reference,le=q.floating.style;le.setProperty("--radix-popper-available-width",`${W}px`),le.setProperty("--radix-popper-available-height",`${X}px`),le.setProperty("--radix-popper-anchor-width",`${te}px`),le.setProperty("--radix-popper-anchor-height",`${xe}px`)},"apply")}),R&&ru({element:R,padding:u}),pu({arrowWidth:I,arrowHeight:N}),x&&nu({strategy:"referenceHidden",...$,boundary:D?$.boundary:void 0})]}),V=C.setPlacementState;oe(()=>(V(k),()=>{V(void 0)}),[k,V]);const[we,G]=xn(k),ae=Ee(v);oe(()=>{F&&ae?.()},[F,ae]);const me=U.arrow?.x,he=U.arrow?.y,We=U.arrow?.centerOffset!==0,[ve,M]=c.useState();return oe(()=>{b&&M(window.getComputedStyle(b).zIndex)},[b]),i.jsx("div",{ref:K.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:F?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ve,"--radix-popper-transform-origin":[U.transformOrigin?.x,U.transformOrigin?.y].join(" "),...U.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:i.jsx(du,{scope:r,placedSide:we,placedAlign:G,onArrowChange:S,arrowX:me,arrowY:he,shouldHideArrow:We,children:i.jsx(H.div,{"data-side":we,"data-align":G,...m,ref:w,style:{...m.style,animation:F?m.style?.animation:"none"}})})})},"PopperContent"));function Bs(e){return e!==null}Ge(Bs,"isNotNull");var pu=Ge(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,a=o.arrow?.centerOffset!==0,l=a?0:e.arrowWidth,u=a?0:e.arrowHeight,[f,p]=xn(n),d={start:"0%",center:"50%",end:"100%"}[p],h=(o.arrow?.x??0)+l/2,x=(o.arrow?.y??0)+u/2;let g="",v="";return f==="bottom"?(g=a?d:`${h}px`,v=`${-u}px`):f==="top"?(g=a?d:`${h}px`,v=`${r.floating.height+u}px`):f==="right"?(g=`${-u}px`,v=a?d:`${x}px`):f==="left"&&(g=`${r.floating.width+u}px`,v=a?d:`${x}px`),{data:{x:g,y:v}}}}),"transformOrigin");function xn(e){const[t,n="center"]=e.split("-");return[t,n]}Ge(xn,"getSideAndAlignFromPlacement");var mu=cu,hu=uu,vu=fu,gu=Object.defineProperty,xu=(e,t)=>gu(e,"name",{value:t,configurable:!0}),zs=c.forwardRef(xu(function(t,n){const{container:r,...o}=t,[s,a]=c.useState(!1);oe(()=>a(!0),[]);const l=r||s&&globalThis?.document?.body;return l?Tt.createPortal(i.jsx(H.div,{...o,ref:n}),l):null},"Portal")),bu=Object.defineProperty,yu=(e,t)=>bu(e,"name",{value:t,configurable:!0});function Vs(e){const t=c.useRef({value:e,previous:e});return c.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}yu(Vs,"usePrevious");var wu=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Cu=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},lt=new WeakMap,Wt=new WeakMap,Kt={},Mn=0,Hs=function(e){return e&&(e.host||Hs(e.parentNode))},Su=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Hs(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Ru=function(e,t,n,r){var o=Su(t,Array.isArray(e)?e:[e]);Kt[n]||(Kt[n]=new WeakMap);var s=Kt[n],a=[],l=new Set,u=new Set(o),f=function(d){!d||l.has(d)||(l.add(d),f(d.parentNode))};o.forEach(f);var p=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(h){if(l.has(h))p(h);else try{var x=h.getAttribute(r),g=x!==null&&x!=="false",v=(lt.get(h)||0)+1,m=(s.get(h)||0)+1;lt.set(h,v),s.set(h,m),a.push(h),v===1&&g&&Wt.set(h,!0),m===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(C){console.error("aria-hidden: cannot operate on ",h,C)}})};return p(t),l.clear(),Mn++,function(){a.forEach(function(d){var h=lt.get(d)-1,x=s.get(d)-1;lt.set(d,h),s.set(d,x),h||(Wt.has(d)||d.removeAttribute(r),Wt.delete(d)),x||d.removeAttribute(n)}),Mn--,Mn||(lt=new WeakMap,lt=new WeakMap,Wt=new WeakMap,Kt={})}},Us=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Cu(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Ru(r,o,n,"aria-hidden")):function(){return null}},je=function(){return je=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},je.apply(this,arguments)};function Ws(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Eu(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Jt="right-scroll-bar-position",Qt="width-before-scroll-bar",Pu="with-scroll-bars-hidden",ju="--removed-body-scroll-bar-size";function $n(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Nu(e,t){var n=c.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Iu=typeof window<"u"?c.useLayoutEffect:c.useEffect,No=new WeakMap;function Au(e,t){var n=Nu(null,function(r){return e.forEach(function(o){return $n(o,r)})});return Iu(function(){var r=No.get(n);if(r){var o=new Set(r),s=new Set(e),a=n.current;o.forEach(function(l){s.has(l)||$n(l,null)}),s.forEach(function(l){o.has(l)||$n(l,a)})}No.set(n,e)},[e]),n}function Tu(e){return e}function Ou(e,t){t===void 0&&(t=Tu);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var a=t(s,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(s){for(r=!0;n.length;){var a=n;n=[],a.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(s),a=n}var u=function(){var p=a;a=[],p.forEach(s)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(p){a.push(p),f()},filter:function(p){return a=a.filter(p),n}}}};return o}function _u(e){e===void 0&&(e={});var t=Ou(null);return t.options=je({async:!0,ssr:!1},e),t}var Ks=function(e){var t=e.sideCar,n=Ws(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return c.createElement(r,je({},n))};Ks.isSideCarExport=!0;function Du(e,t){return e.useMedium(t),Ks}var Gs=_u(),Fn=function(){},bn=c.forwardRef(function(e,t){var n=c.useRef(null),r=c.useState({onScrollCapture:Fn,onWheelCapture:Fn,onTouchMoveCapture:Fn}),o=r[0],s=r[1],a=e.forwardProps,l=e.children,u=e.className,f=e.removeScrollBar,p=e.enabled,d=e.shards,h=e.sideCar,x=e.noRelative,g=e.noIsolation,v=e.inert,m=e.allowPinchZoom,C=e.as,b=C===void 0?"div":C,y=e.gapMode,w=Ws(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=h,S=Au([n,t]),P=je(je({},w),o);return c.createElement(c.Fragment,null,p&&c.createElement(R,{sideCar:Gs,removeScrollBar:f,shards:d,noRelative:x,noIsolation:g,inert:v,setCallbacks:s,allowPinchZoom:!!m,lockRef:n,gapMode:y}),a?c.cloneElement(c.Children.only(l),je(je({},P),{ref:S})):c.createElement(b,je({},P,{className:u,ref:S}),l))});bn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};bn.classNames={fullWidth:Qt,zeroRight:Jt};var ku=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Mu(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ku();return t&&e.setAttribute("nonce",t),e}function $u(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Fu(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Lu=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Mu())&&($u(t,n),Fu(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Bu=function(){var e=Lu();return function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ys=function(){var e=Bu(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},zu={left:0,top:0,right:0,gap:0},Ln=function(e){return parseInt(e||"",10)||0},Vu=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Ln(n),Ln(r),Ln(o)]},Hu=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return zu;var t=Vu(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Uu=Ys(),ht="data-scroll-locked",Wu=function(e,t,n,r){var o=e.left,s=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
2
|
-
|
|
3
|
-
overflow: hidden `).concat(r,`;
|
|
4
|
-
padding-right: `).concat(l,"px ").concat(r,`;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.`).concat(Jt,` {
|
|
20
|
-
right: `).concat(l,"px ").concat(r,`;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.`).concat(Qt,` {
|
|
24
|
-
margin-right: `).concat(l,"px ").concat(r,`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.`).concat(Jt," .").concat(Jt,` {
|
|
28
|
-
right: 0 `).concat(r,`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.`).concat(Qt," .").concat(Qt,` {
|
|
32
|
-
margin-right: 0 `).concat(r,`;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
body[`).concat(ht,`] {
|
|
36
|
-
`).concat(ju,": ").concat(l,`px;
|
|
37
|
-
}
|
|
38
|
-
`)},Io=function(){var e=parseInt(document.body.getAttribute(ht)||"0",10);return isFinite(e)?e:0},Ku=function(){c.useEffect(function(){return document.body.setAttribute(ht,(Io()+1).toString()),function(){var e=Io()-1;e<=0?document.body.removeAttribute(ht):document.body.setAttribute(ht,e.toString())}},[])},Gu=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Ku();var s=c.useMemo(function(){return Hu(o)},[o]);return c.createElement(Uu,{styles:Wu(s,!t,o,n?"":"!important")})},tr=!1;if(typeof window<"u")try{var Gt=Object.defineProperty({},"passive",{get:function(){return tr=!0,!0}});window.addEventListener("test",Gt,Gt),window.removeEventListener("test",Gt,Gt)}catch{tr=!1}var ut=tr?{passive:!1}:!1,Yu=function(e){return e.tagName==="TEXTAREA"},qs=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Yu(e)&&n[t]==="visible")},qu=function(e){return qs(e,"overflowY")},Xu=function(e){return qs(e,"overflowX")},Ao=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Xs(e,r);if(o){var s=Zs(e,r),a=s[1],l=s[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Zu=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Ju=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Xs=function(e,t){return e==="v"?qu(t):Xu(t)},Zs=function(e,t){return e==="v"?Zu(t):Ju(t)},Qu=function(e,t){return e==="h"&&t==="rtl"?-1:1},ed=function(e,t,n,r,o){var s=Qu(e,window.getComputedStyle(t).direction),a=s*r,l=n.target,u=t.contains(l),f=!1,p=a>0,d=0,h=0;do{if(!l)break;var x=Zs(e,l),g=x[0],v=x[1],m=x[2],C=v-m-s*g;(g||C)&&Xs(e,l)&&(d+=C,h+=g);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return(p&&Math.abs(d)<1||!p&&Math.abs(h)<1)&&(f=!0),f},Yt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},To=function(e){return[e.deltaX,e.deltaY]},Oo=function(e){return e&&"current"in e?e.current:e},td=function(e,t){return e[0]===t[0]&&e[1]===t[1]},nd=function(e){return`
|
|
39
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
40
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
41
|
-
`)},rd=0,dt=[];function od(e){var t=c.useRef([]),n=c.useRef([0,0]),r=c.useRef(),o=c.useState(rd++)[0],s=c.useState(Ys)[0],a=c.useRef(e);c.useEffect(function(){a.current=e},[e]),c.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=Eu([e.lockRef.current],(e.shards||[]).map(Oo),!0).filter(Boolean);return v.forEach(function(m){return m.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=c.useCallback(function(v,m){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!a.current.allowPinchZoom;var C=Yt(v),b=n.current,y="deltaX"in v?v.deltaX:b[0]-C[0],w="deltaY"in v?v.deltaY:b[1]-C[1],R,S=v.target,P=Math.abs(y)>Math.abs(w)?"h":"v";if("touches"in v&&P==="h"&&S.type==="range")return!1;var I=window.getSelection(),N=I&&I.anchorNode,A=N?N===S||N.contains(S):!1;if(A)return!1;var _=Ao(P,S);if(!_)return!0;if(_?R=P:(R=P==="v"?"h":"v",_=Ao(P,S)),!_)return!1;if(!r.current&&"changedTouches"in v&&(y||w)&&(r.current=R),!R)return!0;var T=r.current||R;return ed(T,m,v,T==="h"?y:w)},[]),u=c.useCallback(function(v){var m=v;if(!(!dt.length||dt[dt.length-1]!==s)){var C="deltaY"in m?To(m):Yt(m),b=t.current.filter(function(R){return R.name===m.type&&(R.target===m.target||m.target===R.shadowParent)&&td(R.delta,C)})[0];if(b&&b.should){m.cancelable&&m.preventDefault();return}if(!b){var y=(a.current.shards||[]).map(Oo).filter(Boolean).filter(function(R){return R.contains(m.target)}),w=y.length>0?l(m,y[0]):!a.current.noIsolation;w&&m.cancelable&&m.preventDefault()}}},[]),f=c.useCallback(function(v,m,C,b){var y={name:v,delta:m,target:C,should:b,shadowParent:sd(C)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(w){return w!==y})},1)},[]),p=c.useCallback(function(v){n.current=Yt(v),r.current=void 0},[]),d=c.useCallback(function(v){f(v.type,To(v),v.target,l(v,e.lockRef.current))},[]),h=c.useCallback(function(v){f(v.type,Yt(v),v.target,l(v,e.lockRef.current))},[]);c.useEffect(function(){return dt.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",u,ut),document.addEventListener("touchmove",u,ut),document.addEventListener("touchstart",p,ut),function(){dt=dt.filter(function(v){return v!==s}),document.removeEventListener("wheel",u,ut),document.removeEventListener("touchmove",u,ut),document.removeEventListener("touchstart",p,ut)}},[]);var x=e.removeScrollBar,g=e.inert;return c.createElement(c.Fragment,null,g?c.createElement(s,{styles:nd(o)}):null,x?c.createElement(Gu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function sd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const id=Du(Gs,od);var Ir=c.forwardRef(function(e,t){return c.createElement(bn,je({},e,{ref:t,sideCar:id}))});Ir.classNames=bn.classNames;var ad=Object.defineProperty,Y=(e,t)=>ad(e,"name",{value:t,configurable:!0}),cd=[" ","Enter","ArrowUp","ArrowDown"],ld=[" ","Enter"],vt="Select",[yn,Ar,ud]=cn(vt),[st,Jf]=Pe(vt,[ud,$s]),Tr=$s(),[dd,Je]=st(vt),[fd,pd]=st(vt);function Js(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:a,defaultValue:l,onValueChange:u,dir:f,name:p,autoComplete:d,disabled:h,required:x,form:g,internal_do_not_use_render:v}=e,m=Tr(t),[C,b]=c.useState(null),[y,w]=c.useState(null),[R,S]=c.useState(!1),P=Dt(f),[I,N]=Ae({prop:r,defaultProp:o??!1,onChange:s,caller:vt}),[A,_]=Ae({prop:a,defaultProp:l,onChange:u,caller:vt}),T=c.useRef(null),D=c.useRef(A);c.useEffect(()=>{const G=g?C?.ownerDocument.getElementById(g):C?.form;if(G instanceof HTMLFormElement){const ae=Y(()=>_(D.current),"reset");return G.addEventListener("reset",ae),()=>G.removeEventListener("reset",ae)}},[g,C,_]);const $=C?!!g||!!C.closest("form"):!0,[K,L]=c.useState(new Set),k=Ie(),F=Array.from(K).map(G=>G.props.value).join(";"),U=c.useCallback(G=>{L(ae=>new Set(ae).add(G))},[]),V=c.useCallback(G=>{L(ae=>{const me=new Set(ae);return me.delete(G),me})},[]),we={required:x,trigger:C,onTriggerChange:b,valueNode:y,onValueNodeChange:w,valueNodeHasChildren:R,onValueNodeHasChildrenChange:S,contentId:k,value:A,onValueChange:_,open:I,onOpenChange:N,dir:P,triggerPointerDownPosRef:T,disabled:h,name:p,autoComplete:d,form:g,nativeOptions:K,nativeSelectKey:F,isFormControl:$};return i.jsx(mu,{...m,children:i.jsx(dd,{scope:t,...we,children:i.jsx(yn.Provider,{scope:t,children:i.jsx(fd,{scope:t,onNativeOptionAdd:U,onNativeOptionRemove:V,children:oi(v)?v(we):n})})})})}Y(Js,"SelectProvider");var md=Y(e=>{const{__scopeSelect:t,children:n,...r}=e;return i.jsx(Js,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:o})=>i.jsxs(i.Fragment,{children:[n,o?i.jsx(Md,{__scopeSelect:t}):null]})})},"Select"),hd="SelectTrigger",Qs=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,disabled:o=!1,...s}=t,a=Tr(r),l=Je(hd,r),u=l.disabled||o,f=ne(n,l.onTriggerChange),p=Ar(r),d=c.useRef("touch"),[h,x,g]=Or(m=>{const C=p().filter(w=>!w.disabled),b=C.find(w=>w.value===l.value),y=_r(C,m,b);y!==void 0&&l.onValueChange(y.value)}),v=Y(m=>{u||(l.onOpenChange(!0),g()),m&&(l.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})},"handleOpen");return i.jsx(hu,{asChild:!0,...a,children:i.jsx(H.button,{type:"button",role:"combobox","aria-controls":l.open?l.contentId:void 0,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":kt(l.value)?"":void 0,...s,ref:f,onClick:z(s.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&v(m)}),onPointerDown:z(s.onPointerDown,m=>{d.current=m.pointerType;const C=m.target;C.hasPointerCapture(m.pointerId)&&C.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(v(m),m.preventDefault())}),onKeyDown:z(s.onKeyDown,m=>{const C=h.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&x(m.key),!(C&&m.key===" ")&&cd.includes(m.key)&&(v(),m.preventDefault())})})})},"SelectTrigger")),vd="SelectValue",gd=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,className:o,style:s,children:a,placeholder:l="",...u}=t,f=Je(vd,r),{onValueNodeHasChildrenChange:p}=f,d=a!==void 0,h=ne(n,f.onValueNodeChange);oe(()=>{p(d)},[p,d]);const x=kt(f.value);return i.jsx(H.span,{...u,asChild:x?!1:u.asChild,ref:h,style:{pointerEvents:"none"},children:i.jsx(c.Fragment,{children:x?l:a},x?"placeholder":"value")})},"SelectValue")),xd=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,children:o,...s}=t;return i.jsx(H.span,{"aria-hidden":!0,...s,ref:n,children:o||"▼"})},"SelectIcon")),bd="SelectPortal",[yd,wd]=st(bd,{forceMount:void 0}),Cd=Y(e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return i.jsx(yd,{scope:e.__scopeSelect,forceMount:n,children:i.jsx(zs,{asChild:!0,...r})})},"SelectPortal"),ot="SelectContent",ei=c.forwardRef(Y(function(t,n){const r=wd(ot,t.__scopeSelect),{forceMount:o=r.forceMount,...s}=t,a=Je(ot,t.__scopeSelect),[l,u]=c.useState();return oe(()=>{u(new DocumentFragment)},[]),i.jsx(xt,{present:o||a.open,children:({present:f})=>f?i.jsx(Ed,{...s,ref:n}):i.jsx(Sd,{...s,fragment:l})})},"SelectContent")),Sd=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,children:o,fragment:s}=t;return s?Tt.createPortal(i.jsx(ti,{scope:r,children:i.jsx(yn.Slot,{scope:r,children:i.jsx("div",{ref:n,children:o})})}),s):null},"SelectContentFragment")),Re=10,[ti,wn]=st(ot),Rd=tt("SelectContent.RemoveScroll"),Ed=c.forwardRef(Y(function(t,n){const{__scopeSelect:r}=t,{position:o="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:l,side:u,sideOffset:f,align:p,alignOffset:d,arrowPadding:h,collisionBoundary:x,collisionPadding:g,sticky:v,hideWhenDetached:m,avoidCollisions:C,...b}=t,y=Je(ot,r),[w,R]=c.useState(null),[S,P]=c.useState(null),I=ne(n,R),[N,A]=c.useState(null),[_,T]=c.useState(null),D=Ar(r),[$,K]=c.useState(!1),L=c.useRef(!1);c.useEffect(()=>{if(w)return Us(w)},[w]),fn();const k=c.useCallback(M=>{const[q,...ee]=D().map(te=>te.ref.current),[W]=ee.slice(-1),X=document.activeElement;for(const te of M)if(te===X||(te?.scrollIntoView({block:"nearest"}),te===q&&S&&(S.scrollTop=0),te===W&&S&&(S.scrollTop=S.scrollHeight),te?.focus(),document.activeElement!==X))return},[D,S]),F=c.useCallback(()=>k([N,w]),[k,N,w]);c.useEffect(()=>{$&&F()},[$,F]);const{onOpenChange:U,triggerPointerDownPosRef:V}=y;c.useEffect(()=>{if(w){let M={x:0,y:0};const q=Y(W=>{M={x:Math.abs(Math.round(W.pageX)-(V.current?.x??0)),y:Math.abs(Math.round(W.pageY)-(V.current?.y??0))}},"handlePointerMove"),ee=Y(W=>{M.x<=10&&M.y<=10?W.preventDefault():W.composedPath().includes(w)||U(!1),document.removeEventListener("pointermove",q),V.current=null},"handlePointerUp");return V.current!==null&&(document.addEventListener("pointermove",q),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",q),document.removeEventListener("pointerup",ee,{capture:!0})}}},[w,U,V]),c.useEffect(()=>{const M=Y(()=>U(!1),"close");return window.addEventListener("blur",M),window.addEventListener("resize",M),()=>{window.removeEventListener("blur",M),window.removeEventListener("resize",M)}},[U]);const[we,G]=Or(M=>{const q=D().filter(X=>!X.disabled),ee=q.find(X=>X.ref.current===document.activeElement),W=_r(q,M,ee);W&&setTimeout(()=>W.ref.current?.focus())}),ae=c.useCallback((M,q,ee)=>{const W=!L.current&&!ee;(y.value!==void 0&&y.value===q||W)&&(A(M),W&&(L.current=!0))},[y.value]),me=c.useCallback(()=>w?.focus(),[w]),he=c.useCallback((M,q,ee)=>{const W=!L.current&&!ee;(y.value!==void 0&&y.value===q||W)&&T(M)},[y.value]),We=o==="popper"?_o:Pd,ve=We===_o?{side:u,sideOffset:f,align:p,alignOffset:d,arrowPadding:h,collisionBoundary:x,collisionPadding:g,sticky:v,hideWhenDetached:m,avoidCollisions:C}:{};return i.jsx(ti,{scope:r,content:w,viewport:S,onViewportChange:P,itemRefCallback:ae,selectedItem:N,onItemLeave:me,itemTextRefCallback:he,focusSelectedItem:F,selectedItemText:_,position:o,isPositioned:$,searchRef:we,children:i.jsx(Ir,{as:Rd,allowPinchZoom:!0,children:i.jsx(gs,{asChild:!0,trapped:y.open,onMountAutoFocus:M=>{M.preventDefault()},onUnmountAutoFocus:z(s,M=>{y.trigger?.focus({preventScroll:!0}),M.preventDefault()}),children:i.jsx(ps,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:M=>M.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:i.jsx(We,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:M=>M.preventDefault(),...b,...ve,onPlaced:()=>K(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:z(b.onKeyDown,M=>{const q=M.ctrlKey||M.altKey||M.metaKey;if(M.key==="Tab"&&M.preventDefault(),!q&&M.key.length===1&&G(M.key),["ArrowUp","ArrowDown","Home","End"].includes(M.key)){let W=D().filter(X=>!X.disabled).map(X=>X.ref.current);if(["ArrowUp","End"].includes(M.key)&&(W=W.slice().reverse()),["ArrowUp","ArrowDown"].includes(M.key)){const X=M.target,te=W.indexOf(X);W=W.slice(te+1)}setTimeout(()=>k(W)),M.preventDefault()}})})})})})})},"SelectContentImpl")),Pd=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,onPlaced:o,...s}=t,a=Je(ot,r),l=wn(ot,r),[u,f]=c.useState(null),[p,d]=c.useState(null),h=ne(n,d),x=Ar(r),g=c.useRef(!1),v=c.useRef(!0),{viewport:m,selectedItem:C,selectedItemText:b,focusSelectedItem:y}=l,w=c.useCallback(()=>{if(a.trigger&&a.valueNode&&u&&p&&m&&C&&b){const I=a.trigger.getBoundingClientRect(),N=p.getBoundingClientRect(),A=a.valueNode.getBoundingClientRect(),_=b.getBoundingClientRect();if(a.dir!=="rtl"){const X=_.left-N.left,te=A.left-X,xe=I.left-te,le=I.width+xe,Me=Math.max(le,N.width),Ke=window.innerWidth-Re,at=Gn(te,[Re,Math.max(Re,Ke-Me)]);u.style.minWidth=le+"px",u.style.left=at+"px"}else{const X=N.right-_.right,te=window.innerWidth-A.right-X,xe=window.innerWidth-I.right-te,le=I.width+xe,Me=Math.max(le,N.width),Ke=window.innerWidth-Re,at=Gn(te,[Re,Math.max(Re,Ke-Me)]);u.style.minWidth=le+"px",u.style.right=at+"px"}const T=x(),D=window.innerHeight-Re*2,$=m.scrollHeight,K=window.getComputedStyle(p),L=parseInt(K.borderTopWidth,10),k=parseInt(K.paddingTop,10),F=parseInt(K.borderBottomWidth,10),U=parseInt(K.paddingBottom,10),V=L+k+$+U+F,we=Math.min(C.offsetHeight*5,V),G=window.getComputedStyle(m),ae=parseInt(G.paddingTop,10),me=parseInt(G.paddingBottom,10),he=I.top+I.height/2-Re,We=D-he,ve=C.offsetHeight/2,M=C.offsetTop+ve,q=L+k+M,ee=V-q;if(q<=he){const X=T.length>0&&C===T[T.length-1].ref.current;u.style.bottom="0px";const te=p.clientHeight-m.offsetTop-m.offsetHeight,xe=Math.max(We,ve+(X?me:0)+te+F),le=q+xe;u.style.height=le+"px"}else{const X=T.length>0&&C===T[0].ref.current;u.style.top="0px";const xe=Math.max(he,L+m.offsetTop+(X?ae:0)+ve)+ee;u.style.height=xe+"px",m.scrollTop=q-he+m.offsetTop}u.style.margin=`${Re}px 0`,u.style.minHeight=we+"px",u.style.maxHeight=D+"px",o?.(),requestAnimationFrame(()=>g.current=!0)}},[x,a.trigger,a.valueNode,u,p,m,C,b,a.dir,o]);oe(()=>w(),[w]);const[R,S]=c.useState();oe(()=>{p&&S(window.getComputedStyle(p).zIndex)},[p]);const P=c.useCallback(I=>{I&&v.current===!0&&(w(),y?.(),v.current=!1)},[w,y]);return i.jsx(jd,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:g,onScrollButtonChange:P,children:i.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:i.jsx(H.div,{...s,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})},"SelectItemAlignedPosition")),_o=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,align:o="start",collisionPadding:s=Re,...a}=t,l=Tr(r);return i.jsx(vu,{...l,...a,ref:n,align:o,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[jd,Nd]=st(ot,{}),Do="SelectViewport",Id=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,nonce:o,...s}=t,a=wn(Do,r),l=Nd(Do,r),u=ne(n,a.onViewportChange),f=c.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),i.jsx(yn.Slot,{scope:r,children:i.jsx(H.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:z(s.onScroll,p=>{const d=p.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:x}=l;if(x?.current&&h){const g=Math.abs(f.current-d.scrollTop);if(g>0){const v=window.innerHeight-Re*2,m=parseFloat(h.style.minHeight),C=parseFloat(h.style.height),b=Math.max(m,C);if(b<v){const y=b+g,w=Math.min(v,y),R=y-w;h.style.height=w+"px",h.style.bottom==="0px"&&(d.scrollTop=R>0?R:0,h.style.justifyContent="flex-end")}}}f.current=d.scrollTop})})})]})},"SelectViewport")),Ad="SelectGroup",[Qf,ep]=st(Ad),nr="SelectItem",[Td,ni]=st(nr),ri=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,value:o,disabled:s=!1,textValue:a,...l}=t,u=Je(nr,r),f=wn(nr,r),p=u.value===o,[d,h]=c.useState(a??""),[x,g]=c.useState(!1),v=Ee(w=>f.itemRefCallback?.(w,o,s)),m=ne(n,v),C=Ie(),b=c.useRef("touch"),y=Y(()=>{s||(u.onValueChange(o),u.onOpenChange(!1))},"handleSelect");return i.jsx(Td,{scope:r,value:o,disabled:s,textId:C,isSelected:p,onItemTextChange:c.useCallback(w=>{h(R=>R||(w?.textContent??"").trim())},[]),children:i.jsx(yn.ItemSlot,{scope:r,value:o,disabled:s,textValue:d,children:i.jsx(H.div,{role:"option","aria-labelledby":C,"data-highlighted":x?"":void 0,"aria-selected":p&&x,"data-state":p?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...l,ref:m,onFocus:z(l.onFocus,()=>g(!0)),onBlur:z(l.onBlur,()=>g(!1)),onClick:z(l.onClick,()=>{b.current!=="mouse"&&y()}),onPointerUp:z(l.onPointerUp,()=>{b.current==="mouse"&&y()}),onPointerDown:z(l.onPointerDown,w=>{b.current=w.pointerType}),onPointerMove:z(l.onPointerMove,w=>{b.current=w.pointerType,s?f.onItemLeave?.():b.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:z(l.onPointerLeave,w=>{w.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:z(l.onKeyDown,w=>{s||w.target!==w.currentTarget||f.searchRef?.current!==""&&w.key===" "||(ld.includes(w.key)&&y(),w.key===" "&&w.preventDefault())})})})})},"SelectItem")),qt="SelectItemText",Od=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,className:o,style:s,...a}=t,l=Je(qt,r),u=wn(qt,r),f=ni(qt,r),p=pd(qt,r),[d,h]=c.useState(null),x=Ee(y=>u.itemTextRefCallback?.(y,f.value,f.disabled)),g=ne(n,h,f.onItemTextChange,x),v=d?.textContent,m=c.useMemo(()=>i.jsx("option",{value:f.value,disabled:f.disabled,children:v},f.value),[f.disabled,f.value,v]),{onNativeOptionAdd:C,onNativeOptionRemove:b}=p;return oe(()=>(C(m),()=>b(m)),[C,b,m]),i.jsxs(i.Fragment,{children:[i.jsx(H.span,{id:f.textId,...a,ref:g}),f.isSelected&&l.valueNode&&!l.valueNodeHasChildren&&!kt(l.value)?Tt.createPortal(a.children,l.valueNode):null]})},"SelectItemText")),_d="SelectItemIndicator",Dd=c.forwardRef(Y(function(t,n){const{__scopeSelect:r,...o}=t;return ni(_d,r).isSelected?i.jsx(H.span,{"aria-hidden":!0,...o,ref:n}):null},"SelectItemIndicator")),kd="SelectBubbleInput",Md=c.forwardRef(Y(function({__scopeSelect:t,...n},r){const o=Je(kd,t),{value:s,onValueChange:a,required:l,disabled:u,name:f,autoComplete:p,form:d}=o,{nativeOptions:h,nativeSelectKey:x}=o,g=c.useRef(null),v=ne(r,g),m=s??"",C=Vs(m),b=Array.from(h).some(y=>(y.props.value??"")==="");return c.useEffect(()=>{const y=g.current;if(!y)return;const w=window.HTMLSelectElement.prototype,S=Object.getOwnPropertyDescriptor(w,"value").set;if(C!==m&&S){const P=new Event("change",{bubbles:!0});S.call(y,m),y.dispatchEvent(P)}},[C,m]),i.jsxs(H.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:f,autoComplete:p,disabled:u,form:d,onChange:y=>a(y.target.value),...n,style:{...wu,...n.style},ref:v,defaultValue:m,children:[kt(s)&&!b?i.jsx("option",{value:""}):null,Array.from(h)]},x)},"SelectBubbleInput"));function oi(e){return typeof e=="function"}Y(oi,"isFunction");function kt(e){return e===""||e===void 0}Y(kt,"shouldShowPlaceholder");function Or(e){const t=Ee(e),n=c.useRef(""),r=c.useRef(0),o=c.useCallback(a=>{const l=n.current+a;t(l),Y((function u(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}),"updateSearch")(l)},[t]),s=c.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return c.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}Y(Or,"useTypeaheadSearch");function _r(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=si(e,Math.max(s,0));o.length===1&&(a=a.filter(f=>f!==n));const u=a.find(f=>f.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}Y(_r,"findNextItem");function si(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Y(si,"wrapArray");const $d=md,Fd=gd,ii=c.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(Qs,{ref:r,className:Q("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-popover px-3 py-2 text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,i.jsx(xd,{asChild:!0,children:i.jsx($o,{className:"h-4 w-4 opacity-50"})})]}));ii.displayName=Qs.displayName;const ai=c.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>i.jsx(Cd,{children:i.jsx(ei,{ref:o,className:Q("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1",e),position:n,...r,children:i.jsx(Id,{className:Q("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));ai.displayName=ei.displayName;const en=c.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(ri,{ref:r,className:Q("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(Dd,{children:i.jsx(ba,{className:"h-4 w-4"})})}),i.jsx(Od,{children:t})]}));en.displayName=ri.displayName;var Ld=Object.defineProperty,Xe=(e,t)=>Ld(e,"name",{value:t,configurable:!0}),Dr="Switch",[Bd,tp]=Pe(Dr),[zd,kr]=Bd(Dr);function ci(e){const{__scopeSwitch:t,checked:n,children:r,defaultChecked:o,disabled:s,form:a,name:l,onCheckedChange:u,required:f,value:p="on",internal_do_not_use_render:d}=e,[h,x]=Ae({prop:n,defaultProp:o??!1,onChange:u,caller:Dr}),[g,v]=c.useState(null),[m,C]=c.useState(null),b=c.useRef(!1),[y,w]=c.useReducer(P=>P+1,0),R=g?!!a||!!g.closest("form"):!0,S={checked:h,setChecked:x,disabled:s,control:g,setControl:v,name:l,form:a,value:p,hasConsumerStoppedPropagationRef:b,userInteractionCount:y,onUserInteraction:w,required:f,defaultChecked:o,isFormControl:R,bubbleInput:m,setBubbleInput:C};return i.jsx(zd,{scope:t,...S,children:ui(d)?d(S):r})}Xe(ci,"SwitchProvider");var Vd="SwitchTrigger",Hd=c.forwardRef(Xe(function({__scopeSwitch:t,onClick:n,...r},o){const{control:s,form:a,value:l,disabled:u,checked:f,required:p,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:x,onUserInteraction:g,isFormControl:v,bubbleInput:m}=kr(Vd,t),C=ne(o,d),b=c.useRef(f);return c.useEffect(()=>{const y=a?s?.ownerDocument.getElementById(a):s?.form;if(y instanceof HTMLFormElement){const w=Xe(()=>h(b.current),"reset");return y.addEventListener("reset",w),()=>y.removeEventListener("reset",w)}},[s,a,h]),i.jsx(H.button,{type:"button",role:"switch","aria-checked":f,"aria-required":p,"data-state":Mr(f),"data-disabled":u?"":void 0,disabled:u,value:l,...r,ref:C,onClick:z(n,y=>{g(),h(w=>!w),m&&v&&(x.current=y.isPropagationStopped(),x.current||y.stopPropagation())})})},"SwitchTrigger")),li=c.forwardRef(Xe(function(t,n){const{__scopeSwitch:r,name:o,checked:s,defaultChecked:a,required:l,disabled:u,value:f,onCheckedChange:p,form:d,...h}=t;return i.jsx(ci,{__scopeSwitch:r,checked:s,defaultChecked:a,disabled:u,required:l,onCheckedChange:p,name:o,form:d,value:f,internal_do_not_use_render:({isFormControl:x})=>i.jsxs(i.Fragment,{children:[i.jsx(Hd,{...h,ref:n,__scopeSwitch:r}),x&&i.jsx(Gd,{__scopeSwitch:r})]})})},"Switch")),Ud="SwitchThumb",Wd=c.forwardRef(Xe(function(t,n){const{__scopeSwitch:r,...o}=t,s=kr(Ud,r);return i.jsx(H.span,{"data-state":Mr(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:n})},"SwitchThumb")),Kd="SwitchBubbleInput",Gd=c.forwardRef(Xe(function({__scopeSwitch:t,onClick:n,...r},o){const{control:s,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:u,defaultChecked:f,required:p,disabled:d,name:h,value:x,form:g,bubbleInput:v,setBubbleInput:m}=kr(Kd,t),C=ne(o,m),b=Nr(s),y=c.useRef(!1),w=c.useRef(u),R=c.useRef(l);c.useEffect(()=>{const P=v;if(!P)return;const I=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(I,"checked").set,_=l!==R.current;R.current=l;const T=w.current!==u;w.current=u;const D=!(_&&a.current);if(T&&A){y.current=!_;const $=new Event("click",{bubbles:D});A.call(P,u),P.dispatchEvent($),y.current=!1}},[v,u,a,l]);const S=c.useRef(u);return i.jsx(H.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??S.current,required:p,disabled:d,name:h,value:x,form:g,...r,tabIndex:-1,ref:C,onClick:z(n,P=>{y.current&&P.stopPropagation()}),style:{...r.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function ui(e){return typeof e=="function"}Xe(ui,"isFunction");function Mr(e){return e?"checked":"unchecked"}Xe(Mr,"getState");const tn=c.forwardRef(({className:e,...t},n)=>i.jsx(li,{className:Q("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:i.jsx(Wd,{className:Q("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));tn.displayName=li.displayName;function Yd({frozen:e,values:t,defaults:n,candidates:r,candidatesPort:o,selectedIconRef:s,uploadedIconUrl:a,iconAnalysis:l,iconComposition:u,iconComposeError:f,iconBackground:p,iconScale:d,onIconBackgroundChange:h,onIconScaleChange:x,selectedTrayRef:g,uploadedTrayUrl:v,selectedPort:m,targetDirExists:C,onPickIconCandidate:b,onUploadIcon:y,onClearIcon:w,onPickTray:R,onUploadTray:S,onClearTray:P,onPatch:I,onConfirm:N}){return i.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[i.jsx(Ua,{values:t,defaults:n,frozen:e,iconCandidates:r,iconCandidatesPort:o,uploadedIconUrl:a,selectedIconRef:s,iconAnalysis:l,iconComposition:u,iconComposeError:f,iconBackground:p,iconScale:d,onIconBackgroundChange:h,onIconScaleChange:x,onPickIconCandidate:b,onUploadIcon:y,onClearIcon:w,onPatch:I}),i.jsx(ds,{type:"multiple",className:"mt-4 border-t border-border pt-1",children:i.jsxs(vr,{value:"advanced",className:"border-b-0",children:[i.jsx(gr,{children:"高级选项"}),i.jsxs(xr,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[i.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[i.jsx(tn,{id:"showStartupTerminal",checked:t.showStartupTerminal,disabled:e,onCheckedChange:A=>I({showStartupTerminal:A})}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"showStartupTerminal",className:"text-foreground",children:"显示启动终端"}),i.jsxs("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:[i.jsx(nn,{className:"mr-0.5 inline size-3"}),"应用启动时打开独立终端窗口,实时显示命令的 PTY 输出(可交互)。"]})]})]}),i.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[i.jsx(tn,{id:"showAddressBar",checked:t.showAddressBar,disabled:e,onCheckedChange:A=>I({showAddressBar:A})}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"showAddressBar",className:"text-foreground",children:"显示地址栏"}),i.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"服务窗口顶部显示地址栏(Web Navigation API 管理导航)。"})]})]})]}),i.jsxs("div",{children:[i.jsx(fe,{children:"托盘图标"}),i.jsx("p",{className:"mb-1.5 mt-0.5 text-[11px] text-muted-foreground",children:"默认与应用图标一致;纯色候选适合系统托盘(macOS 模板风格)。"}),i.jsx(Wa,{candidates:r,port:o,disabled:e,selectedRef:g,uploadedUrl:v,includeVariants:!0,defaultLabel:"默认跟随应用图标",onPick:R,onUpload:S,onClear:P})]}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"pm",children:"包管理器"}),i.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] leading-relaxed text-muted-foreground",children:"仅为生成的应用安装依赖时使用的工具(决定 install 命令与锁文件形态),不影响应用本身的运行方式——生成的应用始终以 Node 启动。默认自动跟随你启动向导所用的包管理器,一般无需修改。"}),i.jsxs($d,{value:t.pm,disabled:e,onValueChange:A=>I({pm:A}),children:[i.jsx(ii,{id:"pm",className:"mt-0",children:i.jsx(Fd,{})}),i.jsxs(ai,{children:[i.jsx(en,{value:"npm",children:"npm"}),i.jsx(en,{value:"pnpm",children:"pnpm"}),i.jsx(en,{value:"bun",children:"bun"})]})]})]}),i.jsxs("div",{className:"rounded-lg border border-border p-3",children:[i.jsx(fe,{children:"生成位置"}),i.jsx("p",{className:"mt-1 font-mono text-[11px] break-all text-muted-foreground",children:n.targetDir||"~/.opentray/create/<应用名>"}),i.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-muted-foreground",children:"生成的项目默认落在 OpenTray 主目录下,同一命令重复创建会落到同一位置; 也可在启动向导时通过位置参数指定其他目录。"}),C?i.jsx("p",{className:"mt-2 text-[11px] font-medium text-amber-400",children:"目标目录已存在且非空——继续生成会失败,或开启下方强制覆盖。"}):null,i.jsxs("div",{className:"mt-3 flex items-start gap-3",children:[i.jsx(tn,{id:"force-overwrite",checked:t.force,disabled:e,onCheckedChange:A=>I({force:A})}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"force-overwrite",className:"text-foreground",children:"强制覆盖已存在的目录"}),i.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:"开启后将清空目标目录内的现有内容并重新生成(等同 --force)。请确认目录中没有你需要的文件。"})]})]})]})]})]})}),i.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[i.jsx(de,{onClick:N,disabled:e,children:"确定创建应用"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:m!==void 0?`已选服务 :${m}(点击状态栏服务可切换)`:"未运行也不影响:应用启动时会自行嗅探命令的监听端口"})]})]})}function qd({tags:e,onTagsChange:t,disabled:n=!1,placeholder:r,className:o,...s}){const[a,l]=c.useState(""),u=()=>{a.length!==0&&(t([...e,a]),l(""))};return i.jsxs("div",{className:Q("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((f,p)=>i.jsxs("span",{className:"flex items-center gap-1 rounded bg-accent px-1.5 py-0.5 text-accent-foreground",children:[i.jsx("span",{className:"max-w-56 truncate",title:f,children:f}),n?null:i.jsx("button",{type:"button","aria-label":`移除参数 ${p+1}`,className:"text-muted-foreground hover:text-foreground",onClick:()=>{t(e.filter((d,h)=>h!==p))},children:i.jsx(Lo,{className:"size-3"})})]},`${p}:${f}`)),i.jsx("input",{className:"min-w-24 flex-1 bg-transparent font-mono text-xs outline-none placeholder:text-muted-foreground",value:a,disabled:n,placeholder:r??(e.length===0?"程序(如 npx)":"参数,回车添加"),onChange:f=>l(f.target.value),onKeyDown:f=>{if(f.key==="Enter"){f.preventDefault(),u();return}f.key==="Backspace"&&a.length===0&&e.length>0&&(f.preventDefault(),t(e.slice(0,-1)))},onBlur:u,...s})]})}function Xd({command:e,onCommandChange:t,argv:n,onArgvChange:r,runAlive:o,frozen:s,failedReason:a,commandOptions:l,defaultCwd:u,onCommandOptionsChange:f,onRun:p,onStop:d}){const h=x=>{f({...l,...x})};return i.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[i.jsxs("div",{className:"flex gap-2",children:[l.argsMode==="array"?i.jsx(qd,{tags:n,onTagsChange:r,disabled:o,"aria-label":"命令参数(argv)"}):i.jsx(et,{className:"font-mono",placeholder:"npx somecommand start --xx",value:e,disabled:o,onChange:x=>t(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!o&&p()}}),o?i.jsxs(de,{variant:"destructive",onClick:d,"aria-label":"中断命令",children:[i.jsx(Aa,{}),"中断"]}):i.jsxs(de,{disabled:s,onClick:p,"aria-label":"运行命令",children:[i.jsx(Pa,{}),"运行"]})]}),a!==void 0?i.jsx("p",{className:"mt-2 font-mono text-xs text-red-400",children:a}):null,i.jsx(ds,{type:"multiple",defaultValue:["command"],className:"mt-3 border-t border-border pt-1",children:i.jsxs(vr,{value:"command",className:"border-b-0",children:[i.jsx(gr,{children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Na,{className:"size-4 text-muted-foreground"}),"命令选项"]})}),i.jsxs(xr,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[i.jsxs("div",{children:[i.jsx(fe,{children:"参数输入模式"}),i.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"数组模式逐个输入参数(回车添加),原样传递、绝不拆分。"}),i.jsxs("div",{className:"flex gap-1.5",children:[i.jsx(de,{type:"button",size:"sm",variant:l.argsMode==="string"?"default":"outline",disabled:s,onClick:()=>h({argsMode:"string"}),children:"字符串"}),i.jsx(de,{type:"button",size:"sm",variant:l.argsMode==="array"?"default":"outline",disabled:s,onClick:()=>h({argsMode:"array"}),children:"数组 (argv)"})]})]}),i.jsxs("div",{children:[i.jsx(fe,{htmlFor:"cmd-cwd",children:"工作目录 (cwd)"}),i.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"留空使用用户主目录(下方完整路径);相对路径按主目录解析。"}),i.jsx(et,{id:"cmd-cwd",className:"mt-0 font-mono text-xs",disabled:s,value:l.cwd,placeholder:u.length>0?`默认:${u}`:"默认:用户主目录",title:u,onChange:x=>h({cwd:x.target.value})}),u.length>0&&l.cwd.trim().length===0?i.jsx("p",{className:"mt-1 font-mono text-[11px] break-all text-muted-foreground",children:u}):null]})]}),i.jsxs("div",{children:[i.jsx(fe,{children:"环境变量 (env)"}),i.jsx("p",{className:"mt-0.5 mb-1.5 text-[11px] text-muted-foreground",children:"启动命令时叠加在当前环境之上;同时写入生成的应用。"}),i.jsxs("div",{className:"space-y-1.5",children:[l.env.length===0?i.jsx("p",{className:"text-xs text-muted-foreground",children:"未配置"}):l.env.map((x,g)=>i.jsxs("div",{className:"flex gap-1.5",children:[i.jsx(et,{className:"font-mono text-xs",disabled:s,"aria-label":`env 名称 ${g+1}`,value:x.key,placeholder:"NAME",onChange:v=>{const m=[...l.env];m[g]={...x,key:v.target.value},h({env:m})}}),i.jsx(et,{className:"font-mono text-xs",disabled:s,"aria-label":`env 值 ${g+1}`,value:x.value,placeholder:"value",onChange:v=>{const m=[...l.env];m[g]={...x,value:v.target.value},h({env:m})}}),i.jsx(de,{type:"button",variant:"ghost",size:"iconSm",disabled:s,"aria-label":"删除环境变量",onClick:()=>{h({env:l.env.filter((v,m)=>m!==g)})},children:"×"})]},g)),i.jsxs(de,{type:"button",variant:"outline",size:"sm",disabled:s,onClick:()=>h({env:[...l.env,{key:"",value:""}]}),children:[i.jsx(nn,{className:"size-3.5"}),"添加变量"]})]})]})]})]})})]})}var Zd=Object.defineProperty,Se=(e,t)=>Zd(e,"name",{value:t,configurable:!0}),$r="Dialog",[di,np]=Pe($r),[Jd,ke]=di($r),Qd=Se(e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,l=c.useRef(null),u=c.useRef(null),[f,p]=Ae({prop:r,defaultProp:o??!1,onChange:s,caller:$r}),[d,h]=c.useState(0),[x,g]=c.useState(0);return i.jsx(Jd,{scope:t,triggerRef:l,contentRef:u,contentId:Ie(),titleId:Ie(),descriptionId:Ie(),titlePresent:d>0,descriptionPresent:x>0,setTitleCount:h,setDescriptionCount:g,open:f,onOpenChange:p,onOpenToggle:c.useCallback(()=>p(v=>!v),[p]),modal:a,children:n})},"Dialog"),fi="DialogPortal",[ef,pi]=di(fi,{forceMount:void 0}),tf=Se(e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=ke(fi,t);return i.jsx(ef,{scope:t,forceMount:n,children:c.Children.map(r,a=>i.jsx(xt,{present:n||s.open,children:i.jsx(zs,{asChild:!0,container:o,children:a})}))})},"DialogPortal"),rr="DialogOverlay",mi=c.forwardRef(Se(function(t,n){const r=pi(rr,t.__scopeDialog),{forceMount:o=r.forceMount,...s}=t,a=ke(rr,t.__scopeDialog);return a.modal?i.jsx(xt,{present:o||a.open,children:i.jsx(rf,{...s,ref:n})}):null},"DialogOverlay")),nf=tt("DialogOverlay.RemoveScroll"),rf=c.forwardRef(Se(function(t,n){const{__scopeDialog:r,...o}=t,s=ke(rr,r),a=ms(),l=ne(n,a);return i.jsx(Ir,{as:nf,allowPinchZoom:!0,shards:[s.contentRef],children:i.jsx(H.div,{"data-state":Fr(s.open),...o,ref:l,style:{pointerEvents:"auto",...o.style}})})},"DialogOverlayImpl")),It="DialogContent",hi=c.forwardRef(Se(function(t,n){const r=pi(It,t.__scopeDialog),{forceMount:o=r.forceMount,...s}=t,a=ke(It,t.__scopeDialog);return i.jsx(xt,{present:o||a.open,children:a.modal?i.jsx(of,{...s,ref:n}):i.jsx(sf,{...s,ref:n})})},"DialogContent")),of=c.forwardRef(Se(function(t,n){const r=ke(It,t.__scopeDialog),o=c.useRef(null),s=ne(n,r.contentRef,o);return c.useEffect(()=>{const a=o.current;if(a)return Us(a)},[]),i.jsx(vi,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:z(t.onCloseAutoFocus,a=>{a.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:z(t.onPointerDownOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&a.preventDefault()}),onFocusOutside:z(t.onFocusOutside,a=>a.preventDefault())})},"DialogContentModal")),sf=c.forwardRef(Se(function(t,n){const r=ke(It,t.__scopeDialog),o=c.useRef(!1),s=c.useRef(!1);return i.jsx(vi,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{t.onCloseAutoFocus?.(a),a.defaultPrevented||(o.current||r.triggerRef.current?.focus(),a.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:a=>{t.onInteractOutside?.(a),a.defaultPrevented||(o.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;r.triggerRef.current?.contains(l)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})},"DialogContentNonModal")),vi=c.forwardRef(Se(function(t,n){const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:a,...l}=t,u=ke(It,r);return fn(),i.jsx(i.Fragment,{children:i.jsx(gs,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:a,children:i.jsx(ps,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionPresent?u.descriptionId:void 0,"aria-labelledby":u.titlePresent?u.titleId:void 0,"data-state":Fr(u.open),...l,ref:n,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1)})})})},"DialogContentImpl")),af="DialogTitle",gi=c.forwardRef(Se(function(t,n){const{__scopeDialog:r,...o}=t,s=ke(af,r),{setTitleCount:a}=s;return oe(()=>(a(l=>l+1),()=>a(l=>l-1)),[a]),i.jsx(H.h2,{id:s.titleId,...o,ref:n})},"DialogTitle")),cf="DialogDescription",xi=c.forwardRef(Se(function(t,n){const{__scopeDialog:r,...o}=t,s=ke(cf,r),{setDescriptionCount:a}=s;return oe(()=>(a(l=>l+1),()=>a(l=>l-1)),[a]),i.jsx(H.p,{id:s.descriptionId,...o,ref:n})},"DialogDescription")),lf="DialogClose",uf=c.forwardRef(Se(function(t,n){const{__scopeDialog:r,...o}=t,s=ke(lf,r);return i.jsx(H.button,{type:"button",...o,ref:n,onClick:z(t.onClick,()=>s.onOpenChange(!1))})},"DialogClose"));function Fr(e){return e?"open":"closed"}Se(Fr,"getState");const df=Qd,ff=tf,bi=c.forwardRef(({className:e,...t},n)=>i.jsx(mi,{ref:n,className:Q("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out",e),...t}));bi.displayName=mi.displayName;const yi=c.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(ff,{children:[i.jsx(bi,{}),i.jsxs(hi,{ref:r,className:Q("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border border-border bg-card p-6 shadow-lg rounded-xl",e),...n,children:[t,i.jsxs(uf,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none",children:[i.jsx(Lo,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));yi.displayName=hi.displayName;const Et=({className:e,...t})=>i.jsx("div",{className:Q("flex flex-col space-y-1.5 text-left",e),...t});Et.displayName="DialogHeader";const Pt=c.forwardRef(({className:e,...t},n)=>i.jsx(gi,{ref:n,className:Q("text-lg font-semibold leading-none tracking-tight",e),...t}));Pt.displayName=gi.displayName;const wi=c.forwardRef(({className:e,...t},n)=>i.jsx(xi,{ref:n,className:Q("text-sm text-muted-foreground",e),...t}));wi.displayName=xi.displayName;const Bn=["scaffold","icon","install","launch","bundle"];function pf({open:e,phase:t,frozenValues:n,iconSrc:r,iconLabel:o,traySrc:s,trayLabel:a,selectedPort:l,currentStep:u,logs:f,error:p,result:d,onBack:h,onCreate:x,onOpenApp:g,onClose:v,confirmError:m,onOpenChange:C}){const b=c.useRef(null);c.useEffect(()=>{b.current?.scrollTo({top:b.current.scrollHeight})},[f.length]);const y=w=>{const R=Bn.indexOf(w),S=Bn.indexOf(u);return t==="success"||R<S?"done":R===S?"active":""};return i.jsx(df,{open:e,onOpenChange:w=>{t==="pending"&&w===!1||C(w)},children:i.jsx(yi,{className:"max-w-xl",children:t==="confirm"?i.jsxs(i.Fragment,{children:[i.jsxs(Et,{children:[i.jsx(Pt,{children:"确认应用信息"}),i.jsx(wi,{children:"表单已固定,以下值将用于生成应用。"})]}),i.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-sm",children:[i.jsx("dt",{className:"text-muted-foreground",children:"App ID"}),i.jsx("dd",{className:"font-mono break-all",children:n.appId}),i.jsx("dt",{className:"text-muted-foreground",children:"应用名称"}),i.jsx("dd",{className:"break-all",children:n.appName}),i.jsx("dt",{className:"text-muted-foreground",children:"图标"}),i.jsxs("dd",{className:"flex flex-wrap items-center gap-4",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"icon-checker flex size-10 items-center justify-center overflow-hidden rounded-md","aria-label":"应用图标预览",children:r!==void 0?i.jsx("img",{src:r,alt:"应用图标",className:"size-full object-contain"}):i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"无"})}),i.jsxs("span",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs leading-tight",children:"应用图标"}),i.jsx("span",{className:"font-mono text-[10px] leading-tight text-muted-foreground",children:o})]})]}),i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"icon-checker flex size-10 items-center justify-center overflow-hidden rounded-md","aria-label":"托盘图标预览",children:s!==void 0?i.jsx("img",{src:s,alt:"托盘图标",className:"size-full object-contain"}):i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"文字"})}),i.jsxs("span",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs leading-tight",children:"托盘图标"}),i.jsx("span",{className:"font-mono text-[10px] leading-tight text-muted-foreground",children:a})]})]})]}),i.jsx("dt",{className:"text-muted-foreground",children:"服务端口"}),i.jsx("dd",{className:"font-mono",children:l!==void 0?`:${l}(生成后运行时重新嗅探)`:"运行时嗅探"}),i.jsx("dt",{className:"text-muted-foreground",children:"包管理器"}),i.jsx("dd",{children:n.pm})]}),m!==void 0?i.jsx("p",{className:"text-xs font-medium text-red-400",children:m}):null,i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(de,{variant:"outline",onClick:h,children:"返回修改"}),i.jsx(de,{onClick:x,children:"确认生成"})]})]}):t==="pending"?i.jsxs(i.Fragment,{children:[i.jsx(Et,{children:i.jsx(Pt,{children:"正在生成应用…"})}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:Bn.map(w=>i.jsx(ar,{variant:y(w)==="done"?"success":y(w)==="active"?"warning":"secondary",children:w},w))}),i.jsx("div",{ref:b,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:f.join(`
|
|
42
|
-
`)})]}):t==="success"&&d!==void 0?i.jsxs(i.Fragment,{children:[i.jsx(Et,{children:i.jsxs(Pt,{className:"flex items-center gap-2",children:[i.jsx(Ca,{className:"size-5 text-emerald-400"}),"应用已生成"]})}),i.jsxs("dl",{className:"grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-sm",children:[i.jsx("dt",{className:"text-muted-foreground",children:"项目目录"}),i.jsx("dd",{className:"font-mono break-all",children:d.projectDir}),d.bundlePath?i.jsxs(i.Fragment,{children:[i.jsx("dt",{className:"text-muted-foreground",children:"macOS Bundle"}),i.jsx("dd",{className:"font-mono break-all",children:d.bundlePath})]}):null]}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(de,{variant:"outline",onClick:v,children:"完成"}),i.jsxs(de,{onClick:g,children:[i.jsx(Ra,{}),"打开应用"]})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:d.pinHint})]}):i.jsxs(i.Fragment,{children:[i.jsx(Et,{children:i.jsxs(Pt,{className:"flex items-center gap-2",children:[i.jsx(Oa,{className:"size-5 text-red-400"}),"生成失败"]})}),i.jsx("p",{className:"break-all font-mono text-xs text-red-400",children:p??"未知错误"}),i.jsx("div",{className:"flex justify-end",children:i.jsx(de,{variant:"outline",onClick:h,children:"返回重试"})})]})})})}const ko=(e,t)=>{const n=c.useRef(e);n.current=e;const r=c.useRef(void 0),o=c.useRef(void 0),s=c.useCallback(()=>{r.current!==void 0&&(clearTimeout(r.current),r.current=void 0);const p=o.current;o.current=void 0,p!==void 0&&n.current(...p)},[]),a=c.useCallback(()=>{r.current!==void 0&&(clearTimeout(r.current),r.current=void 0),o.current=void 0},[]),l=c.useCallback((...p)=>{o.current=p,r.current!==void 0&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=void 0;const d=o.current;o.current=void 0,d!==void 0&&n.current(...d)},t)},[t]);c.useEffect(()=>s,[s]);const u=c.useRef(l);u.current=l;const f=c.useCallback((...p)=>{u.current(...p)},[]);return f.flush=s,f.cancel=a,f};var mf=Object.defineProperty,Lr=(e,t)=>mf(e,"name",{value:t,configurable:!0}),zn=!1;function Ci(){const[e,t]=c.useState(zn);return c.useEffect(()=>{zn||(zn=!0,t(!0))},[]),e}Lr(Ci,"useIsHydrated");var Si=At[" useSyncExternalStore ".trim().toString()];function Ri(){return()=>{}}Lr(Ri,"subscribe");function Ei(){return Si(Ri,()=>!0,()=>!1)}Lr(Ei,"useIsHydratedModern");var hf=typeof Si=="function"?Ei:Ci,vf=Object.defineProperty,it=(e,t)=>vf(e,"name",{value:t,configurable:!0}),Vn="rovingFocusGroup.onEntryFocus",gf={bubbles:!1,cancelable:!0},Cn="RovingFocusGroup",[or,Pi,xf]=cn(Cn),[bf,ji]=Pe(Cn,[xf]),[yf,wf]=bf(Cn),Cf=c.forwardRef(it(function(t,n){return i.jsx(or.Provider,{scope:t.__scopeRovingFocusGroup,children:i.jsx(or.Slot,{scope:t.__scopeRovingFocusGroup,children:i.jsx(Sf,{...t,ref:n})})})},"RovingFocusGroup")),Sf=c.forwardRef(it(function(t,n){const{__scopeRovingFocusGroup:r,orientation:o,loop:s=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:f,onEntryFocus:p,preventScrollOnEntryFocus:d=!1,...h}=t,x=c.useRef(null),g=ne(n,x),v=Dt(a),[m,C]=Ae({prop:l,defaultProp:u??null,onChange:f,caller:Cn}),[b,y]=c.useState(!1),w=Ee(p),R=Pi(r),S=c.useRef(!1),[P,I]=c.useState(0);return c.useEffect(()=>{const N=x.current;if(N)return N.addEventListener(Vn,w),()=>N.removeEventListener(Vn,w)},[w]),i.jsx(yf,{scope:r,orientation:o,dir:v,loop:s,currentTabStopId:m,onItemFocus:c.useCallback(N=>C(N),[C]),onItemShiftTab:c.useCallback(()=>y(!0),[]),onFocusableItemAdd:c.useCallback(()=>I(N=>N+1),[]),onFocusableItemRemove:c.useCallback(()=>I(N=>N-1),[]),children:i.jsx(H.div,{tabIndex:b||P===0?-1:0,"data-orientation":o,...h,ref:g,style:{outline:"none",...t.style},onMouseDown:z(t.onMouseDown,()=>{S.current=!0}),onFocus:z(t.onFocus,N=>{const A=!S.current;if(N.target===N.currentTarget&&A&&!b){const _=new CustomEvent(Vn,gf);if(N.currentTarget.dispatchEvent(_),!_.defaultPrevented){const T=R().filter(k=>k.focusable),D=T.find(k=>k.active),$=T.find(k=>k.id===m),L=[D,$,...T].filter(Boolean).map(k=>k.ref.current);Br(L,d)}}S.current=!1}),onBlur:z(t.onBlur,()=>y(!1))})})},"RovingFocusGroupImpl")),Rf="RovingFocusGroupItem",Ef=c.forwardRef(it(function(t,n){const{__scopeRovingFocusGroup:r,focusable:o=!0,active:s=!1,tabStopId:a,children:l,...u}=t,f=Ie(),p=a||f,d=wf(Rf,r),h=d.currentTabStopId===p,x=Pi(r),{onFocusableItemAdd:g,onFocusableItemRemove:v,currentTabStopId:m}=d,C=hf();return oe(()=>{if(!(!C||!o))return g(),()=>v()},[C,o,g,v]),c.useEffect(()=>{if(!(C||!o))return g(),()=>v()},[C,o,g,v]),i.jsx(or.ItemSlot,{scope:r,id:p,focusable:o,active:s,children:i.jsx(H.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...u,ref:n,onMouseDown:z(t.onMouseDown,b=>{o?d.onItemFocus(p):b.preventDefault()}),onFocus:z(t.onFocus,()=>d.onItemFocus(p)),onKeyDown:z(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){d.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const y=Ii(b,d.orientation,d.dir);if(y!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let R=x().filter(S=>S.focusable).map(S=>S.ref.current);if(y==="last")R.reverse();else if(y==="prev"||y==="next"){y==="prev"&&R.reverse();const S=R.indexOf(b.currentTarget);R=d.loop?Ai(R,S+1):R.slice(S+1)}setTimeout(()=>Br(R))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:m!=null}):l})})},"RovingFocusGroupItem")),Pf={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ni(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}it(Ni,"getDirectionAwareKey");function Ii(e,t,n){const r=Ni(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Pf[r]}it(Ii,"getFocusIntent");function Br(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}it(Br,"focusFirst");function Ai(e,t){return e.map((n,r)=>e[(t+r)%e.length])}it(Ai,"wrapArray");var jf=Cf,Nf=Ef,If=Object.defineProperty,wt=(e,t)=>If(e,"name",{value:t,configurable:!0}),zr="Tabs",[Af,rp]=Pe(zr,[ji]),Ti=ji(),[Tf,Vr]=Af(zr),Of=c.forwardRef(wt(function(t,n){const{__scopeTabs:r,value:o,onValueChange:s,defaultValue:a,orientation:l="horizontal",dir:u,activationMode:f="automatic",...p}=t,d=Dt(u),[h,x]=Ae({prop:o,onChange:s,defaultProp:a??"",caller:zr});return i.jsx(Tf,{scope:r,baseId:Ie(),value:h,onValueChange:x,orientation:l,dir:d,activationMode:f,children:i.jsx(H.div,{dir:d,"data-orientation":l,...p,ref:n})})},"Tabs")),_f="TabsList",Df=c.forwardRef(wt(function(t,n){const{__scopeTabs:r,loop:o=!0,...s}=t,a=Vr(_f,r),l=Ti(r);return i.jsx(jf,{asChild:!0,...l,orientation:a.orientation,dir:a.dir,loop:o,children:i.jsx(H.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:n})})},"TabsList")),kf="TabsTrigger",Mf=c.forwardRef(wt(function(t,n){const{__scopeTabs:r,value:o,disabled:s=!1,...a}=t,l=Vr(kf,r),u=Ti(r),f=Hr(l.baseId,o),p=Ur(l.baseId,o),d=o===l.value;return i.jsx(Nf,{asChild:!0,...u,focusable:!s,active:d,children:i.jsx(H.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":p,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:f,...a,ref:n,onMouseDown:z(t.onMouseDown,h=>{!s&&h.button===0&&h.ctrlKey===!1?l.onValueChange(o):h.preventDefault()}),onKeyDown:z(t.onKeyDown,h=>{s||h.target!==h.currentTarget||[" ","Enter"].includes(h.key)&&l.onValueChange(o)}),onFocus:z(t.onFocus,()=>{const h=l.activationMode!=="manual";!d&&!s&&h&&l.onValueChange(o)})})})},"TabsTrigger")),$f="TabsContent",Ff=c.forwardRef(wt(function(t,n){const{__scopeTabs:r,value:o,forceMount:s,children:a,...l}=t,u=Vr($f,r),f=Hr(u.baseId,o),p=Ur(u.baseId,o),d=o===u.value,h=c.useRef(d);return c.useEffect(()=>{const x=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(x)},[]),i.jsx(xt,{present:s||d,children:({present:x})=>i.jsx(H.div,{"data-state":d?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":f,hidden:!x,id:p,tabIndex:0,...l,ref:n,style:{...t.style,animationDuration:h.current?"0s":void 0},children:x&&a})})},"TabsContent"));function Hr(e,t){return`${e}-trigger-${t}`}wt(Hr,"makeTriggerId");function Ur(e,t){return`${e}-content-${t}`}wt(Ur,"makeContentId");var Lf=Of,Oi=Df,_i=Mf,Di=Ff;const Bf=Lf,ki=c.forwardRef(({className:e,...t},n)=>i.jsx(Oi,{ref:n,className:Q("inline-flex h-9 items-center justify-start gap-1 rounded-t-lg bg-muted/50 p-1 text-muted-foreground w-full overflow-x-auto",e),...t}));ki.displayName=Oi.displayName;const sr=c.forwardRef(({className:e,...t},n)=>i.jsx(_i,{ref:n,className:Q("inline-flex items-center gap-1.5 whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));sr.displayName=_i.displayName;const ir=c.forwardRef(({className:e,...t},n)=>i.jsx(Di,{ref:n,className:Q("mt-2 ring-offset-background focus-visible:outline-none",e),...t}));ir.displayName=Di.displayName;const zf=e=>{const t=e.trim();if(t.length!==0)try{return new URL(/^https?:\/\//iu.test(t)?t:`http://${t}`).href}catch{return}};function Vf({command:e,terminalHostRef:t,terminalReady:n,interactive:r,status:o,services:s,iframeTabs:a,activeTab:l,onActiveTabChange:u,onIframeNavigate:f,onIframeHistoryMove:p,onJumpToService:d,className:h}){const x=a.find(b=>`svc-${b.port}`===l),[g,v]=c.useState("");c.useEffect(()=>{v(x?.url??"")},[x?.url,l]);const m=x!==void 0&&x.historyIndex>0,C=x!==void 0&&x.historyIndex<x.history.length-1;return i.jsxs("div",{className:Q("flex flex-col rounded-xl border border-border bg-card overflow-hidden",h),children:[i.jsxs(Bf,{value:l,onValueChange:u,className:"flex min-h-0 flex-1 flex-col",children:[i.jsxs(ki,{children:[i.jsxs(sr,{value:"terminal",children:[i.jsx(nn,{className:"size-3.5"}),"终端",!r&&n?i.jsx("span",{className:"text-[10px] text-amber-400",children:"非交互"}):null]}),a.map(b=>i.jsxs(sr,{value:`svc-${b.port}`,children:[i.jsx(co,{className:"size-3.5"}),Ha(b.url),":",new URL(b.url).port]},b.port))]}),i.jsx("div",{className:"flex h-11 items-center gap-2 border-y border-border px-3",children:x===void 0?i.jsxs(i.Fragment,{children:[i.jsx(nn,{className:"size-4 shrink-0 text-muted-foreground"}),i.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",children:e||"尚未运行命令"})]}):i.jsxs(i.Fragment,{children:[i.jsx(de,{variant:"ghost",size:"iconSm",disabled:!m,onClick:()=>p(x.port,-1),"aria-label":"后退",children:i.jsx(pa,{})}),i.jsx(de,{variant:"ghost",size:"iconSm",disabled:!C,onClick:()=>p(x.port,1),"aria-label":"前进",children:i.jsx(ma,{})}),i.jsx(de,{variant:"ghost",size:"iconSm",onClick:()=>f(x.port,x.url,"replace"),"aria-label":"重新加载",children:i.jsx(ha,{})}),i.jsx(co,{className:"size-4 shrink-0 text-muted-foreground"}),i.jsx(et,{className:"h-7 font-mono text-xs",value:g,placeholder:"输入 URL 跳转",onChange:b=>v(b.target.value),onKeyDown:b=>{if(b.key!=="Enter")return;const y=zf(g);y!==void 0&&f(x.port,y,"push")}})]})}),i.jsxs(ir,{value:"terminal",forceMount:!0,className:"mt-0 min-h-0 flex-1",style:{display:l==="terminal"?"flex":"none",flexDirection:"column"},children:[i.jsx("div",{ref:t,className:"min-h-0 min-w-0 flex-1 bg-[#05070b] px-1"}),n?null:i.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"正在加载终端渲染器…"})]}),a.map(b=>i.jsx(ir,{value:`svc-${b.port}`,forceMount:!0,className:"mt-0 min-h-0 flex-1",style:{display:l===`svc-${b.port}`?"flex":"none",flexDirection:"column"},children:i.jsx("iframe",{title:`service-${b.port}`,src:b.url,className:"min-h-0 w-full flex-1 border-0 bg-white",sandbox:"allow-same-origin allow-scripts allow-forms"})},b.port))]}),i.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-3 overflow-x-auto border-t border-border px-3 text-[11px] text-muted-foreground",children:[i.jsxs("span",{className:"font-mono whitespace-nowrap",children:["光标 ",o.cursorY,":",o.cursorX]}),i.jsxs("span",{className:"font-mono whitespace-nowrap",children:[o.cols,"×",o.rows]}),i.jsx("span",{className:"font-mono whitespace-nowrap",children:o.selection===void 0?"无选区":`选区 ${o.selection.start.y}:${o.selection.start.x} – ${o.selection.end.y}:${o.selection.end.x}`}),i.jsx("span",{className:"h-3 w-px bg-border"}),s.length===0?i.jsx("span",{children:"嗅探 HTTP 服务中…(未发现不影响创建应用)"}):s.map(b=>i.jsxs(ar,{variant:l===`svc-${b.port}`?"default":"secondary",className:"cursor-pointer font-mono whitespace-nowrap",onClick:()=>d(b.port),children:[":",b.port,b.title?` · ${b.title}`:""]},b.port))]})]})}const Mo={appId:"",appName:"",iconPath:"",iconBackground:"transparent",iconScale:.8,trayIconPath:"",force:!1,pm:"npm",showStartupTerminal:!1,showAddressBar:!1},Hf={appId:"",appName:"",targetDir:"",iconPath:""};function Uf(){const[e,t]=c.useState(""),[n,r]=c.useState([]),[o,s]=c.useState(za),[a,l]=c.useState(""),[u,f]=c.useState(!1),[p,d]=c.useState(!1),[h,x]=c.useState(!1),[g,v]=c.useState("idle"),[m,C]=c.useState(),[b,y]=c.useState(""),[w,R]=c.useState(!0),[S,P]=c.useState(!1),[I,N]=c.useState(),[A,_]=c.useState(Mo),[T,D]=c.useState(Hf),[$,K]=c.useState([]),[L,k]=c.useState(),[F,U]=c.useState(!1),[V,we]=c.useState([]),[G,ae]=c.useState(),[me,he]=c.useState(),[We,ve]=c.useState(),[M,q]=c.useState(),[ee,W]=c.useState(),[X,te]=c.useState("transparent"),[xe,le]=c.useState(.8),Me=c.useRef(void 0),Ke=c.useRef(void 0),at=c.useRef(!1),Wr=c.useRef(!1),[Mt,$t]=c.useState(),[Sn,Ct]=c.useState(),[Ft,Lt]=c.useState(),[Mi,Bt]=c.useState("terminal"),[Kr,zt]=c.useState([]),[$i,Fi]=c.useState({cursorX:0,cursorY:0,cols:0,rows:0}),[Rn,St]=c.useState(!1),[Li,Rt]=c.useState("confirm"),[Bi,En]=c.useState([]),[zi,Vi]=c.useState(""),[Hi,Ui]=c.useState(),[Wi,Ki]=c.useState(),[Gi,Yi]=c.useState(Mo),Gr=c.useRef(null),$e=c.useRef(void 0),Vt=c.useRef([]),Yr=c.useRef(A);Yr.current=A;const qr=c.useRef(g);qr.current=g;const Xr=(E,B,j)=>{if(B===void 0)return!1;const O=Number.parseInt(B.split(":")[1]??"",10);return!E.some(Z=>Z.index===O)||B.split(":")[0]!==String(j)},Pn=c.useRef(void 0);c.useEffect(()=>{const E=A.iconPath.trim().length>0?A.iconPath.trim():T.iconPath.trim().length>0?T.iconPath.trim():void 0;if(Pn.current=E,E===void 0){ve(void 0),W(void 0),Me.current=void 0;return}E===Me.current&&ee!==void 0||(async()=>{try{q(void 0);const B=await J("/api/icon-analyze",{path:E});if(!B.ok)throw new Error("analyze failed");const j=await B.json();if(Pn.current!==E)return;ve(j),at.current=!1,te(j.suggested),J("/api/form",{iconBackground:j.suggested});const O=await J("/api/icon-compose",{foregroundPath:E,background:j.suggested,scale:xe});if(!O.ok)throw new Error("compose failed");const Z=await O.json();if(Pn.current!==E)return;W(Z),Me.current=E}catch{ve(void 0),W(void 0),q("图标分析或合成失败,预览不可用")}})()},[A.iconPath,T.iconPath]);const Zr=ko(E=>{J("/api/form",{iconScale:E});const B=Qr();eo(B,X,E)},250),qi=E=>{le(E),Zr(E)},Jr=ko(E=>{J("/api/form",{iconBackground:E});const B=Qr();eo(B,E,xe)},120),Xi=E=>{at.current=!0,te(E),Jr(E)},Qr=()=>A.iconPath.trim().length>0?A.iconPath.trim():T.iconPath.trim().length>0?T.iconPath.trim():void 0,eo=c.useCallback(async(E,B,j)=>{if(E===void 0){ve(void 0),W(void 0),Me.current=void 0,Ke.current=void 0;return}Ke.current=E;try{const O=await J("/api/icon-analyze",{path:E});if(!O.ok)throw new Error("analyze failed");const Z=await O.json();if(Ke.current!==E)return;ve(Z);const ue=await J("/api/icon-compose",{foregroundPath:E,background:B,scale:j});if(!ue.ok)throw new Error("compose failed");const Fe=await ue.json();if(Ke.current!==E)return;W(Fe),Me.current=E}catch{ve(void 0),W(void 0),q("图标合成失败,预览未更新")}},[]);c.useEffect(()=>{va()},[]),c.useEffect(()=>{if(!p)return;let E=!1;return(async()=>{const B=Gr.current;if(B===null)return;const j=await ga(B);if(E||j===void 0){E||N("ghostty-web 加载失败,输出将以纯文本显示");return}$e.current=j,P(!0);const O=Vt.current;Vt.current=[];for(const ue of O)j.write(ue);j.onData(ue=>{to.current&&J("/api/terminal-input",{data:ue})}),j.onResize(({cols:ue,rows:Fe})=>{J("/api/terminal-resize",{cols:ue,rows:Fe})});const Z=window.setInterval(()=>{if(!(qr.current==="idle"&&!$e.current))try{Fi(j.readState())}catch{}},300);return()=>window.clearInterval(Z)})(),()=>{E=!0,$e.current?.dispose(),$e.current=void 0}},[p]);const to=c.useRef(!0);c.useEffect(()=>{to.current=w},[w]),c.useEffect(()=>{const E=Va();return E.onmessage=B=>{const j=JSON.parse(B.data);switch(j.type){case"state":v(j.state),j.state==="failed"&&C(j.reason),j.state==="frozen"&&(Rt("confirm"),St(!0)),j.state==="materializing"&&(Rt("pending"),En([])),j.state==="success"&&Rt("success"),j.state==="failed"&&ro.current&&(Rt("failed"),Ui(j.reason));break;case"log":{$e.current!==void 0?$e.current.write(j.chunk):no.current!==void 0?N(O=>(O??"")+j.chunk):Vt.current.push(j.chunk);break}case"term-mode":if(R(j.interactive),!j.interactive&&j.message!==void 0){const O=`\x1B[33m${j.message}\x1B[0m\r
|
|
43
|
-
`;$e.current!==void 0?$e.current.write(O):Vt.current.push(O)}break;case"run-status":x(j.running);break;case"command-display":y(j.command);break;case"command-options":s(j.options),l(j.defaultCwd);break;case"services":{K(j.services),k(j.selectedPort),zt(O=>{const Z=[...O];let ue;for(const Fe of j.services)Z.find(la=>la.port===Fe.port)===void 0&&(Z.push({port:Fe.port,url:Fe.url,history:[Fe.url],historyIndex:0}),ue=Fe.port);return ue!==void 0&&Bt(`svc-${ue}`),Z});break}case"icons":we(j.icons),ae(j.port),Xr(j.icons,me,j.port)&&he(void 0),Xr(j.icons,Sn,j.port)&&Ct(void 0);break;case"scrape":U(j.hasIcon);break;case"form":_(j.values),D(j.defaults),f(j.targetDirExists),Wr.current||(Wr.current=!0,te(j.values.iconBackground),le(j.values.iconScale));break;case"materialize-step":Vi(j.step),En(O=>[...O,`[${j.step}] ${j.message}`]);break;case"materialize-log":En(O=>[...O,j.message]);break;case"success":Ki({projectDir:j.projectDir,...j.bundlePath===void 0?{}:{bundlePath:j.bundlePath},pinHint:j.pinHint});break}},()=>E.close()},[]);const no=c.useRef(void 0);c.useEffect(()=>{no.current=I},[I]);const ro=c.useRef(!1);c.useEffect(()=>{ro.current=Rn},[Rn]);const jn=me===void 0?void 0:Number.parseInt(me.split(":")[1]??"",10),Zi=ee!==void 0?Vo(ee.key):Mt!==void 0?Mt:G!==void 0&&jn!==void 0&&V.some(E=>E.index===jn)?pt(G,jn):G!==void 0&&V[0]!==void 0&&me===void 0?pt(G,V[0].index):void 0,Ji=ee!==void 0?`合成 ${ee.background==="transparent"?"透明底":ee.background==="black"?"黑底":"白底"}`:Mt!==void 0?"本地图片":V[0]!==void 0?`${V[0].width}×${V[0].height} ${V[0].format.toUpperCase()}`:"首字母图标",oo=(()=>{if(Ft!==void 0)return Ft;const E=A.trayIconPath.trim();if(E.length>0&&G!==void 0){const j=V.find(O=>O.path===E);if(j!==void 0)return pt(G,j.index)}const B=/^([^:]+):(\d+)$/.exec(Sn??"");if(B!==null){const j=Number(B[1]),O=Number(B[2]);if(Number.isInteger(j)&&Number.isInteger(O))return pt(j,O)}E.length})(),Qi=Ft!==void 0?"本地图片":oo!==void 0?"跟随源图":"跟随应用图标";c.useEffect(()=>{const E=e.trim();if(E.length===0)return;const B=window.setTimeout(()=>{J("/api/prime",{command:E})},400);return()=>window.clearTimeout(B)},[e]);const ea=async()=>{const E=e.trim();if(!(o.argsMode==="string"&&E.length===0)){if(d(!0),Bt("terminal"),$e.current?.reset(),zt([]),K([]),U(!1),we([]),ae(void 0),he(void 0),$t(void 0),Ct(void 0),Lt(void 0),o.argsMode==="array"){if(n.length===0||(n[0]??"").trim().length===0)return;await J("/api/command",{argv:n});return}await J("/api/command",{command:E})}},ta=E=>{if(Kr.find(j=>j.port===E)===void 0){J("/api/select-service",{port:E});return}J("/api/select-service",{port:E}),Bt(`svc-${E}`)},na=(E,B,j)=>{zt(O=>O.map(Z=>{if(Z.port!==E)return Z;if(j==="replace")return{...Z,url:B};const ue=[...Z.history.slice(0,Z.historyIndex+1),B];return{...Z,url:B,history:ue,historyIndex:ue.length-1}}))},ra=(E,B)=>{zt(j=>j.map(O=>{if(O.port!==E)return O;const Z=O.historyIndex+B;return Z<0||Z>=O.history.length?O:{...O,historyIndex:Z,url:O.history[Z]}}))},[oa,Nn]=c.useState(),sa=async()=>{Zr.flush(),Jr.flush(),Rt("confirm"),St(!0);try{const E=await J("/api/confirm",{});if(!E.ok){const B=await E.json().catch(()=>({}));Nn(B.error??`确认失败(${E.status})`);return}Nn(void 0)}catch{Nn("确认请求失败")}};c.useEffect(()=>{g==="frozen"&&Yi({...Yr.current,...A})},[g]);const ia=async()=>{await J("/api/create",{})},aa=g==="discovered"||g==="success"?"success":g==="running"||g==="materializing"?"warning":g==="failed"?"destructive":"secondary",ca=p?"minmax(0, 520px) minmax(0, 1fr) minmax(0, 0fr)":"minmax(0, 1fr) minmax(0, var(--list-w)) minmax(0, 1fr)";return i.jsxs("div",{className:"grid h-screen w-full overflow-hidden",style:{"--list-w":"min(520px, 100vw - 40px)",gridTemplateColumns:ca,transition:"grid-template-columns 450ms cubic-bezier(0.4, 0, 0.2, 1)"},children:[i.jsxs("div",{className:"flex w-full flex-col gap-4 overflow-y-auto p-5 max-md:min-h-screen "+(p?"md:border-r md:border-border":""),style:{gridColumn:p?"1":"2",gridRow:"1",transition:"border-color 450ms",scrollbarGutter:"stable"},children:[i.jsxs("header",{className:"flex items-center gap-3",children:[i.jsx("h1",{className:"text-lg font-bold",children:"create-opentray"}),i.jsx(ar,{variant:aa,className:"ml-auto shrink-0",children:g})]}),i.jsx(Xd,{command:e,onCommandChange:t,argv:n,onArgvChange:E=>r([...E]),runAlive:h,frozen:g==="materializing"||g==="frozen"||g==="success",failedReason:g==="failed"?m:void 0,commandOptions:o,defaultCwd:a,onCommandOptionsChange:E=>{s(E),J("/api/command-options",{cwd:E.cwd,env:E.env,argsMode:E.argsMode})},onRun:()=>{ea()},onStop:()=>{J("/api/stop",{})}}),i.jsx(Yd,{frozen:g==="frozen"||g==="materializing"||g==="success",values:A,defaults:T,candidates:V,candidatesPort:G,selectedIconRef:me,uploadedIconUrl:Mt,iconAnalysis:We,iconComposition:ee,iconComposeError:M,iconBackground:X,iconScale:xe,onIconBackgroundChange:Xi,onIconScaleChange:qi,selectedTrayRef:Sn,uploadedTrayUrl:Ft,selectedPort:L,targetDirExists:u,onPickIconCandidate:E=>{G!==void 0&&(he(`${G}:${E.index}`),$t(void 0),J("/api/icon-select",{port:G,index:E.index}))},onUploadIcon:E=>{const B=URL.createObjectURL(E);$t(B),he(void 0),E.arrayBuffer().then(j=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":E.type||"application/octet-stream",authorization:`Bearer ${new URLSearchParams(location.search).get("token")??""}`},body:j}).then(O=>O.json()).then(({path:O})=>{O===void 0||O.length===0||(_(Z=>({...Z,iconPath:O})),J("/api/form",{iconPath:O}))}).catch(()=>{})})},onClearIcon:()=>{he(void 0),$t(void 0),_(E=>({...E,iconPath:""})),J("/api/form",{iconPath:""})},onPickTray:E=>{G!==void 0&&(Ct(`${G}:${E.index}`),Lt(void 0),J("/api/tray-icon-select",{port:G,index:E.index}))},onUploadTray:E=>{const B=URL.createObjectURL(E);Lt(B),Ct(void 0),E.arrayBuffer().then(j=>{fetch("/api/icon-upload",{method:"POST",headers:{"content-type":E.type||"application/octet-stream",authorization:`Bearer ${new URLSearchParams(location.search).get("token")??""}`},body:j}).then(O=>O.json()).then(({path:O})=>{O===void 0||O.length===0||(_(Z=>({...Z,trayIconPath:O})),J("/api/form",{trayIconPath:O}))}).catch(()=>{})})},onClearTray:()=>{Ct(void 0),Lt(void 0),_(E=>({...E,trayIconPath:""})),J("/api/form",{trayIconPath:""})},onPatch:E=>{_(B=>({...B,...E})),J("/api/form",E)},onConfirm:()=>{sa()}})]}),i.jsx("div",{className:"flex min-h-0 min-w-0 flex-col gap-4 overflow-y-auto p-4 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?i.jsxs(i.Fragment,{children:[i.jsx(Vf,{command:b,terminalHostRef:Gr,terminalReady:S,interactive:w,status:$i,services:[...$],iframeTabs:Kr,activeTab:Mi,onActiveTabChange:Bt,onIframeNavigate:na,onIframeHistoryMove:ra,onJumpToService:ta,className:"min-h-[480px] flex-1"}),I!==void 0?i.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:I}):null]}):null}),i.jsx(pf,{open:Rn,onOpenChange:St,phase:Li,frozenValues:Gi,iconSrc:Zi,iconLabel:Ji,traySrc:oo,trayLabel:Qi,selectedPort:L,currentStep:zi,logs:Bi,error:Hi??m,result:Wi,onBack:()=>St(!1),onCreate:()=>{ia()},onOpenApp:()=>{J("/api/open-app",{})},confirmError:oa,onClose:()=>St(!1)})]})}da.createRoot(document.getElementById("root")).render(i.jsx(fa.StrictMode,{children:i.jsx(Uf,{})}));
|
|
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+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12Dnd5SF2ZdhiYwDyAOoAbSJwZXEAAKBOIgAHSE9hY2RlZmhpbG9yc3UXARoBHwE6AVIBVQFiAWQBZgGCAakB6QHtAfIBYwB5ACdkUABZADuAqQCpQIABY3B5ACUBKAE1AfUhdGUGYWmg0iJ0KGFsRGlmZmVyZW50aWFsRAAAoEUhbCJleXMAAKAtIQACYWVpb0EBRAFKAU0B8iFvbgxhZABpAGwAO4DHAMdAcgBjAAhhbiJpbnQAAKAwIm8AdAAKYQABZG5ZAV0BaSJsbGEAuGB0I2VyRG90ALdg8gA5AWkAp2NyImNsZQAAAkRNUFRwAXQBeQF9AW8AdAAAoJkiaSJudXMAAKCWIuwhdXMAoJUiaSJtZXMAAKCXIm8AAAFjc4cBlAFrKndpc2VDb250b3VySW50ZWdyYWwAAKAyImUjQ3VybHkAAAFEUZwBpAFvJXVibGVRdW90ZQAAoB0gdSJvdGUAAKAZIAACbG5wdbABtgHNAdgBbwBuAGWgNyIAoHQqgAFnaXQAvAHBAcUB8iJ1ZW50AKBhIm4AdAAAoC8i7yV1ckludGVncmFsAKAuIgABZnLRAdMBAKACIe8iZHVjdACgECJuLnRlckNsb2Nrd2lzZUNvbnRvdXJJbnRlZ3JhbAAAoDMi7yFzcwCgLypjAHIAAOA12J7ccABDoNMiYQBwAACgTSKABURKU1phY2VmaW9zAAsCEgIVAhgCGwIsAjQCOQI9AnMCfwNvoEUh9CJyYWhkAKARKWMAeQACZGMAeQAFZGMAeQAPZIABZ3JzACECJQIoAuchZXIAoCEgcgAAoKEhaAB2AACg5CoAAWF5MAIzAvIhb24OYRRkbAB0oAciYQCUY3IAAOA12AfdAAFhZkECawIAAWNtRQJnAvIjaXRpY2FsAAJBREdUUAJUAl8CYwJjInV0ZQC0YG8AdAFZAloC2WJiJGxlQWN1dGUA3WJyImF2ZQBgYGkibGRlANxi7yFuZACgxCJmJWVyZW50aWFsRAAAoEYhcAR9AgAAAAAAAIECjgIAABoDZgAA4DXYO91EoagAhQKJAm8AdAAAoNwgcSJ1YWwAAKBQIuIhbGUAA0NETFJVVpkCqAK1Au8C/wIRA28AbgB0AG8AdQByAEkAbgB0AGUAZwByAGEA7ADEAW8AdAKvAgAAAACwAqhgbiNBcnJvdwAAoNMhAAFlb7kC0AJmAHQAgAFBUlQAwQLGAs0CciJyb3cAAKDQIekkZ2h0QXJyb3cAoNQhZQDlACsCbgBnAAABTFLWAugC5SFmdAABQVLcAuECciJyb3cAAKD4J+kkZ2h0QXJyb3cAoPon6SRnaHRBcnJvdwCg+SdpImdodAAAAUFU9gL7AnIicm93AACg0iFlAGUAAKCoInAAQQIGAwAAAAALA3Iicm93AACg0SFvJHduQXJyb3cAAKDVIWUlcnRpY2FsQmFyAACgJSJuAAADQUJMUlRhJAM2AzoDWgNxA3oDciJyb3cAAKGTIUJVLAMwA2EAcgAAoBMpcCNBcnJvdwAAoPUhciJldmUAEWPlIWZ00gJDAwAASwMAAFIDaSVnaHRWZWN0b3IAAKBQKWUkZVZlY3RvcgAAoF4p5SJjdG9yQqC9IWEAcgAAoFYpaSJnaHQA1AFiAwAAaQNlJGVWZWN0b3IAAKBfKeUiY3RvckKgwSFhAHIAAKBXKWUAZQBBoKQiciJyb3cAAKCnIXIAcgBvAPcAtAIAAWN0gwOHA3IAAOA12J/c8iFvaxBhAAhOVGFjZGZnbG1vcHFzdHV4owOlA6kDsAO/A8IDxgPNA9ID8gP9AwEEFAQeBCAEJQRHAEphSAA7gNAA0EBjAHUAdABlADuAyQDJQIABYWl5ALYDuQO+A/Ihb24aYXIAYwA7gMoAykAtZG8AdAAWYXIAAOA12AjdcgBhAHYAZQA7gMgAyEDlIm1lbnQAoAgiAAFhcNYD2QNjAHIAEmF0AHkAUwLhAwAAAADpA20lYWxsU3F1YXJlAACg+yVlJ3J5U21hbGxTcXVhcmUAAKCrJQABZ3D2A/kDbwBuABhhZgAA4DXYPN3zImlsb26VY3UAAAFhaQYEDgRsAFSgdSppImxkZQAAoEIi7CNpYnJpdW0AoMwhAAFjaRgEGwRyAACgMCFtAACgcyphAJdjbQBsADuAywDLQAABaXApBC0E8yF0cwCgAyLvJG5lbnRpYWxFAKBHIYACY2Zpb3MAPQQ/BEMEXQRyBHkAJGRyAADgNdgJ3WwibGVkAFMCTAQAAAAAVARtJWFsbFNxdWFyZQAAoPwlZSdyeVNtYWxsU3F1YXJlAACgqiVwA2UEAABpBAAAAABtBGYAAOA12D3dwSFsbACgACLyI2llcnRyZgCgMSFjAPIAcQQABkpUYWJjZGZnb3JzdIgEiwSOBJMElwSkBKcEqwStBLIE5QTqBGMAeQADZDuAPgA+QO0hbWFkoJMD3GNyImV2ZQAeYYABZWl5AJ0EoASjBOQhaWwiYXIAYwAcYRNkbwB0ACBhcgAA4DXYCt0AoNkicABmAADgNdg+3eUiYXRlcgADRUZHTFNUvwTIBM8E1QTZBOAEcSJ1YWwATKBlIuUhc3MAoNsidSRsbEVxdWFsAACgZyJyI2VhdGVyAACgoirlIXNzAKB3IuwkYW50RXF1YWwAoH4qaSJsZGUAAKBzImMAcgAA4DXYotwAoGsiAARBYWNmaW9zdfkE/QQFBQgFCwUTBSIFKwVSIkRjeQAqZAABY3QBBQQFZQBrAMdiXmDpIXJjJGFyAACgDCFsJWJlcnRTcGFjZQAAoAsh8AEYBQAAGwVmAACgDSHpJXpvbnRhbExpbmUAoAAlAAFjdCYFKAXyABIF8iFvayZhbQBwAEQBMQU5BW8AdwBuAEgAdQBtAPAAAAFxInVhbAAAoE8iAAdFSk9hY2RmZ21ub3N0dVMFVgVZBVwFYwVtBXAFcwV6BZAFtgXFBckFzQVjAHkAFWTsIWlnMmFjAHkAAWRjAHUAdABlADuAzQDNQAABaXlnBWwFcgBjADuAzgDOQBhkbwB0ADBhcgAAoBEhcgBhAHYAZQA7gMwAzEAAoREhYXB/BYsFAAFjZ4MFhQVyACphaSNuYXJ5SQAAoEghbABpAGUA8wD6AvQBlQUAAKUFZaAsIgABZ3KaBZ4F8iFhbACgKyLzI2VjdGlvbgCgwiJpI3NpYmxlAAABQ1SsBbEFbyJtbWEAAKBjIGkibWVzAACgYiCAAWdwdAC8Bb8FwwVvAG4ALmFmAADgNdhA3WEAmWNjAHIAAKAQIWkibGRlAChh6wHSBQAA1QVjAHkABmRsADuAzwDPQIACY2Zvc3UA4QXpBe0F8gX9BQABaXnlBegFcgBjADRhGWRyAADgNdgN3XAAZgAA4DXYQd3jAfcFAAD7BXIAAOA12KXc8iFjeQhk6yFjeQRkgANISmFjZm9zAAwGDwYSBhUGHQYhBiYGYwB5ACVkYwB5AAxk8CFwYZpjAAFleRkGHAbkIWlsNmEaZHIAAOA12A7dcABmAADgNdhC3WMAcgAA4DXYptyABUpUYWNlZmxtb3N0AD0GQAZDBl4GawZkB2gHcAd0B80H2gdjAHkACWQ7gDwAPECAAmNtbnByAEwGTwZSBlUGWwb1IXRlOWHiIWRhm2NnAACg6ifsI2FjZXRyZgCgEiFyAACgniGAAWFleQBkBmcGagbyIW9uPWHkIWlsO2EbZAABZnNvBjQHdAAABUFDREZSVFVWYXKABp4GpAbGBssG3AYDByEHwQIqBwABbnKEBowGZyVsZUJyYWNrZXQAAKDoJ/Ihb3cAoZAhQlKTBpcGYQByAACg5CHpJGdodEFycm93AKDGIWUjaWxpbmcAAKAII28A9QGqBgAAsgZiJWxlQnJhY2tldAAAoOYnbgDUAbcGAAC+BmUkZVZlY3RvcgAAoGEp5SJjdG9yQqDDIWEAcgAAoFkpbCJvb3IAAKAKI2kiZ2h0AAABQVbSBtcGciJyb3cAAKCUIeUiY3RvcgCgTikAAWVy4AbwBmUAAKGjIkFW5gbrBnIicm93AACgpCHlImN0b3IAoFopaSNhbmdsZQBCorIi+wYAAAAA/wZhAHIAAKDPKXEidWFsAACgtCJwAIABRFRWAAoHEQcYB+8kd25WZWN0b3IAoFEpZSRlVmVjdG9yAACgYCnlImN0b3JCoL8hYQByAACgWCnlImN0b3JCoLwhYQByAACgUilpAGcAaAB0AGEAcgByAG8A9wDMAnMAAANFRkdMU1Q/B0cHTgdUB1gHXwfxJXVhbEdyZWF0ZXIAoNoidSRsbEVxdWFsAACgZiJyI2VhdGVyAACgdiLlIXNzAKChKuwkYW50RXF1YWwAoH0qaSJsZGUAAKByInIAAOA12A/dZaDYIuYjdGFycm93AKDaIWkiZG90AD9hgAFucHcAege1B7kHZwAAAkxSbHKCB5QHmwerB+UhZnQAAUFSiAeNB3Iicm93AACg9SfpJGdodEFycm93AKD3J+kkZ2h0QXJyb3cAoPYn5SFmdAABYXLcAqEHaQBnAGgAdABhAHIAcgBvAPcA5wJpAGcAaAB0AGEAcgByAG8A9wDuAmYAAOA12EPdZQByAAABTFK/B8YHZSRmdEFycm93AACgmSHpJGdodEFycm93AKCYIYABY2h0ANMH1QfXB/IAWgYAoLAh8iFva0FhAKBqIgAEYWNlZmlvc3XpB+wH7gf/BwMICQgOCBEIcAAAoAUpeQAcZAABZGzyB/kHaSR1bVNwYWNlAACgXyBsI2ludHJmAACgMyFyAADgNdgQ3e4jdXNQbHVzAKATInAAZgAA4DXYRN1jAPIA/gecY4AESmFjZWZvc3R1ACEIJAgoCDUIgQiFCDsKQApHCmMAeQAKZGMidXRlAENhgAFhZXkALggxCDQI8iFvbkdh5CFpbEVhHWSAAWdzdwA7CGEIfQjhInRpdmWAAU1UVgBECEwIWQhlJWRpdW1TcGFjZQAAoAsgaABpAAABY25SCFMIawBTAHAAYQBjAOUASwhlAHIAeQBUAGgAaQDuAFQI9CFlZAABR0xnCHUIcgBlAGEAdABlAHIARwByAGUAYQB0AGUA8gDrBGUAcwBzAEwAZQBzAPMA2wdMImluZQAKYHIAAOA12BHdAAJCbnB0jAiRCJkInAhyImVhawAAoGAgwiZyZWFraW5nU3BhY2WgYGYAAKAVIUOq7CqzCMIIzQgAAOcIGwkAAAAAAAAtCQAAbwkAAIcJAACdCcAJGQoAADQKAAFvdbYIvAjuI2dydWVudACgYiJwIkNhcAAAoG0ibyh1YmxlVmVydGljYWxCYXIAAKAmIoABbHF4ANII1wjhCOUibWVudACgCSL1IWFsVKBgImkibGRlAADgQiI4A2kic3RzAACgBCJyI2VhdGVyAACjbyJFRkdMU1T1CPoIAgkJCQ0JFQlxInVhbAAAoHEidSRsbEVxdWFsAADgZyI4A3IjZWF0ZXIAAOBrIjgD5SFzcwCgeSLsJGFudEVxdWFsAOB+KjgDaSJsZGUAAKB1IvUhbXBEASAJJwnvI3duSHVtcADgTiI4A3EidWFsAADgTyI4A2UAAAFmczEJRgn0JFRyaWFuZ2xlQqLqIj0JAAAAAEIJYQByAADgzyk4A3EidWFsAACg7CJzAICibiJFR0xTVABRCVYJXAlhCWkJcSJ1YWwAAKBwInIjZWF0ZXIAAKB4IuUhc3MA4GoiOAPsJGFudEVxdWFsAOB9KjgDaSJsZGUAAKB0IuUic3RlZAABR0x1CX8J8iZlYXRlckdyZWF0ZXIA4KIqOAPlI3NzTGVzcwDgoSo4A/IjZWNlZGVzAKGAIkVTjwmVCXEidWFsAADgryo4A+wkYW50RXF1YWwAoOAiAAFlaaAJqQl2JmVyc2VFbGVtZW50AACgDCLnJWh0VHJpYW5nbGVCousitgkAAAAAuwlhAHIAAODQKTgDcSJ1YWwAAKDtIgABcXXDCeAJdSNhcmVTdQAAAWJwywnVCfMhZXRF4I8iOANxInVhbAAAoOIi5SJyc2V0ReCQIjgDcSJ1YWwAAKDjIoABYmNwAOYJ8AkNCvMhZXRF4IIi0iBxInVhbAAAoIgi4yJlZWRzgKGBIkVTVAD6CQAKBwpxInVhbAAA4LAqOAPsJGFudEVxdWFsAKDhImkibGRlAADgfyI4A+UicnNldEXggyLSIHEidWFsAACgiSJpImxkZQCAoUEiRUZUACIKJwouCnEidWFsAACgRCJ1JGxsRXF1YWwAAKBHImkibGRlAACgSSJlJXJ0aWNhbEJhcgAAoCQiYwByAADgNdip3GkAbABkAGUAO4DRANFAnWMAB0VhY2RmZ21vcHJzdHV2XgphCmgKcgp2CnoKgQqRCpYKqwqtCrsKyArNCuwhaWdSYWMAdQB0AGUAO4DTANNAAAFpeWwKcQpyAGMAO4DUANRAHmRiImxhYwBQYXIAAOA12BLdcgBhAHYAZQA7gNIA0kCAAWFlaQCHCooKjQpjAHIATGFnAGEAqWNjInJvbgCfY3AAZgAA4DXYRt3lI25DdXJseQABRFGeCqYKbyV1YmxlUXVvdGUAAKAcIHUib3RlAACgGCAAoFQqAAFjbLEKtQpyAADgNdiq3GEAcwBoADuA2ADYQGkAbAHACsUKZABlADuA1QDVQGUAcwAAoDcqbQBsADuA1gDWQGUAcgAAAUJQ0wrmCgABYXLXCtoKcgAAoD4gYQBjAAABZWvgCuIKAKDeI2UAdAAAoLQjYSVyZW50aGVzaXMAAKDcI4AEYWNmaGlsb3JzAP0KAwsFCwkLCwsMCxELIwtaC3IjdGlhbEQAAKACInkAH2RyAADgNdgT3WkApmOgY/Ujc01pbnVzsWAAAWlwFQsgC24AYwBhAHIAZQBwAGwAYQBuAOUACgVmAACgGSGAobsqZWlvACoLRQtJC+MiZWRlc4CheiJFU1QANAs5C0ALcSJ1YWwAAKCvKuwkYW50RXF1YWwAoHwiaSJsZGUAAKB+Im0AZQAAoDMgAAFkcE0LUQv1IWN0AKAPIm8jcnRpb24AYaA3ImwAAKAdIgABY2leC2ILcgAA4DXYq9yoYwACVWZvc2oLbwtzC3cLTwBUADuAIgAiQHIAAOA12BTdcABmAACgGiFjAHIAAOA12KzcAAZCRWFjZWZoaW9yc3WPC5MLlwupC7YL2AvbC90LhQyTDJoMowzhIXJyAKAQKUcAO4CuAK5AgAFjbnIAnQugC6ML9SF0ZVRhZwAAoOsncgB0oKAhbAAAoBYpgAFhZXkArwuyC7UL8iFvblhh5CFpbFZhIGR2oBwhZSJyc2UAAAFFVb8LzwsAAWxxwwvIC+UibWVudACgCyL1JGlsaWJyaXVtAKDLIXAmRXF1aWxpYnJpdW0AAKBvKXIAAKAcIW8AoWPnIWh0AARBQ0RGVFVWYewLCgwQDDIMNwxeDHwM9gIAAW5y8Av4C2clbGVCcmFja2V0AACg6SfyIW93AKGSIUJM/wsDDGEAcgAAoOUhZSRmdEFycm93AACgxCFlI2lsaW5nAACgCSNvAPUBFgwAAB4MYiVsZUJyYWNrZXQAAKDnJ24A1AEjDAAAKgxlJGVWZWN0b3IAAKBdKeUiY3RvckKgwiFhAHIAAKBVKWwib29yAACgCyMAAWVyOwxLDGUAAKGiIkFWQQxGDHIicm93AACgpiHlImN0b3IAoFspaSNhbmdsZQBCorMiVgwAAAAAWgxhAHIAAKDQKXEidWFsAACgtSJwAIABRFRWAGUMbAxzDO8kd25WZWN0b3IAoE8pZSRlVmVjdG9yAACgXCnlImN0b3JCoL4hYQByAACgVCnlImN0b3JCoMAhYQByAACgUykAAXB1iQyMDGYAAKAdIe4kZEltcGxpZXMAoHAp6SRnaHRhcnJvdwCg2yEAAWNongyhDHIAAKAbIQCgsSHsJGVEZWxheWVkAKD0KYAGSE9hY2ZoaW1vcXN0dQC/DMgMzAzQDOIM5gwKDQ0NFA0ZDU8NVA1YDQABQ2PDDMYMyCFjeSlkeQAoZEYiVGN5ACxkYyJ1dGUAWmEAorwqYWVpedgM2wzeDOEM8iFvbmBh5CFpbF5hcgBjAFxhIWRyAADgNdgW3e8hcnQAAkRMUlXvDPYM/QwEDW8kd25BcnJvdwAAoJMhZSRmdEFycm93AACgkCHpJGdodEFycm93AKCSIXAjQXJyb3cAAKCRIechbWGjY+EkbGxDaXJjbGUAoBgicABmAADgNdhK3XICHw0AAAAAIg10AACgGiLhIXJlgKGhJUlTVQAqDTINSg3uJXRlcnNlY3Rpb24AoJMidQAAAWJwNw1ADfMhZXRFoI8icSJ1YWwAAKCRIuUicnNldEWgkCJxInVhbAAAoJIibiJpb24AAKCUImMAcgAA4DXYrtxhAHIAAKDGIgACYmNtcF8Nag2ODZANc6DQImUAdABFoNAicSJ1YWwAAKCGIgABY2huDYkNZSJlZHMAgKF7IkVTVAB4DX0NhA1xInVhbAAAoLAq7CRhbnRFcXVhbACgfSJpImxkZQAAoH8iVABoAGEA9ADHCwCgESIAodEiZXOVDZ8NciJzZXQARaCDInEidWFsAACghyJlAHQAAKDRIoAFSFJTYWNmaGlvcnMAtQ27Db8NyA3ODdsN3w3+DRgOHQ4jDk8AUgBOADuA3gDeQMEhREUAoCIhAAFIY8MNxg1jAHkAC2R5ACZkAAFidcwNzQ0JYKRjgAFhZXkA1A3XDdoN8iFvbmRh5CFpbGJhImRyAADgNdgX3QABZWnjDe4N8gHoDQAA7Q3lImZvcmUAoDQiYQCYYwABY27yDfkNayNTcGFjZQAA4F8gCiDTInBhY2UAoAkg7CFkZYChPCJFRlQABw4MDhMOcSJ1YWwAAKBDInUkbGxFcXVhbAAAoEUiaSJsZGUAAKBIInAAZgAA4DXYS93pI3BsZURvdACg2yAAAWN0Jw4rDnIAAOA12K/c8iFva2Zh4QpFDlYOYA5qDgAAbg5yDgAAAAAAAAAAAAB5DnwOqA6zDgAADg8RDxYPGg8AAWNySA5ODnUAdABlADuA2gDaQHIAb6CfIeMhaXIAoEkpcgDjAVsOAABdDnkADmR2AGUAbGEAAWl5Yw5oDnIAYwA7gNsA20AjZGIibGFjAHBhcgAA4DXYGN1yAGEAdgBlADuA2QDZQOEhY3JqYQABZGl/Dp8OZQByAAABQlCFDpcOAAFhcokOiw5yAF9gYQBjAAABZWuRDpMOAKDfI2UAdAAAoLUjYSVyZW50aGVzaXMAAKDdI28AbgBQoMMi7CF1cwCgjiIAAWdwqw6uDm8AbgByYWYAAOA12EzdAARBREVUYWRwc78O0g7ZDuEOBQPqDvMOBw9yInJvdwDCoZEhyA4AAMwOYQByAACgEilvJHduQXJyb3cAAKDFIW8kd25BcnJvdwAAoJUhcSV1aWxpYnJpdW0AAKBuKWUAZQBBoKUiciJyb3cAAKClIW8AdwBuAGEAcgByAG8A9wAQA2UAcgAAAUxS+Q4AD2UkZnRBcnJvdwAAoJYh6SRnaHRBcnJvdwCglyFpAGyg0gNvAG4ApWPpIW5nbmFjAHIAAOA12LDcaSJsZGUAaGFtAGwAO4DcANxAgAREYmNkZWZvc3YALQ8xDzUPNw89D3IPdg97D4AP4SFzaACgqyJhAHIAAKDrKnkAEmThIXNobKCpIgCg5ioAAWVyQQ9DDwCgwSKAAWJ0eQBJD00Paw9hAHIAAKAWIGmgFiDjIWFsAAJCTFNUWA9cD18PZg9hAHIAAKAjIukhbmV8YGUkcGFyYXRvcgAAoFgnaSJsZGUAAKBAItQkaGluU3BhY2UAoAogcgAA4DXYGd1wAGYAAOA12E3dYwByAADgNdix3GQiYXNoAACgqiKAAmNlZm9zAI4PkQ+VD5kPng/pIXJjdGHkIWdlAKDAInIAAOA12BrdcABmAADgNdhO3WMAcgAA4DXYstwAAmZpb3OqD64Prw+0D3IAAOA12BvdnmNwAGYAAOA12E/dYwByAADgNdiz3IAEQUlVYWNmb3N1AMgPyw/OD9EP2A/gD+QP6Q/uD2MAeQAvZGMAeQAHZGMAeQAuZGMAdQB0AGUAO4DdAN1AAAFpedwP3w9yAGMAdmErZHIAAOA12BzdcABmAADgNdhQ3WMAcgAA4DXYtNxtAGwAeGEABEhhY2RlZm9z/g8BEAUQDRAQEB0QIBAkEGMAeQAWZGMidXRlAHlhAAFheQkQDBDyIW9ufWEXZG8AdAB7YfIBFRAAABwQbwBXAGkAZAB0AOgAVAhhAJZjcgAAoCghcABmAACgJCFjAHIAAOA12LXc4QtCEEkQTRAAAGcQbRByEAAAAAAAAAAAeRCKEJcQ8hD9EAAAGxEhETIROREAAD4RYwB1AHQAZQA7gOEA4UByImV2ZQADYYCiPiJFZGl1eQBWEFkQWxBgEGUQAOA+IjMDAKA/InIAYwA7gOIA4kB0AGUAO4C0ALRAMGRsAGkAZwA7gOYA5kByoGEgAOA12B7dcgBhAHYAZQA7gOAA4EAAAWVwfBCGEAABZnCAEIQQ8yF5bQCgNSHoAIMQaABhALFjAAFhcI0QWwAAAWNskRCTEHIAAWFnAACgPypkApwQAAAAALEQAKInImFkc3ajEKcQqRCuEG4AZAAAoFUqAKBcKmwib3BlAACgWCoAoFoqAKMgImVsbXJzersQvRDAEN0Q5RDtEACgpCllAACgICJzAGQAYaAhImEEzhDQENIQ1BDWENgQ2hDcEACgqCkAoKkpAKCqKQCgqykAoKwpAKCtKQCgrikAoK8pdAB2oB8iYgBkoL4iAKCdKQABcHTpEOwQaAAAoCIixWDhIXJyAKB8IwABZ3D1EPgQbwBuAAVhZgAA4DXYUt0Ao0giRWFlaW9wBxEJEQ0RDxESERQRAKBwKuMhaXIAoG8qAKBKImQAAKBLInMAJ2DyIW94ZaBIIvEADhFpAG4AZwA7gOUA5UCAAWN0eQAmESoRKxFyAADgNdi23CpgbQBwAGWgSCLxAPgBaQBsAGQAZQA7gOMA40BtAGwAO4DkAORAAAFjaUERRxFvAG4AaQBuAPQA6AFuAHQAAKARKgAITmFiY2RlZmlrbG5vcHJzdWQRaBGXEZ8RpxGrEdIR1hErEjASexKKEn0RThNbE3oTbwB0AACg7SoAAWNybBGJEWsAAAJjZXBzdBF4EX0RghHvIW5nAKBMInAjc2lsb24A9mNyImltZQAAoDUgaQBtAGWgPSJxAACgzSJ2AY0RkRFlAGUAAKC9ImUAZABnoAUjZQAAoAUjcgBrAHSgtSPiIXJrAKC2IwABb3mjEaYRbgDnAHcRMWTxIXVvAKAeIIACY21wcnQAtBG5Eb4RwRHFEeEhdXPloDUi5ABwInR5dgAAoLApcwDpAH0RbgBvAPUA6gCAAWFodwDLEcwRzhGyYwCgNiHlIWVuAKBsInIAAOA12B/dZwCAA2Nvc3R1dncA4xHyEQUSEhIhEiYSKRKAAWFpdQDpEesR7xHwAKMFcgBjAACg7yVwAACgwyKAAWRwdAD4EfwRABJvAHQAAKAAKuwhdXMAoAEqaSJtZXMAAKACKnECCxIAAAAADxLjIXVwAKAGKmEAcgAAoAUm8iNpYW5nbGUAAWR1GhIeEu8hd24AoL0lcAAAoLMlcCJsdXMAAKAEKmUA5QBCD+UAkg9hInJvdwAAoA0pgAFha28ANhJoEncSAAFjbjoSZRJrAIABbHN0AEESRxJNEm8jemVuZ2UAAKDrKXEAdQBhAHIA5QBcBPIjaWFuZ2xlgKG0JWRscgBYElwSYBLvIXduAKC+JeUhZnQAoMIlaSJnaHQAAKC4JWsAAKAjJLEBbRIAAHUSsgFxEgAAcxIAoJIlAKCRJTQAAKCTJWMAawAAoIglAAFlb38ShxJx4D0A5SD1IWl2AOBhIuUgdAAAoBAjAAJwdHd4kRKVEpsSnxJmAADgNdhT3XSgpSJvAG0AAKClIvQhaWUAoMgiAAZESFVWYmRobXB0dXayEsES0RLgEvcS+xIKExoTHxMjEygTNxMAAkxSbHK5ErsSvRK/EgCgVyUAoFQlAKBWJQCgUyUAolAlRFVkdckSyxLNEs8SAKBmJQCgaSUAoGQlAKBnJQACTFJsctgS2hLcEt4SAKBdJQCgWiUAoFwlAKBZJQCjUSVITFJobHLrEu0S7xLxEvMS9RIAoGwlAKBjJQCgYCUAoGslAKBiJQCgXyVvAHgAAKDJKQACTFJscgITBBMGEwgTAKBVJQCgUiUAoBAlAKAMJQCiACVEVWR1EhMUExYTGBMAoGUlAKBoJQCgLCUAoDQlaSJudXMAAKCfIuwhdXMAoJ4iaSJtZXMAAKCgIgACTFJsci8TMRMzEzUTAKBbJQCgWCUAoBglAKAUJQCjAiVITFJobHJCE0QTRhNIE0oTTBMAoGolAKBhJQCgXiUAoDwlAKAkJQCgHCUAAWV2UhNVE3YA5QD5AGIAYQByADuApgCmQAACY2Vpb2ITZhNqE24TcgAA4DXYt9xtAGkAAKBPIG0A5aA9IogRbAAAoVwAYmh0E3YTAKDFKfMhdWIAoMgnbAF+E4QTbABloCIgdAAAoCIgcAAAoU4iRWWJE4sTAKCuKvGgTyI8BeEMqRMAAN8TABQDFB8UAAAjFDQUAAAAAIUUAAAAAI0UAAAAANcU4xT3FPsUAACIFQAAlhWAAWNwcgCuE7ET1RP1IXRlB2GAoikiYWJjZHMAuxO/E8QTzhPSE24AZAAAoEQqciJjdXAAAKBJKgABYXXIE8sTcAAAoEsqcAAAoEcqbwB0AACgQCoA4CkiAP4AAWVv2RPcE3QAAKBBIO4ABAUAAmFlaXXlE+8T9RP4E/AB6hMAAO0TcwAAoE0qbwBuAA1hZABpAGwAO4DnAOdAcgBjAAlhcABzAHOgTCptAACgUCpvAHQAC2GAAWRtbgAIFA0UEhRpAGwAO4C4ALhAcCJ0eXYAAKCyKXQAAIGiADtlGBQZFKJAcgBkAG8A9ABiAXIAAOA12CDdgAFjZWkAKBQqFDIUeQBHZGMAawBtoBMn4SFyawCgEyfHY3IAAKPLJUVjZWZtcz8UQRRHFHcUfBSAFACgwykAocYCZWxGFEkUcQAAoFciZQBhAlAUAAAAAGAUciJyb3cAAAFsclYUWhTlIWZ0AKC6IWkiZ2h0AACguyGAAlJTYWNkAGgUaRRrFG8UcxSuYACgyCRzAHQAAKCbIukhcmMAoJoi4SFzaACgnSJuImludAAAoBAqaQBkAACg7yrjIWlyAKDCKfUhYnN1oGMmaQB0AACgYybsApMUmhS2FAAAwxRvAG4AZaA6APGgVCKrAG0CnxQAAAAAoxRhAHSgLABAYAChASJmbKcUqRTuABMNZQAAAW14rhSyFOUhbnQAoAEiZQDzANIB5wG6FAAAwBRkoEUibwB0AACgbSpuAPQAzAGAAWZyeQDIFMsUzhQA4DXYVN1vAOQA1wEAgakAO3MeAdMUcgAAoBchAAFhb9oU3hRyAHIAAKC1IXMAcwAAoBcnAAFjdeYU6hRyAADgNdi43AABYnDuFPIUZaDPKgCg0SploNAqAKDSKuQhb3QAoO8igANkZWxwcnZ3AAYVEBUbFSEVRBVlFYQV4SFycgABbHIMFQ4VAKA4KQCgNSlwAhYVAAAAABkVcgAAoN4iYwAAoN8i4SFycnCgtiEAoD0pgKIqImJjZG9zACsVMBU6FT4VQRVyImNhcAAAoEgqAAFhdTQVNxVwAACgRipwAACgSipvAHQAAKCNInIAAKBFKgDgKiIA/gACYWxydksVURVuFXMVcgByAG2gtyEAoDwpeQCAAWV2dwBYFWUVaRVxAHACXxUAAAAAYxVyAGUA4wAXFXUA4wAZFWUAZQAAoM4iZSJkZ2UAAKDPImUAbgA7gKQApEBlI2Fycm93AAABbHJ7FX8V5SFmdACgtiFpImdodAAAoLchZQDkAG0VAAFjaYsVkRVvAG4AaQBuAPQAkwFuAHQAAKAxImwiY3R5AACgLSOACUFIYWJjZGVmaGlqbG9yc3R1d3oAuBW7Fb8V1RXgFegV+RUKFhUWHxZUFlcWZRbFFtsW7xb7FgUXChdyAPIAtAJhAHIAAKBlKQACZ2xyc8YVyhXOFdAV5yFlcgCgICDlIXRoAKA4IfIA9QxoAHagECAAoKMiawHZFd4VYSJyb3cAAKAPKWEA4wBfAgABYXnkFecV8iFvbg9hNGQAoUYhYW/tFfQVAAFnciEC8RVyAACgyiF0InNlcQAAoHcqgAFnbG0A/xUCFgUWO4CwALBAdABhALRjcCJ0eXYAAKCxKQABaXIOFhIW8yFodACgfykA4DXYId1hAHIAAAFschsWHRYAoMMhAKDCIYACYWVnc3YAKBauAjYWOhY+Fm0AAKHEIm9zLhY0Fm4AZABzoMQi9SFpdACgZiZhIm1tYQDdY2kAbgAAoPIiAKH3AGlvQxZRFmQAZQAAgfcAO29KFksW90BuI3RpbWVzAACgxyJuAPgAUBZjAHkAUmRjAG8CXhYAAAAAYhZyAG4AAKAeI28AcAAAoA0jgAJscHR1dwBuFnEWdRaSFp4W7CFhciRgZgAA4DXYVd0AotkCZW1wc30WhBaJFo0WcQBkoFAibwB0AACgUSJpIm51cwAAoDgi7CF1cwCgFCLxInVhcmUAoKEiYgBsAGUAYgBhAHIAdwBlAGQAZwDlANcAbgCAAWFkaAClFqoWtBZyAHIAbwD3APUMbwB3AG4AYQByAHIAbwB3APMA8xVhI3Jwb29uAAABbHK8FsAWZQBmAPQAHBZpAGcAaAD0AB4WYgHJFs8WawBhAHIAbwD3AJILbwLUFgAAAADYFnIAbgAAoB8jbwBwAACgDCOAAWNvdADhFukW7BYAAXJ55RboFgDgNdi53FVkbAAAoPYp8iFvaxFhAAFkcvMW9xZvAHQAAKDxImkA5qC/JVsSAAFhaP8WAhdyAPIANQNhAPIA1wvhIm5nbGUAoKYpAAFjaQ4XEBd5AF9k5yJyYXJyAKD/JwAJRGFjZGVmZ2xtbm9wcXJzdHV4MRc4F0YXWxcyBF4XaRd5F40XrBe0F78X2RcVGCEYLRg1GEAYAAFEbzUXgRZvAPQA+BUAAWNzPBdCF3UAdABlADuA6QDpQPQhZXIAoG4qAAJhaW95TRdQF1YXWhfyIW9uG2FyAGOgViI7gOoA6kDsIW9uAKBVIk1kbwB0ABdhAAFEcmIXZhdvAHQAAKBSIgDgNdgi3XKhmipuF3QXYQB2AGUAO4DoAOhAZKCWKm8AdAAAoJgqgKGZKmlscwCAF4UXhxfuInRlcnMAoOcjAKATIWSglSpvAHQAAKCXKoABYXBzAJMXlheiF2MAcgATYXQAeQBzogUinxcAAAAAoRdlAHQAAKAFInAAMaADIDMBqRerFwCgBCAAoAUgAAFnc7AXsRdLYXAAAKACIAABZ3C4F7sXbwBuABlhZgAA4DXYVt2AAWFscwDFF8sXzxdyAHOg1SJsAACg4yl1AHMAAKBxKmkAAKG1A2x21RfYF28AbgC1Y/VjAAJjc3V24BfoF/0XEBgAAWlv5BdWF3IAYwAAoFYiaQLuFwAAAADwF+0ADQThIW50AAFnbPUX+Rd0AHIAAKCWKuUhc3MAoJUqgAFhZWkAAxgGGAoYbABzAD1gcwB0AACgXyJ2AESgYSJEAACgeCrwImFyc2wAoOUpAAFEYRkYHRhvAHQAAKBTInIAcgAAoHEpgAFjZGkAJxgqGO0XcgAAoC8hbwD0AIwCAAFhaDEYMhi3YzuA8ADwQAABbXI5GD0YbAA7gOsA60BvAACgrCCAAWNpcABGGEgYSxhsACFgcwD0ACwEAAFlb08YVxhjAHQAYQB0AGkAbwDuABoEbgBlAG4AdABpAGEAbADlADME4Ql1GAAAgRgAAIMYiBgAAAAAoRilGAAAqhgAALsYvhjRGAAA1xgnGWwAbABpAG4AZwBkAG8AdABzAGUA8QBlF3kARGRtImFsZQAAoEAmgAFpbHIAjRiRGJ0Y7CFpZwCgA/tpApcYAAAAAJoYZwAAoAD7aQBnAACgBPsA4DXYI93sIWlnAKAB++whaWcA4GYAagCAAWFsdACvGLIYthh0AACgbSZpAGcAAKAC+24AcwAAoLElbwBmAJJh8AHCGAAAxhhmAADgNdhX3QABYWvJGMwYbADsAGsEdqDUIgCg2SphI3J0aW50AACgDSoAAWFv2hgiGQABY3PeGB8ZsQPnGP0YBRkSGRUZAAAdGbID7xjyGPQY9xj5GAAA+xg7gL0AvUAAoFMhO4C8ALxAAKBVIQCgWSEAoFshswEBGQAAAxkAoFQhAKBWIbQCCxkOGQAAAAAQGTuAvgC+QACgVyEAoFwhNQAAoFghtgEZGQAAGxkAoFohAKBdITgAAKBeIWwAAKBEIHcAbgAAoCIjYwByAADgNdi73IAIRWFiY2RlZmdpamxub3JzdHYARhlKGVoZXhlmGWkZkhmWGZkZnRmgGa0ZxhnLGc8Z4BkjGmygZyIAoIwqgAFjbXAAUBlTGVgZ9SF0ZfVhbQBhAOSgswM6FgCghipyImV2ZQAfYQABaXliGWUZcgBjAB1hM2RvAHQAIWGAoWUibHFzAMYEcBl6GfGhZSLOBAAAdhlsAGEAbgD0AN8EgKF+KmNkbACBGYQZjBljAACgqSpvAHQAb6CAKmyggioAoIQqZeDbIgD+cwAAoJQqcgAA4DXYJN3noGsirATtIWVsAKA3IWMAeQBTZIChdyJFYWoApxmpGasZAKCSKgCgpSoAoKQqAAJFYWVztBm2Gb0ZwhkAoGkicABwoIoq8iFveACgiipxoIgq8aCIKrUZaQBtAACg5yJwAGYAAOA12FjdYQB2AOUAYwIAAWNp0xnWGXIAAKAKIW0AAKFzImVs3BneGQCgjioAoJAqAIM+ADtjZGxxco0E6xn0GfgZ/BkBGgABY2nvGfEZAKCnKnIAAKB6Km8AdAAAoNci0CFhcgCglSl1ImVzdAAAoHwqgAJhZGVscwAKGvQZFhrVBCAa8AEPGgAAFBpwAHIAbwD4AFkZcgAAoHgpcQAAAWxxxAQbGmwAZQBzAPMASRlpAO0A5AQAAWVuJxouGnIjdG5lcXEAAOBpIgD+xQAsGgAFQWFiY2Vma29zeUAaQxpmGmoabRqDGocalhrCGtMacgDyAMwCAAJpbG1yShpOGlAaVBpyAHMA8ABxD2YAvWBpAGwA9AASBQABZHJYGlsaYwB5AEpkAKGUIWN3YBpkGmkAcgAAoEgpAKCtIWEAcgAAoA8h6SFyYyVhgAFhbHIAcxp7Gn8a8iF0c3WgZSZpAHQAAKBlJuwhaXAAoCYg4yFvbgCguSJyAADgNdgl3XMAAAFld4wakRphInJvdwAAoCUpYSJyb3cAAKAmKYACYW1vcHIAnxqjGqcauhq+GnIAcgAAoP8h9CFodACgOyJrAAABbHKsGrMaZSRmdGFycm93AACgqSHpJGdodGFycm93AKCqIWYAAOA12Fnd4iFhcgCgFSCAAWNsdADIGswa0BpyAADgNdi93GEAcwDoAGka8iFvaydhAAFicNca2xr1IWxsAKBDIOghZW4AoBAg4Qr2GgAA/RoAAAgbExsaGwAAIRs7GwAAAAA+G2IbmRuVG6sbAACyG80b0htjAHUAdABlADuA7QDtQAChYyBpeQEbBhtyAGMAO4DuAO5AOGQAAWN4CxsNG3kANWRjAGwAO4ChAKFAAAFmcssCFhsA4DXYJt1yAGEAdgBlADuA7ADsQIChSCFpbm8AJxsyGzYbAAFpbisbLxtuAHQAAKAMKnQAAKAtIuYhaW4AoNwpdABhAACgKSHsIWlnM2GAAWFvcABDG1sbXhuAAWNndABJG0sbWRtyACthgAFlbHAAcQVRG1UbaQBuAOUAyAVhAHIA9AByBWgAMWFmAACgtyJlAGQAtWEAoggiY2ZvdGkbbRt1G3kb4SFyZQCgBSFpAG4AdKAeImkAZQAAoN0pZABvAPQAWxsAoisiY2VscIEbhRuPG5QbYQBsAACguiIAAWdyiRuNG2UAcgDzACMQ4wCCG2EicmhrAACgFyryIW9kAKA8KgACY2dwdJ8boRukG6gbeQBRZG8AbgAvYWYAAOA12FrdYQC5Y3UAZQBzAHQAO4C/AL9AAAFjabUbuRtyAADgNdi+3G4AAKIIIkVkc3bCG8QbyBvQAwCg+SJvAHQAAKD1Inag9CIAoPMiaaBiIOwhZGUpYesB1hsAANkbYwB5AFZkbAA7gO8A70AAA2NmbW9zdeYb7hvyG/Ub+hsFHAABaXnqG+0bcgBjADVhOWRyAADgNdgn3eEhdGg3YnAAZgAA4DXYW93jAf8bAAADHHIAAOA12L/c8iFjeVhk6yFjeVRkAARhY2ZnaGpvcxUcGhwiHCYcKhwtHDAcNRzwIXBhdqC6A/BjAAFleR4cIRzkIWlsN2E6ZHIAAOA12CjdciJlZW4AOGFjAHkARWRjAHkAXGRwAGYAAOA12FzdYwByAADgNdjA3IALQUJFSGFiY2RlZmdoamxtbm9wcnN0dXYAXhxtHHEcdRx5HN8cBx0dHTwd3B3tHfEdAR4EHh0eLB5FHrwewx7hHgkfPR9LH4ABYXJ0AGQcZxxpHHIA8gBvB/IAxQLhIWlsAKAbKeEhcnIAoA4pZ6BmIgCgiyphAHIAAKBiKWMJjRwAAJAcAACVHAAAAAAAAAAAAACZHJwcAACmHKgcrRwAANIc9SF0ZTph7SJwdHl2AKC0KXIAYQDuAFoG4iFkYbtjZwAAoegnZGyhHKMcAKCRKeUAiwYAoIUqdQBvADuAqwCrQHIAgKOQIWJmaGxwc3QAuhy/HMIcxBzHHMoczhxmoOQhcwAAoB8pcwAAoB0p6wCyGnAAAKCrIWwAAKA5KWkAbQAAoHMpbAAAoKIhAKGrKmFl1hzaHGkAbAAAoBkpc6CtKgDgrSoA/oABYWJyAOUc6RztHHIAcgAAoAwpcgBrAACgcicAAWFr8Rz4HGMAAAFla/Yc9xx7YFtgAAFlc/wc/hwAoIspbAAAAWR1Ax0FHQCgjykAoI0pAAJhZXV5Dh0RHRodHB3yIW9uPmEAAWRpFR0YHWkAbAA8YewAowbiAPccO2QAAmNxcnMkHScdLB05HWEAAKA2KXUAbwDyoBwgqhEAAWR1MB00HeghYXIAoGcpcyJoYXIAAKBLKWgAAKCyIQCiZCJmZ3FzRB1FB5Qdnh10AIACYWhscnQATh1WHWUdbB2NHXIicm93AHSgkCFhAOkAzxxhI3Jwb29uAAABZHVeHWId7yF3bgCgvSFwAACgvCHlJGZ0YXJyb3dzAKDHIWkiZ2h0AIABYWhzAHUdex2DHXIicm93APOglCGdBmEAcgBwAG8AbwBuAPMAzgtxAHUAaQBnAGEAcgByAG8A9wBlGugkcmVldGltZXMAoMsi8aFkIk0HAACaHWwAYQBuAPQAXgcAon0qY2Rnc6YdqR2xHbcdYwAAoKgqbwB0AG+gfypyoIEqAKCDKmXg2iIA/nMAAKCTKoACYWRlZ3MAwB3GHcod1h3ZHXAAcAByAG8A+ACmHG8AdAAAoNYicQAAAWdxzx3SHXQA8gBGB2cAdADyAHQcdADyAFMHaQDtAGMHgAFpbHIA4h3mHeod8yFodACgfClvAG8A8gDKBgDgNdgp3UWgdiIAoJEqYQH1Hf4dcgAAAWR1YB35HWygvCEAoGopbABrAACghCVjAHkAWWQAomoiYWNodAweDx4VHhkecgDyAGsdbwByAG4AZQDyAGAW4SFyZACgaylyAGkAAKD6JQABaW8hHiQe5CFvdEBh9SFzdGGgsCPjIWhlAKCwIwACRWFlczMeNR48HkEeAKBoInAAcKCJKvIhb3gAoIkqcaCHKvGghyo0HmkAbQAAoOYiAARhYm5vcHR3elIeXB5fHoUelh6mHqsetB4AAW5yVh5ZHmcAAKDsJ3IAAKD9IXIA6wCwBmcAgAFsbXIAZh52Hnse5SFmdAABYXKIB2weaQBnAGgAdABhAHIAcgBvAPcAkwfhInBzdG8AoPwnaQBnAGgAdABhAHIAcgBvAPcAmgdwI2Fycm93AAABbHKNHpEeZQBmAPQAxhxpImdodAAAoKwhgAFhZmwAnB6fHqIecgAAoIUpAOA12F3ddQBzAACgLSppIm1lcwAAoDQqYQGvHrMecwB0AACgFyLhAIoOZaHKJbkeRhLuIWdlAKDKJWEAcgBsoCgAdAAAoJMpgAJhY2htdADMHs8e1R7bHt0ecgDyAJ0GbwByAG4AZQDyANYWYQByAGSgyyEAoG0pAKAOIHIAaQAAoL8iAANhY2hpcXTrHu8e1QfzHv0eBh/xIXVvAKA5IHIAAOA12MHcbQDloXIi+h4AAPweAKCNKgCgjyoAAWJ19xwBH28AcqAYIACgGiDyIW9rQmEAhDwAO2NkaGlscXJCBhcfxh0gHyQfKB8sHzEfAAFjaRsfHR8AoKYqcgAAoHkqcgBlAOUAkx3tIWVzAKDJIuEhcnIAoHYpdSJlc3QAAKB7KgABUGk1HzkfYQByAACglillocMlAgdfEnIAAAFkdUIfRx9zImhhcgAAoEop6CFhcgCgZikAAWVuTx9WH3IjdG5lcXEAAOBoIgD+xQBUHwAHRGFjZGVmaGlsbm9wc3VuH3Ifoh+rH68ftx+7H74f5h/uH/MfBwj/HwsgxCFvdACgOiIAAmNscHJ5H30fiR+eH3IAO4CvAK9AAAFldIEfgx8AoEImZaAgJ3MAZQAAoCAnc6CmIXQAbwCAoaYhZGx1AJQfmB+cH28AdwDuAHkDZQBmAPQA6gbwAOkO6yFlcgCgriUAAW95ph+qH+0hbWEAoCkqPGThIXNoAKAUIOElc3VyZWRhbmdsZQCgISJyAADgNdgq3W8AAKAnIYABY2RuAMQfyR/bH3IAbwA7gLUAtUBhoiMi0B8AANMf1x9zAPQAKxFpAHIAAKDwKm8AdAA7gLcAt0B1AHMA4qESIh4TAADjH3WgOCIAoCoqYwHqH+0fcAAAoNsq8gB+GnAAbAB1APMACAgAAWRw9x/7H+UhbHMAoKciZgAA4DXYXt0AAWN0AyAHIHIAAOA12MLc8CFvcwCgPiJsobwDECAVIPQiaW1hcACguCJhAPAAEyAADEdMUlZhYmNkZWZnaGlqbG1vcHJzdHV2dzwgRyBmIG0geSCqILgg2iDeIBEhFSEyIUMhTSFQIZwhnyHSIQAiIyKLIrEivyIUIwABZ3RAIEMgAODZIjgD9uBrItIgBwmAAWVsdABNIF8gYiBmAHQAAAFhclMgWCByInJvdwAAoM0h6SRnaHRhcnJvdwCgziEA4NgiOAP24Goi0iBfCekkZ2h0YXJyb3cAoM8hAAFEZHEgdSDhIXNoAKCvIuEhc2gAoK4igAJiY25wdACCIIYgiSCNIKIgbABhAACgByL1IXRlRGFnAADgICLSIACiSSJFaW9wlSCYIJwgniAA4HAqOANkAADgSyI4A3MASWFyAG8A+AAyCnUAcgBhoG4mbADzoG4mmwjzAa8gAACzIHAAO4CgAKBAbQBwAOXgTiI4AyoJgAJhZW91eQDBIMogzSDWINkg8AHGIAAAyCAAoEMqbwBuAEhh5CFpbEZhbgBnAGSgRyJvAHQAAOBtKjgDcAAAoEIqPWThIXNoAKATIACjYCJBYWRxc3jpIO0g+SD+IAIhDCFyAHIAAKDXIXIAAAFocvIg9SBrAACgJClvoJch9wAGD28AdAAA4FAiOAN1AGkA9gC7CAABZWkGIQohYQByAACgKCntAN8I6SFzdPOgBCLlCHIAAOA12CvdAAJFZXN0/wgcISshLiHxoXEiIiEAABMJ8aFxIgAJAAAnIWwAYQBuAPQAEwlpAO0AGQlyoG8iAKBvIoABQWFwADghOyE/IXIA8gBeIHIAcgAAoK4hYQByAACg8ipzogsiSiEAAAAAxwtkoPwiAKD6ImMAeQBaZIADQUVhZGVzdABcIV8hYiFmIWkhkyGWIXIA8gBXIADgZiI4A3IAcgAAoJohcgAAoCUggKFwImZxcwBwIYQhjiF0AAABYXJ1IXohcgByAG8A9wBlIWkAZwBoAHQAYQByAHIAbwD3AD4h8aFwImAhAACKIWwAYQBuAPQAZwlz4H0qOAMAoG4iaQDtAG0JcqBuImkA5aDqIkUJaQDkADoKAAFwdKMhpyFmAADgNdhf3YCBrAA7aW4AriGvIcchrEBuAIChCSJFZHYAtyG6Ib8hAOD5IjgDbwB0AADg9SI4A+EB1gjEIcYhAKD3IgCg9iJpAHagDCLhAagJzyHRIQCg/iIAoP0igAFhb3IA2CHsIfEhcgCAoSYiYXN0AOAh5SHpIWwAbABlAOwAywhsAADg/SrlIADgAiI4A2wiaW50AACgFCrjoYAi9yEAAPohdQDlAJsJY+CvKjgDZaCAIvEAkwkAAkFhaXQHIgoiFyIeInIA8gBsIHIAcgAAoZshY3cRIhQiAOAzKTgDAOCdITgDZyRodGFycm93AACgmyFyAGkA5aDrIr4JgANjaGltcHF1AC8iPCJHIpwhTSJQIloigKGBImNlcgA2Iv0JOSJ1AOUABgoA4DXYw9zvIXJ0bQKdIQAAAABEImEAcgDhAOEhbQBloEEi8aBEIiYKYQDyAMsIcwB1AAABYnBWIlgi5QDUCeUA3wmAAWJjcABgInMieCKAoYQiRWVzAGci7glqIgDgxSo4A2UAdABl4IIi0iBxAPGgiCJoImMAZaCBIvEA/gmAoYUiRWVzAH8iFgqCIgDgxio4A2UAdABl4IMi0iBxAPGgiSKAIgACZ2lscpIilCKaIpwi7AAMCWwAZABlADuA8QDxQOcAWwlpI2FuZ2xlAAABbHKkIqoi5SFmdGWg6iLxAEUJaSJnaHQAZaDrIvEAvgltoL0DAKEjAGVzuCK8InIAbwAAoBYhcAAAoAcggARESGFkZ2lscnMAziLSItYi2iLeIugi7SICIw8j4SFzaACgrSLhIXJyAKAEKXAAAOBNItIg4SFzaACgrCIAAWV04iLlIgDgZSLSIADgPgDSIG4iZmluAACg3imAAUFldADzIvci+iJyAHIAAKACKQDgZCLSIHLgPADSIGkAZQAA4LQi0iAAAUF0BiMKI3IAcgAAoAMp8iFpZQDgtSLSIGkAbQAA4Dwi0iCAAUFhbgAaIx4jKiNyAHIAAKDWIXIAAAFociMjJiNrAACgIylvoJYh9wD/DuUhYXIAoCcpUxJqFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVCMAAF4jaSN/I4IjjSOeI8AUAAAAAKYjwCMAANoj3yMAAO8jHiQvJD8kRCQAAWNzVyNsFHUAdABlADuA8wDzQAABaXlhI2cjcgBjoJoiO4D0APRAPmSAAmFiaW9zAHEjdCN3I3EBeiNzAOgAdhTsIWFjUWF2AACgOCrvIWxkAKC8KewhaWdTYQABY3KFI4kjaQByAACgvykA4DXYLN1vA5QjAAAAAJYjAACcI24A22JhAHYAZQA7gPIA8kAAoMEpAAFibaEjjAphAHIAAKC1KQACYWNpdKwjryO6I70jcgDyAFkUAAFpcrMjtiNyAACgvinvIXNzAKC7KW4A5QDZCgCgwCmAAWFlaQDFI8gjyyNjAHIATWFnAGEAyWOAAWNkbgDRI9Qj1iPyIW9uv2MAoLYpdQDzAHgBcABmAADgNdhg3YABYWVsAOQj5yPrI3IAAKC3KXIAcAAAoLkpdQDzAHwBAKMoImFkaW9zdvkj/CMPJBMkFiQbJHIA8gBeFIChXSplZm0AAyQJJAwkcgBvoDQhZgAAoDQhO4CqAKpAO4C6ALpA5yFvZgCgtiJyAACgVipsIm9wZQAAoFcqAKBbKoABY2xvACMkJSQrJPIACCRhAHMAaAA7gPgA+EBsAACgmCJpAGwBMyQ4JGQAZQA7gPUA9UBlAHMAYaCXInMAAKA2Km0AbAA7gPYA9kDiIWFyAKA9I+EKXiQAAHokAAB8JJQkAACYJKkkAAAAALUkEQsAAPAkAAAAAAQleiUAAIMlcgCAoSUiYXN0AGUkbyQBCwCBtgA7bGokayS2QGwAZQDsABgDaQJ1JAAAAAB4JG0AAKDzKgCg/Sp5AD9kcgCAAmNpbXB0AIUkiCSLJJkSjyRuAHQAJWBvAGQALmBpAGwAAKAwIOUhbmsAoDEgcgAA4DXYLd2AAWltbwCdJKAkpCR2oMYD1WNtAGEA9AD+B24AZQAAoA4m9KHAA64kAAC0JGMjaGZvcmsAAKDUItZjAAFhdbgkxCRuAAABY2u9JMIkawBooA8hAKAOIfYAaRpzAACkKwBhYmNkZW1zdNMkIRPXJNsk4STjJOck6yTjIWlyAKAjKmkAcgAAoCIqAAFvdYsW3yQAoCUqAKByKm4AO4CxALFAaQBtAACgJip3AG8AAKAnKoABaXB1APUk+iT+JO4idGludACgFSpmAADgNdhh3W4AZAA7gKMAo0CApHoiRWFjZWlub3N1ABMlFSUYJRslTCVRJVklSSV1JQCgsypwAACgtyp1AOUAPwtjoK8qgKJ6ImFjZW5zACclLSU0JTYlSSVwAHAAcgBvAPgAFyV1AHIAbAB5AGUA8QA/C/EAOAuAAWFlcwA8JUElRSXwInByb3gAoLkqcQBxAACgtSppAG0AAKDoImkA7QBEC20AZQDzoDIgIguAAUVhcwBDJVclRSXwAEAlgAFkZnAATwtfJXElgAFhbHMAZSVpJW0l7CFhcgCgLiPpIW5lAKASI/UhcmYAoBMjdKAdIu8AWQvyIWVsAKCwIgABY2l9JYElcgAA4DXYxdzIY24iY3NwAACgCCAAA2Zpb3BzdZElKxuVJZolnyWkJXIAAOA12C7dcABmAADgNdhi3XIiaW1lAACgVyBjAHIAAOA12MbcgAFhZW8AqiW6JcAldAAAAWVpryW2JXIAbgBpAG8AbgDzABkFbgB0AACgFipzAHQAZaA/APEACRj0AG0LgApBQkhhYmNkZWZoaWxtbm9wcnN0dXgA4yXyJfYl+iVpJpAmpia9JtUm5ib4JlonaCdxJ3UnnietJ7EnyCfiJ+cngAFhcnQA6SXsJe4lcgDyAJkM8gD6AuEhaWwAoBwpYQByAPIA3BVhAHIAAKBkKYADY2RlbnFydAAGJhAmEyYYJiYmKyZaJgABZXUKJg0mAOA9IjEDdABlAFVhaQDjACAN7SJwdHl2AKCzKWcAgKHpJ2RlbAAgJiImJCYAoJIpAKClKeUA9wt1AG8AO4C7ALtAcgAApZIhYWJjZmhscHN0dz0mQCZFJkcmSiZMJk4mUSZVJlgmcAAAoHUpZqDlIXMAAKAgKQCgMylzAACgHinrALka8ACVHmwAAKBFKWkAbQAAoHQpbAAAoKMhAKCdIQABYWleJmImaQBsAACgGilvAG6gNiJhAGwA8wB2C4ABYWJyAG8mciZ2JnIA8gAvEnIAawAAoHMnAAFha3omgSZjAAABZWt/JoAmfWBdYAABZXOFJocmAKCMKWwAAAFkdYwmjiYAoI4pAKCQKQACYWV1eZcmmiajJqUm8iFvbllhAAFkaZ4moSZpAGwAV2HsAA8M4gCAJkBkAAJjbHFzrSawJrUmuiZhAACgNylkImhhcgAAoGkpdQBvAPKgHSCjAWgAAKCzIYABYWNnAMMm0iaUC2wAgKEcIWlwcwDLJs4migxuAOUAoAxhAHIA9ADaC3QAAKCtJYABaWxyANsm3ybjJvMhaHQAoH0pbwBvAPIANgwA4DXYL90AAWFv6ib1JnIAAAFkde8m8SYAoMEhbKDAIQCgbCl2oMED8WOAAWducwD+Jk4nUCdoAHQAAANhaGxyc3QKJxInISc1Jz0nRydyInJvdwB0oJIhYQDpAFYmYSNycG9vbgAAAWR1GiceJ28AdwDuAPAmcAAAoMAh5SFmdAABYWgnJy0ncgByAG8AdwDzAAkMYQByAHAAbwBvAG4A8wATBGklZ2h0YXJyb3dzAACgySFxAHUAaQBnAGEAcgByAG8A9wBZJugkcmVldGltZXMAoMwiZwDaYmkAbgBnAGQAbwB0AHMAZQDxABwYgAFhaG0AYCdjJ2YncgDyAAkMYQDyABMEAKAPIG8idXN0AGGgsSPjIWhlAKCxI+0haWQAoO4qAAJhYnB0fCeGJ4knmScAAW5ygCeDJ2cAAKDtJ3IAAKD+IXIA6wAcDIABYWZsAI8nkieVJ3IAAKCGKQDgNdhj3XUAcwAAoC4qaSJtZXMAAKA1KgABYXCiJ6gncgBnoCkAdAAAoJQp7yJsaW50AKASKmEAcgDyADwnAAJhY2hxuCe8J6EMwCfxIXVvAKA6IHIAAOA12MfcAAFidYAmxCdvAPKgGSCoAYABaGlyAM4n0ifWJ3IAZQDlAE0n7SFlcwCgyiJpAIChuSVlZmwAXAxjEt4n9CFyaQCgzinsInVoYXIAoGgpAKAeIWENBSgJKA0oSyhVKIYoAACLKLAoAAAAAOMo5ygAABApJCkxKW0pcSmHKaYpAACYKgAAAACxKmMidXRlAFthcQB1AO8ABR+ApHsiRWFjZWlucHN5ABwoHignKCooLygyKEEoRihJKACgtCrwASMoAAAlKACguCpvAG4AYWF1AOUAgw1koLAqaQBsAF9hcgBjAF1hgAFFYXMAOCg6KD0oAKC2KnAAAKC6KmkAbQAAoOki7yJsaW50AKATKmkA7QCIDUFkbwB0AGKixSKRFgAAAABTKACgZiqAA0FhY21zdHgAYChkKG8ocyh1KHkogihyAHIAAKDYIXIAAAFocmkoayjrAJAab6CYIfcAzAd0ADuApwCnQGkAO2D3IWFyAKApKW0AAAFpbn4ozQBuAHUA8wDOAHQAAKA2J3IA7+A12DDdIxkAAmFjb3mRKJUonSisKHIAcAAAoG8mAAFoeZkonChjAHkASWRIZHIAdABtAqUoAAAAAKgoaQDkAFsPYQByAGEA7ABsJDuArQCtQAABZ22zKLsobQBhAAChwwNmdroouijCY4CjPCJkZWdsbnByAMgozCjPKNMo1yjaKN4obwB0AACgairxoEMiCw5FoJ4qAKCgKkWgnSoAoJ8qZQAAoEYi7CF1cwCgJCrhIXJyAKByKWEAcgDyAPwMAAJhZWl07Sj8KAEpCCkAAWxz8Sj4KGwAcwBlAHQAbQDpAH8oaABwAACgMyrwImFyc2wAoOQpAAFkbFoPBSllAACgIyNloKoqc6CsKgDgrCoA/oABZmxwABUpGCkfKfQhY3lMZGKgLwBhoMQpcgAAoD8jZgAA4DXYZN1hAAABZHIoKRcDZQBzAHWgYCZpAHQAAKBgJoABY3N1ADYpRilhKQABYXU6KUApcABzoJMiAOCTIgD+cABzoJQiAOCUIgD+dQAAAWJwSylWKQChjyJlcz4NUCllAHQAZaCPIvEAPw0AoZAiZXNIDVspZQB0AGWgkCLxAEkNAKGhJWFmZilbBHIAZQFrKVwEAKChJWEAcgDyAAMNAAJjZW10dyl7KX8pgilyAADgNdjI3HQAbQDuAM4AaQDsAAYpYQByAOYAVw0AAWFyiimOKXIA5qAGJhESAAFhbpIpoylpImdodAAAAWVwmSmgKXAAcwBpAGwAbwDuANkXaADpAKAkcwCvYIACYmNtbnAArin8KY4NJSooKgCkgiJFZGVtbnByc7wpvinCKcgpzCnUKdgp3CkAoMUqbwB0AACgvSpkoIYibwB0AACgwyr1IWx0AKDBKgABRWXQKdIpAKDLKgCgiiLsIXVzAKC/KuEhcnIAoHkpgAFlaXUA4inxKfQpdAAAoYIiZW7oKewpcQDxoIYivSllAHEA8aCKItEpbQAAoMcqAAFicPgp+ikAoNUqAKDTKmMAgKJ7ImFjZW5zAAcqDSoUKhYqRihwAHAAcgBvAPgAIyh1AHIAbAB5AGUA8QCDDfEAfA2AAWFlcwAcKiIqPShwAHAAcgBvAPgAPChxAPEAOShnAACgaiYApoMiMTIzRWRlaGxtbnBzPCo/KkIqRSpHKlIqWCpjKmcqaypzKncqO4C5ALlAO4CyALJAO4CzALNAAKDGKgABb3NLKk4qdAAAoL4qdQBiAACg2CpkoIcibwB0AACgxCpzAAABb3VdKmAqbAAAoMknYgAAoNcq4SFycgCgeyn1IWx0AKDCKgABRWVvKnEqAKDMKgCgiyLsIXVzAKDAKoABZWl1AH0qjCqPKnQAAKGDImVugyqHKnEA8aCHIkYqZQBxAPGgiyJwKm0AAKDIKgABYnCTKpUqAKDUKgCg1iqAAUFhbgCdKqEqrCpyAHIAAKDZIXIAAAFocqYqqCrrAJUab6CZIfcAxQf3IWFyAKAqKWwAaQBnADuA3wDfQOELzyrZKtwq6SrsKvEqAAD1KjQrAAAAAAAAAAAAAEwrbCsAAHErvSsAAAAAAADRK3IC1CoAAAAA2CrnIWV0AKAWI8RjcgDrAOUKgAFhZXkA4SrkKucq8iFvbmVh5CFpbGNhQmRvAPQAIg5sInJlYwAAoBUjcgAA4DXYMd0AAmVpa2/7KhIrKCsuK/IBACsAAAkrZQAAATRm6g0EK28AcgDlAOsNYQBzorgDECsAAAAAEit5AG0A0WMAAWNuFislK2sAAAFhcxsrIStwAHAAcgBvAPgAFw5pAG0AAKA8InMA8AD9DQABYXMsKyEr8AAXDnIAbgA7gP4A/kDsATgrOyswG2QA5QBnAmUAcwCAgdcAO2JkAEMrRCtJK9dAYaCgInIAAKAxKgCgMCqAAWVwcwBRK1MraSvhAAkh4qKkIlsrXysAAAAAYytvAHQAAKA2I2kAcgAAoPEqb+A12GXdcgBrAACg2irhAHgociJpbWUAAKA0IIABYWlwAHYreSu3K2QA5QC+DYADYWRlbXBzdACFK6MrmiunK6wrsCuzK24iZ2xlAACitSVkbHFykCuUK5ornCvvIXduAKC/JeUhZnRloMMl8QACBwCgXCJpImdodABloLkl8QBdDG8AdAAAoOwlaSJudXMAAKA6KuwhdXMAoDkqYgAAoM0p6SFtZQCgOyrlInppdW0AoOIjgAFjaHQAwivKK80rAAFyecYrySsA4DXYydxGZGMAeQBbZPIhb2tnYQABaW/UK9creAD0ANERaCJlYWQAAAFsct4r5ytlAGYAdABhAHIAcgBvAPcAXQbpJGdodGFycm93AKCgIQAJQUhhYmNkZmdobG1vcHJzdHV3CiwNLBEsHSwnLDEsQCxLLFIsYix6LIQsjyzLLOgs7Sz/LAotcgDyAAkDYQByAACgYykAAWNyFSwbLHUAdABlADuA+gD6QPIACQ1yAOMBIywAACUseQBeZHYAZQBtYQABaXkrLDAscgBjADuA+wD7QENkgAFhYmgANyw6LD0scgDyANEO7CFhY3FhYQDyAOAOAAFpckQsSCzzIWh0AKB+KQDgNdgy3XIAYQB2AGUAO4D5APlAYQFWLF8scgAAAWxyWixcLACgvyEAoL4hbABrAACggCUAAWN0Zix2LG8CbCwAAAAAcyxyAG4AZaAcI3IAAKAcI28AcAAAoA8jcgBpAACg+CUAAWFsfiyBLGMAcgBrYTuAqACoQAABZ3CILIssbwBuAHNhZgAA4DXYZt0AA2FkaGxzdZksniynLLgsuyzFLHIAcgBvAPcACQ1vAHcAbgBhAHIAcgBvAPcA2A5hI3Jwb29uAAABbHKvLLMsZQBmAPQAWyxpAGcAaAD0AF0sdQDzAKYOaQAAocUDaGzBLMIs0mNvAG4AxWPwI2Fycm93cwCgyCGAAWNpdADRLOEs5CxvAtcsAAAAAN4scgBuAGWgHSNyAACgHSNvAHAAAKAOI24AZwBvYXIAaQAAoPklYwByAADgNdjK3IABZGlyAPMs9yz6LG8AdAAAoPAi7CFkZWlhaQBmoLUlAKC0JQABYW0DLQYtcgDyAMosbAA7gPwA/EDhIm5nbGUAoKcpgAdBQkRhY2RlZmxub3Byc3oAJy0qLTAtNC2bLZ0toS2/LcMtxy3TLdgt3C3gLfwtcgDyABADYQByAHag6CoAoOkqYQBzAOgA/gIAAW5yOC08LechcnQAoJwpgANla25wcnN0AJkpSC1NLVQtXi1iLYItYQBwAHAA4QAaHG8AdABoAGkAbgDnAKEXgAFoaXIAoSmzJFotbwBwAPQAdCVooJUh7wD4JgABaXVmLWotZwBtAOEAuygAAWJwbi14LXMjZXRuZXEAceCKIgD+AODLKgD+cyNldG5lcQBx4IsiAP4A4MwqAP4AAWhyhi2KLWUAdADhABIraSNhbmdsZQAAAWxyki2WLeUhZnQAoLIiaSJnaHQAAKCzInkAMmThIXNoAKCiIoABZWxyAKcttC24LWKiKCKuLQAAAACyLWEAcgAAoLsicQAAoFoi7CFpcACg7iIAAWJ0vC1eD2EA8gBfD3IAAOA12DPddAByAOkAlS1zAHUAAAFicM0t0C0A4IIi0iAA4IMi0iBwAGYAAOA12GfdcgBvAPAAWQt0AHIA6QCaLQABY3XkLegtcgAA4DXYy9wAAWJw7C30LW4AAAFFZXUt8S0A4IoiAP5uAAABRWV/LfktAOCLIgD+6SJnemFnAKCaKYADY2Vmb3BycwANLhAuJS4pLiMuLi40LukhcmN1YQABZGkULiEuAAFiZxguHC5hAHIAAKBfKmUAcaAnIgCgWSLlIXJwAKAYIXIAAOA12DTdcABmAADgNdho3WWgQCJhAHQA6ABqD2MAcgAA4DXYzNzjCuQRUC4AAFQuAABYLmIuAAAAAGMubS5wLnQuAAAAAIguki4AAJouJxIqEnQAcgDpAB0ScgAA4DXYNd0AAUFhWy5eLnIA8gDnAnIA8gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg");var xt;(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"})(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={"&":"&","<":"<",">":">",'"':"""};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>
|
|
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
|
+
`:`<br>
|
|
10
|
+
`};Ut.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
|
|
11
|
+
`:`<br>
|
|
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?`>
|
|
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("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',"""),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,{})})}));
|