vibora 4.7.2 → 4.7.3

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.
@@ -22,13 +22,13 @@ Error generating stack: `+A.message+`
22
22
  `:"",w=x&&!x.startsWith(`
23
23
  `)?`
24
24
  `:"",C=v+T+E+w+x;t(C)}else t(e+(e?`
25
- `:"")+E)}catch(E){kt.error("Failed to upload image"),At.kanban.error("Upload error",{error:String(E)})}finally{s(!1)}return}}};return b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"relative",children:[b.jsx(_M,{ref:o,value:e,onChange:f=>t(f.target.value),onPaste:u,className:Be(a&&"opacity-50",n),disabled:a||r,...i}),a&&b.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50 rounded-md",children:b.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})})]}),l.length>0&&b.jsx("div",{className:"flex flex-wrap gap-2",children:l.map((f,d)=>b.jsx("a",{href:fz(f),target:"_blank",rel:"noopener noreferrer",className:"block",children:b.jsx("img",{src:fz(f),alt:`Attachment ${d+1}`,className:"h-16 w-auto rounded border object-cover hover:opacity-80 transition-opacity"})},d))})]})}function Ute({className:e,...t}){return b.jsx("label",{"data-slot":"label",className:Be("gap-2 text-xs/relaxed leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed",e),...t})}const $te=k.forwardRef(function(t,n){const{className:r,render:i,orientation:a="horizontal",...s}=t,o=k.useMemo(()=>({orientation:a}),[a]);return xt("div",t,{state:o,ref:n,props:[{role:"separator","aria-orientation":a},s]})});function oEe({className:e,orientation:t="horizontal",...n}){return b.jsx($te,{"data-slot":"separator",orientation:t,className:Be("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",e),...n})}function mf({className:e,...t}){return b.jsx("div",{"data-slot":"field-group",className:Be("gap-4 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4 group/field-group @container/field-group flex w-full flex-col",e),...t})}const lEe=Xc("data-[invalid=true]:text-destructive gap-2 group/field flex w-full",{variants:{orientation:{vertical:"flex-col [&>*]:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center [&>[data-slot=field-label]]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto @md/field-group:[&>[data-slot=field-label]]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function ir({className:e,orientation:t="vertical",...n}){return b.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:Be(lEe({orientation:t}),e),...n})}function ar({className:e,...t}){return b.jsx(Ute,{"data-slot":"field-label",className:Be("has-data-checked:bg-primary/5 dark:has-data-checked:bg-primary/10 gap-2 group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-2 group/field-label peer/field-label flex w-fit leading-snug","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...t})}function Ya({className:e,...t}){return b.jsx("p",{"data-slot":"field-description",className:Be("text-muted-foreground text-left text-xs/relaxed [[data-variant=legend]+&]:-mt-1.5 leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance","last:mt-0 nth-last-2:-mt-1","[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",e),...t})}function zte(e){const t=k.useRef(!0);t.current&&(t.current=!1,e())}const Hte=k.createContext(null),Wte=k.createContext(null);function ml(){const e=k.useContext(Hte);if(e===null)throw new Error(an(60));return e}function Vte(){const e=k.useContext(Wte);if(e===null)throw new Error(an(61));return e}const Gte=(e,t)=>Object.is(e,t);function vu(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Jd(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:vu(r,t,n))}function Bp(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:vu(r,t,n))}function qte(e,t,n){return e.filter(r=>!vu(r,t,n))}function nD(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Kte(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Qr(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 nD(e)}function to(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?nD(e.value):nD(e)}function uEe(e,t,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]??Qr(e,n);if(Array.isArray(t)){const r=Kte(t)?t.flatMap(i=>i.items):t;if(e==null){const i=r.find(a=>a.value==null);return i&&i.label!=null?i.label:Qr(e,n)}if(typeof e!="object"){const i=r.find(a=>a&&a.value===e);return i&&i.label!=null?i.label:Qr(e,n)}if("value"in e){const i=r.find(a=>a&&a.value===e.value);if(i&&i.label!=null)return i.label}}return Qr(e,n)}function cEe(e,t){return!Array.isArray(e)||e.length===0?"":e.map(n=>Qr(n,t)).join(", ")}const Vt={id:Ue(e=>e.id),modal:Ue(e=>e.modal),multiple:Ue(e=>e.multiple),items:Ue(e=>e.items),itemToStringLabel:Ue(e=>e.itemToStringLabel),itemToStringValue:Ue(e=>e.itemToStringValue),isItemEqualToValue:Ue(e=>e.isItemEqualToValue),value:Ue(e=>e.value),open:Ue(e=>e.open),mounted:Ue(e=>e.mounted),forceMount:Ue(e=>e.forceMount),transitionStatus:Ue(e=>e.transitionStatus),openMethod:Ue(e=>e.openMethod),activeIndex:Ue(e=>e.activeIndex),selectedIndex:Ue(e=>e.selectedIndex),isActive:Ue((e,t)=>e.activeIndex===t),isSelected:Ue((e,t,n)=>{const r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(a=>vu(a,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:vu(i,n,r)}),isSelectedByFocus:Ue((e,t)=>e.selectedIndex===t),popupProps:Ue(e=>e.popupProps),triggerProps:Ue(e=>e.triggerProps),triggerElement:Ue(e=>e.triggerElement),positionerElement:Ue(e=>e.positionerElement),listElement:Ue(e=>e.listElement),scrollUpArrowVisible:Ue(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Ue(e=>e.scrollDownArrowVisible),hasScrollArrows:Ue(e=>e.hasScrollArrows),serializedValue:Ue(e=>{const{multiple:t,value:n,itemToStringValue:r}=e;return t&&Array.isArray(n)&&n.length===0?"":to(n,r)})};function ef(e,t){const n=k.useRef(e),r=Xe(t);Je(()=>{n.current!==e&&r(n.current)},[e,r]),Je(()=>{n.current=e},[e])}function dEe(e){const{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:s=!1,onOpenChange:o,name:l,disabled:u=!1,readOnly:f=!1,required:d=!1,modal:p=!0,actionsRef:m,inputRef:E,onOpenChangeComplete:S,items:g,multiple:y=!1,itemToStringLabel:v,itemToStringValue:x,isItemEqualToValue:T=Gte,highlightItemOnHover:w=!0,children:C}=e,{clearErrors:R}=Zy(),{setDirty:O,shouldValidateOnChange:N,validityData:D,setFilled:L,name:z,disabled:M,validation:V}=Bs(),{controlId:H}=nd(),B=Qx({id:t}),q=M||u,K=z??l,[U,j]=ts({controlled:n,default:y?r??ta:r,name:"Select",state:"value"}),[$,Y]=ts({controlled:a,default:s,name:"Select",state:"open"}),W=k.useRef([]),J=k.useRef([]),ae=k.useRef(null),se=k.useRef(null),Q=k.useRef(0),G=k.useRef(null),Z=k.useRef([]),ee=k.useRef(!1),ne=k.useRef(!1),te=k.useRef(null),ye=k.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),Ee=k.useRef(!1),{mounted:pe,setMounted:_e,transitionStatus:Se}=To($),{openMethod:Te,triggerProps:de,reset:Ce}=Xx($),ge=pi(()=>new pf({id:B,modal:p,multiple:y,itemToStringLabel:v,itemToStringValue:x,isItemEqualToValue:T,value:U,open:$,mounted:pe,transitionStatus:Se,items:g,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,he=Ye(ge,Vt.activeIndex),ce=Ye(ge,Vt.selectedIndex),Ne=Ye(ge,Vt.triggerElement),Pe=Ye(ge,Vt.positionerElement),ve=k.useMemo(()=>y&&Array.isArray(U)&&U.length===0?"":to(U,x),[y,U,x]),Le=k.useMemo(()=>y&&Array.isArray(U)?U.map(yt=>to(yt,x)):to(U,x),[y,U,x]),Ae=lr(ge.state.triggerElement);Qy({id:B,commit:V.commit,value:U,controlRef:Ae,name:K,getValue:()=>Le});const Ve=k.useRef(U);Je(()=>{U!==Ve.current&&ge.set("forceMount",!0)},[ge,U]),Je(()=>{L(U!==null)},[U,L]),Je(function(){if($)return;const Ut=Z.current;if(y){const Ht=Array.isArray(U)?U:[];if(Ht.length===0){ge.set("selectedIndex",null);return}const ft=Ht[Ht.length-1],yn=Bp(Ut,ft,T);ge.set("selectedIndex",yn===-1?null:yn);return}const $t=Bp(Ut,U,T);ge.set("selectedIndex",$t===-1?null:$t)},[y,$,U,Z,T,ge]),ef(U,()=>{R(K),O(U!==D.initialValue),N()?V.commit(U):V.commit(U,!0)});const Ze=Xe((yt,Ut)=>{if(o?.(yt,Ut),!Ut.isCanceled&&(Y(yt),!yt&&ge.state.activeIndex!==null)){const $t=W.current[ge.state.activeIndex];queueMicrotask(()=>{$t?.setAttribute("tabindex","-1")})}}),gt=Xe(()=>{_e(!1),ge.set("activeIndex",null),Ce(),S?.(!1)});Oi({enabled:!m,open:$,ref:ae,onComplete(){$||gt()}}),k.useImperativeHandle(m,()=>({unmount:gt}),[gt]);const st=Xe((yt,Ut)=>{i?.(yt,Ut),!Ut.isCanceled&&j(yt)}),ot=Xe(()=>{const yt=ge.state.listElement||ae.current;if(!yt)return;const Ut=yt.scrollTop,$t=yt.scrollTop+yt.clientHeight,Ht=Ut>1,ft=$t<yt.scrollHeight-1;ge.state.scrollUpArrowVisible!==Ht&&ge.set("scrollUpArrowVisible",Ht),ge.state.scrollDownArrowVisible!==ft&&ge.set("scrollDownArrowVisible",ft)}),Fe=Fx({open:$,onOpenChange:Ze,elements:{reference:Ne,floating:Pe}}),ht=Nm(Fe,{enabled:!f&&!q,event:"mousedown"}),Ie=Im(Fe,{bubbles:!1}),ze=lM(Fe,{enabled:!f&&!q,listRef:W,activeIndex:he,selectedIndex:ce,disabledIndices:ta,onNavigate(yt){yt===null&&!$||ge.set("activeIndex",yt)},focusItemOnHover:!1}),et=uM(Fe,{enabled:!f&&!q&&($||!y),listRef:J,activeIndex:he,selectedIndex:ce,onMatch(yt){$?ge.set("activeIndex",yt):st(Z.current[yt],it("none"))},onTypingChange(yt){ee.current=yt}}),{getReferenceProps:lt,getFloatingProps:pt,getItemProps:bn}=Jc([ht,Ie,ze,et]),Bt=k.useMemo(()=>ol(lt(),de),[lt,de]);zte(()=>{ge.update({popupProps:pt(),triggerProps:Bt})}),Je(()=>{ge.update({id:B,modal:p,multiple:y,value:U,open:$,mounted:pe,transitionStatus:Se,popupProps:pt(),triggerProps:Bt,items:g,itemToStringLabel:v,itemToStringValue:x,isItemEqualToValue:T,openMethod:Te})},[ge,B,p,y,U,$,pe,Se,pt,Bt,g,v,x,T,Te]);const It=k.useMemo(()=>({store:ge,name:K,required:d,disabled:q,readOnly:f,multiple:y,itemToStringLabel:v,itemToStringValue:x,highlightItemOnHover:w,setValue:st,setOpen:Ze,listRef:W,popupRef:ae,scrollHandlerRef:se,handleScrollArrowVisibility:ot,scrollArrowsMountedCountRef:Q,getItemProps:bn,events:Fe.context.events,valueRef:G,valuesRef:Z,labelsRef:J,typingRef:ee,selectionRef:ye,selectedItemTextRef:te,validation:V,onOpenChangeComplete:S,keyboardActiveRef:ne,alignItemWithTriggerActiveRef:Ee,initialValueRef:Ve}),[ge,K,d,q,f,y,v,x,w,st,Ze,bn,Fe.context.events,V,S,ot]),ct=Fs(E,V.inputRef),nn=y&&Array.isArray(U)&&U.length>0,Pt=k.useMemo(()=>!y||!Array.isArray(U)||!K?null:U.map(yt=>{const Ut=to(yt,x);return b.jsx("input",{type:"hidden",name:K,value:Ut},Ut)}),[y,U,K,x]);return b.jsx(Hte.Provider,{value:It,children:b.jsxs(Wte.Provider,{value:Fe,children:[C,b.jsx("input",{...V.getInputValidationProps({onFocus(){ge.state.triggerElement?.focus()},onChange(yt){if(yt.nativeEvent.defaultPrevented)return;const Ut=yt.target.value,$t=it(Dr,yt.nativeEvent);function Ht(){if(y)return;const ft=Z.current.find(yn=>to(yn,x).toLowerCase()===Ut.toLowerCase());ft!=null&&(O(ft!==D.initialValue),st(ft,$t),N()&&V.commit(ft))}ge.set("forceMount",!0),queueMicrotask(Ht)}}),id:t||H||void 0,name:y?void 0:K,value:ve,disabled:q,required:d&&!nn,readOnly:f,ref:ct,style:Rm,tabIndex:-1,"aria-hidden":!0}),Pt]})})}function EM(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),r=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||r.content!=="none"))return t;const a=parseFloat(n.width)||0,s=parseFloat(n.height)||0,o=parseFloat(r.width)||0,l=parseFloat(r.height)||0,u=Math.max(t.width,a,o),f=Math.max(t.height,s,l),d=u-t.width,p=f-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const __=2,fEe={...Mp,...Kf,value:()=>null},hEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,...o}=t,{setTouched:l,setFocused:u,validationMode:f,state:d,disabled:p}=Bs(),{labelId:m}=nd(),{store:E,setOpen:S,selectionRef:g,validation:y,readOnly:v,alignItemWithTriggerActiveRef:x,disabled:T,keyboardActiveRef:w}=ml(),C=p||T||a,R=Ye(E,Vt.open),O=Ye(E,Vt.value),N=Ye(E,Vt.triggerProps),D=Ye(E,Vt.positionerElement),L=Ye(E,Vt.listElement),z=Ye(E,Vt.serializedValue),M=lr(D),V=k.useRef(null),H=Pn(),B=Pn(),{getButtonProps:q,buttonRef:K}=sa({disabled:C,native:s}),U=Xe(se=>{E.set("triggerElement",se)}),j=Fs(n,V,K,U),$=Pn(),Y=Pn();k.useEffect(()=>{if(R)return Y.start(200,()=>{g.current.allowUnselectedMouseUp=!0,$.start(200,()=>{g.current.allowSelectedMouseUp=!0})}),()=>{$.clear(),Y.clear()};g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},B.clear()},[R,g,B,$,Y]);const W=k.useMemo(()=>L?.id??_v(D)?.id,[L,D]),J=ol(N,{role:"combobox","aria-expanded":R?"true":"false","aria-haspopup":"listbox","aria-controls":R?W:void 0,"aria-labelledby":m,"aria-readonly":v||void 0,tabIndex:C?-1:0,ref:j,onFocus(se){u(!0),R&&x.current&&S(!1,it(ho,se.nativeEvent)),H.start(0,()=>{E.set("forceMount",!0)})},onBlur(){l(!0),u(!1),f==="onBlur"&&y.commit(O)},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(se){if(R)return;const Q=ki(se.currentTarget);function G(Z){if(!V.current)return;const ee=Z.target;if(Tt(V.current,ee)||Tt(M.current,ee)||ee===V.current)return;const ne=EM(V.current);Z.clientX>=ne.left-__&&Z.clientX<=ne.right+__&&Z.clientY>=ne.top-__&&Z.clientY<=ne.bottom+__||S(!1,it(Tee,Z))}B.start(0,()=>{Q.addEventListener("mouseup",G,{once:!0})})}},y.getValidationProps,o,q);J.role="combobox";const ae=k.useMemo(()=>({...d,open:R,disabled:C,value:O,readOnly:v,placeholder:!z}),[d,R,C,O,v,z]);return xt("button",t,{ref:[n,V],state:ae,stateAttributesMapping:fEe,props:J})}),pEe={value:()=>null},mEe=k.forwardRef(function(t,n){const{className:r,render:i,children:a,...s}=t,{store:o,valueRef:l}=ml(),u=Ye(o,Vt.value),f=Ye(o,Vt.items),d=Ye(o,Vt.itemToStringLabel),p=Ye(o,Vt.serializedValue),m=k.useMemo(()=>({value:u,placeholder:!p}),[u,p]),E=typeof a=="function"?a(u):a??(Array.isArray(u)?cEe(u,d):uEe(u,f,d));return xt("span",t,{state:m,ref:[n,l],props:[{children:E},s],stateAttributesMapping:pEe})}),gEe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,{store:s}=ml(),o=Ye(s,Vt.open),l=k.useMemo(()=>({open:o}),[o]);return xt("span",t,{state:l,ref:n,props:[{"aria-hidden":!0,children:"▼"},a],stateAttributesMapping:zx})}),bEe=k.createContext(void 0),vEe=k.forwardRef(function(t,n){const{store:r}=ml(),i=Ye(r,Vt.mounted),a=Ye(r,Vt.forceMount);return i||a?b.jsx(bEe.Provider,{value:!0,children:b.jsx(Hy,{ref:n,...t})}):null}),Yte=k.createContext(void 0);function SM(){const e=k.useContext(Yte);if(!e)throw new Error(an(59));return e}function GE(e,t){e&&Object.assign(e.style,t)}const Xte={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},yEe={position:"fixed"},_Ee=k.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:m=5,sticky:E=!1,disableAnchorTracking:S,alignItemWithTrigger:g=!0,collisionAvoidance:y=Nx,...v}=t,{store:x,listRef:T,labelsRef:w,alignItemWithTriggerActiveRef:C,selectedItemTextRef:R,valuesRef:O,initialValueRef:N,popupRef:D,setValue:L}=ml(),z=Vte(),M=Ye(x,Vt.open),V=Ye(x,Vt.mounted),H=Ye(x,Vt.modal),B=Ye(x,Vt.value),q=Ye(x,Vt.openMethod),K=Ye(x,Vt.positionerElement),U=Ye(x,Vt.triggerElement),j=Ye(x,Vt.isItemEqualToValue),$=k.useRef(null),Y=k.useRef(null),[W,J]=k.useState(g),ae=V&&W&&q!=="touch";!V&&W!==g&&J(g),Je(()=>{V||(Vt.scrollUpArrowVisible(x.state)&&x.set("scrollUpArrowVisible",!1),Vt.scrollDownArrowVisible(x.state)&&x.set("scrollDownArrowVisible",!1))},[x,V]),k.useImperativeHandle(C,()=>ae),Yx((ae||H)&&M&&q!=="touch",U);const se=Ky({anchor:r,floatingRootContext:z,positionMethod:i,mounted:V,side:o,sideOffset:u,align:l,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:E,disableAnchorTracking:S??ae,collisionAvoidance:y,keepMounted:!0}),Q=ae?"none":se.side,G=ae?yEe:se.positionerStyles,Z=k.useMemo(()=>{const _e={};return M||(_e.pointerEvents="none"),{role:"presentation",hidden:!V,style:{...G,..._e}}},[M,V,G]),ee=k.useMemo(()=>({open:M,side:Q,align:se.align,anchorHidden:se.anchorHidden}),[M,Q,se.align,se.anchorHidden]),ne=Xe(_e=>{x.set("positionerElement",_e)}),te=xt("div",t,{ref:[n,ne],state:ee,stateAttributesMapping:Oa,props:[Z,v]}),ye=k.useRef(0),Ee=Xe(_e=>{if(_e.size===0&&ye.current===0||O.current.length===0)return;const Se=ye.current;if(ye.current=_e.size,_e.size===Se)return;const Te=it(Dr);if(Se!==0&&!x.state.multiple&&B!==null&&Bp(O.current,B,j)===-1){const Ce=N.current,he=Ce!=null&&Jd(O.current,Ce,j)?Ce:null;L(he,Te),he===null&&(x.set("selectedIndex",null),R.current=null)}if(Se!==0&&x.state.multiple&&Array.isArray(B)){const de=B.filter(Ce=>Jd(O.current,Ce,j));(de.length!==B.length||de.some(Ce=>!Jd(B,Ce,j)))&&(L(de,Te),de.length===0&&(x.set("selectedIndex",null),R.current=null))}if(M&&ae){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const de={height:""};GE(K,de),GE(D.current,de)}}),pe=k.useMemo(()=>({...se,side:Q,alignItemWithTriggerActive:ae,setControlledAlignItemWithTrigger:J,scrollUpArrowRef:$,scrollDownArrowRef:Y}),[se,Q,ae,J]);return b.jsx(Vy,{elementsRef:T,labelsRef:w,onMapChange:Ee,children:b.jsxs(Yte.Provider,{value:pe,children:[V&&H&&b.jsx(Kx,{inert:Dm(!M),cutout:U}),te]})})});function Zte(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const E_="base-ui-disable-scrollbar",Iv={className:E_,element:b.jsx("style",{href:E_,precedence:"base-ui:low",children:`.${E_}{scrollbar-width:none}.${E_}::-webkit-scrollbar{display:none}`})},EEe=k.createContext(void 0);function xM(e){return k.useContext(EEe)}const SEe={...Oa,...ss},xEe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{store:s,popupRef:o,onOpenChangeComplete:l,setOpen:u,valueRef:f,selectedItemTextRef:d,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:E,scrollHandlerRef:S}=ml(),{side:g,align:y,alignItemWithTriggerActive:v,setControlledAlignItemWithTrigger:x,scrollDownArrowRef:T,scrollUpArrowRef:w}=SM(),C=xM()!=null,R=Vte(),O=Pn(),N=Ye(s,Vt.id),D=Ye(s,Vt.open),L=Ye(s,Vt.mounted),z=Ye(s,Vt.popupProps),M=Ye(s,Vt.transitionStatus),V=Ye(s,Vt.triggerElement),H=Ye(s,Vt.positionerElement),B=Ye(s,Vt.listElement),q=k.useRef(0),K=k.useRef(!1),U=k.useRef(0),j=k.useRef(!1),$=k.useRef({}),Y=su(),W=Xe(Q=>{if(!H||!o.current||!j.current)return;if(K.current||!v){E();return}const G=H.style.top==="0px",Z=H.style.bottom==="0px",ee=H.getBoundingClientRect().height,ne=ki(H),te=getComputedStyle(H),ye=parseFloat(te.marginTop),Ee=parseFloat(te.marginBottom),pe=ne.documentElement.clientHeight-ye-Ee,_e=Q.scrollTop,Se=Q.scrollHeight,Te=Q.clientHeight,de=Se-Te;let Ce=null,ge=null,he=!1;if(G){const ce=de-_e,Ne=ee+ce,Pe=Math.min(Ne,pe);Ce=Pe,Pe!==pe?ge=de:he=!0}else if(Z){const ce=_e-0,Ne=ee+ce,Pe=Math.min(Ne,pe),ve=Ne-pe;Ce=Pe,Pe!==pe?ge=0:(he=!0,_e<de&&(ge=_e-(ce-ve)))}Ce!=null&&(H.style.height=`${Ce}px`),ge!=null&&(Q.scrollTop=ge),he&&(K.current=!0),E()});k.useImperativeHandle(S,()=>W,[W]),Oi({open:D,ref:o,onComplete(){D&&l?.(!0)}});const J=k.useMemo(()=>({open:D,transitionStatus:M,side:g,align:y}),[D,M,g,y]);Je(()=>{!H||!o.current||Object.keys($.current).length||($.current={top:H.style.top||"0",left:H.style.left||"0",right:H.style.right,height:H.style.height,bottom:H.style.bottom,minHeight:H.style.minHeight,maxHeight:H.style.maxHeight,marginTop:H.style.marginTop,marginBottom:H.style.marginBottom})},[o,H]),Je(()=>{L||v||(j.current=!1,K.current=!1,q.current=0,U.current=0,GE(H,$.current))},[L,v,H,o]),Je(()=>{const Q=o.current;if(!(!L||!V||!H||!Q)){if(!v){j.current=!0,Y.request(E);return}queueMicrotask(()=>{const G=getComputedStyle(H),Z=getComputedStyle(Q),ee=ki(V),ne=Er(H),te=V.getBoundingClientRect(),ye=H.getBoundingClientRect(),Ee=te.left,pe=te.height,_e=B||Q,Se=_e.scrollHeight,Te=parseFloat(Z.borderBottomWidth),de=parseFloat(G.marginTop)||10,Ce=parseFloat(G.marginBottom)||10,ge=parseFloat(G.minHeight)||100,he=5,ce=5,Ne=20,Pe=ee.documentElement.clientHeight-de-Ce,ve=ee.documentElement.clientWidth,Le=Pe-te.bottom+pe,Ae=d.current,Ve=f.current;let Ze=0,gt=0;if(Ae&&Ve){const It=Ve.getBoundingClientRect(),ct=Ae.getBoundingClientRect(),nn=It.left-Ee,Pt=ct.left-ye.left,yt=It.top-te.top+It.height/2,Ut=ct.top-ye.top+ct.height/2;Ze=nn-Pt,gt=Ut-yt}const st=Le+gt+Ce+Te;let ot=Math.min(Pe,st);const Fe=Pe-de-Ce,ht=st-ot,Ie=Math.max(he,Ee+Ze),ze=ve-ce,et=Math.max(0,Ie+ye.width-ze);H.style.left=`${Ie-et}px`,H.style.height=`${ot}px`,H.style.maxHeight="auto",H.style.marginTop=`${de}px`,H.style.marginBottom=`${Ce}px`,Q.style.height="100%";const lt=_e.scrollHeight-_e.clientHeight,pt=ht>=lt;pt&&(ot=Math.min(Pe,ye.height)-(ht-lt));const bn=te.top<Ne||te.bottom>Pe-Ne||ot<Math.min(Se,ge),Bt=(ne.visualViewport?.scale??1)!==1&&$P;if(bn||Bt){j.current=!0,GE(H,$.current),xr.flushSync(()=>x(!1));return}if(pt){const It=Math.max(0,Pe-st);H.style.top=ye.height>=Fe?"0":`${It}px`,H.style.height=`${ot}px`,_e.scrollTop=_e.scrollHeight-_e.clientHeight,q.current=Math.max(ge,ot)}else H.style.bottom="0",q.current=Math.max(ge,ot),_e.scrollTop=ht;q.current===Pe&&(K.current=!0),E(),setTimeout(()=>{j.current=!0})})}},[s,L,H,V,f,d,o,E,v,x,Y,T,w,B]),k.useEffect(()=>{if(!v||!H||!L)return;const Q=Er(H);function G(Z){u(!1,it(Jve,Z))}return Q.addEventListener("resize",G),()=>{Q.removeEventListener("resize",G)}},[u,v,H,L]);const ae={...B?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(Q){p.current=!0,C&&dM.has(Q.key)&&Q.stopPropagation()},onMouseMove(){p.current=!1},onPointerLeave(Q){if(Zte(Q)||Q.pointerType==="touch")return;const G=Q.currentTarget;O.start(0,()=>{s.set("activeIndex",null),G.focus({preventScroll:!0})})},onScroll(Q){B||S.current?.(Q.currentTarget)},...v&&{style:B?{height:"100%"}:Xte}},se=xt("div",t,{ref:[n,o],state:J,stateAttributesMapping:SEe,props:[z,ae,Pm(M),{className:!B&&v?Iv.className:void 0},a]});return b.jsxs(k.Fragment,{children:[Iv.element,b.jsx(Lx,{context:R,modal:!1,disabled:!L,restoreFocus:!0,children:se})]})}),wEe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,{store:s,scrollHandlerRef:o}=ml(),{alignItemWithTriggerActive:l}=SM(),u=Ye(s,Vt.hasScrollArrows),f=Ye(s,Vt.openMethod),d=Ye(s,Vt.multiple),m={id:`${Ye(s,Vt.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(S){o.current?.(S.currentTarget)},...l&&{style:Xte},className:u&&f!=="touch"?Iv.className:void 0},E=Xe(S=>{s.set("listElement",S)});return xt("div",t,{ref:[n,E],props:[m,a]})}),Qte=k.createContext(void 0);function wM(){const e=k.useContext(Qte);if(!e)throw new Error(an(57));return e}const TEe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a=null,label:s,disabled:o=!1,nativeButton:l=!1,...u}=t,f=k.useRef(null),d=Lm({label:s,textRef:f,indexGuessBehavior:fM.GuessFromOrder}),{store:p,getItemProps:m,setOpen:E,setValue:S,selectionRef:g,typingRef:y,valuesRef:v,keyboardActiveRef:x,multiple:T,highlightItemOnHover:w}=ml(),C=Pn(),R=Ye(p,Vt.isActive,d.index),O=Ye(p,Vt.isSelected,d.index,a),N=Ye(p,Vt.isSelectedByFocus,d.index),D=Ye(p,Vt.isItemEqualToValue),L=d.index,z=L!==-1,M=k.useRef(null),V=lr(L);Je(()=>{if(!z)return;const se=v.current;return se[L]=a,()=>{delete se[L]}},[z,L,a,v]),Je(()=>{if(!z)return;const se=p.state.value;let Q=se;T&&Array.isArray(se)&&se.length>0&&(Q=se[se.length-1]),Q!==void 0&&vu(Q,a,D)&&p.set("selectedIndex",L)},[z,L,T,D,p,a]);const H=k.useMemo(()=>({disabled:o,selected:O,highlighted:R}),[o,O,R]),B=m({active:R,selected:O});B.onFocus=void 0,B.id=void 0;const q=k.useRef(null),K=k.useRef("mouse"),U=k.useRef(!1),{getButtonProps:j,buttonRef:$}=sa({disabled:o,focusableWhenDisabled:!0,native:l});function Y(se){const Q=p.state.value;if(T){const G=Array.isArray(Q)?Q:[],Z=O?qte(G,a,D):[...G,a];S(Z,it(ff,se))}else S(a,it(ff,se)),E(!1,it(ff,se))}const W={role:"option","aria-selected":O,"aria-disabled":o||void 0,tabIndex:R?0:-1,onFocus(){p.set("activeIndex",L)},onMouseEnter(){!x.current&&p.state.selectedIndex===null&&p.set("activeIndex",L)},onMouseMove(){w&&p.set("activeIndex",L)},onMouseLeave(se){!w||x.current||Zte(se)||C.start(0,()=>{p.state.activeIndex===L&&p.set("activeIndex",null)})},onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(se){q.current=se.key,p.set("activeIndex",L)},onClick(se){U.current=!1,!(se.type==="keydown"&&q.current===null)&&(o||q.current===" "&&y.current||K.current!=="touch"&&!R||(q.current=null,Y(se.nativeEvent)))},onPointerEnter(se){K.current=se.pointerType},onPointerDown(se){K.current=se.pointerType,U.current=!0},onMouseUp(se){if(o)return;if(U.current){U.current=!1;return}const Q=!g.current.allowSelectedMouseUp&&O,G=!g.current.allowUnselectedMouseUp&&!O;Q||G||K.current!=="touch"&&!R||Y(se.nativeEvent)}},J=xt("div",t,{ref:[$,n,d.ref,M],state:H,props:[B,W,u,j]}),ae=k.useMemo(()=>({selected:O,indexRef:V,textRef:f,selectedByFocus:N,hasRegistered:z}),[O,V,f,N,z]);return b.jsx(Qte.Provider,{value:ae,children:J})})),CEe=k.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=wM();return r||i?b.jsx(AEe,{...t,ref:n}):null}),AEe=k.memo(k.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...a}=e,{selected:s}=wM(),o=k.useRef(null),{transitionStatus:l,setMounted:u}=To(s),f=k.useMemo(()=>({selected:s,transitionStatus:l}),[s,l]),d=xt("span",e,{ref:[t,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:ss});return Oi({open:s,ref:o,onComplete(){s||u(!1)}}),d})),kEe=k.memo(k.forwardRef(function(t,n){const{indexRef:r,textRef:i,selectedByFocus:a,hasRegistered:s}=wM(),{selectedItemTextRef:o}=ml(),{className:l,render:u,...f}=t,d=k.useCallback(m=>{if(!m||!s)return;const E=o.current===null||!o.current.isConnected;(a||E&&r.current===0)&&(o.current=m)},[o,r,a,s]);return xt("div",t,{ref:[d,n,i],props:f})})),Jte=k.forwardRef(function(t,n){const{render:r,className:i,direction:a,keepMounted:s=!1,...o}=t,{store:l,popupRef:u,listRef:f,handleScrollArrowVisibility:d,scrollArrowsMountedCountRef:p}=ml(),{side:m,scrollDownArrowRef:E,scrollUpArrowRef:S}=SM(),g=a==="up"?Vt.scrollUpArrowVisible:Vt.scrollDownArrowVisible,y=Ye(l,g),v=Ye(l,Vt.openMethod),x=y&&v!=="touch",T=Pn(),w=a==="up"?S:E,{transitionStatus:C,setMounted:R}=To(x);Je(()=>(p.current+=1,l.state.hasScrollArrows||l.set("hasScrollArrows",!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set("hasScrollArrows",!1)}),[l,p]),Oi({open:x,ref:w,onComplete(){x||R(!1)}});const O=k.useMemo(()=>({direction:a,visible:x,side:m,transitionStatus:C}),[a,x,m,C]),D=xt("div",t,{ref:[n,w],state:O,props:[{"aria-hidden":!0,children:a==="up"?"▲":"▼",style:{position:"absolute"},onMouseMove(z){if(z.movementX===0&&z.movementY===0||T.isStarted())return;l.set("activeIndex",null);function M(){const V=l.state.listElement??u.current;if(!V)return;l.set("activeIndex",null),d();const H=V.scrollTop===0,B=Math.round(V.scrollTop+V.clientHeight)>=V.scrollHeight;if(f.current.length===0&&(a==="up"?l.set("scrollUpArrowVisible",!H):l.set("scrollDownArrowVisible",!B)),a==="up"&&H||a==="down"&&B){T.clear();return}if((l.state.listElement||u.current)&&f.current&&f.current.length>0){const K=f.current,U=w.current?.offsetHeight||0;if(a==="up"){let j=0;const $=V.scrollTop+U;for(let W=0;W<K.length;W+=1){const J=K[W];if(J&&J.offsetTop>=$){j=W;break}}const Y=Math.max(0,j-1);if(Y<j){const W=K[Y];W&&(V.scrollTop=Math.max(0,W.offsetTop-U))}else V.scrollTop=0}else{let j=K.length-1;const $=V.scrollTop+V.clientHeight-U;for(let W=0;W<K.length;W+=1){const J=K[W];if(J&&J.offsetTop+J.offsetHeight>$){j=Math.max(0,W-1);break}}const Y=Math.min(K.length-1,j+1);if(Y>j){const W=K[Y];W&&(V.scrollTop=W.offsetTop+W.offsetHeight-V.clientHeight+U)}else V.scrollTop=V.scrollHeight-V.clientHeight}}T.start(40,M)}T.start(40,M)},onMouseLeave(){T.clear()}},o]});return x||s?D:null}),OEe=k.forwardRef(function(t,n){return b.jsx(Jte,{...t,ref:n,direction:"down"})}),REe=k.forwardRef(function(t,n){return b.jsx(Jte,{...t,ref:n,direction:"up"})}),Bi=dEe;function Ui({className:e,...t}){return b.jsx(mEe,{"data-slot":"select-value",className:Be("flex flex-1 text-left",e),...t})}function $i({className:e,size:t="default",children:n,...r}){return b.jsxs(hEe,{"data-slot":"select-trigger","data-size":t,className:Be("border-input data-[placeholder]:text-muted-foreground bg-input/20 dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border px-2 py-1.5 text-xs/relaxed transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r,children:[n,b.jsx(gEe,{render:b.jsx(fe,{icon:Ste,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})})]})}function zi({className:e,children:t,side:n="bottom",sideOffset:r=4,align:i="center",alignOffset:a=0,alignItemWithTrigger:s=!0,...o}){return b.jsx(vEe,{children:b.jsx(_Ee,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:s,className:"isolate z-50",children:b.jsxs(xEe,{"data-slot":"select-content",className:Be("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-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 ring-foreground/10 min-w-32 rounded-lg shadow-md ring-1 duration-100 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto",e),...o,children:[b.jsx(NEe,{}),b.jsx(wEe,{children:t}),b.jsx(IEe,{})]})})})}function Cn({className:e,children:t,...n}){return b.jsxs(TEe,{"data-slot":"select-item",className:Be("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[b.jsx(kEe,{className:"flex flex-1 gap-2 shrink-0 whitespace-nowrap",children:t}),b.jsx(CEe,{render:b.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:b.jsx(fe,{icon:pl,strokeWidth:2,className:"pointer-events-none"})})]})}function NEe({className:e,...t}){return b.jsx(REe,{"data-slot":"select-scroll-up-button",className:Be("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5 top-0 w-full",e),...t,children:b.jsx(fe,{icon:mM,strokeWidth:2})})}function IEe({className:e,...t}){return b.jsx(OEe,{"data-slot":"select-scroll-down-button",className:Be("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5 bottom-0 w-full",e),...t,children:b.jsx(fe,{icon:Yy,strokeWidth:2})})}const ene=k.createContext(void 0);function TM(){const e=k.useContext(ene);if(e===void 0)throw new Error(an(64));return e}let DEe=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const CM={tabActivationDirection:e=>({[DEe.activationDirection]:e})},LEe=k.forwardRef(function(t,n){const{className:r,defaultValue:i=0,onValueChange:a,orientation:s="horizontal",render:o,value:l,...u}=t,f=Ou(),d=Object.hasOwn(t,"defaultValue"),p=k.useRef([]),[m,E]=k.useState(()=>new Map),[S,g]=ts({controlled:l,default:i,name:"Tabs",state:"value"}),y=l!==void 0,[v,x]=k.useState(()=>new Map),[T,w]=k.useState("none"),C=Xe((q,K)=>{a?.(q,K),!K.isCanceled&&(g(q),w(K.activationDirection))}),R=Xe((q,K)=>{E(U=>{if(U.get(q)===K)return U;const j=new Map(U);return j.set(q,K),j})}),O=Xe((q,K)=>{E(U=>{if(!U.has(q)||U.get(q)!==K)return U;const j=new Map(U);return j.delete(q),j})}),N=k.useCallback(q=>m.get(q),[m]),D=k.useCallback(q=>{for(const K of v.values())if(q===K?.value)return K?.id},[v]),L=k.useCallback(q=>{if(q===void 0)return null;for(const[K,U]of v.entries())if(U!=null&&q===(U.value??U.index))return K;return null},[v]),z=k.useMemo(()=>({direction:f,getTabElementBySelectedValue:L,getTabIdByPanelValue:D,getTabPanelIdByValue:N,onValueChange:C,orientation:s,registerMountedTabPanel:R,setTabMap:x,unregisterMountedTabPanel:O,tabActivationDirection:T,value:S}),[f,L,D,N,C,s,R,x,O,T,S]),M=k.useMemo(()=>{for(const q of v.values())if(q!=null&&q.value===S)return q},[v,S]),V=k.useMemo(()=>{for(const q of v.values())if(q!=null&&!q.disabled)return q.value},[v]);Je(()=>{if(y||v.size===0)return;const q=M?.disabled,K=M==null&&S!==null;if(d&&q&&S===i||!q&&!K)return;const j=V??null;S!==j&&(g(j),w("none"))},[i,V,d,y,M,w,g,v,S]);const B=xt("div",t,{state:{orientation:s,tabActivationDirection:T},ref:n,props:u,stateAttributesMapping:CM});return b.jsx(ene.Provider,{value:z,children:b.jsx(Vy,{elementsRef:p,children:B})})}),tne=k.createContext(void 0);function PEe(){const e=k.useContext(tne);if(e===void 0)throw new Error(an(65));return e}const MEe=k.forwardRef(function(t,n){const{className:r,disabled:i=!1,render:a,value:s,id:o,nativeButton:l=!0,...u}=t,{value:f,getTabPanelIdByValue:d,orientation:p}=TM(),{activateOnFocus:m,highlightedTabIndex:E,onTabActivation:S,setHighlightedTabIndex:g,tabsListElement:y}=PEe(),v=mi(o),x=k.useMemo(()=>({disabled:i,id:v,value:s}),[i,v,s]),{compositeProps:T,compositeRef:w,index:C}=rte({metadata:x}),R=s===f,O=k.useRef(!1);Je(()=>{if(O.current){O.current=!1;return}if(!(R&&C>-1&&E!==C))return;const U=y;if(U!=null){const j=As(ki(U));if(j&&Tt(U,j))return}i||g(C)},[R,C,E,g,i,y]);const{getButtonProps:N,buttonRef:D}=sa({disabled:i,native:l,focusableWhenDisabled:!0}),L=d(s),z=k.useRef(!1),M=k.useRef(!1);function V(U){R||i||S(s,it(Dr,U.nativeEvent,void 0,{activationDirection:"none"}))}function H(U){R||(C>-1&&!i&&g(C),!i&&m&&(!z.current||z.current&&M.current)&&S(s,it(Dr,U.nativeEvent,void 0,{activationDirection:"none"})))}function B(U){if(R||i)return;z.current=!0;function j(){z.current=!1,M.current=!1}(!U.button||U.button===0)&&(M.current=!0,ki(U.currentTarget).addEventListener("pointerup",j,{once:!0}))}const q=k.useMemo(()=>({disabled:i,active:R,orientation:p}),[i,R,p]);return xt("button",t,{state:q,ref:[n,D,w],props:[T,{role:"tab","aria-controls":L,"aria-selected":R,id:v,onClick:V,onFocus:H,onPointerDown:B,[Qee]:R?"":void 0,onKeyDownCapture(){O.current=!0}},u,N]})});let jEe=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const FEe=k.forwardRef(function(t,n){const{className:r,value:i,render:a,keepMounted:s=!1,...o}=t,{value:l,getTabIdByPanelValue:u,orientation:f,tabActivationDirection:d,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=TM(),E=mi(),S=k.useMemo(()=>({id:E,value:i}),[E,i]),{ref:g,index:y}=Lm({metadata:S}),v=i!==l,x=u(i),T=k.useMemo(()=>({hidden:v,orientation:f,tabActivationDirection:d}),[v,f,d]),w=xt("div",t,{state:T,ref:[n,g],props:[{"aria-labelledby":x,hidden:v,id:E??void 0,role:"tabpanel",tabIndex:v?-1:0,[jEe.index]:y},o],stateAttributesMapping:CM});return Je(()=>{if(!(v&&!s)&&E!=null)return p(i,E),()=>{m(i,E)}},[v,s,i,E,p,m]),!v||s?w:null}),BEe=k.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:i,loopFocus:a=!0,render:s,...o}=t,{getTabElementBySelectedValue:l,onValueChange:u,orientation:f,value:d,setTabMap:p,tabActivationDirection:m}=TM(),[E,S]=k.useState(0),[g,y]=k.useState(null),v=UEe(d,f,g,l),x=Xe((R,O)=>{if(R!==d){const N=v(R);O.activationDirection=N,u(R,O)}}),T=k.useMemo(()=>({orientation:f,tabActivationDirection:m}),[f,m]),w={"aria-orientation":f==="vertical"?"vertical":void 0,role:"tablist"},C=k.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:E,onTabActivation:x,setHighlightedTabIndex:S,tabsListElement:g,value:d}),[r,E,x,S,g,d]);return b.jsx(tne.Provider,{value:C,children:b.jsx($x,{render:s,className:i,state:T,refs:[n,y],props:[w,o],stateAttributesMapping:CM,highlightedIndex:E,enableHomeAndEndKeys:!0,loopFocus:a,orientation:f,onHighlightedIndexChange:S,onMapChange:p,disabledIndices:ta})})});function hz(e,t){const{left:n,top:r}=e.getBoundingClientRect(),{left:i,top:a}=t.getBoundingClientRect(),s=n-i,o=r-a;return{left:s,top:o}}function UEe(e,t,n,r){const[i,a]=k.useState(null);return Je(()=>{if(e==null||n==null){a(null);return}const s=r(e);if(s==null){a(null);return}const{left:o,top:l}=hz(s,n);a(t==="horizontal"?o:l)},[t,r,n,e]),k.useCallback(s=>{if(s===e)return"none";if(s==null)return a(null),"none";if(s!=null&&n!=null){const o=r(s);if(o!=null){const{left:l,top:u}=hz(o,n);if(i==null)return a(t==="horizontal"?l:u),"none";if(t==="horizontal"){if(l<i)return a(l),"left";if(l>i)return a(l),"right"}else{if(u<i)return a(u),"up";if(u>i)return a(u),"down"}}}return"none"},[r,t,i,n,e])}function Zo({className:e,orientation:t="horizontal",...n}){return b.jsx(LEe,{"data-slot":"tabs","data-orientation":t,className:Be("gap-2 group/tabs flex data-[orientation=horizontal]:flex-col",e),...n})}const $Ee=Xc("rounded-lg p-[3px] group-data-horizontal/tabs:h-8 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Qo({className:e,variant:t="default",...n}){return b.jsx(BEe,{"data-slot":"tabs-list","data-variant":t,className:Be($Ee({variant:t}),e),...n})}function Wr({className:e,...t}){return b.jsx(MEe,{"data-slot":"tabs-trigger",className:Be("gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-xs font-medium group-data-vertical/tabs:py-[calc(--spacing(1.25))] [&_svg:not([class*='size-'])]:size-3.5 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0","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 dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function ci({className:e,...t}){return b.jsx(FEe,{"data-slot":"tabs-content",className:Be("text-xs/relaxed flex-1 min-h-0 outline-none",e),...t})}function zEe(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:s,handle:o,triggerId:l,defaultTriggerId:u=null}=e,f=Ru(),d=!!f,p=pi(()=>o?.store??new Dte({open:n??r,activeTriggerId:l!==void 0?l:u,modal:!0,disablePointerDismissal:!0,nested:d,role:"alertdialog"})).current;p.useControlledProp("open",n,r),p.useControlledProp("activeTriggerId",l,u),p.useSyncedValue("nested",d),p.useContextCallback("onOpenChange",i),p.useContextCallback("onOpenChangeComplete",a);const m=p.useState("payload");Ite({store:p,actionsRef:s,parentContext:f?.store.context});const E=k.useMemo(()=>({store:p}),[p]);return b.jsx(yM.Provider,{value:E,children:typeof t=="function"?t({payload:m}):t})}const nne=k.createContext(void 0),rne=k.createContext(void 0),ine=k.createContext(void 0),ane=k.createContext("");function Nu(){const e=k.useContext(nne);if(!e)throw new Error(an(22));return e}function Jx(){const e=k.useContext(rne);if(!e)throw new Error(an(23));return e}function Yf(){const e=k.useContext(ine);if(!e)throw new Error(an(24));return e}function AM(){return k.useContext(ane)}const mt={id:Ue(e=>e.id),query:Ue(e=>e.query),items:Ue(e=>e.items),selectedValue:Ue(e=>e.selectedValue),open:Ue(e=>e.open),mounted:Ue(e=>e.mounted),forceMounted:Ue(e=>e.forceMounted),inline:Ue(e=>e.inline),activeIndex:Ue(e=>e.activeIndex),selectedIndex:Ue(e=>e.selectedIndex),isActive:Ue((e,t)=>e.activeIndex===t),isSelected:Ue((e,t)=>{const n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(i=>vu(i,t,n)):vu(r,t,n)}),transitionStatus:Ue(e=>e.transitionStatus),popupProps:Ue(e=>e.popupProps),inputProps:Ue(e=>e.inputProps),triggerProps:Ue(e=>e.triggerProps),getItemProps:Ue(e=>e.getItemProps),positionerElement:Ue(e=>e.positionerElement),listElement:Ue(e=>e.listElement),triggerElement:Ue(e=>e.triggerElement),inputElement:Ue(e=>e.inputElement),popupSide:Ue(e=>e.popupSide),openMethod:Ue(e=>e.openMethod),inputInsidePopup:Ue(e=>e.inputInsidePopup),selectionMode:Ue(e=>e.selectionMode),listRef:Ue(e=>e.listRef),labelsRef:Ue(e=>e.labelsRef),popupRef:Ue(e=>e.popupRef),emptyRef:Ue(e=>e.emptyRef),inputRef:Ue(e=>e.inputRef),keyboardActiveRef:Ue(e=>e.keyboardActiveRef),chipsContainerRef:Ue(e=>e.chipsContainerRef),clearRef:Ue(e=>e.clearRef),valuesRef:Ue(e=>e.valuesRef),allValuesRef:Ue(e=>e.allValuesRef),name:Ue(e=>e.name),disabled:Ue(e=>e.disabled),readOnly:Ue(e=>e.readOnly),required:Ue(e=>e.required),grid:Ue(e=>e.grid),isGrouped:Ue(e=>e.isGrouped),virtualized:Ue(e=>e.virtualized),onOpenChangeComplete:Ue(e=>e.onOpenChangeComplete),openOnInputClick:Ue(e=>e.openOnInputClick),itemToStringLabel:Ue(e=>e.itemToStringLabel),isItemEqualToValue:Ue(e=>e.isItemEqualToValue),modal:Ue(e=>e.modal),autoHighlight:Ue(e=>e.autoHighlight),submitOnItemClick:Ue(e=>e.submitOnItemClick)};function HEe(e,t){return(n,r)=>{if(n==null)return!1;const i=Qr(n,t);return e.contains(i,r)}}function WEe(e,t,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;const a=Qr(r,t),s=n!=null?Qr(n,t):"";return s&&e.contains(s,i)&&s.length===i.length?!0:e.contains(a,i)}}const pz=new Map;function sne(e){return Array.isArray(e)?e.map(t=>sne(t)).join(","):e==null?"":String(e)}function VEe(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},n=`${sne(e.locale)}|${JSON.stringify(t)}`,r=pz.get(n);if(r)return r;const i=new Intl.Collator(e.locale,t),a={contains(s,o,l){if(!o)return!0;const u=Qr(s,l);for(let f=0;f<=u.length-o.length;f+=1)if(i.compare(u.slice(f,f+o.length),o)===0)return!0;return!1},startsWith(s,o,l){if(!o)return!0;const u=Qr(s,l);return i.compare(u.slice(0,o.length),o)===0},endsWith(s,o,l){if(!o)return!0;const u=Qr(s,l),f=o.length;return u.length>=f&&i.compare(u.slice(u.length-f),o)===0}};return pz.set(n,a),a}const GEe=VEe,one=Symbol("none"),Ld={value:one,index:-1};function qEe(e){const{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:s,inputValue:o,selectionMode:l="none",onItemHighlighted:u,name:f,disabled:d=!1,readOnly:p=!1,required:m=!1,inputRef:E,grid:S=!1,items:g,filteredItems:y,filter:v,openOnInputClick:x=!0,autoHighlight:T=!1,keepHighlight:w=!1,highlightItemOnHover:C=!0,itemToStringLabel:R,itemToStringValue:O,isItemEqualToValue:N=Gte,virtualized:D=!1,inline:L=!1,fillInputOnItemPress:z=!0,modal:M=!1,limit:V=-1,autoComplete:H="list",locale:B,submitOnItemClick:q=!1}=e,{clearErrors:K}=Zy(),{setDirty:U,validityData:j,shouldValidateOnChange:$,setFilled:Y,name:W,disabled:J,validation:ae}=Bs(),se=Qx({id:t}),Q=GEe({locale:B}),[G,Z]=k.useState(!1),[ee,ne]=k.useState(null),te=k.useRef([]),ye=k.useRef([]),Ee=k.useRef(null),pe=k.useRef(null),_e=k.useRef(null),Se=k.useRef(!0),Te=k.useRef(!1),de=k.useRef(null),Ce=k.useRef(null),ge=k.useRef(null),he=k.useRef(Ld),ce=k.useRef(null),Ne=k.useRef([]),Pe=k.useRef([]),ve=J||d,Le=W??f,Ae=l==="multiple",Ve=l==="single",Ze=o!==void 0||s!==void 0,gt=g!==void 0,st=y!==void 0;let ot;T==="always"?ot="always":ot=T?"input-change":!1;const[Fe,ht]=ts({controlled:i,default:Ae?r??ta:r,name:"Combobox",state:"selectedValue"}),Ie=k.useMemo(()=>v===null?()=>!0:v!==void 0?v:Ve&&!G?WEe(Q,R,Fe):HEe(Q,R),[v,Ve,Fe,G,Q,R]),ze=pi(()=>Ze?s??"":Ve?Qr(Fe,R):"").current,[et,lt]=ts({controlled:o,default:ze,name:"Combobox",state:"inputValue"}),[pt,bn]=ts({controlled:e.open,default:e.defaultOpen,name:"Combobox",state:"open"}),Bt=Kte(g),It=ee??(et===""?"":String(et).trim()),ct=Ve?Qr(Fe,R):"",nn=Ve&&!G&&It!==""&&ct!==""&&ct.length===It.length&&Q.contains(ct,It),Pt=nn?"":It,yt=gt&&st&&nn,Ut=k.useMemo(()=>g?Bt?g.flatMap(dt=>dt.items):g:ta,[g,Bt]),$t=k.useMemo(()=>{if(y&&!yt)return y;if(!g)return ta;if(Bt){const Ct=g,Kt=[];let Kn=0;for(const vr of Ct){if(V>-1&&Kn>=V)break;const Mr=Pt===""?vr.items:vr.items.filter(Nl=>Ie(Nl,Pt,R));if(Mr.length===0)continue;const Ol=V>-1?V-Kn:1/0,Rl=Mr.slice(0,Ol);if(Rl.length>0){const Nl={...vr,items:Rl};Kt.push(Nl),Kn+=Rl.length}}return Kt}if(Pt==="")return V>-1?Ut.slice(0,V):Ut;const dt=[];for(const Ct of Ut){if(V>-1&&dt.length>=V)break;Ie(Ct,Pt,R)&&dt.push(Ct)}return dt},[y,yt,g,Bt,Pt,V,Ie,R,Ut]),Ht=k.useMemo(()=>Bt?$t.flatMap(Ct=>Ct.items):$t,[$t,Bt]),ft=pi(()=>new pf({id:se,selectedValue:Fe,open:pt,filter:Ie,query:It,items:g,selectionMode:l,listRef:te,labelsRef:ye,popupRef:Ee,emptyRef:_e,inputRef:pe,keyboardActiveRef:Se,chipsContainerRef:de,clearRef:Ce,valuesRef:Ne,allValuesRef:Pe,selectionEventRef:ge,name:Le,disabled:ve,readOnly:p,required:m,grid:S,isGrouped:Bt,virtualized:D,openOnInputClick:x,itemToStringLabel:R,isItemEqualToValue:N,modal:M,autoHighlight:ot,submitOnItemClick:q,hasInputValue:Ze,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:L,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:n||yr,setOpen:yr,setInputValue:yr,setSelectedValue:yr,setIndices:yr,onItemHighlighted:yr,handleSelection:yr,getItemProps:()=>Jn,forceMount:yr,requestSubmit:yr})).current,yn=l==="none"?et:Fe,mr=k.useMemo(()=>l==="none"?yn:Array.isArray(Fe)?Fe.map(dt=>to(dt,O)):to(Fe,O),[yn,O,l,Fe]),qr=Xe(u),Pr=Xe(n),Yi=Ye(ft,mt.activeIndex),Yt=Ye(ft,mt.selectedIndex),Di=Ye(ft,mt.positionerElement),gr=Ye(ft,mt.listElement),br=Ye(ft,mt.triggerElement),ls=Ye(ft,mt.inputElement),Xi=Ye(ft,mt.inline),Vs=Ye(ft,mt.inputInsidePopup),lg=lr(br),{mounted:hd,setMounted:wl,transitionStatus:Tl}=To(pt),{openMethod:Gs,triggerProps:us,reset:Cl}=Xx(pt);Qy({id:se,name:Le,commit:ae.commit,value:yn,controlRef:Vs?lg:pe,getValue:()=>mr});const Li=Xe(()=>{g?ye.current=Ht.map(dt=>Qr(dt,R)):ft.set("forceMounted",!0)}),Tr=k.useRef(Fe);Je(()=>{Fe!==Tr.current&&Li()},[Li,Fe]);const vi=Xe(dt=>{ft.update(dt);const Ct=dt.type||"none";if(dt.activeIndex!==void 0)if(dt.activeIndex===null)he.current!==Ld&&(he.current=Ld,qr(void 0,lb(Ct,void 0,{index:-1})));else{const Kt=Ne.current[dt.activeIndex];he.current={value:Kt,index:dt.activeIndex},qr(Kt,lb(Ct,void 0,{index:dt.activeIndex}))}}),Ge=Xe((dt,Ct)=>{if(Te.current=Ct.reason===bc,e.onInputValueChange?.(dt,Ct),!Ct.isCanceled){if(Ct.reason===Yd){const Kt=dt.trim()!=="";Kt&&Z(!0),ce.current={hasQuery:Kt},Kt&&ot&&ft.state.activeIndex==null&&ft.set("activeIndex",0)}lt(dt)}}),Nt=Xe((dt,Ct)=>{pt!==dt&&(Ct.reason==="escape-key"&&gt&&Ht.length===0&&!ft.state.emptyRef.current&&Ct.allowPropagation(),e.onOpenChange?.(dt,Ct),!Ct.isCanceled&&(!dt&&G&&(Ve?(ne(It),It===""&&Z(!1)):Ae&&(Xi||Vs?vi({activeIndex:null}):ne(It),Ge("",it(bc,Ct.event)))),bn(dt)))}),Cr=Xe((dt,Ct)=>{if(a?.(dt,Ct),Ct.isCanceled)return;ht(dt),(l==="none"&&Ee.current&&z||Ve&&!ft.state.inputInsidePopup)&&Ge(Qr(dt,R),it(Ct.reason,Ct.event)),Ve&&dt!=null&&Ct.reason!==Yd&&G&&ne(It)}),Al=Xe((dt,Ct)=>{let Kt=Ct;if(Kt===void 0){if(Yi===null)return;Kt=Ne.current[Yi]}const Kn=_r(dt),vr=ge.current??dt;ge.current=null;const Mr=it(ff,vr),Ol=Kn?.closest("a")?.getAttribute("href");if(Ol){Ol.startsWith("#")&&Nt(!1,Mr);return}if(Ae){const Rl=Array.isArray(Fe)?Fe:[],qs=Jd(Rl,Kt,ft.state.isItemEqualToValue)?qte(Rl,Kt,ft.state.isItemEqualToValue):[...Rl,Kt];if(Cr(qs,Mr),!(pe.current?pe.current.value.trim()!=="":!1))return;ft.state.inputInsidePopup?Ge("",it(bc,Mr.event)):Nt(!1,Mr)}else Cr(Kt,Mr),Nt(!1,Mr)}),Da=Xe(()=>{if(!ft.state.submitOnItemClick)return;const dt=ft.state.inputElement?.form;dt&&typeof dt.requestSubmit=="function"&&dt.requestSubmit()}),pd=Xe(()=>{if(wl(!1),Pr?.(!1),Z(!1),Cl(),ne(null),vi(l==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Ae&&pe.current&&pe.current.value!==""&&!Te.current&&Ge("",it(bc)),Ve)if(ft.state.inputInsidePopup)pe.current&&pe.current.value!==""&&Ge("",it(bc));else{const dt=Qr(Fe,R);pe.current&&pe.current.value!==dt&&Ge(dt,it(dt===""?bc:Dr))}}),DT=k.useMemo(()=>Xi&&Di?{current:Di.closest('[role="dialog"]')}:Ee,[Xi,Di]);Oi({enabled:!e.actionsRef,open:pt,ref:DT,onComplete(){pt||pd()}}),k.useImperativeHandle(e.actionsRef,()=>({unmount:pd}),[pd]),Je(function(){if(pt||l==="none")return;const Ct=g?Ut:Pe.current;if(Ae){const Kt=Array.isArray(Fe)?Fe:[],Kn=Kt[Kt.length-1],vr=Bp(Ct,Kn,N);vi({selectedIndex:vr===-1?null:vr})}else{const Kt=Bp(Ct,Fe,N);vi({selectedIndex:Kt===-1?null:Kt})}},[pt,Fe,g,l,Ut,Ae,N,vi]),Je(()=>{g&&(Ne.current=Ht,te.current.length=Ht.length)},[g,Ht]),Je(()=>{const dt=ce.current;if(dt&&(dt.hasQuery?ot&&ft.set("activeIndex",0):ot==="always"&&ft.set("activeIndex",0),ce.current=null),!pt&&!Xi)return;const Kt=gt||st?Ht:Ne.current,Kn=ft.state.activeIndex;if(Kn==null){if(ot==="always"&&Kt.length>0){ft.set("activeIndex",0);return}he.current!==Ld&&(he.current=Ld,ft.state.onItemHighlighted(void 0,lb(Dr,void 0,{index:-1})));return}if(Kn>=Kt.length){he.current!==Ld&&(he.current=Ld,ft.state.onItemHighlighted(void 0,lb(Dr,void 0,{index:-1}))),ft.set("activeIndex",null);return}const vr=Kt[Kn],Mr=he.current.value,Ol=Mr!==one&&ft.state.isItemEqualToValue(vr,Mr);(he.current.index!==Kn||!Ol)&&(he.current={value:vr,index:Kn},ft.state.onItemHighlighted(vr,lb(Dr,void 0,{index:Kn})))},[Yi,ot,st,gt,Ht,Xi,pt,ft]),Je(()=>{if(!g||l==="none")return;const dt=Ut;if(Ae){const Kn=Array.isArray(Fe)?Fe:ta,vr=Kn.filter(Mr=>Jd(dt,Mr,ft.state.isItemEqualToValue));vr.length!==Kn.length&&ht(vr);return}if(Fe==null?!0:Jd(dt,Fe,ft.state.isItemEqualToValue))return;let Kt=null;if(r!=null&&Jd(dt,r,ft.state.isItemEqualToValue)&&(Kt=r),ht(Kt),!ft.state.inputInsidePopup){const Kn=Qr(Kt,R);pe.current&&pe.current.value!==Kn&&Ge(Kn,it(Dr))}},[g,Ut,Ae,l,Fe,r,ht,R,ft,Ge]),Je(()=>{if(l==="none"){Y(String(et)!=="");return}Y(Ae?Array.isArray(Fe)&&Fe.length>0:Fe!=null)},[Y,l,et,Fe,Ae]),k.useEffect(()=>{gt&&ot&&Ht.length===0&&vi({activeIndex:null})},[gt,ot,Ht.length,vi]),ef(It,()=>{!pt||It===""||It===String(ze)||Z(!0)}),ef(Fe,()=>{if(l!=="none"&&(K(Le),U(Fe!==j.initialValue),$()?ae.commit(Fe):ae.commit(Fe,!0),Ae&&ft.state.selectedIndex!==null&&(!Array.isArray(Fe)||Fe.length===0)&&vi({activeIndex:null,selectedIndex:null}),Ve&&!Ze&&!Vs)){const dt=Qr(Fe,R);et!==dt&&Ge(dt,it(Dr))}}),ef(et,()=>{l==="none"&&(K(Le),U(et!==j.initialValue),$()?ae.commit(et):ae.commit(et,!0))}),ef(g,()=>{if(!Ve||Ze||Vs||G)return;const dt=Qr(Fe,R);et!==dt&&Ge(dt,it(Dr))});const kl=Fx({open:Xi?!0:pt,onOpenChange:Nt,elements:{reference:Vs?br:ls,floating:Di}});let Fu,La;Xi||(Fu=S?"grid":"listbox",La=pt?"true":"false");const oa=k.useMemo(()=>{const dt=ls?.tagName==="INPUT",Ct=dt||pt,Kt=dt?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return Ct&&(Kt.role="combobox",Kt["aria-expanded"]=La,Kt["aria-haspopup"]=Fu,Kt["aria-controls"]=pt?gr?.id:void 0,Kt["aria-autocomplete"]=H),{reference:Kt,floating:{role:"presentation"}}},[ls,pt,La,Fu,gr?.id,H]),$0=Nm(kl,{enabled:!p&&!ve&&x,event:"mousedown-only",toggle:!1,touchOpenDelay:Vs?0:50}),LT=Im(kl,{enabled:!p&&!ve&&!Xi,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Xi?!0:void 0,outsidePress(dt){const Ct=_r(dt);return!Tt(br,Ct)&&!Tt(Ce.current,Ct)&&!Tt(de.current,Ct)}}),ug=lM(kl,{enabled:!p&&!ve,id:se,listRef:te,activeIndex:Yi,selectedIndex:Yt,virtual:!0,loopFocus:!0,allowEscape:!ot,focusItemOnOpen:G||l==="none"&&!ot?!1:"auto",focusItemOnHover:C,resetOnPointerLeave:!w,cols:S?2:1,orientation:S?"horizontal":void 0,disabledIndices:ta,onNavigate(dt,Ct){!Ct&&!pt||Tl==="ending"||vi(Ct?{activeIndex:dt,type:Se.current?"keyboard":"pointer"}:{activeIndex:dt})}}),{getReferenceProps:ph,getFloatingProps:Bu,getItemProps:cg}=Jc([oa,$0,LT,ug]);zte(()=>{ft.update({inline:L,popupProps:Bu(),inputProps:ph(),triggerProps:us,getItemProps:cg,setOpen:Nt,setInputValue:Ge,setSelectedValue:Cr,setIndices:vi,onItemHighlighted:qr,handleSelection:Al,forceMount:Li,requestSubmit:Da})}),Je(()=>{ft.update({id:se,selectedValue:Fe,open:pt,mounted:hd,transitionStatus:Tl,items:g,inline:L,popupProps:Bu(),inputProps:ph(),triggerProps:us,openMethod:Gs,getItemProps:cg,selectionMode:l,name:Le,disabled:ve,readOnly:p,required:m,grid:S,isGrouped:Bt,virtualized:D,onOpenChangeComplete:Pr,openOnInputClick:x,itemToStringLabel:R,modal:M,autoHighlight:ot,isItemEqualToValue:N,submitOnItemClick:q,hasInputValue:Ze,requestSubmit:Da})},[ft,se,Fe,pt,hd,Tl,g,Bu,ph,cg,Gs,us,l,Le,ve,p,m,ae,S,Bt,D,Pr,x,R,M,N,q,Ze,L,Da,ot]);const la=Fs(E,ae.inputRef),dg=k.useMemo(()=>({query:It,filteredItems:$t,flatFilteredItems:Ht}),[It,$t,Ht]),z0=k.useMemo(()=>Array.isArray(yn)?"":to(yn,O),[yn,O]),fg=Ae&&Array.isArray(Fe)&&Fe.length>0,Uu=k.useMemo(()=>!Ae||!Array.isArray(Fe)||!Le?null:Fe.map(dt=>{const Ct=to(dt,O);return b.jsx("input",{type:"hidden",name:Le,value:Ct},Ct)}),[Ae,Fe,Le,O]),H0=b.jsxs(k.Fragment,{children:[e.children,b.jsx("input",{...ae.getInputValidationProps({onFocus(){if(Vs){br?.focus();return}(pe.current||br)?.focus()},onChange(dt){if(dt.nativeEvent.defaultPrevented)return;const Ct=dt.target.value,Kt=it(Yd,dt.nativeEvent);function Kn(){if(Ae)return;if(l==="none"){U(Ct!==j.initialValue),Ge(Ct,Kt),$()&&ae.commit(Ct);return}const vr=Ne.current.find(Mr=>to(Mr,O).toLowerCase()===Ct.toLowerCase());vr!=null&&(U(vr!==j.initialValue),Cr?.(vr,Kt),$()&&ae.commit(vr))}g?Kn():(Li(),queueMicrotask(Kn))}}),id:se,name:Ae||l==="none"?void 0:Le,disabled:ve,required:m&&!fg,readOnly:p,value:z0,ref:la,style:Rm,tabIndex:-1,"aria-hidden":!0}),Uu]});return b.jsx(nne.Provider,{value:ft,children:b.jsx(rne.Provider,{value:kl,children:b.jsx(ine.Provider,{value:dg,children:b.jsx(ane.Provider,{value:et,children:H0})})})})}const S_=2,KEe={...Mp,...Kf},YEe=k.forwardRef(function(t,n){const{render:r,className:i,nativeButton:a=!0,disabled:s=!1,...o}=t,{state:l,disabled:u,setTouched:f,setFocused:d,validationMode:p,validation:m}=Bs(),{labelId:E}=nd(),S=Nu(),g=Ye(S,mt.selectionMode),y=Ye(S,mt.disabled),v=Ye(S,mt.readOnly),x=Ye(S,mt.listElement),T=Ye(S,mt.triggerProps),w=Ye(S,mt.triggerElement),C=Ye(S,mt.inputInsidePopup),R=Ye(S,mt.open),O=Ye(S,mt.selectedValue),N=Ye(S,mt.activeIndex),D=Ye(S,mt.selectedIndex),L=Jx(),z=AM(),M=Pn(),V=u||y||s,H=k.useRef("");function B(ae){H.current=ae.pointerType}const q=L.select("domReferenceElement");k.useEffect(()=>{C&&w&&w!==q&&L.set("domReferenceElement",w)},[w,q,L,C]);const{reference:K}=uM(L,{enabled:!R&&!v&&!y&&g==="single",listRef:S.state.labelsRef,activeIndex:N,selectedIndex:D,onMatch(ae){const se=S.state.valuesRef.current[ae];se!==void 0&&S.state.setSelectedValue(se,it("none"))}}),{reference:U}=Nm(L,{enabled:!v&&!y,event:"mousedown"}),{buttonRef:j,getButtonProps:$}=sa({native:a,disabled:V}),Y=k.useMemo(()=>({...l,open:R,disabled:V}),[l,R,V]),W=Xe(ae=>{S.set("triggerElement",ae)});return xt("button",t,{ref:[n,j,W],state:Y,props:[T,U,K,{tabIndex:C?0:-1,disabled:V,role:C?"combobox":void 0,"aria-expanded":R?"true":"false","aria-haspopup":C?"dialog":"listbox","aria-controls":R?x?.id:void 0,"aria-readonly":v||void 0,"aria-labelledby":E,onPointerDown:B,onPointerEnter:B,onFocus(){d(!0),!(V||v)&&M.start(0,S.state.forceMount)},onBlur(){if(f(!0),d(!1),p==="onBlur"){const ae=g==="none"?z:O;m.commit(ae)}},onMouseDown(ae){if(V||v||(C||L.set("domReferenceElement",ae.currentTarget),S.state.forceMount(),H.current!=="touch"&&(S.state.inputRef.current?.focus(),C||ae.preventDefault()),R))return;const se=ki(ae.currentTarget);function Q(G){if(!w)return;const Z=_r(G),ee=S.state.positionerElement,ne=S.state.listElement;if(Tt(w,Z)||Tt(ee,Z)||Tt(ne,Z)||Z===w)return;const te=EM(w),ye=G.clientX>=te.left-S_&&G.clientX<=te.right+S_,Ee=G.clientY>=te.top-S_&&G.clientY<=te.bottom+S_;ye&&Ee||S.state.setOpen(!1,it("cancel-open",G))}C&&se.addEventListener("mouseup",Q,{once:!0})},onKeyDown(ae){V||v||(ae.key==="ArrowDown"||ae.key==="ArrowUp")&&(Rr(ae),S.state.setOpen(!0,it(vp,ae.nativeEvent)),S.state.inputRef.current?.focus())}},m?m.getValidationProps(o):o,$],stateAttributesMapping:KEe})}),XEe=k.createContext(void 0);function ZEe(){return k.useContext(XEe)}const lne=k.createContext(void 0);function kM(e){const t=k.useContext(lne);if(t===void 0&&!e)throw new Error(an(21));return t}const QEe={...Mp,...Kf,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},JEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,id:s,...o}=t,{state:l,disabled:u,setTouched:f,setFocused:d,validationMode:p,validation:m}=Bs(),{labelId:E}=nd(),S=ZEe(),y=!!kM(!0),v=Nu(),{filteredItems:x}=Yf(),T=AM(),w=mi(s),C=Ou(),R=Ye(v,mt.disabled),O=Ye(v,mt.readOnly),N=Ye(v,mt.name),D=Ye(v,mt.selectionMode),L=Ye(v,mt.autoHighlight),z=Ye(v,mt.inputProps),M=Ye(v,mt.triggerProps),V=Ye(v,mt.open),H=Ye(v,mt.mounted),B=Ye(v,mt.selectedValue),q=Ye(v,mt.popupSide),K=Ye(v,mt.positionerElement),U=!!L,j=H&&K?q:null,$=u||R||a,Y=x.length===0,[W,J]=k.useState(null),ae=k.useRef(!1),se=Xe(ee=>{const ne=y||v.state.inline;ne&&!v.state.hasInputValue&&v.state.setInputValue("",it(Dr)),v.update({inputElement:ee,inputInsidePopup:ne})}),Q=k.useMemo(()=>({...l,open:V,disabled:$,readOnly:O,popupSide:j,listEmpty:Y}),[l,V,$,O,j,Y]);function G(ee){if(!S)return;let ne;const{highlightedChipIndex:te}=S;if(te!==void 0){if(ee.key==="ArrowLeft")ee.preventDefault(),te>0?ne=te-1:ne=void 0;else if(ee.key==="ArrowRight")ee.preventDefault(),te<B.length-1?ne=te+1:ne=void 0;else if(ee.key==="Backspace"||ee.key==="Delete"){ee.preventDefault();const ye=te>=B.length-1?B.length-2:te;ne=ye>=0?ye:void 0,v.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return ne}return ee.key==="ArrowLeft"&&(ee.currentTarget.selectionStart??0)===0&&B.length>0?(ee.preventDefault(),ne=Math.max(B.length-1,0)):ee.key==="Backspace"&&ee.currentTarget.value===""&&B.length>0&&(v.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),ee.preventDefault()),ne}return xt("input",t,{state:Q,ref:[n,v.state.inputRef,se],props:[z,M,{type:"text",value:t.value??W??T,"aria-readonly":O||void 0,"aria-labelledby":E,disabled:$,readOnly:O,...D==="none"&&N&&{name:N},id:w,onFocus(){d(!0)},onBlur(){if(f(!0),d(!1),p==="onBlur"){const ee=D==="none"?T:B;m.commit(ee)}},onCompositionStart(ee){jE||(ae.current=!0,J(ee.currentTarget.value))},onCompositionEnd(ee){ae.current=!1;const ne=ee.currentTarget.value;J(null),v.state.setInputValue(ne,it(Yd,ee.nativeEvent))},onChange(ee){if(ae.current){const Ee=ee.currentTarget.value;J(Ee),Ee===""&&!v.state.openOnInputClick&&!v.state.inputInsidePopup&&v.state.setOpen(!1,it(bc,ee.nativeEvent));const pe=Ee.trim(),_e=U&&pe!=="";!O&&!$&&pe!==""&&(v.state.setOpen(!0,it(Yd,ee.nativeEvent)),U||v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"})),V&&v.state.activeIndex!==null&&!_e&&v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"});return}v.state.setInputValue(ee.currentTarget.value,it(Yd,ee.nativeEvent));const ne=ee.currentTarget.value==="",te=it(bc,ee.nativeEvent);ne&&!v.state.inputInsidePopup&&(D==="single"&&v.state.setSelectedValue(null,te),v.state.openOnInputClick||v.state.setOpen(!1,te));const ye=ee.currentTarget.value.trim();!O&&!$&&ye!==""&&(v.state.setOpen(!0,it(Yd,ee.nativeEvent)),U||v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"})),V&&v.state.activeIndex!==null&&!U&&v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(ee){if($||O||ee.ctrlKey||ee.shiftKey||ee.altKey||ee.metaKey)return;v.state.keyboardActiveRef.current=!0;const ne=ee.currentTarget,te=ne.scrollWidth-ne.clientWidth,ye=C==="rtl";if(ee.key==="Home"){Rr(ee);const pe=w$&&ye?ne.value.length:0;ne.setSelectionRange(pe,pe),ne.scrollLeft=0;return}if(ee.key==="End"){Rr(ee);const pe=w$&&ye?0:ne.value.length;ne.setSelectionRange(pe,pe),ne.scrollLeft=ye?-te:te;return}if(!H&&ee.key==="Escape"){const pe=D==="multiple"&&Array.isArray(B)?B.length===0:B===null,_e=it(zy,ee.nativeEvent),Se=D==="multiple"?[]:null;v.state.setInputValue("",_e),v.state.setSelectedValue(Se,_e),!pe&&!v.state.inline&&!_e.isPropagationAllowed&&ee.stopPropagation();return}if(S&&ee.key==="Backspace"&&ne.value===""&&S.highlightedChipIndex===void 0&&Array.isArray(B)&&B.length>0){const pe=B.slice(0,-1);v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"}),v.state.setSelectedValue(pe,it(Dr,ee.nativeEvent));return}const Ee=G(ee);if(S?.setHighlightedChipIndex(Ee),Ee!==void 0?S?.chipsRef.current[Ee]?.focus():v.state.inputRef.current?.focus(),ee.which!==229&&ee.key==="Enter"&&V){const pe=v.state.activeIndex,_e=ee.nativeEvent;if(pe===null){v.state.setOpen(!1,it(Dr,_e));return}Rr(ee);const Se=v.state.listRef.current[pe];Se&&(v.state.selectionEventRef.current=_e,Se.click(),v.state.selectionEventRef.current=null)}},onPointerMove(){v.state.keyboardActiveRef.current=!1},onPointerDown(){v.state.keyboardActiveRef.current=!1}},m?m.getValidationProps(o):o],stateAttributesMapping:QEe})}),eSe={...ss,...zx},tSe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,keepMounted:o=!1,...l}=t,{disabled:u}=Bs(),f=Nu(),d=Ye(f,mt.selectionMode),p=Ye(f,mt.disabled),m=Ye(f,mt.readOnly),E=Ye(f,mt.open),S=Ye(f,mt.selectedValue),g=AM();let y=!1;d==="none"?y=g!=="":d==="single"?y=S!=null:y=Array.isArray(S)&&S.length>0;const v=u||p||a,{buttonRef:x,getButtonProps:T}=sa({native:s,disabled:v}),{mounted:w,transitionStatus:C,setMounted:R}=To(y),O=k.useMemo(()=>({disabled:v,open:E,transitionStatus:C}),[v,E,C]);Oi({open:y,ref:f.state.clearRef,onComplete(){y||R(!1)}});const N=xt("button",t,{state:O,ref:[n,x,f.state.clearRef],props:[{tabIndex:-1,children:"x",disabled:v,"aria-readonly":m||void 0,onMouseDown(L){L.preventDefault()},onClick(L){if(v||m)return;const z=f.state.keyboardActiveRef;f.state.setInputValue("",it(N$,L.nativeEvent)),d!=="none"?(f.state.setSelectedValue(Array.isArray(S)?[]:null,it(N$,L.nativeEvent)),f.state.setIndices({activeIndex:null,selectedIndex:null,type:z.current?"keyboard":"pointer"})):f.state.setIndices({activeIndex:null,type:z.current?"keyboard":"pointer"}),f.state.inputRef.current?.focus()}},l,T],stateAttributesMapping:eSe});return o||w?N:null}),nSe=k.createContext(null);function rSe(){return k.useContext(nSe)}function iSe(e){const{children:t}=e,{filteredItems:n}=Yf(),r=rSe(),i=r?r.items:n;return i?b.jsx(k.Fragment,{children:i.map(t)}):null}const aSe=k.forwardRef(function(t,n){var r;const{render:i,className:a,children:s,...o}=t,l=Nu(),u=Jx(),f=!!kM(!0),{filteredItems:d}=Yf(),p=Ye(l,mt.items),m=Ye(l,mt.labelsRef),E=Ye(l,mt.listRef),S=Ye(l,mt.selectionMode),g=Ye(l,mt.grid),y=Ye(l,mt.popupProps),v=Ye(l,mt.disabled),x=Ye(l,mt.readOnly),T=Ye(l,mt.virtualized),w=S==="multiple",C=d.length===0,R=Xe(M=>{l.set("positionerElement",M)}),O=Xe(M=>{l.set("listElement",M)}),N=k.useMemo(()=>typeof s=="function"?r||(r=b.jsx(iSe,{children:s})):s,[s]),D=k.useMemo(()=>({empty:C}),[C]),L=u.useState("floatingId"),z=xt("div",t,{state:D,ref:[n,O,f?null:R],props:[y,{children:N,tabIndex:-1,id:L,role:g?"grid":"listbox","aria-multiselectable":w?"true":void 0,onKeyDown(M){if(!(v||x)&&M.key==="Enter"){const V=l.state.activeIndex;if(V==null)return;Rr(M);const H=M.nativeEvent,B=l.state.listRef.current[V];B&&(l.state.selectionEventRef.current=H,B.click(),l.state.selectionEventRef.current=null)}},onKeyDownCapture(){l.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){l.state.keyboardActiveRef.current=!1}},o]});return T?z:b.jsx(Vy,{elementsRef:E,labelsRef:p?void 0:m,children:z})}),une=k.createContext(void 0);function sSe(){const e=k.useContext(une);if(e===void 0)throw new Error(an(20));return e}const oSe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,a=Nu(),s=Ye(a,mt.mounted),o=Ye(a,mt.forceMounted);return s||r||o?b.jsx(une.Provider,{value:r,children:b.jsx(Hy,{ref:n,...i})}):null}),lSe=k.forwardRef(function(t,n){const{render:r,className:i,anchor:a,positionMethod:s="absolute",side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:E=!1,disableAnchorTracking:S=!1,collisionAvoidance:g=Nx,...y}=t,v=Nu(),{filteredItems:x}=Yf(),T=Jx(),w=sSe(),C=Ye(v,mt.modal),R=Ye(v,mt.open),O=Ye(v,mt.mounted),N=Ye(v,mt.openMethod),D=Ye(v,mt.triggerElement),L=Ye(v,mt.inputElement),z=Ye(v,mt.inputInsidePopup),M=x.length===0,H=Ky({anchor:a??(z?D:L),floatingRootContext:T,positionMethod:s,mounted:O,side:o,sideOffset:u,align:l,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:E,disableAnchorTracking:S,keepMounted:w,collisionAvoidance:g,lazyFlip:!0});Yx(R&&C&&N!=="touch",D);const B=k.useMemo(()=>{const $={...H.positionerStyles};return R||($.pointerEvents="none"),{role:"presentation",hidden:!O,style:$}},[R,O,H.positionerStyles]),q=k.useMemo(()=>({open:R,side:H.side,align:H.align,anchorHidden:H.anchorHidden,empty:M}),[R,H.side,H.align,H.anchorHidden,M]);Je(()=>{v.set("popupSide",H.side)},[v,H.side]);const K=k.useMemo(()=>({side:H.side,align:H.align,arrowRef:H.arrowRef,arrowUncentered:H.arrowUncentered,arrowStyles:H.arrowStyles,anchorHidden:H.anchorHidden,isPositioned:H.isPositioned}),[H.side,H.align,H.arrowRef,H.arrowUncentered,H.arrowStyles,H.anchorHidden,H.isPositioned]),U=Xe($=>{v.set("positionerElement",$)}),j=xt("div",t,{state:q,ref:[n,U],props:[B,y],stateAttributesMapping:Oa});return b.jsxs(lne.Provider,{value:K,children:[O&&C&&b.jsx(Kx,{inert:Dm(!R),cutout:L??D}),j]})}),uSe={...Oa,...ss},cSe=k.forwardRef(function(t,n){const{render:r,className:i,initialFocus:a,finalFocus:s,...o}=t,l=Nu(),u=kM(),f=Jx(),{filteredItems:d}=Yf(),p=Ye(l,mt.mounted),m=Ye(l,mt.open),E=Ye(l,mt.openMethod),S=Ye(l,mt.transitionStatus),g=Ye(l,mt.inputInsidePopup),y=Ye(l,mt.inputElement),v=d.length===0;Oi({open:m,ref:l.state.popupRef,onComplete(){m&&l.state.onOpenChangeComplete(!0)}});const x=k.useMemo(()=>({open:m,side:u.side,align:u.align,anchorHidden:u.anchorHidden,transitionStatus:S,empty:v}),[m,u.side,u.align,u.anchorHidden,S,v]),T=xt("div",t,{state:x,ref:[n,l.state.popupRef],props:[{role:g?"dialog":"presentation",tabIndex:-1,onFocus(O){const N=_r(O.nativeEvent);E!=="touch"&&(Tt(l.state.listElement,N)||N===O.currentTarget)&&l.state.inputRef.current?.focus()}},Pm(S),o],stateAttributesMapping:uSe}),C=a===void 0?g?O=>O==="touch"?l.state.popupRef.current:y:!1:a;let R;return s!=null?R=s:R=g?void 0:!1,b.jsx(Lx,{context:f,disabled:!p,modal:!g,openInteractionType:E,initialFocus:C,returnFocus:R,children:T})}),cne=k.createContext(void 0);function dne(){const e=k.useContext(cne);if(!e)throw new Error(an(19));return e}const dSe=k.createContext(!1);function fSe(){return k.useContext(dSe)}const hSe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a=null,index:s,disabled:o=!1,nativeButton:l=!1,...u}=t,f=k.useRef(!1),d=k.useRef(null),p=Lm({index:s,textRef:d,indexGuessBehavior:fM.GuessFromOrder}),m=Nu(),E=fSe(),{flatFilteredItems:S}=Yf(),g=Ye(m,mt.open),y=Ye(m,mt.selectionMode),v=Ye(m,mt.readOnly),x=Ye(m,mt.virtualized),T=Ye(m,mt.isItemEqualToValue),w=y!=="none",C=s??(x?Bp(S,a,T):p.index),R=p.index!==-1,O=Ye(m,mt.id),N=Ye(m,mt.isActive,C),D=Ye(m,mt.isSelected,a),L=Ye(m,mt.items),z=Ye(m,mt.getItemProps),M=k.useRef(null),V=O!=null&&R?`${O}-${C}`:void 0,H=D&&w;Je(()=>{if(!(R&&(x||s!=null)))return;const ae=m.state.listRef.current;return ae[C]=M.current,()=>{delete ae[C]}},[R,x,C,s,m]),Je(()=>{if(!R||L)return;const J=m.state.valuesRef.current;return J[C]=a,y!=="none"&&m.state.allValuesRef.current.push(a),()=>{delete J[C]}},[R,L,C,a,m,y]),Je(()=>{if(!g){f.current=!1;return}if(!R||L)return;const J=m.state.selectedValue,ae=Array.isArray(J)?J[J.length-1]:J;vu(ae,a,T)&&m.set("selectedIndex",C)},[R,L,g,m,C,a,T]);const B=k.useMemo(()=>({disabled:o,selected:H,highlighted:N}),[o,H,N]),q=z({active:N,selected:H});q.id=void 0,q.onFocus=void 0;const{getButtonProps:K,buttonRef:U}=sa({disabled:o,focusableWhenDisabled:!0,native:l});function j(J){function ae(){m.state.handleSelection(J,a)}m.state.submitOnItemClick?(xr.flushSync(ae),m.state.requestSubmit()):ae()}const $={id:V,role:E?"gridcell":"option","aria-disabled":o||void 0,"aria-selected":w?H:void 0,tabIndex:void 0,onPointerDownCapture(J){f.current=!0,J.preventDefault()},onClick(J){o||v||j(J.nativeEvent)},onMouseUp(J){const ae=f.current;f.current=!1,!(o||v||J.button!==0||ae||!N)&&j(J.nativeEvent)}},Y=xt("div",t,{ref:[U,n,p.ref,M],state:B,props:[q,$,u,K]}),W=k.useMemo(()=>({selected:H,textRef:d}),[H,d]);return b.jsx(cne.Provider,{value:W,children:Y})})),pSe=k.forwardRef(function(t,n){const{render:r,className:i,children:a,...s}=t,{filteredItems:o}=Yf(),l=Nu(),u=o.length===0?a:null;return xt("div",t,{ref:[n,l.state.emptyRef],props:[{children:u,role:"status","aria-live":"polite","aria-atomic":!0},s]})});let mz=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});function fne(e){return k.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[mz.checked]:""}:{[mz.unchecked]:""}},...Kf}),[e.indeterminate])}const hne=k.createContext(void 0);function mSe(){const e=k.useContext(hne);if(e===void 0)throw new Error(an(14));return e}const gSe="data-parent",bSe=k.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:a=!1,disabled:s=!1,id:o,indeterminate:l=!1,inputRef:u,name:f,onCheckedChange:d,parent:p=!1,readOnly:m=!1,render:E,required:S=!1,uncheckedValue:g,value:y,nativeButton:v=!1,...x}=t,{clearErrors:T}=Zy(),{disabled:w,name:C,setDirty:R,setFilled:O,setFocused:N,setTouched:D,state:L,validationMode:z,validityData:M,shouldValidateOnChange:V,validation:H}=Bs(),B=nEe(),{labelId:q,controlId:K,setControlId:U,getDescriptionProps:j}=nd(),$=iEe(),Y=$?.parent,W=Y&&$.allValues,J=w||B.disabled||$?.disabled||s,ae=C??f,se=y??ae,Q=mi(),G=mi();let Z=K;W?Z=p?G:`${Y.id}-${se}`:o&&(Z=o);let ee={};W&&(p?ee=$.parent.getParentProps():se&&(ee=$.parent.getChildProps(se)));const ne=Xe(d),{checked:te=r,indeterminate:ye=l,onCheckedChange:Ee,...pe}=ee,_e=$?.value,Se=$?.setValue,Te=$?.defaultValue,de=k.useRef(null),{getButtonProps:Ce,buttonRef:ge}=sa({disabled:J,native:v}),he=$?.validation??H,[ce,Ne]=ts({controlled:se&&_e&&!p?_e.includes(se):te,default:se&&Te&&!p?Te.includes(se):a,name:"Checkbox",state:"checked"});Je(()=>{if(U!==yr)return U(Z),()=>{U(void 0)}},[Z,$,U,p]),Qy({enabled:!$,id:Q,commit:he.commit,value:ce,controlRef:de,name:ae,getValue:()=>ce});const Pe=k.useRef(null),ve=Fs(u,Pe,he.inputRef);Je(()=>{Pe.current&&(Pe.current.indeterminate=ye,ce&&O(!0))},[ce,ye,O]),ef(ce,()=>{$&&!p||(T(ae),O(ce),R(ce!==M.initialValue),V()?he.commit(ce):he.commit(ce,!0))});const Le=ol({checked:ce,disabled:J,name:p?void 0:ae,id:Z??void 0,required:S,ref:ve,style:Rm,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(ot){if(ot.nativeEvent.defaultPrevented)return;const Fe=ot.target.checked,ht=it(Dr,ot.nativeEvent);if(Ee?.(Fe,ht),ne(Fe,ht),!ht.isCanceled&&(Ne(Fe),se&&_e&&Se&&!p)){const Ie=Fe?[..._e,se]:_e.filter(ze=>ze!==se);Se(Ie,ht)}},onFocus(){de.current?.focus()}},y!==void 0?{value:($?ce&&y:y)||""}:Jn,j,$?he.getValidationProps:he.getInputValidationProps),Ae=W?!!te:ce,Ve=W&&ye||l;k.useEffect(()=>{Y&&se&&Y.disabledStatesRef.current.set(se,J)},[Y,J,se]);const Ze=k.useMemo(()=>({...L,checked:Ae,disabled:J,readOnly:m,required:S,indeterminate:Ve}),[L,Ae,J,m,S,Ve]),gt=fne(Ze),st=xt("span",t,{state:Ze,ref:[ge,de,n,$?.registerControlRef],props:[{id:Q,role:"checkbox","aria-checked":ye?"mixed":ce,"aria-readonly":m||void 0,"aria-required":S||void 0,"aria-labelledby":q,[gSe]:p?"":void 0,onFocus(){N(!0)},onBlur(){const ot=Pe.current;ot&&(D(!0),N(!1),z==="onBlur"&&he.commit($?_e:ot.checked))},onClick(ot){m||J||(ot.preventDefault(),Pe.current?.click())}},j,he.getValidationProps,x,pe,Ce],stateAttributesMapping:gt});return b.jsxs(hne.Provider,{value:Ze,children:[st,!ce&&!$&&ae&&!p&&g!==void 0&&b.jsx("input",{type:"hidden",name:ae,value:g}),b.jsx("input",{...Le})]})}),vSe=k.forwardRef(function(t,n){const{render:r,className:i,keepMounted:a=!1,...s}=t,o=mSe(),l=o.checked||o.indeterminate,{transitionStatus:u,setMounted:f}=To(l),d=k.useRef(null),p=k.useMemo(()=>({...o,transitionStatus:u}),[o,u]);Oi({open:l,ref:d,onComplete(){l||f(!1)}});const m=fne(o),E=k.useMemo(()=>({...m,...ss,...Kf}),[m]),S=a||l,g=xt("span",t,{enabled:S,ref:[n,d],state:p,stateAttributesMapping:E,props:s});return S?g:null});function ySe(e){const{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,...a}=e;return b.jsx(qEe,{...a,selectionMode:t?"multiple":"single",selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i})}const _Se=k.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=dne();return r||i?b.jsx(ESe,{...t,ref:n}):null}),ESe=k.memo(k.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...a}=e,{selected:s}=dne(),o=k.useRef(null),{transitionStatus:l,setMounted:u}=To(s),f=k.useMemo(()=>({selected:s,transitionStatus:l}),[s,l]),d=xt("span",e,{ref:[t,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:ss});return Oi({open:s,ref:o,onComplete(){s||u(!1)}}),d})),SSe=k.createContext(void 0);function ew(e=!0){const t=k.useContext(SSe);if(t===void 0&&!e)throw new Error(an(25));return t}const pne=k.createContext(void 0);function OM(e){const t=k.useContext(pne);if(t===void 0&&!e)throw new Error(an(33));return t}const mne=k.createContext(void 0);function rd(e){const t=k.useContext(mne);if(t===void 0&&!e)throw new Error(an(36));return t}const gne={type:"regular-item"};function bne(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,nativeButton:s,itemMetadata:o,nodeId:l}=e,u=k.useRef(null),f=ew(!0),d=f!==void 0,{events:p}=a.useState("floatingTreeRoot"),{getButtonProps:m,buttonRef:E}=sa({disabled:n,focusableWhenDisabled:!0,native:s}),S=k.useCallback(y=>ol({id:i,role:"menuitem",tabIndex:r?0:-1,onMouseMove(v){l&&p.emit("itemhover",{nodeId:l,target:v.currentTarget})},onMouseEnter(){o.type==="submenu-trigger"&&o.setActive()},onKeyUp(v){v.key===" "&&a.context.typingRef.current&&v.preventBaseUIHandler()},onClick(v){t&&p.emit("close",{domEvent:v,reason:ff})},onMouseUp(v){if(f){const x=f.initialCursorPointRef.current;if(f.initialCursorPointRef.current=null,d&&x&&Math.abs(v.clientX-x.x)<=1&&Math.abs(v.clientY-x.y)<=1)return}u.current&&a.context.allowMouseUpTriggerRef.current&&(!d||v.button===2)&&o.type==="regular-item"&&u.current.click()}},y,m),[i,r,m,t,p,a,d,f,o,l]),g=Fs(u,E);return k.useMemo(()=>({getItemProps:S,itemRef:g}),[S,g])}let gz=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const vne={checked(e){return e?{[gz.checked]:""}:{[gz.unchecked]:""}},...ss},xSe=k.forwardRef(function(t,n){const{render:r,className:i,id:a,label:s,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!0,...f}=t,d=Lm({label:s}),p=OM(!0),m=mi(a),{store:E}=rd(),S=E.useState("isActive",d.index),g=E.useState("itemProps"),{getItemProps:y,itemRef:v}=bne({closeOnClick:u,disabled:l,highlighted:S,id:m,store:E,nativeButton:o,nodeId:p?.nodeId,itemMetadata:gne}),x=k.useMemo(()=>({disabled:l,highlighted:S}),[l,S]);return xt("div",t,{state:x,props:[g,f,y],ref:[v,n,d.ref]})}),wSe={...Oa,...ss},TSe=k.forwardRef(function(t,n){const{render:r,className:i,finalFocus:a,...s}=t,{store:o}=rd(),{side:l,align:u}=OM(),f=xM()!=null,d=o.useState("open"),p=o.useState("transitionStatus"),m=o.useState("popupProps"),E=o.useState("mounted"),S=o.useState("instantType"),g=o.useState("activeTriggerElement"),y=o.useState("parent"),v=o.useState("lastOpenChangeReason"),x=o.useState("rootId"),T=o.useState("floatingRootContext"),w=o.useState("floatingTreeRoot"),C=o.useState("closeDelay"),R=o.useState("activeTriggerElement");Oi({open:d,ref:o.context.popupRef,onComplete(){d&&o.context.onOpenChangeComplete?.(!0)}}),k.useEffect(()=>{function M(V){o.setOpen(!1,it(V.reason,V.domEvent))}return w.events.on("close",M),()=>{w.events.off("close",M)}},[w.events,o]);const O=o.useState("hoverEnabled"),N=o.useState("disabled");Hee(T,{enabled:O&&!N&&y.type!=="context-menu"&&y.type!=="menubar",closeDelay:C});const D=k.useMemo(()=>({transitionStatus:p,side:l,align:u,open:d,nested:y.type==="menu",instant:S}),[p,l,u,d,y.type,S]),L=xt("div",t,{state:D,ref:[n,o.context.popupRef],stateAttributesMapping:wSe,props:[m,{onKeyDown(M){f&&dM.has(M.key)&&M.stopPropagation()}},Pm(p),s,{"data-rootownerid":x}]});let z=y.type===void 0||y.type==="context-menu";return(g||y.type==="menubar"&&v!==Dx)&&(z=!0),b.jsx(Lx,{context:T,modal:!1,disabled:!E,returnFocus:a===void 0?z:a,initialFocus:y.type!=="menu",restoreFocus:!0,externalTree:y.type!=="menubar"?w:void 0,previousFocusableElement:R,nextFocusableElement:y.type===void 0?o.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:y.type===void 0?o.context.beforeContentFocusGuardRef:void 0,children:L})}),yne=k.createContext(void 0);function CSe(){const e=k.useContext(yne);if(e===void 0)throw new Error(an(32));return e}const ASe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:a}=rd();return a.useState("mounted")||r?b.jsx(yne.Provider,{value:r,children:b.jsx(Hy,{ref:n,...i})}):null}),kSe=k.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o,align:l,sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:E=!1,disableAnchorTracking:S=!1,collisionAvoidance:g=Nx,...y}=t,{store:v}=rd(),x=CSe(),T=ew(!0),w=v.useState("parent"),C=v.useState("floatingRootContext"),R=v.useState("floatingTreeRoot"),O=v.useState("mounted"),N=v.useState("open"),D=v.useState("modal"),L=v.useState("activeTriggerElement"),z=v.useState("lastOpenChangeReason"),M=v.useState("floatingNodeId"),V=v.useState("floatingParentNodeId");let H=r,B=u,q=f,K=l,U=g;w.type==="context-menu"&&(H=r??w.context?.anchor,K=K??"start",!o&&K!=="center"&&(q=t.alignOffset??2,B=t.sideOffset??-5));let j=o,$=K;w.type==="menu"?(j=j??"inline-end",$=$??"start",U=t.collisionAvoidance??FP):w.type==="menubar"&&(j=j??"bottom",$=$??"start");const Y=w.type==="context-menu",W=Ky({anchor:H,floatingRootContext:C,positionMethod:T?"fixed":i,mounted:O,side:j,sideOffset:B,align:$,alignOffset:q,arrowPadding:Y?0:m,collisionBoundary:d,collisionPadding:p,sticky:E,nodeId:M,keepMounted:x,disableAnchorTracking:S,collisionAvoidance:U,shiftCrossAxis:Y,externalTree:R}),J=k.useMemo(()=>{const ee={};return N||(ee.pointerEvents="none"),{role:"presentation",hidden:!O,style:{...W.positionerStyles,...ee}}},[N,O,W.positionerStyles]);k.useEffect(()=>{function ee(ne){ne.open?(ne.parentNodeId===M&&v.set("hoverEnabled",!1),ne.nodeId!==M&&ne.parentNodeId===v.select("floatingParentNodeId")&&v.setOpen(!1,it(Ib))):ne.parentNodeId===M&&ne.reason!==Ib&&v.set("hoverEnabled",!0)}return R.events.on("menuopenchange",ee),()=>{R.events.off("menuopenchange",ee)}},[v,R.events,M]),k.useEffect(()=>{if(v.select("floatingParentNodeId")==null)return;function ee(ne){if(ne.open||ne.nodeId!==v.select("floatingParentNodeId"))return;const te=ne.reason??Ib;v.setOpen(!1,it(te))}return R.events.on("menuopenchange",ee),()=>{R.events.off("menuopenchange",ee)}},[R.events,v]),k.useEffect(()=>{function ee(ne){!N||ne.nodeId!==v.select("floatingParentNodeId")||ne.target&&L&&L!==ne.target&&v.setOpen(!1,it(Ib))}return R.events.on("itemhover",ee),()=>{R.events.off("itemhover",ee)}},[R.events,N,L,v]),k.useEffect(()=>{const ee={open:N,nodeId:M,parentNodeId:V,reason:v.select("lastOpenChangeReason")};R.events.emit("menuopenchange",ee)},[R.events,N,v,M,V]);const ae=k.useMemo(()=>({open:N,side:W.side,align:W.align,anchorHidden:W.anchorHidden,nested:w.type==="menu"}),[N,W.side,W.align,W.anchorHidden,w.type]),se=k.useMemo(()=>({side:W.side,align:W.align,arrowRef:W.arrowRef,arrowUncentered:W.arrowUncentered,arrowStyles:W.arrowStyles,nodeId:W.context.nodeId}),[W.side,W.align,W.arrowRef,W.arrowUncentered,W.arrowStyles,W.context.nodeId]),Q=xt("div",t,{state:ae,stateAttributesMapping:Oa,ref:[n,v.useStateSetter("positionerElement")],props:[J,y]}),G=O&&w.type!=="menu"&&(w.type!=="menubar"&&D&&z!==dr||w.type==="menubar"&&w.context.modal);let Z=null;return w.type==="menubar"?Z=w.context.contentElement:w.type===void 0&&(Z=L),b.jsxs(pne.Provider,{value:se,children:[G&&b.jsx(Kx,{ref:w.type==="context-menu"||w.type==="nested-context-menu"?w.context.internalBackdropRef:null,inert:Dm(!N),cutout:Z}),b.jsx(xee,{id:M,children:b.jsx(Vy,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:Q})})]})}),_ne=k.createContext(void 0);function OSe(){const e=k.useContext(_ne);if(e===void 0)throw new Error(an(34));return e}const RSe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a,defaultValue:s,onValueChange:o,disabled:l=!1,...u}=t,[f,d]=ts({controlled:a,default:s,name:"MenuRadioGroup"}),p=Xe(o),m=Xe((y,v)=>{p?.(y,v),!v.isCanceled&&d(y)}),E=k.useMemo(()=>({disabled:l}),[l]),S=xt("div",t,{state:E,ref:n,props:{role:"group","aria-disabled":l||void 0,...u}}),g=k.useMemo(()=>({value:f,setValue:m,disabled:l}),[f,m,l]);return b.jsx(_ne.Provider,{value:g,children:S})})),Ene=k.createContext(void 0);function NSe(){const e=k.useContext(Ene);if(e===void 0)throw new Error(an(35));return e}const ISe=k.forwardRef(function(t,n){const{render:r,className:i,id:a,label:s,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!1,value:f,...d}=t,p=Lm({label:s}),m=OM(!0),E=mi(a),{store:S}=rd(),g=S.useState("isActive",p.index),y=S.useState("itemProps"),{value:v,setValue:x,disabled:T}=OSe(),w=T||l,C=v===f,{getItemProps:R,itemRef:O}=bne({closeOnClick:u,disabled:w,highlighted:g,id:E,store:S,nativeButton:o,nodeId:m?.nodeId,itemMetadata:gne}),N=k.useMemo(()=>({disabled:w,highlighted:g,checked:C}),[w,g,C]),D=Xe(z=>{const M={...it(ff,z.nativeEvent),preventUnmountOnClose:()=>{}};x(f,M)}),L=xt("div",t,{state:N,stateAttributesMapping:vne,props:[y,{role:"menuitemradio","aria-checked":C,onClick:D},d,R],ref:[O,n,p.ref]});return b.jsx(Ene.Provider,{value:N,children:L})}),DSe=k.forwardRef(function(t,n){const{render:r,className:i,keepMounted:a=!1,...s}=t,o=NSe(),l=k.useRef(null),{transitionStatus:u,setMounted:f}=To(o.checked);Oi({open:o.checked,ref:l,onComplete(){o.checked||f(!1)}});const d=k.useMemo(()=>({checked:o.checked,disabled:o.disabled,highlighted:o.highlighted,transitionStatus:u}),[o.checked,o.disabled,o.highlighted,u]);return xt("span",t,{state:d,stateAttributesMapping:vne,ref:[n,l],props:{"aria-hidden":!0,...s},enabled:a||o.checked})}),LSe=k.createContext(null);function Sne(e){return k.useContext(LSe)}const PSe={...sM,disabled:Ue(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Ue(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:Ue(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:Ue(e=>e.stickIfOpen),parent:Ue(e=>e.parent),rootId:Ue(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Ue(e=>e.activeIndex),isActive:Ue((e,t)=>e.activeIndex===t),hoverEnabled:Ue(e=>e.hoverEnabled),instantType:Ue(e=>e.instantType),lastOpenChangeReason:Ue(e=>e.openChangeReason),floatingTreeRoot:Ue(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Ue(e=>e.floatingNodeId),floatingParentNodeId:Ue(e=>e.floatingParentNodeId),itemProps:Ue(e=>e.itemProps),closeDelay:Ue(e=>e.closeDelay),keyboardEventRelay:Ue(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class RM extends Mx{constructor(t){super({...MSe(),...t},{positionerRef:k.createRef(),popupRef:k.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:k.createRef(),beforeContentFocusGuardRef:k.createRef(),onOpenChangeComplete:void 0,triggerElements:new Wy},PSe),this.observe(Ue(n=>n.allowMouseEnter),(n,r)=>{this.state.parent.type==="menu"&&n!==r&&this.state.parent.store.set("allowMouseEnter",n)}),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){this.unsubscribeParentListener=n.store.subscribe(()=>{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})}static useStore(t,n){return pi(()=>t??new RM(n)).current}unsubscribeParentListener=null}function MSe(){return{...aM(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new YP,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Jn,keyboardEventRelay:void 0,closeDelay:0}}const jSe=k.createContext(void 0);function FSe(){return k.useContext(jSe)}function BSe(e){const{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:s=!1,modal:o,loopFocus:l=!0,orientation:u="vertical",actionsRef:f,closeParentOnEsc:d=!1,handle:p,triggerId:m,defaultTriggerId:E=null,highlightItemOnHover:S=!0}=e,g=ew(!0),y=rd(!0),v=Sne(),x=FSe(),T=k.useMemo(()=>x&&y?{type:"menu",store:y.store}:v?{type:"menubar",context:v}:g&&!y?{type:"context-menu",context:g}:{type:void 0},[g,y,v,x]),w=RM.useStore(p?.store,{parent:T}),C=w.useState("floatingTreeRoot"),R=XP(C),O=xo();Je(()=>{g&&!y?w.update({parent:{type:"context-menu",context:g},floatingNodeId:R,floatingParentNodeId:O}):y&&w.update({floatingNodeId:R,floatingParentNodeId:O})},[g,y,R,O,w]),w.useControlledProp("open",n,a),w.useControlledProp("activeTriggerId",m,E),w.useContextCallback("onOpenChangeComplete",i);const N=w.useState("open"),D=w.useState("activeTriggerElement"),L=w.useState("positionerElement"),z=w.useState("hoverEnabled"),M=w.useState("modal"),V=w.useState("disabled"),H=w.useState("lastOpenChangeReason"),B=w.useState("parent"),q=w.useState("activeIndex"),K=w.useState("payload"),U=w.useState("floatingParentNodeId"),j=k.useRef(null),$=U!=null;let Y;w.useSyncedValues({disabled:s,modal:B.type===void 0?o:void 0,rootId:Qc()});const{openMethod:W,triggerProps:J,reset:ae}=Xx(N);rM(w);const{forceUnmount:se}=iM(N,w,()=>{w.update({allowMouseEnter:!1,stickIfOpen:!0}),ae()}),Q=k.useRef(B.type!=="context-menu"),G=Pn();k.useEffect(()=>{if(N||(j.current=null),B.type==="context-menu"){if(!N){G.clear(),Q.current=!1;return}G.start(500,()=>{Q.current=!0})}},[G,N,B.type]),Yx(N&&M&&H!==dr&&W!=="touch",L),Je(()=>{!N&&!z&&w.set("hoverEnabled",!0)},[N,z,w]);const Z=k.useRef(!0),ee=Pn(),ne=Xe((Fe,ht)=>{const Ie=ht.reason;if(N===Fe&&ht.trigger===D||(ht.preventUnmountOnClose=()=>{w.set("preventUnmountingOnClose",!0)},!Fe&&ht.trigger==null&&(ht.trigger=D??void 0),r?.(Fe,ht),ht.isCanceled))return;const ze={open:Fe,nativeEvent:ht.event,reason:ht.reason,nested:$};Y?.emit("openchange",ze);const et=ht.event;if(Fe===!1&&et?.type==="click"&&et.pointerType==="touch"&&!Z.current)return;if(!Fe&&q!==null){const Bt=w.context.itemDomElements.current[q];queueMicrotask(()=>{Bt?.setAttribute("tabindex","-1")})}Fe&&Ie===Sv?(Z.current=!1,ee.start(300,()=>{Z.current=!0})):(Z.current=!0,ee.clear());const lt=(Ie===au||Ie===ff)&&et.detail===0&&et?.isTrusted,pt=!Fe&&(Ie===zy||Ie==null);function bn(){const Bt={open:Fe,openChangeReason:Ie};j.current=ht.event??null;const It=ht.trigger?.id??null;(It||Fe)&&(Bt.activeTriggerId=It,Bt.activeTriggerElement=ht.trigger??null),w.update(Bt)}Ie===dr?xr.flushSync(bn):bn(),B.type==="menubar"&&(Ie===Sv||Ie===ho||Ie===dr||Ie===vp||Ie===Ib)?w.set("instantType","group"):lt||pt?w.set("instantType",lt?"click":"dismiss"):w.set("instantType",void 0)}),te=k.useCallback(Fe=>{const ht=it(Fe);return ht.preventUnmountOnClose=()=>{w.set("preventUnmountingOnClose",!0)},ht},[w]),ye=k.useCallback(()=>{w.setOpen(!1,te(ZP))},[w,te]);k.useImperativeHandle(f,()=>({unmount:se,close:ye}),[se,ye]);let Ee;B.type==="context-menu"&&(Ee=B.context),k.useImperativeHandle(Ee?.positionerRef,()=>L,[L]),k.useImperativeHandle(Ee?.actionsRef,()=>({setOpen:ne}),[ne]);const pe=oM({popupStore:w,onOpenChange:ne});Y=pe.context.events,k.useEffect(()=>{const Fe=({open:ht,eventDetails:Ie})=>ne(ht,Ie);return Y.on("setOpen",Fe),()=>{Y?.off("setOpen",Fe)}},[Y,ne]);const _e=Im(pe,{enabled:!V,bubbles:d&&B.type==="menu",outsidePress(){return B.type!=="context-menu"||j.current?.type==="contextmenu"?!0:Q.current},externalTree:$?C:void 0}),Se=Vee(pe,{role:"menu"}),Te=Ou(),de=k.useCallback(Fe=>{w.select("activeIndex")!==Fe&&w.set("activeIndex",Fe)},[w]),Ce=lM(pe,{enabled:!V,listRef:w.context.itemDomElements,activeIndex:q,nested:B.type!==void 0,loopFocus:l,orientation:u,parentOrientation:B.type==="menubar"?B.context.orientation:void 0,rtl:Te==="rtl",disabledIndices:ta,onNavigate:de,openOnArrowKeyDown:B.type!=="context-menu",externalTree:$?C:void 0,focusItemOnHover:S}),ge=k.useCallback(Fe=>{w.context.typingRef.current=Fe},[w]),he=uM(pe,{listRef:w.context.itemLabels,activeIndex:q,resetMs:mbe,onMatch:Fe=>{N&&Fe!==q&&w.set("activeIndex",Fe)},onTypingChange:ge}),{getReferenceProps:ce,getFloatingProps:Ne,getItemProps:Pe,getTriggerProps:ve}=Jc([_e,Se,Ce,he]),Le=k.useMemo(()=>{const Fe=ol(ce(),{onMouseEnter(){w.set("hoverEnabled",!0)},onMouseMove(){w.set("allowMouseEnter",!0)}},J);return delete Fe.role,Fe},[ce,w,J]),Ae=k.useMemo(()=>{const Fe=ve();if(!Fe)return Fe;const ht=ol(Fe,J);return delete ht.role,delete ht["aria-controls"],ht},[ve,J]),Ve=su(),Ze=k.useMemo(()=>Ne({onMouseEnter(){B.type==="menu"&&Ve.request(()=>w.set("hoverEnabled",!1))},onMouseMove(){w.set("allowMouseEnter",!0)},onClick(){w.select("hoverEnabled")&&w.set("hoverEnabled",!1)},onKeyDown(Fe){const ht=w.select("keyboardEventRelay");ht&&!Fe.isPropagationStopped()&&ht(Fe)}}),[Ne,B.type,Ve,w]),gt=k.useMemo(()=>Pe(),[Pe]);w.useSyncedValues({floatingRootContext:pe,activeTriggerProps:Le,inactiveTriggerProps:Ae,popupProps:Ze,itemProps:gt});const st=k.useMemo(()=>({store:w,parent:T}),[w,T]),ot=b.jsx(mne.Provider,{value:st,children:typeof t=="function"?t({payload:K}):t});return B.type===void 0||B.type==="context-menu"?b.jsx(wee,{externalTree:C,children:ot}):ot}function xne(e){if(Qn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!Yo(e))return xne(sl(e))}function USe(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,i=k.useRef(!1);return k.useMemo(()=>t?{onMouseDown:a=>{(n==="open"&&!r||n==="close"&&r)&&(i.current=!0,ki(a.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:a=>{i.current&&(i.current=!1,a.preventBaseUIHandler())}}:Jn,[t,n,r])}const x_=2,$Se=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,id:o,openOnHover:l,delay:u=100,closeDelay:f=0,handle:d,payload:p,...m}=t,E=rd(!0),S=d?.store??E?.store;if(!S)throw new Error(an(85));const g=mi(o),y=S.useState("isTriggerActive",g),v=S.useState("floatingRootContext"),x=S.useState("isOpenedByTrigger",g),T=k.useRef(null),w=HSe(),C=MP(!0),R=wo(),O=k.useMemo(()=>R??new YP,[R]),N=XP(O),D=xo(),{registerTrigger:L,isMountedByThisTrigger:z}=nM(g,T,S,{payload:p,closeDelay:f,parent:w,floatingTreeRoot:O,floatingNodeId:N,floatingParentNodeId:D,keyboardEventRelay:C?.relayKeyboardEvent}),M=S.useState("disabled"),V=a||M||w.type==="menubar"&&w.context.disabled,{getButtonProps:H,buttonRef:B}=sa({disabled:V,native:s});k.useEffect(()=>{!x&&w.type===void 0&&(S.context.allowMouseUpTriggerRef.current=!1)},[S,x,w.type]);const q=k.useRef(null),K=Pn(),U=Xe(Se=>{if(!q.current)return;K.clear(),S.context.allowMouseUpTriggerRef.current=!1;const Te=Se.target;if(Tt(q.current,Te)||Tt(S.select("positionerElement"),Te)||Te===q.current||Te!=null&&xne(Te)===S.select("rootId"))return;const de=EM(q.current);Se.clientX>=de.left-x_&&Se.clientX<=de.right+x_&&Se.clientY>=de.top-x_&&Se.clientY<=de.bottom+x_||O.events.emit("close",{domEvent:Se,reason:Tee})});k.useEffect(()=>{x&&S.select("lastOpenChangeReason")===dr&&ki(q.current).addEventListener("mouseup",U,{once:!0})},[x,U,S]);const j=w.type==="menubar"&&w.context.hasSubmenuOpen,Y=Wee(v,{enabled:(l??j??!1)&&!V&&w.type!=="context-menu"&&(w.type!=="menubar"||j&&!z),handleClose:cM({blockPointerEvents:w.type!=="menubar"}),mouseOnly:!0,move:!1,restMs:w.type===void 0?u:void 0,delay:{close:f},triggerElementRef:T,externalTree:O,isActiveTrigger:y}),W=zSe(x,S.select("lastOpenChangeReason")),J=Nm(v,{enabled:!V&&w.type!=="context-menu",event:x&&w.type==="menubar"?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0?W:!1}),ae=$ee(v,{enabled:!V&&(w.type!=="menubar"&&x||j)}),se=USe({open:x,enabled:w.type==="menubar",mouseDownAction:"open"}),Q=Jc([J,ae]),G=w.type==="menubar",Z=k.useMemo(()=>({disabled:V,open:x}),[V,x]),ee=S.useState("triggerProps",z),ne=[q,n,B,L,T],te=[Q.getReferenceProps(),Y??Jn,ee,{"aria-haspopup":"menu",id:g,onMouseDown:Se=>{if(S.select("open"))return;K.start(200,()=>{S.context.allowMouseUpTriggerRef.current=!0}),ki(Se.currentTarget).addEventListener("mouseup",U,{once:!0})}},G?{role:"menuitem"}:{},se,m,H],ye=k.useRef(null),Ee=Xe(Se=>{xr.flushSync(()=>{S.setOpen(!1,it(ho,Se.nativeEvent,Se.currentTarget))}),qve(ye.current)?.focus()}),pe=Xe(Se=>{const Te=S.select("positionerElement");if(Te&&oo(Se,Te))S.context.beforeContentFocusGuardRef.current?.focus();else{xr.flushSync(()=>{S.setOpen(!1,it(ho,Se.nativeEvent,Se.currentTarget))});let de=Gve(T.current);for(;de!==null&&Tt(Te,de)||de?.hasAttribute("aria-hidden");){const Ce=de;if(de=$y(de),de===Ce)break}de?.focus()}}),_e=xt("button",t,{enabled:!G,stateAttributesMapping:Mp,state:Z,ref:ne,props:te});return G?b.jsx(Hx,{tag:"button",render:r,className:i,state:Z,refs:ne,props:te,stateAttributesMapping:Mp}):x?b.jsxs(k.Fragment,{children:[b.jsx(ll,{ref:ye,onFocus:Ee},`${g}-pre-focus-guard`),b.jsx(k.Fragment,{children:_e},g),b.jsx(ll,{ref:S.context.triggerFocusTargetRef,onFocus:pe},`${g}-post-focus-guard`)]}):b.jsx(k.Fragment,{children:_e},g)});function zSe(e,t){const n=Pn(),[r,i]=k.useState(!1);return Je(()=>{e&&t==="trigger-hover"?(i(!0),n.start(PJ,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function HSe(){const e=ew(!0),t=rd(!0),n=Sne();return k.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}function Yl(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const WSe=typeof ResizeObserver<"u",VSe=()=>!0;function GSe(e){const{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:a=VSe,onMeasureLayout:s,onMeasureLayoutComplete:o,side:l,direction:u}=e,f=k.useRef(!0),d=tM(t,!0,!1),p=su(),m=k.useRef(null),E=Xe(s),S=Xe(o),g=k.useMemo(()=>{let y=l==="top",v=l==="left";return u==="rtl"?(y=y||l==="inline-end",v=v||l==="inline-end"):(y=y||l==="inline-start",v=v||l==="inline-start"),y?{position:"absolute",[l==="top"?"bottom":"top"]:"0",[v?"right":"left"]:"0"}:Jn},[l,u]);Je(()=>{if(!i||!a()||!WSe){f.current=!0,m.current=null;return}if(!t||!n)return;Object.entries(g).forEach(([N,D])=>{t.style.setProperty(N,D)});const y=new ResizeObserver(N=>{const D=N[0];D&&(m.current===null?m.current={width:Math.ceil(D.borderBoxSize[0].inlineSize),height:Math.ceil(D.borderBoxSize[0].blockSize)}:(m.current.width=Math.ceil(D.borderBoxSize[0].inlineSize),m.current.height=Math.ceil(D.borderBoxSize[0].blockSize)))});y.observe(t),t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto");const v=ub(t,"position","static"),x=ub(t,"transform","none"),T=ub(t,"scale","1"),w=ub(n,"--available-width","max-content"),C=ub(n,"--available-height","max-content");if(E?.(),f.current||m.current===null){n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const N=wv(t);return n.style.setProperty("--positioner-width",`${N.width}px`),n.style.setProperty("--positioner-height",`${N.height}px`),v(),x(),T(),w(),C(),S?.(null,N),f.current=!1,()=>{y.disconnect()}}t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto"),n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const R=wv(t);t.style.setProperty("--popup-width",`${m.current.width}px`),t.style.setProperty("--popup-height",`${m.current.height}px`),v(),x(),w(),C(),S?.(m.current,R),n.style.setProperty("--positioner-width",`${R.width}px`),n.style.setProperty("--positioner-height",`${R.height}px`);const O=new AbortController;return p.request(()=>{t.style.setProperty("--popup-width",`${R.width}px`),t.style.setProperty("--popup-height",`${R.height}px`),d(()=>{t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto")},O.signal)}),()=>{y.disconnect(),O.abort(),p.cancel()}},[r,t,n,d,p,a,i,E,S,g])}function ub(e,t,n){const r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}const qSe=k.forwardRef(function(t,n){const{children:r,container:i,className:a,render:s,...o}=t,{portalNode:l,portalSubtree:u}=Ree({container:i,ref:n,componentProps:t,elementProps:o});return!u&&!l?null:b.jsxs(k.Fragment,{children:[u,l&&xr.createPortal(r,l)]})}),wne=k.createContext(void 0);function tw(){const e=k.useContext(wne);if(e===void 0)throw new Error(an(53));return e}let qE=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});const w_=500,bz=16;function Ns(e,t,n){if(!e)return 0;const r=getComputedStyle(e),i=n==="x"?"Inline":"Block";return n==="x"&&t==="margin"?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}let KSe=(function(e){return e.orientation="data-orientation",e.hovering="data-hovering",e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({}),Kh=(function(e){return e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({});const NM={hasOverflowX:e=>e?{[Kh.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[Kh.hasOverflowY]:""}:null,overflowXStart:e=>e?{[Kh.overflowXStart]:""}:null,overflowXEnd:e=>e?{[Kh.overflowXEnd]:""}:null,overflowYStart:e=>e?{[Kh.overflowYStart]:""}:null,overflowYEnd:e=>e?{[Kh.overflowYEnd]:""}:null,cornerHidden:()=>null},vz={width:0,height:0},YSe={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},XSe=k.forwardRef(function(t,n){const{render:r,className:i,overflowEdgeThreshold:a,...s}=t,[o,l]=k.useState(!1),[u,f]=k.useState(!1),[d,p]=k.useState(!1),[m,E]=k.useState(vz),[S,g]=k.useState(vz),[y,v]=k.useState(!1),[x,T]=k.useState(YSe),w=mi(),C=k.useRef(null),R=k.useRef(null),O=k.useRef(null),N=k.useRef(null),D=k.useRef(null),L=k.useRef(null),z=k.useRef(null),M=k.useRef(!1),V=k.useRef(0),H=k.useRef(0),B=k.useRef(0),q=k.useRef(0),K=k.useRef("vertical"),U=Pn(),j=Pn(),$=k.useRef({x:0,y:0}),[Y,W]=k.useState({scrollbarYHidden:!1,scrollbarXHidden:!1,cornerHidden:!1}),J=ZSe(a),ae=Xe(Ee=>{const pe=Ee.x-$.current.x,_e=Ee.y-$.current.y;$.current=Ee,_e!==0&&(p(!0),U.start(w_,()=>{p(!1)})),pe!==0&&(f(!0),j.start(w_,()=>{f(!1)}))}),se=Xe(Ee=>{Ee.button===0&&(M.current=!0,V.current=Ee.clientY,H.current=Ee.clientX,K.current=Ee.currentTarget.getAttribute(KSe.orientation),R.current&&(B.current=R.current.scrollTop,q.current=R.current.scrollLeft),D.current&&K.current==="vertical"&&D.current.setPointerCapture(Ee.pointerId),L.current&&K.current==="horizontal"&&L.current.setPointerCapture(Ee.pointerId))}),Q=Xe(Ee=>{if(!M.current)return;const pe=Ee.clientY-V.current,_e=Ee.clientX-H.current;if(R.current){const Se=R.current.scrollHeight,Te=R.current.clientHeight,de=R.current.scrollWidth,Ce=R.current.clientWidth;if(D.current&&O.current&&K.current==="vertical"){const ge=Ns(O.current,"padding","y"),he=Ns(D.current,"margin","y"),ce=D.current.offsetHeight,Ne=O.current.offsetHeight-ce-ge-he,Pe=pe/Ne;R.current.scrollTop=B.current+Pe*(Se-Te),Ee.preventDefault(),p(!0),U.start(w_,()=>{p(!1)})}if(L.current&&N.current&&K.current==="horizontal"){const ge=Ns(N.current,"padding","x"),he=Ns(L.current,"margin","x"),ce=L.current.offsetWidth,Ne=N.current.offsetWidth-ce-ge-he,Pe=_e/Ne;R.current.scrollLeft=q.current+Pe*(de-Ce),Ee.preventDefault(),f(!0),j.start(w_,()=>{f(!1)})}}}),G=Xe(Ee=>{M.current=!1,D.current&&K.current==="vertical"&&D.current.releasePointerCapture(Ee.pointerId),L.current&&K.current==="horizontal"&&L.current.releasePointerCapture(Ee.pointerId)});function Z(Ee){const pe=Ee.pointerType==="touch";if(v(pe),!pe){const _e=Tt(C.current,Ee.target);l(_e)}}const ee=k.useMemo(()=>({hasOverflowX:!Y.scrollbarXHidden,hasOverflowY:!Y.scrollbarYHidden,overflowXStart:x.xStart,overflowXEnd:x.xEnd,overflowYStart:x.yStart,overflowYEnd:x.yEnd,cornerHidden:Y.cornerHidden}),[Y.scrollbarXHidden,Y.scrollbarYHidden,Y.cornerHidden,x]),ne={role:"presentation",onPointerEnter:Z,onPointerMove:Z,onPointerDown({pointerType:Ee}){v(Ee==="touch")},onPointerLeave(){l(!1)},style:{position:"relative",[qE.scrollAreaCornerHeight]:`${m.height}px`,[qE.scrollAreaCornerWidth]:`${m.width}px`}},te=xt("div",t,{state:ee,ref:[n,C],props:[ne,s],stateAttributesMapping:NM}),ye=k.useMemo(()=>({handlePointerDown:se,handlePointerMove:Q,handlePointerUp:G,handleScroll:ae,cornerSize:m,setCornerSize:E,thumbSize:S,setThumbSize:g,touchModality:y,cornerRef:z,scrollingX:u,setScrollingX:f,scrollingY:d,setScrollingY:p,hovering:o,setHovering:l,viewportRef:R,rootRef:C,scrollbarYRef:O,scrollbarXRef:N,thumbYRef:D,thumbXRef:L,rootId:w,hiddenState:Y,setHiddenState:W,overflowEdges:x,setOverflowEdges:T,viewportState:ee,overflowEdgeThreshold:J}),[se,Q,G,ae,m,S,y,z,u,f,d,p,o,l,R,C,O,N,D,L,w,Y,x,ee,J]);return b.jsxs(wne.Provider,{value:ye,children:[Iv.element,te]})});function ZSe(e){if(typeof e=="number"){const t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}const QSe=k.createContext(void 0);function JSe(e,t){if(typeof IntersectionObserver>"u")return()=>{};const n=new IntersectionObserver(r=>{r.forEach(i=>{i.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}let Tc=(function(e){return e.scrollAreaOverflowXStart="--scroll-area-overflow-x-start",e.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",e.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",e.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",e})({}),yz=!1;function exe(){yz||$P||(typeof CSS<"u"&&"registerProperty"in CSS&&[Tc.scrollAreaOverflowXStart,Tc.scrollAreaOverflowXEnd,Tc.scrollAreaOverflowYStart,Tc.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),yz=!0)}const txe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{viewportRef:s,scrollbarYRef:o,scrollbarXRef:l,thumbYRef:u,thumbXRef:f,cornerRef:d,setCornerSize:p,setThumbSize:m,rootId:E,setHiddenState:S,hiddenState:g,handleScroll:y,setHovering:v,setOverflowEdges:x,overflowEdges:T,overflowEdgeThreshold:w}=tw(),C=Ou(),R=k.useRef(!0),O=Pn(),N=Pn();function D(){const q=s.current,K=o.current,U=l.current,j=u.current,$=f.current,Y=d.current;if(!q)return;const W=q.scrollHeight,J=q.scrollWidth,ae=q.clientHeight,se=q.clientWidth,Q=q.scrollTop,G=q.scrollLeft;if(W===0||J===0)return;const Z=ae>=W,ee=se>=J,ne=se/J,te=ae/W,ye=Math.max(0,J-se),Ee=Math.max(0,W-ae);let pe=0,_e=0;ee||(C==="rtl"?pe=Yl(-G,0,ye):pe=Yl(G,0,ye),_e=ye-pe);const Se=Z?0:Yl(Q,0,Ee),Te=Z?0:Ee-Se,de=ee?0:se,Ce=Z?0:ae,ge=Ns(U,"padding","x"),he=Ns(K,"padding","y"),ce=Ns($,"margin","x"),Ne=Ns(j,"margin","y"),Pe=de-ge-ce,ve=Ce-he-Ne,Le=U?Math.min(U.offsetWidth,Pe):Pe,Ae=K?Math.min(K.offsetHeight,ve):ve,Ve=Math.max(bz,Le*ne),Ze=Math.max(bz,Ae*te);if(m(ze=>ze.height===Ze&&ze.width===Ve?ze:{width:Ve,height:Ze}),K&&j){const ze=K.offsetHeight-Ze-he-Ne,et=W-ae,lt=et===0?0:Q/et,pt=Math.min(ze,Math.max(0,lt*ze));j.style.transform=`translate3d(0,${pt}px,0)`}if(U&&$){const ze=U.offsetWidth-Ve-ge-ce,et=J-se,lt=et===0?0:G/et,pt=C==="rtl"?Yl(lt*ze,-ze,0):Yl(lt*ze,0,ze);$.style.transform=`translate3d(${pt}px,0,0)`}const gt=Yl(pe,0,ye),st=Yl(_e,0,ye),ot=Yl(Se,0,Ee),Fe=Yl(Te,0,Ee),ht=[[Tc.scrollAreaOverflowXStart,gt],[Tc.scrollAreaOverflowXEnd,st],[Tc.scrollAreaOverflowYStart,ot],[Tc.scrollAreaOverflowYEnd,Fe]];for(const[ze,et]of ht)q.style.setProperty(ze,`${et}px`);if(Y){if(ee||Z)p({width:0,height:0});else if(!ee&&!Z){const ze=K?.offsetWidth||0,et=U?.offsetHeight||0;p({width:ze,height:et})}}S(ze=>{const et=Z||ee;return ze.scrollbarYHidden===Z&&ze.scrollbarXHidden===ee&&ze.cornerHidden===et?ze:{scrollbarYHidden:Z,scrollbarXHidden:ee,cornerHidden:et}});const Ie={xStart:!ee&&gt>w.xStart,xEnd:!ee&&st>w.xEnd,yStart:!Z&&ot>w.yStart,yEnd:!Z&&Fe>w.yEnd};x(ze=>ze.xStart===Ie.xStart&&ze.xEnd===Ie.xEnd&&ze.yStart===Ie.yStart&&ze.yEnd===Ie.yEnd?ze:Ie)}const L=Xe(()=>{xr.flushSync(D)});Je(()=>s.current?(exe(),JSe(s.current,L)):void 0,[L,s]),Je(()=>{queueMicrotask(L)},[L,g,C]),Je(()=>{s.current?.matches(":hover")&&v(!0)},[s,v]),k.useEffect(()=>{const q=s.current;if(typeof ResizeObserver>"u"||!q)return;const K=new ResizeObserver(L);return K.observe(q),N.start(0,()=>{Promise.all(q.getAnimations({subtree:!0}).map(U=>U.finished)).then(L).catch(()=>{})}),()=>{K.disconnect(),N.clear()}},[L,s,N]);function z(){R.current=!1}const M={role:"presentation",...E&&{"data-id":`${E}-viewport`},...(!g.scrollbarXHidden||!g.scrollbarYHidden)&&{tabIndex:0},className:Iv.className,style:{overflow:"scroll"},onScroll(){s.current&&(L(),R.current||y({x:s.current.scrollLeft,y:s.current.scrollTop}),O.start(100,()=>{R.current=!0}))},onWheel:z,onTouchMove:z,onPointerMove:z,onPointerEnter:z,onKeyDown:z},V=k.useMemo(()=>({hasOverflowX:!g.scrollbarXHidden,hasOverflowY:!g.scrollbarYHidden,overflowXStart:T.xStart,overflowXEnd:T.xEnd,overflowYStart:T.yStart,overflowYEnd:T.yEnd,cornerHidden:g.cornerHidden}),[g.scrollbarXHidden,g.scrollbarYHidden,g.cornerHidden,T]),H=xt("div",t,{ref:[n,s],state:V,props:[M,a],stateAttributesMapping:NM}),B=k.useMemo(()=>({computeThumbPosition:L}),[L]);return b.jsx(QSe.Provider,{value:B,children:H})}),Tne=k.createContext(void 0);function nxe(){const e=k.useContext(Tne);if(e===void 0)throw new Error(an(54));return e}let KE=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});const rxe=k.forwardRef(function(t,n){const{render:r,className:i,orientation:a="vertical",keepMounted:s=!1,...o}=t,{hovering:l,scrollingX:u,scrollingY:f,hiddenState:d,overflowEdges:p,scrollbarYRef:m,scrollbarXRef:E,viewportRef:S,thumbYRef:g,thumbXRef:y,handlePointerDown:v,handlePointerUp:x,rootId:T,thumbSize:w}=tw(),C=k.useMemo(()=>({hovering:l,scrolling:{horizontal:u,vertical:f}[a],orientation:a,hasOverflowX:!d.scrollbarXHidden,hasOverflowY:!d.scrollbarYHidden,overflowXStart:p.xStart,overflowXEnd:p.xEnd,overflowYStart:p.yStart,overflowYEnd:p.yEnd,cornerHidden:d.cornerHidden}),[l,u,f,a,d,p]),R=Ou();k.useEffect(()=>{const M=S.current,V=a==="vertical"?m.current:E.current;if(!V)return;function H(B){if(!(!M||!V||B.ctrlKey)){if(B.preventDefault(),a==="vertical"){if(M.scrollTop===0&&B.deltaY<0)return}else if(M.scrollLeft===0&&B.deltaX<0)return;if(a==="vertical"){if(M.scrollTop===M.scrollHeight-M.clientHeight&&B.deltaY>0)return}else if(M.scrollLeft===M.scrollWidth-M.clientWidth&&B.deltaX>0)return;a==="vertical"?M.scrollTop+=B.deltaY:M.scrollLeft+=B.deltaX}}return V.addEventListener("wheel",H,{passive:!1}),()=>{V.removeEventListener("wheel",H)}},[a,E,m,S]);const O={...T&&{"data-id":`${T}-scrollbar`},onPointerDown(M){if(M.button===0&&M.currentTarget===M.target&&S.current){if(g.current&&m.current&&a==="vertical"){const V=Ns(g.current,"margin","y"),H=Ns(m.current,"padding","y"),B=g.current.offsetHeight,q=m.current.getBoundingClientRect(),K=M.clientY-q.top-B/2-H+V/2,U=S.current.scrollHeight,j=S.current.clientHeight,$=m.current.offsetHeight-B-H-V,W=K/$*(U-j);S.current.scrollTop=W}if(y.current&&E.current&&a==="horizontal"){const V=Ns(y.current,"margin","x"),H=Ns(E.current,"padding","x"),B=y.current.offsetWidth,q=E.current.getBoundingClientRect(),K=M.clientX-q.left-B/2-H+V/2,U=S.current.scrollWidth,j=S.current.clientWidth,$=E.current.offsetWidth-B-H-V,Y=K/$;let W;R==="rtl"?(W=(1-Y)*(U-j),S.current.scrollLeft<=0&&(W=-W)):W=Y*(U-j),S.current.scrollLeft=W}v(M)}},onPointerUp:x,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",...a==="vertical"&&{top:0,bottom:`var(${qE.scrollAreaCornerHeight})`,insetInlineEnd:0,[KE.scrollAreaThumbHeight]:`${w.height}px`},...a==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${qE.scrollAreaCornerWidth})`,bottom:0,[KE.scrollAreaThumbWidth]:`${w.width}px`}}},N=xt("div",t,{ref:[n,a==="vertical"?m:E],state:C,props:[O,o],stateAttributesMapping:NM}),D=k.useMemo(()=>({orientation:a}),[a]),L=a==="vertical"?d.scrollbarYHidden:d.scrollbarXHidden;return s||!L?b.jsx(Tne.Provider,{value:D,children:N}):null}),ixe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{thumbYRef:s,thumbXRef:o,handlePointerDown:l,handlePointerMove:u,handlePointerUp:f,setScrollingX:d,setScrollingY:p}=tw(),{orientation:m}=nxe(),E=k.useMemo(()=>({orientation:m}),[m]);return xt("div",t,{ref:[n,m==="vertical"?s:o],state:E,props:[{onPointerDown:l,onPointerMove:u,onPointerUp(g){m==="vertical"&&p(!1),m==="horizontal"&&d(!1),f(g)},style:{...m==="vertical"&&{height:`var(${KE.scrollAreaThumbHeight})`},...m==="horizontal"&&{width:`var(${KE.scrollAreaThumbWidth})`}}},a]})}),axe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{cornerRef:s,cornerSize:o,hiddenState:l}=tw(),u=xt("div",t,{ref:[n,s],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:o.width,height:o.height}},a]});return l.cornerHidden?null:u}),Cne=k.createContext(void 0);function sxe(){const e=k.useContext(Cne);if(e===void 0)throw new Error(an(63));return e}let _z=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Ane={...Kf,checked(e){return e?{[_z.checked]:""}:{[_z.unchecked]:""}}},oxe=k.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:a,id:s,inputRef:o,name:l,nativeButton:u=!1,onCheckedChange:f,readOnly:d=!1,required:p=!1,disabled:m=!1,render:E,uncheckedValue:S,...g}=t,{clearErrors:y}=Zy(),{state:v,setTouched:x,setDirty:T,validityData:w,setFilled:C,setFocused:R,shouldValidateOnChange:O,validationMode:N,disabled:D,name:L,validation:z}=Bs(),{labelId:M}=nd(),V=D||m,H=L??l,B=Xe(f),q=k.useRef(null),K=Fs(q,o,z.inputRef),U=k.useRef(null),j=mi(),$=Qx({id:s,implicit:!1,controlRef:U}),[Y,W]=ts({controlled:r,default:!!a,name:"Switch",state:"checked"});Qy({id:j,commit:z.commit,value:Y,controlRef:U,name:H,getValue:()=>Y}),Je(()=>{q.current&&C(q.current.checked)},[q,C]),ef(Y,()=>{y(H),T(Y!==w.initialValue),C(Y),O()?z.commit(Y):z.commit(Y,!0)});const{getButtonProps:J,buttonRef:ae}=sa({disabled:V,native:u}),se={id:j,role:"switch","aria-checked":Y,"aria-readonly":d||void 0,"aria-labelledby":M,onFocus(){V||R(!0)},onBlur(){const ee=q.current;!ee||V||(x(!0),R(!1),N==="onBlur"&&z.commit(ee.checked))},onClick(ee){d||V||(ee.preventDefault(),q?.current?.click())}},Q=k.useMemo(()=>ol({checked:Y,disabled:V,id:$,name:H,required:p,style:Rm,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:K,onChange(ee){if(ee.nativeEvent.defaultPrevented)return;const ne=ee.target.checked,te=it(Dr,ee.nativeEvent);B?.(ne,te),!te.isCanceled&&W(ne)},onFocus(){U.current?.focus()}},z.getInputValidationProps),[Y,V,K,$,H,B,p,W,z]),G=k.useMemo(()=>({...v,checked:Y,disabled:V,readOnly:d,required:p}),[v,Y,V,d,p]),Z=xt("span",t,{state:G,ref:[n,U,ae],props:[se,z.getValidationProps,g,J],stateAttributesMapping:Ane});return b.jsxs(Cne.Provider,{value:G,children:[Z,!Y&&H&&S!==void 0&&b.jsx("input",{type:"hidden",name:H,value:S}),b.jsx("input",{...Q})]})}),lxe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{state:s}=Bs(),o=sxe(),l={...s,...o};return xt("span",t,{state:l,ref:n,stateAttributesMapping:Ane,props:a})}),kne=k.createContext(void 0);function uxe(e=!0){const t=k.useContext(kne);if(t===void 0&&!e)throw new Error(an(7));return t}const cxe=k.forwardRef(function(t,n){const{className:r,defaultPressed:i=!1,disabled:a=!1,form:s,onPressedChange:o,pressed:l,render:u,type:f,value:d,nativeButton:p=!0,...m}=t,E=mi(d||void 0),S=uxe(),g=S?.value??[],y=S?void 0:i,v=(a||S?.disabled)??!1,[x,T]=ts({controlled:S?g?.indexOf(E)>-1:l,default:y,name:"Toggle",state:"pressed"}),w=Xe((z,M)=>{E&&S?.setGroupValue?.(E,z,M),o?.(z,M)}),{getButtonProps:C,buttonRef:R}=sa({disabled:v,native:p}),O=k.useMemo(()=>({disabled:v,pressed:x}),[v,x]),N=[R,n],D=[{"aria-pressed":x,onClick(z){const M=!x,V=it(Dr,z.nativeEvent);w(M,V),!V.isCanceled&&T(M)}},m,C],L=xt("button",t,{enabled:!S,state:O,ref:N,props:D});return S?b.jsx(Hx,{tag:"button",render:u,className:r,state:O,refs:N,props:D}):L});let dxe=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const Ez={multiple(e){return e?{[dxe.multiple]:""}:null}},fxe=k.forwardRef(function(t,n){const{defaultValue:r,disabled:i=!1,loopFocus:a=!0,onValueChange:s,orientation:o="horizontal",multiple:l=!1,value:u,className:f,render:d,...p}=t,m=xM(),E=k.useMemo(()=>{if(u===void 0)return r??[]},[u,r]),S=(m?.disabled??!1)||i,[g,y]=ts({controlled:u,default:E,name:"ToggleGroup",state:"value"}),v=Xe((R,O,N)=>{let D;if(l?(D=g.slice(),O?D.push(R):D.splice(g.indexOf(R),1)):D=O?[R]:[],Array.isArray(D)){if(s?.(D,N),N.isCanceled)return;y(D)}}),x=k.useMemo(()=>({disabled:S,multiple:l,orientation:o}),[S,o,l]),T=k.useMemo(()=>({disabled:S,orientation:o,setGroupValue:v,value:g}),[S,o,v,g]),w={role:"group"},C=xt("div",t,{enabled:!!m,state:x,ref:n,props:[w,p],stateAttributesMapping:Ez});return b.jsx(kne.Provider,{value:T,children:m?C:b.jsx($x,{render:d,className:f,state:x,refs:[n],props:[w,p],stateAttributesMapping:Ez,loopFocus:a})})}),One=k.createContext(void 0);function Jy(e){const t=k.useContext(One);if(t===void 0&&!e)throw new Error(an(72));return t}const hxe={...sM,disabled:Ue(e=>e.disabled),instantType:Ue(e=>e.instantType),isInstantPhase:Ue(e=>e.isInstantPhase),trackCursorAxis:Ue(e=>e.trackCursorAxis),disableHoverablePopup:Ue(e=>e.disableHoverablePopup),lastOpenChangeReason:Ue(e=>e.openChangeReason),closeDelay:Ue(e=>e.closeDelay)};class IM extends Mx{constructor(t){super({...pxe(),...t},{popupRef:k.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Wy},hxe)}setOpen=(t,n)=>{const r=n.reason,i=r===dr,a=t&&r===Sv,s=!t&&(r===au||r===zy);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const o=()=>{const l={open:t,openChangeReason:r};a?l.instantType="focus":s?l.instantType="dismiss":r===dr&&(l.instantType=void 0);const u=n.trigger?.id??null;(u||t)&&(l.activeTriggerId=u,l.activeTriggerElement=n.trigger??null),this.update(l)};i?xr.flushSync(o):o()};static useStore(t,n){const r=pi(()=>t??new IM(n)).current,i=oM({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=i,r}}function pxe(){return{...aM(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0}}function mxe(e){const{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a="none",actionsRef:s,onOpenChange:o,onOpenChangeComplete:l,handle:u,triggerId:f,defaultTriggerId:d=null,children:p}=e,m=IM.useStore(u?.store,{open:r??n,activeTriggerId:f!==void 0?f:d});m.useControlledProp("open",r,n),m.useControlledProp("activeTriggerId",f,d),m.useContextCallback("onOpenChange",o),m.useContextCallback("onOpenChangeComplete",l);const E=m.useState("open"),S=m.useState("activeTriggerId"),g=m.useState("payload");m.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i});const y=!t&&E;Je(()=>{E&&t&&m.setOpen(!1,it(Qve))},[E,t,m]),m.useSyncedValue("disabled",t),rM(m);const{forceUnmount:v,transitionStatus:x}=iM(y,m),T=m.useState("isInstantPhase"),w=m.useState("instantType"),C=m.useState("lastOpenChangeReason"),R=k.useRef(null);Je(()=>{x==="ending"&&C===Dr||x!=="ending"&&T?(w!=="delay"&&(R.current=w),m.set("instantType","delay")):R.current!==null&&(m.set("instantType",R.current),R.current=null)},[x,T,C,w,m]),Je(()=>{y&&S==null&&m.set("payload",void 0)},[m,S,y]);const O=k.useCallback(()=>{m.setOpen(!1,gxe(m,ZP))},[m]);k.useImperativeHandle(s,()=>({unmount:v,close:O}),[v,O]);const N=m.useState("floatingRootContext"),D=$ee(N,{enabled:!t}),L=Im(N,{enabled:!t,referencePress:!0}),z=mye(N,{enabled:!t&&a!=="none",axis:a==="none"?void 0:a}),{getReferenceProps:M,getFloatingProps:V,getTriggerProps:H}=Jc([D,L,z]),B=k.useMemo(()=>M(),[M]),q=k.useMemo(()=>H(),[H]),K=k.useMemo(()=>V(),[V]);return m.useSyncedValues({floatingRootContext:N,activeTriggerProps:B,inactiveTriggerProps:q,popupProps:K}),b.jsx(One.Provider,{value:m,children:typeof p=="function"?p({payload:g}):p})}function gxe(e,t){const n=it(t);return n.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},n}const Rne=k.createContext(void 0);function bxe(){return k.useContext(Rne)}const vxe=600,yxe=k.forwardRef(function(t,n){const{className:r,render:i,handle:a,payload:s,disabled:o,delay:l,closeDelay:u,id:f,...d}=t,p=Jy(!0),m=a?.store??p;if(!m)throw new Error(an(82));const E=mi(f),S=m.useState("isTriggerActive",E),g=m.useState("floatingRootContext"),y=m.useState("isOpenedByTrigger",E),v=k.useRef(null),x=l??vxe,T=u??0,{registerTrigger:w,isMountedByThisTrigger:C}=nM(E,v,m,{payload:s,closeDelay:T}),R=bxe(),{delayRef:O,isInstantPhase:N,hasProvider:D}=iye(g,{open:y});m.useSyncedValue("isInstantPhase",N);const L=m.useState("disabled"),z=o??L,M=m.useState("trackCursorAxis"),V=m.useState("disableHoverablePopup"),H=Wee(g,{enabled:!z,mouseOnly:!0,move:!1,handleClose:!V&&M!=="both"?cM():null,restMs(){const U=R?.delay,j=typeof O.current=="object"?O.current.open:void 0;let $=x;return D&&(j!==0?$=l??U??x:$=0),$},delay(){const U=typeof O.current=="object"?O.current.close:void 0;let j=T;return u==null&&D&&(j=U),{close:j}},triggerElementRef:v,isActiveTrigger:S}),B=k.useMemo(()=>({open:y}),[y]),q=m.useState("triggerProps",C);return xt("button",t,{state:B,ref:[n,w,v],props:[H,q,{id:E},d],stateAttributesMapping:zx})}),Nne=k.createContext(void 0);function _xe(){const e=k.useContext(Nne);if(e===void 0)throw new Error(an(70));return e}const Exe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t;return Jy().useState("mounted")||r?b.jsx(Nne.Provider,{value:r,children:b.jsx(qSe,{ref:n,...i})}):null}),Ine=k.createContext(void 0);function Dne(){const e=k.useContext(Ine);if(e===void 0)throw new Error(an(71));return e}const Sxe=k.forwardRef(function(t,n){const{render:r,className:i,anchor:a,positionMethod:s="absolute",side:o="top",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:E=!1,disableAnchorTracking:S=!1,collisionAvoidance:g=FP,...y}=t,v=Jy(),x=_xe(),T=v.useState("open"),w=v.useState("mounted"),C=v.useState("trackCursorAxis"),R=v.useState("disableHoverablePopup"),O=v.useState("floatingRootContext"),N=v.useState("instantType"),D=v.useState("transitionStatus"),L=Ky({anchor:a,positionMethod:s,floatingRootContext:O,mounted:w,side:o,sideOffset:u,align:l,alignOffset:f,collisionBoundary:d,collisionPadding:p,sticky:E,arrowPadding:m,disableAnchorTracking:S,keepMounted:x,collisionAvoidance:g,adaptiveOrigin:ate}),z=k.useMemo(()=>{const B={};return(!T||C==="both"||R)&&(B.pointerEvents="none"),{role:"presentation",hidden:!w,style:{...L.positionerStyles,...B}}},[T,C,R,w,L.positionerStyles]),M=k.useMemo(()=>({open:T,side:L.side,align:L.align,anchorHidden:L.anchorHidden,instant:C!=="none"?"tracking-cursor":N}),[T,L.side,L.align,L.anchorHidden,C,N]),V=k.useMemo(()=>({...M,arrowRef:L.arrowRef,arrowStyles:L.arrowStyles,arrowUncentered:L.arrowUncentered}),[M,L.arrowRef,L.arrowStyles,L.arrowUncentered]),H=xt("div",t,{state:M,props:[z,Pm(D),y],ref:[n,v.useStateSetter("positionerElement")],stateAttributesMapping:Oa});return b.jsx(Ine.Provider,{value:V,children:H})}),xxe={...Oa,...ss},wxe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,s=Jy(),{side:o,align:l}=Dne(),u=s.useState("open"),f=s.useState("mounted"),d=s.useState("instantType"),p=s.useState("transitionStatus"),m=s.useState("popupProps"),E=s.useState("payload"),S=s.useState("popupElement"),g=s.useState("positionerElement"),y=s.useState("floatingRootContext"),v=Ou();Oi({open:u,ref:s.context.popupRef,onComplete(){u&&s.context.onOpenChangeComplete?.(!0)}});function x(){y.context.events.emit("measure-layout")}function T(D,L){y.context.events.emit("measure-layout-complete",{previousDimensions:D,nextDimensions:L})}const w=k.useCallback(()=>s.context.triggerElements.size>1,[s]);GSe({popupElement:S,positionerElement:g,mounted:f,content:E,enabled:w,onMeasureLayout:x,onMeasureLayoutComplete:T,side:o,direction:v});const C=s.useState("disabled"),R=s.useState("closeDelay");Hee(y,{enabled:!C,closeDelay:R});const O=k.useMemo(()=>({open:u,side:o,align:l,instant:d,transitionStatus:p}),[u,o,l,d,p]);return xt("div",t,{state:O,ref:[n,s.context.popupRef,s.useStateSetter("popupElement")],props:[m,Pm(p),a],stateAttributesMapping:xxe})}),Txe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,o=Jy().useState("instantType"),{open:l,arrowRef:u,side:f,align:d,arrowUncentered:p,arrowStyles:m}=Dne(),E=k.useMemo(()=>({open:l,side:f,align:d,uncentered:p,instant:o}),[l,f,d,p,o]);return xt("div",t,{state:E,ref:[n,u],props:[{style:m,"aria-hidden":!0},a],stateAttributesMapping:Oa})}),Cxe=function(t){const{delay:n,closeDelay:r,timeout:i=400}=t,a=k.useMemo(()=>({delay:n,closeDelay:r}),[n,r]),s=k.useMemo(()=>({open:n,close:r}),[n,r]);return b.jsx(Rne.Provider,{value:a,children:b.jsx(rye,{delay:s,timeoutMs:i,children:t.children})})};function Axe(e){return xt(e.defaultTagName??"div",e,e)}function kxe({className:e,...t}){return b.jsx("div",{"data-slot":"input-group",role:"group",className:Be("border-input bg-input/20 dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot=input-group-control]:focus-visible]:ring-inset has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[[data-slot][aria-invalid=true]]:ring-inset h-7 rounded-md border transition-colors has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:ring-[2px] has-[[data-slot][aria-invalid=true]]:ring-[2px] has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 [[data-slot=combobox-content]_&]:focus-within:border-inherit [[data-slot=combobox-content]_&]:focus-within:ring-0 group/input-group relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto",e),...t})}const Oxe=Xc("text-muted-foreground **:data-[slot=kbd]:bg-muted-foreground/10 h-auto gap-1 py-2 text-xs/relaxed font-medium group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5 flex cursor-text items-center justify-center select-none",{variants:{align:{"inline-start":"pl-2 has-[>button]:ml-[-0.275rem] has-[>kbd]:ml-[-0.275rem] order-first","inline-end":"pr-2 has-[>button]:mr-[-0.275rem] has-[>kbd]:mr-[-0.275rem] order-last","block-start":"px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start","block-end":"px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start"}},defaultVariants:{align:"inline-start"}});function Rxe({className:e,align:t="inline-start",...n}){return b.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Be(Oxe({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}const Nxe=Xc("gap-2 rounded-md text-xs/relaxed shadow-none flex items-center",{variants:{size:{xs:"h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3",sm:"","icon-xs":"size-6 p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function Lne({className:e,type:t="button",variant:n="ghost",size:r="xs",...i}){return b.jsx(qe,{type:t,"data-size":r,variant:n,className:Be(Nxe({size:r}),e),...i})}function Ixe({className:e,...t}){return b.jsx(dn,{"data-slot":"input-group-control",className:Be("rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent flex-1",e),...t})}const Dxe=ySe;function Lxe({className:e,children:t,...n}){return b.jsxs(YEe,{"data-slot":"combobox-trigger",className:Be("[&_svg:not([class*='size-'])]:size-3.5",e),...n,children:[t,b.jsx(fe,{icon:Yy,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})]})}function Pxe({className:e,...t}){return b.jsx(tSe,{"data-slot":"combobox-clear",render:b.jsx(Lne,{variant:"ghost",size:"icon-xs"}),className:Be(e),...t,children:b.jsx(fe,{icon:fi,strokeWidth:2,className:"pointer-events-none"})})}function Mxe({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return b.jsxs(kxe,{className:Be("w-auto",e),children:[b.jsx(JEe,{render:b.jsx(Ixe,{disabled:n}),...a}),b.jsxs(Rxe,{align:"inline-end",children:[r&&b.jsx(Lne,{size:"icon-xs",variant:"ghost",render:b.jsx(Lxe,{}),"data-slot":"input-group-button",className:"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",disabled:n}),i&&b.jsx(Pxe,{disabled:n})]}),t]})}function jxe({className:e,side:t="bottom",sideOffset:n=6,align:r="start",alignOffset:i=0,anchor:a,...s}){return b.jsx(oSe,{children:b.jsx(lSe,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,className:"isolate z-50",children:b.jsx(cSe,{"data-slot":"combobox-content","data-chips":!!a,className:Be("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-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 ring-foreground/10 *:data-[slot=input-group]:bg-input/20 dark:bg-popover max-h-72 min-w-32 overflow-hidden rounded-lg shadow-md ring-1 duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-7 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:shadow-none group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) data-[chips=true]:min-w-(--anchor-width)",e),...s})})})}function Fxe({className:e,...t}){return b.jsx(aSe,{"data-slot":"combobox-list",className:Be("no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto p-1 data-empty:p-0 overflow-y-auto overscroll-contain",e),...t})}function Bxe({className:e,children:t,...n}){return b.jsxs(hSe,{"data-slot":"combobox-item",className:Be("data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[t,b.jsx(_Se,{render:b.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:b.jsx(fe,{icon:pl,strokeWidth:2,className:"pointer-events-none"})})]})}function Uxe({className:e,...t}){return b.jsx(pSe,{"data-slot":"combobox-empty",className:Be("text-muted-foreground hidden w-full justify-center py-2 text-center text-xs/relaxed group-data-empty/combobox-content:flex",e),...t})}const $xe=Xc("hover:text-foreground hover:bg-accent/20 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive aria-pressed:bg-accent aria-pressed:text-accent-foreground aria-pressed:hover:bg-accent data-[state=on]:bg-accent data-[state=on]:text-accent-foreground data-[state=on]:hover:bg-accent gap-1 rounded-md text-xs font-medium transition-all [&_svg:not([class*='size-'])]:size-3.5 group/toggle inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border-input hover:bg-accent/20 border bg-transparent"},size:{default:"h-7 min-w-7 px-2",sm:"h-6 min-w-6 rounded-[min(var(--radius-md),8px)] px-1.5 text-[0.625rem] [&_svg:not([class*='size-'])]:size-3",lg:"h-8 min-w-8 px-2"}},defaultVariants:{variant:"default",size:"default"}}),Pne=k.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function zxe({className:e,variant:t,size:n,spacing:r=0,orientation:i="horizontal",children:a,...s}){return b.jsx(fxe,{"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:Be("rounded-md data-[size=sm]:rounded-[min(var(--radius-md),8px)] group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch",e),...s,children:b.jsx(Pne.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function Sz({className:e,children:t,variant:n="default",size:r="default",...i}){const a=k.useContext(Pne);return b.jsx(cxe,{"data-slot":"toggle-group-item","data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:Be("group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md shrink-0 focus:z-10 focus-visible:z-10 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",$xe({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}async function zt(e,t){const n=await fetch(e,{...t,headers:{"Content-Type":"application/json",...t?.headers}});if(!n.ok){const r=await n.json().catch(()=>({error:"Request failed"}));throw new Error(r.error||"Request failed")}return n.json()}const Hc="";function DM(){return qn({queryKey:["tasks"],queryFn:()=>zt(`${Hc}/api/tasks`)})}function Mne(e){return qn({queryKey:["tasks",e],queryFn:()=>zt(`${Hc}/api/tasks/${e}`),enabled:!!e})}function Hxe(){const e=wr();return Fn({mutationFn:t=>zt(`${Hc}/api/tasks`,{method:"POST",body:JSON.stringify({...t,status:"IN_PROGRESS"})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function Wxe(){const e=wr();return Fn({mutationFn:({taskId:t,status:n,position:r})=>zt(`${Hc}/api/tasks/${t}/status`,{method:"PATCH",body:JSON.stringify({status:n,position:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function nw(){const e=wr();return Fn({mutationFn:({taskId:t,updates:n})=>zt(`${Hc}/api/tasks/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{taskId:n})=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["tasks",n]})}})}function rw(){const e=wr();return Fn({mutationFn:({taskId:t,deleteLinkedWorktree:n})=>{const r=n?`${Hc}/api/tasks/${t}?deleteLinkedWorktree=true`:`${Hc}/api/tasks/${t}`;return zt(r,{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}function Vxe(){const e=wr();return Fn({mutationFn:({ids:t,deleteLinkedWorktrees:n})=>zt(`${Hc}/api/tasks/bulk`,{method:"DELETE",body:JSON.stringify({ids:t,deleteLinkedWorktrees:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}const e0="";function Gxe(e){return qn({queryKey:["fs","list",e],queryFn:()=>{const t=e?`?path=${encodeURIComponent(e)}`:"";return zt(`${e0}/api/fs/list${t}`)},enabled:e!==null})}function qxe(e){return qn({queryKey:["git","branches",e],queryFn:()=>zt(`${e0}/api/git/branches?repo=${encodeURIComponent(e)}`),enabled:!!e})}function Kxe(e,t={}){const{staged:n=!1,ignoreWhitespace:r=!1,includeUntracked:i=!1}=t;return qn({queryKey:["git","diff",e,n,r,i],queryFn:()=>{const a=new URLSearchParams({path:e,...n&&{staged:"true"},...r&&{ignoreWhitespace:"true"},...i&&{includeUntracked:"true"}});return zt(`${e0}/api/git/diff?${a}`)},enabled:!!e,refetchInterval:5e3})}function Yxe(e){return qn({queryKey:["git","status",e],queryFn:()=>zt(`${e0}/api/git/status?path=${encodeURIComponent(e)}`),enabled:!!e,refetchInterval:5e3})}async function Xxe(e){return zt(`${e0}/api/fs/is-git-repo?path=${encodeURIComponent(e)}`)}const gl="",In={PORT:"server.port",WORKTREE_BASE_PATH:"worktree_base_path",DEFAULT_GIT_REPOS_DIR:"paths.defaultGitReposDir",EDITOR_APP:"editor.app",EDITOR_HOST:"editor.host",EDITOR_SSH_PORT:"editor.sshPort",LINEAR_API_KEY:"integrations.linearApiKey",GITHUB_PAT:"integrations.githubPat",LANGUAGE:"appearance.language",SYNC_CLAUDE_CODE_THEME:"appearance.syncClaudeCodeTheme",CLAUDE_CODE_LIGHT_THEME:"appearance.claudeCodeLightTheme",CLAUDE_CODE_DARK_THEME:"appearance.claudeCodeDarkTheme"},Zxe=7777;function $s(e){return qn({queryKey:["config",e],queryFn:()=>zt(`${gl}/api/config/${e}`)})}function jne(){const e=$s(In.PORT);return{...e,data:e.data?.value??Zxe,isDefault:e.data?.isDefault??!0}}function Qxe(){const e=$s(In.WORKTREE_BASE_PATH);return{...e,data:e.data?.value??""}}function iw(){const e=$s(In.DEFAULT_GIT_REPOS_DIR);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function LM(){const e=$s(In.EDITOR_APP);return{...e,data:e.data?.value??"vscode",isDefault:e.data?.isDefault??!0}}function PM(){const e=$s(In.EDITOR_HOST);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function MM(){const e=$s(In.EDITOR_SSH_PORT);return{...e,data:e.data?.value??22,isDefault:e.data?.isDefault??!0}}function Jxe(){const e=$s(In.LINEAR_API_KEY);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function ewe(){const e=$s(In.GITHUB_PAT);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function twe(){const e=$s(In.LANGUAGE);return{...e,data:e.data?.value??null,isDefault:e.data?.isDefault??!0}}function nwe(){const e=$s(In.SYNC_CLAUDE_CODE_THEME);return{...e,data:!!e.data?.value,isDefault:e.data?.isDefault??!0}}const xz=["light","light-ansi","light-daltonized","dark","dark-ansi","dark-daltonized"];function rwe(){const e=$s(In.CLAUDE_CODE_LIGHT_THEME);return{...e,data:e.data?.value??"light-ansi",isDefault:e.data?.isDefault??!0}}function iwe(){const e=$s(In.CLAUDE_CODE_DARK_THEME);return{...e,data:e.data?.value??"dark-ansi",isDefault:e.data?.isDefault??!0}}function Fne(){const e=wr();return Fn({mutationFn:({key:t,value:n})=>zt(`${gl}/api/config/${t}`,{method:"PUT",body:JSON.stringify({value:n})}),onSuccess:(t,{key:n})=>{e.invalidateQueries({queryKey:["config",n]}),n===In.GITHUB_PAT&&(e.invalidateQueries({queryKey:["github-user"]}),e.invalidateQueries({queryKey:["github-prs"]}),e.invalidateQueries({queryKey:["github-issues"]}),e.invalidateQueries({queryKey:["github-orgs"]}))}})}function awe(){const e=wr();return Fn({mutationFn:t=>zt(`${gl}/api/config/${t}`,{method:"DELETE"}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["config",n]})}})}function swe(){return qn({queryKey:["config","notifications"],queryFn:()=>zt(`${gl}/api/config/notifications`)})}function owe(){const e=wr();return Fn({mutationFn:t=>zt(`${gl}/api/config/notifications`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","notifications"]})}})}function lwe(){return Fn({mutationFn:e=>zt(`${gl}/api/config/notifications/test/${e}`,{method:"POST"})})}function uwe(){return qn({queryKey:["config","z-ai"],queryFn:()=>zt(`${gl}/api/config/z-ai`)})}function cwe(){const e=wr();return Fn({mutationFn:t=>zt(`${gl}/api/config/z-ai`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","z-ai"]}),e.invalidateQueries({queryKey:["monitoring","claude-usage"]})}})}function Bne(){return qn({queryKey:["config","developer-mode"],queryFn:()=>zt(`${gl}/api/config/developer-mode`),staleTime:1/0})}function dwe(){return Fn({mutationFn:()=>zt(`${gl}/api/config/restart`,{method:"POST"})})}const yu="";function t0(){return qn({queryKey:["repositories"],queryFn:()=>zt(`${yu}/api/repositories`)})}function fwe(e){return qn({queryKey:["repositories",e],queryFn:()=>zt(`${yu}/api/repositories/${e}`),enabled:!!e})}function Une(){const e=wr();return Fn({mutationFn:t=>zt(`${yu}/api/repositories`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function hwe(){const e=wr();return Fn({mutationFn:t=>zt(`${yu}/api/repositories/clone`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function pwe(){const e=wr();return Fn({mutationFn:({id:t,updates:n})=>zt(`${yu}/api/repositories/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{id:n})=>{e.invalidateQueries({queryKey:["repositories"]}),e.invalidateQueries({queryKey:["repositories",n]})}})}function $ne(){const e=wr();return Fn({mutationFn:({id:t,deleteDirectory:n=!1})=>{const r=n?`${yu}/api/repositories/${t}?deleteDirectory=true`:`${yu}/api/repositories/${t}`;return zt(r,{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function mwe(){return Fn({mutationFn:e=>zt(`${yu}/api/repositories/scan`,{method:"POST",body:JSON.stringify(e?{directory:e}:{})})})}function gwe(){const e=wr();return Fn({mutationFn:t=>zt(`${yu}/api/repositories/bulk`,{method:"POST",body:JSON.stringify({repositories:t})}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function n0({className:e,children:t,...n}){return b.jsxs(XSe,{"data-slot":"scroll-area",className:Be("relative",e),...n,children:[b.jsx(txe,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),b.jsx(bwe,{}),b.jsx(axe,{})]})}function bwe({className:e,orientation:t="vertical",...n}){return b.jsx(rxe,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:Be("data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none",e),...n,children:b.jsx(ixe,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function gf({open:e,onOpenChange:t,onSelect:n,initialPath:r}){const[i,a]=k.useState(r||null),[s,o]=k.useState(""),[l,u]=k.useState("");k.useEffect(()=>{e&&(a(r||null),o(""),u(""))},[e,r]);const{data:f,isLoading:d,error:p}=Gxe(e?i??"":null),m=x=>{f&&(a(f.path+"/"+x),u(""))},E=()=>{f?.parent&&f.parent!==f.path&&(a(f.parent),u(""))},S=()=>{a(null),u("")},g=()=>{s.trim()&&(a(s.trim()),u(""))},y=x=>{n(x),t(!1)},v=f?.entries.filter(x=>x.name.toLowerCase().includes(l.toLowerCase()));return b.jsx(ed,{open:e,onOpenChange:t,children:b.jsxs(td,{className:"sm:max-w-lg overflow-hidden",children:[b.jsxs(Gf,{children:[b.jsx(qf,{children:"Select Git Repository"}),b.jsx(Zx,{children:"Choose an existing git repository"})]}),b.jsx("p",{className:"text-xs text-muted-foreground",children:"Click folder names to navigate • Use action buttons to select"}),b.jsx(oEe,{}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{className:"text-xs font-medium",children:"Enter path manually:"}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(dn,{value:s,onChange:x=>o(x.target.value),placeholder:"/path/to/your/project",onKeyDown:x=>x.key==="Enter"&&g(),className:"flex-1"}),b.jsx(qe,{variant:"outline",size:"sm",onClick:g,children:"Go"})]})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{className:"text-xs font-medium",children:"Search current directory:"}),b.jsxs("div",{className:"relative",children:[b.jsx(fe,{icon:Gx,size:14,strokeWidth:2,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),b.jsx(dn,{value:l,onChange:x=>u(x.target.value),placeholder:"Filter folders and files...",className:"pl-8"})]})]}),b.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b.jsx(qe,{variant:"outline",size:"icon-sm",onClick:S,title:"Home",className:"shrink-0",children:b.jsx(fe,{icon:j1e,size:14,strokeWidth:2})}),b.jsx(qe,{variant:"outline",size:"icon-sm",onClick:E,disabled:!f||f.parent===f.path,title:"Parent directory",className:"shrink-0",children:b.jsx(fe,{icon:mM,size:14,strokeWidth:2})}),b.jsx("code",{className:"min-w-0 flex-1 text-xs bg-muted/50 px-2 py-1 rounded truncate overflow-hidden",children:f?.path||"~"}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:()=>f&&y(f.path),disabled:!f,className:"shrink-0 max-sm:px-2",title:"Select current directory",children:[b.jsx(fe,{icon:JI,size:14,strokeWidth:2,className:"sm:hidden"}),b.jsx("span",{className:"max-sm:hidden",children:"Select Current"})]})]}),b.jsx(n0,{className:"h-64 border rounded-md",children:b.jsxs("div",{className:"p-1",children:[d&&b.jsx("div",{className:"text-muted-foreground text-xs p-3",children:"Loading..."}),p&&b.jsx("div",{className:"text-destructive text-xs p-3",children:p.message}),f&&v&&b.jsxs(b.Fragment,{children:[v.length===0&&b.jsx("div",{className:"text-muted-foreground text-xs p-3",children:l?"No matches found":"Empty directory"}),v.map(x=>b.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted group",children:x.type==="directory"?b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:x.isGitRepo?JI:Vi,size:16,strokeWidth:2,className:(x.isGitRepo,"text-accent")}),b.jsx("button",{onClick:()=>m(x.name),className:"flex-1 text-left text-xs truncate hover:underline",children:x.name}),x.isGitRepo&&b.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded border border-accent/50 text-accent font-medium shrink-0",children:[b.jsx("span",{className:"max-sm:hidden",children:"git repo"}),b.jsx("span",{className:"sm:hidden",children:"git"})]})]}):b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"w-4"}),b.jsx("span",{className:"flex-1 text-xs text-muted-foreground truncate",children:x.name})]})},x.name))]})]})}),b.jsxs(Df,{children:[b.jsx(Fp,{render:b.jsx(qe,{variant:"outline"}),children:"Cancel"}),b.jsx(qe,{onClick:()=>f&&y(f.path),disabled:!f,children:"Select Path"})]})]})})}function vwe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ywe(e){const t=vwe(e);if(!t)return"";const n=Math.random().toString(36).substring(2,6);return`${t}-${n}`}function jM({open:e,onOpenChange:t,defaultRepository:n,showTrigger:r=!0}={}){const{t:i}=rn("tasks"),{t:a}=rn("common"),[s,o]=k.useState(!1),l=e??s,u=t??o,[f,d]=k.useState(!1),[p,m]=k.useState(""),[E,S]=k.useState(""),[g,y]=k.useState(""),[v,x]=k.useState(""),[T,w]=k.useState(""),[C,R]=k.useState(""),[O,N]=k.useState("default"),[D,L]=k.useState(!1),[z,M]=k.useState(null),[V,H]=k.useState("browse"),[B,q]=k.useState(""),[K,U]=k.useState(null),[j,$]=k.useState(!1),Y=Ri(),W=Hxe(),J=Une(),ae=k.useRef(null),{data:se}=Qxe(),{data:Q}=iw(),{data:G}=t0(),{data:Z,isLoading:ee}=qxe(g||null),ne=z?G?.find(de=>de.id===z):null,te=k.useMemo(()=>{if(!G)return[];if(ne&&B===ne.displayName||!B.trim())return G;const de=B.toLowerCase();return G.filter(Ce=>Ce.displayName.toLowerCase().includes(de)||Ce.path.toLowerCase().includes(de))},[G,B,ne]);k.useEffect(()=>{G&&G.length>0?H("saved"):H("browse")},[G]),k.useEffect(()=>{if(l){if(n)M(n.id),y(n.path),q(n.displayName),H("saved");else if(G&&G.length>0){const de=G[0];M(de.id),y(de.path),q(de.displayName),H("saved")}}},[l,n,G]),k.useEffect(()=>{x(Z?Z.current||Z.branches[0]||"main":"")},[Z,g]);const ye=de=>{m(de),R(ywe(de))},Ee=async de=>{U(null),$(!0);try{if(!(await Xxe(de)).isGitRepo){U(i("createModal.errors.notGitRepo")),$(!1);return}if(y(de),M(null),!G?.find(he=>he.path===de)){const he=de.split("/").pop()||"Unknown";J.mutate({path:de,displayName:he})}}catch(Ce){U(Ce instanceof Error?Ce.message:i("createModal.errors.validationFailed"))}finally{$(!1)}},pe=de=>{if(de.preventDefault(),!p.trim()||!g)return;const Ce=g.split("/").pop()||"repo",ge=T.trim()||C,he=`${se}/${ge}`;W.mutate({title:p.trim(),description:E.trim(),aiMode:O,repoPath:g,repoName:Ce,baseBranch:v||"main",branch:ge,worktreePath:he,copyFiles:ne?.copyFiles||void 0,startupScript:ne?.startupScript||void 0},{onSuccess:ce=>{const Ne=E.trim()?{aiMode:O,description:E.trim()}:{aiMode:O};u(!1),m(""),S(""),y(""),x(""),w(""),R(""),N("default"),L(!1),M(null),q(""),U(null),H(G&&G.length>0?"saved":"browse"),Y({to:"/tasks/$taskId",params:{taskId:ce.id},state:Ne})},onError:ce=>{kt.error(i("createModal.errors.createFailed"),{description:ce instanceof Error?ce.message:String(ce)})}})},_e=!W.isPending&&!!p.trim()&&!!g;Va("meta+enter",()=>{ae.current&&ae.current.requestSubmit()},{enabled:l&&_e,allowInInput:!0,ignoreContext:!0,deps:[l,_e]});const Se=T.trim()||C,Te=Se?`${se}/${Se}`:"";return b.jsxs(b.Fragment,{children:[b.jsxs(ed,{open:l,onOpenChange:u,children:[r&&b.jsxs(Mte,{render:b.jsx(qe,{size:"sm"}),children:[b.jsx(fe,{icon:bM,size:16,strokeWidth:2,"data-slot":"icon",className:"-translate-y-px"}),i("newTask")]}),b.jsx(td,{className:"sm:max-w-md max-h-[80dvh] flex flex-col overflow-hidden",children:b.jsxs("form",{ref:ae,onSubmit:pe,className:"flex flex-col min-h-0 flex-1",children:[b.jsxs(Gf,{className:"shrink-0",children:[b.jsx(qf,{children:i("createModal.title")}),b.jsx(Zx,{children:i("createModal.description")})]}),b.jsxs(mf,{className:"mt-4 pb-4 overflow-y-auto min-h-0 flex-1",children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"title",children:i("createModal.fields.title")}),b.jsx(dn,{id:"title",value:p,onChange:de=>ye(de.target.value),placeholder:i("createModal.fields.titlePlaceholder"),required:!0})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"description",children:i("createModal.fields.description")}),b.jsx(Bte,{id:"description",value:E,onValueChange:de=>{S(de),D||N(de.trim()?"plan":"default")},placeholder:i("createModal.fields.descriptionPlaceholder"),rows:2})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:i("createModal.fields.aiMode")}),b.jsxs(zxe,{value:[O],onValueChange:de=>{const Ce=Array.isArray(de)?de[0]:de;Ce&&(N(Ce),L(!0))},className:"w-full",variant:"outline",children:[b.jsx(Sz,{value:"plan",className:"flex-1",children:i("createModal.aiModes.plan")}),b.jsx(Sz,{value:"default",className:"flex-1",children:i("createModal.aiModes.default")})]})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:i("createModal.fields.repository")}),b.jsxs(Zo,{value:V,onValueChange:de=>{H(de),U(null)},children:[b.jsxs(Qo,{children:[b.jsx(Wr,{value:"saved",disabled:!G?.length,children:i("createModal.tabs.saved")}),b.jsx(Wr,{value:"browse",children:i("createModal.tabs.browse")})]}),b.jsx(ci,{value:"saved",className:"mt-2",children:b.jsxs(Dxe,{value:z||"",onValueChange:de=>{const Ce=G?.find(ge=>ge.id===de);Ce&&(M(de),y(Ce.path),q(Ce.displayName),U(null))},inputValue:B,onInputValueChange:de=>{q(de),ne&&de!==ne.displayName&&M(null)},itemToStringLabel:de=>G?.find(Ce=>Ce.id===de)?.displayName||"",children:[b.jsx(Mxe,{placeholder:i("createModal.searchRepositories"),className:"w-full"}),b.jsx(jxe,{children:b.jsxs(Fxe,{children:[b.jsx(Uxe,{children:i("createModal.noRepositoriesFound")}),te.map(de=>b.jsx(Bxe,{value:de.id,children:de.displayName},de.id))]})})]})}),b.jsx(ci,{value:"browse",className:"mt-2",children:b.jsxs(qe,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>d(!0),disabled:j,children:[b.jsx(fe,{icon:Vi,size:14,strokeWidth:2,className:"mr-2"}),j?b.jsx("span",{className:"text-muted-foreground",children:a("status.validating")}):g&&!z?b.jsx("span",{className:"truncate",children:g}):b.jsx("span",{className:"text-muted-foreground group-hover/button:text-accent-foreground",children:i("createModal.selectFolder")})]})})]}),K&&b.jsx("p",{className:"text-sm text-destructive",children:K}),g&&!K&&b.jsx(Ya,{className:"font-mono text-xs truncate",children:g})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"baseBranch",children:i("createModal.fields.baseBranch")}),b.jsxs(Bi,{value:v,onValueChange:de=>x(de??""),disabled:!g||ee,children:[b.jsx($i,{className:"w-full",children:b.jsx(Ui,{children:v||b.jsx("span",{className:"text-muted-foreground",children:i(g?ee?"createModal.loadingBranches":"createModal.selectBranch":"createModal.selectRepositoryFirst")})})}),b.jsx(zi,{children:Z?.branches.map(de=>b.jsxs(Cn,{value:de,children:[de,de===Z.current&&b.jsx("span",{className:"text-muted-foreground ml-2",children:i("createModal.current")})]},de))})]})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"branch",children:i("createModal.fields.branchName")}),b.jsx(dn,{id:"branch",value:T,onChange:de=>w(de.target.value),placeholder:C||i("createModal.fields.branchPlaceholder")}),Te&&b.jsxs(Ya,{children:[i("createModal.worktreePrefix")," ",Te]}),!T.trim()&&C&&b.jsx(Ya,{children:i("createModal.branchAutoGenerated",{branch:C})})]})]}),b.jsxs(Df,{className:"mt-4 shrink-0",children:[b.jsx(Fp,{render:b.jsx(qe,{variant:"outline",type:"button",className:"border-destructive text-destructive hover:bg-destructive hover:text-white"}),children:a("buttons.cancel")}),b.jsx(qe,{type:"submit",disabled:W.isPending||!p.trim()||!g,children:W.isPending?a("status.creating"):i("createModal.createTask")})]})]})})]}),b.jsx(gf,{open:f,onOpenChange:d,onSelect:Ee,initialPath:Q||void 0})]})}const wz=[{to:"/tasks",icon:jp,labelKey:"header.tasks",matchPrefix:!0},{to:"/terminals",icon:Wx,labelKey:"header.terminals",matchPrefix:!1},{to:"/repositories",icon:Qd,labelKey:"header.repositories",matchPrefix:!0},{to:"/review",icon:ou,labelKey:"header.review",matchPrefix:!0},{to:"/monitoring",icon:dte,labelKey:"header.monitoring",matchPrefix:!0}];function _we({onNewTaskRef:e,onOpenCommandPalette:t}){const{t:n}=rn("navigation"),{location:r}=ri(),i=r.pathname,[a,s]=k.useState(!1),o=(l,u)=>u?i.startsWith(l):i===l;return k.useEffect(()=>{e?.(()=>s(!0))},[e]),b.jsxs("header",{className:"sticky top-0 z-10 flex h-12 shrink-0 items-center justify-between border-b border-border bg-card px-4 max-sm:px-2",children:[b.jsxs("div",{className:"flex min-w-0 items-center gap-4 max-sm:gap-2",children:[b.jsx(K1e,{className:"md:hidden",children:b.jsx(Y1e,{children:b.jsxs(X1e,{children:[b.jsxs(Q1e,{className:"bg-transparent hover:bg-muted/50 data-open:bg-muted/50 gap-1 px-2",children:[b.jsx(fe,{icon:_te,size:16,strokeWidth:2}),b.jsx("span",{className:"sr-only",children:"Menu"})]}),b.jsx(J1e,{className:"min-w-48",children:wz.map(l=>b.jsxs(t_e,{href:l.to,active:o(l.to,l.matchPrefix),render:b.jsx(Ai,{to:l.to}),children:[b.jsx(fe,{icon:l.icon,size:16,strokeWidth:2}),n(l.labelKey)]},l.to))})]})})}),b.jsx("nav",{className:"hidden items-center gap-1 md:flex",children:wz.map(l=>{const u=o(l.to,l.matchPrefix);return b.jsxs(Ai,{to:l.to,className:Be("relative flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium transition-colors",u?"bg-background text-foreground":"text-foreground/60 hover:text-foreground","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-foreground after:transition-opacity",u?"after:opacity-100":"after:opacity-0"),children:[b.jsx(fe,{icon:l.icon,size:16,strokeWidth:2,"data-slot":"icon"}),n(l.labelKey)]},l.to)})})]}),b.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[b.jsx(jM,{open:a,onOpenChange:s}),b.jsx(qe,{variant:"ghost",size:"icon-sm",onClick:t,title:n("header.commandPalette",{shortcut:"⌘K"}),children:b.jsx(fe,{icon:QI,size:16,strokeWidth:2})}),b.jsx(Ai,{to:"/settings",className:Be("relative flex items-center justify-center rounded-md p-1.5 transition-colors",i==="/settings"?"bg-background text-foreground":"text-foreground/60 hover:text-foreground","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-foreground after:transition-opacity",i==="/settings"?"after:opacity-100":"after:opacity-0"),children:b.jsx(fe,{icon:Ete,size:16,strokeWidth:2})})]})]})}function Ewe(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}const Swe=10,xwe=2e3;function wwe(){const e=wr(),t=Ri(),{resolvedTheme:n}=Kc(),r=k.useRef(null),i=k.useRef(void 0),a=k.useRef(0),s=k.useRef(void 0),o=k.useCallback(u=>{try{const f=JSON.parse(u.data);if(f.type==="task:updated")e.invalidateQueries({queryKey:["tasks"]});else if(f.type==="notification"&&"payload"in f){let d=function(){const N=y&&!v?"/goat.jpeg":n==="dark"?"/logo-dark.jpg":"/logo-light.jpg",L={description:E,icon:b.jsx("img",{src:N,alt:"",className:"size-8 shrink-0 aspect-square rounded-sm object-cover"}),...g&&{action:{label:"View",onClick:()=>t({to:"/tasks/$taskId",params:{taskId:g}})}}};switch(S){case"success":kt.success(m,L);break;case"error":kt.error(m,L);break;case"warning":kt.warning(m,L);break;default:kt.info(m,L);break}if("Notification"in window&&window.parent===window&&Notification.permission==="granted"&&new Notification(m,{body:E,icon:N,tag:p}),y){const V="vibora:lastSoundPlayed",H=Date.now(),B=localStorage.getItem(V);if(B){const K=parseInt(B.split(":")[0]);if(H-K<1e3)return}const q=`${H}:${Math.random().toString(36).slice(2)}`;localStorage.setItem(V,q),setTimeout(()=>{if(localStorage.getItem(V)!==q)return;let K=!1;const U=()=>{if(K)return;K=!0,new Audio("/sounds/goat-bleat.mp3").play().catch(()=>{})},j=new Audio("/api/uploads/sound");j.onerror=U,j.play().catch(U)},50)}window.parent!==window&&window.parent.postMessage({type:"vibora:notification",title:m,message:E,notificationType:S},"*")};const{id:p,title:m,message:E,notificationType:S,taskId:g,playSound:y,isCustomSound:v}=f.payload,x=`vibora:notification:${p}`,T=50,w=1e4;if(localStorage.getItem(x))return;const R=`${Date.now()}:${Math.random().toString(36).slice(2)}`;localStorage.setItem(x,R),setTimeout(()=>{localStorage.getItem(x)===R&&(setTimeout(()=>localStorage.removeItem(x),w),d())},T)}}catch{}},[e,t,n]),l=k.useCallback(()=>{const u=r.current;if(u&&(u.readyState===WebSocket.CONNECTING||u.readyState===WebSocket.OPEN))return;const f=Ewe(),d=new WebSocket(f);r.current=d,d.onopen=()=>{a.current=0},d.onmessage=o,d.onclose=()=>{r.current===d&&(r.current=null),a.current<Swe&&(a.current++,i.current=setTimeout(()=>{s.current?.()},xwe))},d.onerror=()=>{}},[o]);s.current=l,k.useEffect(()=>{"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[]),k.useEffect(()=>(l(),()=>{i.current&&clearTimeout(i.current);const u=r.current;u&&(u.readyState===WebSocket.OPEN&&u.close(),r.current=null)}),[l])}const Twe={save:"Save Changes",cancel:"Cancel",delete:"Delete",create:"Create",reset:"Reset to default",browse:"Browse",clearFilters:"Clear filters"},Cwe={loading:"Loading...",saving:"Saving...",saved:"Saved",error:"Error",calculating:"calculating...",validating:"Validating...",creating:"Creating...",deleting:"Deleting...",loggingIn:"Logging in..."},Awe={justNow:"just now",minuteAgo:"1 minute ago",minutesAgo:"{{count}} minutes ago",hourAgo:"1 hour ago",hoursAgo:"{{count}} hours ago",dayAgo:"1 day ago",daysAgo:"{{count}} days ago"},kwe={one:"{{count}} result",other:"{{count}} results"},Owe={IN_PROGRESS:"In Progress",IN_REVIEW:"In Review",DONE:"Done",CANCELED:"Canceled",ORPHANED:"Orphaned"},Rwe={loginTitle:"Login to Vibora",username:"Username",password:"Password",login:"Login",loginFailed:"Login failed"},Nwe={buttons:Twe,status:Cwe,time:Awe,results:kwe,statuses:Owe,auth:Rwe},Iwe={tasks:"Tasks",terminals:"Terminals",worktrees:"Worktrees",repositories:"Repositories",review:"Review",monitoring:"Monitoring",settings:"Settings",commandPalette:"Command Palette ({{shortcut}})"},Dwe={placeholder:"Type a command or search...",noResults:"No commands found.",categories:{navigation:"Navigation",actions:"Actions"},commands:{goToTasks:"Go to Tasks",goToTerminals:"Go to Terminals",goToTaskTerminals:"Go to Task Terminals",goToRepositories:"Go to Repositories",goToReview:"Go to Review",goToMonitoring:"Go to Monitoring",goToSettings:"Go to Settings",newTask:"New Task",keyboardShortcuts:"Keyboard Shortcuts"}},Lwe={title:"Keyboard Shortcuts",groups:{navigation:"Navigation",actions:"Actions",terminals:"Terminals (Desktop)",general:"General"},labels:{goToTasks:"Go to Tasks",goToTerminals:"Go to Terminals",goToTaskTerminals:"Go to Task Terminals",goToRepositories:"Go to Repositories",goToReview:"Go to Review",goToMonitoring:"Go to Monitoring",goToSettings:"Go to Settings",commandPalette:"Command Palette",newTask:"New Task",keyboardShortcuts:"Keyboard Shortcuts",closeModal:"Close Modal",newTerminal:"New Terminal",closeTerminal:"Close Terminal",submitForm:"Submit Form"}},Pwe={header:Iwe,commandPalette:Dwe,shortcuts:Lwe},Mwe="Tasks",jwe="Search",Fwe="All Repos",Bwe="New Task",Uwe={title:"Create New Task",description:"Create a new task with a git worktree for isolated development.",fields:{title:"Title",titlePlaceholder:"Add user authentication",description:"Description",descriptionPlaceholder:"Implement OAuth2 login flow...",aiMode:"AI Mode",repository:"Repository",baseBranch:"Base Branch",branchName:"Branch Name",branchPlaceholder:"auto-generated-from-title"},aiModes:{plan:"Plan",default:"Default"},tabs:{saved:"Repos",browse:"Browse"},worktreePrefix:"Worktree:",branchAutoGenerated:'Will use "{{branch}}" if left empty.',selectFolder:"Select folder...",searchRepositories:"Search repositories...",noRepositoriesFound:"No repositories found",selectRepositoryFirst:"Select repository first",loadingBranches:"Loading branches...",selectBranch:"Select branch",current:"(current)",createTask:"Create Task",errors:{notGitRepo:"Selected folder is not a git repository",validationFailed:"Failed to validate repository",createFailed:"Failed to create task"}},$we={title:Mwe,searchPlaceholder:jwe,allRepos:Fwe,newTask:Bwe,createModal:Uwe},zwe="Settings",Hwe={server:"Server",serverDefaults:"Server & Defaults",paths:"Paths",editor:"Editor",integrations:"Integrations",zai:"z.ai",notifications:"Notifications",appearance:"Appearance",developer:"Developer"},Wwe={port:{label:"Port",description:"Requires restart"},startupCommand:{label:"Startup Command",description:"Command for new task terminals"},gitReposDir:{label:"Git Repos Directory",description:"Starting directory for repo picker"},editor:{app:{label:"Editor",description:"Code editor for opening worktrees",options:{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}},host:{label:"Remote Host",description:"For SSH URLs when code is on a remote machine",placeholder:"e.g., my-server.tailnet.ts.net"},sshPort:{label:"SSH Port",description:"Remote SSH port (default 22)"}},linear:{label:"Linear",description:"API key for ticket sync"},github:{label:"GitHub",description:"PAT for Issues & PRs"},zai:{enable:"Enable",apiKey:"API Key",description:"Configures Claude Code to use z.ai proxy",modelMappings:"Model Mappings",haiku:"Haiku",sonnet:"Sonnet",opus:"Opus"},language:{label:"Language",description:"Interface language",options:{auto:"Auto-detect",en:"English",zh:"Chinese (Simplified)"}},theme:{label:"Theme",description:"Color theme for the interface",options:{system:"System",light:"Light",dark:"Dark"}},syncClaudeTheme:{label:"Sync Claude Code",description:"Automatically update Claude Code's theme when Vibora switches between light and dark mode"},claudeCodeTheme:{light:"Light mode",dark:"Dark mode",options:{light:"Light","light-ansi":"Light ANSI","light-daltonized":"Light (colorblind)",dark:"Dark","dark-ansi":"Dark ANSI","dark-daltonized":"Dark (colorblind)"}}},Vwe={enable:"Enable Notifications",sound:"Sound",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"App Token",userKey:"User Key",testSuccess:"{{channel}} test successful",testFailed:"{{channel}} test failed: {{error}}",uploadSound:"Upload custom sound",deleteSound:"Remove custom sound",testSound:"Test sound",soundUploaded:"Custom sound uploaded",soundUploadFailed:"Failed to upload sound: {{error}}",soundDeleted:"Custom sound removed",soundDeleteFailed:"Failed to remove custom sound",customSoundActive:"Custom sound active"},Gwe={restartButton:"Restart Vibora",restarting:"Restarting...",restartDescription:"Rebuild and restart the Vibora server. If the build fails, the server will continue running.",restartFailed:"Restart failed",checkLogs:"Build may have failed. Check journalctl --user -u vibora for details."},qwe={title:"Unsaved Changes",description:"You have unsaved changes that will be lost if you leave this page.",stay:"Stay",leave:"Leave"},Kwe={title:zwe,sections:Hwe,fields:Wwe,notifications:Vwe,developer:Gwe,unsavedChanges:qwe},Ywe="Review",Xwe={pullRequests:"Pull Requests",issues:"Issues"},Zwe={pr:{created:"Created by me",assigned:"Assigned to me",reviewRequested:"Review requests",mentioned:"Mentioned"},issue:{assigned:"Assigned to me",created:"Created by me",mentioned:"Mentioned"},allOrgs:"All Orgs",allOrganizations:"All Organizations",viboraReposOnly:"Vibora repos only"},Qwe={tokenRequired:"GitHub Token Required",tokenDescription:"To view your issues and pull requests, add a GitHub Personal Access Token in Settings.",requiredScopes:"Required scopes:",scopes:{repo:"(for private repositories)",readUser:"(for user info)",readOrg:"(for organization list)"},generateToken:"Generate Token",goToSettings:"Go to Settings"},Jwe={loading:"Loading...",failedToLoad:"Failed to load pull requests",empty:{all:"No open pull requests",created:"No pull requests created by you",assigned:"No pull requests assigned to you",reviewRequested:"No pull requests awaiting your review",mentioned:"No pull requests mentioning you"},draft:"Draft"},eTe={loading:"Loading...",failedToLoad:"Failed to load issues",empty:{assigned:"No issues assigned to you",created:"No issues created by you",mentioned:"No issues mentioning you"}},tTe={title:Ywe,tabs:Xwe,filters:Zwe,github:Qwe,prs:Jwe,issues:eTe},nTe="Worktrees",rTe={total:"{{count}} total",orphaned:"{{count}} orphaned"},iTe={button:"Clean up ({{count}})",title:"Delete Completed Worktrees",description:"This will permanently delete {{count}} worktree(s).",linkedTasksWillBeDeleted:"Their linked tasks will also be deleted.",alsoDeleteLinkedTasks:"Also delete linked tasks",done:"Done",canceled:"Canceled",cannotUndo:"This action cannot be undone."},aTe={noMatch:"No worktrees match the selected filters.",noWorktrees:"No worktrees found. Worktrees are created when you create tasks."},sTe={failedToLoad:"Failed to load worktrees: {{message}}"},oTe={title:nTe,summary:rTe,cleanup:iTe,delete:{title:"Delete Worktree",description:"This will permanently delete the worktree directory at",linkedTaskWillBeDeleted:'The linked task "{{title}}" will also be deleted.',alsoDeleteLinkedTask:'Also delete linked task "{{title}}"',cannotUndo:"This action cannot be undone.",button:"Delete {{count}}"},empty:aTe,error:sTe},lTe="Monitoring",uTe={claude:"Claude Instances",system:"System Metrics",processes:"Processes",vibora:"Vibora Servers",worktrees:"Worktrees",usage:"Usage Limits"},cTe={showAllInstances:"Show all instances",instanceCount:"{{count}} instance(s) running",totalRam:"{{ram}} MB total",headers:{terminal:"Terminal",task:"Task",ram:"RAM",actions:"Actions",pid:"PID",workingDirectory:"Working Dir",source:"Source"},noTask:"(no task)",kill:"Kill",killing:"Killing...",killSelected:"Kill {{count}} selected",source:{vibora:"Vibora: {{name}}",external:"External"},empty:"No Claude instances running",emptyVibora:" in Vibora terminals",error:"Failed to load Claude instances: {{message}}"},dTe={cpuUsage:"CPU Usage",memoryUsage:"Memory Usage",memoryLabels:{used:"Used",cache:"Cache / Buffers"},diskUsage:"Disk Usage ({{path}})",error:"Failed to load system metrics: {{message}}"},fTe={topProcesses:"Top Processes",sortBy:{memory:"By Memory",cpu:"By CPU"},headers:{pid:"PID",name:"Name",command:"Command",memory:"Memory"},empty:"No processes found",error:"Failed to load processes: {{message}}",containers:"Containers",containersEmpty:"No containers running",containersUnavailable:"Docker/Podman not available"},hTe={description:"Running Vibora dev servers",instanceCount:"{{count}} instance(s) running",headers:{port:"Port",mode:"Mode",directory:"Directory",ram:"RAM",actions:"Actions"},mode:{dev:"Dev",prod:"Prod"},vite:"Vite",kill:"Kill",killing:"Killing...",empty:"No Vibora instances running",error:"Failed to load Vibora instances: {{message}}"},pTe={fiveHourBlock:"5-Hour Block",sevenDayRolling:"7-Day Rolling",opusWeekly:"Opus Weekly",sonnetWeekly:"Sonnet Weekly",resetsIn:"Resets in {{time}}",resetsAt:"Resets {{time}}",weekProgress:"{{percent}}% through week",unavailable:"Claude Code usage data not available. Make sure you're logged in to Claude Code.",error:"Failed to load usage data: {{message}}"},mTe={title:lTe,tabs:uTe,claude:cTe,system:dTe,processes:fTe,vibora:hTe,usage:pTe},gTe="Tasks",bTe="New Terminal",vTe="All Repos",yTe={title:"Edit Tab",name:"Name",namePlaceholder:"Tab name",directory:"Directory",directoryPlaceholder:"Select a directory...",clearDirectory:"Clear directory",cancel:"Cancel",save:"Save"},_Te={title:"New Tab",create:"Create"},ETe={taskTerminals:gTe,newTerminal:bTe,allRepos:vTe,editTab:yTe,newTab:_Te},STe="Repositories",xTe="{{count}} total",wTe="Search repositories...",TTe="New Task",CTe="Tasks",ATe="Terminal",kTe="Editor",OTe="Settings",RTe="Add Repository",NTe="Scan Directory",ITe="Open in Terminal",DTe="Open in {{editor}}",LTe={openInVSCode:"Open in VS Code"},PTe={title:"Add Repository",description:"Add a git repository from a URL or local path, or scan a directory.",tabs:{add:"Add",scan:"Scan"},inputLabel:"Repository URL or path",inputPlaceholder:"https://github.com/user/repo or /local/path",browse:"Browse...",cloneOptions:"Clone Options",targetDirectory:"Clone to directory",folderName:"Folder name",willCloneTo:"Will clone to",cloning:"Cloning repository...",adding:"Adding...",cloneFailed:"Failed to clone repository",createFailed:"Failed to add repository",cancel:"Cancel",add:"Add",retry:"Retry",fields:{path:"Repository Path",pathPlaceholder:"Select repository...",displayName:"Display Name",startupScript:"Startup Script",startupScriptPlaceholder:"npm install && npm run dev",startupScriptDescription:"Command to run in the terminal when creating a worktree.",copyFiles:"Copy Files",copyFilesPlaceholder:".env, config.local.json",copyFilesDescription:"Comma-separated glob patterns for files to copy into new worktrees.",isCopierTemplate:"Use as Copier Template",isCopierTemplateDescription:"Mark as a template for creating new projects."}},MTe={button:"New Project",title:"Create New Project",back:"Back",next:"Next",create:"Create Project",steps:{template:{description:"Select a template to create your project from.",help:"Copier generates new projects from templates, letting you scaffold applications with pre-configured settings.",learnMore:"Learn more about Copier",savedTemplates:"Saved Templates",selectTemplate:"Select a template...",or:"or",customUrl:"Custom Template URL/Path",customUrlHelp:"Git URL or local path to a Copier template."},questions:{description:"Configure your project.",noQuestions:"This template has no configuration questions."},output:{description:"Choose where to create your project.",projectName:"Project Name",outputDirectory:"Output Directory",selectDirectory:"Select directory...",willCreate:"Will create",trustTemplate:"Trust this template",trustWarning:"This template runs code during project creation. Only enable if you trust the source."},creating:{description:"Creating your project...",inProgress:"Running Copier..."}}},jTe={title:"Scan Directory for Repositories",description:"Find and add multiple git repositories from a directory.",directoryLabel:"Directory to scan",directoryPlaceholder:"Enter directory path",browse:"Browse...",scan:"Scan",foundRepos:"Found {{count}} repositories",selectAll:"Select all",selectNone:"Select none",noReposFound:"No git repositories found in this directory.",alreadyAdded:"Already added",adding:"Adding repositories...",scanFailed:"Failed to scan directory",addFailed:"Failed to add repositories",cancel:"Cancel",addSelected:"Add {{count}} selected"},FTe={noRepositories:"No repositories added yet. Add a repository for quick access when creating tasks.",noMatches:"No repositories match your search."},BTe={failedToLoad:"Failed to load repositories: {{message}}"},UTe={title:STe,total:xTe,searchPlaceholder:wTe,newTask:TTe,viewTasks:CTe,terminal:ATe,editor:kTe,settings:OTe,addRepository:RTe,scanDirectory:NTe,openInTerminal:ITe,openInEditor:DTe,card:LTe,delete:{title:"Delete Repository",description:'This will remove "{{name}}" from Vibora. The actual repository files will not be affected.',button:"Delete",deleting:"Deleting...",alsoDeleteDirectory:"Also delete the directory from disk",deleteDirectoryWarning:"This will permanently delete all files in the repository. This action cannot be undone."},addModal:PTe,newProject:MTe,bulkAdd:jTe,empty:FTe,error:BTe},$Te={save:"保存更改",cancel:"取消",delete:"删除",create:"创建",reset:"重置为默认值",browse:"浏览",clearFilters:"清除筛选"},zTe={loading:"加载中...",saving:"保存中...",saved:"已保存",error:"错误",calculating:"计算中...",validating:"验证中...",creating:"创建中...",deleting:"删除中...",loggingIn:"登录中..."},HTe={justNow:"刚刚",minuteAgo:"1 分钟前",minutesAgo:"{{count}} 分钟前",hourAgo:"1 小时前",hoursAgo:"{{count}} 小时前",dayAgo:"1 天前",daysAgo:"{{count}} 天前"},WTe={one:"{{count}} 个结果",other:"{{count}} 个结果"},VTe={IN_PROGRESS:"进行中",IN_REVIEW:"审核中",DONE:"已完成",CANCELED:"已取消",ORPHANED:"孤立"},GTe={loginTitle:"登录 Vibora",username:"用户名",password:"密码",login:"登录",loginFailed:"登录失败"},qTe={buttons:$Te,status:zTe,time:HTe,results:WTe,statuses:VTe,auth:GTe},KTe={tasks:"任务",terminals:"终端",worktrees:"工作树",repositories:"仓库",review:"审核",monitoring:"监控",settings:"设置",commandPalette:"命令面板 ({{shortcut}})"},YTe={placeholder:"输入命令或搜索...",noResults:"未找到命令",categories:{navigation:"导航",actions:"操作"},commands:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToRepositories:"前往仓库",goToReview:"前往审核",goToMonitoring:"前往监控",goToSettings:"前往设置",newTask:"新建任务",keyboardShortcuts:"键盘快捷键"}},XTe={title:"键盘快捷键",groups:{navigation:"导航",actions:"操作",general:"通用"},labels:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToRepositories:"前往仓库",goToReview:"前往审核",goToMonitoring:"前往监控",goToSettings:"前往设置",commandPalette:"命令面板",newTask:"新建任务",keyboardShortcuts:"键盘快捷键",closeModal:"关闭弹窗"}},ZTe={header:KTe,commandPalette:YTe,shortcuts:XTe},QTe="任务",JTe="搜索",eCe="全部仓库",tCe="新建任务",nCe={title:"创建新任务",description:"创建一个带有 Git 工作树的新任务,用于隔离开发。",fields:{title:"标题",titlePlaceholder:"添加用户认证",description:"描述",descriptionPlaceholder:"实现 OAuth2 登录流程...",aiMode:"AI 模式",repository:"仓库",baseBranch:"基础分支",branchName:"分支名称",branchPlaceholder:"自动生成分支名"},aiModes:{plan:"计划",default:"默认"},tabs:{saved:"仓库",browse:"浏览"},worktreePrefix:"工作树:",branchAutoGenerated:'留空将使用 "{{branch}}"。',selectFolder:"选择文件夹...",searchRepositories:"搜索仓库...",noRepositoriesFound:"未找到仓库",selectRepositoryFirst:"请先选择仓库",loadingBranches:"加载分支中...",selectBranch:"选择分支",current:"(当前)",createTask:"创建任务",errors:{notGitRepo:"所选文件夹不是 Git 仓库",validationFailed:"验证仓库失败",createFailed:"创建任务失败"}},rCe={title:QTe,searchPlaceholder:JTe,allRepos:eCe,newTask:tCe,createModal:nCe},iCe="设置",aCe={server:"服务器",serverDefaults:"服务器与默认设置",paths:"路径",editor:"编辑器",integrations:"集成",zai:"z.ai",notifications:"通知",appearance:"外观",developer:"开发者"},sCe={port:{label:"端口",description:"需要重启"},startupCommand:{label:"启动命令",description:"新任务终端的命令"},gitReposDir:{label:"Git 仓库目录",description:"仓库选择器的起始目录"},editor:{app:{label:"编辑器",description:"用于打开工作树的代码编辑器",options:{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}},host:{label:"远程主机",description:"代码在远程机器上时使用的 SSH 地址",placeholder:"例如:my-server.tailnet.ts.net"},sshPort:{label:"SSH 端口",description:"远程 SSH 端口(默认 22)"}},linear:{label:"Linear",description:"用于工单同步的 API 密钥"},github:{label:"GitHub",description:"用于 Issues 和 PR 的个人访问令牌"},zai:{enable:"启用",apiKey:"API 密钥",description:"配置 Claude Code 使用 z.ai 代理",modelMappings:"模型映射",haiku:"Haiku",sonnet:"Sonnet",opus:"Opus"},language:{label:"语言",description:"界面语言",options:{auto:"自动检测",en:"English",zh:"简体中文"}},theme:{label:"主题",description:"界面颜色主题",options:{system:"跟随系统",light:"浅色",dark:"深色"}},syncClaudeTheme:{label:"同步 Claude Code",description:"当 Vibora 在浅色和深色模式之间切换时自动更新 Claude Code 的主题"},claudeCodeTheme:{light:"浅色模式",dark:"深色模式",options:{light:"浅色","light-ansi":"浅色 ANSI","light-daltonized":"浅色(色盲友好)",dark:"深色","dark-ansi":"深色 ANSI","dark-daltonized":"深色(色盲友好)"}}},oCe={enable:"启用通知",sound:"声音",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"应用令牌",userKey:"用户密钥",testSuccess:"{{channel}} 测试成功",testFailed:"{{channel}} 测试失败:{{error}}",uploadSound:"上传自定义声音",deleteSound:"删除自定义声音",testSound:"测试声音",soundUploaded:"自定义声音已上传",soundUploadFailed:"上传声音失败:{{error}}",soundDeleted:"自定义声音已删除",soundDeleteFailed:"删除自定义声音失败",customSoundActive:"使用自定义声音"},lCe={restartButton:"重启 Vibora",restarting:"重启中...",restartDescription:"重新构建并重启 Vibora 服务器。如果构建失败,服务器将继续运行。",restartFailed:"重启失败",checkLogs:"构建可能失败。运行 journalctl --user -u vibora 查看详情。"},uCe={title:"未保存的更改",description:"您有未保存的更改,离开此页面将丢失这些更改。",stay:"留下",leave:"离开"},cCe={title:iCe,sections:aCe,fields:sCe,notifications:oCe,developer:lCe,unsavedChanges:uCe},dCe="审核",fCe={pullRequests:"拉取请求",issues:"问题"},hCe={pr:{created:"我创建的",assigned:"分配给我的",reviewRequested:"待我审核",mentioned:"提及我的"},issue:{assigned:"分配给我的",created:"我创建的",mentioned:"提及我的"},allOrgs:"所有组织",allOrganizations:"所有组织",viboraReposOnly:"仅 Vibora 仓库"},pCe={tokenRequired:"需要 GitHub 令牌",tokenDescription:"要查看您的问题和拉取请求,请在设置中添加 GitHub 个人访问令牌。",requiredScopes:"所需权限:",scopes:{repo:"(用于私有仓库)",readUser:"(用于用户信息)",readOrg:"(用于组织列表)"},generateToken:"生成令牌",goToSettings:"前往设置"},mCe={loading:"加载中...",failedToLoad:"加载拉取请求失败",empty:{all:"没有打开的拉取请求",created:"没有您创建的拉取请求",assigned:"没有分配给您的拉取请求",reviewRequested:"没有等待您审核的拉取请求",mentioned:"没有提及您的拉取请求"},draft:"草稿"},gCe={loading:"加载中...",failedToLoad:"加载问题失败",empty:{assigned:"没有分配给您的问题",created:"没有您创建的问题",mentioned:"没有提及您的问题"}},bCe={title:dCe,tabs:fCe,filters:hCe,github:pCe,prs:mCe,issues:gCe},vCe="工作树",yCe={total:"共 {{count}} 个",orphaned:"{{count}} 个孤立"},_Ce={button:"清理 ({{count}})",title:"删除已完成的工作树",description:"这将永久删除 {{count}} 个工作树。",linkedTasksWillBeDeleted:"关联的任务也将被删除。",alsoDeleteLinkedTasks:"同时删除关联的任务",done:"已完成",canceled:"已取消",cannotUndo:"此操作无法撤销。"},ECe={noMatch:"没有匹配所选筛选条件的工作树。",noWorktrees:"未找到工作树。工作树在创建任务时自动生成。"},SCe={failedToLoad:"加载工作树失败:{{message}}"},xCe={title:vCe,summary:yCe,cleanup:_Ce,delete:{title:"删除工作树",description:"这将永久删除位于以下位置的工作树目录",linkedTaskWillBeDeleted:'关联的任务 "{{title}}" 也将被删除。',alsoDeleteLinkedTask:'同时删除关联的任务 "{{title}}"',cannotUndo:"此操作无法撤销。",button:"删除 {{count}} 个"},empty:ECe,error:SCe},wCe="监控",TCe={claude:"Claude 实例",system:"系统指标",processes:"进程",vibora:"Vibora 服务器",usage:"使用限额"},CCe={showAllInstances:"显示所有实例",instanceCount:"{{count}} 个实例运行中",totalRam:"总计 {{ram}} MB",headers:{terminal:"终端",task:"任务",ram:"内存",actions:"操作",pid:"PID",workingDirectory:"工作目录",source:"来源"},noTask:"(无任务)",kill:"终止",killing:"终止中...",killSelected:"终止 {{count}} 个已选",source:{vibora:"Vibora: {{name}}",external:"外部"},empty:"没有 Claude 实例运行中",emptyVibora:" (在 Vibora 终端中)",error:"加载 Claude 实例失败:{{message}}"},ACe={cpuUsage:"CPU 使用率",memoryUsage:"内存使用率",memoryLabels:{used:"已使用",cache:"缓存/缓冲区"},diskUsage:"磁盘使用率 ({{path}})",error:"加载系统指标失败:{{message}}"},kCe={topProcesses:"热门进程",sortBy:{memory:"按内存",cpu:"按 CPU"},headers:{pid:"PID",name:"名称",command:"命令",memory:"内存"},empty:"未找到进程",error:"加载进程失败:{{message}}",containers:"容器",containersEmpty:"没有容器运行中",containersUnavailable:"Docker/Podman 不可用"},OCe={description:"运行中的 Vibora 开发服务器",instanceCount:"{{count}} 个实例运行中",headers:{port:"端口",mode:"模式",directory:"目录",ram:"内存",actions:"操作"},mode:{dev:"开发",prod:"生产"},vite:"Vite",kill:"终止",killing:"终止中...",empty:"没有 Vibora 实例运行中",error:"加载 Vibora 实例失败:{{message}}"},RCe={fiveHourBlock:"5小时配额",sevenDayRolling:"7天滚动配额",opusWeekly:"Opus 周配额",sonnetWeekly:"Sonnet 周配额",resetsIn:"{{time}}后重置",resetsAt:"{{time}}重置",weekProgress:"本周已过 {{percent}}%",unavailable:"Claude Code 使用数据不可用。请确保已登录 Claude Code。",error:"加载使用数据失败:{{message}}"},NCe={title:wCe,tabs:TCe,claude:CCe,system:ACe,processes:kCe,vibora:OCe,usage:RCe},ICe="任务",DCe="新建终端",LCe="全部仓库",PCe={taskTerminals:ICe,newTerminal:DCe,allRepos:LCe},MCe="仓库",jCe="共 {{count}} 个",FCe="搜索仓库...",BCe="新建任务",UCe="添加仓库",$Ce="扫描目录",zCe={openInVSCode:"在 VS Code 中打开"},HCe={title:"添加仓库",description:"从 URL 或本地路径添加 Git 仓库,或扫描目录。",tabs:{add:"添加",scan:"扫描"},inputLabel:"仓库 URL 或路径",inputPlaceholder:"https://github.com/user/repo 或 /local/path",browse:"浏览...",cloneOptions:"克隆选项",targetDirectory:"克隆到目录",folderName:"文件夹名称",willCloneTo:"将克隆到",cloning:"正在克隆仓库...",adding:"添加中...",cloneFailed:"克隆仓库失败",createFailed:"添加仓库失败",cancel:"取消",add:"添加",retry:"重试",fields:{path:"仓库路径",pathPlaceholder:"选择仓库...",displayName:"显示名称",startupScript:"启动脚本",startupScriptPlaceholder:"npm install && npm run dev",startupScriptDescription:"创建工作树时在终端中运行的命令。",copyFiles:"复制文件",copyFilesPlaceholder:".env, config.local.json",copyFilesDescription:"用逗号分隔的 glob 模式,用于复制文件到新的工作树。"}},WCe={title:"扫描目录中的仓库",description:"从目录中查找并添加多个 Git 仓库。",directoryLabel:"要扫描的目录",directoryPlaceholder:"输入目录路径",browse:"浏览...",scan:"扫描",foundRepos:"找到 {{count}} 个仓库",selectAll:"全选",selectNone:"取消全选",noReposFound:"此目录中未找到 Git 仓库。",alreadyAdded:"已添加",adding:"正在添加仓库...",scanFailed:"扫描目录失败",addFailed:"添加仓库失败",cancel:"取消",addSelected:"添加 {{count}} 个选中项"},VCe={button:"新建项目",title:"创建新项目",back:"返回",next:"下一步",create:"创建项目",steps:{template:{description:"选择一个模板来创建您的项目。",help:"Copier 从模板生成新项目,让您可以使用预配置的设置快速搭建应用程序。",learnMore:"了解更多关于 Copier",savedTemplates:"已保存的模板",selectTemplate:"选择模板...",or:"或",customUrl:"自定义模板 URL/路径",customUrlHelp:"Copier 模板的 Git URL 或本地路径。"},questions:{description:"配置您的项目。",noQuestions:"此模板没有配置问题。"},output:{description:"选择项目创建位置。",projectName:"项目名称",outputDirectory:"输出目录",selectDirectory:"选择目录...",willCreate:"将创建"},creating:{description:"正在创建您的项目...",inProgress:"正在运行 Copier..."}}},GCe={noRepositories:"尚未添加任何仓库。添加一个仓库以便在创建任务时快速访问。",noMatches:"没有匹配的仓库。"},qCe={failedToLoad:"加载仓库失败:{{message}}"},KCe={title:MCe,total:jCe,searchPlaceholder:FCe,newTask:BCe,addRepository:UCe,scanDirectory:$Ce,card:zCe,delete:{title:"删除仓库",description:'这将从 Vibora 中移除 "{{name}}"。实际的仓库文件不会受到影响。',button:"删除",deleting:"删除中...",alsoDeleteDirectory:"同时从磁盘删除目录",deleteDirectoryWarning:"这将永久删除仓库中的所有文件。此操作无法撤销。"},addModal:HCe,bulkAdd:WCe,newProject:VCe,empty:GCe,error:qCe},YCe="common",rD=["en","zh"],XCe={en:{common:Nwe,navigation:Pwe,tasks:$we,settings:Kwe,review:tTe,worktrees:oTe,monitoring:mTe,terminals:ETe,repositories:UTe},zh:{common:qTe,navigation:ZTe,tasks:rCe,settings:cCe,review:bCe,worktrees:xCe,monitoring:NCe,terminals:PCe,repositories:KCe}};function ZCe(){if(typeof window<"u"){const e=localStorage.getItem("vibora-language");if(e&&rD.includes(e))return e;const t=navigator.language.split("-")[0];if(rD.includes(t))return t}return"en"}Gi.use(Mge).init({resources:XCe,lng:ZCe(),fallbackLng:"en",defaultNS:YCe,ns:["common","navigation","tasks","settings","review","worktrees","monitoring","terminals","repositories"],interpolation:{escapeValue:!1}});Gi.on("languageChanged",e=>{typeof window<"u"&&localStorage.setItem("vibora-language",e)});function zne(){const{i18n:e}=rn(),{data:t,isSuccess:n}=twe(),r=Fne();k.useEffect(()=>{n&&t&&t!==e.language&&e.changeLanguage(t)},[n,t,e]);const i=k.useCallback(async a=>{if(a)await e.changeLanguage(a);else{const s=navigator.language.split("-")[0],o=rD.includes(s)?s:"en";await e.changeLanguage(o)}r.mutate({key:In.LANGUAGE,value:a??""})},[e,r]);return{language:e.language,savedLanguage:t,changeLanguage:i,isUpdating:r.isPending}}function on(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var QCe={};function aw(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:QCe}var Hne=Object.assign,YE=Object.getOwnPropertyDescriptor,Jo=Object.defineProperty,sw=Object.prototype,iD=[];Object.freeze(iD);var FM={};Object.freeze(FM);var JCe=typeof Proxy<"u",eAe=Object.toString();function Wne(){JCe||on("Proxy not available")}function Vne(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var sp=function(){};function is(e){return typeof e=="function"}function Lf(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function ow(e){return e!==null&&typeof e=="object"}function Wc(e){if(!ow(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===eAe}function Gne(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function lw(e,t,n){Jo(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function qne(e,t,n){Jo(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function id(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return ow(r)&&r[n]===!0}}function Mm(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function tAe(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function Ql(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Kne=typeof Object.getOwnPropertySymbols<"u";function nAe(e){var t=Object.keys(e);if(!Kne)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return sw.propertyIsEnumerable.call(e,r)})):t}var uw=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Kne?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Yne(e){return e===null?null:typeof e=="object"?""+e:e}function lu(e,t){return sw.hasOwnProperty.call(e,t)}var rAe=Object.getOwnPropertyDescriptors||function(t){var n={};return uw(t).forEach(function(r){n[r]=YE(t,r)}),n};function Qa(e,t){return!!(e&t)}function Ja(e,t,n){return n?e|=t:e&=~t,e}function Tz(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function iAe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,sAe(r.key),r)}}function jm(e,t,n){return t&&iAe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function op(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=oAe(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
25
+ `:"")+E)}catch(E){kt.error("Failed to upload image"),At.kanban.error("Upload error",{error:String(E)})}finally{s(!1)}return}}};return b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"relative",children:[b.jsx(_M,{ref:o,value:e,onChange:f=>t(f.target.value),onPaste:u,className:Be(a&&"opacity-50",n),disabled:a||r,...i}),a&&b.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50 rounded-md",children:b.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})})]}),l.length>0&&b.jsx("div",{className:"flex flex-wrap gap-2",children:l.map((f,d)=>b.jsx("a",{href:fz(f),target:"_blank",rel:"noopener noreferrer",className:"block",children:b.jsx("img",{src:fz(f),alt:`Attachment ${d+1}`,className:"h-16 w-auto rounded border object-cover hover:opacity-80 transition-opacity"})},d))})]})}function Ute({className:e,...t}){return b.jsx("label",{"data-slot":"label",className:Be("gap-2 text-xs/relaxed leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed",e),...t})}const $te=k.forwardRef(function(t,n){const{className:r,render:i,orientation:a="horizontal",...s}=t,o=k.useMemo(()=>({orientation:a}),[a]);return xt("div",t,{state:o,ref:n,props:[{role:"separator","aria-orientation":a},s]})});function oEe({className:e,orientation:t="horizontal",...n}){return b.jsx($te,{"data-slot":"separator",orientation:t,className:Be("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",e),...n})}function mf({className:e,...t}){return b.jsx("div",{"data-slot":"field-group",className:Be("gap-4 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4 group/field-group @container/field-group flex w-full flex-col",e),...t})}const lEe=Xc("data-[invalid=true]:text-destructive gap-2 group/field flex w-full",{variants:{orientation:{vertical:"flex-col [&>*]:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center [&>[data-slot=field-label]]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto @md/field-group:[&>[data-slot=field-label]]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function ir({className:e,orientation:t="vertical",...n}){return b.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:Be(lEe({orientation:t}),e),...n})}function ar({className:e,...t}){return b.jsx(Ute,{"data-slot":"field-label",className:Be("has-data-checked:bg-primary/5 dark:has-data-checked:bg-primary/10 gap-2 group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-2 group/field-label peer/field-label flex w-fit leading-snug","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...t})}function Ya({className:e,...t}){return b.jsx("p",{"data-slot":"field-description",className:Be("text-muted-foreground text-left text-xs/relaxed [[data-variant=legend]+&]:-mt-1.5 leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance","last:mt-0 nth-last-2:-mt-1","[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",e),...t})}function zte(e){const t=k.useRef(!0);t.current&&(t.current=!1,e())}const Hte=k.createContext(null),Wte=k.createContext(null);function ml(){const e=k.useContext(Hte);if(e===null)throw new Error(an(60));return e}function Vte(){const e=k.useContext(Wte);if(e===null)throw new Error(an(61));return e}const Gte=(e,t)=>Object.is(e,t);function vu(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Jd(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:vu(r,t,n))}function Bp(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:vu(r,t,n))}function qte(e,t,n){return e.filter(r=>!vu(r,t,n))}function nD(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Kte(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Qr(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 nD(e)}function to(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?nD(e.value):nD(e)}function uEe(e,t,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]??Qr(e,n);if(Array.isArray(t)){const r=Kte(t)?t.flatMap(i=>i.items):t;if(e==null){const i=r.find(a=>a.value==null);return i&&i.label!=null?i.label:Qr(e,n)}if(typeof e!="object"){const i=r.find(a=>a&&a.value===e);return i&&i.label!=null?i.label:Qr(e,n)}if("value"in e){const i=r.find(a=>a&&a.value===e.value);if(i&&i.label!=null)return i.label}}return Qr(e,n)}function cEe(e,t){return!Array.isArray(e)||e.length===0?"":e.map(n=>Qr(n,t)).join(", ")}const Vt={id:Ue(e=>e.id),modal:Ue(e=>e.modal),multiple:Ue(e=>e.multiple),items:Ue(e=>e.items),itemToStringLabel:Ue(e=>e.itemToStringLabel),itemToStringValue:Ue(e=>e.itemToStringValue),isItemEqualToValue:Ue(e=>e.isItemEqualToValue),value:Ue(e=>e.value),open:Ue(e=>e.open),mounted:Ue(e=>e.mounted),forceMount:Ue(e=>e.forceMount),transitionStatus:Ue(e=>e.transitionStatus),openMethod:Ue(e=>e.openMethod),activeIndex:Ue(e=>e.activeIndex),selectedIndex:Ue(e=>e.selectedIndex),isActive:Ue((e,t)=>e.activeIndex===t),isSelected:Ue((e,t,n)=>{const r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(a=>vu(a,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:vu(i,n,r)}),isSelectedByFocus:Ue((e,t)=>e.selectedIndex===t),popupProps:Ue(e=>e.popupProps),triggerProps:Ue(e=>e.triggerProps),triggerElement:Ue(e=>e.triggerElement),positionerElement:Ue(e=>e.positionerElement),listElement:Ue(e=>e.listElement),scrollUpArrowVisible:Ue(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Ue(e=>e.scrollDownArrowVisible),hasScrollArrows:Ue(e=>e.hasScrollArrows),serializedValue:Ue(e=>{const{multiple:t,value:n,itemToStringValue:r}=e;return t&&Array.isArray(n)&&n.length===0?"":to(n,r)})};function ef(e,t){const n=k.useRef(e),r=Xe(t);Je(()=>{n.current!==e&&r(n.current)},[e,r]),Je(()=>{n.current=e},[e])}function dEe(e){const{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:s=!1,onOpenChange:o,name:l,disabled:u=!1,readOnly:f=!1,required:d=!1,modal:p=!0,actionsRef:m,inputRef:E,onOpenChangeComplete:S,items:g,multiple:y=!1,itemToStringLabel:v,itemToStringValue:x,isItemEqualToValue:T=Gte,highlightItemOnHover:w=!0,children:C}=e,{clearErrors:R}=Zy(),{setDirty:O,shouldValidateOnChange:N,validityData:D,setFilled:L,name:z,disabled:M,validation:V}=Bs(),{controlId:H}=nd(),B=Qx({id:t}),q=M||u,K=z??l,[U,j]=ts({controlled:n,default:y?r??ta:r,name:"Select",state:"value"}),[$,Y]=ts({controlled:a,default:s,name:"Select",state:"open"}),W=k.useRef([]),J=k.useRef([]),ae=k.useRef(null),se=k.useRef(null),Q=k.useRef(0),G=k.useRef(null),Z=k.useRef([]),ee=k.useRef(!1),ne=k.useRef(!1),te=k.useRef(null),ye=k.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),Ee=k.useRef(!1),{mounted:pe,setMounted:_e,transitionStatus:Se}=To($),{openMethod:Te,triggerProps:de,reset:Ce}=Xx($),ge=pi(()=>new pf({id:B,modal:p,multiple:y,itemToStringLabel:v,itemToStringValue:x,isItemEqualToValue:T,value:U,open:$,mounted:pe,transitionStatus:Se,items:g,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,he=Ye(ge,Vt.activeIndex),ce=Ye(ge,Vt.selectedIndex),Ne=Ye(ge,Vt.triggerElement),Pe=Ye(ge,Vt.positionerElement),ve=k.useMemo(()=>y&&Array.isArray(U)&&U.length===0?"":to(U,x),[y,U,x]),Le=k.useMemo(()=>y&&Array.isArray(U)?U.map(yt=>to(yt,x)):to(U,x),[y,U,x]),Ae=lr(ge.state.triggerElement);Qy({id:B,commit:V.commit,value:U,controlRef:Ae,name:K,getValue:()=>Le});const Ve=k.useRef(U);Je(()=>{U!==Ve.current&&ge.set("forceMount",!0)},[ge,U]),Je(()=>{L(U!==null)},[U,L]),Je(function(){if($)return;const Ut=Z.current;if(y){const Ht=Array.isArray(U)?U:[];if(Ht.length===0){ge.set("selectedIndex",null);return}const ft=Ht[Ht.length-1],yn=Bp(Ut,ft,T);ge.set("selectedIndex",yn===-1?null:yn);return}const $t=Bp(Ut,U,T);ge.set("selectedIndex",$t===-1?null:$t)},[y,$,U,Z,T,ge]),ef(U,()=>{R(K),O(U!==D.initialValue),N()?V.commit(U):V.commit(U,!0)});const Ze=Xe((yt,Ut)=>{if(o?.(yt,Ut),!Ut.isCanceled&&(Y(yt),!yt&&ge.state.activeIndex!==null)){const $t=W.current[ge.state.activeIndex];queueMicrotask(()=>{$t?.setAttribute("tabindex","-1")})}}),gt=Xe(()=>{_e(!1),ge.set("activeIndex",null),Ce(),S?.(!1)});Oi({enabled:!m,open:$,ref:ae,onComplete(){$||gt()}}),k.useImperativeHandle(m,()=>({unmount:gt}),[gt]);const st=Xe((yt,Ut)=>{i?.(yt,Ut),!Ut.isCanceled&&j(yt)}),ot=Xe(()=>{const yt=ge.state.listElement||ae.current;if(!yt)return;const Ut=yt.scrollTop,$t=yt.scrollTop+yt.clientHeight,Ht=Ut>1,ft=$t<yt.scrollHeight-1;ge.state.scrollUpArrowVisible!==Ht&&ge.set("scrollUpArrowVisible",Ht),ge.state.scrollDownArrowVisible!==ft&&ge.set("scrollDownArrowVisible",ft)}),Fe=Fx({open:$,onOpenChange:Ze,elements:{reference:Ne,floating:Pe}}),ht=Nm(Fe,{enabled:!f&&!q,event:"mousedown"}),Ie=Im(Fe,{bubbles:!1}),ze=lM(Fe,{enabled:!f&&!q,listRef:W,activeIndex:he,selectedIndex:ce,disabledIndices:ta,onNavigate(yt){yt===null&&!$||ge.set("activeIndex",yt)},focusItemOnHover:!1}),et=uM(Fe,{enabled:!f&&!q&&($||!y),listRef:J,activeIndex:he,selectedIndex:ce,onMatch(yt){$?ge.set("activeIndex",yt):st(Z.current[yt],it("none"))},onTypingChange(yt){ee.current=yt}}),{getReferenceProps:lt,getFloatingProps:pt,getItemProps:bn}=Jc([ht,Ie,ze,et]),Bt=k.useMemo(()=>ol(lt(),de),[lt,de]);zte(()=>{ge.update({popupProps:pt(),triggerProps:Bt})}),Je(()=>{ge.update({id:B,modal:p,multiple:y,value:U,open:$,mounted:pe,transitionStatus:Se,popupProps:pt(),triggerProps:Bt,items:g,itemToStringLabel:v,itemToStringValue:x,isItemEqualToValue:T,openMethod:Te})},[ge,B,p,y,U,$,pe,Se,pt,Bt,g,v,x,T,Te]);const It=k.useMemo(()=>({store:ge,name:K,required:d,disabled:q,readOnly:f,multiple:y,itemToStringLabel:v,itemToStringValue:x,highlightItemOnHover:w,setValue:st,setOpen:Ze,listRef:W,popupRef:ae,scrollHandlerRef:se,handleScrollArrowVisibility:ot,scrollArrowsMountedCountRef:Q,getItemProps:bn,events:Fe.context.events,valueRef:G,valuesRef:Z,labelsRef:J,typingRef:ee,selectionRef:ye,selectedItemTextRef:te,validation:V,onOpenChangeComplete:S,keyboardActiveRef:ne,alignItemWithTriggerActiveRef:Ee,initialValueRef:Ve}),[ge,K,d,q,f,y,v,x,w,st,Ze,bn,Fe.context.events,V,S,ot]),ct=Fs(E,V.inputRef),nn=y&&Array.isArray(U)&&U.length>0,Pt=k.useMemo(()=>!y||!Array.isArray(U)||!K?null:U.map(yt=>{const Ut=to(yt,x);return b.jsx("input",{type:"hidden",name:K,value:Ut},Ut)}),[y,U,K,x]);return b.jsx(Hte.Provider,{value:It,children:b.jsxs(Wte.Provider,{value:Fe,children:[C,b.jsx("input",{...V.getInputValidationProps({onFocus(){ge.state.triggerElement?.focus()},onChange(yt){if(yt.nativeEvent.defaultPrevented)return;const Ut=yt.target.value,$t=it(Dr,yt.nativeEvent);function Ht(){if(y)return;const ft=Z.current.find(yn=>to(yn,x).toLowerCase()===Ut.toLowerCase());ft!=null&&(O(ft!==D.initialValue),st(ft,$t),N()&&V.commit(ft))}ge.set("forceMount",!0),queueMicrotask(Ht)}}),id:t||H||void 0,name:y?void 0:K,value:ve,disabled:q,required:d&&!nn,readOnly:f,ref:ct,style:Rm,tabIndex:-1,"aria-hidden":!0}),Pt]})})}function EM(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),r=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||r.content!=="none"))return t;const a=parseFloat(n.width)||0,s=parseFloat(n.height)||0,o=parseFloat(r.width)||0,l=parseFloat(r.height)||0,u=Math.max(t.width,a,o),f=Math.max(t.height,s,l),d=u-t.width,p=f-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const __=2,fEe={...Mp,...Kf,value:()=>null},hEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,...o}=t,{setTouched:l,setFocused:u,validationMode:f,state:d,disabled:p}=Bs(),{labelId:m}=nd(),{store:E,setOpen:S,selectionRef:g,validation:y,readOnly:v,alignItemWithTriggerActiveRef:x,disabled:T,keyboardActiveRef:w}=ml(),C=p||T||a,R=Ye(E,Vt.open),O=Ye(E,Vt.value),N=Ye(E,Vt.triggerProps),D=Ye(E,Vt.positionerElement),L=Ye(E,Vt.listElement),z=Ye(E,Vt.serializedValue),M=lr(D),V=k.useRef(null),H=Pn(),B=Pn(),{getButtonProps:q,buttonRef:K}=sa({disabled:C,native:s}),U=Xe(se=>{E.set("triggerElement",se)}),j=Fs(n,V,K,U),$=Pn(),Y=Pn();k.useEffect(()=>{if(R)return Y.start(200,()=>{g.current.allowUnselectedMouseUp=!0,$.start(200,()=>{g.current.allowSelectedMouseUp=!0})}),()=>{$.clear(),Y.clear()};g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},B.clear()},[R,g,B,$,Y]);const W=k.useMemo(()=>L?.id??_v(D)?.id,[L,D]),J=ol(N,{role:"combobox","aria-expanded":R?"true":"false","aria-haspopup":"listbox","aria-controls":R?W:void 0,"aria-labelledby":m,"aria-readonly":v||void 0,tabIndex:C?-1:0,ref:j,onFocus(se){u(!0),R&&x.current&&S(!1,it(ho,se.nativeEvent)),H.start(0,()=>{E.set("forceMount",!0)})},onBlur(){l(!0),u(!1),f==="onBlur"&&y.commit(O)},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(se){if(R)return;const Q=ki(se.currentTarget);function G(Z){if(!V.current)return;const ee=Z.target;if(Tt(V.current,ee)||Tt(M.current,ee)||ee===V.current)return;const ne=EM(V.current);Z.clientX>=ne.left-__&&Z.clientX<=ne.right+__&&Z.clientY>=ne.top-__&&Z.clientY<=ne.bottom+__||S(!1,it(Tee,Z))}B.start(0,()=>{Q.addEventListener("mouseup",G,{once:!0})})}},y.getValidationProps,o,q);J.role="combobox";const ae=k.useMemo(()=>({...d,open:R,disabled:C,value:O,readOnly:v,placeholder:!z}),[d,R,C,O,v,z]);return xt("button",t,{ref:[n,V],state:ae,stateAttributesMapping:fEe,props:J})}),pEe={value:()=>null},mEe=k.forwardRef(function(t,n){const{className:r,render:i,children:a,...s}=t,{store:o,valueRef:l}=ml(),u=Ye(o,Vt.value),f=Ye(o,Vt.items),d=Ye(o,Vt.itemToStringLabel),p=Ye(o,Vt.serializedValue),m=k.useMemo(()=>({value:u,placeholder:!p}),[u,p]),E=typeof a=="function"?a(u):a??(Array.isArray(u)?cEe(u,d):uEe(u,f,d));return xt("span",t,{state:m,ref:[n,l],props:[{children:E},s],stateAttributesMapping:pEe})}),gEe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,{store:s}=ml(),o=Ye(s,Vt.open),l=k.useMemo(()=>({open:o}),[o]);return xt("span",t,{state:l,ref:n,props:[{"aria-hidden":!0,children:"▼"},a],stateAttributesMapping:zx})}),bEe=k.createContext(void 0),vEe=k.forwardRef(function(t,n){const{store:r}=ml(),i=Ye(r,Vt.mounted),a=Ye(r,Vt.forceMount);return i||a?b.jsx(bEe.Provider,{value:!0,children:b.jsx(Hy,{ref:n,...t})}):null}),Yte=k.createContext(void 0);function SM(){const e=k.useContext(Yte);if(!e)throw new Error(an(59));return e}function GE(e,t){e&&Object.assign(e.style,t)}const Xte={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},yEe={position:"fixed"},_Ee=k.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:m=5,sticky:E=!1,disableAnchorTracking:S,alignItemWithTrigger:g=!0,collisionAvoidance:y=Nx,...v}=t,{store:x,listRef:T,labelsRef:w,alignItemWithTriggerActiveRef:C,selectedItemTextRef:R,valuesRef:O,initialValueRef:N,popupRef:D,setValue:L}=ml(),z=Vte(),M=Ye(x,Vt.open),V=Ye(x,Vt.mounted),H=Ye(x,Vt.modal),B=Ye(x,Vt.value),q=Ye(x,Vt.openMethod),K=Ye(x,Vt.positionerElement),U=Ye(x,Vt.triggerElement),j=Ye(x,Vt.isItemEqualToValue),$=k.useRef(null),Y=k.useRef(null),[W,J]=k.useState(g),ae=V&&W&&q!=="touch";!V&&W!==g&&J(g),Je(()=>{V||(Vt.scrollUpArrowVisible(x.state)&&x.set("scrollUpArrowVisible",!1),Vt.scrollDownArrowVisible(x.state)&&x.set("scrollDownArrowVisible",!1))},[x,V]),k.useImperativeHandle(C,()=>ae),Yx((ae||H)&&M&&q!=="touch",U);const se=Ky({anchor:r,floatingRootContext:z,positionMethod:i,mounted:V,side:o,sideOffset:u,align:l,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:E,disableAnchorTracking:S??ae,collisionAvoidance:y,keepMounted:!0}),Q=ae?"none":se.side,G=ae?yEe:se.positionerStyles,Z=k.useMemo(()=>{const _e={};return M||(_e.pointerEvents="none"),{role:"presentation",hidden:!V,style:{...G,..._e}}},[M,V,G]),ee=k.useMemo(()=>({open:M,side:Q,align:se.align,anchorHidden:se.anchorHidden}),[M,Q,se.align,se.anchorHidden]),ne=Xe(_e=>{x.set("positionerElement",_e)}),te=xt("div",t,{ref:[n,ne],state:ee,stateAttributesMapping:Oa,props:[Z,v]}),ye=k.useRef(0),Ee=Xe(_e=>{if(_e.size===0&&ye.current===0||O.current.length===0)return;const Se=ye.current;if(ye.current=_e.size,_e.size===Se)return;const Te=it(Dr);if(Se!==0&&!x.state.multiple&&B!==null&&Bp(O.current,B,j)===-1){const Ce=N.current,he=Ce!=null&&Jd(O.current,Ce,j)?Ce:null;L(he,Te),he===null&&(x.set("selectedIndex",null),R.current=null)}if(Se!==0&&x.state.multiple&&Array.isArray(B)){const de=B.filter(Ce=>Jd(O.current,Ce,j));(de.length!==B.length||de.some(Ce=>!Jd(B,Ce,j)))&&(L(de,Te),de.length===0&&(x.set("selectedIndex",null),R.current=null))}if(M&&ae){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const de={height:""};GE(K,de),GE(D.current,de)}}),pe=k.useMemo(()=>({...se,side:Q,alignItemWithTriggerActive:ae,setControlledAlignItemWithTrigger:J,scrollUpArrowRef:$,scrollDownArrowRef:Y}),[se,Q,ae,J]);return b.jsx(Vy,{elementsRef:T,labelsRef:w,onMapChange:Ee,children:b.jsxs(Yte.Provider,{value:pe,children:[V&&H&&b.jsx(Kx,{inert:Dm(!M),cutout:U}),te]})})});function Zte(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const E_="base-ui-disable-scrollbar",Iv={className:E_,element:b.jsx("style",{href:E_,precedence:"base-ui:low",children:`.${E_}{scrollbar-width:none}.${E_}::-webkit-scrollbar{display:none}`})},EEe=k.createContext(void 0);function xM(e){return k.useContext(EEe)}const SEe={...Oa,...ss},xEe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{store:s,popupRef:o,onOpenChangeComplete:l,setOpen:u,valueRef:f,selectedItemTextRef:d,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:E,scrollHandlerRef:S}=ml(),{side:g,align:y,alignItemWithTriggerActive:v,setControlledAlignItemWithTrigger:x,scrollDownArrowRef:T,scrollUpArrowRef:w}=SM(),C=xM()!=null,R=Vte(),O=Pn(),N=Ye(s,Vt.id),D=Ye(s,Vt.open),L=Ye(s,Vt.mounted),z=Ye(s,Vt.popupProps),M=Ye(s,Vt.transitionStatus),V=Ye(s,Vt.triggerElement),H=Ye(s,Vt.positionerElement),B=Ye(s,Vt.listElement),q=k.useRef(0),K=k.useRef(!1),U=k.useRef(0),j=k.useRef(!1),$=k.useRef({}),Y=su(),W=Xe(Q=>{if(!H||!o.current||!j.current)return;if(K.current||!v){E();return}const G=H.style.top==="0px",Z=H.style.bottom==="0px",ee=H.getBoundingClientRect().height,ne=ki(H),te=getComputedStyle(H),ye=parseFloat(te.marginTop),Ee=parseFloat(te.marginBottom),pe=ne.documentElement.clientHeight-ye-Ee,_e=Q.scrollTop,Se=Q.scrollHeight,Te=Q.clientHeight,de=Se-Te;let Ce=null,ge=null,he=!1;if(G){const ce=de-_e,Ne=ee+ce,Pe=Math.min(Ne,pe);Ce=Pe,Pe!==pe?ge=de:he=!0}else if(Z){const ce=_e-0,Ne=ee+ce,Pe=Math.min(Ne,pe),ve=Ne-pe;Ce=Pe,Pe!==pe?ge=0:(he=!0,_e<de&&(ge=_e-(ce-ve)))}Ce!=null&&(H.style.height=`${Ce}px`),ge!=null&&(Q.scrollTop=ge),he&&(K.current=!0),E()});k.useImperativeHandle(S,()=>W,[W]),Oi({open:D,ref:o,onComplete(){D&&l?.(!0)}});const J=k.useMemo(()=>({open:D,transitionStatus:M,side:g,align:y}),[D,M,g,y]);Je(()=>{!H||!o.current||Object.keys($.current).length||($.current={top:H.style.top||"0",left:H.style.left||"0",right:H.style.right,height:H.style.height,bottom:H.style.bottom,minHeight:H.style.minHeight,maxHeight:H.style.maxHeight,marginTop:H.style.marginTop,marginBottom:H.style.marginBottom})},[o,H]),Je(()=>{L||v||(j.current=!1,K.current=!1,q.current=0,U.current=0,GE(H,$.current))},[L,v,H,o]),Je(()=>{const Q=o.current;if(!(!L||!V||!H||!Q)){if(!v){j.current=!0,Y.request(E);return}queueMicrotask(()=>{const G=getComputedStyle(H),Z=getComputedStyle(Q),ee=ki(V),ne=Er(H),te=V.getBoundingClientRect(),ye=H.getBoundingClientRect(),Ee=te.left,pe=te.height,_e=B||Q,Se=_e.scrollHeight,Te=parseFloat(Z.borderBottomWidth),de=parseFloat(G.marginTop)||10,Ce=parseFloat(G.marginBottom)||10,ge=parseFloat(G.minHeight)||100,he=5,ce=5,Ne=20,Pe=ee.documentElement.clientHeight-de-Ce,ve=ee.documentElement.clientWidth,Le=Pe-te.bottom+pe,Ae=d.current,Ve=f.current;let Ze=0,gt=0;if(Ae&&Ve){const It=Ve.getBoundingClientRect(),ct=Ae.getBoundingClientRect(),nn=It.left-Ee,Pt=ct.left-ye.left,yt=It.top-te.top+It.height/2,Ut=ct.top-ye.top+ct.height/2;Ze=nn-Pt,gt=Ut-yt}const st=Le+gt+Ce+Te;let ot=Math.min(Pe,st);const Fe=Pe-de-Ce,ht=st-ot,Ie=Math.max(he,Ee+Ze),ze=ve-ce,et=Math.max(0,Ie+ye.width-ze);H.style.left=`${Ie-et}px`,H.style.height=`${ot}px`,H.style.maxHeight="auto",H.style.marginTop=`${de}px`,H.style.marginBottom=`${Ce}px`,Q.style.height="100%";const lt=_e.scrollHeight-_e.clientHeight,pt=ht>=lt;pt&&(ot=Math.min(Pe,ye.height)-(ht-lt));const bn=te.top<Ne||te.bottom>Pe-Ne||ot<Math.min(Se,ge),Bt=(ne.visualViewport?.scale??1)!==1&&$P;if(bn||Bt){j.current=!0,GE(H,$.current),xr.flushSync(()=>x(!1));return}if(pt){const It=Math.max(0,Pe-st);H.style.top=ye.height>=Fe?"0":`${It}px`,H.style.height=`${ot}px`,_e.scrollTop=_e.scrollHeight-_e.clientHeight,q.current=Math.max(ge,ot)}else H.style.bottom="0",q.current=Math.max(ge,ot),_e.scrollTop=ht;q.current===Pe&&(K.current=!0),E(),setTimeout(()=>{j.current=!0})})}},[s,L,H,V,f,d,o,E,v,x,Y,T,w,B]),k.useEffect(()=>{if(!v||!H||!L)return;const Q=Er(H);function G(Z){u(!1,it(Jve,Z))}return Q.addEventListener("resize",G),()=>{Q.removeEventListener("resize",G)}},[u,v,H,L]);const ae={...B?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(Q){p.current=!0,C&&dM.has(Q.key)&&Q.stopPropagation()},onMouseMove(){p.current=!1},onPointerLeave(Q){if(Zte(Q)||Q.pointerType==="touch")return;const G=Q.currentTarget;O.start(0,()=>{s.set("activeIndex",null),G.focus({preventScroll:!0})})},onScroll(Q){B||S.current?.(Q.currentTarget)},...v&&{style:B?{height:"100%"}:Xte}},se=xt("div",t,{ref:[n,o],state:J,stateAttributesMapping:SEe,props:[z,ae,Pm(M),{className:!B&&v?Iv.className:void 0},a]});return b.jsxs(k.Fragment,{children:[Iv.element,b.jsx(Lx,{context:R,modal:!1,disabled:!L,restoreFocus:!0,children:se})]})}),wEe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,{store:s,scrollHandlerRef:o}=ml(),{alignItemWithTriggerActive:l}=SM(),u=Ye(s,Vt.hasScrollArrows),f=Ye(s,Vt.openMethod),d=Ye(s,Vt.multiple),m={id:`${Ye(s,Vt.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(S){o.current?.(S.currentTarget)},...l&&{style:Xte},className:u&&f!=="touch"?Iv.className:void 0},E=Xe(S=>{s.set("listElement",S)});return xt("div",t,{ref:[n,E],props:[m,a]})}),Qte=k.createContext(void 0);function wM(){const e=k.useContext(Qte);if(!e)throw new Error(an(57));return e}const TEe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a=null,label:s,disabled:o=!1,nativeButton:l=!1,...u}=t,f=k.useRef(null),d=Lm({label:s,textRef:f,indexGuessBehavior:fM.GuessFromOrder}),{store:p,getItemProps:m,setOpen:E,setValue:S,selectionRef:g,typingRef:y,valuesRef:v,keyboardActiveRef:x,multiple:T,highlightItemOnHover:w}=ml(),C=Pn(),R=Ye(p,Vt.isActive,d.index),O=Ye(p,Vt.isSelected,d.index,a),N=Ye(p,Vt.isSelectedByFocus,d.index),D=Ye(p,Vt.isItemEqualToValue),L=d.index,z=L!==-1,M=k.useRef(null),V=lr(L);Je(()=>{if(!z)return;const se=v.current;return se[L]=a,()=>{delete se[L]}},[z,L,a,v]),Je(()=>{if(!z)return;const se=p.state.value;let Q=se;T&&Array.isArray(se)&&se.length>0&&(Q=se[se.length-1]),Q!==void 0&&vu(Q,a,D)&&p.set("selectedIndex",L)},[z,L,T,D,p,a]);const H=k.useMemo(()=>({disabled:o,selected:O,highlighted:R}),[o,O,R]),B=m({active:R,selected:O});B.onFocus=void 0,B.id=void 0;const q=k.useRef(null),K=k.useRef("mouse"),U=k.useRef(!1),{getButtonProps:j,buttonRef:$}=sa({disabled:o,focusableWhenDisabled:!0,native:l});function Y(se){const Q=p.state.value;if(T){const G=Array.isArray(Q)?Q:[],Z=O?qte(G,a,D):[...G,a];S(Z,it(ff,se))}else S(a,it(ff,se)),E(!1,it(ff,se))}const W={role:"option","aria-selected":O,"aria-disabled":o||void 0,tabIndex:R?0:-1,onFocus(){p.set("activeIndex",L)},onMouseEnter(){!x.current&&p.state.selectedIndex===null&&p.set("activeIndex",L)},onMouseMove(){w&&p.set("activeIndex",L)},onMouseLeave(se){!w||x.current||Zte(se)||C.start(0,()=>{p.state.activeIndex===L&&p.set("activeIndex",null)})},onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(se){q.current=se.key,p.set("activeIndex",L)},onClick(se){U.current=!1,!(se.type==="keydown"&&q.current===null)&&(o||q.current===" "&&y.current||K.current!=="touch"&&!R||(q.current=null,Y(se.nativeEvent)))},onPointerEnter(se){K.current=se.pointerType},onPointerDown(se){K.current=se.pointerType,U.current=!0},onMouseUp(se){if(o)return;if(U.current){U.current=!1;return}const Q=!g.current.allowSelectedMouseUp&&O,G=!g.current.allowUnselectedMouseUp&&!O;Q||G||K.current!=="touch"&&!R||Y(se.nativeEvent)}},J=xt("div",t,{ref:[$,n,d.ref,M],state:H,props:[B,W,u,j]}),ae=k.useMemo(()=>({selected:O,indexRef:V,textRef:f,selectedByFocus:N,hasRegistered:z}),[O,V,f,N,z]);return b.jsx(Qte.Provider,{value:ae,children:J})})),CEe=k.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=wM();return r||i?b.jsx(AEe,{...t,ref:n}):null}),AEe=k.memo(k.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...a}=e,{selected:s}=wM(),o=k.useRef(null),{transitionStatus:l,setMounted:u}=To(s),f=k.useMemo(()=>({selected:s,transitionStatus:l}),[s,l]),d=xt("span",e,{ref:[t,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:ss});return Oi({open:s,ref:o,onComplete(){s||u(!1)}}),d})),kEe=k.memo(k.forwardRef(function(t,n){const{indexRef:r,textRef:i,selectedByFocus:a,hasRegistered:s}=wM(),{selectedItemTextRef:o}=ml(),{className:l,render:u,...f}=t,d=k.useCallback(m=>{if(!m||!s)return;const E=o.current===null||!o.current.isConnected;(a||E&&r.current===0)&&(o.current=m)},[o,r,a,s]);return xt("div",t,{ref:[d,n,i],props:f})})),Jte=k.forwardRef(function(t,n){const{render:r,className:i,direction:a,keepMounted:s=!1,...o}=t,{store:l,popupRef:u,listRef:f,handleScrollArrowVisibility:d,scrollArrowsMountedCountRef:p}=ml(),{side:m,scrollDownArrowRef:E,scrollUpArrowRef:S}=SM(),g=a==="up"?Vt.scrollUpArrowVisible:Vt.scrollDownArrowVisible,y=Ye(l,g),v=Ye(l,Vt.openMethod),x=y&&v!=="touch",T=Pn(),w=a==="up"?S:E,{transitionStatus:C,setMounted:R}=To(x);Je(()=>(p.current+=1,l.state.hasScrollArrows||l.set("hasScrollArrows",!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set("hasScrollArrows",!1)}),[l,p]),Oi({open:x,ref:w,onComplete(){x||R(!1)}});const O=k.useMemo(()=>({direction:a,visible:x,side:m,transitionStatus:C}),[a,x,m,C]),D=xt("div",t,{ref:[n,w],state:O,props:[{"aria-hidden":!0,children:a==="up"?"▲":"▼",style:{position:"absolute"},onMouseMove(z){if(z.movementX===0&&z.movementY===0||T.isStarted())return;l.set("activeIndex",null);function M(){const V=l.state.listElement??u.current;if(!V)return;l.set("activeIndex",null),d();const H=V.scrollTop===0,B=Math.round(V.scrollTop+V.clientHeight)>=V.scrollHeight;if(f.current.length===0&&(a==="up"?l.set("scrollUpArrowVisible",!H):l.set("scrollDownArrowVisible",!B)),a==="up"&&H||a==="down"&&B){T.clear();return}if((l.state.listElement||u.current)&&f.current&&f.current.length>0){const K=f.current,U=w.current?.offsetHeight||0;if(a==="up"){let j=0;const $=V.scrollTop+U;for(let W=0;W<K.length;W+=1){const J=K[W];if(J&&J.offsetTop>=$){j=W;break}}const Y=Math.max(0,j-1);if(Y<j){const W=K[Y];W&&(V.scrollTop=Math.max(0,W.offsetTop-U))}else V.scrollTop=0}else{let j=K.length-1;const $=V.scrollTop+V.clientHeight-U;for(let W=0;W<K.length;W+=1){const J=K[W];if(J&&J.offsetTop+J.offsetHeight>$){j=Math.max(0,W-1);break}}const Y=Math.min(K.length-1,j+1);if(Y>j){const W=K[Y];W&&(V.scrollTop=W.offsetTop+W.offsetHeight-V.clientHeight+U)}else V.scrollTop=V.scrollHeight-V.clientHeight}}T.start(40,M)}T.start(40,M)},onMouseLeave(){T.clear()}},o]});return x||s?D:null}),OEe=k.forwardRef(function(t,n){return b.jsx(Jte,{...t,ref:n,direction:"down"})}),REe=k.forwardRef(function(t,n){return b.jsx(Jte,{...t,ref:n,direction:"up"})}),Bi=dEe;function Ui({className:e,...t}){return b.jsx(mEe,{"data-slot":"select-value",className:Be("flex flex-1 text-left",e),...t})}function $i({className:e,size:t="default",children:n,...r}){return b.jsxs(hEe,{"data-slot":"select-trigger","data-size":t,className:Be("border-input data-[placeholder]:text-muted-foreground bg-input/20 dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border px-2 py-1.5 text-xs/relaxed transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r,children:[n,b.jsx(gEe,{render:b.jsx(fe,{icon:Ste,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})})]})}function zi({className:e,children:t,side:n="bottom",sideOffset:r=4,align:i="center",alignOffset:a=0,alignItemWithTrigger:s=!0,...o}){return b.jsx(vEe,{children:b.jsx(_Ee,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:s,className:"isolate z-50",children:b.jsxs(xEe,{"data-slot":"select-content",className:Be("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-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 ring-foreground/10 min-w-32 rounded-lg shadow-md ring-1 duration-100 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto",e),...o,children:[b.jsx(NEe,{}),b.jsx(wEe,{children:t}),b.jsx(IEe,{})]})})})}function Cn({className:e,children:t,...n}){return b.jsxs(TEe,{"data-slot":"select-item",className:Be("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[b.jsx(kEe,{className:"flex flex-1 gap-2 shrink-0 whitespace-nowrap",children:t}),b.jsx(CEe,{render:b.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:b.jsx(fe,{icon:pl,strokeWidth:2,className:"pointer-events-none"})})]})}function NEe({className:e,...t}){return b.jsx(REe,{"data-slot":"select-scroll-up-button",className:Be("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5 top-0 w-full",e),...t,children:b.jsx(fe,{icon:mM,strokeWidth:2})})}function IEe({className:e,...t}){return b.jsx(OEe,{"data-slot":"select-scroll-down-button",className:Be("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5 bottom-0 w-full",e),...t,children:b.jsx(fe,{icon:Yy,strokeWidth:2})})}const ene=k.createContext(void 0);function TM(){const e=k.useContext(ene);if(e===void 0)throw new Error(an(64));return e}let DEe=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const CM={tabActivationDirection:e=>({[DEe.activationDirection]:e})},LEe=k.forwardRef(function(t,n){const{className:r,defaultValue:i=0,onValueChange:a,orientation:s="horizontal",render:o,value:l,...u}=t,f=Ou(),d=Object.hasOwn(t,"defaultValue"),p=k.useRef([]),[m,E]=k.useState(()=>new Map),[S,g]=ts({controlled:l,default:i,name:"Tabs",state:"value"}),y=l!==void 0,[v,x]=k.useState(()=>new Map),[T,w]=k.useState("none"),C=Xe((q,K)=>{a?.(q,K),!K.isCanceled&&(g(q),w(K.activationDirection))}),R=Xe((q,K)=>{E(U=>{if(U.get(q)===K)return U;const j=new Map(U);return j.set(q,K),j})}),O=Xe((q,K)=>{E(U=>{if(!U.has(q)||U.get(q)!==K)return U;const j=new Map(U);return j.delete(q),j})}),N=k.useCallback(q=>m.get(q),[m]),D=k.useCallback(q=>{for(const K of v.values())if(q===K?.value)return K?.id},[v]),L=k.useCallback(q=>{if(q===void 0)return null;for(const[K,U]of v.entries())if(U!=null&&q===(U.value??U.index))return K;return null},[v]),z=k.useMemo(()=>({direction:f,getTabElementBySelectedValue:L,getTabIdByPanelValue:D,getTabPanelIdByValue:N,onValueChange:C,orientation:s,registerMountedTabPanel:R,setTabMap:x,unregisterMountedTabPanel:O,tabActivationDirection:T,value:S}),[f,L,D,N,C,s,R,x,O,T,S]),M=k.useMemo(()=>{for(const q of v.values())if(q!=null&&q.value===S)return q},[v,S]),V=k.useMemo(()=>{for(const q of v.values())if(q!=null&&!q.disabled)return q.value},[v]);Je(()=>{if(y||v.size===0)return;const q=M?.disabled,K=M==null&&S!==null;if(d&&q&&S===i||!q&&!K)return;const j=V??null;S!==j&&(g(j),w("none"))},[i,V,d,y,M,w,g,v,S]);const B=xt("div",t,{state:{orientation:s,tabActivationDirection:T},ref:n,props:u,stateAttributesMapping:CM});return b.jsx(ene.Provider,{value:z,children:b.jsx(Vy,{elementsRef:p,children:B})})}),tne=k.createContext(void 0);function PEe(){const e=k.useContext(tne);if(e===void 0)throw new Error(an(65));return e}const MEe=k.forwardRef(function(t,n){const{className:r,disabled:i=!1,render:a,value:s,id:o,nativeButton:l=!0,...u}=t,{value:f,getTabPanelIdByValue:d,orientation:p}=TM(),{activateOnFocus:m,highlightedTabIndex:E,onTabActivation:S,setHighlightedTabIndex:g,tabsListElement:y}=PEe(),v=mi(o),x=k.useMemo(()=>({disabled:i,id:v,value:s}),[i,v,s]),{compositeProps:T,compositeRef:w,index:C}=rte({metadata:x}),R=s===f,O=k.useRef(!1);Je(()=>{if(O.current){O.current=!1;return}if(!(R&&C>-1&&E!==C))return;const U=y;if(U!=null){const j=As(ki(U));if(j&&Tt(U,j))return}i||g(C)},[R,C,E,g,i,y]);const{getButtonProps:N,buttonRef:D}=sa({disabled:i,native:l,focusableWhenDisabled:!0}),L=d(s),z=k.useRef(!1),M=k.useRef(!1);function V(U){R||i||S(s,it(Dr,U.nativeEvent,void 0,{activationDirection:"none"}))}function H(U){R||(C>-1&&!i&&g(C),!i&&m&&(!z.current||z.current&&M.current)&&S(s,it(Dr,U.nativeEvent,void 0,{activationDirection:"none"})))}function B(U){if(R||i)return;z.current=!0;function j(){z.current=!1,M.current=!1}(!U.button||U.button===0)&&(M.current=!0,ki(U.currentTarget).addEventListener("pointerup",j,{once:!0}))}const q=k.useMemo(()=>({disabled:i,active:R,orientation:p}),[i,R,p]);return xt("button",t,{state:q,ref:[n,D,w],props:[T,{role:"tab","aria-controls":L,"aria-selected":R,id:v,onClick:V,onFocus:H,onPointerDown:B,[Qee]:R?"":void 0,onKeyDownCapture(){O.current=!0}},u,N]})});let jEe=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const FEe=k.forwardRef(function(t,n){const{className:r,value:i,render:a,keepMounted:s=!1,...o}=t,{value:l,getTabIdByPanelValue:u,orientation:f,tabActivationDirection:d,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=TM(),E=mi(),S=k.useMemo(()=>({id:E,value:i}),[E,i]),{ref:g,index:y}=Lm({metadata:S}),v=i!==l,x=u(i),T=k.useMemo(()=>({hidden:v,orientation:f,tabActivationDirection:d}),[v,f,d]),w=xt("div",t,{state:T,ref:[n,g],props:[{"aria-labelledby":x,hidden:v,id:E??void 0,role:"tabpanel",tabIndex:v?-1:0,[jEe.index]:y},o],stateAttributesMapping:CM});return Je(()=>{if(!(v&&!s)&&E!=null)return p(i,E),()=>{m(i,E)}},[v,s,i,E,p,m]),!v||s?w:null}),BEe=k.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:i,loopFocus:a=!0,render:s,...o}=t,{getTabElementBySelectedValue:l,onValueChange:u,orientation:f,value:d,setTabMap:p,tabActivationDirection:m}=TM(),[E,S]=k.useState(0),[g,y]=k.useState(null),v=UEe(d,f,g,l),x=Xe((R,O)=>{if(R!==d){const N=v(R);O.activationDirection=N,u(R,O)}}),T=k.useMemo(()=>({orientation:f,tabActivationDirection:m}),[f,m]),w={"aria-orientation":f==="vertical"?"vertical":void 0,role:"tablist"},C=k.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:E,onTabActivation:x,setHighlightedTabIndex:S,tabsListElement:g,value:d}),[r,E,x,S,g,d]);return b.jsx(tne.Provider,{value:C,children:b.jsx($x,{render:s,className:i,state:T,refs:[n,y],props:[w,o],stateAttributesMapping:CM,highlightedIndex:E,enableHomeAndEndKeys:!0,loopFocus:a,orientation:f,onHighlightedIndexChange:S,onMapChange:p,disabledIndices:ta})})});function hz(e,t){const{left:n,top:r}=e.getBoundingClientRect(),{left:i,top:a}=t.getBoundingClientRect(),s=n-i,o=r-a;return{left:s,top:o}}function UEe(e,t,n,r){const[i,a]=k.useState(null);return Je(()=>{if(e==null||n==null){a(null);return}const s=r(e);if(s==null){a(null);return}const{left:o,top:l}=hz(s,n);a(t==="horizontal"?o:l)},[t,r,n,e]),k.useCallback(s=>{if(s===e)return"none";if(s==null)return a(null),"none";if(s!=null&&n!=null){const o=r(s);if(o!=null){const{left:l,top:u}=hz(o,n);if(i==null)return a(t==="horizontal"?l:u),"none";if(t==="horizontal"){if(l<i)return a(l),"left";if(l>i)return a(l),"right"}else{if(u<i)return a(u),"up";if(u>i)return a(u),"down"}}}return"none"},[r,t,i,n,e])}function Zo({className:e,orientation:t="horizontal",...n}){return b.jsx(LEe,{"data-slot":"tabs","data-orientation":t,className:Be("gap-2 group/tabs flex data-[orientation=horizontal]:flex-col",e),...n})}const $Ee=Xc("rounded-lg p-[3px] group-data-horizontal/tabs:h-8 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Qo({className:e,variant:t="default",...n}){return b.jsx(BEe,{"data-slot":"tabs-list","data-variant":t,className:Be($Ee({variant:t}),e),...n})}function Wr({className:e,...t}){return b.jsx(MEe,{"data-slot":"tabs-trigger",className:Be("gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-xs font-medium group-data-vertical/tabs:py-[calc(--spacing(1.25))] [&_svg:not([class*='size-'])]:size-3.5 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0","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 dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function ci({className:e,...t}){return b.jsx(FEe,{"data-slot":"tabs-content",className:Be("text-xs/relaxed flex-1 min-h-0 outline-none",e),...t})}function zEe(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:s,handle:o,triggerId:l,defaultTriggerId:u=null}=e,f=Ru(),d=!!f,p=pi(()=>o?.store??new Dte({open:n??r,activeTriggerId:l!==void 0?l:u,modal:!0,disablePointerDismissal:!0,nested:d,role:"alertdialog"})).current;p.useControlledProp("open",n,r),p.useControlledProp("activeTriggerId",l,u),p.useSyncedValue("nested",d),p.useContextCallback("onOpenChange",i),p.useContextCallback("onOpenChangeComplete",a);const m=p.useState("payload");Ite({store:p,actionsRef:s,parentContext:f?.store.context});const E=k.useMemo(()=>({store:p}),[p]);return b.jsx(yM.Provider,{value:E,children:typeof t=="function"?t({payload:m}):t})}const nne=k.createContext(void 0),rne=k.createContext(void 0),ine=k.createContext(void 0),ane=k.createContext("");function Nu(){const e=k.useContext(nne);if(!e)throw new Error(an(22));return e}function Jx(){const e=k.useContext(rne);if(!e)throw new Error(an(23));return e}function Yf(){const e=k.useContext(ine);if(!e)throw new Error(an(24));return e}function AM(){return k.useContext(ane)}const mt={id:Ue(e=>e.id),query:Ue(e=>e.query),items:Ue(e=>e.items),selectedValue:Ue(e=>e.selectedValue),open:Ue(e=>e.open),mounted:Ue(e=>e.mounted),forceMounted:Ue(e=>e.forceMounted),inline:Ue(e=>e.inline),activeIndex:Ue(e=>e.activeIndex),selectedIndex:Ue(e=>e.selectedIndex),isActive:Ue((e,t)=>e.activeIndex===t),isSelected:Ue((e,t)=>{const n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(i=>vu(i,t,n)):vu(r,t,n)}),transitionStatus:Ue(e=>e.transitionStatus),popupProps:Ue(e=>e.popupProps),inputProps:Ue(e=>e.inputProps),triggerProps:Ue(e=>e.triggerProps),getItemProps:Ue(e=>e.getItemProps),positionerElement:Ue(e=>e.positionerElement),listElement:Ue(e=>e.listElement),triggerElement:Ue(e=>e.triggerElement),inputElement:Ue(e=>e.inputElement),popupSide:Ue(e=>e.popupSide),openMethod:Ue(e=>e.openMethod),inputInsidePopup:Ue(e=>e.inputInsidePopup),selectionMode:Ue(e=>e.selectionMode),listRef:Ue(e=>e.listRef),labelsRef:Ue(e=>e.labelsRef),popupRef:Ue(e=>e.popupRef),emptyRef:Ue(e=>e.emptyRef),inputRef:Ue(e=>e.inputRef),keyboardActiveRef:Ue(e=>e.keyboardActiveRef),chipsContainerRef:Ue(e=>e.chipsContainerRef),clearRef:Ue(e=>e.clearRef),valuesRef:Ue(e=>e.valuesRef),allValuesRef:Ue(e=>e.allValuesRef),name:Ue(e=>e.name),disabled:Ue(e=>e.disabled),readOnly:Ue(e=>e.readOnly),required:Ue(e=>e.required),grid:Ue(e=>e.grid),isGrouped:Ue(e=>e.isGrouped),virtualized:Ue(e=>e.virtualized),onOpenChangeComplete:Ue(e=>e.onOpenChangeComplete),openOnInputClick:Ue(e=>e.openOnInputClick),itemToStringLabel:Ue(e=>e.itemToStringLabel),isItemEqualToValue:Ue(e=>e.isItemEqualToValue),modal:Ue(e=>e.modal),autoHighlight:Ue(e=>e.autoHighlight),submitOnItemClick:Ue(e=>e.submitOnItemClick)};function HEe(e,t){return(n,r)=>{if(n==null)return!1;const i=Qr(n,t);return e.contains(i,r)}}function WEe(e,t,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;const a=Qr(r,t),s=n!=null?Qr(n,t):"";return s&&e.contains(s,i)&&s.length===i.length?!0:e.contains(a,i)}}const pz=new Map;function sne(e){return Array.isArray(e)?e.map(t=>sne(t)).join(","):e==null?"":String(e)}function VEe(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},n=`${sne(e.locale)}|${JSON.stringify(t)}`,r=pz.get(n);if(r)return r;const i=new Intl.Collator(e.locale,t),a={contains(s,o,l){if(!o)return!0;const u=Qr(s,l);for(let f=0;f<=u.length-o.length;f+=1)if(i.compare(u.slice(f,f+o.length),o)===0)return!0;return!1},startsWith(s,o,l){if(!o)return!0;const u=Qr(s,l);return i.compare(u.slice(0,o.length),o)===0},endsWith(s,o,l){if(!o)return!0;const u=Qr(s,l),f=o.length;return u.length>=f&&i.compare(u.slice(u.length-f),o)===0}};return pz.set(n,a),a}const GEe=VEe,one=Symbol("none"),Ld={value:one,index:-1};function qEe(e){const{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:s,inputValue:o,selectionMode:l="none",onItemHighlighted:u,name:f,disabled:d=!1,readOnly:p=!1,required:m=!1,inputRef:E,grid:S=!1,items:g,filteredItems:y,filter:v,openOnInputClick:x=!0,autoHighlight:T=!1,keepHighlight:w=!1,highlightItemOnHover:C=!0,itemToStringLabel:R,itemToStringValue:O,isItemEqualToValue:N=Gte,virtualized:D=!1,inline:L=!1,fillInputOnItemPress:z=!0,modal:M=!1,limit:V=-1,autoComplete:H="list",locale:B,submitOnItemClick:q=!1}=e,{clearErrors:K}=Zy(),{setDirty:U,validityData:j,shouldValidateOnChange:$,setFilled:Y,name:W,disabled:J,validation:ae}=Bs(),se=Qx({id:t}),Q=GEe({locale:B}),[G,Z]=k.useState(!1),[ee,ne]=k.useState(null),te=k.useRef([]),ye=k.useRef([]),Ee=k.useRef(null),pe=k.useRef(null),_e=k.useRef(null),Se=k.useRef(!0),Te=k.useRef(!1),de=k.useRef(null),Ce=k.useRef(null),ge=k.useRef(null),he=k.useRef(Ld),ce=k.useRef(null),Ne=k.useRef([]),Pe=k.useRef([]),ve=J||d,Le=W??f,Ae=l==="multiple",Ve=l==="single",Ze=o!==void 0||s!==void 0,gt=g!==void 0,st=y!==void 0;let ot;T==="always"?ot="always":ot=T?"input-change":!1;const[Fe,ht]=ts({controlled:i,default:Ae?r??ta:r,name:"Combobox",state:"selectedValue"}),Ie=k.useMemo(()=>v===null?()=>!0:v!==void 0?v:Ve&&!G?WEe(Q,R,Fe):HEe(Q,R),[v,Ve,Fe,G,Q,R]),ze=pi(()=>Ze?s??"":Ve?Qr(Fe,R):"").current,[et,lt]=ts({controlled:o,default:ze,name:"Combobox",state:"inputValue"}),[pt,bn]=ts({controlled:e.open,default:e.defaultOpen,name:"Combobox",state:"open"}),Bt=Kte(g),It=ee??(et===""?"":String(et).trim()),ct=Ve?Qr(Fe,R):"",nn=Ve&&!G&&It!==""&&ct!==""&&ct.length===It.length&&Q.contains(ct,It),Pt=nn?"":It,yt=gt&&st&&nn,Ut=k.useMemo(()=>g?Bt?g.flatMap(dt=>dt.items):g:ta,[g,Bt]),$t=k.useMemo(()=>{if(y&&!yt)return y;if(!g)return ta;if(Bt){const Ct=g,Kt=[];let Kn=0;for(const vr of Ct){if(V>-1&&Kn>=V)break;const Mr=Pt===""?vr.items:vr.items.filter(Nl=>Ie(Nl,Pt,R));if(Mr.length===0)continue;const Ol=V>-1?V-Kn:1/0,Rl=Mr.slice(0,Ol);if(Rl.length>0){const Nl={...vr,items:Rl};Kt.push(Nl),Kn+=Rl.length}}return Kt}if(Pt==="")return V>-1?Ut.slice(0,V):Ut;const dt=[];for(const Ct of Ut){if(V>-1&&dt.length>=V)break;Ie(Ct,Pt,R)&&dt.push(Ct)}return dt},[y,yt,g,Bt,Pt,V,Ie,R,Ut]),Ht=k.useMemo(()=>Bt?$t.flatMap(Ct=>Ct.items):$t,[$t,Bt]),ft=pi(()=>new pf({id:se,selectedValue:Fe,open:pt,filter:Ie,query:It,items:g,selectionMode:l,listRef:te,labelsRef:ye,popupRef:Ee,emptyRef:_e,inputRef:pe,keyboardActiveRef:Se,chipsContainerRef:de,clearRef:Ce,valuesRef:Ne,allValuesRef:Pe,selectionEventRef:ge,name:Le,disabled:ve,readOnly:p,required:m,grid:S,isGrouped:Bt,virtualized:D,openOnInputClick:x,itemToStringLabel:R,isItemEqualToValue:N,modal:M,autoHighlight:ot,submitOnItemClick:q,hasInputValue:Ze,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:L,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:n||yr,setOpen:yr,setInputValue:yr,setSelectedValue:yr,setIndices:yr,onItemHighlighted:yr,handleSelection:yr,getItemProps:()=>Jn,forceMount:yr,requestSubmit:yr})).current,yn=l==="none"?et:Fe,mr=k.useMemo(()=>l==="none"?yn:Array.isArray(Fe)?Fe.map(dt=>to(dt,O)):to(Fe,O),[yn,O,l,Fe]),qr=Xe(u),Pr=Xe(n),Yi=Ye(ft,mt.activeIndex),Yt=Ye(ft,mt.selectedIndex),Di=Ye(ft,mt.positionerElement),gr=Ye(ft,mt.listElement),br=Ye(ft,mt.triggerElement),ls=Ye(ft,mt.inputElement),Xi=Ye(ft,mt.inline),Vs=Ye(ft,mt.inputInsidePopup),lg=lr(br),{mounted:hd,setMounted:wl,transitionStatus:Tl}=To(pt),{openMethod:Gs,triggerProps:us,reset:Cl}=Xx(pt);Qy({id:se,name:Le,commit:ae.commit,value:yn,controlRef:Vs?lg:pe,getValue:()=>mr});const Li=Xe(()=>{g?ye.current=Ht.map(dt=>Qr(dt,R)):ft.set("forceMounted",!0)}),Tr=k.useRef(Fe);Je(()=>{Fe!==Tr.current&&Li()},[Li,Fe]);const vi=Xe(dt=>{ft.update(dt);const Ct=dt.type||"none";if(dt.activeIndex!==void 0)if(dt.activeIndex===null)he.current!==Ld&&(he.current=Ld,qr(void 0,lb(Ct,void 0,{index:-1})));else{const Kt=Ne.current[dt.activeIndex];he.current={value:Kt,index:dt.activeIndex},qr(Kt,lb(Ct,void 0,{index:dt.activeIndex}))}}),Ge=Xe((dt,Ct)=>{if(Te.current=Ct.reason===bc,e.onInputValueChange?.(dt,Ct),!Ct.isCanceled){if(Ct.reason===Yd){const Kt=dt.trim()!=="";Kt&&Z(!0),ce.current={hasQuery:Kt},Kt&&ot&&ft.state.activeIndex==null&&ft.set("activeIndex",0)}lt(dt)}}),Nt=Xe((dt,Ct)=>{pt!==dt&&(Ct.reason==="escape-key"&&gt&&Ht.length===0&&!ft.state.emptyRef.current&&Ct.allowPropagation(),e.onOpenChange?.(dt,Ct),!Ct.isCanceled&&(!dt&&G&&(Ve?(ne(It),It===""&&Z(!1)):Ae&&(Xi||Vs?vi({activeIndex:null}):ne(It),Ge("",it(bc,Ct.event)))),bn(dt)))}),Cr=Xe((dt,Ct)=>{if(a?.(dt,Ct),Ct.isCanceled)return;ht(dt),(l==="none"&&Ee.current&&z||Ve&&!ft.state.inputInsidePopup)&&Ge(Qr(dt,R),it(Ct.reason,Ct.event)),Ve&&dt!=null&&Ct.reason!==Yd&&G&&ne(It)}),Al=Xe((dt,Ct)=>{let Kt=Ct;if(Kt===void 0){if(Yi===null)return;Kt=Ne.current[Yi]}const Kn=_r(dt),vr=ge.current??dt;ge.current=null;const Mr=it(ff,vr),Ol=Kn?.closest("a")?.getAttribute("href");if(Ol){Ol.startsWith("#")&&Nt(!1,Mr);return}if(Ae){const Rl=Array.isArray(Fe)?Fe:[],qs=Jd(Rl,Kt,ft.state.isItemEqualToValue)?qte(Rl,Kt,ft.state.isItemEqualToValue):[...Rl,Kt];if(Cr(qs,Mr),!(pe.current?pe.current.value.trim()!=="":!1))return;ft.state.inputInsidePopup?Ge("",it(bc,Mr.event)):Nt(!1,Mr)}else Cr(Kt,Mr),Nt(!1,Mr)}),Da=Xe(()=>{if(!ft.state.submitOnItemClick)return;const dt=ft.state.inputElement?.form;dt&&typeof dt.requestSubmit=="function"&&dt.requestSubmit()}),pd=Xe(()=>{if(wl(!1),Pr?.(!1),Z(!1),Cl(),ne(null),vi(l==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Ae&&pe.current&&pe.current.value!==""&&!Te.current&&Ge("",it(bc)),Ve)if(ft.state.inputInsidePopup)pe.current&&pe.current.value!==""&&Ge("",it(bc));else{const dt=Qr(Fe,R);pe.current&&pe.current.value!==dt&&Ge(dt,it(dt===""?bc:Dr))}}),DT=k.useMemo(()=>Xi&&Di?{current:Di.closest('[role="dialog"]')}:Ee,[Xi,Di]);Oi({enabled:!e.actionsRef,open:pt,ref:DT,onComplete(){pt||pd()}}),k.useImperativeHandle(e.actionsRef,()=>({unmount:pd}),[pd]),Je(function(){if(pt||l==="none")return;const Ct=g?Ut:Pe.current;if(Ae){const Kt=Array.isArray(Fe)?Fe:[],Kn=Kt[Kt.length-1],vr=Bp(Ct,Kn,N);vi({selectedIndex:vr===-1?null:vr})}else{const Kt=Bp(Ct,Fe,N);vi({selectedIndex:Kt===-1?null:Kt})}},[pt,Fe,g,l,Ut,Ae,N,vi]),Je(()=>{g&&(Ne.current=Ht,te.current.length=Ht.length)},[g,Ht]),Je(()=>{const dt=ce.current;if(dt&&(dt.hasQuery?ot&&ft.set("activeIndex",0):ot==="always"&&ft.set("activeIndex",0),ce.current=null),!pt&&!Xi)return;const Kt=gt||st?Ht:Ne.current,Kn=ft.state.activeIndex;if(Kn==null){if(ot==="always"&&Kt.length>0){ft.set("activeIndex",0);return}he.current!==Ld&&(he.current=Ld,ft.state.onItemHighlighted(void 0,lb(Dr,void 0,{index:-1})));return}if(Kn>=Kt.length){he.current!==Ld&&(he.current=Ld,ft.state.onItemHighlighted(void 0,lb(Dr,void 0,{index:-1}))),ft.set("activeIndex",null);return}const vr=Kt[Kn],Mr=he.current.value,Ol=Mr!==one&&ft.state.isItemEqualToValue(vr,Mr);(he.current.index!==Kn||!Ol)&&(he.current={value:vr,index:Kn},ft.state.onItemHighlighted(vr,lb(Dr,void 0,{index:Kn})))},[Yi,ot,st,gt,Ht,Xi,pt,ft]),Je(()=>{if(!g||l==="none")return;const dt=Ut;if(Ae){const Kn=Array.isArray(Fe)?Fe:ta,vr=Kn.filter(Mr=>Jd(dt,Mr,ft.state.isItemEqualToValue));vr.length!==Kn.length&&ht(vr);return}if(Fe==null?!0:Jd(dt,Fe,ft.state.isItemEqualToValue))return;let Kt=null;if(r!=null&&Jd(dt,r,ft.state.isItemEqualToValue)&&(Kt=r),ht(Kt),!ft.state.inputInsidePopup){const Kn=Qr(Kt,R);pe.current&&pe.current.value!==Kn&&Ge(Kn,it(Dr))}},[g,Ut,Ae,l,Fe,r,ht,R,ft,Ge]),Je(()=>{if(l==="none"){Y(String(et)!=="");return}Y(Ae?Array.isArray(Fe)&&Fe.length>0:Fe!=null)},[Y,l,et,Fe,Ae]),k.useEffect(()=>{gt&&ot&&Ht.length===0&&vi({activeIndex:null})},[gt,ot,Ht.length,vi]),ef(It,()=>{!pt||It===""||It===String(ze)||Z(!0)}),ef(Fe,()=>{if(l!=="none"&&(K(Le),U(Fe!==j.initialValue),$()?ae.commit(Fe):ae.commit(Fe,!0),Ae&&ft.state.selectedIndex!==null&&(!Array.isArray(Fe)||Fe.length===0)&&vi({activeIndex:null,selectedIndex:null}),Ve&&!Ze&&!Vs)){const dt=Qr(Fe,R);et!==dt&&Ge(dt,it(Dr))}}),ef(et,()=>{l==="none"&&(K(Le),U(et!==j.initialValue),$()?ae.commit(et):ae.commit(et,!0))}),ef(g,()=>{if(!Ve||Ze||Vs||G)return;const dt=Qr(Fe,R);et!==dt&&Ge(dt,it(Dr))});const kl=Fx({open:Xi?!0:pt,onOpenChange:Nt,elements:{reference:Vs?br:ls,floating:Di}});let Fu,La;Xi||(Fu=S?"grid":"listbox",La=pt?"true":"false");const oa=k.useMemo(()=>{const dt=ls?.tagName==="INPUT",Ct=dt||pt,Kt=dt?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return Ct&&(Kt.role="combobox",Kt["aria-expanded"]=La,Kt["aria-haspopup"]=Fu,Kt["aria-controls"]=pt?gr?.id:void 0,Kt["aria-autocomplete"]=H),{reference:Kt,floating:{role:"presentation"}}},[ls,pt,La,Fu,gr?.id,H]),$0=Nm(kl,{enabled:!p&&!ve&&x,event:"mousedown-only",toggle:!1,touchOpenDelay:Vs?0:50}),LT=Im(kl,{enabled:!p&&!ve&&!Xi,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Xi?!0:void 0,outsidePress(dt){const Ct=_r(dt);return!Tt(br,Ct)&&!Tt(Ce.current,Ct)&&!Tt(de.current,Ct)}}),ug=lM(kl,{enabled:!p&&!ve,id:se,listRef:te,activeIndex:Yi,selectedIndex:Yt,virtual:!0,loopFocus:!0,allowEscape:!ot,focusItemOnOpen:G||l==="none"&&!ot?!1:"auto",focusItemOnHover:C,resetOnPointerLeave:!w,cols:S?2:1,orientation:S?"horizontal":void 0,disabledIndices:ta,onNavigate(dt,Ct){!Ct&&!pt||Tl==="ending"||vi(Ct?{activeIndex:dt,type:Se.current?"keyboard":"pointer"}:{activeIndex:dt})}}),{getReferenceProps:ph,getFloatingProps:Bu,getItemProps:cg}=Jc([oa,$0,LT,ug]);zte(()=>{ft.update({inline:L,popupProps:Bu(),inputProps:ph(),triggerProps:us,getItemProps:cg,setOpen:Nt,setInputValue:Ge,setSelectedValue:Cr,setIndices:vi,onItemHighlighted:qr,handleSelection:Al,forceMount:Li,requestSubmit:Da})}),Je(()=>{ft.update({id:se,selectedValue:Fe,open:pt,mounted:hd,transitionStatus:Tl,items:g,inline:L,popupProps:Bu(),inputProps:ph(),triggerProps:us,openMethod:Gs,getItemProps:cg,selectionMode:l,name:Le,disabled:ve,readOnly:p,required:m,grid:S,isGrouped:Bt,virtualized:D,onOpenChangeComplete:Pr,openOnInputClick:x,itemToStringLabel:R,modal:M,autoHighlight:ot,isItemEqualToValue:N,submitOnItemClick:q,hasInputValue:Ze,requestSubmit:Da})},[ft,se,Fe,pt,hd,Tl,g,Bu,ph,cg,Gs,us,l,Le,ve,p,m,ae,S,Bt,D,Pr,x,R,M,N,q,Ze,L,Da,ot]);const la=Fs(E,ae.inputRef),dg=k.useMemo(()=>({query:It,filteredItems:$t,flatFilteredItems:Ht}),[It,$t,Ht]),z0=k.useMemo(()=>Array.isArray(yn)?"":to(yn,O),[yn,O]),fg=Ae&&Array.isArray(Fe)&&Fe.length>0,Uu=k.useMemo(()=>!Ae||!Array.isArray(Fe)||!Le?null:Fe.map(dt=>{const Ct=to(dt,O);return b.jsx("input",{type:"hidden",name:Le,value:Ct},Ct)}),[Ae,Fe,Le,O]),H0=b.jsxs(k.Fragment,{children:[e.children,b.jsx("input",{...ae.getInputValidationProps({onFocus(){if(Vs){br?.focus();return}(pe.current||br)?.focus()},onChange(dt){if(dt.nativeEvent.defaultPrevented)return;const Ct=dt.target.value,Kt=it(Yd,dt.nativeEvent);function Kn(){if(Ae)return;if(l==="none"){U(Ct!==j.initialValue),Ge(Ct,Kt),$()&&ae.commit(Ct);return}const vr=Ne.current.find(Mr=>to(Mr,O).toLowerCase()===Ct.toLowerCase());vr!=null&&(U(vr!==j.initialValue),Cr?.(vr,Kt),$()&&ae.commit(vr))}g?Kn():(Li(),queueMicrotask(Kn))}}),id:se,name:Ae||l==="none"?void 0:Le,disabled:ve,required:m&&!fg,readOnly:p,value:z0,ref:la,style:Rm,tabIndex:-1,"aria-hidden":!0}),Uu]});return b.jsx(nne.Provider,{value:ft,children:b.jsx(rne.Provider,{value:kl,children:b.jsx(ine.Provider,{value:dg,children:b.jsx(ane.Provider,{value:et,children:H0})})})})}const S_=2,KEe={...Mp,...Kf},YEe=k.forwardRef(function(t,n){const{render:r,className:i,nativeButton:a=!0,disabled:s=!1,...o}=t,{state:l,disabled:u,setTouched:f,setFocused:d,validationMode:p,validation:m}=Bs(),{labelId:E}=nd(),S=Nu(),g=Ye(S,mt.selectionMode),y=Ye(S,mt.disabled),v=Ye(S,mt.readOnly),x=Ye(S,mt.listElement),T=Ye(S,mt.triggerProps),w=Ye(S,mt.triggerElement),C=Ye(S,mt.inputInsidePopup),R=Ye(S,mt.open),O=Ye(S,mt.selectedValue),N=Ye(S,mt.activeIndex),D=Ye(S,mt.selectedIndex),L=Jx(),z=AM(),M=Pn(),V=u||y||s,H=k.useRef("");function B(ae){H.current=ae.pointerType}const q=L.select("domReferenceElement");k.useEffect(()=>{C&&w&&w!==q&&L.set("domReferenceElement",w)},[w,q,L,C]);const{reference:K}=uM(L,{enabled:!R&&!v&&!y&&g==="single",listRef:S.state.labelsRef,activeIndex:N,selectedIndex:D,onMatch(ae){const se=S.state.valuesRef.current[ae];se!==void 0&&S.state.setSelectedValue(se,it("none"))}}),{reference:U}=Nm(L,{enabled:!v&&!y,event:"mousedown"}),{buttonRef:j,getButtonProps:$}=sa({native:a,disabled:V}),Y=k.useMemo(()=>({...l,open:R,disabled:V}),[l,R,V]),W=Xe(ae=>{S.set("triggerElement",ae)});return xt("button",t,{ref:[n,j,W],state:Y,props:[T,U,K,{tabIndex:C?0:-1,disabled:V,role:C?"combobox":void 0,"aria-expanded":R?"true":"false","aria-haspopup":C?"dialog":"listbox","aria-controls":R?x?.id:void 0,"aria-readonly":v||void 0,"aria-labelledby":E,onPointerDown:B,onPointerEnter:B,onFocus(){d(!0),!(V||v)&&M.start(0,S.state.forceMount)},onBlur(){if(f(!0),d(!1),p==="onBlur"){const ae=g==="none"?z:O;m.commit(ae)}},onMouseDown(ae){if(V||v||(C||L.set("domReferenceElement",ae.currentTarget),S.state.forceMount(),H.current!=="touch"&&(S.state.inputRef.current?.focus(),C||ae.preventDefault()),R))return;const se=ki(ae.currentTarget);function Q(G){if(!w)return;const Z=_r(G),ee=S.state.positionerElement,ne=S.state.listElement;if(Tt(w,Z)||Tt(ee,Z)||Tt(ne,Z)||Z===w)return;const te=EM(w),ye=G.clientX>=te.left-S_&&G.clientX<=te.right+S_,Ee=G.clientY>=te.top-S_&&G.clientY<=te.bottom+S_;ye&&Ee||S.state.setOpen(!1,it("cancel-open",G))}C&&se.addEventListener("mouseup",Q,{once:!0})},onKeyDown(ae){V||v||(ae.key==="ArrowDown"||ae.key==="ArrowUp")&&(Rr(ae),S.state.setOpen(!0,it(vp,ae.nativeEvent)),S.state.inputRef.current?.focus())}},m?m.getValidationProps(o):o,$],stateAttributesMapping:KEe})}),XEe=k.createContext(void 0);function ZEe(){return k.useContext(XEe)}const lne=k.createContext(void 0);function kM(e){const t=k.useContext(lne);if(t===void 0&&!e)throw new Error(an(21));return t}const QEe={...Mp,...Kf,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},JEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,id:s,...o}=t,{state:l,disabled:u,setTouched:f,setFocused:d,validationMode:p,validation:m}=Bs(),{labelId:E}=nd(),S=ZEe(),y=!!kM(!0),v=Nu(),{filteredItems:x}=Yf(),T=AM(),w=mi(s),C=Ou(),R=Ye(v,mt.disabled),O=Ye(v,mt.readOnly),N=Ye(v,mt.name),D=Ye(v,mt.selectionMode),L=Ye(v,mt.autoHighlight),z=Ye(v,mt.inputProps),M=Ye(v,mt.triggerProps),V=Ye(v,mt.open),H=Ye(v,mt.mounted),B=Ye(v,mt.selectedValue),q=Ye(v,mt.popupSide),K=Ye(v,mt.positionerElement),U=!!L,j=H&&K?q:null,$=u||R||a,Y=x.length===0,[W,J]=k.useState(null),ae=k.useRef(!1),se=Xe(ee=>{const ne=y||v.state.inline;ne&&!v.state.hasInputValue&&v.state.setInputValue("",it(Dr)),v.update({inputElement:ee,inputInsidePopup:ne})}),Q=k.useMemo(()=>({...l,open:V,disabled:$,readOnly:O,popupSide:j,listEmpty:Y}),[l,V,$,O,j,Y]);function G(ee){if(!S)return;let ne;const{highlightedChipIndex:te}=S;if(te!==void 0){if(ee.key==="ArrowLeft")ee.preventDefault(),te>0?ne=te-1:ne=void 0;else if(ee.key==="ArrowRight")ee.preventDefault(),te<B.length-1?ne=te+1:ne=void 0;else if(ee.key==="Backspace"||ee.key==="Delete"){ee.preventDefault();const ye=te>=B.length-1?B.length-2:te;ne=ye>=0?ye:void 0,v.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return ne}return ee.key==="ArrowLeft"&&(ee.currentTarget.selectionStart??0)===0&&B.length>0?(ee.preventDefault(),ne=Math.max(B.length-1,0)):ee.key==="Backspace"&&ee.currentTarget.value===""&&B.length>0&&(v.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),ee.preventDefault()),ne}return xt("input",t,{state:Q,ref:[n,v.state.inputRef,se],props:[z,M,{type:"text",value:t.value??W??T,"aria-readonly":O||void 0,"aria-labelledby":E,disabled:$,readOnly:O,...D==="none"&&N&&{name:N},id:w,onFocus(){d(!0)},onBlur(){if(f(!0),d(!1),p==="onBlur"){const ee=D==="none"?T:B;m.commit(ee)}},onCompositionStart(ee){jE||(ae.current=!0,J(ee.currentTarget.value))},onCompositionEnd(ee){ae.current=!1;const ne=ee.currentTarget.value;J(null),v.state.setInputValue(ne,it(Yd,ee.nativeEvent))},onChange(ee){if(ae.current){const Ee=ee.currentTarget.value;J(Ee),Ee===""&&!v.state.openOnInputClick&&!v.state.inputInsidePopup&&v.state.setOpen(!1,it(bc,ee.nativeEvent));const pe=Ee.trim(),_e=U&&pe!=="";!O&&!$&&pe!==""&&(v.state.setOpen(!0,it(Yd,ee.nativeEvent)),U||v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"})),V&&v.state.activeIndex!==null&&!_e&&v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"});return}v.state.setInputValue(ee.currentTarget.value,it(Yd,ee.nativeEvent));const ne=ee.currentTarget.value==="",te=it(bc,ee.nativeEvent);ne&&!v.state.inputInsidePopup&&(D==="single"&&v.state.setSelectedValue(null,te),v.state.openOnInputClick||v.state.setOpen(!1,te));const ye=ee.currentTarget.value.trim();!O&&!$&&ye!==""&&(v.state.setOpen(!0,it(Yd,ee.nativeEvent)),U||v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"})),V&&v.state.activeIndex!==null&&!U&&v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(ee){if($||O||ee.ctrlKey||ee.shiftKey||ee.altKey||ee.metaKey)return;v.state.keyboardActiveRef.current=!0;const ne=ee.currentTarget,te=ne.scrollWidth-ne.clientWidth,ye=C==="rtl";if(ee.key==="Home"){Rr(ee);const pe=w$&&ye?ne.value.length:0;ne.setSelectionRange(pe,pe),ne.scrollLeft=0;return}if(ee.key==="End"){Rr(ee);const pe=w$&&ye?0:ne.value.length;ne.setSelectionRange(pe,pe),ne.scrollLeft=ye?-te:te;return}if(!H&&ee.key==="Escape"){const pe=D==="multiple"&&Array.isArray(B)?B.length===0:B===null,_e=it(zy,ee.nativeEvent),Se=D==="multiple"?[]:null;v.state.setInputValue("",_e),v.state.setSelectedValue(Se,_e),!pe&&!v.state.inline&&!_e.isPropagationAllowed&&ee.stopPropagation();return}if(S&&ee.key==="Backspace"&&ne.value===""&&S.highlightedChipIndex===void 0&&Array.isArray(B)&&B.length>0){const pe=B.slice(0,-1);v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"}),v.state.setSelectedValue(pe,it(Dr,ee.nativeEvent));return}const Ee=G(ee);if(S?.setHighlightedChipIndex(Ee),Ee!==void 0?S?.chipsRef.current[Ee]?.focus():v.state.inputRef.current?.focus(),ee.which!==229&&ee.key==="Enter"&&V){const pe=v.state.activeIndex,_e=ee.nativeEvent;if(pe===null){v.state.setOpen(!1,it(Dr,_e));return}Rr(ee);const Se=v.state.listRef.current[pe];Se&&(v.state.selectionEventRef.current=_e,Se.click(),v.state.selectionEventRef.current=null)}},onPointerMove(){v.state.keyboardActiveRef.current=!1},onPointerDown(){v.state.keyboardActiveRef.current=!1}},m?m.getValidationProps(o):o],stateAttributesMapping:QEe})}),eSe={...ss,...zx},tSe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,keepMounted:o=!1,...l}=t,{disabled:u}=Bs(),f=Nu(),d=Ye(f,mt.selectionMode),p=Ye(f,mt.disabled),m=Ye(f,mt.readOnly),E=Ye(f,mt.open),S=Ye(f,mt.selectedValue),g=AM();let y=!1;d==="none"?y=g!=="":d==="single"?y=S!=null:y=Array.isArray(S)&&S.length>0;const v=u||p||a,{buttonRef:x,getButtonProps:T}=sa({native:s,disabled:v}),{mounted:w,transitionStatus:C,setMounted:R}=To(y),O=k.useMemo(()=>({disabled:v,open:E,transitionStatus:C}),[v,E,C]);Oi({open:y,ref:f.state.clearRef,onComplete(){y||R(!1)}});const N=xt("button",t,{state:O,ref:[n,x,f.state.clearRef],props:[{tabIndex:-1,children:"x",disabled:v,"aria-readonly":m||void 0,onMouseDown(L){L.preventDefault()},onClick(L){if(v||m)return;const z=f.state.keyboardActiveRef;f.state.setInputValue("",it(N$,L.nativeEvent)),d!=="none"?(f.state.setSelectedValue(Array.isArray(S)?[]:null,it(N$,L.nativeEvent)),f.state.setIndices({activeIndex:null,selectedIndex:null,type:z.current?"keyboard":"pointer"})):f.state.setIndices({activeIndex:null,type:z.current?"keyboard":"pointer"}),f.state.inputRef.current?.focus()}},l,T],stateAttributesMapping:eSe});return o||w?N:null}),nSe=k.createContext(null);function rSe(){return k.useContext(nSe)}function iSe(e){const{children:t}=e,{filteredItems:n}=Yf(),r=rSe(),i=r?r.items:n;return i?b.jsx(k.Fragment,{children:i.map(t)}):null}const aSe=k.forwardRef(function(t,n){var r;const{render:i,className:a,children:s,...o}=t,l=Nu(),u=Jx(),f=!!kM(!0),{filteredItems:d}=Yf(),p=Ye(l,mt.items),m=Ye(l,mt.labelsRef),E=Ye(l,mt.listRef),S=Ye(l,mt.selectionMode),g=Ye(l,mt.grid),y=Ye(l,mt.popupProps),v=Ye(l,mt.disabled),x=Ye(l,mt.readOnly),T=Ye(l,mt.virtualized),w=S==="multiple",C=d.length===0,R=Xe(M=>{l.set("positionerElement",M)}),O=Xe(M=>{l.set("listElement",M)}),N=k.useMemo(()=>typeof s=="function"?r||(r=b.jsx(iSe,{children:s})):s,[s]),D=k.useMemo(()=>({empty:C}),[C]),L=u.useState("floatingId"),z=xt("div",t,{state:D,ref:[n,O,f?null:R],props:[y,{children:N,tabIndex:-1,id:L,role:g?"grid":"listbox","aria-multiselectable":w?"true":void 0,onKeyDown(M){if(!(v||x)&&M.key==="Enter"){const V=l.state.activeIndex;if(V==null)return;Rr(M);const H=M.nativeEvent,B=l.state.listRef.current[V];B&&(l.state.selectionEventRef.current=H,B.click(),l.state.selectionEventRef.current=null)}},onKeyDownCapture(){l.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){l.state.keyboardActiveRef.current=!1}},o]});return T?z:b.jsx(Vy,{elementsRef:E,labelsRef:p?void 0:m,children:z})}),une=k.createContext(void 0);function sSe(){const e=k.useContext(une);if(e===void 0)throw new Error(an(20));return e}const oSe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,a=Nu(),s=Ye(a,mt.mounted),o=Ye(a,mt.forceMounted);return s||r||o?b.jsx(une.Provider,{value:r,children:b.jsx(Hy,{ref:n,...i})}):null}),lSe=k.forwardRef(function(t,n){const{render:r,className:i,anchor:a,positionMethod:s="absolute",side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:E=!1,disableAnchorTracking:S=!1,collisionAvoidance:g=Nx,...y}=t,v=Nu(),{filteredItems:x}=Yf(),T=Jx(),w=sSe(),C=Ye(v,mt.modal),R=Ye(v,mt.open),O=Ye(v,mt.mounted),N=Ye(v,mt.openMethod),D=Ye(v,mt.triggerElement),L=Ye(v,mt.inputElement),z=Ye(v,mt.inputInsidePopup),M=x.length===0,H=Ky({anchor:a??(z?D:L),floatingRootContext:T,positionMethod:s,mounted:O,side:o,sideOffset:u,align:l,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:E,disableAnchorTracking:S,keepMounted:w,collisionAvoidance:g,lazyFlip:!0});Yx(R&&C&&N!=="touch",D);const B=k.useMemo(()=>{const $={...H.positionerStyles};return R||($.pointerEvents="none"),{role:"presentation",hidden:!O,style:$}},[R,O,H.positionerStyles]),q=k.useMemo(()=>({open:R,side:H.side,align:H.align,anchorHidden:H.anchorHidden,empty:M}),[R,H.side,H.align,H.anchorHidden,M]);Je(()=>{v.set("popupSide",H.side)},[v,H.side]);const K=k.useMemo(()=>({side:H.side,align:H.align,arrowRef:H.arrowRef,arrowUncentered:H.arrowUncentered,arrowStyles:H.arrowStyles,anchorHidden:H.anchorHidden,isPositioned:H.isPositioned}),[H.side,H.align,H.arrowRef,H.arrowUncentered,H.arrowStyles,H.anchorHidden,H.isPositioned]),U=Xe($=>{v.set("positionerElement",$)}),j=xt("div",t,{state:q,ref:[n,U],props:[B,y],stateAttributesMapping:Oa});return b.jsxs(lne.Provider,{value:K,children:[O&&C&&b.jsx(Kx,{inert:Dm(!R),cutout:L??D}),j]})}),uSe={...Oa,...ss},cSe=k.forwardRef(function(t,n){const{render:r,className:i,initialFocus:a,finalFocus:s,...o}=t,l=Nu(),u=kM(),f=Jx(),{filteredItems:d}=Yf(),p=Ye(l,mt.mounted),m=Ye(l,mt.open),E=Ye(l,mt.openMethod),S=Ye(l,mt.transitionStatus),g=Ye(l,mt.inputInsidePopup),y=Ye(l,mt.inputElement),v=d.length===0;Oi({open:m,ref:l.state.popupRef,onComplete(){m&&l.state.onOpenChangeComplete(!0)}});const x=k.useMemo(()=>({open:m,side:u.side,align:u.align,anchorHidden:u.anchorHidden,transitionStatus:S,empty:v}),[m,u.side,u.align,u.anchorHidden,S,v]),T=xt("div",t,{state:x,ref:[n,l.state.popupRef],props:[{role:g?"dialog":"presentation",tabIndex:-1,onFocus(O){const N=_r(O.nativeEvent);E!=="touch"&&(Tt(l.state.listElement,N)||N===O.currentTarget)&&l.state.inputRef.current?.focus()}},Pm(S),o],stateAttributesMapping:uSe}),C=a===void 0?g?O=>O==="touch"?l.state.popupRef.current:y:!1:a;let R;return s!=null?R=s:R=g?void 0:!1,b.jsx(Lx,{context:f,disabled:!p,modal:!g,openInteractionType:E,initialFocus:C,returnFocus:R,children:T})}),cne=k.createContext(void 0);function dne(){const e=k.useContext(cne);if(!e)throw new Error(an(19));return e}const dSe=k.createContext(!1);function fSe(){return k.useContext(dSe)}const hSe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a=null,index:s,disabled:o=!1,nativeButton:l=!1,...u}=t,f=k.useRef(!1),d=k.useRef(null),p=Lm({index:s,textRef:d,indexGuessBehavior:fM.GuessFromOrder}),m=Nu(),E=fSe(),{flatFilteredItems:S}=Yf(),g=Ye(m,mt.open),y=Ye(m,mt.selectionMode),v=Ye(m,mt.readOnly),x=Ye(m,mt.virtualized),T=Ye(m,mt.isItemEqualToValue),w=y!=="none",C=s??(x?Bp(S,a,T):p.index),R=p.index!==-1,O=Ye(m,mt.id),N=Ye(m,mt.isActive,C),D=Ye(m,mt.isSelected,a),L=Ye(m,mt.items),z=Ye(m,mt.getItemProps),M=k.useRef(null),V=O!=null&&R?`${O}-${C}`:void 0,H=D&&w;Je(()=>{if(!(R&&(x||s!=null)))return;const ae=m.state.listRef.current;return ae[C]=M.current,()=>{delete ae[C]}},[R,x,C,s,m]),Je(()=>{if(!R||L)return;const J=m.state.valuesRef.current;return J[C]=a,y!=="none"&&m.state.allValuesRef.current.push(a),()=>{delete J[C]}},[R,L,C,a,m,y]),Je(()=>{if(!g){f.current=!1;return}if(!R||L)return;const J=m.state.selectedValue,ae=Array.isArray(J)?J[J.length-1]:J;vu(ae,a,T)&&m.set("selectedIndex",C)},[R,L,g,m,C,a,T]);const B=k.useMemo(()=>({disabled:o,selected:H,highlighted:N}),[o,H,N]),q=z({active:N,selected:H});q.id=void 0,q.onFocus=void 0;const{getButtonProps:K,buttonRef:U}=sa({disabled:o,focusableWhenDisabled:!0,native:l});function j(J){function ae(){m.state.handleSelection(J,a)}m.state.submitOnItemClick?(xr.flushSync(ae),m.state.requestSubmit()):ae()}const $={id:V,role:E?"gridcell":"option","aria-disabled":o||void 0,"aria-selected":w?H:void 0,tabIndex:void 0,onPointerDownCapture(J){f.current=!0,J.preventDefault()},onClick(J){o||v||j(J.nativeEvent)},onMouseUp(J){const ae=f.current;f.current=!1,!(o||v||J.button!==0||ae||!N)&&j(J.nativeEvent)}},Y=xt("div",t,{ref:[U,n,p.ref,M],state:B,props:[q,$,u,K]}),W=k.useMemo(()=>({selected:H,textRef:d}),[H,d]);return b.jsx(cne.Provider,{value:W,children:Y})})),pSe=k.forwardRef(function(t,n){const{render:r,className:i,children:a,...s}=t,{filteredItems:o}=Yf(),l=Nu(),u=o.length===0?a:null;return xt("div",t,{ref:[n,l.state.emptyRef],props:[{children:u,role:"status","aria-live":"polite","aria-atomic":!0},s]})});let mz=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});function fne(e){return k.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[mz.checked]:""}:{[mz.unchecked]:""}},...Kf}),[e.indeterminate])}const hne=k.createContext(void 0);function mSe(){const e=k.useContext(hne);if(e===void 0)throw new Error(an(14));return e}const gSe="data-parent",bSe=k.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:a=!1,disabled:s=!1,id:o,indeterminate:l=!1,inputRef:u,name:f,onCheckedChange:d,parent:p=!1,readOnly:m=!1,render:E,required:S=!1,uncheckedValue:g,value:y,nativeButton:v=!1,...x}=t,{clearErrors:T}=Zy(),{disabled:w,name:C,setDirty:R,setFilled:O,setFocused:N,setTouched:D,state:L,validationMode:z,validityData:M,shouldValidateOnChange:V,validation:H}=Bs(),B=nEe(),{labelId:q,controlId:K,setControlId:U,getDescriptionProps:j}=nd(),$=iEe(),Y=$?.parent,W=Y&&$.allValues,J=w||B.disabled||$?.disabled||s,ae=C??f,se=y??ae,Q=mi(),G=mi();let Z=K;W?Z=p?G:`${Y.id}-${se}`:o&&(Z=o);let ee={};W&&(p?ee=$.parent.getParentProps():se&&(ee=$.parent.getChildProps(se)));const ne=Xe(d),{checked:te=r,indeterminate:ye=l,onCheckedChange:Ee,...pe}=ee,_e=$?.value,Se=$?.setValue,Te=$?.defaultValue,de=k.useRef(null),{getButtonProps:Ce,buttonRef:ge}=sa({disabled:J,native:v}),he=$?.validation??H,[ce,Ne]=ts({controlled:se&&_e&&!p?_e.includes(se):te,default:se&&Te&&!p?Te.includes(se):a,name:"Checkbox",state:"checked"});Je(()=>{if(U!==yr)return U(Z),()=>{U(void 0)}},[Z,$,U,p]),Qy({enabled:!$,id:Q,commit:he.commit,value:ce,controlRef:de,name:ae,getValue:()=>ce});const Pe=k.useRef(null),ve=Fs(u,Pe,he.inputRef);Je(()=>{Pe.current&&(Pe.current.indeterminate=ye,ce&&O(!0))},[ce,ye,O]),ef(ce,()=>{$&&!p||(T(ae),O(ce),R(ce!==M.initialValue),V()?he.commit(ce):he.commit(ce,!0))});const Le=ol({checked:ce,disabled:J,name:p?void 0:ae,id:Z??void 0,required:S,ref:ve,style:Rm,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(ot){if(ot.nativeEvent.defaultPrevented)return;const Fe=ot.target.checked,ht=it(Dr,ot.nativeEvent);if(Ee?.(Fe,ht),ne(Fe,ht),!ht.isCanceled&&(Ne(Fe),se&&_e&&Se&&!p)){const Ie=Fe?[..._e,se]:_e.filter(ze=>ze!==se);Se(Ie,ht)}},onFocus(){de.current?.focus()}},y!==void 0?{value:($?ce&&y:y)||""}:Jn,j,$?he.getValidationProps:he.getInputValidationProps),Ae=W?!!te:ce,Ve=W&&ye||l;k.useEffect(()=>{Y&&se&&Y.disabledStatesRef.current.set(se,J)},[Y,J,se]);const Ze=k.useMemo(()=>({...L,checked:Ae,disabled:J,readOnly:m,required:S,indeterminate:Ve}),[L,Ae,J,m,S,Ve]),gt=fne(Ze),st=xt("span",t,{state:Ze,ref:[ge,de,n,$?.registerControlRef],props:[{id:Q,role:"checkbox","aria-checked":ye?"mixed":ce,"aria-readonly":m||void 0,"aria-required":S||void 0,"aria-labelledby":q,[gSe]:p?"":void 0,onFocus(){N(!0)},onBlur(){const ot=Pe.current;ot&&(D(!0),N(!1),z==="onBlur"&&he.commit($?_e:ot.checked))},onClick(ot){m||J||(ot.preventDefault(),Pe.current?.click())}},j,he.getValidationProps,x,pe,Ce],stateAttributesMapping:gt});return b.jsxs(hne.Provider,{value:Ze,children:[st,!ce&&!$&&ae&&!p&&g!==void 0&&b.jsx("input",{type:"hidden",name:ae,value:g}),b.jsx("input",{...Le})]})}),vSe=k.forwardRef(function(t,n){const{render:r,className:i,keepMounted:a=!1,...s}=t,o=mSe(),l=o.checked||o.indeterminate,{transitionStatus:u,setMounted:f}=To(l),d=k.useRef(null),p=k.useMemo(()=>({...o,transitionStatus:u}),[o,u]);Oi({open:l,ref:d,onComplete(){l||f(!1)}});const m=fne(o),E=k.useMemo(()=>({...m,...ss,...Kf}),[m]),S=a||l,g=xt("span",t,{enabled:S,ref:[n,d],state:p,stateAttributesMapping:E,props:s});return S?g:null});function ySe(e){const{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,...a}=e;return b.jsx(qEe,{...a,selectionMode:t?"multiple":"single",selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i})}const _Se=k.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=dne();return r||i?b.jsx(ESe,{...t,ref:n}):null}),ESe=k.memo(k.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...a}=e,{selected:s}=dne(),o=k.useRef(null),{transitionStatus:l,setMounted:u}=To(s),f=k.useMemo(()=>({selected:s,transitionStatus:l}),[s,l]),d=xt("span",e,{ref:[t,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:ss});return Oi({open:s,ref:o,onComplete(){s||u(!1)}}),d})),SSe=k.createContext(void 0);function ew(e=!0){const t=k.useContext(SSe);if(t===void 0&&!e)throw new Error(an(25));return t}const pne=k.createContext(void 0);function OM(e){const t=k.useContext(pne);if(t===void 0&&!e)throw new Error(an(33));return t}const mne=k.createContext(void 0);function rd(e){const t=k.useContext(mne);if(t===void 0&&!e)throw new Error(an(36));return t}const gne={type:"regular-item"};function bne(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,nativeButton:s,itemMetadata:o,nodeId:l}=e,u=k.useRef(null),f=ew(!0),d=f!==void 0,{events:p}=a.useState("floatingTreeRoot"),{getButtonProps:m,buttonRef:E}=sa({disabled:n,focusableWhenDisabled:!0,native:s}),S=k.useCallback(y=>ol({id:i,role:"menuitem",tabIndex:r?0:-1,onMouseMove(v){l&&p.emit("itemhover",{nodeId:l,target:v.currentTarget})},onMouseEnter(){o.type==="submenu-trigger"&&o.setActive()},onKeyUp(v){v.key===" "&&a.context.typingRef.current&&v.preventBaseUIHandler()},onClick(v){t&&p.emit("close",{domEvent:v,reason:ff})},onMouseUp(v){if(f){const x=f.initialCursorPointRef.current;if(f.initialCursorPointRef.current=null,d&&x&&Math.abs(v.clientX-x.x)<=1&&Math.abs(v.clientY-x.y)<=1)return}u.current&&a.context.allowMouseUpTriggerRef.current&&(!d||v.button===2)&&o.type==="regular-item"&&u.current.click()}},y,m),[i,r,m,t,p,a,d,f,o,l]),g=Fs(u,E);return k.useMemo(()=>({getItemProps:S,itemRef:g}),[S,g])}let gz=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const vne={checked(e){return e?{[gz.checked]:""}:{[gz.unchecked]:""}},...ss},xSe=k.forwardRef(function(t,n){const{render:r,className:i,id:a,label:s,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!0,...f}=t,d=Lm({label:s}),p=OM(!0),m=mi(a),{store:E}=rd(),S=E.useState("isActive",d.index),g=E.useState("itemProps"),{getItemProps:y,itemRef:v}=bne({closeOnClick:u,disabled:l,highlighted:S,id:m,store:E,nativeButton:o,nodeId:p?.nodeId,itemMetadata:gne}),x=k.useMemo(()=>({disabled:l,highlighted:S}),[l,S]);return xt("div",t,{state:x,props:[g,f,y],ref:[v,n,d.ref]})}),wSe={...Oa,...ss},TSe=k.forwardRef(function(t,n){const{render:r,className:i,finalFocus:a,...s}=t,{store:o}=rd(),{side:l,align:u}=OM(),f=xM()!=null,d=o.useState("open"),p=o.useState("transitionStatus"),m=o.useState("popupProps"),E=o.useState("mounted"),S=o.useState("instantType"),g=o.useState("activeTriggerElement"),y=o.useState("parent"),v=o.useState("lastOpenChangeReason"),x=o.useState("rootId"),T=o.useState("floatingRootContext"),w=o.useState("floatingTreeRoot"),C=o.useState("closeDelay"),R=o.useState("activeTriggerElement");Oi({open:d,ref:o.context.popupRef,onComplete(){d&&o.context.onOpenChangeComplete?.(!0)}}),k.useEffect(()=>{function M(V){o.setOpen(!1,it(V.reason,V.domEvent))}return w.events.on("close",M),()=>{w.events.off("close",M)}},[w.events,o]);const O=o.useState("hoverEnabled"),N=o.useState("disabled");Hee(T,{enabled:O&&!N&&y.type!=="context-menu"&&y.type!=="menubar",closeDelay:C});const D=k.useMemo(()=>({transitionStatus:p,side:l,align:u,open:d,nested:y.type==="menu",instant:S}),[p,l,u,d,y.type,S]),L=xt("div",t,{state:D,ref:[n,o.context.popupRef],stateAttributesMapping:wSe,props:[m,{onKeyDown(M){f&&dM.has(M.key)&&M.stopPropagation()}},Pm(p),s,{"data-rootownerid":x}]});let z=y.type===void 0||y.type==="context-menu";return(g||y.type==="menubar"&&v!==Dx)&&(z=!0),b.jsx(Lx,{context:T,modal:!1,disabled:!E,returnFocus:a===void 0?z:a,initialFocus:y.type!=="menu",restoreFocus:!0,externalTree:y.type!=="menubar"?w:void 0,previousFocusableElement:R,nextFocusableElement:y.type===void 0?o.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:y.type===void 0?o.context.beforeContentFocusGuardRef:void 0,children:L})}),yne=k.createContext(void 0);function CSe(){const e=k.useContext(yne);if(e===void 0)throw new Error(an(32));return e}const ASe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:a}=rd();return a.useState("mounted")||r?b.jsx(yne.Provider,{value:r,children:b.jsx(Hy,{ref:n,...i})}):null}),kSe=k.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o,align:l,sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:E=!1,disableAnchorTracking:S=!1,collisionAvoidance:g=Nx,...y}=t,{store:v}=rd(),x=CSe(),T=ew(!0),w=v.useState("parent"),C=v.useState("floatingRootContext"),R=v.useState("floatingTreeRoot"),O=v.useState("mounted"),N=v.useState("open"),D=v.useState("modal"),L=v.useState("activeTriggerElement"),z=v.useState("lastOpenChangeReason"),M=v.useState("floatingNodeId"),V=v.useState("floatingParentNodeId");let H=r,B=u,q=f,K=l,U=g;w.type==="context-menu"&&(H=r??w.context?.anchor,K=K??"start",!o&&K!=="center"&&(q=t.alignOffset??2,B=t.sideOffset??-5));let j=o,$=K;w.type==="menu"?(j=j??"inline-end",$=$??"start",U=t.collisionAvoidance??FP):w.type==="menubar"&&(j=j??"bottom",$=$??"start");const Y=w.type==="context-menu",W=Ky({anchor:H,floatingRootContext:C,positionMethod:T?"fixed":i,mounted:O,side:j,sideOffset:B,align:$,alignOffset:q,arrowPadding:Y?0:m,collisionBoundary:d,collisionPadding:p,sticky:E,nodeId:M,keepMounted:x,disableAnchorTracking:S,collisionAvoidance:U,shiftCrossAxis:Y,externalTree:R}),J=k.useMemo(()=>{const ee={};return N||(ee.pointerEvents="none"),{role:"presentation",hidden:!O,style:{...W.positionerStyles,...ee}}},[N,O,W.positionerStyles]);k.useEffect(()=>{function ee(ne){ne.open?(ne.parentNodeId===M&&v.set("hoverEnabled",!1),ne.nodeId!==M&&ne.parentNodeId===v.select("floatingParentNodeId")&&v.setOpen(!1,it(Ib))):ne.parentNodeId===M&&ne.reason!==Ib&&v.set("hoverEnabled",!0)}return R.events.on("menuopenchange",ee),()=>{R.events.off("menuopenchange",ee)}},[v,R.events,M]),k.useEffect(()=>{if(v.select("floatingParentNodeId")==null)return;function ee(ne){if(ne.open||ne.nodeId!==v.select("floatingParentNodeId"))return;const te=ne.reason??Ib;v.setOpen(!1,it(te))}return R.events.on("menuopenchange",ee),()=>{R.events.off("menuopenchange",ee)}},[R.events,v]),k.useEffect(()=>{function ee(ne){!N||ne.nodeId!==v.select("floatingParentNodeId")||ne.target&&L&&L!==ne.target&&v.setOpen(!1,it(Ib))}return R.events.on("itemhover",ee),()=>{R.events.off("itemhover",ee)}},[R.events,N,L,v]),k.useEffect(()=>{const ee={open:N,nodeId:M,parentNodeId:V,reason:v.select("lastOpenChangeReason")};R.events.emit("menuopenchange",ee)},[R.events,N,v,M,V]);const ae=k.useMemo(()=>({open:N,side:W.side,align:W.align,anchorHidden:W.anchorHidden,nested:w.type==="menu"}),[N,W.side,W.align,W.anchorHidden,w.type]),se=k.useMemo(()=>({side:W.side,align:W.align,arrowRef:W.arrowRef,arrowUncentered:W.arrowUncentered,arrowStyles:W.arrowStyles,nodeId:W.context.nodeId}),[W.side,W.align,W.arrowRef,W.arrowUncentered,W.arrowStyles,W.context.nodeId]),Q=xt("div",t,{state:ae,stateAttributesMapping:Oa,ref:[n,v.useStateSetter("positionerElement")],props:[J,y]}),G=O&&w.type!=="menu"&&(w.type!=="menubar"&&D&&z!==dr||w.type==="menubar"&&w.context.modal);let Z=null;return w.type==="menubar"?Z=w.context.contentElement:w.type===void 0&&(Z=L),b.jsxs(pne.Provider,{value:se,children:[G&&b.jsx(Kx,{ref:w.type==="context-menu"||w.type==="nested-context-menu"?w.context.internalBackdropRef:null,inert:Dm(!N),cutout:Z}),b.jsx(xee,{id:M,children:b.jsx(Vy,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:Q})})]})}),_ne=k.createContext(void 0);function OSe(){const e=k.useContext(_ne);if(e===void 0)throw new Error(an(34));return e}const RSe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a,defaultValue:s,onValueChange:o,disabled:l=!1,...u}=t,[f,d]=ts({controlled:a,default:s,name:"MenuRadioGroup"}),p=Xe(o),m=Xe((y,v)=>{p?.(y,v),!v.isCanceled&&d(y)}),E=k.useMemo(()=>({disabled:l}),[l]),S=xt("div",t,{state:E,ref:n,props:{role:"group","aria-disabled":l||void 0,...u}}),g=k.useMemo(()=>({value:f,setValue:m,disabled:l}),[f,m,l]);return b.jsx(_ne.Provider,{value:g,children:S})})),Ene=k.createContext(void 0);function NSe(){const e=k.useContext(Ene);if(e===void 0)throw new Error(an(35));return e}const ISe=k.forwardRef(function(t,n){const{render:r,className:i,id:a,label:s,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!1,value:f,...d}=t,p=Lm({label:s}),m=OM(!0),E=mi(a),{store:S}=rd(),g=S.useState("isActive",p.index),y=S.useState("itemProps"),{value:v,setValue:x,disabled:T}=OSe(),w=T||l,C=v===f,{getItemProps:R,itemRef:O}=bne({closeOnClick:u,disabled:w,highlighted:g,id:E,store:S,nativeButton:o,nodeId:m?.nodeId,itemMetadata:gne}),N=k.useMemo(()=>({disabled:w,highlighted:g,checked:C}),[w,g,C]),D=Xe(z=>{const M={...it(ff,z.nativeEvent),preventUnmountOnClose:()=>{}};x(f,M)}),L=xt("div",t,{state:N,stateAttributesMapping:vne,props:[y,{role:"menuitemradio","aria-checked":C,onClick:D},d,R],ref:[O,n,p.ref]});return b.jsx(Ene.Provider,{value:N,children:L})}),DSe=k.forwardRef(function(t,n){const{render:r,className:i,keepMounted:a=!1,...s}=t,o=NSe(),l=k.useRef(null),{transitionStatus:u,setMounted:f}=To(o.checked);Oi({open:o.checked,ref:l,onComplete(){o.checked||f(!1)}});const d=k.useMemo(()=>({checked:o.checked,disabled:o.disabled,highlighted:o.highlighted,transitionStatus:u}),[o.checked,o.disabled,o.highlighted,u]);return xt("span",t,{state:d,stateAttributesMapping:vne,ref:[n,l],props:{"aria-hidden":!0,...s},enabled:a||o.checked})}),LSe=k.createContext(null);function Sne(e){return k.useContext(LSe)}const PSe={...sM,disabled:Ue(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Ue(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:Ue(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:Ue(e=>e.stickIfOpen),parent:Ue(e=>e.parent),rootId:Ue(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Ue(e=>e.activeIndex),isActive:Ue((e,t)=>e.activeIndex===t),hoverEnabled:Ue(e=>e.hoverEnabled),instantType:Ue(e=>e.instantType),lastOpenChangeReason:Ue(e=>e.openChangeReason),floatingTreeRoot:Ue(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Ue(e=>e.floatingNodeId),floatingParentNodeId:Ue(e=>e.floatingParentNodeId),itemProps:Ue(e=>e.itemProps),closeDelay:Ue(e=>e.closeDelay),keyboardEventRelay:Ue(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class RM extends Mx{constructor(t){super({...MSe(),...t},{positionerRef:k.createRef(),popupRef:k.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:k.createRef(),beforeContentFocusGuardRef:k.createRef(),onOpenChangeComplete:void 0,triggerElements:new Wy},PSe),this.observe(Ue(n=>n.allowMouseEnter),(n,r)=>{this.state.parent.type==="menu"&&n!==r&&this.state.parent.store.set("allowMouseEnter",n)}),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){this.unsubscribeParentListener=n.store.subscribe(()=>{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})}static useStore(t,n){return pi(()=>t??new RM(n)).current}unsubscribeParentListener=null}function MSe(){return{...aM(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new YP,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Jn,keyboardEventRelay:void 0,closeDelay:0}}const jSe=k.createContext(void 0);function FSe(){return k.useContext(jSe)}function BSe(e){const{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:s=!1,modal:o,loopFocus:l=!0,orientation:u="vertical",actionsRef:f,closeParentOnEsc:d=!1,handle:p,triggerId:m,defaultTriggerId:E=null,highlightItemOnHover:S=!0}=e,g=ew(!0),y=rd(!0),v=Sne(),x=FSe(),T=k.useMemo(()=>x&&y?{type:"menu",store:y.store}:v?{type:"menubar",context:v}:g&&!y?{type:"context-menu",context:g}:{type:void 0},[g,y,v,x]),w=RM.useStore(p?.store,{parent:T}),C=w.useState("floatingTreeRoot"),R=XP(C),O=xo();Je(()=>{g&&!y?w.update({parent:{type:"context-menu",context:g},floatingNodeId:R,floatingParentNodeId:O}):y&&w.update({floatingNodeId:R,floatingParentNodeId:O})},[g,y,R,O,w]),w.useControlledProp("open",n,a),w.useControlledProp("activeTriggerId",m,E),w.useContextCallback("onOpenChangeComplete",i);const N=w.useState("open"),D=w.useState("activeTriggerElement"),L=w.useState("positionerElement"),z=w.useState("hoverEnabled"),M=w.useState("modal"),V=w.useState("disabled"),H=w.useState("lastOpenChangeReason"),B=w.useState("parent"),q=w.useState("activeIndex"),K=w.useState("payload"),U=w.useState("floatingParentNodeId"),j=k.useRef(null),$=U!=null;let Y;w.useSyncedValues({disabled:s,modal:B.type===void 0?o:void 0,rootId:Qc()});const{openMethod:W,triggerProps:J,reset:ae}=Xx(N);rM(w);const{forceUnmount:se}=iM(N,w,()=>{w.update({allowMouseEnter:!1,stickIfOpen:!0}),ae()}),Q=k.useRef(B.type!=="context-menu"),G=Pn();k.useEffect(()=>{if(N||(j.current=null),B.type==="context-menu"){if(!N){G.clear(),Q.current=!1;return}G.start(500,()=>{Q.current=!0})}},[G,N,B.type]),Yx(N&&M&&H!==dr&&W!=="touch",L),Je(()=>{!N&&!z&&w.set("hoverEnabled",!0)},[N,z,w]);const Z=k.useRef(!0),ee=Pn(),ne=Xe((Fe,ht)=>{const Ie=ht.reason;if(N===Fe&&ht.trigger===D||(ht.preventUnmountOnClose=()=>{w.set("preventUnmountingOnClose",!0)},!Fe&&ht.trigger==null&&(ht.trigger=D??void 0),r?.(Fe,ht),ht.isCanceled))return;const ze={open:Fe,nativeEvent:ht.event,reason:ht.reason,nested:$};Y?.emit("openchange",ze);const et=ht.event;if(Fe===!1&&et?.type==="click"&&et.pointerType==="touch"&&!Z.current)return;if(!Fe&&q!==null){const Bt=w.context.itemDomElements.current[q];queueMicrotask(()=>{Bt?.setAttribute("tabindex","-1")})}Fe&&Ie===Sv?(Z.current=!1,ee.start(300,()=>{Z.current=!0})):(Z.current=!0,ee.clear());const lt=(Ie===au||Ie===ff)&&et.detail===0&&et?.isTrusted,pt=!Fe&&(Ie===zy||Ie==null);function bn(){const Bt={open:Fe,openChangeReason:Ie};j.current=ht.event??null;const It=ht.trigger?.id??null;(It||Fe)&&(Bt.activeTriggerId=It,Bt.activeTriggerElement=ht.trigger??null),w.update(Bt)}Ie===dr?xr.flushSync(bn):bn(),B.type==="menubar"&&(Ie===Sv||Ie===ho||Ie===dr||Ie===vp||Ie===Ib)?w.set("instantType","group"):lt||pt?w.set("instantType",lt?"click":"dismiss"):w.set("instantType",void 0)}),te=k.useCallback(Fe=>{const ht=it(Fe);return ht.preventUnmountOnClose=()=>{w.set("preventUnmountingOnClose",!0)},ht},[w]),ye=k.useCallback(()=>{w.setOpen(!1,te(ZP))},[w,te]);k.useImperativeHandle(f,()=>({unmount:se,close:ye}),[se,ye]);let Ee;B.type==="context-menu"&&(Ee=B.context),k.useImperativeHandle(Ee?.positionerRef,()=>L,[L]),k.useImperativeHandle(Ee?.actionsRef,()=>({setOpen:ne}),[ne]);const pe=oM({popupStore:w,onOpenChange:ne});Y=pe.context.events,k.useEffect(()=>{const Fe=({open:ht,eventDetails:Ie})=>ne(ht,Ie);return Y.on("setOpen",Fe),()=>{Y?.off("setOpen",Fe)}},[Y,ne]);const _e=Im(pe,{enabled:!V,bubbles:d&&B.type==="menu",outsidePress(){return B.type!=="context-menu"||j.current?.type==="contextmenu"?!0:Q.current},externalTree:$?C:void 0}),Se=Vee(pe,{role:"menu"}),Te=Ou(),de=k.useCallback(Fe=>{w.select("activeIndex")!==Fe&&w.set("activeIndex",Fe)},[w]),Ce=lM(pe,{enabled:!V,listRef:w.context.itemDomElements,activeIndex:q,nested:B.type!==void 0,loopFocus:l,orientation:u,parentOrientation:B.type==="menubar"?B.context.orientation:void 0,rtl:Te==="rtl",disabledIndices:ta,onNavigate:de,openOnArrowKeyDown:B.type!=="context-menu",externalTree:$?C:void 0,focusItemOnHover:S}),ge=k.useCallback(Fe=>{w.context.typingRef.current=Fe},[w]),he=uM(pe,{listRef:w.context.itemLabels,activeIndex:q,resetMs:mbe,onMatch:Fe=>{N&&Fe!==q&&w.set("activeIndex",Fe)},onTypingChange:ge}),{getReferenceProps:ce,getFloatingProps:Ne,getItemProps:Pe,getTriggerProps:ve}=Jc([_e,Se,Ce,he]),Le=k.useMemo(()=>{const Fe=ol(ce(),{onMouseEnter(){w.set("hoverEnabled",!0)},onMouseMove(){w.set("allowMouseEnter",!0)}},J);return delete Fe.role,Fe},[ce,w,J]),Ae=k.useMemo(()=>{const Fe=ve();if(!Fe)return Fe;const ht=ol(Fe,J);return delete ht.role,delete ht["aria-controls"],ht},[ve,J]),Ve=su(),Ze=k.useMemo(()=>Ne({onMouseEnter(){B.type==="menu"&&Ve.request(()=>w.set("hoverEnabled",!1))},onMouseMove(){w.set("allowMouseEnter",!0)},onClick(){w.select("hoverEnabled")&&w.set("hoverEnabled",!1)},onKeyDown(Fe){const ht=w.select("keyboardEventRelay");ht&&!Fe.isPropagationStopped()&&ht(Fe)}}),[Ne,B.type,Ve,w]),gt=k.useMemo(()=>Pe(),[Pe]);w.useSyncedValues({floatingRootContext:pe,activeTriggerProps:Le,inactiveTriggerProps:Ae,popupProps:Ze,itemProps:gt});const st=k.useMemo(()=>({store:w,parent:T}),[w,T]),ot=b.jsx(mne.Provider,{value:st,children:typeof t=="function"?t({payload:K}):t});return B.type===void 0||B.type==="context-menu"?b.jsx(wee,{externalTree:C,children:ot}):ot}function xne(e){if(Qn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!Yo(e))return xne(sl(e))}function USe(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,i=k.useRef(!1);return k.useMemo(()=>t?{onMouseDown:a=>{(n==="open"&&!r||n==="close"&&r)&&(i.current=!0,ki(a.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:a=>{i.current&&(i.current=!1,a.preventBaseUIHandler())}}:Jn,[t,n,r])}const x_=2,$Se=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,id:o,openOnHover:l,delay:u=100,closeDelay:f=0,handle:d,payload:p,...m}=t,E=rd(!0),S=d?.store??E?.store;if(!S)throw new Error(an(85));const g=mi(o),y=S.useState("isTriggerActive",g),v=S.useState("floatingRootContext"),x=S.useState("isOpenedByTrigger",g),T=k.useRef(null),w=HSe(),C=MP(!0),R=wo(),O=k.useMemo(()=>R??new YP,[R]),N=XP(O),D=xo(),{registerTrigger:L,isMountedByThisTrigger:z}=nM(g,T,S,{payload:p,closeDelay:f,parent:w,floatingTreeRoot:O,floatingNodeId:N,floatingParentNodeId:D,keyboardEventRelay:C?.relayKeyboardEvent}),M=S.useState("disabled"),V=a||M||w.type==="menubar"&&w.context.disabled,{getButtonProps:H,buttonRef:B}=sa({disabled:V,native:s});k.useEffect(()=>{!x&&w.type===void 0&&(S.context.allowMouseUpTriggerRef.current=!1)},[S,x,w.type]);const q=k.useRef(null),K=Pn(),U=Xe(Se=>{if(!q.current)return;K.clear(),S.context.allowMouseUpTriggerRef.current=!1;const Te=Se.target;if(Tt(q.current,Te)||Tt(S.select("positionerElement"),Te)||Te===q.current||Te!=null&&xne(Te)===S.select("rootId"))return;const de=EM(q.current);Se.clientX>=de.left-x_&&Se.clientX<=de.right+x_&&Se.clientY>=de.top-x_&&Se.clientY<=de.bottom+x_||O.events.emit("close",{domEvent:Se,reason:Tee})});k.useEffect(()=>{x&&S.select("lastOpenChangeReason")===dr&&ki(q.current).addEventListener("mouseup",U,{once:!0})},[x,U,S]);const j=w.type==="menubar"&&w.context.hasSubmenuOpen,Y=Wee(v,{enabled:(l??j??!1)&&!V&&w.type!=="context-menu"&&(w.type!=="menubar"||j&&!z),handleClose:cM({blockPointerEvents:w.type!=="menubar"}),mouseOnly:!0,move:!1,restMs:w.type===void 0?u:void 0,delay:{close:f},triggerElementRef:T,externalTree:O,isActiveTrigger:y}),W=zSe(x,S.select("lastOpenChangeReason")),J=Nm(v,{enabled:!V&&w.type!=="context-menu",event:x&&w.type==="menubar"?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0?W:!1}),ae=$ee(v,{enabled:!V&&(w.type!=="menubar"&&x||j)}),se=USe({open:x,enabled:w.type==="menubar",mouseDownAction:"open"}),Q=Jc([J,ae]),G=w.type==="menubar",Z=k.useMemo(()=>({disabled:V,open:x}),[V,x]),ee=S.useState("triggerProps",z),ne=[q,n,B,L,T],te=[Q.getReferenceProps(),Y??Jn,ee,{"aria-haspopup":"menu",id:g,onMouseDown:Se=>{if(S.select("open"))return;K.start(200,()=>{S.context.allowMouseUpTriggerRef.current=!0}),ki(Se.currentTarget).addEventListener("mouseup",U,{once:!0})}},G?{role:"menuitem"}:{},se,m,H],ye=k.useRef(null),Ee=Xe(Se=>{xr.flushSync(()=>{S.setOpen(!1,it(ho,Se.nativeEvent,Se.currentTarget))}),qve(ye.current)?.focus()}),pe=Xe(Se=>{const Te=S.select("positionerElement");if(Te&&oo(Se,Te))S.context.beforeContentFocusGuardRef.current?.focus();else{xr.flushSync(()=>{S.setOpen(!1,it(ho,Se.nativeEvent,Se.currentTarget))});let de=Gve(T.current);for(;de!==null&&Tt(Te,de)||de?.hasAttribute("aria-hidden");){const Ce=de;if(de=$y(de),de===Ce)break}de?.focus()}}),_e=xt("button",t,{enabled:!G,stateAttributesMapping:Mp,state:Z,ref:ne,props:te});return G?b.jsx(Hx,{tag:"button",render:r,className:i,state:Z,refs:ne,props:te,stateAttributesMapping:Mp}):x?b.jsxs(k.Fragment,{children:[b.jsx(ll,{ref:ye,onFocus:Ee},`${g}-pre-focus-guard`),b.jsx(k.Fragment,{children:_e},g),b.jsx(ll,{ref:S.context.triggerFocusTargetRef,onFocus:pe},`${g}-post-focus-guard`)]}):b.jsx(k.Fragment,{children:_e},g)});function zSe(e,t){const n=Pn(),[r,i]=k.useState(!1);return Je(()=>{e&&t==="trigger-hover"?(i(!0),n.start(PJ,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function HSe(){const e=ew(!0),t=rd(!0),n=Sne();return k.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}function Yl(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const WSe=typeof ResizeObserver<"u",VSe=()=>!0;function GSe(e){const{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:a=VSe,onMeasureLayout:s,onMeasureLayoutComplete:o,side:l,direction:u}=e,f=k.useRef(!0),d=tM(t,!0,!1),p=su(),m=k.useRef(null),E=Xe(s),S=Xe(o),g=k.useMemo(()=>{let y=l==="top",v=l==="left";return u==="rtl"?(y=y||l==="inline-end",v=v||l==="inline-end"):(y=y||l==="inline-start",v=v||l==="inline-start"),y?{position:"absolute",[l==="top"?"bottom":"top"]:"0",[v?"right":"left"]:"0"}:Jn},[l,u]);Je(()=>{if(!i||!a()||!WSe){f.current=!0,m.current=null;return}if(!t||!n)return;Object.entries(g).forEach(([N,D])=>{t.style.setProperty(N,D)});const y=new ResizeObserver(N=>{const D=N[0];D&&(m.current===null?m.current={width:Math.ceil(D.borderBoxSize[0].inlineSize),height:Math.ceil(D.borderBoxSize[0].blockSize)}:(m.current.width=Math.ceil(D.borderBoxSize[0].inlineSize),m.current.height=Math.ceil(D.borderBoxSize[0].blockSize)))});y.observe(t),t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto");const v=ub(t,"position","static"),x=ub(t,"transform","none"),T=ub(t,"scale","1"),w=ub(n,"--available-width","max-content"),C=ub(n,"--available-height","max-content");if(E?.(),f.current||m.current===null){n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const N=wv(t);return n.style.setProperty("--positioner-width",`${N.width}px`),n.style.setProperty("--positioner-height",`${N.height}px`),v(),x(),T(),w(),C(),S?.(null,N),f.current=!1,()=>{y.disconnect()}}t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto"),n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const R=wv(t);t.style.setProperty("--popup-width",`${m.current.width}px`),t.style.setProperty("--popup-height",`${m.current.height}px`),v(),x(),w(),C(),S?.(m.current,R),n.style.setProperty("--positioner-width",`${R.width}px`),n.style.setProperty("--positioner-height",`${R.height}px`);const O=new AbortController;return p.request(()=>{t.style.setProperty("--popup-width",`${R.width}px`),t.style.setProperty("--popup-height",`${R.height}px`),d(()=>{t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto")},O.signal)}),()=>{y.disconnect(),O.abort(),p.cancel()}},[r,t,n,d,p,a,i,E,S,g])}function ub(e,t,n){const r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}const qSe=k.forwardRef(function(t,n){const{children:r,container:i,className:a,render:s,...o}=t,{portalNode:l,portalSubtree:u}=Ree({container:i,ref:n,componentProps:t,elementProps:o});return!u&&!l?null:b.jsxs(k.Fragment,{children:[u,l&&xr.createPortal(r,l)]})}),wne=k.createContext(void 0);function tw(){const e=k.useContext(wne);if(e===void 0)throw new Error(an(53));return e}let qE=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});const w_=500,bz=16;function Ns(e,t,n){if(!e)return 0;const r=getComputedStyle(e),i=n==="x"?"Inline":"Block";return n==="x"&&t==="margin"?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}let KSe=(function(e){return e.orientation="data-orientation",e.hovering="data-hovering",e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({}),Kh=(function(e){return e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({});const NM={hasOverflowX:e=>e?{[Kh.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[Kh.hasOverflowY]:""}:null,overflowXStart:e=>e?{[Kh.overflowXStart]:""}:null,overflowXEnd:e=>e?{[Kh.overflowXEnd]:""}:null,overflowYStart:e=>e?{[Kh.overflowYStart]:""}:null,overflowYEnd:e=>e?{[Kh.overflowYEnd]:""}:null,cornerHidden:()=>null},vz={width:0,height:0},YSe={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},XSe=k.forwardRef(function(t,n){const{render:r,className:i,overflowEdgeThreshold:a,...s}=t,[o,l]=k.useState(!1),[u,f]=k.useState(!1),[d,p]=k.useState(!1),[m,E]=k.useState(vz),[S,g]=k.useState(vz),[y,v]=k.useState(!1),[x,T]=k.useState(YSe),w=mi(),C=k.useRef(null),R=k.useRef(null),O=k.useRef(null),N=k.useRef(null),D=k.useRef(null),L=k.useRef(null),z=k.useRef(null),M=k.useRef(!1),V=k.useRef(0),H=k.useRef(0),B=k.useRef(0),q=k.useRef(0),K=k.useRef("vertical"),U=Pn(),j=Pn(),$=k.useRef({x:0,y:0}),[Y,W]=k.useState({scrollbarYHidden:!1,scrollbarXHidden:!1,cornerHidden:!1}),J=ZSe(a),ae=Xe(Ee=>{const pe=Ee.x-$.current.x,_e=Ee.y-$.current.y;$.current=Ee,_e!==0&&(p(!0),U.start(w_,()=>{p(!1)})),pe!==0&&(f(!0),j.start(w_,()=>{f(!1)}))}),se=Xe(Ee=>{Ee.button===0&&(M.current=!0,V.current=Ee.clientY,H.current=Ee.clientX,K.current=Ee.currentTarget.getAttribute(KSe.orientation),R.current&&(B.current=R.current.scrollTop,q.current=R.current.scrollLeft),D.current&&K.current==="vertical"&&D.current.setPointerCapture(Ee.pointerId),L.current&&K.current==="horizontal"&&L.current.setPointerCapture(Ee.pointerId))}),Q=Xe(Ee=>{if(!M.current)return;const pe=Ee.clientY-V.current,_e=Ee.clientX-H.current;if(R.current){const Se=R.current.scrollHeight,Te=R.current.clientHeight,de=R.current.scrollWidth,Ce=R.current.clientWidth;if(D.current&&O.current&&K.current==="vertical"){const ge=Ns(O.current,"padding","y"),he=Ns(D.current,"margin","y"),ce=D.current.offsetHeight,Ne=O.current.offsetHeight-ce-ge-he,Pe=pe/Ne;R.current.scrollTop=B.current+Pe*(Se-Te),Ee.preventDefault(),p(!0),U.start(w_,()=>{p(!1)})}if(L.current&&N.current&&K.current==="horizontal"){const ge=Ns(N.current,"padding","x"),he=Ns(L.current,"margin","x"),ce=L.current.offsetWidth,Ne=N.current.offsetWidth-ce-ge-he,Pe=_e/Ne;R.current.scrollLeft=q.current+Pe*(de-Ce),Ee.preventDefault(),f(!0),j.start(w_,()=>{f(!1)})}}}),G=Xe(Ee=>{M.current=!1,D.current&&K.current==="vertical"&&D.current.releasePointerCapture(Ee.pointerId),L.current&&K.current==="horizontal"&&L.current.releasePointerCapture(Ee.pointerId)});function Z(Ee){const pe=Ee.pointerType==="touch";if(v(pe),!pe){const _e=Tt(C.current,Ee.target);l(_e)}}const ee=k.useMemo(()=>({hasOverflowX:!Y.scrollbarXHidden,hasOverflowY:!Y.scrollbarYHidden,overflowXStart:x.xStart,overflowXEnd:x.xEnd,overflowYStart:x.yStart,overflowYEnd:x.yEnd,cornerHidden:Y.cornerHidden}),[Y.scrollbarXHidden,Y.scrollbarYHidden,Y.cornerHidden,x]),ne={role:"presentation",onPointerEnter:Z,onPointerMove:Z,onPointerDown({pointerType:Ee}){v(Ee==="touch")},onPointerLeave(){l(!1)},style:{position:"relative",[qE.scrollAreaCornerHeight]:`${m.height}px`,[qE.scrollAreaCornerWidth]:`${m.width}px`}},te=xt("div",t,{state:ee,ref:[n,C],props:[ne,s],stateAttributesMapping:NM}),ye=k.useMemo(()=>({handlePointerDown:se,handlePointerMove:Q,handlePointerUp:G,handleScroll:ae,cornerSize:m,setCornerSize:E,thumbSize:S,setThumbSize:g,touchModality:y,cornerRef:z,scrollingX:u,setScrollingX:f,scrollingY:d,setScrollingY:p,hovering:o,setHovering:l,viewportRef:R,rootRef:C,scrollbarYRef:O,scrollbarXRef:N,thumbYRef:D,thumbXRef:L,rootId:w,hiddenState:Y,setHiddenState:W,overflowEdges:x,setOverflowEdges:T,viewportState:ee,overflowEdgeThreshold:J}),[se,Q,G,ae,m,S,y,z,u,f,d,p,o,l,R,C,O,N,D,L,w,Y,x,ee,J]);return b.jsxs(wne.Provider,{value:ye,children:[Iv.element,te]})});function ZSe(e){if(typeof e=="number"){const t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}const QSe=k.createContext(void 0);function JSe(e,t){if(typeof IntersectionObserver>"u")return()=>{};const n=new IntersectionObserver(r=>{r.forEach(i=>{i.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}let Tc=(function(e){return e.scrollAreaOverflowXStart="--scroll-area-overflow-x-start",e.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",e.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",e.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",e})({}),yz=!1;function exe(){yz||$P||(typeof CSS<"u"&&"registerProperty"in CSS&&[Tc.scrollAreaOverflowXStart,Tc.scrollAreaOverflowXEnd,Tc.scrollAreaOverflowYStart,Tc.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),yz=!0)}const txe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{viewportRef:s,scrollbarYRef:o,scrollbarXRef:l,thumbYRef:u,thumbXRef:f,cornerRef:d,setCornerSize:p,setThumbSize:m,rootId:E,setHiddenState:S,hiddenState:g,handleScroll:y,setHovering:v,setOverflowEdges:x,overflowEdges:T,overflowEdgeThreshold:w}=tw(),C=Ou(),R=k.useRef(!0),O=Pn(),N=Pn();function D(){const q=s.current,K=o.current,U=l.current,j=u.current,$=f.current,Y=d.current;if(!q)return;const W=q.scrollHeight,J=q.scrollWidth,ae=q.clientHeight,se=q.clientWidth,Q=q.scrollTop,G=q.scrollLeft;if(W===0||J===0)return;const Z=ae>=W,ee=se>=J,ne=se/J,te=ae/W,ye=Math.max(0,J-se),Ee=Math.max(0,W-ae);let pe=0,_e=0;ee||(C==="rtl"?pe=Yl(-G,0,ye):pe=Yl(G,0,ye),_e=ye-pe);const Se=Z?0:Yl(Q,0,Ee),Te=Z?0:Ee-Se,de=ee?0:se,Ce=Z?0:ae,ge=Ns(U,"padding","x"),he=Ns(K,"padding","y"),ce=Ns($,"margin","x"),Ne=Ns(j,"margin","y"),Pe=de-ge-ce,ve=Ce-he-Ne,Le=U?Math.min(U.offsetWidth,Pe):Pe,Ae=K?Math.min(K.offsetHeight,ve):ve,Ve=Math.max(bz,Le*ne),Ze=Math.max(bz,Ae*te);if(m(ze=>ze.height===Ze&&ze.width===Ve?ze:{width:Ve,height:Ze}),K&&j){const ze=K.offsetHeight-Ze-he-Ne,et=W-ae,lt=et===0?0:Q/et,pt=Math.min(ze,Math.max(0,lt*ze));j.style.transform=`translate3d(0,${pt}px,0)`}if(U&&$){const ze=U.offsetWidth-Ve-ge-ce,et=J-se,lt=et===0?0:G/et,pt=C==="rtl"?Yl(lt*ze,-ze,0):Yl(lt*ze,0,ze);$.style.transform=`translate3d(${pt}px,0,0)`}const gt=Yl(pe,0,ye),st=Yl(_e,0,ye),ot=Yl(Se,0,Ee),Fe=Yl(Te,0,Ee),ht=[[Tc.scrollAreaOverflowXStart,gt],[Tc.scrollAreaOverflowXEnd,st],[Tc.scrollAreaOverflowYStart,ot],[Tc.scrollAreaOverflowYEnd,Fe]];for(const[ze,et]of ht)q.style.setProperty(ze,`${et}px`);if(Y){if(ee||Z)p({width:0,height:0});else if(!ee&&!Z){const ze=K?.offsetWidth||0,et=U?.offsetHeight||0;p({width:ze,height:et})}}S(ze=>{const et=Z||ee;return ze.scrollbarYHidden===Z&&ze.scrollbarXHidden===ee&&ze.cornerHidden===et?ze:{scrollbarYHidden:Z,scrollbarXHidden:ee,cornerHidden:et}});const Ie={xStart:!ee&&gt>w.xStart,xEnd:!ee&&st>w.xEnd,yStart:!Z&&ot>w.yStart,yEnd:!Z&&Fe>w.yEnd};x(ze=>ze.xStart===Ie.xStart&&ze.xEnd===Ie.xEnd&&ze.yStart===Ie.yStart&&ze.yEnd===Ie.yEnd?ze:Ie)}const L=Xe(()=>{xr.flushSync(D)});Je(()=>s.current?(exe(),JSe(s.current,L)):void 0,[L,s]),Je(()=>{queueMicrotask(L)},[L,g,C]),Je(()=>{s.current?.matches(":hover")&&v(!0)},[s,v]),k.useEffect(()=>{const q=s.current;if(typeof ResizeObserver>"u"||!q)return;const K=new ResizeObserver(L);return K.observe(q),N.start(0,()=>{Promise.all(q.getAnimations({subtree:!0}).map(U=>U.finished)).then(L).catch(()=>{})}),()=>{K.disconnect(),N.clear()}},[L,s,N]);function z(){R.current=!1}const M={role:"presentation",...E&&{"data-id":`${E}-viewport`},...(!g.scrollbarXHidden||!g.scrollbarYHidden)&&{tabIndex:0},className:Iv.className,style:{overflow:"scroll"},onScroll(){s.current&&(L(),R.current||y({x:s.current.scrollLeft,y:s.current.scrollTop}),O.start(100,()=>{R.current=!0}))},onWheel:z,onTouchMove:z,onPointerMove:z,onPointerEnter:z,onKeyDown:z},V=k.useMemo(()=>({hasOverflowX:!g.scrollbarXHidden,hasOverflowY:!g.scrollbarYHidden,overflowXStart:T.xStart,overflowXEnd:T.xEnd,overflowYStart:T.yStart,overflowYEnd:T.yEnd,cornerHidden:g.cornerHidden}),[g.scrollbarXHidden,g.scrollbarYHidden,g.cornerHidden,T]),H=xt("div",t,{ref:[n,s],state:V,props:[M,a],stateAttributesMapping:NM}),B=k.useMemo(()=>({computeThumbPosition:L}),[L]);return b.jsx(QSe.Provider,{value:B,children:H})}),Tne=k.createContext(void 0);function nxe(){const e=k.useContext(Tne);if(e===void 0)throw new Error(an(54));return e}let KE=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});const rxe=k.forwardRef(function(t,n){const{render:r,className:i,orientation:a="vertical",keepMounted:s=!1,...o}=t,{hovering:l,scrollingX:u,scrollingY:f,hiddenState:d,overflowEdges:p,scrollbarYRef:m,scrollbarXRef:E,viewportRef:S,thumbYRef:g,thumbXRef:y,handlePointerDown:v,handlePointerUp:x,rootId:T,thumbSize:w}=tw(),C=k.useMemo(()=>({hovering:l,scrolling:{horizontal:u,vertical:f}[a],orientation:a,hasOverflowX:!d.scrollbarXHidden,hasOverflowY:!d.scrollbarYHidden,overflowXStart:p.xStart,overflowXEnd:p.xEnd,overflowYStart:p.yStart,overflowYEnd:p.yEnd,cornerHidden:d.cornerHidden}),[l,u,f,a,d,p]),R=Ou();k.useEffect(()=>{const M=S.current,V=a==="vertical"?m.current:E.current;if(!V)return;function H(B){if(!(!M||!V||B.ctrlKey)){if(B.preventDefault(),a==="vertical"){if(M.scrollTop===0&&B.deltaY<0)return}else if(M.scrollLeft===0&&B.deltaX<0)return;if(a==="vertical"){if(M.scrollTop===M.scrollHeight-M.clientHeight&&B.deltaY>0)return}else if(M.scrollLeft===M.scrollWidth-M.clientWidth&&B.deltaX>0)return;a==="vertical"?M.scrollTop+=B.deltaY:M.scrollLeft+=B.deltaX}}return V.addEventListener("wheel",H,{passive:!1}),()=>{V.removeEventListener("wheel",H)}},[a,E,m,S]);const O={...T&&{"data-id":`${T}-scrollbar`},onPointerDown(M){if(M.button===0&&M.currentTarget===M.target&&S.current){if(g.current&&m.current&&a==="vertical"){const V=Ns(g.current,"margin","y"),H=Ns(m.current,"padding","y"),B=g.current.offsetHeight,q=m.current.getBoundingClientRect(),K=M.clientY-q.top-B/2-H+V/2,U=S.current.scrollHeight,j=S.current.clientHeight,$=m.current.offsetHeight-B-H-V,W=K/$*(U-j);S.current.scrollTop=W}if(y.current&&E.current&&a==="horizontal"){const V=Ns(y.current,"margin","x"),H=Ns(E.current,"padding","x"),B=y.current.offsetWidth,q=E.current.getBoundingClientRect(),K=M.clientX-q.left-B/2-H+V/2,U=S.current.scrollWidth,j=S.current.clientWidth,$=E.current.offsetWidth-B-H-V,Y=K/$;let W;R==="rtl"?(W=(1-Y)*(U-j),S.current.scrollLeft<=0&&(W=-W)):W=Y*(U-j),S.current.scrollLeft=W}v(M)}},onPointerUp:x,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",...a==="vertical"&&{top:0,bottom:`var(${qE.scrollAreaCornerHeight})`,insetInlineEnd:0,[KE.scrollAreaThumbHeight]:`${w.height}px`},...a==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${qE.scrollAreaCornerWidth})`,bottom:0,[KE.scrollAreaThumbWidth]:`${w.width}px`}}},N=xt("div",t,{ref:[n,a==="vertical"?m:E],state:C,props:[O,o],stateAttributesMapping:NM}),D=k.useMemo(()=>({orientation:a}),[a]),L=a==="vertical"?d.scrollbarYHidden:d.scrollbarXHidden;return s||!L?b.jsx(Tne.Provider,{value:D,children:N}):null}),ixe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{thumbYRef:s,thumbXRef:o,handlePointerDown:l,handlePointerMove:u,handlePointerUp:f,setScrollingX:d,setScrollingY:p}=tw(),{orientation:m}=nxe(),E=k.useMemo(()=>({orientation:m}),[m]);return xt("div",t,{ref:[n,m==="vertical"?s:o],state:E,props:[{onPointerDown:l,onPointerMove:u,onPointerUp(g){m==="vertical"&&p(!1),m==="horizontal"&&d(!1),f(g)},style:{...m==="vertical"&&{height:`var(${KE.scrollAreaThumbHeight})`},...m==="horizontal"&&{width:`var(${KE.scrollAreaThumbWidth})`}}},a]})}),axe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{cornerRef:s,cornerSize:o,hiddenState:l}=tw(),u=xt("div",t,{ref:[n,s],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:o.width,height:o.height}},a]});return l.cornerHidden?null:u}),Cne=k.createContext(void 0);function sxe(){const e=k.useContext(Cne);if(e===void 0)throw new Error(an(63));return e}let _z=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Ane={...Kf,checked(e){return e?{[_z.checked]:""}:{[_z.unchecked]:""}}},oxe=k.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:a,id:s,inputRef:o,name:l,nativeButton:u=!1,onCheckedChange:f,readOnly:d=!1,required:p=!1,disabled:m=!1,render:E,uncheckedValue:S,...g}=t,{clearErrors:y}=Zy(),{state:v,setTouched:x,setDirty:T,validityData:w,setFilled:C,setFocused:R,shouldValidateOnChange:O,validationMode:N,disabled:D,name:L,validation:z}=Bs(),{labelId:M}=nd(),V=D||m,H=L??l,B=Xe(f),q=k.useRef(null),K=Fs(q,o,z.inputRef),U=k.useRef(null),j=mi(),$=Qx({id:s,implicit:!1,controlRef:U}),[Y,W]=ts({controlled:r,default:!!a,name:"Switch",state:"checked"});Qy({id:j,commit:z.commit,value:Y,controlRef:U,name:H,getValue:()=>Y}),Je(()=>{q.current&&C(q.current.checked)},[q,C]),ef(Y,()=>{y(H),T(Y!==w.initialValue),C(Y),O()?z.commit(Y):z.commit(Y,!0)});const{getButtonProps:J,buttonRef:ae}=sa({disabled:V,native:u}),se={id:j,role:"switch","aria-checked":Y,"aria-readonly":d||void 0,"aria-labelledby":M,onFocus(){V||R(!0)},onBlur(){const ee=q.current;!ee||V||(x(!0),R(!1),N==="onBlur"&&z.commit(ee.checked))},onClick(ee){d||V||(ee.preventDefault(),q?.current?.click())}},Q=k.useMemo(()=>ol({checked:Y,disabled:V,id:$,name:H,required:p,style:Rm,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:K,onChange(ee){if(ee.nativeEvent.defaultPrevented)return;const ne=ee.target.checked,te=it(Dr,ee.nativeEvent);B?.(ne,te),!te.isCanceled&&W(ne)},onFocus(){U.current?.focus()}},z.getInputValidationProps),[Y,V,K,$,H,B,p,W,z]),G=k.useMemo(()=>({...v,checked:Y,disabled:V,readOnly:d,required:p}),[v,Y,V,d,p]),Z=xt("span",t,{state:G,ref:[n,U,ae],props:[se,z.getValidationProps,g,J],stateAttributesMapping:Ane});return b.jsxs(Cne.Provider,{value:G,children:[Z,!Y&&H&&S!==void 0&&b.jsx("input",{type:"hidden",name:H,value:S}),b.jsx("input",{...Q})]})}),lxe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{state:s}=Bs(),o=sxe(),l={...s,...o};return xt("span",t,{state:l,ref:n,stateAttributesMapping:Ane,props:a})}),kne=k.createContext(void 0);function uxe(e=!0){const t=k.useContext(kne);if(t===void 0&&!e)throw new Error(an(7));return t}const cxe=k.forwardRef(function(t,n){const{className:r,defaultPressed:i=!1,disabled:a=!1,form:s,onPressedChange:o,pressed:l,render:u,type:f,value:d,nativeButton:p=!0,...m}=t,E=mi(d||void 0),S=uxe(),g=S?.value??[],y=S?void 0:i,v=(a||S?.disabled)??!1,[x,T]=ts({controlled:S?g?.indexOf(E)>-1:l,default:y,name:"Toggle",state:"pressed"}),w=Xe((z,M)=>{E&&S?.setGroupValue?.(E,z,M),o?.(z,M)}),{getButtonProps:C,buttonRef:R}=sa({disabled:v,native:p}),O=k.useMemo(()=>({disabled:v,pressed:x}),[v,x]),N=[R,n],D=[{"aria-pressed":x,onClick(z){const M=!x,V=it(Dr,z.nativeEvent);w(M,V),!V.isCanceled&&T(M)}},m,C],L=xt("button",t,{enabled:!S,state:O,ref:N,props:D});return S?b.jsx(Hx,{tag:"button",render:u,className:r,state:O,refs:N,props:D}):L});let dxe=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const Ez={multiple(e){return e?{[dxe.multiple]:""}:null}},fxe=k.forwardRef(function(t,n){const{defaultValue:r,disabled:i=!1,loopFocus:a=!0,onValueChange:s,orientation:o="horizontal",multiple:l=!1,value:u,className:f,render:d,...p}=t,m=xM(),E=k.useMemo(()=>{if(u===void 0)return r??[]},[u,r]),S=(m?.disabled??!1)||i,[g,y]=ts({controlled:u,default:E,name:"ToggleGroup",state:"value"}),v=Xe((R,O,N)=>{let D;if(l?(D=g.slice(),O?D.push(R):D.splice(g.indexOf(R),1)):D=O?[R]:[],Array.isArray(D)){if(s?.(D,N),N.isCanceled)return;y(D)}}),x=k.useMemo(()=>({disabled:S,multiple:l,orientation:o}),[S,o,l]),T=k.useMemo(()=>({disabled:S,orientation:o,setGroupValue:v,value:g}),[S,o,v,g]),w={role:"group"},C=xt("div",t,{enabled:!!m,state:x,ref:n,props:[w,p],stateAttributesMapping:Ez});return b.jsx(kne.Provider,{value:T,children:m?C:b.jsx($x,{render:d,className:f,state:x,refs:[n],props:[w,p],stateAttributesMapping:Ez,loopFocus:a})})}),One=k.createContext(void 0);function Jy(e){const t=k.useContext(One);if(t===void 0&&!e)throw new Error(an(72));return t}const hxe={...sM,disabled:Ue(e=>e.disabled),instantType:Ue(e=>e.instantType),isInstantPhase:Ue(e=>e.isInstantPhase),trackCursorAxis:Ue(e=>e.trackCursorAxis),disableHoverablePopup:Ue(e=>e.disableHoverablePopup),lastOpenChangeReason:Ue(e=>e.openChangeReason),closeDelay:Ue(e=>e.closeDelay)};class IM extends Mx{constructor(t){super({...pxe(),...t},{popupRef:k.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Wy},hxe)}setOpen=(t,n)=>{const r=n.reason,i=r===dr,a=t&&r===Sv,s=!t&&(r===au||r===zy);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const o=()=>{const l={open:t,openChangeReason:r};a?l.instantType="focus":s?l.instantType="dismiss":r===dr&&(l.instantType=void 0);const u=n.trigger?.id??null;(u||t)&&(l.activeTriggerId=u,l.activeTriggerElement=n.trigger??null),this.update(l)};i?xr.flushSync(o):o()};static useStore(t,n){const r=pi(()=>t??new IM(n)).current,i=oM({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=i,r}}function pxe(){return{...aM(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0}}function mxe(e){const{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a="none",actionsRef:s,onOpenChange:o,onOpenChangeComplete:l,handle:u,triggerId:f,defaultTriggerId:d=null,children:p}=e,m=IM.useStore(u?.store,{open:r??n,activeTriggerId:f!==void 0?f:d});m.useControlledProp("open",r,n),m.useControlledProp("activeTriggerId",f,d),m.useContextCallback("onOpenChange",o),m.useContextCallback("onOpenChangeComplete",l);const E=m.useState("open"),S=m.useState("activeTriggerId"),g=m.useState("payload");m.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i});const y=!t&&E;Je(()=>{E&&t&&m.setOpen(!1,it(Qve))},[E,t,m]),m.useSyncedValue("disabled",t),rM(m);const{forceUnmount:v,transitionStatus:x}=iM(y,m),T=m.useState("isInstantPhase"),w=m.useState("instantType"),C=m.useState("lastOpenChangeReason"),R=k.useRef(null);Je(()=>{x==="ending"&&C===Dr||x!=="ending"&&T?(w!=="delay"&&(R.current=w),m.set("instantType","delay")):R.current!==null&&(m.set("instantType",R.current),R.current=null)},[x,T,C,w,m]),Je(()=>{y&&S==null&&m.set("payload",void 0)},[m,S,y]);const O=k.useCallback(()=>{m.setOpen(!1,gxe(m,ZP))},[m]);k.useImperativeHandle(s,()=>({unmount:v,close:O}),[v,O]);const N=m.useState("floatingRootContext"),D=$ee(N,{enabled:!t}),L=Im(N,{enabled:!t,referencePress:!0}),z=mye(N,{enabled:!t&&a!=="none",axis:a==="none"?void 0:a}),{getReferenceProps:M,getFloatingProps:V,getTriggerProps:H}=Jc([D,L,z]),B=k.useMemo(()=>M(),[M]),q=k.useMemo(()=>H(),[H]),K=k.useMemo(()=>V(),[V]);return m.useSyncedValues({floatingRootContext:N,activeTriggerProps:B,inactiveTriggerProps:q,popupProps:K}),b.jsx(One.Provider,{value:m,children:typeof p=="function"?p({payload:g}):p})}function gxe(e,t){const n=it(t);return n.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},n}const Rne=k.createContext(void 0);function bxe(){return k.useContext(Rne)}const vxe=600,yxe=k.forwardRef(function(t,n){const{className:r,render:i,handle:a,payload:s,disabled:o,delay:l,closeDelay:u,id:f,...d}=t,p=Jy(!0),m=a?.store??p;if(!m)throw new Error(an(82));const E=mi(f),S=m.useState("isTriggerActive",E),g=m.useState("floatingRootContext"),y=m.useState("isOpenedByTrigger",E),v=k.useRef(null),x=l??vxe,T=u??0,{registerTrigger:w,isMountedByThisTrigger:C}=nM(E,v,m,{payload:s,closeDelay:T}),R=bxe(),{delayRef:O,isInstantPhase:N,hasProvider:D}=iye(g,{open:y});m.useSyncedValue("isInstantPhase",N);const L=m.useState("disabled"),z=o??L,M=m.useState("trackCursorAxis"),V=m.useState("disableHoverablePopup"),H=Wee(g,{enabled:!z,mouseOnly:!0,move:!1,handleClose:!V&&M!=="both"?cM():null,restMs(){const U=R?.delay,j=typeof O.current=="object"?O.current.open:void 0;let $=x;return D&&(j!==0?$=l??U??x:$=0),$},delay(){const U=typeof O.current=="object"?O.current.close:void 0;let j=T;return u==null&&D&&(j=U),{close:j}},triggerElementRef:v,isActiveTrigger:S}),B=k.useMemo(()=>({open:y}),[y]),q=m.useState("triggerProps",C);return xt("button",t,{state:B,ref:[n,w,v],props:[H,q,{id:E},d],stateAttributesMapping:zx})}),Nne=k.createContext(void 0);function _xe(){const e=k.useContext(Nne);if(e===void 0)throw new Error(an(70));return e}const Exe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t;return Jy().useState("mounted")||r?b.jsx(Nne.Provider,{value:r,children:b.jsx(qSe,{ref:n,...i})}):null}),Ine=k.createContext(void 0);function Dne(){const e=k.useContext(Ine);if(e===void 0)throw new Error(an(71));return e}const Sxe=k.forwardRef(function(t,n){const{render:r,className:i,anchor:a,positionMethod:s="absolute",side:o="top",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:E=!1,disableAnchorTracking:S=!1,collisionAvoidance:g=FP,...y}=t,v=Jy(),x=_xe(),T=v.useState("open"),w=v.useState("mounted"),C=v.useState("trackCursorAxis"),R=v.useState("disableHoverablePopup"),O=v.useState("floatingRootContext"),N=v.useState("instantType"),D=v.useState("transitionStatus"),L=Ky({anchor:a,positionMethod:s,floatingRootContext:O,mounted:w,side:o,sideOffset:u,align:l,alignOffset:f,collisionBoundary:d,collisionPadding:p,sticky:E,arrowPadding:m,disableAnchorTracking:S,keepMounted:x,collisionAvoidance:g,adaptiveOrigin:ate}),z=k.useMemo(()=>{const B={};return(!T||C==="both"||R)&&(B.pointerEvents="none"),{role:"presentation",hidden:!w,style:{...L.positionerStyles,...B}}},[T,C,R,w,L.positionerStyles]),M=k.useMemo(()=>({open:T,side:L.side,align:L.align,anchorHidden:L.anchorHidden,instant:C!=="none"?"tracking-cursor":N}),[T,L.side,L.align,L.anchorHidden,C,N]),V=k.useMemo(()=>({...M,arrowRef:L.arrowRef,arrowStyles:L.arrowStyles,arrowUncentered:L.arrowUncentered}),[M,L.arrowRef,L.arrowStyles,L.arrowUncentered]),H=xt("div",t,{state:M,props:[z,Pm(D),y],ref:[n,v.useStateSetter("positionerElement")],stateAttributesMapping:Oa});return b.jsx(Ine.Provider,{value:V,children:H})}),xxe={...Oa,...ss},wxe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,s=Jy(),{side:o,align:l}=Dne(),u=s.useState("open"),f=s.useState("mounted"),d=s.useState("instantType"),p=s.useState("transitionStatus"),m=s.useState("popupProps"),E=s.useState("payload"),S=s.useState("popupElement"),g=s.useState("positionerElement"),y=s.useState("floatingRootContext"),v=Ou();Oi({open:u,ref:s.context.popupRef,onComplete(){u&&s.context.onOpenChangeComplete?.(!0)}});function x(){y.context.events.emit("measure-layout")}function T(D,L){y.context.events.emit("measure-layout-complete",{previousDimensions:D,nextDimensions:L})}const w=k.useCallback(()=>s.context.triggerElements.size>1,[s]);GSe({popupElement:S,positionerElement:g,mounted:f,content:E,enabled:w,onMeasureLayout:x,onMeasureLayoutComplete:T,side:o,direction:v});const C=s.useState("disabled"),R=s.useState("closeDelay");Hee(y,{enabled:!C,closeDelay:R});const O=k.useMemo(()=>({open:u,side:o,align:l,instant:d,transitionStatus:p}),[u,o,l,d,p]);return xt("div",t,{state:O,ref:[n,s.context.popupRef,s.useStateSetter("popupElement")],props:[m,Pm(p),a],stateAttributesMapping:xxe})}),Txe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,o=Jy().useState("instantType"),{open:l,arrowRef:u,side:f,align:d,arrowUncentered:p,arrowStyles:m}=Dne(),E=k.useMemo(()=>({open:l,side:f,align:d,uncentered:p,instant:o}),[l,f,d,p,o]);return xt("div",t,{state:E,ref:[n,u],props:[{style:m,"aria-hidden":!0},a],stateAttributesMapping:Oa})}),Cxe=function(t){const{delay:n,closeDelay:r,timeout:i=400}=t,a=k.useMemo(()=>({delay:n,closeDelay:r}),[n,r]),s=k.useMemo(()=>({open:n,close:r}),[n,r]);return b.jsx(Rne.Provider,{value:a,children:b.jsx(rye,{delay:s,timeoutMs:i,children:t.children})})};function Axe(e){return xt(e.defaultTagName??"div",e,e)}function kxe({className:e,...t}){return b.jsx("div",{"data-slot":"input-group",role:"group",className:Be("border-input bg-input/20 dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot=input-group-control]:focus-visible]:ring-inset has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[[data-slot][aria-invalid=true]]:ring-inset h-7 rounded-md border transition-colors has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:ring-[2px] has-[[data-slot][aria-invalid=true]]:ring-[2px] has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 [[data-slot=combobox-content]_&]:focus-within:border-inherit [[data-slot=combobox-content]_&]:focus-within:ring-0 group/input-group relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto",e),...t})}const Oxe=Xc("text-muted-foreground **:data-[slot=kbd]:bg-muted-foreground/10 h-auto gap-1 py-2 text-xs/relaxed font-medium group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5 flex cursor-text items-center justify-center select-none",{variants:{align:{"inline-start":"pl-2 has-[>button]:ml-[-0.275rem] has-[>kbd]:ml-[-0.275rem] order-first","inline-end":"pr-2 has-[>button]:mr-[-0.275rem] has-[>kbd]:mr-[-0.275rem] order-last","block-start":"px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start","block-end":"px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start"}},defaultVariants:{align:"inline-start"}});function Rxe({className:e,align:t="inline-start",...n}){return b.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Be(Oxe({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}const Nxe=Xc("gap-2 rounded-md text-xs/relaxed shadow-none flex items-center",{variants:{size:{xs:"h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3",sm:"","icon-xs":"size-6 p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function Lne({className:e,type:t="button",variant:n="ghost",size:r="xs",...i}){return b.jsx(qe,{type:t,"data-size":r,variant:n,className:Be(Nxe({size:r}),e),...i})}function Ixe({className:e,...t}){return b.jsx(dn,{"data-slot":"input-group-control",className:Be("rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent flex-1",e),...t})}const Dxe=ySe;function Lxe({className:e,children:t,...n}){return b.jsxs(YEe,{"data-slot":"combobox-trigger",className:Be("[&_svg:not([class*='size-'])]:size-3.5",e),...n,children:[t,b.jsx(fe,{icon:Yy,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})]})}function Pxe({className:e,...t}){return b.jsx(tSe,{"data-slot":"combobox-clear",render:b.jsx(Lne,{variant:"ghost",size:"icon-xs"}),className:Be(e),...t,children:b.jsx(fe,{icon:fi,strokeWidth:2,className:"pointer-events-none"})})}function Mxe({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return b.jsxs(kxe,{className:Be("w-auto",e),children:[b.jsx(JEe,{render:b.jsx(Ixe,{disabled:n}),...a}),b.jsxs(Rxe,{align:"inline-end",children:[r&&b.jsx(Lne,{size:"icon-xs",variant:"ghost",render:b.jsx(Lxe,{}),"data-slot":"input-group-button",className:"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",disabled:n}),i&&b.jsx(Pxe,{disabled:n})]}),t]})}function jxe({className:e,side:t="bottom",sideOffset:n=6,align:r="start",alignOffset:i=0,anchor:a,...s}){return b.jsx(oSe,{children:b.jsx(lSe,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,className:"isolate z-50",children:b.jsx(cSe,{"data-slot":"combobox-content","data-chips":!!a,className:Be("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-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 ring-foreground/10 *:data-[slot=input-group]:bg-input/20 dark:bg-popover max-h-72 min-w-32 overflow-hidden rounded-lg shadow-md ring-1 duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-7 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:shadow-none group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) data-[chips=true]:min-w-(--anchor-width)",e),...s})})})}function Fxe({className:e,...t}){return b.jsx(aSe,{"data-slot":"combobox-list",className:Be("no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto p-1 data-empty:p-0 overflow-y-auto overscroll-contain",e),...t})}function Bxe({className:e,children:t,...n}){return b.jsxs(hSe,{"data-slot":"combobox-item",className:Be("data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[t,b.jsx(_Se,{render:b.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:b.jsx(fe,{icon:pl,strokeWidth:2,className:"pointer-events-none"})})]})}function Uxe({className:e,...t}){return b.jsx(pSe,{"data-slot":"combobox-empty",className:Be("text-muted-foreground hidden w-full justify-center py-2 text-center text-xs/relaxed group-data-empty/combobox-content:flex",e),...t})}const $xe=Xc("hover:text-foreground hover:bg-accent/20 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive aria-pressed:bg-accent aria-pressed:text-accent-foreground aria-pressed:hover:bg-accent data-[state=on]:bg-accent data-[state=on]:text-accent-foreground data-[state=on]:hover:bg-accent gap-1 rounded-md text-xs font-medium transition-all [&_svg:not([class*='size-'])]:size-3.5 group/toggle inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border-input hover:bg-accent/20 border bg-transparent"},size:{default:"h-7 min-w-7 px-2",sm:"h-6 min-w-6 rounded-[min(var(--radius-md),8px)] px-1.5 text-[0.625rem] [&_svg:not([class*='size-'])]:size-3",lg:"h-8 min-w-8 px-2"}},defaultVariants:{variant:"default",size:"default"}}),Pne=k.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function zxe({className:e,variant:t,size:n,spacing:r=0,orientation:i="horizontal",children:a,...s}){return b.jsx(fxe,{"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:Be("rounded-md data-[size=sm]:rounded-[min(var(--radius-md),8px)] group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch",e),...s,children:b.jsx(Pne.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function Sz({className:e,children:t,variant:n="default",size:r="default",...i}){const a=k.useContext(Pne);return b.jsx(cxe,{"data-slot":"toggle-group-item","data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:Be("group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md shrink-0 focus:z-10 focus-visible:z-10 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",$xe({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}async function zt(e,t){const n=await fetch(e,{...t,headers:{"Content-Type":"application/json",...t?.headers}});if(!n.ok){const r=await n.json().catch(()=>({error:"Request failed"}));throw new Error(r.error||"Request failed")}return n.json()}const Hc="";function DM(){return qn({queryKey:["tasks"],queryFn:()=>zt(`${Hc}/api/tasks`)})}function Mne(e){return qn({queryKey:["tasks",e],queryFn:()=>zt(`${Hc}/api/tasks/${e}`),enabled:!!e})}function Hxe(){const e=wr();return Fn({mutationFn:t=>zt(`${Hc}/api/tasks`,{method:"POST",body:JSON.stringify({...t,status:"IN_PROGRESS"})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function Wxe(){const e=wr();return Fn({mutationFn:({taskId:t,status:n,position:r})=>zt(`${Hc}/api/tasks/${t}/status`,{method:"PATCH",body:JSON.stringify({status:n,position:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function nw(){const e=wr();return Fn({mutationFn:({taskId:t,updates:n})=>zt(`${Hc}/api/tasks/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{taskId:n})=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["tasks",n]})}})}function rw(){const e=wr();return Fn({mutationFn:({taskId:t,deleteLinkedWorktree:n})=>{const r=n?`${Hc}/api/tasks/${t}?deleteLinkedWorktree=true`:`${Hc}/api/tasks/${t}`;return zt(r,{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}function Vxe(){const e=wr();return Fn({mutationFn:({ids:t,deleteLinkedWorktrees:n})=>zt(`${Hc}/api/tasks/bulk`,{method:"DELETE",body:JSON.stringify({ids:t,deleteLinkedWorktrees:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}const e0="";function Gxe(e){return qn({queryKey:["fs","list",e],queryFn:()=>{const t=e?`?path=${encodeURIComponent(e)}`:"";return zt(`${e0}/api/fs/list${t}`)},enabled:e!==null})}function qxe(e){return qn({queryKey:["git","branches",e],queryFn:()=>zt(`${e0}/api/git/branches?repo=${encodeURIComponent(e)}`),enabled:!!e})}function Kxe(e,t={}){const{staged:n=!1,ignoreWhitespace:r=!1,includeUntracked:i=!1}=t;return qn({queryKey:["git","diff",e,n,r,i],queryFn:()=>{const a=new URLSearchParams({path:e,...n&&{staged:"true"},...r&&{ignoreWhitespace:"true"},...i&&{includeUntracked:"true"}});return zt(`${e0}/api/git/diff?${a}`)},enabled:!!e,refetchInterval:5e3})}function Yxe(e){return qn({queryKey:["git","status",e],queryFn:()=>zt(`${e0}/api/git/status?path=${encodeURIComponent(e)}`),enabled:!!e,refetchInterval:5e3})}async function Xxe(e){return zt(`${e0}/api/fs/is-git-repo?path=${encodeURIComponent(e)}`)}const gl="",In={PORT:"server.port",WORKTREE_BASE_PATH:"worktree_base_path",DEFAULT_GIT_REPOS_DIR:"paths.defaultGitReposDir",EDITOR_APP:"editor.app",EDITOR_HOST:"editor.host",EDITOR_SSH_PORT:"editor.sshPort",LINEAR_API_KEY:"integrations.linearApiKey",GITHUB_PAT:"integrations.githubPat",LANGUAGE:"appearance.language",SYNC_CLAUDE_CODE_THEME:"appearance.syncClaudeCodeTheme",CLAUDE_CODE_LIGHT_THEME:"appearance.claudeCodeLightTheme",CLAUDE_CODE_DARK_THEME:"appearance.claudeCodeDarkTheme"},Zxe=7777;function $s(e){return qn({queryKey:["config",e],queryFn:()=>zt(`${gl}/api/config/${e}`)})}function jne(){const e=$s(In.PORT);return{...e,data:e.data?.value??Zxe,isDefault:e.data?.isDefault??!0}}function Qxe(){const e=$s(In.WORKTREE_BASE_PATH);return{...e,data:e.data?.value??""}}function iw(){const e=$s(In.DEFAULT_GIT_REPOS_DIR);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function LM(){const e=$s(In.EDITOR_APP);return{...e,data:e.data?.value??"vscode",isDefault:e.data?.isDefault??!0}}function PM(){const e=$s(In.EDITOR_HOST);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function MM(){const e=$s(In.EDITOR_SSH_PORT);return{...e,data:e.data?.value??22,isDefault:e.data?.isDefault??!0}}function Jxe(){const e=$s(In.LINEAR_API_KEY);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function ewe(){const e=$s(In.GITHUB_PAT);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function twe(){const e=$s(In.LANGUAGE);return{...e,data:e.data?.value??null,isDefault:e.data?.isDefault??!0}}function nwe(){const e=$s(In.SYNC_CLAUDE_CODE_THEME);return{...e,data:!!e.data?.value,isDefault:e.data?.isDefault??!0}}const xz=["light","light-ansi","light-daltonized","dark","dark-ansi","dark-daltonized"];function rwe(){const e=$s(In.CLAUDE_CODE_LIGHT_THEME);return{...e,data:e.data?.value??"light-ansi",isDefault:e.data?.isDefault??!0}}function iwe(){const e=$s(In.CLAUDE_CODE_DARK_THEME);return{...e,data:e.data?.value??"dark-ansi",isDefault:e.data?.isDefault??!0}}function Fne(){const e=wr();return Fn({mutationFn:({key:t,value:n})=>zt(`${gl}/api/config/${t}`,{method:"PUT",body:JSON.stringify({value:n})}),onSuccess:(t,{key:n})=>{e.invalidateQueries({queryKey:["config",n]}),n===In.GITHUB_PAT&&(e.invalidateQueries({queryKey:["github-user"]}),e.invalidateQueries({queryKey:["github-prs"]}),e.invalidateQueries({queryKey:["github-issues"]}),e.invalidateQueries({queryKey:["github-orgs"]}))}})}function awe(){const e=wr();return Fn({mutationFn:t=>zt(`${gl}/api/config/${t}`,{method:"DELETE"}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["config",n]})}})}function swe(){return qn({queryKey:["config","notifications"],queryFn:()=>zt(`${gl}/api/config/notifications`)})}function owe(){const e=wr();return Fn({mutationFn:t=>zt(`${gl}/api/config/notifications`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","notifications"]})}})}function lwe(){return Fn({mutationFn:e=>zt(`${gl}/api/config/notifications/test/${e}`,{method:"POST"})})}function uwe(){return qn({queryKey:["config","z-ai"],queryFn:()=>zt(`${gl}/api/config/z-ai`)})}function cwe(){const e=wr();return Fn({mutationFn:t=>zt(`${gl}/api/config/z-ai`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","z-ai"]}),e.invalidateQueries({queryKey:["monitoring","claude-usage"]})}})}function Bne(){return qn({queryKey:["config","developer-mode"],queryFn:()=>zt(`${gl}/api/config/developer-mode`),staleTime:1/0})}function dwe(){return Fn({mutationFn:()=>zt(`${gl}/api/config/restart`,{method:"POST"})})}const yu="";function t0(){return qn({queryKey:["repositories"],queryFn:()=>zt(`${yu}/api/repositories`)})}function fwe(e){return qn({queryKey:["repositories",e],queryFn:()=>zt(`${yu}/api/repositories/${e}`),enabled:!!e})}function Une(){const e=wr();return Fn({mutationFn:t=>zt(`${yu}/api/repositories`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function hwe(){const e=wr();return Fn({mutationFn:t=>zt(`${yu}/api/repositories/clone`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function pwe(){const e=wr();return Fn({mutationFn:({id:t,updates:n})=>zt(`${yu}/api/repositories/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{id:n})=>{e.invalidateQueries({queryKey:["repositories"]}),e.invalidateQueries({queryKey:["repositories",n]})}})}function $ne(){const e=wr();return Fn({mutationFn:({id:t,deleteDirectory:n=!1})=>{const r=n?`${yu}/api/repositories/${t}?deleteDirectory=true`:`${yu}/api/repositories/${t}`;return zt(r,{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function mwe(){return Fn({mutationFn:e=>zt(`${yu}/api/repositories/scan`,{method:"POST",body:JSON.stringify(e?{directory:e}:{})})})}function gwe(){const e=wr();return Fn({mutationFn:t=>zt(`${yu}/api/repositories/bulk`,{method:"POST",body:JSON.stringify({repositories:t})}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function n0({className:e,children:t,...n}){return b.jsxs(XSe,{"data-slot":"scroll-area",className:Be("relative",e),...n,children:[b.jsx(txe,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),b.jsx(bwe,{}),b.jsx(axe,{})]})}function bwe({className:e,orientation:t="vertical",...n}){return b.jsx(rxe,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:Be("data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none",e),...n,children:b.jsx(ixe,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function gf({open:e,onOpenChange:t,onSelect:n,initialPath:r}){const[i,a]=k.useState(r||null),[s,o]=k.useState(""),[l,u]=k.useState("");k.useEffect(()=>{e&&(a(r||null),o(""),u(""))},[e,r]);const{data:f,isLoading:d,error:p}=Gxe(e?i??"":null),m=x=>{f&&(a(f.path+"/"+x),u(""))},E=()=>{f?.parent&&f.parent!==f.path&&(a(f.parent),u(""))},S=()=>{a(null),u("")},g=()=>{s.trim()&&(a(s.trim()),u(""))},y=x=>{n(x),t(!1)},v=f?.entries.filter(x=>x.name.toLowerCase().includes(l.toLowerCase()));return b.jsx(ed,{open:e,onOpenChange:t,children:b.jsxs(td,{className:"sm:max-w-lg overflow-hidden",children:[b.jsxs(Gf,{children:[b.jsx(qf,{children:"Select Git Repository"}),b.jsx(Zx,{children:"Choose an existing git repository"})]}),b.jsx("p",{className:"text-xs text-muted-foreground",children:"Click folder names to navigate • Use action buttons to select"}),b.jsx(oEe,{}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{className:"text-xs font-medium",children:"Enter path manually:"}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(dn,{value:s,onChange:x=>o(x.target.value),placeholder:"/path/to/your/project",onKeyDown:x=>x.key==="Enter"&&g(),className:"flex-1"}),b.jsx(qe,{variant:"outline",size:"sm",onClick:g,children:"Go"})]})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{className:"text-xs font-medium",children:"Search current directory:"}),b.jsxs("div",{className:"relative",children:[b.jsx(fe,{icon:Gx,size:14,strokeWidth:2,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),b.jsx(dn,{value:l,onChange:x=>u(x.target.value),placeholder:"Filter folders and files...",className:"pl-8"})]})]}),b.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b.jsx(qe,{variant:"outline",size:"icon-sm",onClick:S,title:"Home",className:"shrink-0",children:b.jsx(fe,{icon:j1e,size:14,strokeWidth:2})}),b.jsx(qe,{variant:"outline",size:"icon-sm",onClick:E,disabled:!f||f.parent===f.path,title:"Parent directory",className:"shrink-0",children:b.jsx(fe,{icon:mM,size:14,strokeWidth:2})}),b.jsx("code",{className:"min-w-0 flex-1 text-xs bg-muted/50 px-2 py-1 rounded truncate overflow-hidden",children:f?.path||"~"}),b.jsxs(qe,{variant:"outline",size:"sm",onClick:()=>f&&y(f.path),disabled:!f,className:"shrink-0 max-sm:px-2",title:"Select current directory",children:[b.jsx(fe,{icon:JI,size:14,strokeWidth:2,className:"sm:hidden"}),b.jsx("span",{className:"max-sm:hidden",children:"Select Current"})]})]}),b.jsx(n0,{className:"h-64 border rounded-md",children:b.jsxs("div",{className:"p-1",children:[d&&b.jsx("div",{className:"text-muted-foreground text-xs p-3",children:"Loading..."}),p&&b.jsx("div",{className:"text-destructive text-xs p-3",children:p.message}),f&&v&&b.jsxs(b.Fragment,{children:[v.length===0&&b.jsx("div",{className:"text-muted-foreground text-xs p-3",children:l?"No matches found":"Empty directory"}),v.map(x=>b.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted group",children:x.type==="directory"?b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:x.isGitRepo?JI:Vi,size:16,strokeWidth:2,className:(x.isGitRepo,"text-accent")}),b.jsx("button",{onClick:()=>m(x.name),className:"flex-1 text-left text-xs truncate hover:underline",children:x.name}),x.isGitRepo&&b.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded border border-accent/50 text-accent font-medium shrink-0",children:[b.jsx("span",{className:"max-sm:hidden",children:"git repo"}),b.jsx("span",{className:"sm:hidden",children:"git"})]})]}):b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"w-4"}),b.jsx("span",{className:"flex-1 text-xs text-muted-foreground truncate",children:x.name})]})},x.name))]})]})}),b.jsxs(Df,{children:[b.jsx(Fp,{render:b.jsx(qe,{variant:"outline"}),children:"Cancel"}),b.jsx(qe,{onClick:()=>f&&y(f.path),disabled:!f,children:"Select Path"})]})]})})}function vwe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ywe(e){const t=vwe(e);if(!t)return"";const n=Math.random().toString(36).substring(2,6);return`${t}-${n}`}function jM({open:e,onOpenChange:t,defaultRepository:n,showTrigger:r=!0}={}){const{t:i}=rn("tasks"),{t:a}=rn("common"),[s,o]=k.useState(!1),l=e??s,u=t??o,[f,d]=k.useState(!1),[p,m]=k.useState(""),[E,S]=k.useState(""),[g,y]=k.useState(""),[v,x]=k.useState(""),[T,w]=k.useState(""),[C,R]=k.useState(""),[O,N]=k.useState("default"),[D,L]=k.useState(!1),[z,M]=k.useState(null),[V,H]=k.useState("browse"),[B,q]=k.useState(""),[K,U]=k.useState(null),[j,$]=k.useState(!1),Y=Ri(),W=Hxe(),J=Une(),ae=k.useRef(null),{data:se}=Qxe(),{data:Q}=iw(),{data:G}=t0(),{data:Z,isLoading:ee}=qxe(g||null),ne=z?G?.find(de=>de.id===z):null,te=k.useMemo(()=>{if(!G)return[];if(ne&&B===ne.displayName||!B.trim())return G;const de=B.toLowerCase();return G.filter(Ce=>Ce.displayName.toLowerCase().includes(de)||Ce.path.toLowerCase().includes(de))},[G,B,ne]);k.useEffect(()=>{G&&G.length>0?H("saved"):H("browse")},[G]),k.useEffect(()=>{if(l){if(n)M(n.id),y(n.path),q(n.displayName),H("saved");else if(G&&G.length>0){const de=G[0];M(de.id),y(de.path),q(de.displayName),H("saved")}}},[l,n,G]),k.useEffect(()=>{x(Z?Z.current||Z.branches[0]||"main":"")},[Z,g]);const ye=de=>{m(de),R(ywe(de))},Ee=async de=>{U(null),$(!0);try{if(!(await Xxe(de)).isGitRepo){U(i("createModal.errors.notGitRepo")),$(!1);return}if(y(de),M(null),!G?.find(he=>he.path===de)){const he=de.split("/").pop()||"Unknown";J.mutate({path:de,displayName:he})}}catch(Ce){U(Ce instanceof Error?Ce.message:i("createModal.errors.validationFailed"))}finally{$(!1)}},pe=de=>{if(de.preventDefault(),!p.trim()||!g)return;const Ce=g.split("/").pop()||"repo",ge=T.trim()||C,he=`${se}/${ge}`;W.mutate({title:p.trim(),description:E.trim(),aiMode:O,repoPath:g,repoName:Ce,baseBranch:v||"main",branch:ge,worktreePath:he,copyFiles:ne?.copyFiles||void 0,startupScript:ne?.startupScript||void 0},{onSuccess:ce=>{const Ne=E.trim()?{aiMode:O,description:E.trim()}:{aiMode:O};u(!1),m(""),S(""),y(""),x(""),w(""),R(""),N("default"),L(!1),M(null),q(""),U(null),H(G&&G.length>0?"saved":"browse"),Y({to:"/tasks/$taskId",params:{taskId:ce.id},state:Ne})},onError:ce=>{kt.error(i("createModal.errors.createFailed"),{description:ce instanceof Error?ce.message:String(ce)})}})},_e=!W.isPending&&!!p.trim()&&!!g;Va("meta+enter",()=>{ae.current&&ae.current.requestSubmit()},{enabled:l&&_e,allowInInput:!0,ignoreContext:!0,deps:[l,_e]});const Se=T.trim()||C,Te=Se?`${se}/${Se}`:"";return b.jsxs(b.Fragment,{children:[b.jsxs(ed,{open:l,onOpenChange:u,children:[r&&b.jsxs(Mte,{render:b.jsx(qe,{size:"sm"}),children:[b.jsx(fe,{icon:bM,size:16,strokeWidth:2,"data-slot":"icon",className:"-translate-y-px"}),i("newTask")]}),b.jsx(td,{className:"sm:max-w-md max-h-[80dvh] flex flex-col overflow-hidden",children:b.jsxs("form",{ref:ae,onSubmit:pe,className:"flex flex-col min-h-0 flex-1",children:[b.jsxs(Gf,{className:"shrink-0",children:[b.jsx(qf,{children:i("createModal.title")}),b.jsx(Zx,{children:i("createModal.description")})]}),b.jsxs(mf,{className:"mt-4 pb-4 overflow-y-auto min-h-0 flex-1",children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"title",children:i("createModal.fields.title")}),b.jsx(dn,{id:"title",value:p,onChange:de=>ye(de.target.value),placeholder:i("createModal.fields.titlePlaceholder"),required:!0})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"description",children:i("createModal.fields.description")}),b.jsx(Bte,{id:"description",value:E,onValueChange:de=>{S(de),D||N(de.trim()?"plan":"default")},placeholder:i("createModal.fields.descriptionPlaceholder"),rows:2})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:i("createModal.fields.aiMode")}),b.jsxs(zxe,{value:[O],onValueChange:de=>{const Ce=Array.isArray(de)?de[0]:de;Ce&&(N(Ce),L(!0))},className:"w-full",variant:"outline",children:[b.jsx(Sz,{value:"plan",className:"flex-1",children:i("createModal.aiModes.plan")}),b.jsx(Sz,{value:"default",className:"flex-1",children:i("createModal.aiModes.default")})]})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:i("createModal.fields.repository")}),b.jsxs(Zo,{value:V,onValueChange:de=>{H(de),U(null)},children:[b.jsxs(Qo,{children:[b.jsx(Wr,{value:"saved",disabled:!G?.length,children:i("createModal.tabs.saved")}),b.jsx(Wr,{value:"browse",children:i("createModal.tabs.browse")})]}),b.jsx(ci,{value:"saved",className:"mt-2",children:b.jsxs(Dxe,{value:z||"",onValueChange:de=>{const Ce=G?.find(ge=>ge.id===de);Ce&&(M(de),y(Ce.path),q(Ce.displayName),U(null))},inputValue:B,onInputValueChange:de=>{q(de),ne&&de!==ne.displayName&&M(null)},itemToStringLabel:de=>G?.find(Ce=>Ce.id===de)?.displayName||"",children:[b.jsx(Mxe,{placeholder:i("createModal.searchRepositories"),className:"w-full"}),b.jsx(jxe,{children:b.jsxs(Fxe,{children:[b.jsx(Uxe,{children:i("createModal.noRepositoriesFound")}),te.map(de=>b.jsx(Bxe,{value:de.id,children:de.displayName},de.id))]})})]})}),b.jsx(ci,{value:"browse",className:"mt-2",children:b.jsxs(qe,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>d(!0),disabled:j,children:[b.jsx(fe,{icon:Vi,size:14,strokeWidth:2,className:"mr-2"}),j?b.jsx("span",{className:"text-muted-foreground",children:a("status.validating")}):g&&!z?b.jsx("span",{className:"truncate",children:g}):b.jsx("span",{className:"text-muted-foreground group-hover/button:text-accent-foreground",children:i("createModal.selectFolder")})]})})]}),K&&b.jsx("p",{className:"text-sm text-destructive",children:K}),g&&!K&&b.jsx(Ya,{className:"font-mono text-xs truncate",children:g})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"baseBranch",children:i("createModal.fields.baseBranch")}),b.jsxs(Bi,{value:v,onValueChange:de=>x(de??""),disabled:!g||ee,children:[b.jsx($i,{className:"w-full",children:b.jsx(Ui,{children:v||b.jsx("span",{className:"text-muted-foreground",children:i(g?ee?"createModal.loadingBranches":"createModal.selectBranch":"createModal.selectRepositoryFirst")})})}),b.jsx(zi,{children:Z?.branches.map(de=>b.jsxs(Cn,{value:de,children:[de,de===Z.current&&b.jsx("span",{className:"text-muted-foreground ml-2",children:i("createModal.current")})]},de))})]})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"branch",children:i("createModal.fields.branchName")}),b.jsx(dn,{id:"branch",value:T,onChange:de=>w(de.target.value),placeholder:C||i("createModal.fields.branchPlaceholder")}),Te&&b.jsxs(Ya,{children:[i("createModal.worktreePrefix")," ",Te]}),!T.trim()&&C&&b.jsx(Ya,{children:i("createModal.branchAutoGenerated",{branch:C})})]})]}),b.jsxs(Df,{className:"mt-4 shrink-0",children:[b.jsx(Fp,{render:b.jsx(qe,{variant:"outline",type:"button",className:"border-destructive text-destructive hover:bg-destructive hover:text-white"}),children:a("buttons.cancel")}),b.jsx(qe,{type:"submit",disabled:W.isPending||!p.trim()||!g,children:W.isPending?a("status.creating"):i("createModal.createTask")})]})]})})]}),b.jsx(gf,{open:f,onOpenChange:d,onSelect:Ee,initialPath:Q||void 0})]})}const wz=[{to:"/tasks",icon:jp,labelKey:"header.tasks",matchPrefix:!0},{to:"/terminals",icon:Wx,labelKey:"header.terminals",matchPrefix:!1},{to:"/repositories",icon:Qd,labelKey:"header.repositories",matchPrefix:!0},{to:"/review",icon:ou,labelKey:"header.review",matchPrefix:!0},{to:"/monitoring",icon:dte,labelKey:"header.monitoring",matchPrefix:!0}];function _we({onNewTaskRef:e,onOpenCommandPalette:t}){const{t:n}=rn("navigation"),{location:r}=ri(),i=r.pathname,[a,s]=k.useState(!1),o=(l,u)=>u?i.startsWith(l):i===l;return k.useEffect(()=>{e?.(()=>s(!0))},[e]),b.jsxs("header",{className:"sticky top-0 z-10 flex h-12 shrink-0 items-center justify-between border-b border-border bg-card px-4 max-sm:px-2",children:[b.jsxs("div",{className:"flex min-w-0 items-center gap-4 max-sm:gap-2",children:[b.jsx(K1e,{className:"md:hidden",children:b.jsx(Y1e,{children:b.jsxs(X1e,{children:[b.jsxs(Q1e,{className:"bg-transparent hover:bg-muted/50 data-open:bg-muted/50 gap-1 px-2",children:[b.jsx(fe,{icon:_te,size:16,strokeWidth:2}),b.jsx("span",{className:"sr-only",children:"Menu"})]}),b.jsx(J1e,{className:"min-w-48",children:wz.map(l=>b.jsxs(t_e,{href:l.to,active:o(l.to,l.matchPrefix),render:b.jsx(Ai,{to:l.to}),children:[b.jsx(fe,{icon:l.icon,size:16,strokeWidth:2}),n(l.labelKey)]},l.to))})]})})}),b.jsx("nav",{className:"hidden items-center gap-1 md:flex",children:wz.map(l=>{const u=o(l.to,l.matchPrefix);return b.jsxs(Ai,{to:l.to,className:Be("relative flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium transition-colors",u?"bg-background text-foreground":"text-foreground/60 hover:text-foreground","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-foreground after:transition-opacity",u?"after:opacity-100":"after:opacity-0"),children:[b.jsx(fe,{icon:l.icon,size:16,strokeWidth:2,"data-slot":"icon"}),n(l.labelKey)]},l.to)})})]}),b.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[b.jsx(jM,{open:a,onOpenChange:s}),b.jsx(qe,{variant:"ghost",size:"icon-sm",onClick:t,title:n("header.commandPalette",{shortcut:"⌘K"}),className:"hidden sm:inline-flex",children:b.jsx(fe,{icon:QI,size:16,strokeWidth:2})}),b.jsx(Ai,{to:"/settings",className:Be("relative flex items-center justify-center rounded-md p-1.5 transition-colors",i==="/settings"?"bg-background text-foreground":"text-foreground/60 hover:text-foreground","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-foreground after:transition-opacity",i==="/settings"?"after:opacity-100":"after:opacity-0"),children:b.jsx(fe,{icon:Ete,size:16,strokeWidth:2})})]})]})}function Ewe(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}const Swe=10,xwe=2e3;function wwe(){const e=wr(),t=Ri(),{resolvedTheme:n}=Kc(),r=k.useRef(null),i=k.useRef(void 0),a=k.useRef(0),s=k.useRef(void 0),o=k.useCallback(u=>{try{const f=JSON.parse(u.data);if(f.type==="task:updated")e.invalidateQueries({queryKey:["tasks"]});else if(f.type==="notification"&&"payload"in f){let d=function(){const N=y&&!v?"/goat.jpeg":n==="dark"?"/logo-dark.jpg":"/logo-light.jpg",L={description:E,icon:b.jsx("img",{src:N,alt:"",className:"size-8 shrink-0 aspect-square rounded-sm object-cover"}),...g&&{action:{label:"View",onClick:()=>t({to:"/tasks/$taskId",params:{taskId:g}})}}};switch(S){case"success":kt.success(m,L);break;case"error":kt.error(m,L);break;case"warning":kt.warning(m,L);break;default:kt.info(m,L);break}if("Notification"in window&&window.parent===window&&Notification.permission==="granted"&&new Notification(m,{body:E,icon:N,tag:p}),y){const V="vibora:lastSoundPlayed",H=Date.now(),B=localStorage.getItem(V);if(B){const K=parseInt(B.split(":")[0]);if(H-K<1e3)return}const q=`${H}:${Math.random().toString(36).slice(2)}`;localStorage.setItem(V,q),setTimeout(()=>{if(localStorage.getItem(V)!==q)return;let K=!1;const U=()=>{if(K)return;K=!0,new Audio("/sounds/goat-bleat.mp3").play().catch(()=>{})},j=new Audio("/api/uploads/sound");j.onerror=U,j.play().catch(U)},50)}window.parent!==window&&window.parent.postMessage({type:"vibora:notification",title:m,message:E,notificationType:S},"*")};const{id:p,title:m,message:E,notificationType:S,taskId:g,playSound:y,isCustomSound:v}=f.payload,x=`vibora:notification:${p}`,T=50,w=1e4;if(localStorage.getItem(x))return;const R=`${Date.now()}:${Math.random().toString(36).slice(2)}`;localStorage.setItem(x,R),setTimeout(()=>{localStorage.getItem(x)===R&&(setTimeout(()=>localStorage.removeItem(x),w),d())},T)}}catch{}},[e,t,n]),l=k.useCallback(()=>{const u=r.current;if(u&&(u.readyState===WebSocket.CONNECTING||u.readyState===WebSocket.OPEN))return;const f=Ewe(),d=new WebSocket(f);r.current=d,d.onopen=()=>{a.current=0},d.onmessage=o,d.onclose=()=>{r.current===d&&(r.current=null),a.current<Swe&&(a.current++,i.current=setTimeout(()=>{s.current?.()},xwe))},d.onerror=()=>{}},[o]);s.current=l,k.useEffect(()=>{"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[]),k.useEffect(()=>(l(),()=>{i.current&&clearTimeout(i.current);const u=r.current;u&&(u.readyState===WebSocket.OPEN&&u.close(),r.current=null)}),[l])}const Twe={save:"Save Changes",cancel:"Cancel",delete:"Delete",create:"Create",reset:"Reset to default",browse:"Browse",clearFilters:"Clear filters"},Cwe={loading:"Loading...",saving:"Saving...",saved:"Saved",error:"Error",calculating:"calculating...",validating:"Validating...",creating:"Creating...",deleting:"Deleting...",loggingIn:"Logging in..."},Awe={justNow:"just now",minuteAgo:"1 minute ago",minutesAgo:"{{count}} minutes ago",hourAgo:"1 hour ago",hoursAgo:"{{count}} hours ago",dayAgo:"1 day ago",daysAgo:"{{count}} days ago"},kwe={one:"{{count}} result",other:"{{count}} results"},Owe={IN_PROGRESS:"In Progress",IN_REVIEW:"In Review",DONE:"Done",CANCELED:"Canceled",ORPHANED:"Orphaned"},Rwe={loginTitle:"Login to Vibora",username:"Username",password:"Password",login:"Login",loginFailed:"Login failed"},Nwe={buttons:Twe,status:Cwe,time:Awe,results:kwe,statuses:Owe,auth:Rwe},Iwe={tasks:"Tasks",terminals:"Terminals",worktrees:"Worktrees",repositories:"Repositories",review:"Review",monitoring:"Monitoring",settings:"Settings",commandPalette:"Command Palette ({{shortcut}})"},Dwe={placeholder:"Type a command or search...",noResults:"No commands found.",categories:{navigation:"Navigation",actions:"Actions"},commands:{goToTasks:"Go to Tasks",goToTerminals:"Go to Terminals",goToTaskTerminals:"Go to Task Terminals",goToRepositories:"Go to Repositories",goToReview:"Go to Review",goToMonitoring:"Go to Monitoring",goToSettings:"Go to Settings",newTask:"New Task",keyboardShortcuts:"Keyboard Shortcuts"}},Lwe={title:"Keyboard Shortcuts",groups:{navigation:"Navigation",actions:"Actions",terminals:"Terminals (Desktop)",general:"General"},labels:{goToTasks:"Go to Tasks",goToTerminals:"Go to Terminals",goToTaskTerminals:"Go to Task Terminals",goToRepositories:"Go to Repositories",goToReview:"Go to Review",goToMonitoring:"Go to Monitoring",goToSettings:"Go to Settings",commandPalette:"Command Palette",newTask:"New Task",keyboardShortcuts:"Keyboard Shortcuts",closeModal:"Close Modal",newTerminal:"New Terminal",closeTerminal:"Close Terminal",submitForm:"Submit Form"}},Pwe={header:Iwe,commandPalette:Dwe,shortcuts:Lwe},Mwe="Tasks",jwe="Search",Fwe="All Repos",Bwe="New Task",Uwe={title:"Create New Task",description:"Create a new task with a git worktree for isolated development.",fields:{title:"Title",titlePlaceholder:"Add user authentication",description:"Description",descriptionPlaceholder:"Implement OAuth2 login flow...",aiMode:"AI Mode",repository:"Repository",baseBranch:"Base Branch",branchName:"Branch Name",branchPlaceholder:"auto-generated-from-title"},aiModes:{plan:"Plan",default:"Default"},tabs:{saved:"Repos",browse:"Browse"},worktreePrefix:"Worktree:",branchAutoGenerated:'Will use "{{branch}}" if left empty.',selectFolder:"Select folder...",searchRepositories:"Search repositories...",noRepositoriesFound:"No repositories found",selectRepositoryFirst:"Select repository first",loadingBranches:"Loading branches...",selectBranch:"Select branch",current:"(current)",createTask:"Create Task",errors:{notGitRepo:"Selected folder is not a git repository",validationFailed:"Failed to validate repository",createFailed:"Failed to create task"}},$we={title:Mwe,searchPlaceholder:jwe,allRepos:Fwe,newTask:Bwe,createModal:Uwe},zwe="Settings",Hwe={server:"Server",serverDefaults:"Server & Defaults",paths:"Paths",editor:"Editor",integrations:"Integrations",zai:"z.ai",notifications:"Notifications",appearance:"Appearance",developer:"Developer"},Wwe={port:{label:"Port",description:"Requires restart"},startupCommand:{label:"Startup Command",description:"Command for new task terminals"},gitReposDir:{label:"Git Repos Directory",description:"Starting directory for repo picker"},editor:{app:{label:"Editor",description:"Code editor for opening worktrees",options:{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}},host:{label:"Remote Host",description:"For SSH URLs when code is on a remote machine",placeholder:"e.g., my-server.tailnet.ts.net"},sshPort:{label:"SSH Port",description:"Remote SSH port (default 22)"}},linear:{label:"Linear",description:"API key for ticket sync"},github:{label:"GitHub",description:"PAT for Issues & PRs"},zai:{enable:"Enable",apiKey:"API Key",description:"Configures Claude Code to use z.ai proxy",modelMappings:"Model Mappings",haiku:"Haiku",sonnet:"Sonnet",opus:"Opus"},language:{label:"Language",description:"Interface language",options:{auto:"Auto-detect",en:"English",zh:"Chinese (Simplified)"}},theme:{label:"Theme",description:"Color theme for the interface",options:{system:"System",light:"Light",dark:"Dark"}},syncClaudeTheme:{label:"Sync Claude Code",description:"Automatically update Claude Code's theme when Vibora switches between light and dark mode"},claudeCodeTheme:{light:"Light mode",dark:"Dark mode",options:{light:"Light","light-ansi":"Light ANSI","light-daltonized":"Light (colorblind)",dark:"Dark","dark-ansi":"Dark ANSI","dark-daltonized":"Dark (colorblind)"}}},Vwe={enable:"Enable Notifications",sound:"Sound",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"App Token",userKey:"User Key",testSuccess:"{{channel}} test successful",testFailed:"{{channel}} test failed: {{error}}",uploadSound:"Upload custom sound",deleteSound:"Remove custom sound",testSound:"Test sound",soundUploaded:"Custom sound uploaded",soundUploadFailed:"Failed to upload sound: {{error}}",soundDeleted:"Custom sound removed",soundDeleteFailed:"Failed to remove custom sound",customSoundActive:"Custom sound active"},Gwe={restartButton:"Restart Vibora",restarting:"Restarting...",restartDescription:"Rebuild and restart the Vibora server. If the build fails, the server will continue running.",restartFailed:"Restart failed",checkLogs:"Build may have failed. Check journalctl --user -u vibora for details."},qwe={title:"Unsaved Changes",description:"You have unsaved changes that will be lost if you leave this page.",stay:"Stay",leave:"Leave"},Kwe={title:zwe,sections:Hwe,fields:Wwe,notifications:Vwe,developer:Gwe,unsavedChanges:qwe},Ywe="Review",Xwe={pullRequests:"Pull Requests",issues:"Issues"},Zwe={pr:{created:"Created by me",assigned:"Assigned to me",reviewRequested:"Review requests",mentioned:"Mentioned"},issue:{assigned:"Assigned to me",created:"Created by me",mentioned:"Mentioned"},allOrgs:"All Orgs",allOrganizations:"All Organizations",viboraReposOnly:"Vibora repos only"},Qwe={tokenRequired:"GitHub Token Required",tokenDescription:"To view your issues and pull requests, add a GitHub Personal Access Token in Settings.",requiredScopes:"Required scopes:",scopes:{repo:"(for private repositories)",readUser:"(for user info)",readOrg:"(for organization list)"},generateToken:"Generate Token",goToSettings:"Go to Settings"},Jwe={loading:"Loading...",failedToLoad:"Failed to load pull requests",empty:{all:"No open pull requests",created:"No pull requests created by you",assigned:"No pull requests assigned to you",reviewRequested:"No pull requests awaiting your review",mentioned:"No pull requests mentioning you"},draft:"Draft"},eTe={loading:"Loading...",failedToLoad:"Failed to load issues",empty:{assigned:"No issues assigned to you",created:"No issues created by you",mentioned:"No issues mentioning you"}},tTe={title:Ywe,tabs:Xwe,filters:Zwe,github:Qwe,prs:Jwe,issues:eTe},nTe="Worktrees",rTe={total:"{{count}} total",orphaned:"{{count}} orphaned"},iTe={button:"Clean up ({{count}})",title:"Delete Completed Worktrees",description:"This will permanently delete {{count}} worktree(s).",linkedTasksWillBeDeleted:"Their linked tasks will also be deleted.",alsoDeleteLinkedTasks:"Also delete linked tasks",done:"Done",canceled:"Canceled",cannotUndo:"This action cannot be undone."},aTe={noMatch:"No worktrees match the selected filters.",noWorktrees:"No worktrees found. Worktrees are created when you create tasks."},sTe={failedToLoad:"Failed to load worktrees: {{message}}"},oTe={title:nTe,summary:rTe,cleanup:iTe,delete:{title:"Delete Worktree",description:"This will permanently delete the worktree directory at",linkedTaskWillBeDeleted:'The linked task "{{title}}" will also be deleted.',alsoDeleteLinkedTask:'Also delete linked task "{{title}}"',cannotUndo:"This action cannot be undone.",button:"Delete {{count}}"},empty:aTe,error:sTe},lTe="Monitoring",uTe={claude:"Claude Instances",system:"System Metrics",processes:"Processes",vibora:"Vibora Servers",worktrees:"Worktrees",usage:"Usage Limits"},cTe={showAllInstances:"Show all instances",instanceCount:"{{count}} instance(s) running",totalRam:"{{ram}} MB total",headers:{terminal:"Terminal",task:"Task",ram:"RAM",actions:"Actions",pid:"PID",workingDirectory:"Working Dir",source:"Source"},noTask:"(no task)",kill:"Kill",killing:"Killing...",killSelected:"Kill {{count}} selected",source:{vibora:"Vibora: {{name}}",external:"External"},empty:"No Claude instances running",emptyVibora:" in Vibora terminals",error:"Failed to load Claude instances: {{message}}"},dTe={cpuUsage:"CPU Usage",memoryUsage:"Memory Usage",memoryLabels:{used:"Used",cache:"Cache / Buffers"},diskUsage:"Disk Usage ({{path}})",error:"Failed to load system metrics: {{message}}"},fTe={topProcesses:"Top Processes",sortBy:{memory:"By Memory",cpu:"By CPU"},headers:{pid:"PID",name:"Name",command:"Command",memory:"Memory"},empty:"No processes found",error:"Failed to load processes: {{message}}",containers:"Containers",containersEmpty:"No containers running",containersUnavailable:"Docker/Podman not available"},hTe={description:"Running Vibora dev servers",instanceCount:"{{count}} instance(s) running",headers:{port:"Port",mode:"Mode",directory:"Directory",ram:"RAM",actions:"Actions"},mode:{dev:"Dev",prod:"Prod"},vite:"Vite",kill:"Kill",killing:"Killing...",empty:"No Vibora instances running",error:"Failed to load Vibora instances: {{message}}"},pTe={fiveHourBlock:"5-Hour Block",sevenDayRolling:"7-Day Rolling",opusWeekly:"Opus Weekly",sonnetWeekly:"Sonnet Weekly",resetsIn:"Resets in {{time}}",resetsAt:"Resets {{time}}",weekProgress:"{{percent}}% through week",unavailable:"Claude Code usage data not available. Make sure you're logged in to Claude Code.",error:"Failed to load usage data: {{message}}"},mTe={title:lTe,tabs:uTe,claude:cTe,system:dTe,processes:fTe,vibora:hTe,usage:pTe},gTe="Tasks",bTe="New Terminal",vTe="All Repos",yTe={title:"Edit Tab",name:"Name",namePlaceholder:"Tab name",directory:"Directory",directoryPlaceholder:"Select a directory...",clearDirectory:"Clear directory",cancel:"Cancel",save:"Save"},_Te={title:"New Tab",create:"Create"},ETe={taskTerminals:gTe,newTerminal:bTe,allRepos:vTe,editTab:yTe,newTab:_Te},STe="Repositories",xTe="{{count}} total",wTe="Search repositories...",TTe="New Task",CTe="Tasks",ATe="Terminal",kTe="Editor",OTe="Settings",RTe="Add Repository",NTe="Scan Directory",ITe="Open in Terminal",DTe="Open in {{editor}}",LTe={openInVSCode:"Open in VS Code"},PTe={title:"Add Repository",description:"Add a git repository from a URL or local path, or scan a directory.",tabs:{add:"Add",scan:"Scan"},inputLabel:"Repository URL or path",inputPlaceholder:"https://github.com/user/repo or /local/path",browse:"Browse...",cloneOptions:"Clone Options",targetDirectory:"Clone to directory",folderName:"Folder name",willCloneTo:"Will clone to",cloning:"Cloning repository...",adding:"Adding...",cloneFailed:"Failed to clone repository",createFailed:"Failed to add repository",cancel:"Cancel",add:"Add",retry:"Retry",fields:{path:"Repository Path",pathPlaceholder:"Select repository...",displayName:"Display Name",startupScript:"Startup Script",startupScriptPlaceholder:"npm install && npm run dev",startupScriptDescription:"Command to run in the terminal when creating a worktree.",copyFiles:"Copy Files",copyFilesPlaceholder:".env, config.local.json",copyFilesDescription:"Comma-separated glob patterns for files to copy into new worktrees.",isCopierTemplate:"Use as Copier Template",isCopierTemplateDescription:"Mark as a template for creating new projects."}},MTe={button:"New Project",title:"Create New Project",back:"Back",next:"Next",create:"Create Project",steps:{template:{description:"Select a template to create your project from.",help:"Copier generates new projects from templates, letting you scaffold applications with pre-configured settings.",learnMore:"Learn more about Copier",savedTemplates:"Saved Templates",selectTemplate:"Select a template...",or:"or",customUrl:"Custom Template URL/Path",customUrlHelp:"Git URL or local path to a Copier template."},questions:{description:"Configure your project.",noQuestions:"This template has no configuration questions."},output:{description:"Choose where to create your project.",projectName:"Project Name",outputDirectory:"Output Directory",selectDirectory:"Select directory...",willCreate:"Will create",trustTemplate:"Trust this template",trustWarning:"This template runs code during project creation. Only enable if you trust the source."},creating:{description:"Creating your project...",inProgress:"Running Copier..."}}},jTe={title:"Scan Directory for Repositories",description:"Find and add multiple git repositories from a directory.",directoryLabel:"Directory to scan",directoryPlaceholder:"Enter directory path",browse:"Browse...",scan:"Scan",foundRepos:"Found {{count}} repositories",selectAll:"Select all",selectNone:"Select none",noReposFound:"No git repositories found in this directory.",alreadyAdded:"Already added",adding:"Adding repositories...",scanFailed:"Failed to scan directory",addFailed:"Failed to add repositories",cancel:"Cancel",addSelected:"Add {{count}} selected"},FTe={noRepositories:"No repositories added yet. Add a repository for quick access when creating tasks.",noMatches:"No repositories match your search."},BTe={failedToLoad:"Failed to load repositories: {{message}}"},UTe={title:STe,total:xTe,searchPlaceholder:wTe,newTask:TTe,viewTasks:CTe,terminal:ATe,editor:kTe,settings:OTe,addRepository:RTe,scanDirectory:NTe,openInTerminal:ITe,openInEditor:DTe,card:LTe,delete:{title:"Delete Repository",description:'This will remove "{{name}}" from Vibora. The actual repository files will not be affected.',button:"Delete",deleting:"Deleting...",alsoDeleteDirectory:"Also delete the directory from disk",deleteDirectoryWarning:"This will permanently delete all files in the repository. This action cannot be undone."},addModal:PTe,newProject:MTe,bulkAdd:jTe,empty:FTe,error:BTe},$Te={save:"保存更改",cancel:"取消",delete:"删除",create:"创建",reset:"重置为默认值",browse:"浏览",clearFilters:"清除筛选"},zTe={loading:"加载中...",saving:"保存中...",saved:"已保存",error:"错误",calculating:"计算中...",validating:"验证中...",creating:"创建中...",deleting:"删除中...",loggingIn:"登录中..."},HTe={justNow:"刚刚",minuteAgo:"1 分钟前",minutesAgo:"{{count}} 分钟前",hourAgo:"1 小时前",hoursAgo:"{{count}} 小时前",dayAgo:"1 天前",daysAgo:"{{count}} 天前"},WTe={one:"{{count}} 个结果",other:"{{count}} 个结果"},VTe={IN_PROGRESS:"进行中",IN_REVIEW:"审核中",DONE:"已完成",CANCELED:"已取消",ORPHANED:"孤立"},GTe={loginTitle:"登录 Vibora",username:"用户名",password:"密码",login:"登录",loginFailed:"登录失败"},qTe={buttons:$Te,status:zTe,time:HTe,results:WTe,statuses:VTe,auth:GTe},KTe={tasks:"任务",terminals:"终端",worktrees:"工作树",repositories:"仓库",review:"审核",monitoring:"监控",settings:"设置",commandPalette:"命令面板 ({{shortcut}})"},YTe={placeholder:"输入命令或搜索...",noResults:"未找到命令",categories:{navigation:"导航",actions:"操作"},commands:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToRepositories:"前往仓库",goToReview:"前往审核",goToMonitoring:"前往监控",goToSettings:"前往设置",newTask:"新建任务",keyboardShortcuts:"键盘快捷键"}},XTe={title:"键盘快捷键",groups:{navigation:"导航",actions:"操作",general:"通用"},labels:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToRepositories:"前往仓库",goToReview:"前往审核",goToMonitoring:"前往监控",goToSettings:"前往设置",commandPalette:"命令面板",newTask:"新建任务",keyboardShortcuts:"键盘快捷键",closeModal:"关闭弹窗"}},ZTe={header:KTe,commandPalette:YTe,shortcuts:XTe},QTe="任务",JTe="搜索",eCe="全部仓库",tCe="新建任务",nCe={title:"创建新任务",description:"创建一个带有 Git 工作树的新任务,用于隔离开发。",fields:{title:"标题",titlePlaceholder:"添加用户认证",description:"描述",descriptionPlaceholder:"实现 OAuth2 登录流程...",aiMode:"AI 模式",repository:"仓库",baseBranch:"基础分支",branchName:"分支名称",branchPlaceholder:"自动生成分支名"},aiModes:{plan:"计划",default:"默认"},tabs:{saved:"仓库",browse:"浏览"},worktreePrefix:"工作树:",branchAutoGenerated:'留空将使用 "{{branch}}"。',selectFolder:"选择文件夹...",searchRepositories:"搜索仓库...",noRepositoriesFound:"未找到仓库",selectRepositoryFirst:"请先选择仓库",loadingBranches:"加载分支中...",selectBranch:"选择分支",current:"(当前)",createTask:"创建任务",errors:{notGitRepo:"所选文件夹不是 Git 仓库",validationFailed:"验证仓库失败",createFailed:"创建任务失败"}},rCe={title:QTe,searchPlaceholder:JTe,allRepos:eCe,newTask:tCe,createModal:nCe},iCe="设置",aCe={server:"服务器",serverDefaults:"服务器与默认设置",paths:"路径",editor:"编辑器",integrations:"集成",zai:"z.ai",notifications:"通知",appearance:"外观",developer:"开发者"},sCe={port:{label:"端口",description:"需要重启"},startupCommand:{label:"启动命令",description:"新任务终端的命令"},gitReposDir:{label:"Git 仓库目录",description:"仓库选择器的起始目录"},editor:{app:{label:"编辑器",description:"用于打开工作树的代码编辑器",options:{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}},host:{label:"远程主机",description:"代码在远程机器上时使用的 SSH 地址",placeholder:"例如:my-server.tailnet.ts.net"},sshPort:{label:"SSH 端口",description:"远程 SSH 端口(默认 22)"}},linear:{label:"Linear",description:"用于工单同步的 API 密钥"},github:{label:"GitHub",description:"用于 Issues 和 PR 的个人访问令牌"},zai:{enable:"启用",apiKey:"API 密钥",description:"配置 Claude Code 使用 z.ai 代理",modelMappings:"模型映射",haiku:"Haiku",sonnet:"Sonnet",opus:"Opus"},language:{label:"语言",description:"界面语言",options:{auto:"自动检测",en:"English",zh:"简体中文"}},theme:{label:"主题",description:"界面颜色主题",options:{system:"跟随系统",light:"浅色",dark:"深色"}},syncClaudeTheme:{label:"同步 Claude Code",description:"当 Vibora 在浅色和深色模式之间切换时自动更新 Claude Code 的主题"},claudeCodeTheme:{light:"浅色模式",dark:"深色模式",options:{light:"浅色","light-ansi":"浅色 ANSI","light-daltonized":"浅色(色盲友好)",dark:"深色","dark-ansi":"深色 ANSI","dark-daltonized":"深色(色盲友好)"}}},oCe={enable:"启用通知",sound:"声音",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"应用令牌",userKey:"用户密钥",testSuccess:"{{channel}} 测试成功",testFailed:"{{channel}} 测试失败:{{error}}",uploadSound:"上传自定义声音",deleteSound:"删除自定义声音",testSound:"测试声音",soundUploaded:"自定义声音已上传",soundUploadFailed:"上传声音失败:{{error}}",soundDeleted:"自定义声音已删除",soundDeleteFailed:"删除自定义声音失败",customSoundActive:"使用自定义声音"},lCe={restartButton:"重启 Vibora",restarting:"重启中...",restartDescription:"重新构建并重启 Vibora 服务器。如果构建失败,服务器将继续运行。",restartFailed:"重启失败",checkLogs:"构建可能失败。运行 journalctl --user -u vibora 查看详情。"},uCe={title:"未保存的更改",description:"您有未保存的更改,离开此页面将丢失这些更改。",stay:"留下",leave:"离开"},cCe={title:iCe,sections:aCe,fields:sCe,notifications:oCe,developer:lCe,unsavedChanges:uCe},dCe="审核",fCe={pullRequests:"拉取请求",issues:"问题"},hCe={pr:{created:"我创建的",assigned:"分配给我的",reviewRequested:"待我审核",mentioned:"提及我的"},issue:{assigned:"分配给我的",created:"我创建的",mentioned:"提及我的"},allOrgs:"所有组织",allOrganizations:"所有组织",viboraReposOnly:"仅 Vibora 仓库"},pCe={tokenRequired:"需要 GitHub 令牌",tokenDescription:"要查看您的问题和拉取请求,请在设置中添加 GitHub 个人访问令牌。",requiredScopes:"所需权限:",scopes:{repo:"(用于私有仓库)",readUser:"(用于用户信息)",readOrg:"(用于组织列表)"},generateToken:"生成令牌",goToSettings:"前往设置"},mCe={loading:"加载中...",failedToLoad:"加载拉取请求失败",empty:{all:"没有打开的拉取请求",created:"没有您创建的拉取请求",assigned:"没有分配给您的拉取请求",reviewRequested:"没有等待您审核的拉取请求",mentioned:"没有提及您的拉取请求"},draft:"草稿"},gCe={loading:"加载中...",failedToLoad:"加载问题失败",empty:{assigned:"没有分配给您的问题",created:"没有您创建的问题",mentioned:"没有提及您的问题"}},bCe={title:dCe,tabs:fCe,filters:hCe,github:pCe,prs:mCe,issues:gCe},vCe="工作树",yCe={total:"共 {{count}} 个",orphaned:"{{count}} 个孤立"},_Ce={button:"清理 ({{count}})",title:"删除已完成的工作树",description:"这将永久删除 {{count}} 个工作树。",linkedTasksWillBeDeleted:"关联的任务也将被删除。",alsoDeleteLinkedTasks:"同时删除关联的任务",done:"已完成",canceled:"已取消",cannotUndo:"此操作无法撤销。"},ECe={noMatch:"没有匹配所选筛选条件的工作树。",noWorktrees:"未找到工作树。工作树在创建任务时自动生成。"},SCe={failedToLoad:"加载工作树失败:{{message}}"},xCe={title:vCe,summary:yCe,cleanup:_Ce,delete:{title:"删除工作树",description:"这将永久删除位于以下位置的工作树目录",linkedTaskWillBeDeleted:'关联的任务 "{{title}}" 也将被删除。',alsoDeleteLinkedTask:'同时删除关联的任务 "{{title}}"',cannotUndo:"此操作无法撤销。",button:"删除 {{count}} 个"},empty:ECe,error:SCe},wCe="监控",TCe={claude:"Claude 实例",system:"系统指标",processes:"进程",vibora:"Vibora 服务器",usage:"使用限额"},CCe={showAllInstances:"显示所有实例",instanceCount:"{{count}} 个实例运行中",totalRam:"总计 {{ram}} MB",headers:{terminal:"终端",task:"任务",ram:"内存",actions:"操作",pid:"PID",workingDirectory:"工作目录",source:"来源"},noTask:"(无任务)",kill:"终止",killing:"终止中...",killSelected:"终止 {{count}} 个已选",source:{vibora:"Vibora: {{name}}",external:"外部"},empty:"没有 Claude 实例运行中",emptyVibora:" (在 Vibora 终端中)",error:"加载 Claude 实例失败:{{message}}"},ACe={cpuUsage:"CPU 使用率",memoryUsage:"内存使用率",memoryLabels:{used:"已使用",cache:"缓存/缓冲区"},diskUsage:"磁盘使用率 ({{path}})",error:"加载系统指标失败:{{message}}"},kCe={topProcesses:"热门进程",sortBy:{memory:"按内存",cpu:"按 CPU"},headers:{pid:"PID",name:"名称",command:"命令",memory:"内存"},empty:"未找到进程",error:"加载进程失败:{{message}}",containers:"容器",containersEmpty:"没有容器运行中",containersUnavailable:"Docker/Podman 不可用"},OCe={description:"运行中的 Vibora 开发服务器",instanceCount:"{{count}} 个实例运行中",headers:{port:"端口",mode:"模式",directory:"目录",ram:"内存",actions:"操作"},mode:{dev:"开发",prod:"生产"},vite:"Vite",kill:"终止",killing:"终止中...",empty:"没有 Vibora 实例运行中",error:"加载 Vibora 实例失败:{{message}}"},RCe={fiveHourBlock:"5小时配额",sevenDayRolling:"7天滚动配额",opusWeekly:"Opus 周配额",sonnetWeekly:"Sonnet 周配额",resetsIn:"{{time}}后重置",resetsAt:"{{time}}重置",weekProgress:"本周已过 {{percent}}%",unavailable:"Claude Code 使用数据不可用。请确保已登录 Claude Code。",error:"加载使用数据失败:{{message}}"},NCe={title:wCe,tabs:TCe,claude:CCe,system:ACe,processes:kCe,vibora:OCe,usage:RCe},ICe="任务",DCe="新建终端",LCe="全部仓库",PCe={taskTerminals:ICe,newTerminal:DCe,allRepos:LCe},MCe="仓库",jCe="共 {{count}} 个",FCe="搜索仓库...",BCe="新建任务",UCe="添加仓库",$Ce="扫描目录",zCe={openInVSCode:"在 VS Code 中打开"},HCe={title:"添加仓库",description:"从 URL 或本地路径添加 Git 仓库,或扫描目录。",tabs:{add:"添加",scan:"扫描"},inputLabel:"仓库 URL 或路径",inputPlaceholder:"https://github.com/user/repo 或 /local/path",browse:"浏览...",cloneOptions:"克隆选项",targetDirectory:"克隆到目录",folderName:"文件夹名称",willCloneTo:"将克隆到",cloning:"正在克隆仓库...",adding:"添加中...",cloneFailed:"克隆仓库失败",createFailed:"添加仓库失败",cancel:"取消",add:"添加",retry:"重试",fields:{path:"仓库路径",pathPlaceholder:"选择仓库...",displayName:"显示名称",startupScript:"启动脚本",startupScriptPlaceholder:"npm install && npm run dev",startupScriptDescription:"创建工作树时在终端中运行的命令。",copyFiles:"复制文件",copyFilesPlaceholder:".env, config.local.json",copyFilesDescription:"用逗号分隔的 glob 模式,用于复制文件到新的工作树。"}},WCe={title:"扫描目录中的仓库",description:"从目录中查找并添加多个 Git 仓库。",directoryLabel:"要扫描的目录",directoryPlaceholder:"输入目录路径",browse:"浏览...",scan:"扫描",foundRepos:"找到 {{count}} 个仓库",selectAll:"全选",selectNone:"取消全选",noReposFound:"此目录中未找到 Git 仓库。",alreadyAdded:"已添加",adding:"正在添加仓库...",scanFailed:"扫描目录失败",addFailed:"添加仓库失败",cancel:"取消",addSelected:"添加 {{count}} 个选中项"},VCe={button:"新建项目",title:"创建新项目",back:"返回",next:"下一步",create:"创建项目",steps:{template:{description:"选择一个模板来创建您的项目。",help:"Copier 从模板生成新项目,让您可以使用预配置的设置快速搭建应用程序。",learnMore:"了解更多关于 Copier",savedTemplates:"已保存的模板",selectTemplate:"选择模板...",or:"或",customUrl:"自定义模板 URL/路径",customUrlHelp:"Copier 模板的 Git URL 或本地路径。"},questions:{description:"配置您的项目。",noQuestions:"此模板没有配置问题。"},output:{description:"选择项目创建位置。",projectName:"项目名称",outputDirectory:"输出目录",selectDirectory:"选择目录...",willCreate:"将创建"},creating:{description:"正在创建您的项目...",inProgress:"正在运行 Copier..."}}},GCe={noRepositories:"尚未添加任何仓库。添加一个仓库以便在创建任务时快速访问。",noMatches:"没有匹配的仓库。"},qCe={failedToLoad:"加载仓库失败:{{message}}"},KCe={title:MCe,total:jCe,searchPlaceholder:FCe,newTask:BCe,addRepository:UCe,scanDirectory:$Ce,card:zCe,delete:{title:"删除仓库",description:'这将从 Vibora 中移除 "{{name}}"。实际的仓库文件不会受到影响。',button:"删除",deleting:"删除中...",alsoDeleteDirectory:"同时从磁盘删除目录",deleteDirectoryWarning:"这将永久删除仓库中的所有文件。此操作无法撤销。"},addModal:HCe,bulkAdd:WCe,newProject:VCe,empty:GCe,error:qCe},YCe="common",rD=["en","zh"],XCe={en:{common:Nwe,navigation:Pwe,tasks:$we,settings:Kwe,review:tTe,worktrees:oTe,monitoring:mTe,terminals:ETe,repositories:UTe},zh:{common:qTe,navigation:ZTe,tasks:rCe,settings:cCe,review:bCe,worktrees:xCe,monitoring:NCe,terminals:PCe,repositories:KCe}};function ZCe(){if(typeof window<"u"){const e=localStorage.getItem("vibora-language");if(e&&rD.includes(e))return e;const t=navigator.language.split("-")[0];if(rD.includes(t))return t}return"en"}Gi.use(Mge).init({resources:XCe,lng:ZCe(),fallbackLng:"en",defaultNS:YCe,ns:["common","navigation","tasks","settings","review","worktrees","monitoring","terminals","repositories"],interpolation:{escapeValue:!1}});Gi.on("languageChanged",e=>{typeof window<"u"&&localStorage.setItem("vibora-language",e)});function zne(){const{i18n:e}=rn(),{data:t,isSuccess:n}=twe(),r=Fne();k.useEffect(()=>{n&&t&&t!==e.language&&e.changeLanguage(t)},[n,t,e]);const i=k.useCallback(async a=>{if(a)await e.changeLanguage(a);else{const s=navigator.language.split("-")[0],o=rD.includes(s)?s:"en";await e.changeLanguage(o)}r.mutate({key:In.LANGUAGE,value:a??""})},[e,r]);return{language:e.language,savedLanguage:t,changeLanguage:i,isUpdating:r.isPending}}function on(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var QCe={};function aw(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:QCe}var Hne=Object.assign,YE=Object.getOwnPropertyDescriptor,Jo=Object.defineProperty,sw=Object.prototype,iD=[];Object.freeze(iD);var FM={};Object.freeze(FM);var JCe=typeof Proxy<"u",eAe=Object.toString();function Wne(){JCe||on("Proxy not available")}function Vne(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var sp=function(){};function is(e){return typeof e=="function"}function Lf(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function ow(e){return e!==null&&typeof e=="object"}function Wc(e){if(!ow(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===eAe}function Gne(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function lw(e,t,n){Jo(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function qne(e,t,n){Jo(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function id(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return ow(r)&&r[n]===!0}}function Mm(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function tAe(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function Ql(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Kne=typeof Object.getOwnPropertySymbols<"u";function nAe(e){var t=Object.keys(e);if(!Kne)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return sw.propertyIsEnumerable.call(e,r)})):t}var uw=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Kne?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Yne(e){return e===null?null:typeof e=="object"?""+e:e}function lu(e,t){return sw.hasOwnProperty.call(e,t)}var rAe=Object.getOwnPropertyDescriptors||function(t){var n={};return uw(t).forEach(function(r){n[r]=YE(t,r)}),n};function Qa(e,t){return!!(e&t)}function Ja(e,t,n){return n?e|=t:e&=~t,e}function Tz(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function iAe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,sAe(r.key),r)}}function jm(e,t,n){return t&&iAe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function op(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=oAe(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
26
26
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vc(){return Vc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vc.apply(null,arguments)}function Xne(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,aD(e,t)}function aD(e,t){return aD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},aD(e,t)}function aAe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function sAe(e){var t=aAe(e,"string");return typeof t=="symbol"?t:t+""}function oAe(e,t){if(e){if(typeof e=="string")return Tz(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tz(e,t):void 0}}var Go=Symbol("mobx-stored-annotations");function el(e){function t(n,r){if(i0(r))return e.decorate_20223_(n,r);r0(n,r,e)}return Object.assign(t,e)}function r0(e,t,n){lu(e,Go)||lw(e,Go,Vc({},e[Go])),pAe(n)||(e[Go][t]=n)}function lAe(e){return lu(e,Go)||lw(e,Go,Vc({},e[Go])),e[Go]}function i0(e){return typeof e=="object"&&typeof e.kind=="string"}var Ft=Symbol("mobx administration"),ad=(function(){function e(n){n===void 0&&(n="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=kn.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return hre(this)},t.reportChanged=function(){va(),pre(this),ya()},t.toString=function(){return this.name_},jm(e,[{key:"isBeingObserved",get:function(){return Qa(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=Ja(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Qa(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=Ja(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Qa(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Ja(this.flags_,e.diffValueMask_,r===1)}}])})();ad.isBeingObservedMask_=1;ad.isPendingUnobservationMask_=2;ad.diffValueMask_=4;var BM=id("Atom",ad);function XE(e,t,n){t===void 0&&(t=sp),n===void 0&&(n=sp);var r=new ad(e);return t!==sp&&bke(r,t),n!==sp&&Sre(r,n),r}function uAe(e,t){return Bre(e,t)}function cAe(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Up={structural:uAe,default:cAe};function Pf(e,t,n){return Are(e)?e:Array.isArray(e)?fr.array(e,{name:n}):Wc(e)?fr.object(e,void 0,{name:n}):Mm(e)?fr.map(e,{name:n}):Ql(e)?fr.set(e,{name:n}):typeof e=="function"&&!$p(e)&&!Lv(e)?Gne(e)?zp(e):Dv(n,e):e}function dAe(e,t,n){if(e==null||Ao(e)||bl(e)||zs(e)||na(e))return e;if(Array.isArray(e))return fr.array(e,{name:n,deep:!1});if(Wc(e))return fr.object(e,void 0,{name:n,deep:!1});if(Mm(e))return fr.map(e,{name:n,deep:!1});if(Ql(e))return fr.set(e,{name:n,deep:!1})}function cw(e){return e}function fAe(e,t){return Bre(e,t)?t:e}var hAe="override";function pAe(e){return e.annotationType_===hAe}function a0(e,t){return{annotationType_:e,options_:t,make_:mAe,extend_:gAe,decorate_20223_:bAe}}function mAe(e,t,n,r){var i;if((i=this.options_)!=null&&i.bound)return this.extend_(e,t,n,!1)===null?0:1;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if($p(n.value))return 1;var a=Zne(e,this,t,n,!1);return Jo(r,t,a),2}function gAe(e,t,n,r){var i=Zne(e,this,t,n);return e.defineProperty_(t,i,r)}function bAe(e,t){var n=t.kind,r=t.name,i=t.addInitializer,a=this,s=function(u){var f,d,p,m;return Gc((f=(d=a.options_)==null?void 0:d.name)!=null?f:r.toString(),u,(p=(m=a.options_)==null?void 0:m.autoAction)!=null?p:!1)};if(n=="field")return function(l){var u,f=l;return $p(f)||(f=s(f)),(u=a.options_)!=null&&u.bound&&(f=f.bind(this),f.isMobxAction=!0),f};if(n=="method"){var o;return $p(e)||(e=s(e)),(o=this.options_)!=null&&o.bound&&i(function(){var l=this,u=l[r].bind(l);u.isMobxAction=!0,l[r]=u}),e}on("Cannot apply '"+a.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
27
27
  '`+a.annotationType_+"' can only be used on properties with a function value."))}function vAe(e,t,n,r){t.annotationType_,r.value}function Zne(e,t,n,r,i){var a,s,o,l,u,f,d;i===void 0&&(i=ut.safeDescriptors),vAe(e,t,n,r);var p=r.value;if((a=t.options_)!=null&&a.bound){var m;p=p.bind((m=e.proxy_)!=null?m:e.target_)}return{value:Gc((s=(o=t.options_)==null?void 0:o.name)!=null?s:n.toString(),p,(l=(u=t.options_)==null?void 0:u.autoAction)!=null?l:!1,(f=t.options_)!=null&&f.bound?(d=e.proxy_)!=null?d:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Qne(e,t){return{annotationType_:e,options_:t,make_:yAe,extend_:_Ae,decorate_20223_:EAe}}function yAe(e,t,n,r){var i;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!lu(e.target_,t)||!Lv(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(Lv(n.value))return 1;var a=Jne(e,this,t,n,!1,!1);return Jo(r,t,a),2}function _Ae(e,t,n,r){var i,a=Jne(e,this,t,n,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,a,r)}function EAe(e,t){var n,r=t.name,i=t.addInitializer;return Lv(e)||(e=zp(e)),(n=this.options_)!=null&&n.bound&&i(function(){var a=this,s=a[r].bind(a);s.isMobXFlow=!0,a[r]=s}),e}function SAe(e,t,n,r){t.annotationType_,r.value}function Jne(e,t,n,r,i,a){a===void 0&&(a=ut.safeDescriptors),SAe(e,t,n,r);var s=r.value;if(Lv(s)||(s=zp(s)),i){var o;s=s.bind((o=e.proxy_)!=null?o:e.target_),s.isMobXFlow=!0}return{value:s,configurable:a?e.isPlainObject_:!0,enumerable:!1,writable:!a}}function UM(e,t){return{annotationType_:e,options_:t,make_:xAe,extend_:wAe,decorate_20223_:TAe}}function xAe(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function wAe(e,t,n,r){return CAe(e,this,t,n),e.defineComputedProperty_(t,Vc({},this.options_,{get:n.get,set:n.set}),r)}function TAe(e,t){var n=this,r=t.name,i=t.addInitializer;return i(function(){var a=Bm(this)[Ft],s=Vc({},n.options_,{get:e,context:this});s.name||(s.name="ObservableObject."+r.toString()),a.values_.set(r,new mo(s))}),function(){return this[Ft].getObservablePropValue_(r)}}function CAe(e,t,n,r){t.annotationType_,r.get}function dw(e,t){return{annotationType_:e,options_:t,make_:AAe,extend_:kAe,decorate_20223_:OAe}}function AAe(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function kAe(e,t,n,r){var i,a;return RAe(e,this),e.defineObservableProperty_(t,n.value,(i=(a=this.options_)==null?void 0:a.enhancer)!=null?i:Pf,r)}function OAe(e,t){var n=this,r=t.kind,i=t.name,a=new WeakSet;function s(o,l){var u,f,d=Bm(o)[Ft],p=new Fc(l,(u=(f=n.options_)==null?void 0:f.enhancer)!=null?u:Pf,"ObservableObject."+i.toString(),!1);d.values_.set(i,p),a.add(o)}if(r=="accessor")return{get:function(){return a.has(this)||s(this,e.get.call(this)),this[Ft].getObservablePropValue_(i)},set:function(l){return a.has(this)||s(this,l),this[Ft].setObservablePropValue_(i,l)},init:function(l){return a.has(this)||s(this,l),l}}}function RAe(e,t,n,r){t.annotationType_}var NAe="true",IAe=ere();function ere(e){return{annotationType_:NAe,options_:e,make_:DAe,extend_:LAe,decorate_20223_:PAe}}function DAe(e,t,n,r){var i,a;if(n.get)return Fm.make_(e,t,n,r);if(n.set){var s=$p(n.set)?n.set:Gc(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:ut.safeDescriptors?e.isPlainObject_:!0,set:s})===null?0:2:(Jo(r,t,{configurable:!0,set:s}),2)}if(r!==e.target_&&typeof n.value=="function"){var o;if(Gne(n.value)){var l,u=(l=this.options_)!=null&&l.autoBind?zp.bound:zp;return u.make_(e,t,n,r)}var f=(o=this.options_)!=null&&o.autoBind?Dv.bound:Dv;return f.make_(e,t,n,r)}var d=((i=this.options_)==null?void 0:i.deep)===!1?fr.ref:fr;if(typeof n.value=="function"&&(a=this.options_)!=null&&a.autoBind){var p;n.value=n.value.bind((p=e.proxy_)!=null?p:e.target_)}return d.make_(e,t,n,r)}function LAe(e,t,n,r){var i,a;if(n.get)return Fm.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:ut.safeDescriptors?e.isPlainObject_:!0,set:Gc(t.toString(),n.set)},r);if(typeof n.value=="function"&&(i=this.options_)!=null&&i.autoBind){var s;n.value=n.value.bind((s=e.proxy_)!=null?s:e.target_)}var o=((a=this.options_)==null?void 0:a.deep)===!1?fr.ref:fr;return o.extend_(e,t,n,r)}function PAe(e,t){on("'"+this.annotationType_+"' cannot be used as a decorator")}var MAe="observable",jAe="observable.ref",FAe="observable.shallow",BAe="observable.struct",tre={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(tre);function T_(e){return e||tre}var sD=dw(MAe),UAe=dw(jAe,{enhancer:cw}),$Ae=dw(FAe,{enhancer:dAe}),zAe=dw(BAe,{enhancer:fAe}),nre=el(sD);function C_(e){return e.deep===!0?Pf:e.deep===!1?cw:WAe(e.defaultDecorator)}function HAe(e){var t;return e?(t=e.defaultDecorator)!=null?t:ere(e):void 0}function WAe(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:Pf}function rre(e,t,n){if(i0(t))return sD.decorate_20223_(e,t);if(Lf(t)){r0(e,t,sD);return}return Are(e)?e:Wc(e)?fr.object(e,t,n):Array.isArray(e)?fr.array(e,t):Mm(e)?fr.map(e,t):Ql(e)?fr.set(e,t):typeof e=="object"&&e!==null?e:fr.box(e,t)}Hne(rre,nre);var VAe={box:function(t,n){var r=T_(n);return new Fc(t,C_(r),r.name,!0,r.equals)},array:function(t,n){var r=T_(n);return(ut.useProxies===!1||r.proxy===!1?qke:jke)(t,C_(r),r.name)},map:function(t,n){var r=T_(n);return new GM(t,C_(r),r.name)},set:function(t,n){var r=T_(n);return new Lre(t,C_(r),r.name)},object:function(t,n,r){return Zf(function(){return Eke(ut.useProxies===!1||r?.proxy===!1?Bm({},r):Lke({},r),t,n)})},ref:el(UAe),shallow:el($Ae),deep:nre,struct:el(zAe)},fr=Hne(rre,VAe),ire="computed",GAe="computed.struct",oD=UM(ire),qAe=UM(GAe,{equals:Up.structural}),Fm=function(t,n){if(i0(n))return oD.decorate_20223_(t,n);if(Lf(n))return r0(t,n,oD);if(Wc(t))return el(UM(ire,t));var r=Wc(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new mo(r)};Object.assign(Fm,oD);Fm.struct=el(qAe);var Cz,Az,ZE=0,KAe=1,YAe=(Cz=(Az=YE(function(){},"name"))==null?void 0:Az.configurable)!=null?Cz:!1,kz={value:"action",configurable:!0,writable:!1,enumerable:!1};function Gc(e,t,n,r){n===void 0&&(n=!1);function i(){return are(e,n,t,r||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},YAe&&(kz.value=e,Jo(i,"name",kz)),i}function are(e,t,n,r,i){var a=XAe(e,t);try{return n.apply(r,i)}catch(s){throw a.error_=s,s}finally{ZAe(a)}}function XAe(e,t,n,r){var i=!1,a=0,s=ut.trackingDerivation,o=!t||!s;va();var l=ut.allowStateChanges;o&&(Xf(),l=fw(!0));var u=$M(!0),f={runAsAction_:o,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:i,startTime_:a,actionId_:KAe++,parentActionId_:ZE};return ZE=f.actionId_,f}function ZAe(e){ZE!==e.actionId_&&on(30),ZE=e.parentActionId_,e.error_!==void 0&&(ut.suppressReactionErrors=!0),hw(e.prevAllowStateChanges_),Wb(e.prevAllowStateReads_),ya(),e.runAsAction_&&uu(e.prevDerivation_),ut.suppressReactionErrors=!1}function sre(e,t){var n=fw(e);try{return t()}finally{hw(n)}}function fw(e){var t=ut.allowStateChanges;return ut.allowStateChanges=e,t}function hw(e){ut.allowStateChanges=e}var Fc=(function(e){function t(r,i,a,s,o){var l;return a===void 0&&(a="ObservableValue"),o===void 0&&(o=Up.default),l=e.call(this,a)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=i,l.name_=a,l.equals=o,l.value_=i(r,void 0,a),l}Xne(t,e);var n=t.prototype;return n.dehanceValue=function(i){return this.dehancer!==void 0?this.dehancer(i):i},n.set=function(i){this.value_,i=this.prepareNewValue_(i),i!==ut.UNCHANGED&&this.setNewValue_(i)},n.prepareNewValue_=function(i){if(ks(this)){var a=Os(this,{object:this,type:tl,newValue:i});if(!a)return ut.UNCHANGED;i=a.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?ut.UNCHANGED:i},n.setNewValue_=function(i){var a=this.value_;this.value_=i,this.reportChanged(),lo(this)&&uo(this,{type:tl,object:this,newValue:i,oldValue:a})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(i){return s0(this,i)},n.observe_=function(i,a){return a&&i({observableKind:"value",debugObjectName:this.name_,object:this,type:tl,newValue:this.value_,oldValue:void 0}),o0(this,i)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return Yne(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t})(ad),QAe=id("ObservableValue",Fc),mo=(function(){function e(n){this.dependenciesState_=kn.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=kn.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new JE(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=QE.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||on(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=Gc("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?Up.structural:Up.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){ike(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&on(32,this.name_,this.derivation),ut.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)lD(this)&&(this.warnAboutUntrackedRead_(),va(),this.value_=this.computeValue_(!1),ya());else if(hre(this),lD(this)){var r=ut.trackingContext;this.keepAlive_&&!r&&(ut.trackingContext=this),this.trackAndCompute()&&rke(this),ut.trackingContext=r}var i=this.value_;if(fE(i))throw i.cause;return i},t.set=function(r){if(this.setter_){this.isRunningSetter&&on(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else on(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,i=this.dependenciesState_===kn.NOT_TRACKING_,a=this.computeValue_(!0),s=i||fE(r)||fE(a)||!this.equals_(r,a);return s&&(this.value_=a),s},t.computeValue_=function(r){this.isComputing=!0;var i=fw(!1),a;if(r)a=ore(this,this.derivation,this.scope_);else if(ut.disableErrorBoundaries===!0)a=this.derivation.call(this.scope_);else try{a=this.derivation.call(this.scope_)}catch(s){a=new JE(s)}return hw(i),this.isComputing=!1,a},t.suspend_=function(){this.keepAlive_||(uD(this),this.value_=void 0)},t.observe_=function(r,i){var a=this,s=!0,o=void 0;return _re(function(){var l=a.get();if(!s||i){var u=Xf();r({observableKind:"computed",debugObjectName:a.name_,type:tl,object:a,newValue:l,oldValue:o}),uu(u)}s=!1,o=l})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Yne(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},jm(e,[{key:"isComputing",get:function(){return Qa(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=Ja(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return Qa(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=Ja(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return Qa(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=Ja(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Qa(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=Ja(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Qa(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Ja(this.flags_,e.diffValueMask_,r===1)}}])})();mo.isComputingMask_=1;mo.isRunningSetterMask_=2;mo.isBeingObservedMask_=4;mo.isPendingUnobservationMask_=8;mo.diffValueMask_=16;var pw=id("ComputedValue",mo),kn;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(kn||(kn={}));var QE;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(QE||(QE={}));var JE=function(t){this.cause=void 0,this.cause=t};function fE(e){return e instanceof JE}function lD(e){switch(e.dependenciesState_){case kn.UP_TO_DATE_:return!1;case kn.NOT_TRACKING_:case kn.STALE_:return!0;case kn.POSSIBLY_STALE_:{for(var t=$M(!0),n=Xf(),r=e.observing_,i=r.length,a=0;a<i;a++){var s=r[a];if(pw(s)){if(ut.disableErrorBoundaries)s.get();else try{s.get()}catch{return uu(n),Wb(t),!0}if(e.dependenciesState_===kn.STALE_)return uu(n),Wb(t),!0}}return ure(e),uu(n),Wb(t),!1}}}function ore(e,t,n){var r=$M(!0);ure(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++ut.runId;var i=ut.trackingDerivation;ut.trackingDerivation=e,ut.inBatch++;var a;if(ut.disableErrorBoundaries===!0)a=t.call(n);else try{a=t.call(n)}catch(s){a=new JE(s)}return ut.inBatch--,ut.trackingDerivation=i,JAe(e),Wb(r),a}function JAe(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=kn.UP_TO_DATE_,i=0,a=e.unboundDepsCount_,s=0;s<a;s++){var o=n[s];o.diffValue===0&&(o.diffValue=1,i!==s&&(n[i]=o),i++),o.dependenciesState_>r&&(r=o.dependenciesState_)}for(n.length=i,e.newObserving_=null,a=t.length;a--;){var l=t[a];l.diffValue===0&&dre(l,e),l.diffValue=0}for(;i--;){var u=n[i];u.diffValue===1&&(u.diffValue=0,nke(u,e))}r!==kn.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function uD(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)dre(t[n],e);e.dependenciesState_=kn.NOT_TRACKING_}function lre(e){var t=Xf();try{return e()}finally{uu(t)}}function Xf(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function uu(e){ut.trackingDerivation=e}function $M(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function Wb(e){ut.allowStateReads=e}function ure(e){if(e.dependenciesState_!==kn.UP_TO_DATE_){e.dependenciesState_=kn.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=kn.UP_TO_DATE_}}var hE=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},pE=!0,cre=!1,ut=(function(){var e=aw();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(pE=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new hE().version&&(pE=!1),pE?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new hE):(setTimeout(function(){cre||on(35)},1),new hE)})();function eke(){if((ut.pendingReactions.length||ut.inBatch||ut.isRunningReactions)&&on(36),cre=!0,pE){var e=aw();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),ut=new hE}}function tke(){return ut}function nke(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function dre(e,t){e.observers_.delete(t),e.observers_.size===0&&fre(e)}function fre(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,ut.pendingUnobservations.push(e))}function va(){ut.inBatch++}function ya(){if(--ut.inBatch===0){mre();for(var e=ut.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof mo&&n.suspend_())}ut.pendingUnobservations=[]}}function hre(e){var t=ut.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&ut.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&ut.inBatch>0&&fre(e),!1)}function pre(e){e.lowestObserverState_!==kn.STALE_&&(e.lowestObserverState_=kn.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===kn.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=kn.STALE_}))}function rke(e){e.lowestObserverState_!==kn.STALE_&&(e.lowestObserverState_=kn.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===kn.POSSIBLY_STALE_?t.dependenciesState_=kn.STALE_:t.dependenciesState_===kn.UP_TO_DATE_&&(e.lowestObserverState_=kn.UP_TO_DATE_)}))}function ike(e){e.lowestObserverState_===kn.UP_TO_DATE_&&(e.lowestObserverState_=kn.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===kn.UP_TO_DATE_&&(t.dependenciesState_=kn.POSSIBLY_STALE_,t.onBecomeStale_())}))}var ul=(function(){function e(n,r,i,a){n===void 0&&(n="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=kn.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=QE.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=i,this.requiresObservable_=a}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,ut.pendingReactions.push(this),mre())},t.runReaction_=function(){if(!this.isDisposed){va(),this.isScheduled=!1;var r=ut.trackingContext;if(ut.trackingContext=this,lD(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(i){this.reportExceptionInDerivation_(i)}}ut.trackingContext=r,ya()}},t.track=function(r){if(!this.isDisposed){va(),this.isRunning=!0;var i=ut.trackingContext;ut.trackingContext=this;var a=ore(this,r,void 0);ut.trackingContext=i,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&uD(this),fE(a)&&this.reportExceptionInDerivation_(a.cause),ya()}},t.reportExceptionInDerivation_=function(r){var i=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(ut.disableErrorBoundaries)throw r;var a="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(a,r),ut.globalReactionErrorHandlers.forEach(function(s){return s(r,i)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(va(),uD(this),ya()))},t.getDisposer_=function(r){var i=this,a=function s(){i.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",s)};return r==null||r.addEventListener==null||r.addEventListener("abort",a),a[Ft]=this,"dispose"in Symbol&&typeof Symbol.dispose=="symbol"&&(a[Symbol.dispose]=a),a},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){},jm(e,[{key:"isDisposed",get:function(){return Qa(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=Ja(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return Qa(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=Ja(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return Qa(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=Ja(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return Qa(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=Ja(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return Qa(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Ja(this.flags_,e.diffValueMask_,r===1)}}])})();ul.isDisposedMask_=1;ul.isScheduledMask_=2;ul.isTrackPendingMask_=4;ul.isRunningMask_=8;ul.diffValueMask_=16;var ake=100,cD=function(t){return t()};function mre(){ut.inBatch>0||ut.isRunningReactions||cD(ske)}function ske(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===ake&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].runReaction_()}ut.isRunningReactions=!1}var eS=id("Reaction",ul);function oke(e){var t=cD;cD=function(r){return e(function(){return t(r)})}}function Vb(){return!1}function lke(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var gre="action",uke="action.bound",bre="autoAction",cke="autoAction.bound",vre="<unnamed action>",dD=a0(gre),dke=a0(uke,{bound:!0}),fD=a0(bre,{autoAction:!0}),fke=a0(cke,{autoAction:!0,bound:!0});function yre(e){var t=function(r,i){if(is(r))return Gc(r.name||vre,r,e);if(is(i))return Gc(r,i,e);if(i0(i))return(e?fD:dD).decorate_20223_(r,i);if(Lf(i))return r0(r,i,e?fD:dD);if(Lf(r))return el(a0(e?bre:gre,{name:r,autoAction:e}))};return t}var ti=yre(!1);Object.assign(ti,dD);var Dv=yre(!0);Object.assign(Dv,fD);ti.bound=el(dke);Dv.bound=el(fke);function Oz(e){return are(e.name||vre,!1,e,this,void 0)}function $p(e){return is(e)&&e.isMobxAction===!0}function _re(e,t){var n,r,i,a;t===void 0&&(t=FM);var s=(n=(r=t)==null?void 0:r.name)!=null?n:"Autorun",o=!t.scheduler&&!t.delay,l;if(o)l=new ul(s,function(){this.track(d)},t.onError,t.requiresObservable);else{var u=Ere(t),f=!1;l=new ul(s,function(){f||(f=!0,u(function(){f=!1,l.isDisposed||l.track(d)}))},t.onError,t.requiresObservable)}function d(){e(l)}return(i=t)!=null&&(i=i.signal)!=null&&i.aborted||l.schedule_(),l.getDisposer_((a=t)==null?void 0:a.signal)}var hke=function(t){return t()};function Ere(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:hke}function zM(e,t,n){var r,i,a;n===void 0&&(n=FM);var s=(r=n.name)!=null?r:"Reaction",o=ti(s,n.onError?pke(n.onError,t):t),l=!n.scheduler&&!n.delay,u=Ere(n),f=!0,d=!1,p,m=n.compareStructural?Up.structural:n.equals||Up.default,E=new ul(s,function(){f||l?S():d||(d=!0,u(S))},n.onError,n.requiresObservable);function S(){if(d=!1,!E.isDisposed){var g=!1,y=p;E.track(function(){var v=sre(!1,function(){return e(E)});g=f||!m(p,v),p=v}),(f&&n.fireImmediately||!f&&g)&&o(p,y,E),f=!1}}return(i=n)!=null&&(i=i.signal)!=null&&i.aborted||E.schedule_(),E.getDisposer_((a=n)==null?void 0:a.signal)}function pke(e,t){return function(){try{return t.apply(this,arguments)}catch(n){e.call(this,n)}}}var mke="onBO",gke="onBUO";function bke(e,t,n){return xre(mke,e,t,n)}function Sre(e,t,n){return xre(gke,e,t,n)}function xre(e,t,n,r){var i=Hp(t),a=is(r)?r:n,s=e+"L";return i[s]?i[s].add(a):i[s]=new Set([a]),function(){var o=i[s];o&&(o.delete(a),o.size===0&&delete i[s])}}var vke="never",A_="always",yke="observed";function _ke(e){e.isolateGlobalState===!0&&eke();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(ut.useProxies=t===A_?!0:t===vke?!1:typeof Proxy<"u"),t==="ifavailable"&&(ut.verifyProxies=!0),n!==void 0){var r=n===A_?A_:n===yke;ut.enforceActions=r,ut.allowStateChanges=!(r===!0||r===A_)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(ut[i]=!!e[i])}),ut.allowStateReads=!ut.observableRequiresReaction,e.reactionScheduler&&oke(e.reactionScheduler)}function Eke(e,t,n,r){var i=rAe(t);return Zf(function(){var a=Bm(e,r)[Ft];uw(i).forEach(function(s){a.extend_(s,i[s],n&&s in n?n[s]:!0)})}),e}function Ske(e,t){return wre(Hp(e,t))}function wre(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=xke(e.observing_).map(wre)),t}function xke(e){return Array.from(new Set(e))}var wke=0;function Tre(){this.message="FLOW_CANCELLED"}Tre.prototype=Object.create(Error.prototype);var vk=Qne("flow"),Tke=Qne("flow.bound",{bound:!0}),zp=Object.assign(function(t,n){if(i0(n))return vk.decorate_20223_(t,n);if(Lf(n))return r0(t,n,vk);var r=t,i=r.name||"<unnamed flow>",a=function(){var o=this,l=arguments,u=++wke,f=ti(i+" - runid: "+u+" - init",r).apply(o,l),d,p=void 0,m=new Promise(function(E,S){var g=0;d=S;function y(T){p=void 0;var w;try{w=ti(i+" - runid: "+u+" - yield "+g++,f.next).call(f,T)}catch(C){return S(C)}x(w)}function v(T){p=void 0;var w;try{w=ti(i+" - runid: "+u+" - yield "+g++,f.throw).call(f,T)}catch(C){return S(C)}x(w)}function x(T){if(is(T?.then)){T.then(x,S);return}return T.done?E(T.value):(p=Promise.resolve(T.value),p.then(y,v))}y(void 0)});return m.cancel=ti(i+" - runid: "+u+" - cancel",function(){try{p&&Rz(p);var E=f.return(void 0),S=Promise.resolve(E.value);S.then(sp,sp),Rz(S),d(new Tre)}catch(g){d(g)}}),m};return a.isMobXFlow=!0,a},vk);zp.bound=el(Tke);function Rz(e){is(e.cancel)&&e.cancel()}function Lv(e){return e?.isMobXFlow===!0}function Cre(e,t,n){var r;return zs(e)||bl(e)||QAe(e)?r=cl(e):Ao(e)&&(r=cl(e,t)),r.dehancer=typeof t=="function"?t:n,function(){r.dehancer=void 0}}function HM(e,t,n){return is(n)?Ake(e,t,n):Cke(e,t)}function Cke(e,t){return cl(e).intercept_(t)}function Ake(e,t,n){return cl(e,t).intercept_(n)}function kke(e,t){return e?Ao(e)||!!e[Ft]||BM(e)||eS(e)||pw(e):!1}function Are(e){return kke(e)}function tS(e){if(Ao(e))return e[Ft].keys_();if(zs(e)||na(e))return Array.from(e.keys());if(bl(e))return e.map(function(t,n){return n});on(5)}function kre(e){if(Ao(e))return tS(e).map(function(t){return e[t]});if(zs(e))return tS(e).map(function(t){return e.get(t)});if(na(e))return Array.from(e.values());if(bl(e))return e.slice();on(6)}function Oke(e){if(Ao(e))return tS(e).map(function(t){return[t,e[t]]});if(zs(e))return tS(e).map(function(t){return[t,e.get(t)]});if(na(e))return Array.from(e.entries());if(bl(e))return e.map(function(t,n){return[n,t]});on(7)}function Ore(e,t,n){if(arguments.length===2&&!na(e)){va();var r=t;try{for(var i in r)Ore(e,i,r[i])}finally{ya()}return}Ao(e)?e[Ft].set_(t,n):zs(e)?e.set(t,n):na(e)?e.add(t):bl(e)?(typeof t!="number"&&(t=parseInt(t,10)),t<0&&on("Invalid index: '"+t+"'"),va(),t>=e.length&&(e.length=t+1),e[t]=n,ya()):on(8)}function Rre(e,t,n){if(Ao(e))return e[Ft].defineProperty_(t,n);on(39)}function WM(e,t,n,r){return is(n)?Nke(e,t,n,r):Rke(e,t,n)}function Rke(e,t,n){return cl(e).observe_(t,n)}function Nke(e,t,n,r){return cl(e,t).observe_(n,r)}function Jl(e,t){t===void 0&&(t=void 0),va();try{return e.apply(t)}finally{ya()}}function Nz(e,t,n){return arguments.length===1||t&&typeof t=="object"?Ike(e,t):Nre(e,t,{})}function Nre(e,t,n){var r;if(typeof n.timeout=="number"){var i=new Error("WHEN_TIMEOUT");r=setTimeout(function(){if(!s[Ft].isDisposed)if(s(),n.onError)n.onError(i);else throw i},n.timeout)}n.name="When";var a=Gc("When-effect",t),s=_re(function(o){var l=sre(!1,e);l&&(o.dispose(),r&&clearTimeout(r),a())},n);return s}function Ike(e,t){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var r,i,a=new Promise(function(s,o){var l,u=Nre(e,s,Vc({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},t==null||(l=t.signal)==null||l.addEventListener==null||l.addEventListener("abort",i)}).finally(function(){var s;return t==null||(s=t.signal)==null||s.removeEventListener==null?void 0:s.removeEventListener("abort",i)});return a.cancel=r,a}function Yh(e){return e[Ft]}var Dke={has:function(t,n){return Yh(t).has_(n)},get:function(t,n){return Yh(t).get_(n)},set:function(t,n,r){var i;return Lf(n)?(i=Yh(t).set_(n,r,!0))!=null?i:!0:!1},deleteProperty:function(t,n){var r;return Lf(n)?(r=Yh(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var i;return(i=Yh(t).defineProperty_(n,r))!=null?i:!0},ownKeys:function(t){return Yh(t).ownKeys_()},preventExtensions:function(t){on(13)}};function Lke(e,t){var n,r;return Wne(),e=Bm(e,t),(r=(n=e[Ft]).proxy_)!=null?r:n.proxy_=new Proxy(e,Dke)}function ks(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function s0(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),Vne(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function Os(e,t){var n=Xf();try{for(var r=[].concat(e.interceptors_||[]),i=0,a=r.length;i<a&&(t=r[i](t),t&&!t.type&&on(14),!!t);i++);return t}finally{uu(n)}}function lo(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function o0(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),Vne(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function uo(e,t){var n=Xf(),r=e.changeListeners_;if(r){r=r.slice();for(var i=0,a=r.length;i<a;i++)r[i](t);uu(n)}}function Ire(e,t,n){return Zf(function(){var r,i=Bm(e,n)[Ft];(r=t)!=null||(t=lAe(e)),uw(t).forEach(function(a){return i.make_(a,t[a])})}),e}var Iz="splice",tl="update",Pke=1e4,Mke={get:function(t,n){var r=t[Ft];return n===Ft?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):lu(nS,n)?nS[n]:t[n]},set:function(t,n,r){var i=t[Ft];return n==="length"&&i.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:i.set_(parseInt(n),r),!0},preventExtensions:function(){on(15)}},VM=(function(){function e(n,r,i,a){n===void 0&&(n="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=a,this.atom_=new ad(n),this.enhancer_=function(s,o){return r(s,o,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return s0(this,r)},t.observe_=function(r,i){return i===void 0&&(i=!1),i&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),o0(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&on("Out of range: "+r);var i=this.values_.length;if(r!==i)if(r>i){for(var a=new Array(r-i),s=0;s<r-i;s++)a[s]=void 0;this.spliceWithArray_(i,0,a)}else this.spliceWithArray_(r,i-r)},t.updateArrayLength_=function(r,i){r!==this.lastKnownLength_&&on(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&Fre(r+i+1)},t.spliceWithArray_=function(r,i,a){var s=this;this.atom_;var o=this.values_.length;if(r===void 0?r=0:r>o?r=o:r<0&&(r=Math.max(0,o+r)),arguments.length===1?i=o-r:i==null?i=0:i=Math.max(0,Math.min(i,o-r)),a===void 0&&(a=iD),ks(this)){var l=Os(this,{object:this.proxy_,type:Iz,index:r,removedCount:i,added:a});if(!l)return iD;i=l.removedCount,a=l.added}if(a=a.length===0?a:a.map(function(d){return s.enhancer_(d,void 0)}),this.legacyMode_){var u=a.length-i;this.updateArrayLength_(o,u)}var f=this.spliceItemsIntoValues_(r,i,a);return(i!==0||a.length!==0)&&this.notifyArraySplice_(r,a,f),this.dehanceValues_(f)},t.spliceItemsIntoValues_=function(r,i,a){if(a.length<Pke){var s;return(s=this.values_).splice.apply(s,[r,i].concat(a))}else{var o=this.values_.slice(r,r+i),l=this.values_.slice(r+i);this.values_.length+=a.length-i;for(var u=0;u<a.length;u++)this.values_[r+u]=a[u];for(var f=0;f<l.length;f++)this.values_[r+a.length+f]=l[f];return o}},t.notifyArrayChildUpdate_=function(r,i,a){var s=!this.owned_&&Vb(),o=lo(this),l=o||s?{observableKind:"array",object:this.proxy_,type:tl,debugObjectName:this.atom_.name_,index:r,newValue:i,oldValue:a}:null;this.atom_.reportChanged(),o&&uo(this,l)},t.notifyArraySplice_=function(r,i,a){var s=!this.owned_&&Vb(),o=lo(this),l=o||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Iz,index:r,removed:a,added:i,removedCount:a.length,addedCount:i.length}:null;this.atom_.reportChanged(),o&&uo(this,l)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,i){var a=this.values_;if(this.legacyMode_&&r>a.length&&on(17,r,a.length),r<a.length){this.atom_;var s=a[r];if(ks(this)){var o=Os(this,{type:tl,object:this.proxy_,index:r,newValue:i});if(!o)return;i=o.newValue}i=this.enhancer_(i,s);var l=i!==s;l&&(a[r]=i,this.notifyArrayChildUpdate_(r,i,s))}else{for(var u=new Array(r+1-a.length),f=0;f<u.length-1;f++)u[f]=void 0;u[u.length-1]=i,this.spliceWithArray_(a.length,0,u)}},e})();function jke(e,t,n,r){return n===void 0&&(n="ObservableArray"),r===void 0&&(r=!1),Wne(),Zf(function(){var i=new VM(n,t,r,!1);qne(i.values_,Ft,i);var a=new Proxy(i.values_,Mke);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var nS={clear:function(){return this.splice(0)},replace:function(t){var n=this[Ft];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a];var s=this[Ft];switch(arguments.length){case 0:return[];case 1:return s.spliceWithArray_(t);case 2:return s.spliceWithArray_(t,n)}return s.spliceWithArray_(t,n,i)},spliceWithArray:function(t,n,r){return this[Ft].spliceWithArray_(t,n,r)},push:function(){for(var t=this[Ft],n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.spliceWithArray_(t.values_.length,0,r),t.values_.length},pop:function(){return this.splice(Math.max(this[Ft].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[Ft],n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.spliceWithArray_(0,0,r),t.values_.length},reverse:function(){return ut.trackingDerivation&&on(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){ut.trackingDerivation&&on(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[Ft],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};er("at",os);er("concat",os);er("flat",os);er("includes",os);er("indexOf",os);er("join",os);er("lastIndexOf",os);er("slice",os);er("toString",os);er("toLocaleString",os);er("toSorted",os);er("toSpliced",os);er("with",os);er("every",Co);er("filter",Co);er("find",Co);er("findIndex",Co);er("findLast",Co);er("findLastIndex",Co);er("flatMap",Co);er("forEach",Co);er("map",Co);er("some",Co);er("toReversed",Co);er("reduce",Dre);er("reduceRight",Dre);function er(e,t){typeof Array.prototype[e]=="function"&&(nS[e]=t(e))}function os(e){return function(){var t=this[Ft];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Co(e){return function(t,n){var r=this,i=this[Ft];i.atom_.reportObserved();var a=i.dehanceValues_(i.values_);return a[e](function(s,o){return t.call(n,s,o,r)})}}function Dre(e){return function(){var t=this,n=this[Ft];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(a,s,o){return i(a,s,o,t)},r[e].apply(r,arguments)}}var Fke=id("ObservableArrayAdministration",VM);function bl(e){return ow(e)&&Fke(e[Ft])}var Bke={},Cc="add",rS="delete",GM=(function(){function e(n,r,i){var a=this;r===void 0&&(r=Pf),i===void 0&&(i="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[Ft]=Bke,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=r,this.name_=i,is(Map)||on(18),Zf(function(){a.keysAtom_=XE("ObservableMap.keys()"),a.data_=new Map,a.hasMap_=new Map,n&&a.merge(n)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var i=this;if(!ut.trackingDerivation)return this.has_(r);var a=this.hasMap_.get(r);if(!a){var s=a=new Fc(this.has_(r),cw,"ObservableMap.key?",!1);this.hasMap_.set(r,s),Sre(s,function(){return i.hasMap_.delete(r)})}return a.get()},t.set=function(r,i){var a=this.has_(r);if(ks(this)){var s=Os(this,{type:a?tl:Cc,object:this,newValue:i,name:r});if(!s)return this;i=s.newValue}return a?this.updateValue_(r,i):this.addValue_(r,i),this},t.delete=function(r){var i=this;if(this.keysAtom_,ks(this)){var a=Os(this,{type:rS,object:this,name:r});if(!a)return!1}if(this.has_(r)){var s=Vb(),o=lo(this),l=o||s?{observableKind:"map",debugObjectName:this.name_,type:rS,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return Jl(function(){var u;i.keysAtom_.reportChanged(),(u=i.hasMap_.get(r))==null||u.setNewValue_(!1);var f=i.data_.get(r);f.setNewValue_(void 0),i.data_.delete(r)}),o&&uo(this,l),!0}return!1},t.updateValue_=function(r,i){var a=this.data_.get(r);if(i=a.prepareNewValue_(i),i!==ut.UNCHANGED){var s=Vb(),o=lo(this),l=o||s?{observableKind:"map",debugObjectName:this.name_,type:tl,object:this,oldValue:a.value_,name:r,newValue:i}:null;a.setNewValue_(i),o&&uo(this,l)}},t.addValue_=function(r,i){var a=this;this.keysAtom_,Jl(function(){var u,f=new Fc(i,a.enhancer_,"ObservableMap.key",!1);a.data_.set(r,f),i=f.value_,(u=a.hasMap_.get(r))==null||u.setNewValue_(!0),a.keysAtom_.reportChanged()});var s=Vb(),o=lo(this),l=o||s?{observableKind:"map",debugObjectName:this.name_,type:Cc,object:this,name:r,newValue:i}:null;o&&uo(this,l)},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,i=this.keys();return Dz({next:function(){var s=i.next(),o=s.done,l=s.value;return{done:o,value:o?void 0:r.get(l)}}})},t.entries=function(){var r=this,i=this.keys();return Dz({next:function(){var s=i.next(),o=s.done,l=s.value;return{done:o,value:o?void 0:[l,r.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,i){for(var a=op(this),s;!(s=a()).done;){var o=s.value,l=o[0],u=o[1];r.call(i,u,l,this)}},t.merge=function(r){var i=this;return zs(r)&&(r=new Map(r)),Jl(function(){Wc(r)?nAe(r).forEach(function(a){return i.set(a,r[a])}):Array.isArray(r)?r.forEach(function(a){var s=a[0],o=a[1];return i.set(s,o)}):Mm(r)?(tAe(r)||on(19,r),r.forEach(function(a,s){return i.set(s,a)})):r!=null&&on(20,r)}),this},t.clear=function(){var r=this;Jl(function(){lre(function(){for(var i=op(r.keys()),a;!(a=i()).done;){var s=a.value;r.delete(s)}})})},t.replace=function(r){var i=this;return Jl(function(){for(var a=Uke(r),s=new Map,o=!1,l=op(i.data_.keys()),u;!(u=l()).done;){var f=u.value;if(!a.has(f)){var d=i.delete(f);if(d)o=!0;else{var p=i.data_.get(f);s.set(f,p)}}}for(var m=op(a.entries()),E;!(E=m()).done;){var S=E.value,g=S[0],y=S[1],v=i.data_.has(g);if(i.set(g,y),i.data_.has(g)){var x=i.data_.get(g);s.set(g,x),v||(o=!0)}}if(!o)if(i.data_.size!==s.size)i.keysAtom_.reportChanged();else for(var T=i.data_.keys(),w=s.keys(),C=T.next(),R=w.next();!C.done;){if(C.value!==R.value){i.keysAtom_.reportChanged();break}C=T.next(),R=w.next()}i.data_=s}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,i){return o0(this,r)},t.intercept_=function(r){return s0(this,r)},jm(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])})(),zs=id("ObservableMap",GM);function Dz(e){return e[Symbol.toStringTag]="MapIterator",KM(e)}function Uke(e){if(Mm(e)||zs(e))return e;if(Array.isArray(e))return new Map(e);if(Wc(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return on(21,e)}var $ke={},Lre=(function(){function e(n,r,i){var a=this;r===void 0&&(r=Pf),i===void 0&&(i="ObservableSet"),this.name_=void 0,this[Ft]=$ke,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=i,is(Set)||on(22),this.enhancer_=function(s,o){return r(s,o,i)},Zf(function(){a.atom_=XE(a.name_),n&&a.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;Jl(function(){lre(function(){for(var i=op(r.data_.values()),a;!(a=i()).done;){var s=a.value;r.delete(s)}})})},t.forEach=function(r,i){for(var a=op(this),s;!(s=a()).done;){var o=s.value;r.call(i,o,o,this)}},t.add=function(r){var i=this;if(this.atom_,ks(this)){var a=Os(this,{type:Cc,object:this,newValue:r});if(!a)return this;r=a.newValue}if(!this.has(r)){Jl(function(){i.data_.add(i.enhancer_(r,void 0)),i.atom_.reportChanged()});var s=!1,o=lo(this),l=o||s?{observableKind:"set",debugObjectName:this.name_,type:Cc,object:this,newValue:r}:null;o&&uo(this,l)}return this},t.delete=function(r){var i=this;if(ks(this)){var a=Os(this,{type:rS,object:this,oldValue:r});if(!a)return!1}if(this.has(r)){var s=!1,o=lo(this),l=o||s?{observableKind:"set",debugObjectName:this.name_,type:rS,object:this,oldValue:r}:null;return Jl(function(){i.atom_.reportChanged(),i.data_.delete(r)}),o&&uo(this,l),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=this.values();return Lz({next:function(){var a=r.next(),s=a.value,o=a.done;return o?{value:void 0,done:o}:{value:[s,s],done:o}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,i=this.data_.values();return Lz({next:function(){var s=i.next(),o=s.value,l=s.done;return l?{value:void 0,done:l}:{value:r.dehanceValue_(o),done:l}}})},t.intersection=function(r){if(Ql(r)&&!na(r))return r.intersection(this);var i=new Set(this);return i.intersection(r)},t.union=function(r){if(Ql(r)&&!na(r))return r.union(this);var i=new Set(this);return i.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(Ql(r)&&!na(r))return r.symmetricDifference(this);var i=new Set(this);return i.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(Ql(r)&&!na(r))return r.isDisjointFrom(this);var i=new Set(this);return i.isDisjointFrom(r)},t.replace=function(r){var i=this;return na(r)&&(r=new Set(r)),Jl(function(){Array.isArray(r)?(i.clear(),r.forEach(function(a){return i.add(a)})):Ql(r)?(i.clear(),r.forEach(function(a){return i.add(a)})):r!=null&&on("Cannot initialize set from "+r)}),this},t.observe_=function(r,i){return o0(this,r)},t.intercept_=function(r){return s0(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},jm(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])})(),na=id("ObservableSet",Lre);function Lz(e){return e[Symbol.toStringTag]="SetIterator",KM(e)}var Pz=Object.create(null),Mz="remove",Pre=(function(){function e(n,r,i,a){r===void 0&&(r=new Map),a===void 0&&(a=IAe),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=n,this.values_=r,this.name_=i,this.defaultAnnotation_=a,this.keysAtom_=new ad("ObservableObject.keys"),this.isPlainObject_=Wc(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,i){var a=this.values_.get(r);if(a instanceof mo)return a.set(i),!0;if(ks(this)){var s=Os(this,{type:tl,object:this.proxy_||this.target_,name:r,newValue:i});if(!s)return null;i=s.newValue}if(i=a.prepareNewValue_(i),i!==ut.UNCHANGED){var o=lo(this),l=!1,u=o||l?{type:tl,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:a.value_,name:r,newValue:i}:null;a.setNewValue_(i),o&&uo(this,u)}return!0},t.get_=function(r){return ut.trackingDerivation&&!lu(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,i,a){return a===void 0&&(a=!1),lu(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,i):a?Reflect.set(this.target_,r,i):(this.target_[r]=i,!0):this.extend_(r,{value:i,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,a)},t.has_=function(r){if(!ut.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(r);return i||(i=new Fc(r in this.target_,cw,"ObservableObject.key?",!1),this.pendingKeys_.set(r,i)),i.get()},t.make_=function(r,i){if(i===!0&&(i=this.defaultAnnotation_),i!==!1){if(!(r in this.target_)){var a;if((a=this.target_[Go])!=null&&a[r])return;on(1,i.annotationType_,this.name_+"."+r.toString())}for(var s=this.target_;s&&s!==sw;){var o=YE(s,r);if(o){var l=i.make_(this,r,o,s);if(l===0)return;if(l===1)break}s=Object.getPrototypeOf(s)}Fz(this,i,r)}},t.extend_=function(r,i,a,s){if(s===void 0&&(s=!1),a===!0&&(a=this.defaultAnnotation_),a===!1)return this.defineProperty_(r,i,s);var o=a.extend_(this,r,i,s);return o&&Fz(this,a,r),o},t.defineProperty_=function(r,i,a){a===void 0&&(a=!1),this.keysAtom_;try{va();var s=this.delete_(r);if(!s)return s;if(ks(this)){var o=Os(this,{object:this.proxy_||this.target_,name:r,type:Cc,newValue:i.value});if(!o)return null;var l=o.newValue;i.value!==l&&(i=Vc({},i,{value:l}))}if(a){if(!Reflect.defineProperty(this.target_,r,i))return!1}else Jo(this.target_,r,i);this.notifyPropertyAddition_(r,i.value)}finally{ya()}return!0},t.defineObservableProperty_=function(r,i,a,s){s===void 0&&(s=!1),this.keysAtom_;try{va();var o=this.delete_(r);if(!o)return o;if(ks(this)){var l=Os(this,{object:this.proxy_||this.target_,name:r,type:Cc,newValue:i});if(!l)return null;i=l.newValue}var u=jz(r),f={configurable:ut.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(s){if(!Reflect.defineProperty(this.target_,r,f))return!1}else Jo(this.target_,r,f);var d=new Fc(i,a,"ObservableObject.key",!1);this.values_.set(r,d),this.notifyPropertyAddition_(r,d.value_)}finally{ya()}return!0},t.defineComputedProperty_=function(r,i,a){a===void 0&&(a=!1),this.keysAtom_;try{va();var s=this.delete_(r);if(!s)return s;if(ks(this)){var o=Os(this,{object:this.proxy_||this.target_,name:r,type:Cc,newValue:void 0});if(!o)return null}i.name||(i.name="ObservableObject.key"),i.context=this.proxy_||this.target_;var l=jz(r),u={configurable:ut.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(a){if(!Reflect.defineProperty(this.target_,r,u))return!1}else Jo(this.target_,r,u);this.values_.set(r,new mo(i)),this.notifyPropertyAddition_(r,void 0)}finally{ya()}return!0},t.delete_=function(r,i){if(i===void 0&&(i=!1),this.keysAtom_,!lu(this.target_,r))return!0;if(ks(this)){var a=Os(this,{object:this.proxy_||this.target_,name:r,type:Mz});if(!a)return null}try{var s;va();var o=lo(this),l=!1,u=this.values_.get(r),f=void 0;if(!u&&(o||l)){var d;f=(d=YE(this.target_,r))==null?void 0:d.value}if(i){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(u&&(this.values_.delete(r),u instanceof Fc&&(f=u.value_),pre(u)),this.keysAtom_.reportChanged(),(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(r in this.target_),o||l){var p={type:Mz,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:f,name:r};o&&uo(this,p)}}finally{ya()}return!0},t.observe_=function(r,i){return o0(this,r)},t.intercept_=function(r){return s0(this,r)},t.notifyPropertyAddition_=function(r,i){var a,s=lo(this),o=!1;if(s||o){var l=s||o?{type:Cc,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:i}:null;s&&uo(this,l)}(a=this.pendingKeys_)==null||(a=a.get(r))==null||a.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),uw(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e})();function Bm(e,t){var n;if(lu(e,Ft))return e;var r=(n=t?.name)!=null?n:"ObservableObject",i=new Pre(e,new Map,String(r),HAe(t));return lw(e,Ft,i),e}var zke=id("ObservableObjectAdministration",Pre);function jz(e){return Pz[e]||(Pz[e]={get:function(){return this[Ft].getObservablePropValue_(e)},set:function(n){return this[Ft].setObservablePropValue_(e,n)}})}function Ao(e){return ow(e)?zke(e[Ft]):!1}function Fz(e,t,n){var r;(r=e.target_[Go])==null||delete r[n]}var Hke=jre(0),Wke=(function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1})(),yk=0,Mre=function(){};function Vke(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Vke(Mre,Array.prototype);var qM=(function(e){function t(r,i,a,s){var o;return a===void 0&&(a="ObservableArray"),s===void 0&&(s=!1),o=e.call(this)||this,Zf(function(){var l=new VM(a,i,s,!0);l.proxy_=o,qne(o,Ft,l),r&&r.length&&o.spliceWithArray(0,0,r),Wke&&Object.defineProperty(o,"0",Hke)}),o}Xne(t,e);var n=t.prototype;return n.concat=function(){this[Ft].atom_.reportObserved();for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];return Array.prototype.concat.apply(this.slice(),a.map(function(o){return bl(o)?o.slice():o}))},n[Symbol.iterator]=function(){var r=this,i=0;return KM({next:function(){return i<r.length?{value:r[i++],done:!1}:{done:!0,value:void 0}}})},jm(t,[{key:"length",get:function(){return this[Ft].getArrayLength_()},set:function(i){this[Ft].setArrayLength_(i)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])})(Mre);Object.entries(nS).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&lw(qM.prototype,t,n)});function jre(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ft].get_(e)},set:function(n){this[Ft].set_(e,n)}}}function Gke(e){Jo(qM.prototype,""+e,jre(e))}function Fre(e){if(e>yk){for(var t=yk;t<e+100;t++)Gke(t);yk=e}}Fre(1e3);function qke(e,t,n){return new qM(e,t,n)}function Hp(e,t){if(typeof e=="object"&&e!==null){if(bl(e))return t!==void 0&&on(23),e[Ft].atom_;if(na(e))return e.atom_;if(zs(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||on(25,t,hD(e)),n}if(Ao(e)){if(!t)return on(26);var r=e[Ft].values_.get(t);return r||on(27,t,hD(e)),r}if(BM(e)||pw(e)||eS(e))return e}else if(is(e)&&eS(e[Ft]))return e[Ft];on(28)}function cl(e,t){if(e||on(29),t!==void 0)return cl(Hp(e,t));if(BM(e)||pw(e)||eS(e)||zs(e)||na(e))return e;if(e[Ft])return e[Ft];on(24,e)}function hD(e,t){var n;if(t!==void 0)n=Hp(e,t);else{if($p(e))return e.name;Ao(e)||zs(e)||na(e)?n=cl(e):n=Hp(e)}return n.name_}function Zf(e){var t=Xf(),n=fw(!0);va();try{return e()}finally{ya(),hw(n),uu(t)}}var Bz=sw.toString;function Bre(e,t,n){return n===void 0&&(n=-1),pD(e,t,n)}function pD(e,t,n,r,i){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var a=typeof e;if(a!=="function"&&a!=="object"&&typeof t!="object")return!1;var s=Bz.call(e);if(s!==Bz.call(t))return!1;switch(s){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=Uz(e),t=Uz(t);var o=s==="[object Array]";if(!o){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(is(l)&&l instanceof l&&is(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],i=i||[];for(var f=r.length;f--;)if(r[f]===e)return i[f]===t;if(r.push(e),i.push(t),o){if(f=e.length,f!==t.length)return!1;for(;f--;)if(!pD(e[f],t[f],n-1,r,i))return!1}else{var d=Object.keys(e),p=d.length;if(Object.keys(t).length!==p)return!1;for(var m=0;m<p;m++){var E=d[m];if(!(lu(t,E)&&pD(e[E],t[E],n-1,r,i)))return!1}}return r.pop(),i.pop(),!0}function Uz(e){return bl(e)?e.slice():Mm(e)||zs(e)||Ql(e)||na(e)?Array.from(e.entries()):e}var $z,Kke=(($z=aw().Iterator)==null?void 0:$z.prototype)||{};function KM(e){return e[Symbol.iterator]=Yke,Object.assign(Object.create(Kke),e)}function Yke(){return this}["Symbol","Map","Set"].forEach(function(e){var t=aw();typeof t[e]>"u"&&on("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:lke,extras:{getDebugName:hD},$mobx:Ft});var zz={},Xke="warn";function Zke(){return Xke}var ei;(function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"})(ei||(ei={}));var mD=function(e,t){return mD=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},mD(e,t)};function tr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");mD(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var _a=function(){return _a=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},_a.apply(this,arguments)};function Qke(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 i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Gb(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _u(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],s;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(o){s={error:o}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return a}function Eu(e,t,n){if(arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function Ure(e){return On(e).type}function Jke(e,t){return On(e).onPatch(t)}function Pv(e,t){On(e).applyPatches(Qre(t))}function Hz(e,t){var n={patches:[],inversePatches:[]},r={},i,a={get recording(){return!!i},get patches(){return r.patches||(r.patches=n.patches.slice()),r.patches},get reversedInversePatches(){return r.reversedInversePatches||(r.reversedInversePatches=n.inversePatches.slice().reverse()),r.reversedInversePatches},get inversePatches(){return r.inversePatches||(r.inversePatches=n.inversePatches.slice()),r.inversePatches},stop:function(){i&&(i(),i=void 0)},resume:function(){i||(i=Jke(e,function(s,o){n.patches.push(s),n.inversePatches.push(o),r.patches=void 0,r.inversePatches=void 0,r.reversedInversePatches=void 0}))},replay:function(s){Pv(s||e,n.patches)},undo:function(s){Pv(s||e,n.inversePatches.slice().reverse())}};return a.resume(),a}function eOe(e,t){t===void 0&&(t=!0);var n=On(e);return t?n.snapshot:n.type.getSnapshot(n,!1)}function $re(e){return On(e).root.storedValue}function tOe(e){return On(e).path}function nOe(e){return On(e).identifier}function iS(e){var t=On(e);t.isRoot?t.die():t.parent.removeChild(t.subpath)}function rOe(e){var t=On(e),n=t.root.environment;if(!n)throw new St("Failed to find the environment of ".concat(t," ").concat(t.path));return n}var zre=(function(){function e(t,n,r,i){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"environment",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_escapedSubpath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subpath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subpathUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pathUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storedValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"aliveAtom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_state",{enumerable:!0,configurable:!0,writable:!0,value:Ti.INITIALIZING}),Object.defineProperty(this,"_hookSubscribers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pathAtom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.environment=i,this.baseSetParent(n,r)}return Object.defineProperty(e.prototype,"subpath",{get:function(){return this._subpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subpathUponDeath",{get:function(){return this._subpathUponDeath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pathUponDeath",{get:function(){return this._pathUponDeath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.type.getValue(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},set:function(t){var n=this.isAlive;this._state=t;var r=this.isAlive;this.aliveAtom&&n!==r&&this.aliveAtom.reportChanged()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fireInternalHook",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this._hookSubscribers&&this._hookSubscribers.emit(t,this,t)}}),Object.defineProperty(e.prototype,"registerHook",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return this._hookSubscribers||(this._hookSubscribers=new tie),this._hookSubscribers.register(t,n)}}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getReconciliationType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type}}),Object.defineProperty(e.prototype,"baseSetParent",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){this._parent=t,this._subpath=n,this._escapedSubpath=void 0,this.pathAtom&&this.pathAtom.reportChanged()}}),Object.defineProperty(e.prototype,"path",{get:function(){return this.getEscapedPath(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getEscapedPath",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return t&&(this.pathAtom||(this.pathAtom=XE("path")),this.pathAtom.reportObserved()),this.parent?(this._escapedSubpath===void 0&&(this._escapedSubpath=this._subpath?vf(this._subpath):""),this.parent.getEscapedPath(t)+"/"+this._escapedSubpath):""}}),Object.defineProperty(e.prototype,"isRoot",{get:function(){return this.parent===null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAlive",{get:function(){return this.state!==Ti.DEAD},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDetaching",{get:function(){return this.state===Ti.DETACHING},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"observableIsAlive",{get:function(){return this.aliveAtom||(this.aliveAtom=XE("alive")),this.aliveAtom.reportObserved(),this.isAlive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseFinalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(this.state===Ti.CREATED){if(this.parent){if(this.parent.state!==Ti.FINALIZED)return;this.fireHook(ei.afterAttach)}this.state=Ti.FINALIZED,t&&t()}}}),Object.defineProperty(e.prototype,"baseFinalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._hookSubscribers&&this._hookSubscribers.clearAll(),this._subpathUponDeath=this._subpath,this._pathUponDeath=this.getEscapedPath(!1),this.baseSetParent(null,""),this.state=Ti.DEAD}}),Object.defineProperty(e.prototype,"baseAboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.fireHook(ei.beforeDestroy)}}),e})(),Mv=(function(e){tr(t,e);function t(n,r,i,a,s){var o=e.call(this,n,r,i,a)||this;try{o.storedValue=n.createNewInstance(s)}catch(l){throw o.state=Ti.DEAD,l}return o.state=Ti.CREATED,o.finalizeCreation(),o}return Object.defineProperty(t.prototype,"root",{get:function(){if(!this.parent)throw new St("This scalar node is not part of a tree");return this.parent.root},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this.parent!==n,a=this.subpath!==r;!i&&!a||(this.environment=void 0,this.baseSetParent(this.parent,r))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this.getSnapshot()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=(this.isAlive?this.path:this.pathUponDeath)||"<root>";return"".concat(this.type.name,"@").concat(n).concat(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){!this.isAlive||this.state===Ti.DETACHING||(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this.fireInternalHook(n)}}),t})(zre);Mv.prototype.die=ti(Mv.prototype.die);var iOe=1,Js;(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.CREATING=1]="CREATING",e[e.CREATED=2]="CREATED"})(Js||(Js={}));var Wa;(function(e){e.Dispose="dispose",e.Patch="patch",e.Snapshot="snapshot"})(Wa||(Wa={}));var aOe={onError:function(e){throw e}},Ca=(function(e){tr(t,e);function t(n,r,i,a,s){var o=e.call(this,n,r,i,a)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++iOe}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"hasSnapshotPostProcessor",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:Js.UNINITIALIZED}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Fm(function(){return o.getSnapshot()}),o.unbox=o.unbox.bind(o),o._initialSnapshot=s,o.identifierAttribute=n.identifierAttribute,r||(o.identifierCache=new gOe),o._childNodes=n.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var l=o._initialSnapshot[o.identifierAttribute];if(l===void 0){var u=o._childNodes[o.identifierAttribute];u&&(l=u.value)}if(typeof l!="string"&&typeof l!="number")throw new St("Instance identifier '".concat(o.identifierAttribute,"' for type '").concat(o.type.name,"' must be a string or a number"));o.identifier=l0(l),o.unnormalizedIdentifier=l}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this.createObservableInstanceIfNeeded(),this._applyPatches(n)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this.createObservableInstanceIfNeeded(),this._applySnapshot(n)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(n){n===void 0&&(n=!0),this._observableInstanceState===Js.UNINITIALIZED&&this.createObservableInstance(n)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i,a,s;n===void 0&&(n=!0),this._observableInstanceState=Js.CREATING;for(var o=[],l=this.parent;l&&l._observableInstanceState===Js.UNINITIALIZED;)o.unshift(l),l=l.parent;try{for(var u=Gb(o),f=u.next();!f.done;f=u.next()){var d=f.value;d.createObservableInstanceIfNeeded(!1)}}catch(S){r={error:S}}finally{try{f&&!f.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}var p=this.type;try{this.storedValue=p.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,p.finalizeNewInstance(this,this.storedValue)}catch(S){throw this.state=Ti.DEAD,S}finally{this._isRunningAction=!1}if(this._observableInstanceState=Js.CREATED,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=Gp,this.state=Ti.CREATED,n){this.fireHook(ei.afterCreate),this.finalizeCreation();try{for(var m=Gb(o.reverse()),E=m.next();!E.done;E=m.next()){var d=E.value;d.fireHook(ei.afterCreate),d.finalizeCreation()}}catch(S){a={error:S}}finally{try{E&&!E.done&&(s=m.return)&&s.call(m)}finally{if(a)throw a.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var n=this.parent;return n?n.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(ei.beforeDetach);var n=this.state;this.state=Ti.DETACHING;var r=this.root,i=r.environment,a=r.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=i,this.identifierCache=a}finally{this.state=n}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=n!==this.parent,a=r!==this.subpath;!i&&!a||(i?(this.environment=void 0,n.root.identifierCache.mergeCache(this),this.baseSetParent(n,r),this.fireHook(ei.afterAttach)):a&&this.baseSetParent(this.parent,r))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;this.fireInternalHook(n);var i=this.storedValue&&typeof this.storedValue=="object"&&this.storedValue[n];typeof i=="function"&&(Oz?Oz(function(){i.apply(r.storedValue)}):i.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this.hasSnapshotPostProcessor&&this.createObservableInstanceIfNeeded(),this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?this._observableInstanceState===Js.CREATED?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var n=this.type,r=this._childNodes,i=this._initialSnapshot;this._cachedInitialSnapshot=n.processInitialSnapshot(r,i),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isRunningAction?!0:this.isRoot?!1:this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=Zke();if(!this.isAlive&&r!=="ignore"){var i=this._getAssertAliveError(n);switch(r){case"error":throw new St(i);case"warn":kOe(i)}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.getEscapedPath(!1)||this.pathUponDeath||"",i=n.subpath&&vf(n.subpath)||"",a=n.actionContext||Vre();a&&a.type!=="action"&&a.parentActionEvent&&(a=a.parentActionEvent);var s="";if(a&&a.name!=null){var o=a&&a.context&&tOe(a.context)||r;s="".concat(o,".").concat(a.name,"()")}return"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '".concat(this.type.name,"', Path upon death: '").concat(r,"', Subpath: '").concat(i,"', Action: '").concat(s,"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree.")}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this.assertAlive({subpath:n}),this._autoUnbox=!1;try{return this._observableInstanceState===Js.CREATED?this.type.getChildNode(this,n):this._childNodes[n]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(Gp),this._autoUnbox=!1;try{return this._observableInstanceState===Js.CREATED?this.type.getChildren(this):Xre(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.type.getChildType(n)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(this.assertAlive(n),!this.isRunningAction()&&this.isProtected)throw new St("Cannot modify '".concat(this,"', the object is protected and can only be modified by using an action."))}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this.type.removeChild(this,n)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n&&(this.assertAlive({subpath:n.subpath||n.subpathUponDeath}),this._autoUnbox?n.value:n)}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=(this.isAlive?this.path:this.pathUponDeath)||"<root>",r=this.identifier?"(id: ".concat(this.identifier,")"):"";return"".concat(this.type.name,"@").concat(n).concat(r).concat(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this;this.baseFinalizeCreation(function(){var r,i;try{for(var a=Gb(n.getChildren()),s=a.next();!s.done;s=a.next()){var o=s.value;o.finalizeCreation()}}catch(l){r={error:l}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}n.fireInternalHook(ei.afterCreationFinalization)})}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw new St("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this;this._applyPatches=jv(this.storedValue,"@APPLY_PATCHES",function(r){r.forEach(function(i){if(!i.path){n.type.applySnapshot(n,i.value);return}var a=MOe(i.path),s=yOe(n,a.slice(0,-1));s.applyPatchLocally(a[a.length-1],i)})}),this._applySnapshot=jv(this.storedValue,"@APPLY_SNAPSHOT",function(r){if(r!==n.snapshot)return n.type.applySnapshot(n,r)}),bf(this.storedValue,"$treenode",this),bf(this.storedValue,"toJSON",vOe)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){!this.isAlive||this.state===Ti.DETACHING||(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._observableInstanceState!==Js.UNINITIALIZED&&(this.getChildren().forEach(function(n){n.aboutToDie()}),this.baseAboutToDie(),this._internalEventsEmit(Wa.Dispose),this._internalEventsClear(Wa.Dispose))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach(function(r){r.finalizeDeath()}),this.root.identifierCache.notifyDied(this);var n=this.snapshot;this._snapshotUponDeath=n,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._addSnapshotReaction(),this._internalEventsRegister(Wa.Snapshot,n)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this._internalEventsEmit(Wa.Snapshot,n)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._internalEventsRegister(Wa.Patch,n)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this._internalEventsHasSubscribers(Wa.Patch)){var i=r.path.substr(this.path.length)+(n.path?"/"+n.path:""),a=TOe({},n,{path:i}),s=_u(NOe(a),2),o=s[0],l=s[1];this._internalEventsEmit(Wa.Patch,o,l)}this.parent&&this.parent.emitPatch(n,r)}}),Object.defineProperty(t.prototype,"hasDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._internalEventsHas(Wa.Dispose,n)}}),Object.defineProperty(t.prototype,"addDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(!this.hasDisposer(n)){this._internalEventsRegister(Wa.Dispose,n,!0);return}throw new St("cannot add a disposer when it is already registered for execution")}}),Object.defineProperty(t.prototype,"removeDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(!this._internalEventsHas(Wa.Dispose,n))throw new St("cannot remove a disposer which was never registered for execution");this._internalEventsUnregister(Wa.Dispose,n)}}),Object.defineProperty(t.prototype,"removeMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(this.middlewares){var r=this.middlewares.indexOf(n);r>=0&&this.middlewares.splice(r,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;r===void 0&&(r=!0);var a={handler:n,includeHooks:r};return this.middlewares?this.middlewares.push(a):this.middlewares=[a],function(){i.removeMiddleware(a)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){this.assertWritable({subpath:n}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,n,r)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this;if(!this._hasSnapshotReaction){var r=zM(function(){return n.snapshot},function(i){return n.emitSnapshot(i)},aOe);this.addDisposer(r),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return!!this._internalEvents&&this._internalEvents.hasSubscribers(n)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){return i===void 0&&(i=!1),this._internalEvents||(this._internalEvents=new tie),this._internalEvents.register(n,r,i)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return!!this._internalEvents&&this._internalEvents.has(n,r)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){this._internalEvents&&this._internalEvents.unregister(n,r)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(n){for(var r,i=[],a=1;a<arguments.length;a++)i[a-1]=arguments[a];this._internalEvents&&(r=this._internalEvents).emit.apply(r,Eu([n],_u(i),!1))}}),Object.defineProperty(t.prototype,"_internalEventsClear",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this._internalEvents&&this._internalEvents.clear(n)}}),Object.defineProperty(t.prototype,"_internalEventsClearAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._internalEvents&&this._internalEvents.clearAll()}}),t})(zre);Ca.prototype.createObservableInstance=ti(Ca.prototype.createObservableInstance);Ca.prototype.detach=ti(Ca.prototype.detach);Ca.prototype.die=ti(Ca.prototype.die);var Hre,_n;(function(e){e[e.String=1]="String",e[e.Number=2]="Number",e[e.Boolean=4]="Boolean",e[e.Date=8]="Date",e[e.Literal=16]="Literal",e[e.Array=32]="Array",e[e.Map=64]="Map",e[e.Object=128]="Object",e[e.Frozen=256]="Frozen",e[e.Optional=512]="Optional",e[e.Reference=1024]="Reference",e[e.Identifier=2048]="Identifier",e[e.Late=4096]="Late",e[e.Refinement=8192]="Refinement",e[e.Union=16384]="Union",e[e.Null=32768]="Null",e[e.Undefined=65536]="Undefined",e[e.Integer=131072]="Integer",e[e.Custom=262144]="Custom",e[e.SnapshotProcessor=524288]="SnapshotProcessor",e[e.Lazy=1048576]="Lazy",e[e.Finite=2097152]="Finite",e[e.Float=4194304]="Float"})(_n||(_n={}));var Wre="cannotDetermine",sOe=Symbol("$type"),Su=(function(){function e(t){Object.defineProperty(this,Hre,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"C",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"S",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"T",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"N",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isType",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=t}return Object.defineProperty(e.prototype,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return cu(this,t),this.instantiate(null,"",n,t).value}}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){throw new St("unimplemented method")}}),Object.defineProperty(e.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return t===this}}),Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=Yre(t);if(r){var i=Ure(t);return this.isAssignableFrom(i)?Aa():Ra(n,t)}return this.isValidSnapshot(t,n)}}),Object.defineProperty(e.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return this.validate(t,[{path:"",type:this}]).length===0}}),Object.defineProperty(e.prototype,"Type",{get:function(){throw new St("Factory.Type should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.Type`")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"TypeWithoutSTN",{get:function(){throw new St("Factory.TypeWithoutSTN should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.TypeWithoutSTN`")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"SnapshotType",{get:function(){throw new St("Factory.SnapshotType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.SnapshotType`")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CreationType",{get:function(){throw new St("Factory.CreationType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.CreationType`")},enumerable:!1,configurable:!0}),e})();Hre=sOe;Su.prototype.create=ti(Su.prototype.create);var Wp=(function(e){tr(t,e);function t(n){var r=e.call(this,n)||this;return Object.defineProperty(r,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return Object.defineProperty(t.prototype,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return n===void 0&&(n=this.getDefaultSnapshot()),e.prototype.create.call(this,n,r)}}),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.createObservableInstanceIfNeeded(),n.storedValue}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return!n.identifierAttribute||n.identifier===l0(r[n.identifierAttribute])}}),Object.defineProperty(t.prototype,"tryToReconcileNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return n.isDetaching?!1:n.snapshot===r||Sr(r)&&On(r)===n?!0:n.type===this&&Jre(r)&&!Sr(r)&&this.isMatchingSnapshotId(n,r)?(n.applySnapshot(r),!0):!1}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.tryToReconcileNode(n,r);if(s)return n.setParent(i,a),n;if(n.die(),Sr(r)&&this.isAssignableFrom(Ure(r))){var o=On(r);return o.setParent(i,a),o}return this.instantiate(i,a,void 0,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return null}}),t})(Su);Wp.prototype.create=ti(Wp.prototype.create);var Qf=(function(e){tr(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n}}),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(!n.isDetaching&&n.type===this&&n.storedValue===r)return n;var s=this.instantiate(i,a,void 0,r);return n.die(),s}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return null}}),t})(Su);function xu(e){return typeof e=="object"&&e&&e.isType===!0}var oOe=1,qb;function Vre(){return qb}function Gre(){return oOe++}function gD(e,t){var n=On(e.context);e.type==="action"&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=qb;qb=e;try{return uOe(n,e,t)}finally{qb=i,n._isRunningAction=r}}function qre(e){if(e)return e.type==="action"?e:e.parentActionEvent}function jv(e,t,n){var r=function(){var i=Gre(),a=qb,s=qre(a);return gD({type:"action",name:t,id:i,args:nie(arguments),context:e,tree:$re(e),rootId:a?a.rootId:i,parentId:a?a.id:0,allParentIds:a?Eu(Eu([],_u(a.allParentIds),!1),[a.id],!1):[],parentEvent:a,parentActionEvent:s},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var lOe=(function(){function e(t,n){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),n.$mst_middleware&&this.middlewares.push(n.$mst_middleware);for(var r=t;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t=this.middlewares[this.arrayIndex];if(t){var n=t[this.inArrayIndex++];return n||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}}),e})();function uOe(e,t,n){var r=new lOe(e,n);if(r.isEmpty)return ti(n).apply(null,t.args);var i=null;function a(s){var o=r.getNextMiddleware(),l=o&&o.handler;if(!l)return ti(n).apply(null,s.args);if(!o.includeHooks&&ei[s.name])return a(s);function u(d,p){i=a(d),p&&(i=p(i))}function f(d){i=d}return l(s,u,f),i}return a(t)}function cOe(e){try{return JSON.stringify(e)}catch(t){return"<Unserializable: ".concat(t,">")}}function Kre(e){return typeof e=="function"?"<function".concat(e.name?" "+e.name:"",">"):Sr(e)?"<".concat(e,">"):"`".concat(cOe(e),"`")}function dOe(e){return e.length<280?e:"".concat(e.substring(0,272),"......").concat(e.substring(e.length-8))}function fOe(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map(function(o){var l=o.path;return l}).filter(function(o){return o.length>0}).join("/"),i=r.length>0?'at path "/'.concat(r,'" '):"",a=Sr(t)?"value of type ".concat(On(t).type.name,":"):Fv(t)?"value":"snapshot",s=n&&Sr(t)&&n.is(On(t).snapshot);return"".concat(i).concat(a," ").concat(Kre(t)," is not assignable ").concat(n?"to type: `".concat(n.name,"`"):"")+(e.message?" (".concat(e.message,")"):"")+(n?QOe(n)||Fv(t)?".":", expected an instance of `".concat(n.name,"` or a snapshot like `").concat(n.describe(),"` instead.")+(s?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function YM(e,t,n){return e.concat([{path:t,type:n}])}function Aa(){return Vp}function Ra(e,t,n){return[{context:e,value:t,message:n}]}function mw(e){return e.reduce(function(t,n){return t.concat(n)},[])}function cu(e,t){OOe()&&hOe(e,t)}function hOe(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw new St(pOe(e,t,n))}function pOe(e,t,n){if(n.length!==0)return"Error while converting ".concat(dOe(Kre(t))," to `").concat(e.name,`\`:
28
28
 
29
29
  `)+n.map(fOe).join(`
30
30
  `)}var mOe=0,gOe=(function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:mOe++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:fr.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:fr.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.lastCacheModificationPerId.get(t);this.lastCacheModificationPerId.set(t,n===void 0?1:n+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.lastCacheModificationPerId.get(t)||0;return"".concat(this.cacheId,"-").concat(n)}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){if(n===void 0&&(n=!0),t.identifierAttribute){var r=t.identifier;this.cache.has(r)||this.cache.set(r,fr.array([],gw));var i=this.cache.get(r);if(i.indexOf(t)!==-1)throw new St("Already registered");i.push(t),n&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this;kre(t.identifierCache.cache).forEach(function(r){return r.forEach(function(i){n.addNodeToCache(i)})})}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(t.identifierAttribute){var n=t.identifier,r=this.cache.get(n);r&&(r.remove(t),r.length||this.cache.delete(n),this.updateLastCacheModificationPerId(t.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this,r=new e,i=t.path+"/";return Oke(this.cache).forEach(function(a){for(var s=_u(a,2),o=s[0],l=s[1],u=!1,f=l.length-1;f>=0;f--){var d=l[f];(d===t||d.path.indexOf(i)===0)&&(r.addNodeToCache(d,!1),l.splice(f,1),l.length||n.cache.delete(o),u=!0)}u&&n.updateLastCacheModificationPerId(o)}),r}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.cache.get(n);return r?r.some(function(i){return t.isAssignableFrom(i.type)}):!1}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.cache.get(n);if(!r)return null;var i=r.filter(function(a){return t.isAssignableFrom(a.type)});switch(i.length){case 0:return null;case 1:return i[0];default:throw new St("Cannot resolve a reference to type '".concat(t.name,"' with id: '").concat(n,"' unambigously, there are multiple candidates: ").concat(i.map(function(a){return a.path}).join(", ")))}}}),e})();function XM(e,t,n,r,i){var a=Yre(i);if(a){if(a.parent)throw new St("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(t?t.path:"","/").concat(n,"', but it lives already at '").concat(a.path,"'"));return t&&a.setParent(t,n),a}return new Ca(e,t,n,r,i)}function sd(e,t,n,r,i){return new Mv(e,t,n,r,i)}function bOe(e){return e instanceof Mv||e instanceof Ca}var Ti;(function(e){e[e.INITIALIZING=0]="INITIALIZING",e[e.CREATED=1]="CREATED",e[e.FINALIZED=2]="FINALIZED",e[e.DETACHING=3]="DETACHING",e[e.DEAD=4]="DEAD"})(Ti||(Ti={}));function Sr(e){return!!(e&&e.$treenode)}function On(e){if(!Sr(e))throw new St("Value ".concat(e," is no MST Node"));return e.$treenode}function Yre(e){return e&&e.$treenode||null}function vOe(){return On(this).snapshot}function yOe(e,t,n){n===void 0&&(n=!0);var r=e;try{for(var i=0;i<t.length;i++){var a=t[i];if(a===".."){if(r=r.parent,r)continue}else{if(a===".")continue;if(r){if(r instanceof Mv){var s=r.value;Sr(s)&&(r=On(s))}if(r instanceof Ca){var o=r.getChildType(a);if(o&&(r=r.getChildNode(a),r))continue}}}throw new St("Could not resolve '".concat(a,"' in path '").concat(Wz(t.slice(0,i))||"/","' while resolving '").concat(Wz(t),"'"))}}catch(l){if(!n)return;throw l}return r}function Xre(e){if(!e)return Vp;var t=Object.keys(e);if(!t.length)return Vp;var n=new Array(t.length);return t.forEach(function(r,i){n[i]=e[r]}),n}var _Oe=Object.toString(),Vp=Object.freeze([]),Gp=Object.freeze({}),gw=tke().useProxies?{deep:!1}:{deep:!1,proxy:!1};Object.freeze(gw);var St=(function(e){tr(t,e);function t(n){return n===void 0&&(n="Illegal state"),e.call(this,"[mobx-state-tree] ".concat(n))||this}return t})(Error);function EOe(e){return e}var SOe=Number.isInteger;function xOe(e){return Number(e)===e&&e%1!==0}function wOe(e){return Number.isFinite(e)}function Zre(e){return Array.isArray(e)||bl(e)}function Qre(e){return e?Zre(e)?e:[e]:Vp}function TOe(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0;r<t.length;r++){var i=t[r];for(var a in i)e[a]=i[a]}return e}function lp(e){var t;if(e===null||typeof e!="object")return!1;var n=Object.getPrototypeOf(e);return n==null?!0:((t=n.constructor)===null||t===void 0?void 0:t.toString())===_Oe}function Jre(e){return e!==null&&typeof e=="object"&&!(e instanceof Date)&&!(e instanceof RegExp)}function Fv(e,t){return t===void 0&&(t=!0),e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||t&&e instanceof Date}function eie(e){return typeof e!="function"}function COe(e,t,n){Ao(e)?Rre(e,t,n):Object.defineProperty(e,t,n)}function bf(e,t,n){COe(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}var AOe=(function(){function e(){Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}return Object.defineProperty(e.prototype,"hasSubscribers",{get:function(){return this.handlers.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this;return n===void 0&&(n=!1),n?this.handlers.unshift(t):this.handlers.push(t),function(){r.unregister(t)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return this.handlers.indexOf(t)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.handlers.indexOf(t);n>=0&&this.handlers.splice(n,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=this.handlers.slice();r.forEach(function(i){return i.apply(void 0,Eu([],_u(t),!1))})}}),e})(),tie=(function(){function e(){Object.defineProperty(this,"eventHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"hasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.eventHandlers&&this.eventHandlers[t];return!!n&&n.hasSubscribers}}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){r===void 0&&(r=!1),this.eventHandlers||(this.eventHandlers={});var i=this.eventHandlers[t];return i||(i=this.eventHandlers[t]=new AOe),i.register(n,r)}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.eventHandlers&&this.eventHandlers[t];return!!r&&r.has(n)}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.eventHandlers&&this.eventHandlers[t];r&&r.unregister(n)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.eventHandlers&&delete this.eventHandlers[t]}}),Object.defineProperty(e.prototype,"clearAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.eventHandlers=void 0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(t){for(var n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var a=this.eventHandlers&&this.eventHandlers[t];a&&(n=a).emit.apply(n,Eu([],_u(r),!1))}}),e})();function nie(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e[n];return t}function _k(e,t){return e.indexOf(t)===0}function kOe(e){console.warn(new Error("[mobx-state-tree] ".concat(e)))}function OOe(){return typeof process<"u"&&zz&&zz.ENABLE_TYPE_CHECK==="true"}function Ek(e){typeof queueMicrotask=="function"?queueMicrotask(e):typeof setImmediate=="function"?setImmediate(e):setTimeout(e,1)}function Sk(e){return ROe(e.name,e)}function ROe(e,t){var n=function(){var i=Gre(),a=Vre();if(!a)throw new St("a mst flow must always have a parent context");var s=qre(a);if(!s)throw new St("a mst flow must always have a parent action context");var o={name:e,id:i,tree:a.tree,context:a.context,parentId:a.id,allParentIds:Eu(Eu([],_u(a.allParentIds),!1),[a.id],!1),rootId:a.rootId,parentEvent:a,parentActionEvent:s},l=arguments;function u(f,d,p){return f.$mst_middleware=n.$mst_middleware,gD(_a(_a({},o),{type:d,args:[p]}),f)}return new Promise(function(f,d){var p,m=function(){p=t.apply(null,arguments),E(void 0)};m.$mst_middleware=n.$mst_middleware,gD(_a(_a({},o),{type:"flow_spawn",args:nie(l)}),m);function E(y){var v;try{var x=u(function(T){v=p.next(T)},"flow_resume",y);x instanceof Error&&(v=p.throw(x))}catch(T){Ek(function(){u(function(w){d(T)},"flow_throw",T)});return}g(v)}function S(y){var v;try{u(function(x){v=p.throw(x)},"flow_resume_error",y)}catch(x){Ek(function(){u(function(T){d(x)},"flow_throw",x)});return}g(v)}function g(y){if(y.done){Ek(function(){u(function(v){f(v)},"flow_return",y.value)});return}if(!y.value||typeof y.value.then!="function")throw new St("Only promises can be yielded to `async`, got: "+y);return y.value.then(E,S)}})};return n._isFlowAction=!0,n}function NOe(e){if(!("oldValue"in e))throw new St("Patches without `oldValue` field cannot be inversed");return[IOe(e),DOe(e)]}function IOe(e){switch(e.op){case"add":return{op:"add",path:e.path,value:e.value};case"remove":return{op:"remove",path:e.path};case"replace":return{op:"replace",path:e.path,value:e.value}}}function DOe(e){switch(e.op){case"add":return{op:"remove",path:e.path};case"remove":return{op:"add",path:e.path,value:e.oldValue};case"replace":return{op:"replace",path:e.path,value:e.oldValue}}}function LOe(e){return typeof e=="number"}function vf(e){return LOe(e)===!0?""+e:e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function POe(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Wz(e){if(e.length===0)return"";var t=function(n){return n.map(vf).join("/")};return e[0]==="."||e[0]===".."?t(e):"/"+t(e)}function MOe(e){var t=e.split("/").map(POe),n=e===""||e==="."||e===".."||_k(e,"/")||_k(e,"./")||_k(e,"../");if(!n)throw new St("a json path must be either rooted, empty or relative, but got '".concat(e,"'"));return t[0]===""&&t.shift(),t}var xk=Symbol("$preProcessorFailed"),jOe=(function(e){tr(t,e);function t(n,r,i){var a=e.call(this,i||n.name)||this;return Object.defineProperty(a,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_processors",{enumerable:!0,configurable:!0,writable:!0,value:r}),a}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|_n.SnapshotProcessor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"snapshotProcessor(".concat(this._subtype.describe(),")")}}),Object.defineProperty(t.prototype,"preProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._processors.preProcessor?this._processors.preProcessor.call(null,n):n}}),Object.defineProperty(t.prototype,"preProcessSnapshotSafe",{enumerable:!1,configurable:!0,writable:!0,value:function(n){try{return this.preProcessSnapshot(n)}catch{return xk}}}),Object.defineProperty(t.prototype,"postProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this._processors.postProcessor?this._processors.postProcessor.call(null,n,r.storedValue):n}}),Object.defineProperty(t.prototype,"_fixNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;FOe(n.type,this,"create"),n instanceof Ca&&(n.hasSnapshotPostProcessor=!!this._processors.postProcessor);var i=n.getSnapshot;n.getSnapshot=function(){return r.postProcessSnapshot(i.call(n),n)},iRe(this._subtype)||(n.getReconciliationType=function(){return r})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(a)?a:this.preProcessSnapshot(a),o=this._subtype.instantiate(n,r,i,s);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this._subtype.reconcile(n,Sr(r)?r:this.preProcessSnapshot(r),i,a);return s!==n&&this._fixNode(s),s}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r=!0);var i=this._subtype.getSnapshot(n);return r?this.postProcessSnapshot(i,n):i}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this.preProcessSnapshotSafe(n);return i===xk?Ra(r,n,"Failed to preprocess value"):this._subtype.validate(i,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=xu(n)?this._subtype:Sr(n)?n:this.preProcessSnapshotSafe(n);return r===xk?!1:this._subtype.validate(r,[{path:"",type:this._subtype}]).length===0}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._subtype.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(!(this._subtype instanceof Wp))return!1;var i=this.preProcessSnapshot(r);return this._subtype.isMatchingSnapshotId(n,i)}}),t})(Su);function FOe(e,t){for(var n,r,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];try{for(var s=Gb(i),o=s.next();!o.done;o=s.next()){var l=o.value;e[l]=t[l].bind(t)}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}function BOe(e,t,n){return new jOe(e,t,n)}var Vz="Map.put can only be used to store complex values that have an identifier type attribute";function rie(e,t){var n,r,i=e.getSubTypes();if(i===Wre)return!1;if(i){var a=Qre(i);try{for(var s=Gb(a),o=s.next();!o.done;o=s.next()){var l=o.value;if(!rie(l,t))return!1}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}return e instanceof Bv&&t.push(e),!0}var _c;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"})(_c||(_c={}));var UOe=(function(e){tr(t,e);function t(n,r){return e.call(this,n,fr.ref.enhancer,r)||this}return Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return e.prototype.get.call(this,""+n)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return e.prototype.has.call(this,""+n)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return e.prototype.delete.call(this,""+n)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return e.prototype.set.call(this,""+n,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(!n)throw new St("Map.put cannot be used to set empty values");if(Sr(n)){var r=On(n);if(r.identifier===null)throw new St(Vz);return this.set(r.identifier,n),n}else if(Jre(n)){var i=On(this),a=i.type;if(a.identifierMode!==_c.YES)throw new St(Vz);var s=a.mapIdentifierAttribute,o=n[s];if(!ZM(o)){var l=this.put(a.getChildType().create(n,i.environment));return this.put(eOe(l))}var u=l0(o);return this.set(u,n),this.get(u)}else throw new St("Map.put can only be used to store complex values")}}),t})(GM),aS=(function(e){tr(t,e);function t(n,r,i){i===void 0&&(i=[]);var a=e.call(this,n)||this;return Object.defineProperty(a,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:_c.UNKNOWN}),Object.defineProperty(a,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Map}),Object.defineProperty(a,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a._determineIdentifierMode(),a.hookInitializers=i,a}return Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.hookInitializers.length>0?this.hookInitializers.concat(n):[n];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._determineIdentifierMode(),XM(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===_c.UNKNOWN){var n=[];if(rie(this._subType,n)){var r=n.reduce(function(i,a){if(!a.identifierAttribute)return i;if(i&&i!==a.identifierAttribute)throw new St("The objects in a map should all have the same identifier attribute, expected '".concat(i,"', but child of type '").concat(a.name,"' declared attribute '").concat(a.identifierAttribute,"' as identifier"));return a.identifierAttribute},void 0);r?(this.identifierMode=_c.YES,this.mapIdentifierAttribute=r):this.identifierMode=_c.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r={});var i=n.type._subType,a={};return Object.keys(r).forEach(function(s){a[s]=i.instantiate(n,s,void 0,r[s])}),a}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return new UOe(n,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){Cre(r,n.unbox);var i=n.type;i.hookInitializers.forEach(function(a){var s=a(r);Object.keys(s).forEach(function(o){var l=s[o],u=jv(r,o,l);bf(r,o,u)})}),HM(r,this.willChange),WM(r,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return kre(n.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=n.storedValue.get(""+r);if(!i)throw new St("Not a child "+r);return i}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object),i=n.name;r.assertWritable({subpath:i});var a=r.type,s=a._subType;switch(n.type){case"update":{var o=n.newValue,l=n.object.get(i);if(o===l)return null;cu(s,o),n.newValue=s.reconcile(r.getChildNode(i),n.newValue,r,i),a.processIdentifier(i,n.newValue)}break;case"add":cu(s,n.newValue),n.newValue=s.instantiate(r,i,void 0,n.newValue),a.processIdentifier(i,n.newValue);break}return n}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this.identifierMode===_c.YES&&r instanceof Ca){var i=r.identifier;if(i!==n)throw new St("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '".concat(i,"', but expected: '").concat(n,"'"))}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r={};return n.getChildren().forEach(function(i){r[i.subpath]=i.snapshot}),r}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r={};return Object.keys(n).forEach(function(i){r[i]=n[i].getSnapshot()}),r}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object);switch(n.type){case"update":return void r.emitPatch({op:"replace",path:vf(n.name),value:n.newValue.snapshot,oldValue:n.oldValue?n.oldValue.snapshot:void 0},r);case"add":return void r.emitPatch({op:"add",path:vf(n.name),value:n.newValue.snapshot,oldValue:void 0},r);case"delete":var i=n.oldValue.snapshot;return n.oldValue.die(),void r.emitPatch({op:"remove",path:vf(n.name),oldValue:i},r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){var a=n.storedValue;switch(i.op){case"add":case"replace":a.set(r,i.value);break;case"remove":a.delete(r);break}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){cu(this,r);var i=n.storedValue,a={};if(Array.from(i.keys()).forEach(function(o){a[o]=!1}),r)for(var s in r)i.set(s,r[s]),a[""+s]=!0;Object.keys(a).forEach(function(o){a[o]===!1&&i.delete(o)})}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;return lp(n)?mw(Object.keys(n).map(function(a){return i._subType.validate(n[a],YM(r,a,i._subType))})):Ra(r,n,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Gp}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){n.storedValue.delete(r)}}),t})(Wp);aS.prototype.applySnapshot=ti(aS.prototype.applySnapshot);function $Oe(e){return new aS("Map<string, ".concat(e.name,">"),e)}var sS=(function(e){tr(t,e);function t(n,r,i){i===void 0&&(i=[]);var a=e.call(this,n)||this;return Object.defineProperty(a,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Array}),Object.defineProperty(a,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a.hookInitializers=i,a}return Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.hookInitializers.length>0?this.hookInitializers.concat(n):[n];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return XM(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r=[]);var i=n.type._subType,a={};return r.forEach(function(s,o){var l=""+o;a[l]=i.instantiate(n,l,void 0,s)}),a}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=_a(_a({},gw),{name:this.name});return fr.array(Xre(n),r)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){cl(r).dehancer=n.unbox;var i=n.type;i.hookInitializers.forEach(function(a){var s=a(r);Object.keys(s).forEach(function(o){var l=s[o],u=jv(r,o,l);bf(r,o,u)})}),HM(r,this.willChange),WM(r,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=Number(r);if(i<n.storedValue.length)return n.storedValue[i];throw new St("Not a child: "+r)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object);r.assertWritable({subpath:""+n.index});var i=r.type._subType,a=r.getChildren();switch(n.type){case"update":{if(n.newValue===n.object[n.index])return null;var s=Gz(r,i,[a[n.index]],[n.newValue],[n.index]);if(!s)return null;n.newValue=s[0]}break;case"splice":{var o=n.index,l=n.removedCount,u=n.added,f=Gz(r,i,a.slice(o,o+l),u,u.map(function(p,m){return o+m}));if(!f)return null;n.added=f;for(var d=o+l;d<a.length;d++)a[d].setParent(r,""+(d+u.length-l))}break}return n}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.getChildren().map(function(r){return r.snapshot})}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=[];return Object.keys(n).forEach(function(i){r.push(n[i].getSnapshot())}),r}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object);switch(n.type){case"update":return void r.emitPatch({op:"replace",path:""+n.index,value:n.newValue.snapshot,oldValue:n.oldValue?n.oldValue.snapshot:void 0},r);case"splice":if(n.removedCount&&n.addedCount===n.object.length)return void r.emitPatch({op:"replace",path:"",value:r.snapshot,oldValue:n.removed.map(function(a){return a.snapshot})},r);for(var i=n.removedCount-1;i>=0;i--)r.emitPatch({op:"remove",path:""+(n.index+i),oldValue:n.removed[i].snapshot},r);for(var i=0;i<n.addedCount;i++)r.emitPatch({op:"add",path:""+(n.index+i),value:n.added[i].snapshot,oldValue:void 0},r);return}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){var a=n.storedValue,s=r==="-"?a.length:Number(r);switch(i.op){case"replace":a[s]=i.value;break;case"add":a.splice(s,0,i.value);break;case"remove":a.splice(s,1);break}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){cu(this,r);var i=n.storedValue;i.replace(r)}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;return Zre(n)?mw(n.map(function(a,s){return i._subType.validate(a,YM(r,""+s,i._subType))})):Ra(r,n,"Value is not an array")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Vp}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){n.storedValue.splice(Number(r),1)}}),t})(Wp);sS.prototype.applySnapshot=ti(sS.prototype.applySnapshot);function zOe(e){return new sS("".concat(e.name,"[]"),e)}function Gz(e,t,n,r,i){for(var a=!0,s=0;;s++){var o=s<=r.length-1,l=n[s],u=o?r[s]:void 0,f=""+i[s];if(bOe(u)&&(u=u.storedValue),!l&&!o)break;if(!o)a=!1,n.splice(s,1),l instanceof Ca&&l.createObservableInstanceIfNeeded(),l.die(),s--;else if(l)if(qz(l,u))n[s]=wk(t,e,f,u,l);else{for(var p=void 0,m=s;m<n.length;m++)if(qz(n[m],u)){p=n.splice(m,1)[0];break}a=!1;var d=wk(t,e,f,u,p);n.splice(s,0,d)}else{if(Sr(u)&&On(u).parent===e)throw new St("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(e.path,"/").concat(f,"', but it lives already at '").concat(On(u).path,"'"));a=!1;var d=wk(t,e,f,u);n.splice(s,0,d)}}return a?null:n}function wk(e,t,n,r,i){cu(e,r);function a(){if(Sr(r)){var o=On(r);if(o.assertAlive(Gp),o.parent!==null&&o.parent===t)return o.setParent(t,n),o}return i?e.reconcile(i,r,t,n):e.instantiate(t,n,void 0,r)}var s=a();return i&&i!==s&&(i instanceof Ca&&i.createObservableInstanceIfNeeded(),i.die()),s}function qz(e,t){if(!e.isAlive)return!1;if(Sr(t)){var n=On(t);return n.isAlive&&n===e}if(e.snapshot===t)return!0;if(!(e instanceof Ca))return!1;var r=e.getReconciliationType();return e.identifier!==null&&e.identifierAttribute&&lp(t)&&r.is(t)&&r.isMatchingSnapshotId(e,t)}var Kz="preProcessSnapshot",Yz="postProcessSnapshot";function HOe(){return On(this).toString()}var Xz={name:"AnonymousModel",properties:{},initializers:Vp};function WOe(e){var t=Object.keys(e),n=new Set;return t.forEach(function(r){if(n.has(r))throw new St("".concat(r," is declared twice in the model. Model should not contain the same keys"));n.add(r)}),t.reduce(function(r,i){if(i in ei)throw new St("Hook '".concat(i,"' was defined as property. Hooks should be defined as part of the actions"));var a=Object.getOwnPropertyDescriptor(e,i);if("get"in a)throw new St("Getters are not supported as properties. Please use views instead");var s=a.value;if(s==null)throw new St("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");if(Fv(s))r[i]=yf(ZOe(s),s);else if(s instanceof aS)r[i]=yf(s,{});else if(s instanceof sS)r[i]=yf(s,[]);else if(!xu(s))throw new St("Invalid type definition for property '".concat(i,"', cannot infer a type from a value like '").concat(s,"' (").concat(typeof s,")"));return r},_a({},e))}var Bv=(function(e){tr(t,e);function t(n){var r=e.call(this,n.name||Xz.name)||this;return Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Object}),Object.defineProperty(r,"initializers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"properties",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"preProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"postProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"propertyNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"named",{enumerable:!0,configurable:!0,writable:!0,value:function(i){return r.cloneAndEnhance({name:i})}}),Object.defineProperty(r,"props",{enumerable:!0,configurable:!0,writable:!0,value:function(i){return r.cloneAndEnhance({properties:i})}}),Object.defineProperty(r,"preProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(i){var a=r.preProcessor;return a?r.cloneAndEnhance({preProcessor:function(s){return a(i(s))}}):r.cloneAndEnhance({preProcessor:i})}}),Object.defineProperty(r,"postProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(i){var a=r.postProcessor;return a?r.cloneAndEnhance({postProcessor:function(s){return i(a(s))}}):r.cloneAndEnhance({postProcessor:i})}}),Object.assign(r,Xz,n),r.properties=WOe(r.properties),r.properties,r.propertyNames=Object.keys(r.properties),r.identifierAttribute=r._getIdentifierAttribute(),r}return Object.defineProperty(t.prototype,"_getIdentifierAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=void 0;return this.forAllProps(function(r,i){if(i.flags&_n.Identifier){if(n)throw new St("Cannot define property '".concat(r,"' as object identifier, property '").concat(n,"' is already defined as identifier property"));n=r}}),n}}),Object.defineProperty(t.prototype,"cloneAndEnhance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return new t({name:n.name||this.name,properties:Object.assign({},this.properties,n.properties),initializers:this.initializers.concat(n.initializers||[]),preProcessor:n.preProcessor||this.preProcessor,postProcessor:n.postProcessor||this.postProcessor})}}),Object.defineProperty(t.prototype,"actions",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=function(a){return r.instantiateActions(a,n(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateActions",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;if(!lp(r))throw new St("actions initializer should return a plain object containing actions");Object.getOwnPropertyNames(r).forEach(function(a){if(a in i.properties)throw new St("'".concat(a,"' is a property and cannot be declared as an action"));if(a===Kz)throw new St("Cannot define action '".concat(Kz,"', it should be defined using 'type.preProcessSnapshot(fn)' instead"));if(a===Yz)throw new St("Cannot define action '".concat(Yz,"', it should be defined using 'type.postProcessSnapshot(fn)' instead"));var s=r[a],o=n[a];if(a in ei&&o){var l=s;s=function(){o.apply(null,arguments),l.apply(null,arguments)}}var u=s.$mst_middleware,f=s.bind(r);f._isFlowAction=s._isFlowAction||!1,f.$mst_middleware=u;var d=jv(n,a,f);r[a]=d,bf(n,a,d)})}}),Object.defineProperty(t.prototype,"volatile",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;if(typeof n!="function")throw new St("You passed an ".concat(typeof n," to volatile state as an argument, when function is expected"));var i=function(a){return r.instantiateVolatileState(a,n(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateVolatileState",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;if(!lp(r))throw new St("volatile state initializer should return a plain object containing state");Object.getOwnPropertyNames(r).forEach(function(a){if(a in i.properties)throw new St("'".concat(a,"' is a property and cannot be declared as volatile state"));Ore(n,a,r[a])})}}),Object.defineProperty(t.prototype,"extend",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=function(a){var s=n(a),o=s.actions,l=s.views,u=s.state,f=Qke(s,["actions","views","state"]);for(var d in f)throw new St("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '".concat(d,"'"));return u&&r.instantiateVolatileState(a,u),l&&r.instantiateViews(a,l),o&&r.instantiateActions(a,o),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"views",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=function(a){return r.instantiateViews(a,n(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateViews",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;if(!lp(r))throw new St("views initializer should return a plain object containing views");Object.getOwnPropertyNames(r).forEach(function(a){var s;if(a in i.properties)throw new St("'".concat(a,"' is a property and cannot be declared as a view"));var o=Object.getOwnPropertyDescriptor(r,a);if("get"in o)Rre(n,a,o),Ire(n,(s={},s[a]=Fm,s));else if(typeof o.value=="function")bf(n,a,o.value);else throw new St("A view member should either be a function or getter based property")})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(a)?a:this.applySnapshotPreProcessor(a);return XM(this,n,r,i,s)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r={});var i=n.type,a={};return i.forAllProps(function(s,o){a[s]=o.instantiate(n,s,void 0,r[s])}),a}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=_a(_a({},gw),{name:this.name});return fr.object(n,Gp,r)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){bf(r,"toString",HOe),this.forAllProps(function(i){Cre(r,i,n.unbox)}),this.initializers.reduce(function(i,a){return a(i)},r),HM(r,this.willChange),WM(r,this.didChange)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=n,i=On(r.object),a=r.name;i.assertWritable({subpath:a});var s=i.type.properties[a];return s&&(cu(s,r.newValue),r.newValue=s.reconcile(i.getChildNode(a),r.newValue,i,a)),r}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=n,i=On(r.object),a=i.type.properties[r.name];if(a){var s=r.oldValue?r.oldValue.snapshot:void 0;i.emitPatch({op:"replace",path:vf(r.name),value:r.newValue.snapshot,oldValue:s},i)}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=[];return this.forAllProps(function(a){i.push(r.getChildNode(n,a))}),i}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i;if(!(r in this.properties))throw new St("Not a value property: "+r);var a=cl(n.storedValue,r),s=(i=a.raw)===null||i===void 0?void 0:i.call(a);if(!s)throw new St("Node not available for property "+r);return s}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;r===void 0&&(r=!0);var a={};return this.forAllProps(function(s,o){var l=Hp(n.storedValue,s);l.reportObserved(),a[s]=i.getChildNode(n,s).snapshot}),r?this.applySnapshotPostProcessor(a):a}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r={};return Object.keys(n).forEach(function(i){r[i]=n[i].getSnapshot()}),this.applySnapshotPostProcessor(r)}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){if(!(i.op==="replace"||i.op==="add"))throw new St("object does not support operation ".concat(i.op));n.storedValue[r]=i.value}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){cu(this,r);var i=this.applySnapshotPreProcessor(r);this.forAllProps(function(a){n.storedValue[a]=i[a]})}}),Object.defineProperty(t.prototype,"applySnapshotPreProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.preProcessor;return r?r.call(null,n):n}}),Object.defineProperty(t.prototype,"applySnapshotPostProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.postProcessor;return r?r.call(null,n):n}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.properties[n]}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this,a=this.applySnapshotPreProcessor(n);return lp(a)?mw(this.propertyNames.map(function(s){return i.properties[s].validate(a[s],YM(r,s,i.properties[s]))})):Ra(r,a,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"forAllProps",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;this.propertyNames.forEach(function(i){return n(i,r.properties[i])})}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this;return"{ "+this.propertyNames.map(function(r){return r+": "+n.properties[r].describe()}).join("; ")+" }"}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Gp}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){n.storedValue[r]=void 0}}),t})(Wp);Bv.prototype.applySnapshot=ti(Bv.prototype.applySnapshot);function VOe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=typeof e[0]=="string"?e.shift():"AnonymousModel",r=e.shift()||{};return new Bv({name:n,properties:r})}function GOe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=typeof e[0]=="string",r=n?e[0]:"AnonymousModel";return n&&e.shift(),e.reduce(function(i,a){return i.cloneAndEnhance({name:i.name+"_"+a.name,properties:a.properties,initializers:a.initializers,preProcessor:function(s){return a.applySnapshotPreProcessor(i.applySnapshotPreProcessor(s))},postProcessor:function(s){return a.applySnapshotPostProcessor(i.applySnapshotPostProcessor(s))}})}).named(r)}function qOe(e){return xu(e)&&(e.flags&_n.Object)>0}var Iu=(function(e){tr(t,e);function t(n,r,i,a){a===void 0&&(a=EOe);var s=e.call(this,n)||this;return Object.defineProperty(s,"flags",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"checker",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"initializer",{enumerable:!0,configurable:!0,writable:!0,value:a}),s.flags=r,s}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return sd(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.initializer(n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(Fv(n)&&this.checker(n))return Aa();var i=this.name==="Date"?"Date or a unix milliseconds timestamp":this.name;return Ra(r,n,"Value is not a ".concat(i))}}),t})(Qf),iie=new Iu("string",_n.String,function(e){return typeof e=="string"}),aie=new Iu("number",_n.Number,function(e){return typeof e=="number"}),KOe=new Iu("integer",_n.Integer,function(e){return SOe(e)}),YOe=new Iu("float",_n.Float,function(e){return xOe(e)}),XOe=new Iu("finite",_n.Finite,function(e){return wOe(e)}),sie=new Iu("boolean",_n.Boolean,function(e){return typeof e=="boolean"}),oie=new Iu("null",_n.Null,function(e){return e===null}),lie=new Iu("undefined",_n.Undefined,function(e){return e===void 0}),uie=new Iu("Date",_n.Date,function(e){return typeof e=="number"||e instanceof Date},function(e){return e instanceof Date?e:new Date(e)});uie.getSnapshot=function(e){return e.storedValue.getTime()};var cie=uie;function ZOe(e){switch(typeof e){case"string":return iie;case"number":return aie;case"boolean":return sie;case"object":if(e instanceof Date)return cie}throw new St("Cannot determine primitive type from value "+e)}function QOe(e){return xu(e)&&(e.flags&(_n.String|_n.Number|_n.Integer|_n.Boolean|_n.Date))>0}var JOe=(function(e){tr(t,e);function t(n){var r=e.call(this,JSON.stringify(n))||this;return Object.defineProperty(r,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Literal}),r.value=n,r}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return sd(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.stringify(this.value)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return Fv(n)&&n===this.value?Aa():Ra(r,n,"Value is not a literal ".concat(JSON.stringify(this.value)))}}),t})(Qf);function die(e){return new JOe(e)}var eRe=(function(e){tr(t,e);function t(n,r,i,a){var s=e.call(this,n)||this;return Object.defineProperty(s,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_predicate",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_message",{enumerable:!0,configurable:!0,writable:!0,value:a}),s}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|_n.Refinement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._subtype.instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._subtype.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this._subtype.validate(n,r);if(i.length>0)return i;var a=Sr(n)?On(n).snapshot:n;return this._predicate(a)?Aa():Ra(r,n,this._message(n))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._subtype.reconcile(n,r,i,a)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t})(Su);function tRe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=typeof e[0]=="string"?e.shift():xu(e[0])?e[0].name:null,r=e[0],i=e[1],a=e[2]?e[2]:function(s){return"Value does not respect the refinement predicate"};return new eRe(n,r,i,a)}function nRe(e,t){var n=typeof e=="string"?t:e,r=bw.apply(void 0,Eu([],_u(n.map(function(i){return die(""+i)})),!1));return typeof e=="string"&&(r.name=e),r}var rRe=(function(e){tr(t,e);function t(n,r,i){var a=e.call(this,n)||this;return Object.defineProperty(a,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),i=_a({eager:!0,dispatcher:void 0},i),a._dispatcher=i.dispatcher,i.eager||(a._eager=!1),a}return Object.defineProperty(t.prototype,"flags",{get:function(){var n=_n.Union;return this._types.forEach(function(r){n|=r.flags}),n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._types.some(function(r){return r.isAssignableFrom(n)})}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map(function(n){return n.describe()}).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.determineType(a,void 0);if(!s)throw new St("No matching type for union "+this.describe());return s.instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.determineType(r,n.getReconciliationType());if(!s)throw new St("No matching type for union "+this.describe());return s.reconcile(n,r,i,a)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this._dispatcher?this._dispatcher(n):r?r.is(n)?r:this._types.filter(function(i){return i!==r}).find(function(i){return i.is(n)}):this._types.find(function(i){return i.is(n)})}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this._dispatcher)return this._dispatcher(n).validate(n,r);for(var i=[],a=0,s=0;s<this._types.length;s++){var o=this._types[s],l=o.validate(n,r);if(l.length===0){if(this._eager)return Aa();a++}else i.push(l)}return a===1?Aa():Ra(r,n,"No type is applicable for the union").concat(mw(i))}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._types}}),t})(Su);function bw(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=xu(e)?void 0:e,i=xu(e)?Eu([e],_u(t),!1):t,a="("+i.map(function(s){return s.name}).join(" | ")+")";return new rRe(a,i,r)}function iRe(e){return xu(e)&&(e.flags&_n.Union)>0}var aRe=(function(e){tr(t,e);function t(n,r,i){var a=e.call(this,n.name)||this;return Object.defineProperty(a,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_defaultValue",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"optionalValues",{enumerable:!0,configurable:!0,writable:!0,value:i}),a}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|_n.Optional},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype.describe()+"?"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(this.optionalValues.indexOf(a)>=0){var s=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(n,r,i,s)}return this._subtype.instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._subtype.reconcile(n,this.optionalValues.indexOf(r)<0&&this._subtype.is(r)?r:this.getDefaultInstanceOrSnapshot(),i,a)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=typeof this._defaultValue=="function"?this._defaultValue():this._defaultValue;return typeof this._defaultValue=="function"&&cu(this,n),n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this.optionalValues.indexOf(n)>=0?Aa():this._subtype.validate(n,r)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._subtype.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t})(Su);function sRe(e,t){if(typeof t!="function"&&Sr(t))throw new St("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead")}function yf(e,t,n){return sRe(e,t),new aRe(e,t,n||oRe)}var oRe=[void 0],lRe=yf(lie,void 0),uRe=yf(oie,null);function fie(e){return bw(e,lRe)}function cRe(e){return bw(e,uRe)}var dRe=(function(e){tr(t,e);function t(n,r){var i=e.call(this,n)||this;return Object.defineProperty(i,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),i}return Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|_n.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(!this._subType){var r=void 0;try{r=this._definition()}catch(i){if(i instanceof ReferenceError)r=void 0;else throw i}if(n&&r===void 0)throw new St("Late type seems to be used too early, the definition (still) returns undefined");r&&(this._subType=r)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this.getSubType(!0).instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this.getSubType(!0).reconcile(n,r,i,a)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this.getSubType(!1);return n?n.name:"<uknown late type>"}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this.getSubType(!1);return i?i.validate(n,r):Aa()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.getSubType(!1);return r?r.isAssignableFrom(n):!1}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this.getSubType(!1);return n||Wre}}),t})(Su);function fRe(e,t){var n=typeof e=="string"?e:"late(".concat(e.toString(),")"),r=typeof e=="string"?t:e;return new dRe(n,r)}function hRe(e,t){return new pRe(e,t)}var pRe=(function(e){tr(t,e);function t(n,r){var i=e.call(this,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Lazy}),Object.defineProperty(i,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:fr.array()}),Nz(function(){return i.pendingNodeList.length>0&&i.pendingNodeList.some(function(a){return a.isAlive&&i.options.shouldLoadPredicate(a.parent?a.parent.value:null)})},function(){i.options.loadType().then(ti(function(a){i.loadedType=a,i.pendingNodeList.forEach(function(s){s.parent&&i.loadedType&&s.parent.applyPatches([{op:"replace",path:"/".concat(s.subpath),value:s.snapshot}])})}))}),i}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"<lazy ".concat(this.name,">")}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this;if(this.loadedType)return this.loadedType.instantiate(n,r,i,a);var o=sd(this,n,r,i,a);return this.pendingNodeList.push(o),Nz(function(){return!o.isAlive},function(){return s.pendingNodeList.splice(s.pendingNodeList.indexOf(o),1)}),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this.loadedType?this.loadedType.validate(n,r):eie(n)?Aa():Ra(r,n,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this.loadedType?(n.die(),this.loadedType.instantiate(i,a,i.environment,r)):e.prototype.reconcile.call(this,n,r,i,a)}}),t})(Qf),hie=(function(e){tr(t,e);function t(n){var r=e.call(this,n?"frozen(".concat(n.name,")"):"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Frozen}),r}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"<any immutable value>"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return sd(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return eie(n)?this.subType?this.subType.validate(n,r):Aa():Ra(r,n,"Value is not serializable and cannot be frozen")}}),t})(Qf),Zz=new hie;function mRe(e){return arguments.length===0?Zz:xu(e)?new hie(e):yf(Zz,e)}function gRe(e){switch(e){case ei.beforeDestroy:return"destroy";case ei.beforeDetach:return"detach";default:return}}var bRe=(function(){function e(t,n){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),ZM(t))this.identifier=t;else if(Sr(t)){var r=On(t);if(!r.identifierAttribute)throw new St("Can only store references with a defined identifier attribute.");var i=r.unnormalizedIdentifier;if(i==null)throw new St("Can only store references to tree nodes with a defined identifier.");this.identifier=i}else throw new St("Can only store references to tree nodes or identifiers, got: '".concat(t,"'"))}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=l0(this.identifier),r=t.root,i=r.identifierCache.getLastCacheModificationPerId(n);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==i){var a=this.targetType,s=r.identifierCache.resolve(a,n);if(!s)throw new vRe("[mobx-state-tree] Failed to resolve reference '".concat(this.identifier,"' to type '").concat(this.targetType.name,"' (from node: ").concat(t.path,")"));this.resolvedReference={node:s,lastCacheModification:i}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e})(),vRe=(function(e){tr(t,e);function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return t})(Error),pie=(function(e){tr(t,e);function t(n,r){var i=e.call(this,"reference(".concat(n.name,")"))||this;return Object.defineProperty(i,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Reference}),i}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.targetType.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return ZM(n)?Aa():Ra(r,n,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=r.parent;if(!(!s||!s.isAlive)){var o=s.storedValue;o&&this.onInvalidated({cause:n,parent:o,invalidTarget:a?a.storedValue:void 0,invalidId:i,replaceRef:function(l){Pv(r.root.storedValue,{op:"replace",value:l,path:r.path})},removeRef:function(){qOe(s.type)?this.replaceRef(void 0):Pv(r.root.storedValue,{op:"remove",path:r.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this,a=this.getValue(n);if(a){var s=On(a),o=function(f,d){var p=gRe(d);p&&i.fireInvalidated(p,n,r,s)},l=s.registerHook(ei.beforeDetach,o),u=s.registerHook(ei.beforeDestroy,o);return function(){l(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){var a=this;if(this.onInvalidated){var s;n.registerHook(ei.beforeDestroy,function(){s&&s()});var o=function(l){s&&s();var u=n.parent,f=u&&u.storedValue;if(u&&u.isAlive&&f){var d=void 0;i?d=!!i.get(r,f):d=n.root.identifierCache.has(a.targetType,l0(r)),d?s=a.addTargetNodeWatcher(n,r):l||a.fireInvalidated("invalidSnapshotReference",n,r,null)}};n.state===Ti.FINALIZED?o(!0):(n.isRoot||n.root.registerHook(ei.afterCreationFinalization,function(){n.parent&&n.parent.createObservableInstanceIfNeeded()}),n.registerHook(ei.afterAttach,function(){o(!1)}))}}}),t})(Qf),yRe=(function(e){tr(t,e);function t(n,r){return e.call(this,n,r)||this}return Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(n.isAlive){var r=n.storedValue;return r.resolvedValue}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=n.storedValue;return r.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(a)?nOe(a):a,o=new bRe(a,this.targetType),l=sd(this,n,r,i,o);return o.node=l,this.watchTargetNodeForInvalidations(l,s,void 0),l}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(!n.isDetaching&&n.type===this){var s=Sr(r),o=n.storedValue;if(!s&&o.identifier===r||s&&o.resolvedValue===r)return n.setParent(i,a),n}var l=this.instantiate(i,a,void 0,r);return n.die(),l}}),t})(pie),_Re=(function(e){tr(t,e);function t(n,r,i){var a=e.call(this,n,i)||this;return Object.defineProperty(a,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),a}return Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(n.isAlive){var r=this.options.get(n.storedValue,n.parent?n.parent.storedValue:null);return r}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(a)?this.options.set(a,n?n.storedValue:null):a,o=sd(this,n,r,i,s);return this.watchTargetNodeForInvalidations(o,s,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(r)?this.options.set(r,n?n.storedValue:null):r;if(!n.isDetaching&&n.type===this&&n.storedValue===s)return n.setParent(i,a),n;var o=this.instantiate(i,a,void 0,s);return n.die(),o}}),t})(pie);function mie(e,t){var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new _Re(e,{get:n.get,set:n.set},r):new yRe(e,r)}function ERe(e,t){var n=mie(e,_a(_a({},t),{onInvalidated:function(r){t&&t.onInvalidated&&t.onInvalidated(r),r.removeRef()}}));return t&&t.acceptsUndefined===!1?n:fie(n)}var gie=(function(e){tr(t,e);function t(n,r){var i=e.call(this,n)||this;return Object.defineProperty(i,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Identifier}),i}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(!n||!(n.type instanceof Bv))throw new St("Identifier types can only be instantiated as direct child of a model type");return sd(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(n.storedValue!==r)throw new St("Tried to change identifier from '".concat(n.storedValue,"' to '").concat(r,"'. Changing identifiers is not allowed."));return n.setParent(i,a),n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return typeof n!==this.validType?Ra(r,n,"Value is not a valid ".concat(this.describe(),", expected a ").concat(this.validType)):Aa()}}),t})(Qf),SRe=(function(e){tr(t,e);function t(){var n=e.call(this,"identifier","string")||this;return Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Identifier}),n}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t})(gie),xRe=(function(e){tr(t,e);function t(){return e.call(this,"identifierNumber","number")||this}return Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t})(gie),wRe=new SRe,TRe=new xRe;function l0(e){return""+e}function ZM(e){return typeof e=="string"||typeof e=="number"}function CRe(e){return new ARe(e)}var ARe=(function(e){tr(t,e);function t(n){var r=e.call(this,n.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Custom}),r}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this.options.isTargetType(n))return Aa();var i=this.options.getValidationMessage(n);return i?Ra(r,n,"Invalid value for type '".concat(this.name,"': ").concat(i)):Aa()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.options.toSnapshot(n.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.options.isTargetType(a)?a:this.options.fromSnapshot(a,n&&n.root.environment);return sd(this,n,r,i,s)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=!this.options.isTargetType(r);if(!n.isDetaching){var o=n.type===this&&(s?r===n.snapshot:r===n.storedValue);if(o)return n.setParent(i,a),n}var l=s?this.options.fromSnapshot(r,i.root.environment):r,u=this.instantiate(i,a,void 0,l);return n.die(),u}}),t})(Qf),Ot={enumeration:nRe,model:VOe,compose:GOe,custom:CRe,reference:mie,safeReference:ERe,union:bw,optional:yf,literal:die,maybe:fie,maybeNull:cRe,refinement:tRe,string:iie,boolean:sie,number:aie,integer:KOe,float:YOe,finite:XOe,Date:cie,map:$Oe,array:zOe,frozen:mRe,identifier:wRe,identifierNumber:TRe,late:fRe,lazy:hRe,undefined:lie,null:oie,snapshotProcessor:BOe};const kRe=Ot.enumeration("TerminalStatus",["running","exited","error"]),ORe=Ot.model("Terminal",{id:Ot.identifier,name:Ot.string,cwd:Ot.string,status:kRe,exitCode:Ot.maybe(Ot.number),cols:Ot.number,rows:Ot.number,createdAt:Ot.number,tabId:Ot.maybeNull(Ot.string),positionInTab:Ot.optional(Ot.number,0)}).volatile(()=>({xterm:null,attachCleanup:null,isPending:!1,pendingId:null,isStartingUp:!1})).views(e=>({get isAlive(){return e.status==="running"},get isTabTerminal(){return e.tabId!=null}})).actions(e=>({updateFromServer(t){t.name!==void 0&&(e.name=t.name),t.cwd!==void 0&&(e.cwd=t.cwd),t.status!==void 0&&(e.status=t.status),t.exitCode!==void 0&&(e.exitCode=t.exitCode),t.cols!==void 0&&(e.cols=t.cols),t.rows!==void 0&&(e.rows=t.rows),t.tabId!==void 0&&(e.tabId=t.tabId),t.positionInTab!==void 0&&(e.positionInTab=t.positionInTab)},setXterm(t){e.xterm=t},setAttachCleanup(t){e.attachCleanup=t},markExited(t){e.status="exited",e.exitCode=t},assignToTab(t,n){e.tabId=t,n!==void 0&&(e.positionInTab=n)},rename(t){e.name=t},resize(t,n){e.cols=t,e.rows=n},setPending(t,n){e.isPending=t,n!==void 0&&(e.pendingId=n)},setStartingUp(t){e.isStartingUp=t},cleanup(){e.attachCleanup&&(e.attachCleanup(),e.attachCleanup=null),e.xterm=null}})),RRe=Ot.model("Tab",{id:Ot.identifier,name:Ot.string,position:Ot.number,directory:Ot.maybeNull(Ot.string),createdAt:Ot.number}).volatile(()=>({isPending:!1})).views(e=>({get terminals(){const t=$re(e);return t.terminals?.items?t.terminals.items.filter(n=>n.tabId===e.id).sort((n,r)=>n.positionInTab-r.positionInTab):[]},get terminalCount(){return this.terminals.length}})).actions(e=>({updateFromServer(t){t.name!==void 0&&(e.name=t.name),t.directory!==void 0&&(e.directory=t.directory),t.position!==void 0&&(e.position=t.position)},rename(t){e.name=t},setDirectory(t){e.directory=t},setPosition(t){e.position=t},setPending(t){e.isPending=t}})),NRe=Ot.map(Ot.string),IRe=Ot.model("ViewState",{focusedTerminals:Ot.optional(NRe,{}),currentView:Ot.maybeNull(Ot.string),currentTaskId:Ot.maybeNull(Ot.string),isTabVisible:Ot.maybeNull(Ot.boolean),viewUpdatedAt:Ot.maybeNull(Ot.string)}).volatile(()=>({pendingUpdates:{},debounceTimer:null})).views(e=>({getFocusedTerminal(t){return e.focusedTerminals.get(t)??null}})).actions(e=>({setFocusedTerminal(t,n){n===null?e.focusedTerminals.delete(t):e.focusedTerminals.set(t,n)},clearFocusedTerminalForTab(t){e.focusedTerminals.delete(t)},updateViewTracking(t,n){e.currentView=t,e.currentTaskId=n,e.viewUpdatedAt=new Date().toISOString()},setTabVisible(t){e.isTabVisible=t,e.viewUpdatedAt=new Date().toISOString()},hydrateFromServer(t){if(t.focusedTerminals){e.focusedTerminals.clear();for(const[n,r]of Object.entries(t.focusedTerminals))e.focusedTerminals.set(n,r)}t.currentView!==void 0&&(e.currentView=t.currentView),t.currentTaskId!==void 0&&(e.currentTaskId=t.currentTaskId),t.isTabVisible!==void 0&&(e.isTabVisible=t.isTabVisible),t.viewUpdatedAt!==void 0&&(e.viewUpdatedAt=t.viewUpdatedAt)}}));function bD(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}function Qz(){return`temp-${bD()}`}const DRe=Ot.model("TerminalsStore",{items:Ot.array(ORe)}).views(e=>({get(t){return e.items.find(n=>n.id===t)},getByTab(t){return e.items.filter(n=>n.tabId===t).sort((n,r)=>n.positionInTab-r.positionInTab)},get taskTerminals(){return e.items.filter(t=>t.tabId==null)},has(t){return e.items.some(n=>n.id===t)}})).actions(e=>({add(t){if(e.items.some(n=>n.id===t.id)){At.ws.debug("Terminal already exists, skipping add",{id:t.id});return}e.items.push(t)},remove(t){const n=e.items.find(r=>r.id===t);n&&(n.cleanup(),iS(n))},replaceAll(t){for(const n of e.items)n.cleanup();e.items.clear();for(const n of t)e.items.push(n)},clear(){for(const t of e.items)t.cleanup();e.items.clear()}})),LRe=Ot.model("TabsStore",{items:Ot.array(RRe)}).views(e=>({get(t){return e.items.find(n=>n.id===t)},get sorted(){return[...e.items].sort((t,n)=>t.position-n.position)},has(t){return e.items.some(n=>n.id===t)},get first(){return this.sorted[0]}})).actions(e=>({add(t){if(e.items.some(n=>n.id===t.id)){At.ws.debug("Tab already exists, skipping add",{id:t.id});return}e.items.push(t)},remove(t){const n=e.items.find(r=>r.id===t);n&&iS(n)},replaceAll(t){e.items.clear();for(const n of t)e.items.push(n)},clear(){e.items.clear()}})),PRe=Ot.model("RootStore",{terminals:Ot.optional(DRe,{items:[]}),tabs:Ot.optional(LRe,{items:[]}),viewState:Ot.optional(IRe,{})}).volatile(()=>({connected:!1,initialized:!1,hasEverConnected:!1,reconnectAttempt:0,maxReconnectAttempts:10,newTerminalIds:new Set,pendingUpdates:new Map,onAttachedCallbacks:new Map,terminalsReadyForCallback:new Set,lastFocusedTerminalId:null,terminalsPendingStartup:new Map,pendingTabCreation:null,lastCreatedTabId:null,broadcastedTheme:null})).views(e=>({get isReady(){return e.connected&&e.initialized}})).actions(e=>{const t=()=>rOe(e);return{setConnected(n){const r=e.connected;if(e.connected=n,!n)e.initialized=!1;else if(!r&&n&&(e.hasEverConnected=!0,e.reconnectAttempt=0,e.pendingUpdates.size>0)){t().log.ws.info("Reconnected: clearing stale pending updates",{count:e.pendingUpdates.size});for(const i of e.pendingUpdates.values())if(i.entityType==="terminal"){const a=e.terminals.get(i.tempId);a&&(a.cleanup(),e.terminals.remove(i.tempId)),e.newTerminalIds.delete(i.tempId)}else i.entityType==="tab"&&e.tabs.remove(i.tempId);e.pendingUpdates.clear()}},setInitialized(n){e.initialized=n},setReconnectAttempt(n){e.reconnectAttempt=n},setMaxReconnectAttempts(n){e.maxReconnectAttempts=n},markNewTerminal(n){e.newTerminalIds.add(n)},clearNewTerminal(n){e.newTerminalIds.delete(n)},setLastFocusedTerminal(n){e.lastFocusedTerminalId=n},consumePendingStartup(n){const r=e.terminalsPendingStartup.get(n);return r&&(e.terminalsPendingStartup.delete(n),t().log.ws.info("consumed pending startup",{terminalId:n,taskName:r.taskName})),r},clearStartingUp(n){const r=e.terminals.get(n);r&&(r.setStartingUp(!1),t().log.ws.info("cleared isStartingUp",{terminalId:n}))},setPendingTabCreation(n){e.pendingTabCreation=n},clearLastCreatedTabId(){e.lastCreatedTabId=null},syncTheme(n){t().send({type:"theme:sync",payload:{theme:n}})},clearBroadcastedTheme(){e.broadcastedTheme=null},createTerminal(n){const r=bD(),i=Qz(),a={id:i,name:n.name,cwd:n.cwd??"~",status:"running",cols:n.cols,rows:n.rows,createdAt:Date.now(),tabId:n.tabId??null,positionInTab:n.positionInTab??0},s=Hz(e.terminals);e.terminals.add(a),s.stop();const o=e.terminals.get(i);o?.setPending(!0,i),e.pendingUpdates.set(r,{entityType:"terminal",tempId:i,inversePatches:s.inversePatches,createdAt:Date.now()}),e.newTerminalIds.add(i),n.startup&&(e.terminalsPendingStartup.set(i,n.startup),o?.setStartingUp(!0),t().log.ws.info("createTerminal registered startup",{tempId:i,taskName:n.startup.taskName,isStartingUp:o?.isStartingUp}));const{startup:l,...u}=n;t().send({type:"terminal:create",payload:{...u,requestId:r,tempId:i}}),t().log.ws.debug("createTerminal optimistic",{requestId:r,tempId:i,name:n.name})},destroyTerminal(n,r){t().send({type:"terminal:destroy",payload:{terminalId:n,force:r?.force,reason:r?.reason}});const i=e.terminals.get(n);i&&i.cleanup(),e.terminals.remove(n)},writeToTerminal(n,r){t().send({type:"terminal:input",payload:{terminalId:n,data:r}})},sendInputToTerminal(n,r){t().send({type:"terminal:input",payload:{terminalId:n,data:r}}),setTimeout(()=>{t().send({type:"terminal:input",payload:{terminalId:n,data:"\r"}})},50)},resizeTerminal(n,r,i){t().send({type:"terminal:resize",payload:{terminalId:n,cols:r,rows:i}}),e.terminals.get(n)?.resize(r,i)},renameTerminal(n,r){t().send({type:"terminal:rename",payload:{terminalId:n,name:r}}),e.terminals.get(n)?.rename(r)},attachXterm(n,r,i){const a=e.terminals.get(n);if(!a)return t().log.ws.warn("attachXterm: terminal not found",{terminalId:n}),()=>{};if(a.xterm===r)return t().log.ws.debug("attachXterm: already attached, skipping",{terminalId:n}),i?.onAttached&&(e.terminalsReadyForCallback.has(n)?(e.terminalsReadyForCallback.delete(n),setTimeout(()=>i.onAttached?.(n),0)):e.onAttachedCallbacks.set(n,i.onAttached)),a.attachCleanup||(()=>{});a.attachCleanup&&a.attachCleanup(),a.setXterm(r),r.attachCustomKeyEventHandler(u=>u.type==="keydown"&&u.shiftKey&&u.key==="Enter"?(u.preventDefault(),u.stopPropagation(),t().send({type:"terminal:input",payload:{terminalId:n,data:`
31
- `}}),!1):!0);const s=r.onData(u=>{t().send({type:"terminal:input",payload:{terminalId:n,data:u}})}),o=()=>{this.setLastFocusedTerminal(n)};r.textarea?.addEventListener("focus",o),i?.onAttached&&(e.terminalsReadyForCallback.has(n)?(t().log.ws.debug("attachXterm: terminal already attached, calling callback immediately",{terminalId:n}),e.terminalsReadyForCallback.delete(n),setTimeout(()=>i.onAttached?.(n),0)):(t().log.ws.debug("attachXterm: registering onAttached callback",{terminalId:n,existingCallbacks:Array.from(e.onAttachedCallbacks.keys())}),e.onAttachedCallbacks.set(n,i.onAttached)));const l=()=>{s.dispose(),r.textarea?.removeEventListener("focus",o),e.terminals.get(n)?.setXterm(null)};return a.setAttachCleanup(l),t().send({type:"terminal:attach",payload:{terminalId:n}}),l},requestAttach(n){t().send({type:"terminal:attach",payload:{terminalId:n}})},clearTerminalBuffer(n){t().send({type:"terminal:clearBuffer",payload:{terminalId:n}})},assignTerminalToTab(n,r,i){t().send({type:"terminal:assignTab",payload:{terminalId:n,tabId:r,positionInTab:i}}),e.terminals.get(n)?.assignToTab(r,i)},createTab(n,r,i,a){const s=bD(),o=Qz(),l=r??e.tabs.items.length,u={id:o,name:n,position:l,directory:i??null,createdAt:Date.now()},f=Hz(e.tabs);e.tabs.add(u),f.stop(),e.tabs.get(o)?.setPending(!0),e.pendingTabCreation=o,e.pendingUpdates.set(s,{entityType:"tab",tempId:o,inversePatches:f.inversePatches,createdAt:Date.now()}),t().send({type:"tab:create",payload:{name:n,position:r,directory:i,adoptTerminalId:a,requestId:s,tempId:o}}),t().log.ws.debug("createTab optimistic",{requestId:s,tempId:o,name:n,adoptTerminalId:a})},updateTab(n,r){t().send({type:"tab:update",payload:{tabId:n,...r}}),e.tabs.get(n)?.updateFromServer(r)},deleteTab(n){t().send({type:"tab:delete",payload:{tabId:n}}),e.tabs.remove(n),e.viewState.clearFocusedTerminalForTab(n)},reorderTab(n,r){const i=e.tabs.get(n);if(!i)return;const a=i.position;if(t().send({type:"tab:reorder",payload:{tabId:n,position:r}}),r>a)for(const s of e.tabs.items)s.position>a&&s.position<=r&&s.setPosition(s.position-1);else if(r<a)for(const s of e.tabs.items)s.position>=r&&s.position<a&&s.setPosition(s.position+1);i.setPosition(r)},handleMessage(n){const{type:r,payload:i}=n;switch(r){case"terminals:list":e.terminals.replaceAll(i.terminals);break;case"terminal:created":{const{terminal:a,isNew:s,requestId:o,tempId:l}=i;if(o&&l){const u=e.pendingUpdates.get(o);if(u&&u.tempId===l){e.pendingUpdates.delete(o);const f=e.terminals.get(l);if(f){const d=f.xterm,p=e.onAttachedCallbacks.get(l),m=f.attachCleanup;if(t().log.ws.info("terminal:created optimistic handling",{tempId:l,realId:a.id,hasXterm:!!d,hasCallback:!!p,isNew:s}),m&&m(),f.setXterm(null),f.setAttachCleanup(null),e.onAttachedCallbacks.delete(l),s){const E=f.isStartingUp,S=e.terminals.items.findIndex(v=>v.id===l);S>=0&&iS(e.terminals.items[S]),e.terminals.add(a);const g=e.terminals.get(a.id);E&&g&&(g.setStartingUp(!0),t().log.ws.info("terminal:created transferred isStartingUp",{tempId:l,realId:a.id,isStartingUp:g.isStartingUp})),t().log.ws.info("terminal:created re-attaching xterm",{realId:a.id,hasRealTerminal:!!g,hasXterm:!!d,willAttach:!!(g&&d)}),g&&d?this.attachXterm(a.id,d,{onAttached:p}):p&&(t().log.ws.info("terminal:created preserving callback for later",{realId:a.id}),e.onAttachedCallbacks.set(a.id,p)),e.newTerminalIds.delete(l),e.newTerminalIds.add(a.id);const y=e.terminalsPendingStartup.get(l);y&&(e.terminalsPendingStartup.delete(l),e.terminalsPendingStartup.set(a.id,y),t().log.ws.debug("transferred pending startup",{tempId:l,realId:a.id})),t().log.ws.debug("terminal:created confirmed",{requestId:o,tempId:l,realId:a.id,xtermReattached:!!d,hasPendingStartup:!!y})}else{const E=e.terminals.items.findIndex(g=>g.id===l);E>=0&&iS(e.terminals.items[E]),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l),e.terminals.has(a.id)||e.terminals.add(a),e.terminals.get(a.id)&&d&&this.attachXterm(a.id,d,{onAttached:p}),t().log.ws.debug("terminal:created deduplicated",{requestId:o,tempId:l,existingId:a.id,xtermReattached:!!d})}}break}}e.terminals.add(a),s&&e.newTerminalIds.add(a.id);break}case"terminal:destroyed":{const{terminalId:a}=i;e.terminals.remove(a),e.newTerminalIds.delete(a),e.terminalsReadyForCallback.delete(a),e.onAttachedCallbacks.delete(a);break}case"terminal:output":{const{terminalId:a,data:s}=i,o=e.terminals.get(a);o?.xterm?o.xterm.write(s):t().log.ws.warn("terminal:output but no xterm",{terminalId:a});break}case"terminal:attached":{const{terminalId:a,buffer:s}=i,o=e.terminals.get(a);t().log.ws.info("terminal:attached received",{terminalId:a,hasTerminal:!!o,hasXterm:!!o?.xterm,bufferLength:s?.length??0,hasCallback:e.onAttachedCallbacks.has(a),isReadyForCallback:e.terminalsReadyForCallback.has(a),registeredCallbacks:Array.from(e.onAttachedCallbacks.keys())}),o?.xterm&&(o.xterm.reset(),s&&o.xterm.write(s));const l=e.onAttachedCallbacks.get(a);l?(e.onAttachedCallbacks.delete(a),t().log.ws.debug("terminal:attached calling callback",{terminalId:a}),l(a)):(t().log.ws.debug("terminal:attached no callback yet, marking ready",{terminalId:a}),e.terminalsReadyForCallback.add(a));break}case"terminal:bufferCleared":{const{terminalId:a}=i,s=e.terminals.get(a);s?.xterm&&s.xterm.reset();break}case"terminal:exit":{const{terminalId:a,exitCode:s}=i;e.terminals.get(a)?.markExited(s);break}case"terminal:renamed":{const{terminalId:a,name:s}=i;e.terminals.get(a)?.rename(s);break}case"terminal:tabAssigned":{const{terminalId:a,tabId:s,positionInTab:o}=i;e.terminals.get(a)?.assignToTab(s,o);break}case"tabs:list":e.tabs.replaceAll(i.tabs),e.initialized=!0;break;case"tab:created":{const{tab:a,requestId:s,tempId:o,adoptTerminalId:l}=i;if(s&&o){const u=e.pendingUpdates.get(s);if(u&&u.tempId===o){e.pendingUpdates.delete(s),e.tabs.get(o)&&(e.tabs.remove(o),e.tabs.add(a),e.pendingTabCreation=null,l||(e.lastCreatedTabId=a.id),t().log.ws.debug("tab:created confirmed",{requestId:s,tempId:o,realId:a.id,adoptTerminalId:l}));break}}e.tabs.add(a);break}case"tab:updated":{const{tabId:a,name:s,directory:o}=i;e.tabs.get(a)?.updateFromServer({name:s,directory:o});break}case"tab:deleted":{const{tabId:a}=i;e.tabs.remove(a),e.viewState.clearFocusedTerminalForTab(a);break}case"terminal:error":{const{error:a,requestId:s,tempId:o}=i;if(s&&o){const l=e.pendingUpdates.get(s);if(l&&l.tempId===o){e.pendingUpdates.delete(s);for(let u=l.inversePatches.length-1;u>=0;u--)Pv(e.terminals,l.inversePatches[u]);e.newTerminalIds.delete(o),e.terminalsPendingStartup.delete(o),t().log.ws.warn("terminal:error rollback",{requestId:s,tempId:o,error:a});break}}At.ws.error("Terminal error from server",{error:a});break}case"sync:stale":{const{entityType:a,entityId:s,requestId:o,tempId:l,error:u}=i;if(t().log.ws.warn("sync:stale received",{entityType:a,entityId:s,error:u}),o&&l){const f=e.pendingUpdates.get(o);if(f&&f.tempId===l)if(e.pendingUpdates.delete(o),f.entityType==="terminal"){const d=e.terminals.get(l);d&&(d.cleanup(),e.terminals.remove(l)),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l)}else f.entityType==="tab"&&e.tabs.remove(l)}if(a==="terminal"){if(e.terminals.has(s)){const f=e.terminals.get(s);f&&(f.cleanup(),e.terminals.remove(s))}e.terminalsPendingStartup.delete(s)}else a==="tab"&&e.tabs.has(s)&&(e.tabs.remove(s),e.viewState.clearFocusedTerminalForTab(s));break}case"theme:synced":{const{theme:a}=i;e.broadcastedTheme=a,t().log.ws.debug("theme:synced received",{theme:a});break}}},reset(){e.terminals.clear(),e.tabs.clear(),e.connected=!1,e.initialized=!1,e.newTerminalIds.clear(),e.pendingUpdates.clear(),e.terminalsPendingStartup.clear()}}});function bie(){const e=Um();return k.useMemo(()=>{const t=(n,r)=>{const i=async a=>{const s=a.clipboardData?.items;if(s){for(const o of s)if(o.type.startsWith("image/")){a.preventDefault(),a.stopPropagation();const l=o.getAsFile();if(!l)return;try{const u=await jte(l);e.writeToTerminal(r,u)}catch(u){At.ws.error("Failed to upload image",{error:String(u)})}return}}};return n.addEventListener("paste",i,!0),()=>{n.removeEventListener("paste",i,!0)}};return{get terminals(){return[...e.terminals.items]},get terminalsLoaded(){return e.initialized},get tabs(){return[...e.tabs.sorted]},get connected(){return e.connected},get newTerminalIds(){return e.newTerminalIds},get pendingTabCreation(){return e.pendingTabCreation},get lastCreatedTabId(){return e.lastCreatedTabId},createTerminal:e.createTerminal.bind(e),destroyTerminal:e.destroyTerminal.bind(e),writeToTerminal:e.writeToTerminal.bind(e),sendInputToTerminal:e.sendInputToTerminal.bind(e),resizeTerminal:e.resizeTerminal.bind(e),renameTerminal:e.renameTerminal.bind(e),clearTerminalBuffer:e.clearTerminalBuffer.bind(e),assignTerminalToTab:e.assignTerminalToTab.bind(e),createTab:e.createTab.bind(e),updateTab:e.updateTab.bind(e),deleteTab:e.deleteTab.bind(e),reorderTab:e.reorderTab.bind(e),attachXterm:e.attachXterm.bind(e),setupImagePaste:t,consumePendingStartup:e.consumePendingStartup.bind(e),clearStartingUp:e.clearStartingUp.bind(e),clearLastCreatedTabId:e.clearLastCreatedTabId.bind(e)}},[e])}const Tk="",MRe=Ot.model("File",{path:Ot.identifier,content:Ot.string,originalContent:Ot.string,mimeType:Ot.string,size:Ot.number,lineCount:Ot.number,truncated:Ot.boolean,isMarkdownView:Ot.optional(Ot.boolean,!1)}).views(e=>({get isDirty(){return e.content!==e.originalContent},get isMarkdown(){return e.path.toLowerCase().endsWith(".md")},get isImage(){return e.mimeType.startsWith("image/")},get isBinary(){return e.mimeType==="application/octet-stream"},get isEditable(){return!e.mimeType.startsWith("image/")&&e.mimeType!=="application/octet-stream"}})).actions(e=>({setContent(t){e.content=t},markSaved(){e.originalContent=e.content},toggleMarkdownView(){e.isMarkdownView=!e.isMarkdownView},setMarkdownView(t){e.isMarkdownView=t}})),jRe=Ot.model("FilesStore",{selectedFile:Ot.maybeNull(Ot.string),expandedDirs:Ot.array(Ot.string),openFiles:Ot.map(MRe)}).volatile(()=>({worktreePath:null,readOnly:!1,isLoading:!1,isSaving:!1,loadError:null,saveError:null,fileTree:null,isLoadingTree:!1,treeError:null})).views(e=>({get currentFile(){if(e.selectedFile)return e.openFiles.get(e.selectedFile)},get isDirty(){return(e.selectedFile?e.openFiles.get(e.selectedFile):void 0)?.isDirty??!1},isFileMarkdownView(t){return e.openFiles.get(t)?.isMarkdownView??!1},isDirExpanded(t){return e.expandedDirs.includes(t)}})).actions(e=>({setWorktreePath(t){e.worktreePath!==t&&(e.worktreePath=t,e.selectedFile=null,e.expandedDirs.clear(),e.openFiles.clear(),e.fileTree=null)},setReadOnly(t){e.readOnly=t},selectFile(t){e.selectedFile=t},toggleDir(t){const n=e.expandedDirs.indexOf(t);n>=0?e.expandedDirs.splice(n,1):e.expandedDirs.push(t)},collapseAll(){e.expandedDirs.clear()},updateContent(t,n){const r=e.openFiles.get(t);r&&r.setContent(n)},toggleMarkdownView(t){const n=e.openFiles.get(t);n&&n.toggleMarkdownView()},_setLoading(t){e.isLoading=t},_setLoadError(t){e.loadError=t},_setSaving(t){e.isSaving=t},_setSaveError(t){e.saveError=t},_setFileTree(t){e.fileTree=t},_setLoadingTree(t){e.isLoadingTree=t},_setTreeError(t){e.treeError=t},_addFile(t){e.openFiles.set(t.path,{path:t.path,content:t.content,originalContent:t.content,mimeType:t.mimeType,size:t.size,lineCount:t.lineCount,truncated:t.truncated,isMarkdownView:!1})},_markFileSaved(t){const n=e.openFiles.get(t);n&&n.markSaved()}})).actions(e=>({loadFileTree:Sk(function*(){if(e.worktreePath){e._setLoadingTree(!0),e._setTreeError(null);try{const t=yield zt(`${Tk}/api/fs/tree?root=${encodeURIComponent(e.worktreePath)}`);e._setFileTree(t.entries)}catch(t){e._setTreeError(t instanceof Error?t.message:"Failed to load file tree")}finally{e._setLoadingTree(!1)}}}),loadFile:Sk(function*(t){if(e.worktreePath){if(e.openFiles.has(t)){e.selectedFile=t;return}e._setLoading(!0),e._setLoadError(null);try{const n=new URLSearchParams({path:t,root:e.worktreePath}),r=yield zt(`${Tk}/api/fs/read?${n}`);e._addFile({path:t,content:r.content,mimeType:r.mimeType,size:r.size,lineCount:r.lineCount,truncated:r.truncated}),e.selectedFile=t}catch(n){e._setLoadError(n instanceof Error?n.message:"Failed to load file")}finally{e._setLoading(!1)}}}),saveFile:Sk(function*(t){if(!e.worktreePath)return;const n=e.openFiles.get(t);if(!(!n||!n.isDirty)){e._setSaving(!0),e._setSaveError(null);try{(yield fetch(`${Tk}/api/fs/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,root:e.worktreePath,content:n.content})}).then(i=>i.ok?i.json():i.json().then(a=>{throw new Error(a.error||"Failed to save file")}))).success&&e._markFileSaved(t)}catch(r){throw e._setSaveError(r instanceof Error?r.message:"Failed to save file"),r}finally{e._setSaving(!1)}}}),closeFile(t){e.openFiles.delete(t),e.selectedFile===t&&(e.selectedFile=null)}}));function FRe(){return jRe.create({selectedFile:null,expandedDirs:[],openFiles:{}})}const vie=k.createContext(null);function BRe(e,t=!1,n){const r=k.useMemo(()=>FRe(),[]),i=k.useRef(!1);return k.useEffect(()=>{r.setWorktreePath(e),r.setReadOnly(t),i.current=!1,e&&r.loadFileTree().then(()=>{n&&!i.current&&(i.current=!0,r.selectFile(n),r.loadFile(n))})},[r,e,t,n]),r}function URe(){const e=k.useContext(vie);if(!e)throw new Error("useFilesStore must be used within a FilesStoreProvider");return e}function yie(){const e=URe();return{worktreePath:e.worktreePath,readOnly:e.readOnly,selectedFile:e.selectedFile,currentFile:e.currentFile,expandedDirs:[...e.expandedDirs],fileTree:e.fileTree,isLoading:e.isLoading,isSaving:e.isSaving,isLoadingTree:e.isLoadingTree,loadError:e.loadError,saveError:e.saveError,treeError:e.treeError,isDirty:e.isDirty,selectFile:e.selectFile,loadFile:e.loadFile,saveFile:e.saveFile,closeFile:e.closeFile,updateContent:e.updateContent,toggleDir:e.toggleDir,collapseAll:e.collapseAll,toggleMarkdownView:e.toggleMarkdownView,isFileMarkdownView:e.isFileMarkdownView,isDirExpanded:e.isDirExpanded,refreshTree:e.loadFileTree}}const _ie=k.createContext(null);function Um(){const e=k.useContext(_ie);if(!e)throw new Error("useStore must be used within a StoreProvider");return e}function $Re(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}function zRe({children:e,wsUrl:t=$Re(),reconnectInterval:n=2e3,maxReconnectAttempts:r=10}){const i=k.useRef(null),a=k.useRef(0),s=k.useRef(void 0),o=k.useRef(null),[,l]=k.useState({}),u=k.useCallback(d=>{i.current?.readyState===WebSocket.OPEN?(At.ws.debug("send",{type:d.type}),i.current.send(JSON.stringify(d))):At.ws.warn("send dropped (WebSocket not open)",{type:d.type,readyState:i.current?.readyState??"no socket"})},[]);if(!o.current){const d={send:u,log:At};o.current=PRe.create({},d)}const f=o.current;return k.useEffect(()=>{f.setMaxReconnectAttempts(r)},[f,r]),k.useEffect(()=>{let d=!0;const p=()=>{const m=i.current;if(m&&(m.readyState===WebSocket.CONNECTING||m.readyState===WebSocket.OPEN))return;const E=new WebSocket(t);i.current=E,E.onopen=()=>{d&&(At.ws.info("WebSocket connected"),f.setConnected(!0),a.current=0)},E.onmessage=S=>{if(d)try{const g=JSON.parse(S.data);f.handleMessage(g)}catch(g){At.ws.error("Failed to parse WebSocket message",{error:String(g)})}},E.onclose=()=>{if(d)if(At.ws.info("WebSocket disconnected"),f.setConnected(!1),i.current===E&&(i.current=null),a.current<r){a.current++,f.setReconnectAttempt(a.current);const S=n*Math.pow(1.5,a.current-1);At.ws.info("Scheduling reconnect",{attempt:a.current,delay:S}),s.current=setTimeout(p,S)}else At.ws.warn("Max reconnect attempts reached"),f.setReconnectAttempt(a.current)},E.onerror=S=>{At.ws.error("WebSocket error",{event:String(S)})}};return p(),()=>{d=!1,s.current&&clearTimeout(s.current);const m=i.current;m?.readyState===WebSocket.OPEN&&m.close(),i.current=null}},[t,n,r,f]),k.useEffect(()=>{l({})},[]),b.jsx(_ie.Provider,{value:f,children:e})}function Eie(){const e=Um(),{setTheme:t,resolvedTheme:n,theme:r}=Kc(),{data:i}=nwe(),a=k.useRef(void 0),s=k.useRef(!1),o=k.useRef(!1);k.useEffect(()=>zM(()=>e.broadcastedTheme,f=>{f&&(o.current=!0,t(f),e.clearBroadcastedTheme(),setTimeout(()=>{o.current=!1},0))},{fireImmediately:!0}),[e,t]),k.useEffect(()=>{if(!n)return;const u=n==="dark"?"/logo-dark.jpg":"/logo-light.jpg";let f=document.querySelector('link[rel="icon"]');f||(f=document.createElement("link"),f.rel="icon",document.head.appendChild(f)),f.type="image/jpeg",f.href=u},[n]),k.useEffect(()=>{const u=s.current&&i&&a.current===!1;a.current=i,s.current=!0,n&&u&&zt("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:n})}).catch(()=>{})},[i,n]);const l=k.useCallback(u=>{if(!o.current&&(t(u),e.syncTheme(u),i)){const f=u==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":u;zt("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:f})}).catch(()=>{})}},[t,e,i]);return{theme:r??"system",resolvedTheme:n,syncClaudeCode:i,changeTheme:l,isUpdating:!1}}let Ck=!1;const Jz={activeTabId:null,focusedTerminals:{},currentView:null,currentTaskId:null,isTabVisible:null,viewUpdatedAt:null};function Sie(){const e=wr(),t=k.useRef(void 0),n=k.useRef({}),{data:r=Jz,isLoading:i}=qn({queryKey:["terminal-view-state"],queryFn:async()=>{const p=await fetch("/api/terminal-view-state");if(!p.ok)throw new Error("Failed to fetch terminal view state");return p.json()},staleTime:2e3}),a=Fn({mutationFn:async p=>{const m=await fetch("/api/terminal-view-state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!m.ok)throw new Error("Failed to update terminal view state");return m.json()},onSuccess:p=>{e.setQueryData(["terminal-view-state"],p)}}),s=k.useRef(a);s.current=a;const o=k.useCallback(p=>{const m=n.current;n.current={...m,...p,focusedTerminals:p.focusedTerminals||m.focusedTerminals?{...m.focusedTerminals,...p.focusedTerminals}:void 0};const E=n.current;e.setQueryData(["terminal-view-state"],S=>{const g=S??Jz;return{activeTabId:E.activeTabId!==void 0?E.activeTabId:g.activeTabId,focusedTerminals:{...g.focusedTerminals,...E.focusedTerminals},currentView:E.currentView!==void 0?E.currentView:g.currentView,currentTaskId:E.currentTaskId!==void 0?E.currentTaskId:g.currentTaskId,isTabVisible:E.isTabVisible!==void 0?E.isTabVisible:g.isTabVisible,viewUpdatedAt:E.viewUpdatedAt!==void 0?E.viewUpdatedAt:g.viewUpdatedAt}}),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{s.current.mutate(n.current),n.current={}},500)},[e]),l=k.useCallback((p,m)=>{if(m===null){const E=e.getQueryData(["terminal-view-state"]);if(E){const{[p]:S,...g}=E.focusedTerminals;o({focusedTerminals:g})}}else o({focusedTerminals:{[p]:m}})},[e,o]),u=k.useCallback(p=>r.focusedTerminals[p]??null,[r.focusedTerminals]),f=k.useRef(!1);k.useEffect(()=>{if(Ck){f.current=!1;return}Ck=!0,f.current=!0;const p=()=>{o({isTabVisible:document.visibilityState==="visible",viewUpdatedAt:new Date().toISOString()})};return document.addEventListener("visibilitychange",p),p(),()=>{document.removeEventListener("visibilitychange",p),f.current&&(Ck=!1)}},[o]);const d=k.useCallback((p,m,E)=>{o({currentView:p,currentTaskId:m,activeTabId:E,viewUpdatedAt:new Date().toISOString()})},[o]);return{viewState:r,isLoading:i,getFocusedTerminal:u,setFocusedTerminal:l,updateViewTracking:d}}function no(e,t){const n=e.toLowerCase(),r=t.toLowerCase();if(n===r)return 100;if(n.startsWith(r))return 80;if(n.includes(r))return 60;let i=0,a=0,s=0;for(;i<n.length&&a<r.length;)n[i]===r[a]&&(s+=1,a++),i++;return a===r.length?s:0}function HRe(e,t){return t.trim()?e.map(r=>{let i=no(r.label,t);if(r.keywords)for(const a of r.keywords){const s=no(a,t);s>i&&(i=s)}return{command:r,score:i}}).filter(({score:r})=>r>0).sort((r,i)=>i.score-r.score).map(({command:r})=>r):e}function WRe(e){const t=new Map;for(const n of e){const r=t.get(n.category)||[];r.push(n),t.set(n.category,r)}return t}function VRe({open:e,onOpenChange:t,onNewTask:n,onShowShortcuts:r}){const{t:i}=rn("navigation"),[a,s]=k.useState(!1),o=e??a,l=t??s,[u,f]=k.useState(""),[d,p]=k.useState(0),m=k.useRef(null),E=k.useRef(null),S=Ri(),g=k.useMemo(()=>[{id:"goto-tasks",label:i("commandPalette.commands.goToTasks"),shortcut:"meta+1",keywords:["kanban","board","home"],category:"navigation",icon:b.jsx(fe,{icon:jp,size:16,strokeWidth:2}),action:()=>{S({to:"/tasks"}),l(!1)}},{id:"goto-terminals",label:i("commandPalette.commands.goToTerminals"),shortcut:"meta+2",keywords:["shell","console","cli"],category:"navigation",icon:b.jsx(fe,{icon:R1e,size:16,strokeWidth:2}),action:()=>{S({to:"/terminals"}),l(!1)}},{id:"goto-task-terminals",label:i("commandPalette.commands.goToTaskTerminals"),shortcut:"meta+i",keywords:["tasks","shell","console","cli"],category:"navigation",icon:b.jsx(fe,{icon:jp,size:16,strokeWidth:2}),action:()=>{S({to:"/terminals",search:{tab:"all-tasks"}}),l(!1)}},{id:"goto-repositories",label:i("commandPalette.commands.goToRepositories"),shortcut:"meta+3",keywords:["repos","git","projects"],category:"navigation",icon:b.jsx(fe,{icon:I1e,size:16,strokeWidth:2}),action:()=>{S({to:"/repositories"}),l(!1)}},{id:"goto-review",label:i("commandPalette.commands.goToReview"),shortcut:"meta+4",keywords:["pr","pull request","issues","github"],category:"navigation",icon:b.jsx(fe,{icon:ou,size:16,strokeWidth:2}),action:()=>{S({to:"/review"}),l(!1)}},{id:"goto-monitoring",label:i("commandPalette.commands.goToMonitoring"),shortcut:"meta+5",keywords:["system","cpu","memory","processes","usage"],category:"navigation",icon:b.jsx(fe,{icon:dte,size:16,strokeWidth:2}),action:()=>{S({to:"/monitoring"}),l(!1)}},{id:"goto-settings",label:i("commandPalette.commands.goToSettings"),shortcut:"meta+,",keywords:["preferences","config","configuration"],category:"navigation",icon:b.jsx(fe,{icon:Ete,size:16,strokeWidth:2}),action:()=>{S({to:"/settings"}),l(!1)}},{id:"new-task",label:i("commandPalette.commands.newTask"),shortcut:"meta+j",keywords:["create","add"],category:"actions",icon:b.jsx(fe,{icon:Nv,size:16,strokeWidth:2}),action:()=>{l(!1),n?.()}},{id:"show-shortcuts",label:i("commandPalette.commands.keyboardShortcuts"),shortcut:"meta+/",keywords:["help","hotkeys","keys"],category:"actions",icon:b.jsx(fe,{icon:gte,size:16,strokeWidth:2}),action:()=>{l(!1),r?.()}}],[S,n,r,l,i]),y=k.useMemo(()=>HRe(g,u),[g,u]),v=k.useMemo(()=>WRe(y),[y]),x=k.useMemo(()=>{const C=[],R=["navigation","actions"];for(const O of R){const N=v.get(O);N&&C.push(...N)}return C},[v]);k.useEffect(()=>{p(0)},[u]),k.useEffect(()=>{if(!E.current)return;const C=E.current.querySelector('[data-selected="true"]');C&&C.scrollIntoView({block:"nearest"})},[d]),Va("meta+k",()=>l(!0),{allowInInput:!0,allowInTerminal:!0}),Va("meta+1",()=>S({to:"/tasks"}),{allowInInput:!0,allowInTerminal:!0}),Va("meta+2",()=>S({to:"/terminals"}),{allowInInput:!0,allowInTerminal:!0}),Va("meta+i",()=>{S({to:"/terminals",search:{tab:"all-tasks"}})},{allowInInput:!0,allowInTerminal:!0}),Va("meta+3",()=>S({to:"/repositories"}),{allowInInput:!0,allowInTerminal:!0}),Va("meta+4",()=>S({to:"/review"}),{allowInInput:!0,allowInTerminal:!0}),Va("meta+5",()=>S({to:"/monitoring"}),{allowInInput:!0,allowInTerminal:!0}),Va("meta+,",()=>S({to:"/settings"}),{allowInInput:!0,allowInTerminal:!0}),Va("meta+j",()=>{n?.()},{allowInInput:!1,deps:[n]}),Va("meta+/",()=>{r?.()},{allowInInput:!0,allowInTerminal:!0,deps:[r]});const T=k.useCallback(C=>{switch(C.key){case"ArrowDown":C.preventDefault(),p(R=>Math.min(R+1,x.length-1));break;case"ArrowUp":C.preventDefault(),p(R=>Math.max(R-1,0));break;case"Enter":C.preventDefault(),x[d]&&x[d].action();break;case"Escape":C.preventDefault(),l(!1);break}},[x,d,l]);k.useEffect(()=>{o&&(f(""),p(0),setTimeout(()=>m.current?.focus(),50))},[o]);let w=0;return b.jsx(ed,{open:o,onOpenChange:l,children:b.jsxs(td,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden",showCloseButton:!1,onKeyDown:T,children:[b.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[b.jsx("span",{className:"text-muted-foreground mr-2",children:">"}),b.jsx(dn,{ref:m,value:u,onChange:C=>f(C.target.value),placeholder:i("commandPalette.placeholder"),className:"border-0 ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 px-0 h-12"}),b.jsx("kbd",{className:"pointer-events-none ml-2 inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:"Esc"})]}),b.jsx("div",{ref:E,className:"max-h-80 overflow-y-auto p-2",children:y.length===0?b.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:i("commandPalette.noResults")}):b.jsx(b.Fragment,{children:["navigation","actions"].map(C=>{const R=v.get(C);return!R||R.length===0?null:b.jsxs("div",{className:"mb-2 last:mb-0",children:[b.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:i(`commandPalette.categories.${C}`)}),R.map(O=>{const N=w++,D=N===d;return b.jsxs("button",{"data-selected":D,onClick:()=>O.action(),onMouseEnter:()=>p(N),className:Be("flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm",D?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[O.icon&&b.jsx("span",{className:"text-muted-foreground",children:O.icon}),b.jsx("span",{className:"flex-1 text-left",children:O.label}),O.shortcut&&b.jsx("kbd",{className:"pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:Tte(O.shortcut)})]},O.id)})]},C)})})})]})})}const eH={sm:"w-8 h-8",md:"w-9 h-9 md:w-12 md:h-12",lg:"w-12 h-12 md:w-16 md:h-16"};function GRe({className:e,rows:t=100,cols:n=10,tileClassName:r,tileSize:i="md"}){return b.jsx("div",{className:Be("relative z-0 flex w-full h-full justify-center",e),children:Array.from({length:t}).map((a,s)=>b.jsx("div",{className:Be(eH[i],"border-l dark:border-neutral-900 border-neutral-200 relative",r),children:Array.from({length:n}).map((o,l)=>b.jsx("div",{className:Be(eH[i],"border-r border-t dark:border-neutral-900 border-neutral-200 relative hover:bg-tile transition-colors",r)},`col-${l}`))},`row-${s}`))})}const qRe=["/","/tasks","/terminals","/worktrees","/repositories","/review","/monitoring","/settings"];function KRe(){const e=ri({select:n=>n.location.pathname});return qRe.some(n=>e===n||e.startsWith(n+"/"))?b.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none -z-10",children:b.jsx(GRe,{rows:100,cols:50,tileSize:"sm"})}):null}if(!k.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!Ire)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function YRe(e){e()}function XRe(e){e||(e=YRe),_ke({reactionScheduler:e})}function ZRe(e){return Ske(e)}var QRe=1e4,JRe=1e4,e2e=(function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(r){r===void 0&&(r=QRe),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var i=Date.now();n.registrations.forEach(function(a,s){i-a.registeredAt>=r&&(n.finalize(a.value),n.registrations.delete(s))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){this.registrations.set(r,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,JRe))}}),e})(),t2e=typeof FinalizationRegistry<"u"?FinalizationRegistry:e2e,vD=new t2e(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null});function tH(e){e.reaction=new ul("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function n2e(e,t){t===void 0&&(t="observed");var n=oe.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(o){return vD.unregister(r),r.onStoreChange=o,r.reaction||(tH(r),r.stateVersion=Symbol()),function(){var l;r.onStoreChange=null,(l=r.reaction)===null||l===void 0||l.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var i=n.current;i.reaction||(tH(i),vD.register(n,i,i)),oe.useDebugValue(i.reaction,ZRe),DP.useSyncExternalStore(i.subscribe,i.getSnapshot,i.getSnapshot);var a,s;if(i.reaction.track(function(){try{a=e()}catch(o){s=o}}),s)throw s;return a}var Ak,kk,xie=typeof Symbol=="function"&&Symbol.for,r2e=(kk=(Ak=Object.getOwnPropertyDescriptor(function(){},"name"))===null||Ak===void 0?void 0:Ak.configurable)!==null&&kk!==void 0?kk:!1,nH=xie?Symbol.for("react.forward_ref"):typeof k.forwardRef=="function"&&k.forwardRef(function(e){return null}).$$typeof,rH=xie?Symbol.for("react.memo"):typeof k.memo=="function"&&k.memo(function(e){return null}).$$typeof;function u0(e,t){var n;if(rH&&e.$$typeof===rH)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var r=(n=void 0)!==null&&n!==void 0?n:!1,i=e,a=e.displayName||e.name;if(nH&&e.$$typeof===nH&&(r=!0,i=e.render,typeof i!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var s=function(o,l){return n2e(function(){return i(o,l)},a)};return s.displayName=e.displayName,r2e&&Object.defineProperty(s,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(s.contextTypes=e.contextTypes),r&&(s=k.forwardRef(s)),s=k.memo(s),a2e(e,s),s}var i2e={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function a2e(e,t){Object.keys(e).forEach(function(n){i2e[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var Ok;XRe(xr.unstable_batchedUpdates);Ok=vD.finalizeAllImmediately;const s2e=u0(function(){const t=Um();if(t.connected||!t.hasEverConnected)return null;const n=t.reconnectAttempt>0&&t.reconnectAttempt<t.maxReconnectAttempts,r=t.reconnectAttempt>=t.maxReconnectAttempts;return b.jsx("div",{className:Be("flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium","border-b",r?"bg-destructive/10 border-destructive/30 text-destructive":"bg-amber-500/10 border-amber-500/30 text-amber-600 dark:text-amber-400"),role:"alert","aria-live":"polite",children:r?b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:rs,size:16,strokeWidth:2}),b.jsx("span",{children:"Connection lost. Please check if the server is running."})]}):n?b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:tn,size:16,strokeWidth:2,className:"animate-spin"}),b.jsxs("span",{children:["Reconnecting... (attempt ",t.reconnectAttempt,"/",t.maxReconnectAttempts,")"]})]}):b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:rs,size:16,strokeWidth:2}),b.jsx("span",{children:"Disconnected from server"})]})})});function o2e(){return qn({queryKey:["system","dependencies"],queryFn:()=>zt("/api/system/dependencies"),staleTime:30*1e3,refetchOnWindowFocus:!0})}const iH="npm install -g @anthropic/claude-code",l2e="https://docs.anthropic.com/en/docs/claude-code/overview";function u2e(){const{data:e,isLoading:t}=o2e(),[n,r]=k.useState(!1),[i,a]=k.useState(!1),s=k.useCallback(async()=>{try{await navigator.clipboard.writeText(iH),a(!0),setTimeout(()=>a(!1),2e3)}catch{}},[]),o=k.useCallback(()=>{r(!0)},[]);return t||n||e?.claudeCode?.installed?null:b.jsxs("div",{className:Be("flex items-center justify-between gap-4 px-4 py-3","border-b bg-amber-500/10 border-amber-500/30"),role:"alert",children:[b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx(fe,{icon:rs,size:18,strokeWidth:2,className:"shrink-0 text-amber-600 dark:text-amber-400"}),b.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-4",children:[b.jsx("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:"Claude Code CLI not found"}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("code",{className:"rounded bg-amber-500/20 px-2 py-0.5 text-xs font-mono text-amber-700 dark:text-amber-300",children:iH}),b.jsx("button",{onClick:s,className:Be("p-1 rounded transition-colors","text-amber-600 hover:text-amber-700 hover:bg-amber-500/20","dark:text-amber-400 dark:hover:text-amber-300"),title:i?"Copied!":"Copy to clipboard",children:b.jsx(fe,{icon:i?pl:N1e,size:14,strokeWidth:2})})]})]})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("a",{href:l2e,target:"_blank",rel:"noopener noreferrer",className:Be("text-xs font-medium px-2 py-1 rounded transition-colors","text-amber-600 hover:text-amber-700 hover:bg-amber-500/20","dark:text-amber-400 dark:hover:text-amber-300"),children:"View Docs"}),b.jsx("button",{onClick:o,className:Be("p-1 rounded transition-colors","text-amber-600 hover:text-amber-700 hover:bg-amber-500/20","dark:text-amber-400 dark:hover:text-amber-300"),title:"Dismiss",children:b.jsx(fe,{icon:fi,size:16,strokeWidth:2})})]})]})}const c2e=[{titleKey:"navigation",items:[{labelKey:"goToTasks",shortcut:"meta+1"},{labelKey:"goToTerminals",shortcut:"meta+2"},{labelKey:"goToTaskTerminals",shortcut:"meta+i"},{labelKey:"goToRepositories",shortcut:"meta+3"},{labelKey:"goToReview",shortcut:"meta+4"},{labelKey:"goToMonitoring",shortcut:"meta+5"},{labelKey:"goToSettings",shortcut:"meta+,"}]},{titleKey:"actions",items:[{labelKey:"commandPalette",shortcut:"meta+k"},{labelKey:"newTask",shortcut:"meta+j"},{labelKey:"keyboardShortcuts",shortcut:"meta+/"}]},{titleKey:"terminals",items:[{labelKey:"newTerminal",shortcut:"meta+d"},{labelKey:"closeTerminal",shortcut:"meta+w"}]},{titleKey:"general",items:[{labelKey:"closeModal",shortcut:"escape"},{labelKey:"submitForm",shortcut:"meta+enter"}]}];function d2e({open:e,onOpenChange:t}){const{t:n}=rn("navigation");return b.jsx(ed,{open:e,onOpenChange:t,children:b.jsxs(td,{className:"sm:max-w-md",children:[b.jsx(Gf,{children:b.jsx(qf,{children:n("shortcuts.title")})}),b.jsx("div",{className:"space-y-4 mt-2",children:c2e.map(r=>b.jsxs("div",{children:[b.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:n(`shortcuts.groups.${r.titleKey}`)}),b.jsx("div",{className:"space-y-1",children:r.items.map(i=>b.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[b.jsx("span",{className:"text-sm",children:n(`shortcuts.labels.${i.labelKey}`)}),b.jsx("kbd",{className:"pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:Tte(i.shortcut)})]},i.shortcut))})]},r.titleKey))})]})})}const f2e=({...e})=>{const{resolvedTheme:t}=Kc();return b.jsx(k_e,{theme:t,className:"toaster group",icons:{success:b.jsx(fe,{icon:fte,strokeWidth:2,className:"size-4"}),info:b.jsx(fe,{icon:B1e,strokeWidth:2,className:"size-4"}),warning:b.jsx(fe,{icon:rs,strokeWidth:2,className:"size-4"}),error:b.jsx(fe,{icon:H1e,strokeWidth:2,className:"size-4"}),loading:b.jsx(fe,{icon:tn,strokeWidth:2,className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...e})},ko=nme({component:v2e});function h2e(){return wwe(),null}function p2e(){return zne(),null}function m2e(){return Eie(),null}function g2e(){const e=ri({select:n=>n.location}),{updateViewTracking:t}=Sie();return k.useEffect(()=>{const n=e.pathname;let r="other",i=null,a=null;n.startsWith("/tasks/")?(r="task-detail",i=n.split("/")[2]||null):n==="/terminals"&&(r="terminals",a=new URLSearchParams(e.search).get("tab")),t(r,i,a)},[e.pathname,e.search,t]),null}function b2e(){const e=ri({select:t=>t.location});return k.useEffect(()=>{window.parent!==window&&window.parent.postMessage({type:"vibora:route",pathname:e.pathname,search:e.search},"*")},[e.pathname,e.search]),null}function v2e(){const[e,t]=k.useState(null),[n,r]=k.useState(!1),[i,a]=k.useState(!1),s=typeof window<"u"&&window.parent!==window,o=k.useCallback(d=>{t(()=>d)},[]),l=k.useCallback(()=>{e?.()},[e]),u=k.useCallback(()=>{r(!0)},[]),f=k.useCallback(()=>{a(!0)},[]);return b.jsx(I_e,{children:b.jsxs("div",{className:"flex h-screen flex-col overflow-x-hidden bg-background text-foreground",children:[b.jsx(h2e,{}),b.jsx(p2e,{}),b.jsx(m2e,{}),b.jsx(g2e,{}),b.jsx(b2e,{}),b.jsx(s2e,{}),b.jsx(u2e,{}),b.jsx(_we,{onNewTaskRef:o,onOpenCommandPalette:f}),b.jsxs("main",{className:"isolate flex-1 overflow-hidden relative",children:[b.jsx(KRe,{}),b.jsx(cJ,{})]}),b.jsx(VRe,{open:i,onOpenChange:a,onNewTask:l,onShowShortcuts:u}),b.jsx(d2e,{open:n,onOpenChange:r}),b.jsx(f2e,{position:s?"bottom-center":"bottom-right"})]})})}const y2e=js("/")({beforeLoad:()=>{throw KQ({to:"/tasks"})}}),yD="";function wie(){const[e,t]=k.useState(new Map),[n,r]=k.useState(null),[i,a]=k.useState(!0),[s,o]=k.useState(!1),[l,u]=k.useState(null),f=k.useRef(null),d=k.useRef(0),p=k.useRef(!1),m=k.useCallback(async()=>{a(!0),u(null);try{const g=await fetch(`${yD}/api/worktrees/json`);if(!g.ok)throw new Error("Failed to fetch worktrees");const y=await g.json();t(new Map(y.worktrees.map(v=>[v.path,{...v,size:v.size||0,sizeFormatted:v.sizeFormatted||"0 B",branch:v.branch||"unknown"}]))),r(y.summary),a(!1),o(!1)}catch(g){u(g instanceof Error?g:new Error("Failed to load worktrees")),a(!1),o(!1)}},[]),E=k.useCallback(()=>{if(p.current){m();return}f.current?.close(),a(!0),o(!1),u(null),t(new Map),r(null);const g=new EventSource(`${yD}/api/worktrees`);f.current=g,g.addEventListener("worktree:basic",y=>{const v=JSON.parse(y.data);d.current=v.length,t(new Map(v.map(x=>[x.path,{...x,size:0,sizeFormatted:"...",branch:"..."}]))),a(!1),o(v.length>0)}),g.addEventListener("worktree:details",y=>{const v=JSON.parse(y.data);t(x=>{const T=new Map(x),w=T.get(v.path);return w&&T.set(v.path,{...w,size:v.size,sizeFormatted:v.sizeFormatted,branch:v.branch}),T}),d.current--,d.current<=0&&o(!1)}),g.addEventListener("worktree:complete",y=>{const v=JSON.parse(y.data);r(v),o(!1),g.close()}),g.addEventListener("worktree:error",y=>{const{path:v}=JSON.parse(y.data);At.viewer.error("Error loading worktree details",{path:v}),d.current--,d.current<=0&&o(!1)}),g.onerror=()=>{g.close(),At.viewer.info("SSE connection failed, trying JSON fallback"),p.current=!0,m()}},[m]);return k.useEffect(()=>(E(),()=>{f.current?.close()}),[E]),{worktrees:k.useMemo(()=>Array.from(e.values()).sort((y,v)=>y.isOrphaned!==v.isOrphaned?y.isOrphaned?-1:1:new Date(v.lastModified).getTime()-new Date(y.lastModified).getTime()),[e]),summary:n,isLoading:i,isLoadingDetails:s,error:l,refetch:E}}function Tie(){const e=wr();return Fn({mutationFn:({worktreePath:t,repoPath:n,deleteLinkedTask:r})=>zt(`${yD}/api/worktrees`,{method:"DELETE",body:JSON.stringify({worktreePath:t,repoPath:n,deleteLinkedTask:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worktrees"]}),e.invalidateQueries({queryKey:["tasks"]})}})}const _2e=Xc("h-5 gap-1 rounded-full border border-transparent px-2 py-0.5 text-[0.625rem] font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-2.5! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-colors overflow-hidden group/badge",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground bg-input/20 dark:bg-input/30",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function co({className:e,variant:t="default",render:n,...r}){return Axe({defaultTagName:"span",props:ol({className:Be(_2e({className:e,variant:t}))},r),render:n,state:{slot:"badge",variant:t}})}function wa({className:e,size:t="default",...n}){return b.jsx("div",{"data-slot":"card","data-size":t,className:Be("ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-lg py-4 text-xs/relaxed ring-1 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg group/card flex flex-col",e),...n})}function E2e({className:e,...t}){return b.jsx("div",{"data-slot":"card-header",className:Be("gap-1 rounded-t-lg px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]",e),...t})}function S2e({className:e,...t}){return b.jsx("div",{"data-slot":"card-title",className:Be("text-sm font-medium",e),...t})}function Mf({className:e,...t}){return b.jsx("div",{"data-slot":"card-content",className:Be("px-4 group-data-[size=sm]/card:px-3",e),...t})}function go({...e}){return b.jsx(zEe,{"data-slot":"alert-dialog",...e})}function wu({...e}){return b.jsx(Pte,{"data-slot":"alert-dialog-trigger",...e})}function x2e({...e}){return b.jsx(Nte,{"data-slot":"alert-dialog-portal",...e})}function w2e({className:e,...t}){return b.jsx(Ate,{"data-slot":"alert-dialog-overlay",className:Be("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50",e),...t})}function bo({className:e,size:t="default",...n}){return b.jsxs(x2e,{children:[b.jsx(w2e,{}),b.jsx(Rte,{"data-slot":"alert-dialog-content","data-size":t,className:Be("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/10 gap-3 rounded-xl p-4 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none",e),...n})]})}function vo({className:e,...t}){return b.jsx("div",{"data-slot":"alert-dialog-header",className:Be("grid grid-rows-[auto_1fr] place-items-center gap-1 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 yo({className:e,...t}){return b.jsx("div",{"data-slot":"alert-dialog-footer",className:Be("flex flex-col-reverse gap-2 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 _o({className:e,...t}){return b.jsx(Lte,{"data-slot":"alert-dialog-title",className:Be("text-sm 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 Eo({className:e,...t}){return b.jsx(kte,{"data-slot":"alert-dialog-description",className:Be("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",e),...t})}function qp({className:e,...t}){return b.jsx(qe,{"data-slot":"alert-dialog-action",className:Be(e),...t})}function So({className:e,variant:t="outline",size:n="default",...r}){return b.jsx(qx,{"data-slot":"alert-dialog-cancel",className:Be(e),render:b.jsx(qe,{variant:t,size:n}),...r})}const hi=k.forwardRef(({className:e,...t},n)=>b.jsx(bSe,{ref:n,className:Be("peer size-4 shrink-0 rounded border border-input ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","data-checked:bg-primary data-checked:border-primary data-checked:text-primary-foreground","flex items-center justify-center transition-colors",e),...t,children:b.jsx(vSe,{className:"flex items-center justify-center",children:b.jsx(fe,{icon:pl,size:12,strokeWidth:3})})}));hi.displayName="Checkbox";const _D={IN_PROGRESS:"bg-muted-foreground/20 text-muted-foreground",IN_REVIEW:"bg-primary/20 text-primary",DONE:"bg-accent/20 text-accent",CANCELED:"bg-destructive/20 text-destructive",ORPHANED:"bg-destructive/20 text-destructive"},T2e=js("/worktrees/")({component:O2e});function C2e(){const{t:e}=rn("common");return t=>{const n=new Date(t),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3),s=Math.floor(a/60),o=Math.floor(s/60),l=Math.floor(o/24);return l>0?l===1?e("time.dayAgo"):e("time.daysAgo",{count:l}):o>0?o===1?e("time.hourAgo"):e("time.hoursAgo",{count:o}):s>0?s===1?e("time.minuteAgo"):e("time.minutesAgo",{count:s}):e("time.justNow")}}function aH({className:e}){return b.jsx("span",{className:`inline-block animate-pulse rounded bg-muted ${e}`})}function A2e({worktree:e,onDelete:t}){const{t:n}=rn("common"),{t:r}=rn("worktrees"),i=C2e(),[a,s]=k.useState(!1),[o,l]=k.useState(!1),[u,f]=k.useState(!1),d=e.sizeFormatted==="..."||e.branch==="...",p=!e.isOrphaned&&e.taskId,m=async()=>{l(!0);try{await t(e,u),s(!1)}catch{}finally{l(!1)}},E=S=>{s(S),S||f(!1)};return b.jsx(wa,{className:"transition-colors hover:border-border/80",children:b.jsxs(Mf,{className:"flex items-start justify-between gap-4 py-4",children:[b.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"truncate font-medium",children:e.name}),e.isOrphaned?b.jsx(co,{className:Be("shrink-0",_D.ORPHANED),children:n("statuses.ORPHANED")}):e.taskStatus?b.jsx(co,{className:Be("shrink-0",_D[e.taskStatus]),children:n(`statuses.${e.taskStatus}`)}):null]}),b.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Vi,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate font-mono",children:e.path})]}),b.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Vx,size:12,strokeWidth:2,className:"shrink-0"}),e.branch==="..."?b.jsx(aH,{className:"h-3 w-16"}):b.jsx("span",{className:"font-mono",children:e.branch})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:mte,size:12,strokeWidth:2,className:"shrink-0"}),e.sizeFormatted==="..."?b.jsx(aH,{className:"h-3 w-12"}):b.jsx("span",{children:e.sizeFormatted})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:cte,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{children:i(e.lastModified)})]})]}),e.taskId&&e.taskTitle&&b.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:b.jsxs(Ai,{to:"/tasks/$taskId",params:{taskId:e.taskId},className:"inline-flex items-center gap-1 text-foreground hover:underline",children:[b.jsx("span",{className:"truncate",children:e.taskTitle}),b.jsx(fe,{icon:Xy,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),b.jsxs(go,{open:a,onOpenChange:E,children:[b.jsx(wu,{render:b.jsx(qe,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:d}),children:b.jsx(fe,{icon:bu,size:14,strokeWidth:2})}),b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsx(_o,{children:r("delete.title")}),b.jsxs(Eo,{children:[r("delete.description")," ",b.jsx("span",{className:"font-mono",children:e.name}),".",u&&p&&b.jsxs(b.Fragment,{children:[" ",r("delete.linkedTaskWillBeDeleted",{title:e.taskTitle})]})," ",r("delete.cannotUndo")]}),p&&b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(hi,{checked:u,onCheckedChange:S=>f(S===!0),disabled:o}),r("delete.alsoDeleteLinkedTask",{title:e.taskTitle})]})]}),b.jsxs(yo,{children:[b.jsx(So,{disabled:o,children:n("buttons.cancel")}),b.jsxs(qe,{variant:"destructive",onClick:m,disabled:o,className:"gap-2",children:[o&&b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}),n(o?"status.deleting":"buttons.delete")]})]})]})]})]})})}const k2e=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function O2e(){const{t:e}=rn("common"),{t}=rn("worktrees"),{worktrees:n,summary:r,isLoading:i,isLoadingDetails:a,error:s,refetch:o}=wie(),l=Tie(),[u,f]=k.useState(new Set),[d,p]=k.useState(!1),[m,E]=k.useState(!1),[S,g]=k.useState(!1),y=O=>{f(N=>{const D=new Set(N);return D.has(O)?D.delete(O):D.add(O),D})},v=()=>{f(new Set)},x=k.useMemo(()=>u.size===0?n:n.filter(O=>!!(O.isOrphaned&&u.has("ORPHANED")||O.taskStatus&&u.has(O.taskStatus))),[n,u]),T=k.useMemo(()=>n.filter(O=>O.taskStatus==="DONE"||O.taskStatus==="CANCELED"),[n]),w=async()=>{if(T.length!==0){E(!0);try{for(const O of T)await l.mutateAsync({worktreePath:O.path,repoPath:O.repoPath,deleteLinkedTask:S});p(!1),o()}catch{}finally{E(!1)}}},C=O=>{p(O),O||g(!1)},R=async(O,N)=>{await l.mutateAsync({worktreePath:O.path,repoPath:O.repoPath,deleteLinkedTask:N}),o()};return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsx("h1",{className:"text-sm font-medium",children:t("title")}),(r||n.length>0)&&b.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[b.jsx("span",{children:t("summary.total",{count:r?.total??n.length})}),(r?.orphaned??n.filter(O=>O.isOrphaned).length)>0&&b.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:r?.orphaned??n.filter(O=>O.isOrphaned).length})}),a?b.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):r?b.jsx("span",{children:r.totalSizeFormatted}):null]})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[T.length>0&&b.jsxs(go,{open:d,onOpenChange:C,children:[b.jsxs(wu,{render:b.jsx(qe,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:a}),children:[b.jsx(fe,{icon:hte,size:12,strokeWidth:2}),t("cleanup.button",{count:T.length})]}),b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsx(_o,{children:t("cleanup.title")}),b.jsxs(Eo,{children:[t("cleanup.description",{count:T.length}),S&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("p",{className:"text-sm text-muted-foreground",children:[T.filter(O=>O.taskStatus==="DONE").length>0&&b.jsxs("span",{className:"mr-3",children:[b.jsx("span",{className:"font-medium text-accent",children:T.filter(O=>O.taskStatus==="DONE").length})," ",t("cleanup.done")]}),T.filter(O=>O.taskStatus==="CANCELED").length>0&&b.jsxs("span",{children:[b.jsx("span",{className:"font-medium text-destructive",children:T.filter(O=>O.taskStatus==="CANCELED").length})," ",t("cleanup.canceled")]})]}),b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(hi,{checked:S,onCheckedChange:O=>g(O===!0),disabled:m}),t("cleanup.alsoDeleteLinkedTasks")]}),b.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),b.jsxs(yo,{children:[b.jsx(So,{disabled:m,children:e("buttons.cancel")}),b.jsxs(qe,{variant:"destructive",onClick:w,disabled:m,className:"gap-2",children:[m&&b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}),m?e("status.deleting"):t("delete.button",{count:T.length})]})]})]})]}),u.size>0&&b.jsxs(qe,{variant:"ghost",size:"sm",onClick:v,className:"gap-1.5 text-xs",children:[b.jsx(fe,{icon:fi,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),b.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:k2e.map(O=>{const N=u.has(O);return b.jsx("button",{onClick:()=>y(O),className:Be("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",N?_D[O]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${O}`)},O)})})]}),b.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[i&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),s&&b.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[b.jsx(fe,{icon:rs,size:20,strokeWidth:2}),b.jsx("span",{className:"text-sm",children:t("error.failedToLoad",{message:s.message})})]}),!i&&!s&&x.length===0&&b.jsx("div",{className:"py-12 text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:u.size>0?t("empty.noMatch"):t("empty.noWorktrees")})}),!i&&b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:x.map(O=>b.jsx(A2e,{worktree:O,onDelete:R},O.path))})]})]})}function Wn(e,t="Assertion error"){if(!e)throw Error(t)}function Kp({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,i)=>(r+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function ED(e,t){return t.sort(e==="horizontal"?R2e:N2e)}function R2e(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function N2e(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Cie(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function I2e({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let i,a=Number.MAX_VALUE;for(const s of t){const{x:o,y:l}=Cie(r,s),u=e==="horizontal"?o:l;u<a&&(a=u,i=s)}return Wn(i,"No rect found"),i}function Aie(e){const{element:t,orientation:n,panels:r,separators:i}=e,a=ED(n,Array.from(t.children).filter(f=>f instanceof HTMLElement).map(f=>({element:f}))).map(({element:f})=>f),s=[];let o=!1,l,u=[];for(const f of a)if(f.hasAttribute("data-panel")){const d=r.find(p=>p.element===f);if(d){if(l){const p=l.element.getBoundingClientRect(),m=f.getBoundingClientRect();let E;if(o){const S=n==="horizontal"?new DOMRect(p.right,p.top,0,p.height):new DOMRect(p.left,p.bottom,p.width,0),g=n==="horizontal"?new DOMRect(m.left,m.top,0,m.height):new DOMRect(m.left,m.top,m.width,0);switch(u.length){case 0:{E=[S,g];break}case 1:{const y=u[0],v=I2e({orientation:n,rects:[p,m],targetRect:y.element.getBoundingClientRect()});E=[y,v===p?g:S];break}default:{E=u;break}}}else u.length?E=u:E=[n==="horizontal"?new DOMRect(p.right,m.top,m.left-p.right,m.height):new DOMRect(m.left,p.bottom,m.width,m.top-p.bottom)];for(const S of E)s.push({group:e,groupSize:Kp({group:e}),panels:[l,d],separator:"width"in S?void 0:S,rect:"width"in S?S:S.element.getBoundingClientRect()})}o=!1,l=d,u=[]}}else if(f.hasAttribute("data-separator")){const d=i.find(p=>p.element===f);d?u.push(d):(l=void 0,u=[])}else o=!0;return s}function D2e(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function L2e(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function P2e(e){return e/100*window.innerHeight}function M2e(e){return e/100*window.innerWidth}function j2e(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function k_({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,a]=j2e(n);switch(a){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=L2e(t,i);break}case"em":{r=D2e(t,i);break}case"vh":{r=P2e(i);break}case"vw":{r=M2e(i);break}}return r}function ao(e){return parseFloat(e.toFixed(3))}function sH(e){const{panels:t}=e,n=Kp({group:e});return n===0?t.map(r=>({collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:i,panelConstraints:a}=r;let s=0;if(a.collapsedSize){const f=k_({groupSize:n,panelElement:i,styleProp:a.collapsedSize});s=ao(f/n*100)}let o;if(a.defaultSize){const f=k_({groupSize:n,panelElement:i,styleProp:a.defaultSize});o=ao(f/n*100)}let l=0;if(a.minSize){const f=k_({groupSize:n,panelElement:i,styleProp:a.minSize});l=ao(f/n*100)}let u=100;if(a.maxSize){const f=k_({groupSize:n,panelElement:i,styleProp:a.maxSize});u=ao(f/n*100)}return{collapsedSize:s,collapsible:a.collapsible===!0,defaultSize:o,minSize:l,maxSize:u,panelId:r.id}})}class F2e{#e={};addListener(t,n){const r=this.#e[t];return r===void 0?this.#e[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=this.#e[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let i=!1,a=null;const s=Array.from(r);for(let o=0;o<s.length;o++){const l=s[o];try{l.call(null,n)}catch(u){a===null&&(i=!0,a=u)}}if(i)throw a}}removeAllListeners(){this.#e={}}removeListener(t,n){const r=this.#e[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}}function Ji(e,t,n=0){return Math.abs(ao(e)-ao(t))<=n}let Es={cursorFlags:0,interactionState:{state:"inactive"},mountedGroups:new Map};const _f=new F2e;function vl(){return Es}function Ls(e){const t=typeof e=="function"?e(Es):e;if(Es===t)return Es;const n=Es;return Es={...Es,...t},t.cursorFlags!==void 0&&_f.emit("cursorFlagsChange",Es.cursorFlags),t.interactionState!==void 0&&_f.emit("interactionStateChange",Es.interactionState),t.mountedGroups!==void 0&&(Es.mountedGroups.forEach((r,i)=>{r.derivedPanelConstraints.forEach(a=>{if(a.collapsible){const{layout:s}=n.mountedGroups.get(i)??{};if(s){const o=Ji(a.collapsedSize,r.layout[a.panelId]),l=Ji(a.collapsedSize,s[a.panelId]);o&&!l&&(i.inMemoryLastExpandedPanelSizes[a.panelId]=s[a.panelId])}}})}),_f.emit("mountedGroupsChange",Es.mountedGroups)),Es}const B2e=e=>e,Rk=()=>{},kie=1,Oie=2,Rie=4,Nie=8,oH={coarse:10,precise:5};function U2e({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(a=>{if(!a.disableCursor)switch(a.orientation){case"horizontal":{r++;break}case"vertical":{i++;break}}})}if(r===0&&i===0)return null;switch(n){case"active":{const a=(e&kie)!==0,s=(e&Oie)!==0,o=(e&Rie)!==0,l=(e&Nie)!==0;if(e){if(a)return o?"se-resize":l?"ne-resize":"e-resize";if(s)return o?"sw-resize":l?"nw-resize":"w-resize";if(o)return"s-resize";if(l)return"n-resize"}break}}return r>0&&i>0?"move":r>0?"ew-resize":"ns-resize"}let Nk,jo;function QM(){jo===void 0&&(jo=new CSSStyleSheet,document.adoptedStyleSheets=[jo]);const{cursorFlags:e,interactionState:t}=vl();switch(t.state){case"active":case"hover":{const n=U2e({cursorFlags:e,groups:t.hitRegions.map(i=>i.group),state:t.state}),r=`*{cursor: ${n} !important; ${t.state==="active"?"touch-action: none;":""} }`;if(Nk===r)return;Nk=r,n?jo.cssRules.length===0?jo.insertRule(r):jo.replaceSync(r):jo.cssRules.length===1&&jo.deleteRule(0);break}case"inactive":{Nk=void 0,jo.cssRules.length===1&&jo.deleteRule(0);break}}}function $2e(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Uv(e,t){return Ji(e,t)?0:e>t?1:-1}function up({panelConstraints:e,size:t}){const{collapsedSize:n=0,collapsible:r,maxSize:i=100,minSize:a=0}=e;if(Uv(t,a)<0)if(r){const s=(n+a)/2;Uv(t,s)<0?t=n:t=a}else t=a;return t=Math.min(i,t),t=ao(t),t}function $v({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Ji(e,0))return t;const s=Object.values(t),o=Object.values(i),l=[...s],[u,f]=r;Wn(u!=null,"Invalid first pivot index"),Wn(f!=null,"Invalid second pivot index");let d=0;if(a==="keyboard"){{const E=e<0?f:u,S=n[E];Wn(S,`Panel constraints not found for index ${E}`);const{collapsedSize:g=0,collapsible:y,minSize:v=0}=S;if(y){const x=s[E];if(Wn(x!=null,`Previous layout not found for panel index ${E}`),Ji(x,g)){const T=v-x;Uv(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}{const E=e<0?u:f,S=n[E];Wn(S,`No panel constraints found for index ${E}`);const{collapsedSize:g=0,collapsible:y,minSize:v=0}=S;if(y){const x=s[E];if(Wn(x!=null,`Previous layout not found for panel index ${E}`),Ji(x,v)){const T=x-g;Uv(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}}{const E=e<0?1:-1;let S=e<0?f:u,g=0;for(;;){const v=s[S];Wn(v!=null,`Previous layout not found for panel index ${S}`);const x=up({panelConstraints:n[S],size:100})-v;if(g+=x,S+=E,S<0||S>=n.length)break}const y=Math.min(Math.abs(e),Math.abs(g));e=e<0?0-y:y}{let E=e<0?u:f;for(;E>=0&&E<n.length;){const S=Math.abs(e)-Math.abs(d),g=s[E];Wn(g!=null,`Previous layout not found for panel index ${E}`);const y=g-S,v=up({panelConstraints:n[E],size:y});if(!Ji(g,v)&&(d+=g-v,l[E]=v,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?E--:E++}}if($2e(o,l))return i;{const E=e<0?f:u,S=s[E];Wn(S!=null,`Previous layout not found for panel index ${E}`);const g=S+d,y=up({panelConstraints:n[E],size:g});if(l[E]=y,!Ji(y,g)){let v=g-y,x=e<0?f:u;for(;x>=0&&x<n.length;){const T=l[x];Wn(T!=null,`Previous layout not found for panel index ${x}`);const w=T+v,C=up({panelConstraints:n[x],size:w});if(Ji(T,C)||(v-=C-T,l[x]=C),Ji(v,0))break;e>0?x--:x++}}}const p=Object.values(l).reduce((E,S)=>S+E,0);if(!Ji(p,100,.1))return i;const m=Object.keys(i);return l.reduce((E,S,g)=>(E[m[g]]=S,E),{})}function $m(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Uv(e[n],t[n])!==0)return!1;return!0}function Iie({event:e,hitRegions:t,initialLayoutMap:n,mountedGroups:r,pointerDownAtPoint:i}){let a=0;const s=new Map(r);t.forEach(o=>{const{group:l,groupSize:u}=o,{disableCursor:f,orientation:d,panels:p}=l;let m=0;i?d==="horizontal"?m=(e.clientX-i.x)/u*100:m=(e.clientY-i.y)/u*100:d==="horizontal"?m=e.clientX<0?-100:100:m=e.clientY<0?-100:100;const E=n.get(l),{defaultLayoutDeferred:S,derivedPanelConstraints:g,layout:y,separatorToPanels:v}=r.get(l)??{defaultLayoutDeferred:!1};if(g&&E&&y&&v){const x=$v({delta:m,initialLayout:E,panelConstraints:g,pivotIndices:o.panels.map(T=>p.indexOf(T)),prevLayout:y,trigger:"mouse-or-touch"});if($m(x,y)){if(m!==0&&!f)switch(d){case"horizontal":{a|=m<0?kie:Oie;break}case"vertical":{a|=m<0?Rie:Nie;break}}}else{s.set(o.group,{defaultLayoutDeferred:S,derivedPanelConstraints:g,layout:x,separatorToPanels:v});const T=o.group.panels.map(({id:w})=>w).join(",");o.group.inMemoryLayouts[T]=x}}}),Ls({cursorFlags:a,mountedGroups:s}),QM()}function lH(e){if(e.defaultPrevented||e.relatedTarget!==null||e.clientX===0&&e.clientY===0)return;const{interactionState:t,mountedGroups:n}=vl();t.state==="active"&&t.hitRegions.forEach(r=>{e.currentTarget===r.group.element&&Iie({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n})})}function mE(e){const t=e.parentElement;Wn(t,"Parent group element not found");const{mountedGroups:n}=vl();for(const[r]of n)if(r.element===t)return r;throw Error("Could not find parent Group for separator element")}function jf({layout:e,panelConstraints:t}){const n=[...Object.values(e)],r=n.reduce((s,o)=>s+o,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!Ji(r,100)&&n.length>0)for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=100/r*o;n[s]=l}let i=0;for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=up({panelConstraints:t[s],size:o});o!=l&&(i+=o-l,n[s]=l)}if(!Ji(i,0))for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=o+i,u=up({panelConstraints:t[s],size:l});if(o!==u&&(i-=u-o,n[s]=u,Ji(i,0)))break}const a=Object.keys(e);return n.reduce((s,o,l)=>(s[a[l]]=o,s),{})}function Die({groupId:e}){const t=()=>{const{mountedGroups:n}=vl();for(const[r,i]of n)if(r.id===e)return{group:r,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:a,layout:s,separatorToPanels:o}=t(),l=jf({layout:n,panelConstraints:i});return r?s:($m(s,l)||Ls(u=>({mountedGroups:new Map(u.mountedGroups).set(a,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:l,separatorToPanels:o})})),l)}}}function Lie(e){const{mountedGroups:t}=vl(),n=t.get(e);return Wn(n,`Mounted Group ${e.id} not found`),n}function Pd(e,t){const n=mE(e),r=Lie(n),i=n.separators.find(f=>f.element===e);Wn(i,"Matching separator not found");const a=r.separatorToPanels.get(i);Wn(a,"Matching panels not found");const s=a.map(f=>n.panels.indexOf(f)),o=Die({groupId:n.id}).getLayout(),l=$v({delta:t,initialLayout:o,panelConstraints:r.derivedPanelConstraints,pivotIndices:s,prevLayout:o,trigger:"keyboard"}),u=jf({layout:l,panelConstraints:r.derivedPanelConstraints});$m(o,u)||Ls(f=>({mountedGroups:new Map(f.mountedGroups).set(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,layout:u,separatorToPanels:r.separatorToPanels})}))}function uH(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=mE(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Pd(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Pd(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Pd(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Pd(t,-5);break}case"End":{e.preventDefault(),Pd(t,100);break}case"Enter":{e.preventDefault();const r=mE(t),{derivedPanelConstraints:i,layout:a,separatorToPanels:s}=Lie(r),o=r.separators.find(d=>d.element===t);Wn(o,"Matching separator not found");const l=s.get(o);Wn(l,"Matching panels not found");const u=l[0],f=i.find(d=>d.panelId===u.id);if(Wn(f,"Panel metadata not found"),f.collapsible){const d=a[u.id],p=f.collapsedSize===d?r.inMemoryLastExpandedPanelSizes[u.id]??f.minSize:f.collapsedSize;Pd(t,p-d)}break}case"F6":{e.preventDefault();const r=mE(t).separators.map(s=>s.element),i=Array.from(r).findIndex(s=>s===e.currentTarget);Wn(i!==null,"Index not found");const a=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[a].focus();break}case"Home":{e.preventDefault(),Pd(t,-100);break}}}function z2e(e,t,n){let r,i={x:1/0,y:1/0};for(const a of t){const s=Cie(n,a.rect);switch(e){case"horizontal":{s.x<=i.x&&(r=a,i=s);break}case"vertical":{s.y<=i.y&&(r=a,i=s);break}}}return r?{distance:i,hitRegion:r}:void 0}let O_;function H2e(){return O_===void 0&&(typeof matchMedia=="function"?O_=!!matchMedia("(pointer:coarse)").matches:O_=!1),O_}function W2e(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:fH(e),b:fH(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Wn(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:dH(cH(n.a)),b:dH(cH(n.b))};if(i.a===i.b){const a=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let o=a.length;for(;o--;){const l=a[o];if(l===s.a)return 1;if(l===s.b)return-1}}return Math.sign(i.a-i.b)}const V2e=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function G2e(e){const t=getComputedStyle(Pie(e)??e).display;return t==="flex"||t==="inline-flex"}function q2e(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||G2e(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||V2e.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function cH(e){let t=e.length;for(;t--;){const n=e[t];if(Wn(n,"Missing node"),q2e(n))return n}return null}function dH(e){return e&&Number(getComputedStyle(e).zIndex)||0}function fH(e){const t=[];for(;e;)t.push(e),e=Pie(e);return t}function Pie(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}function K2e(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Y2e({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!(n instanceof HTMLElement)||n.contains(e)||e.contains(n))return!0;if(W2e(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(K2e(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Mie(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const a=H2e()?oH.coarse:oH.precise,s=Aie(i),o=z2e(i.orientation,s,{x:e.clientX,y:e.clientY});o&&o.distance.x<=a&&o.distance.y<=a&&Y2e({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function hH(e){if(e.defaultPrevented)return;const{mountedGroups:t}=vl(),n=Mie(e,t),r=new Set,i=new Set,a=new Set,s=new Map;let o=!1;n.forEach(l=>{r.add(l.group),l.panels.forEach(f=>{i.add(f)}),l.separator&&(a.add(l.separator),o||(o=!0,l.separator.element.focus()));const u=t.get(l.group);u&&s.set(l.group,u.layout)}),Ls({interactionState:{hitRegions:n,initialLayoutMap:s,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}}),n.length&&e.preventDefault()}function pH(e){if(e.defaultPrevented)return;const{interactionState:t,mountedGroups:n}=vl();switch(t.state){case"active":{if(e.type!=="pointerleave"&&e.buttons===0){Ls(r=>r.interactionState.state==="inactive"?r:{cursorFlags:0,interactionState:{state:"inactive"}});return}Iie({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint});break}default:{const r=Mie(e,n);r.length===0?t.state!=="inactive"&&Ls({interactionState:{state:"inactive"}}):Ls({interactionState:{hitRegions:r,state:"hover"}}),QM();break}}}function mH(e){if(e.defaultPrevented)return;e.preventDefault();const{interactionState:t}=vl();t.state==="active"&&(Ls({cursorFlags:0,interactionState:{state:"inactive"}}),QM())}function gH(e){let t=0,n=0;const r={};for(const a of e)if(a.defaultSize!==void 0){t++;const s=ao(a.defaultSize);n+=s,r[a.panelId]=s}else r[a.panelId]=void 0;const i=e.length-t;if(i!==0){const a=ao((100-n)/i);for(const s of e)s.defaultSize===void 0&&(r[s.panelId]=a)}return r}function X2e(e,t,n){const r=n[0];if(!r)return;const i=e.panels.find(s=>s.element===t);if(!i||!i.onResize)return;const a=Kp({group:e});i.onResize({asPercentage:ao(r.inlineSize/a*100),inPixels:r.inlineSize},i.id)}function Z2e(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Q2e(e){let t=!0;const n=new Set,r=new Set,i=new ResizeObserver(m=>{for(const E of m){const{borderBoxSize:S,target:g}=E;if(g===e.element){if(t){if(Kp({group:e})===0)return;Ls(y=>{const v=y.mountedGroups.get(e);if(v){const x=sH(e),T=v.defaultLayoutDeferred?gH(x):v.layout,w=jf({layout:T,panelConstraints:x});return!v.defaultLayoutDeferred&&$m(T,w)&&Z2e(v.derivedPanelConstraints,x)?y:{mountedGroups:new Map(y.mountedGroups).set(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:x,layout:w,separatorToPanels:v.separatorToPanels})}}return y})}}else X2e(e,g,S)}});i.observe(e.element),e.panels.forEach(m=>{Wn(!n.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),n.add(m.id),m.onResize&&i.observe(m.element)});const a=Kp({group:e}),s=sH(e),o=e.panels.map(({id:m})=>m).join(",");let l=e.defaultLayout;l&&e.panels.length!==Object.keys(l).length&&(l=void 0);const u=e.inMemoryLayouts[o]??l??gH(s),f=jf({layout:u,panelConstraints:s}),d=Aie(e),p=Ls(m=>{const E=new Map;return d.forEach(S=>{S.separator&&E.set(S.separator,S.panels)}),{mountedGroups:new Map(m.mountedGroups).set(e,{defaultLayoutDeferred:a===0,derivedPanelConstraints:s,layout:f,separatorToPanels:E})}});return e.element.addEventListener("pointerleave",lH),e.separators.forEach(m=>{Wn(!r.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.element.addEventListener("keydown",uH)}),p.mountedGroups.size===1&&(window.addEventListener("pointerdown",hH),window.addEventListener("pointermove",pH),window.addEventListener("pointerup",mH)),function(){t=!1;const m=Ls(E=>{const S=new Map(E.mountedGroups);return S.delete(e),{mountedGroups:S}});e.element.removeEventListener("pointerleave",lH),e.separators.forEach(E=>{E.element.removeEventListener("keydown",uH)}),m.mountedGroups.size===0&&(window.removeEventListener("pointerdown",hH),window.removeEventListener("pointermove",pH),window.removeEventListener("pointerup",mH)),i.disconnect()}}function JM(e){const t=k.useId();return`${e??t}`}const Jf=typeof window<"u"?k.useLayoutEffect:k.useEffect;function e3(e){const t=k.useRef(e);return Jf(()=>{t.current=e},[e]),k.useCallback(n=>t.current?.(n),[t])}function t3(...e){return e3(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function J2e(e){const t=k.useRef({...e});return Jf(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const jie="--react-resizable-panels--panel--pointer-events";function Fie(e,t){const n=e.replace(/[^a-zA-Z0-9\-_]/g,""),r=t.replace(/[^a-zA-Z0-9\-_]/g,"");return`--react-resizable-panels--${n}--${r}`}const Bie=k.createContext(null);function eNe(e,t){const n=k.useRef({getLayout:()=>({}),setLayout:B2e});k.useImperativeHandle(t,()=>n.current,[]),Jf(()=>{Object.assign(n.current,Die({groupId:e}))})}function tNe({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:s,id:o,onLayoutChange:l,orientation:u="horizontal",style:f,...d}){const p=k.useRef({}),m=e3(H=>{$m(p.current,H)||(p.current=H,l?.(H))}),E=JM(o),[S,g]=k.useState(!1),[y,v]=k.useState(null),[x,T]=k.useState(n??{}),[w,C]=k.useState([]),[R,O]=k.useState([]),N=k.useRef({lastExpandedPanelSizes:{},layouts:{}}),D=t3(v,a);eNe(E,s);const L=k.useMemo(()=>({id:E,orientation:u,registerPanel:H=>(C(B=>ED(u,[...B,H])),()=>{C(B=>B.filter(q=>q!==H))}),registerSeparator:H=>(O(B=>ED(u,[...B,H])),()=>{O(B=>B.filter(q=>q!==H))})}),[E,u]),z=J2e({defaultLayout:n,disableCursor:r}),M=k.useRef(null);Jf(()=>{if(y===null)return;const H={defaultLayout:z.defaultLayout,disableCursor:!!z.disableCursor,disabled:!!i,element:y,id:E,inMemoryLastExpandedPanelSizes:N.current.lastExpandedPanelSizes,inMemoryLayouts:N.current.layouts,orientation:u,panels:w,separators:R};M.current=H;const B=Q2e(H),q=vl().mountedGroups.get(H);if(q){const{defaultLayoutDeferred:j,derivedPanelConstraints:$,layout:Y}=q;!j&&$.length>0&&(T(Y),m?.(Y))}const K=_f.addListener("interactionStateChange",j=>{j.state==="active"?g(j.hitRegions.some($=>$.group===H)):g(!1)}),U=_f.addListener("mountedGroupsChange",j=>{const $=j.get(H);if($){const{defaultLayoutDeferred:Y,derivedPanelConstraints:W,layout:J}=$;if(Y||W.length===0)return;T(J),m?.(J)}});return()=>{M.current=null,B(),K(),U()}},[i,y,E,m,u,w,R,z]),k.useEffect(()=>{const H=M.current;H&&(H.defaultLayout=n,H.disableCursor=!!r)});const V={[jie]:S?"none":void 0};for(const H in x){const B=Fie(E,H),q=x[H];V[B]=q}return b.jsx(Bie.Provider,{value:L,children:b.jsx("div",{...d,"aria-orientation":u,className:t,"data-group":!0,"data-testid":E,id:E,ref:D,style:{...f,...V,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap"},children:e})})}function n3(){const e=k.useContext(Bie);return Wn(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function nNe({groupId:e,panelId:t}){const n=()=>{const{mountedGroups:o}=vl();for(const[l,{defaultLayoutDeferred:u,derivedPanelConstraints:f,layout:d,separatorToPanels:p}]of o)if(l.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:f,group:l,layout:d,separatorToPanels:p};throw Error(`Group ${e} not found`)},r=()=>{const o=n().derivedPanelConstraints.find(l=>l.panelId===t);if(o!==void 0)return o;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const o=n().group.panels.find(l=>l.id===t);if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},a=()=>{const o=n().layout[t];if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},s=o=>{const l=a();if(o===l)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:f,group:d,layout:p,separatorToPanels:m}=n(),E=d.panels.findIndex(v=>v.id===t),S=E===d.panels.length-1,g=$v({delta:S?l-o:o-l,initialLayout:p,panelConstraints:f,pivotIndices:S?[E-1,E]:[E,E+1],prevLayout:p,trigger:"imperative-api"}),y=jf({layout:g,panelConstraints:f});$m(p,y)||Ls(v=>({mountedGroups:new Map(v.mountedGroups).set(d,{defaultLayoutDeferred:u,derivedPanelConstraints:f,layout:y,separatorToPanels:m})}))};return{collapse:()=>{const{collapsible:o,collapsedSize:l}=r(),u=a();o&&u!==l&&s(l)},expand:()=>{const{collapsible:o,collapsedSize:l,minSize:u}=r(),f=a();o&&f===l&&s(u)},getSize:()=>{const{group:o}=n(),l=a(),{element:u}=i(),f=o.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:l,inPixels:f}},isCollapsed:()=>{const{collapsible:o,collapsedSize:l}=r(),u=a();return o&&Ji(l,u)},resize:o=>{if(a()!==o){let l;switch(typeof o){case"number":{const{group:u}=n(),f=Kp({group:u});l=ao(o/f*100);break}case"string":{l=parseFloat(o);break}}s(l)}}}}function rNe(e,t){const{id:n}=n3(),r=k.useRef({collapse:Rk,expand:Rk,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Rk});k.useImperativeHandle(t,()=>r.current,[]),Jf(()=>{Object.assign(r.current,nNe({groupId:n,panelId:e}))})}function iNe({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,elementRef:a,id:s,maxSize:o="100%",minSize:l="0%",onResize:u,panelRef:f,style:d,...p}){const m=!!s,E=JM(s),[S,g]=k.useState(null),y=t3(g,a),{id:v,registerPanel:x}=n3(),T=u!==null,w=e3(R=>{u?.(R,s)});Jf(()=>{if(S!==null)return x({element:S,id:E,idIsStable:m,onResize:T?w:void 0,panelConstraints:{collapsedSize:n,collapsible:r,defaultSize:i,maxSize:o,minSize:l}})},[n,r,i,S,T,E,m,o,l,w,x]),rNe(E,f);const C=Fie(v,E);return b.jsx("div",{...p,"data-panel":!0,"data-testid":E,id:E,ref:y,style:{...aNe,flexBasis:0,flexGrow:`var(${C}, 1)`,flexShrink:1,overflow:"hidden",pointerEvents:`var(${jie})`},children:b.jsx("div",{className:t,style:{width:"100%",height:"100%",...d},children:e})})}const aNe={minHeight:"unset",maxHeight:"unset",height:"unset",minWidth:"unset",maxWidth:"unset",width:"unset",flex:"unset",flexBasis:"unset",flexShrink:"unset",flexGrow:"unset",border:"unset",borderWidth:"unset",padding:"unset",margin:"unset"};function sNe({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a;const s=e[n],o=t.find(l=>l.panelId===n);if(o){const l=o.maxSize,u=a=o.collapsible?o.collapsedSize:o.minSize,f=[r,r+1];a=jf({layout:$v({delta:u-s,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n],i=jf({layout:$v({delta:l-s,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:s}}function oNe({children:e,className:t,elementRef:n,id:r,style:i,...a}){const s=JM(r),[o,l]=k.useState({}),[u,f]=k.useState("inactive"),[d,p]=k.useState(null),m=t3(p,n),{id:E,orientation:S,registerSeparator:g}=n3(),y=S==="horizontal"?"vertical":"horizontal";return Jf(()=>{if(d!==null){const v={element:d,id:s},x=g(v),T=_f.addListener("interactionStateChange",C=>{f(C.state!=="inactive"&&C.hitRegions.some(R=>R.separator===v)?C.state:"inactive")}),w=_f.addListener("mountedGroupsChange",C=>{C.forEach(({derivedPanelConstraints:R,layout:O,separatorToPanels:N},D)=>{if(D.id===E){const L=N.get(v);if(L){const z=L[0],M=D.panels.indexOf(z);l(sNe({layout:O,panelConstraints:R,panelId:z.id,panelIndex:M}))}}})});return()=>{T(),w(),x()}}},[d,E,s,g]),b.jsx("div",{...a,"aria-controls":o.valueControls,"aria-orientation":y,"aria-valuemax":o.valueMax,"aria-valuemin":o.valueMin,"aria-valuenow":o.valueNow,children:e,className:t,"data-separator":u,"data-testid":s,id:s,ref:m,role:"separator",style:{flexBasis:"auto",...i,flexGrow:0,flexShrink:0},tabIndex:0})}function Vd({className:e,direction:t,...n}){return b.jsx(tNe,{"data-slot":"resizable-panel-group",orientation:t,className:Be("flex h-full w-full data-[orientation=vertical]:flex-col",e),...n})}function xs({...e}){return b.jsx(iNe,{"data-slot":"resizable-panel",...e})}function Gd({withHandle:e,className:t,...n}){return b.jsx(oNe,{"data-slot":"resizable-handle",className:Be("relative flex w-px items-center justify-center bg-border cursor-grab active:cursor-grabbing group touch-none","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","focus-visible:ring-offset-1 focus-visible:ring-offset-background","data-[orientation=vertical]:h-px data-[orientation=vertical]:w-full data-[orientation=vertical]:cursor-row-resize","[&[data-orientation=vertical]>div]:rotate-90",t),...n,children:e&&b.jsxs("div",{className:"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center gap-1 bg-muted/90 border border-border rounded-full px-1 py-3 opacity-70 group-hover:opacity-100 group-focus:opacity-100 transition-opacity shadow-sm",children:[b.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-muted-foreground"}),b.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-muted-foreground"}),b.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-muted-foreground"})]})})}var Ik={exports:{}},bH;function lNe(){return bH||(bH=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(s,o,l){var u=this&&this.__decorate||function(v,x,T,w){var C,R=arguments.length,O=R<3?x:w===null?w=Object.getOwnPropertyDescriptor(x,T):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(v,x,T,w);else for(var N=v.length-1;N>=0;N--)(C=v[N])&&(O=(R<3?C(O):R>3?C(x,T,O):C(x,T))||O);return R>3&&O&&Object.defineProperty(x,T,O),O},f=this&&this.__param||function(v,x){return function(T,w){x(T,w,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=l(9042),p=l(9924),m=l(844),E=l(4725),S=l(2585),g=l(3656);let y=o.AccessibilityManager=class extends m.Disposable{constructor(v,x,T,w){super(),this._terminal=v,this._coreBrowserService=T,this._renderService=w,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let C=0;C<this._terminal.rows;C++)this._rowElements[C]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[C]);if(this._topBoundaryFocusListener=C=>this._handleBoundaryFocus(C,0),this._bottomBoundaryFocusListener=C=>this._handleBoundaryFocus(C,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new p.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((C=>this._handleResize(C.rows)))),this.register(this._terminal.onRender((C=>this._refreshRows(C.start,C.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((C=>this._handleChar(C)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
31
+ `}}),!1):!0);const s=r.onData(u=>{t().send({type:"terminal:input",payload:{terminalId:n,data:u}})}),o=()=>{this.setLastFocusedTerminal(n)};r.textarea?.addEventListener("focus",o),i?.onAttached&&(e.terminalsReadyForCallback.has(n)?(t().log.ws.debug("attachXterm: terminal already attached, calling callback immediately",{terminalId:n}),e.terminalsReadyForCallback.delete(n),setTimeout(()=>i.onAttached?.(n),0)):(t().log.ws.debug("attachXterm: registering onAttached callback",{terminalId:n,existingCallbacks:Array.from(e.onAttachedCallbacks.keys())}),e.onAttachedCallbacks.set(n,i.onAttached)));const l=()=>{s.dispose(),r.textarea?.removeEventListener("focus",o),e.terminals.get(n)?.setXterm(null)};return a.setAttachCleanup(l),t().send({type:"terminal:attach",payload:{terminalId:n}}),l},requestAttach(n){t().send({type:"terminal:attach",payload:{terminalId:n}})},clearTerminalBuffer(n){t().send({type:"terminal:clearBuffer",payload:{terminalId:n}})},assignTerminalToTab(n,r,i){t().send({type:"terminal:assignTab",payload:{terminalId:n,tabId:r,positionInTab:i}}),e.terminals.get(n)?.assignToTab(r,i)},createTab(n,r,i,a){const s=bD(),o=Qz(),l=r??e.tabs.items.length,u={id:o,name:n,position:l,directory:i??null,createdAt:Date.now()},f=Hz(e.tabs);e.tabs.add(u),f.stop(),e.tabs.get(o)?.setPending(!0),e.pendingTabCreation=o,e.pendingUpdates.set(s,{entityType:"tab",tempId:o,inversePatches:f.inversePatches,createdAt:Date.now()}),t().send({type:"tab:create",payload:{name:n,position:r,directory:i,adoptTerminalId:a,requestId:s,tempId:o}}),t().log.ws.debug("createTab optimistic",{requestId:s,tempId:o,name:n,adoptTerminalId:a})},updateTab(n,r){t().send({type:"tab:update",payload:{tabId:n,...r}}),e.tabs.get(n)?.updateFromServer(r)},deleteTab(n){t().send({type:"tab:delete",payload:{tabId:n}}),e.tabs.remove(n),e.viewState.clearFocusedTerminalForTab(n)},reorderTab(n,r){const i=e.tabs.get(n);if(!i)return;const a=i.position;if(t().send({type:"tab:reorder",payload:{tabId:n,position:r}}),r>a)for(const s of e.tabs.items)s.position>a&&s.position<=r&&s.setPosition(s.position-1);else if(r<a)for(const s of e.tabs.items)s.position>=r&&s.position<a&&s.setPosition(s.position+1);i.setPosition(r)},handleMessage(n){const{type:r,payload:i}=n;switch(r){case"terminals:list":e.terminals.replaceAll(i.terminals);break;case"terminal:created":{const{terminal:a,isNew:s,requestId:o,tempId:l}=i;if(o&&l){const u=e.pendingUpdates.get(o);if(u&&u.tempId===l){e.pendingUpdates.delete(o);const f=e.terminals.get(l);if(f){const d=f.xterm,p=e.onAttachedCallbacks.get(l),m=f.attachCleanup;if(t().log.ws.info("terminal:created optimistic handling",{tempId:l,realId:a.id,hasXterm:!!d,hasCallback:!!p,isNew:s}),m&&m(),f.setXterm(null),f.setAttachCleanup(null),e.onAttachedCallbacks.delete(l),s){const E=f.isStartingUp,S=e.terminals.items.findIndex(v=>v.id===l);S>=0&&iS(e.terminals.items[S]),e.terminals.add(a);const g=e.terminals.get(a.id);E&&g&&(g.setStartingUp(!0),t().log.ws.info("terminal:created transferred isStartingUp",{tempId:l,realId:a.id,isStartingUp:g.isStartingUp})),t().log.ws.info("terminal:created re-attaching xterm",{realId:a.id,hasRealTerminal:!!g,hasXterm:!!d,willAttach:!!(g&&d)}),g&&d?this.attachXterm(a.id,d,{onAttached:p}):p&&(t().log.ws.info("terminal:created preserving callback for later",{realId:a.id}),e.onAttachedCallbacks.set(a.id,p)),e.newTerminalIds.delete(l),e.newTerminalIds.add(a.id);const y=e.terminalsPendingStartup.get(l);y&&(e.terminalsPendingStartup.delete(l),e.terminalsPendingStartup.set(a.id,y),t().log.ws.debug("transferred pending startup",{tempId:l,realId:a.id})),t().log.ws.debug("terminal:created confirmed",{requestId:o,tempId:l,realId:a.id,xtermReattached:!!d,hasPendingStartup:!!y})}else{const E=e.terminals.items.findIndex(g=>g.id===l);E>=0&&iS(e.terminals.items[E]),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l),e.terminals.has(a.id)||e.terminals.add(a),e.terminals.get(a.id)&&d&&this.attachXterm(a.id,d,{onAttached:p}),t().log.ws.debug("terminal:created deduplicated",{requestId:o,tempId:l,existingId:a.id,xtermReattached:!!d})}}break}}e.terminals.add(a),s&&e.newTerminalIds.add(a.id);break}case"terminal:destroyed":{const{terminalId:a}=i;e.terminals.remove(a),e.newTerminalIds.delete(a),e.terminalsReadyForCallback.delete(a),e.onAttachedCallbacks.delete(a);break}case"terminal:output":{const{terminalId:a,data:s}=i,o=e.terminals.get(a);o?.xterm?o.xterm.write(s):t().log.ws.warn("terminal:output but no xterm",{terminalId:a});break}case"terminal:attached":{const{terminalId:a,buffer:s}=i,o=e.terminals.get(a);t().log.ws.info("terminal:attached received",{terminalId:a,hasTerminal:!!o,hasXterm:!!o?.xterm,bufferLength:s?.length??0,hasCallback:e.onAttachedCallbacks.has(a),isReadyForCallback:e.terminalsReadyForCallback.has(a),registeredCallbacks:Array.from(e.onAttachedCallbacks.keys())}),o?.xterm&&(o.xterm.reset(),s&&o.xterm.write(s));const l=e.onAttachedCallbacks.get(a);l?(e.onAttachedCallbacks.delete(a),t().log.ws.debug("terminal:attached calling callback",{terminalId:a}),l(a)):(t().log.ws.debug("terminal:attached no callback yet, marking ready",{terminalId:a}),e.terminalsReadyForCallback.add(a));break}case"terminal:bufferCleared":{const{terminalId:a}=i,s=e.terminals.get(a);s?.xterm&&s.xterm.reset();break}case"terminal:exit":{const{terminalId:a,exitCode:s}=i;e.terminals.get(a)?.markExited(s);break}case"terminal:renamed":{const{terminalId:a,name:s}=i;e.terminals.get(a)?.rename(s);break}case"terminal:tabAssigned":{const{terminalId:a,tabId:s,positionInTab:o}=i;e.terminals.get(a)?.assignToTab(s,o);break}case"tabs:list":e.tabs.replaceAll(i.tabs),e.initialized=!0;break;case"tab:created":{const{tab:a,requestId:s,tempId:o,adoptTerminalId:l}=i;if(s&&o){const u=e.pendingUpdates.get(s);if(u&&u.tempId===o){e.pendingUpdates.delete(s),e.tabs.get(o)&&(e.tabs.remove(o),e.tabs.add(a),e.pendingTabCreation=null,l||(e.lastCreatedTabId=a.id),t().log.ws.debug("tab:created confirmed",{requestId:s,tempId:o,realId:a.id,adoptTerminalId:l}));break}}e.tabs.add(a);break}case"tab:updated":{const{tabId:a,name:s,directory:o}=i;e.tabs.get(a)?.updateFromServer({name:s,directory:o});break}case"tab:deleted":{const{tabId:a}=i;e.tabs.remove(a),e.viewState.clearFocusedTerminalForTab(a);break}case"terminal:error":{const{error:a,requestId:s,tempId:o}=i;if(s&&o){const l=e.pendingUpdates.get(s);if(l&&l.tempId===o){e.pendingUpdates.delete(s);for(let u=l.inversePatches.length-1;u>=0;u--)Pv(e.terminals,l.inversePatches[u]);e.newTerminalIds.delete(o),e.terminalsPendingStartup.delete(o),t().log.ws.warn("terminal:error rollback",{requestId:s,tempId:o,error:a});break}}At.ws.error("Terminal error from server",{error:a});break}case"sync:stale":{const{entityType:a,entityId:s,requestId:o,tempId:l,error:u}=i;if(t().log.ws.warn("sync:stale received",{entityType:a,entityId:s,error:u}),o&&l){const f=e.pendingUpdates.get(o);if(f&&f.tempId===l)if(e.pendingUpdates.delete(o),f.entityType==="terminal"){const d=e.terminals.get(l);d&&(d.cleanup(),e.terminals.remove(l)),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l)}else f.entityType==="tab"&&e.tabs.remove(l)}if(a==="terminal"){if(e.terminals.has(s)){const f=e.terminals.get(s);f&&(f.cleanup(),e.terminals.remove(s))}e.terminalsPendingStartup.delete(s)}else a==="tab"&&e.tabs.has(s)&&(e.tabs.remove(s),e.viewState.clearFocusedTerminalForTab(s));break}case"theme:synced":{const{theme:a}=i;e.broadcastedTheme=a,t().log.ws.debug("theme:synced received",{theme:a});break}}},reset(){e.terminals.clear(),e.tabs.clear(),e.connected=!1,e.initialized=!1,e.newTerminalIds.clear(),e.pendingUpdates.clear(),e.terminalsPendingStartup.clear()}}});function bie(){const e=Um();return k.useMemo(()=>{const t=(n,r)=>{const i=async a=>{const s=a.clipboardData?.items;if(s){for(const o of s)if(o.type.startsWith("image/")){a.preventDefault(),a.stopPropagation();const l=o.getAsFile();if(!l)return;try{const u=await jte(l);e.writeToTerminal(r,u)}catch(u){At.ws.error("Failed to upload image",{error:String(u)})}return}}};return n.addEventListener("paste",i,!0),()=>{n.removeEventListener("paste",i,!0)}};return{get terminals(){return[...e.terminals.items]},get terminalsLoaded(){return e.initialized},get tabs(){return[...e.tabs.sorted]},get connected(){return e.connected},get newTerminalIds(){return e.newTerminalIds},get pendingTabCreation(){return e.pendingTabCreation},get lastCreatedTabId(){return e.lastCreatedTabId},createTerminal:e.createTerminal.bind(e),destroyTerminal:e.destroyTerminal.bind(e),writeToTerminal:e.writeToTerminal.bind(e),sendInputToTerminal:e.sendInputToTerminal.bind(e),resizeTerminal:e.resizeTerminal.bind(e),renameTerminal:e.renameTerminal.bind(e),clearTerminalBuffer:e.clearTerminalBuffer.bind(e),assignTerminalToTab:e.assignTerminalToTab.bind(e),createTab:e.createTab.bind(e),updateTab:e.updateTab.bind(e),deleteTab:e.deleteTab.bind(e),reorderTab:e.reorderTab.bind(e),attachXterm:e.attachXterm.bind(e),setupImagePaste:t,consumePendingStartup:e.consumePendingStartup.bind(e),clearStartingUp:e.clearStartingUp.bind(e),clearLastCreatedTabId:e.clearLastCreatedTabId.bind(e)}},[e])}const Tk="",MRe=Ot.model("File",{path:Ot.identifier,content:Ot.string,originalContent:Ot.string,mimeType:Ot.string,size:Ot.number,lineCount:Ot.number,truncated:Ot.boolean,isMarkdownView:Ot.optional(Ot.boolean,!1)}).views(e=>({get isDirty(){return e.content!==e.originalContent},get isMarkdown(){return e.path.toLowerCase().endsWith(".md")},get isImage(){return e.mimeType.startsWith("image/")},get isBinary(){return e.mimeType==="application/octet-stream"},get isEditable(){return!e.mimeType.startsWith("image/")&&e.mimeType!=="application/octet-stream"}})).actions(e=>({setContent(t){e.content=t},markSaved(){e.originalContent=e.content},toggleMarkdownView(){e.isMarkdownView=!e.isMarkdownView},setMarkdownView(t){e.isMarkdownView=t}})),jRe=Ot.model("FilesStore",{selectedFile:Ot.maybeNull(Ot.string),expandedDirs:Ot.array(Ot.string),openFiles:Ot.map(MRe)}).volatile(()=>({worktreePath:null,readOnly:!1,isLoading:!1,isSaving:!1,loadError:null,saveError:null,fileTree:null,isLoadingTree:!1,treeError:null})).views(e=>({get currentFile(){if(e.selectedFile)return e.openFiles.get(e.selectedFile)},get isDirty(){return(e.selectedFile?e.openFiles.get(e.selectedFile):void 0)?.isDirty??!1},isFileMarkdownView(t){return e.openFiles.get(t)?.isMarkdownView??!1},isDirExpanded(t){return e.expandedDirs.includes(t)}})).actions(e=>({setWorktreePath(t){e.worktreePath!==t&&(e.worktreePath=t,e.selectedFile=null,e.expandedDirs.clear(),e.openFiles.clear(),e.fileTree=null)},setReadOnly(t){e.readOnly=t},selectFile(t){e.selectedFile=t},toggleDir(t){const n=e.expandedDirs.indexOf(t);n>=0?e.expandedDirs.splice(n,1):e.expandedDirs.push(t)},collapseAll(){e.expandedDirs.clear()},updateContent(t,n){const r=e.openFiles.get(t);r&&r.setContent(n)},toggleMarkdownView(t){const n=e.openFiles.get(t);n&&n.toggleMarkdownView()},_setLoading(t){e.isLoading=t},_setLoadError(t){e.loadError=t},_setSaving(t){e.isSaving=t},_setSaveError(t){e.saveError=t},_setFileTree(t){e.fileTree=t},_setLoadingTree(t){e.isLoadingTree=t},_setTreeError(t){e.treeError=t},_addFile(t){e.openFiles.set(t.path,{path:t.path,content:t.content,originalContent:t.content,mimeType:t.mimeType,size:t.size,lineCount:t.lineCount,truncated:t.truncated,isMarkdownView:!1})},_markFileSaved(t){const n=e.openFiles.get(t);n&&n.markSaved()}})).actions(e=>({loadFileTree:Sk(function*(){if(e.worktreePath){e._setLoadingTree(!0),e._setTreeError(null);try{const t=yield zt(`${Tk}/api/fs/tree?root=${encodeURIComponent(e.worktreePath)}`);e._setFileTree(t.entries)}catch(t){e._setTreeError(t instanceof Error?t.message:"Failed to load file tree")}finally{e._setLoadingTree(!1)}}}),loadFile:Sk(function*(t){if(e.worktreePath){if(e.openFiles.has(t)){e.selectedFile=t;return}e._setLoading(!0),e._setLoadError(null);try{const n=new URLSearchParams({path:t,root:e.worktreePath}),r=yield zt(`${Tk}/api/fs/read?${n}`);e._addFile({path:t,content:r.content,mimeType:r.mimeType,size:r.size,lineCount:r.lineCount,truncated:r.truncated}),e.selectedFile=t}catch(n){e._setLoadError(n instanceof Error?n.message:"Failed to load file")}finally{e._setLoading(!1)}}}),saveFile:Sk(function*(t){if(!e.worktreePath)return;const n=e.openFiles.get(t);if(!(!n||!n.isDirty)){e._setSaving(!0),e._setSaveError(null);try{(yield fetch(`${Tk}/api/fs/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,root:e.worktreePath,content:n.content})}).then(i=>i.ok?i.json():i.json().then(a=>{throw new Error(a.error||"Failed to save file")}))).success&&e._markFileSaved(t)}catch(r){throw e._setSaveError(r instanceof Error?r.message:"Failed to save file"),r}finally{e._setSaving(!1)}}}),closeFile(t){e.openFiles.delete(t),e.selectedFile===t&&(e.selectedFile=null)}}));function FRe(){return jRe.create({selectedFile:null,expandedDirs:[],openFiles:{}})}const vie=k.createContext(null);function BRe(e,t=!1,n){const r=k.useMemo(()=>FRe(),[]),i=k.useRef(!1);return k.useEffect(()=>{r.setWorktreePath(e),r.setReadOnly(t),i.current=!1,e&&r.loadFileTree().then(()=>{n&&!i.current&&(i.current=!0,r.selectFile(n),r.loadFile(n))})},[r,e,t,n]),r}function URe(){const e=k.useContext(vie);if(!e)throw new Error("useFilesStore must be used within a FilesStoreProvider");return e}function yie(){const e=URe();return{worktreePath:e.worktreePath,readOnly:e.readOnly,selectedFile:e.selectedFile,currentFile:e.currentFile,expandedDirs:[...e.expandedDirs],fileTree:e.fileTree,isLoading:e.isLoading,isSaving:e.isSaving,isLoadingTree:e.isLoadingTree,loadError:e.loadError,saveError:e.saveError,treeError:e.treeError,isDirty:e.isDirty,selectFile:e.selectFile,loadFile:e.loadFile,saveFile:e.saveFile,closeFile:e.closeFile,updateContent:e.updateContent,toggleDir:e.toggleDir,collapseAll:e.collapseAll,toggleMarkdownView:e.toggleMarkdownView,isFileMarkdownView:e.isFileMarkdownView,isDirExpanded:e.isDirExpanded,refreshTree:e.loadFileTree}}const _ie=k.createContext(null);function Um(){const e=k.useContext(_ie);if(!e)throw new Error("useStore must be used within a StoreProvider");return e}function $Re(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}function zRe({children:e,wsUrl:t=$Re(),reconnectInterval:n=2e3,maxReconnectAttempts:r=10}){const i=k.useRef(null),a=k.useRef(0),s=k.useRef(void 0),o=k.useRef(null),[,l]=k.useState({}),u=k.useCallback(d=>{i.current?.readyState===WebSocket.OPEN?(At.ws.debug("send",{type:d.type}),i.current.send(JSON.stringify(d))):At.ws.warn("send dropped (WebSocket not open)",{type:d.type,readyState:i.current?.readyState??"no socket"})},[]);if(!o.current){const d={send:u,log:At};o.current=PRe.create({},d)}const f=o.current;return k.useEffect(()=>{f.setMaxReconnectAttempts(r)},[f,r]),k.useEffect(()=>{let d=!0;const p=()=>{const m=i.current;if(m&&(m.readyState===WebSocket.CONNECTING||m.readyState===WebSocket.OPEN))return;const E=new WebSocket(t);i.current=E,E.onopen=()=>{d&&(At.ws.info("WebSocket connected"),f.setConnected(!0),a.current=0)},E.onmessage=S=>{if(d)try{const g=JSON.parse(S.data);f.handleMessage(g)}catch(g){At.ws.error("Failed to parse WebSocket message",{error:String(g)})}},E.onclose=()=>{if(d)if(At.ws.info("WebSocket disconnected"),f.setConnected(!1),i.current===E&&(i.current=null),a.current<r){a.current++,f.setReconnectAttempt(a.current);const S=n*Math.pow(1.5,a.current-1);At.ws.info("Scheduling reconnect",{attempt:a.current,delay:S}),s.current=setTimeout(p,S)}else At.ws.warn("Max reconnect attempts reached"),f.setReconnectAttempt(a.current)},E.onerror=S=>{At.ws.error("WebSocket error",{event:String(S)})}};return p(),()=>{d=!1,s.current&&clearTimeout(s.current);const m=i.current;m?.readyState===WebSocket.OPEN&&m.close(),i.current=null}},[t,n,r,f]),k.useEffect(()=>{l({})},[]),b.jsx(_ie.Provider,{value:f,children:e})}function Eie(){const e=Um(),{setTheme:t,resolvedTheme:n,theme:r}=Kc(),{data:i}=nwe(),a=k.useRef(void 0),s=k.useRef(!1),o=k.useRef(!1);k.useEffect(()=>zM(()=>e.broadcastedTheme,f=>{f&&(o.current=!0,t(f),e.clearBroadcastedTheme(),setTimeout(()=>{o.current=!1},0))},{fireImmediately:!0}),[e,t]),k.useEffect(()=>{if(!n)return;const u=n==="dark"?"/logo-dark.jpg":"/logo-light.jpg";let f=document.querySelector('link[rel="icon"]');f||(f=document.createElement("link"),f.rel="icon",document.head.appendChild(f)),f.type="image/jpeg",f.href=u},[n]),k.useEffect(()=>{const u=s.current&&i&&a.current===!1;a.current=i,s.current=!0,n&&u&&zt("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:n})}).catch(()=>{})},[i,n]);const l=k.useCallback(u=>{if(!o.current&&(t(u),e.syncTheme(u),i)){const f=u==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":u;zt("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:f})}).catch(()=>{})}},[t,e,i]);return{theme:r??"system",resolvedTheme:n,syncClaudeCode:i,changeTheme:l,isUpdating:!1}}let Ck=!1;const Jz={activeTabId:null,focusedTerminals:{},currentView:null,currentTaskId:null,isTabVisible:null,viewUpdatedAt:null};function Sie(){const e=wr(),t=k.useRef(void 0),n=k.useRef({}),{data:r=Jz,isLoading:i}=qn({queryKey:["terminal-view-state"],queryFn:async()=>{const p=await fetch("/api/terminal-view-state");if(!p.ok)throw new Error("Failed to fetch terminal view state");return p.json()},staleTime:2e3}),a=Fn({mutationFn:async p=>{const m=await fetch("/api/terminal-view-state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!m.ok)throw new Error("Failed to update terminal view state");return m.json()},onSuccess:p=>{e.setQueryData(["terminal-view-state"],p)}}),s=k.useRef(a);s.current=a;const o=k.useCallback(p=>{const m=n.current;n.current={...m,...p,focusedTerminals:p.focusedTerminals||m.focusedTerminals?{...m.focusedTerminals,...p.focusedTerminals}:void 0};const E=n.current;e.setQueryData(["terminal-view-state"],S=>{const g=S??Jz;return{activeTabId:E.activeTabId!==void 0?E.activeTabId:g.activeTabId,focusedTerminals:{...g.focusedTerminals,...E.focusedTerminals},currentView:E.currentView!==void 0?E.currentView:g.currentView,currentTaskId:E.currentTaskId!==void 0?E.currentTaskId:g.currentTaskId,isTabVisible:E.isTabVisible!==void 0?E.isTabVisible:g.isTabVisible,viewUpdatedAt:E.viewUpdatedAt!==void 0?E.viewUpdatedAt:g.viewUpdatedAt}}),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{s.current.mutate(n.current),n.current={}},500)},[e]),l=k.useCallback((p,m)=>{if(m===null){const E=e.getQueryData(["terminal-view-state"]);if(E){const{[p]:S,...g}=E.focusedTerminals;o({focusedTerminals:g})}}else o({focusedTerminals:{[p]:m}})},[e,o]),u=k.useCallback(p=>r.focusedTerminals[p]??null,[r.focusedTerminals]),f=k.useRef(!1);k.useEffect(()=>{if(Ck){f.current=!1;return}Ck=!0,f.current=!0;const p=()=>{o({isTabVisible:document.visibilityState==="visible",viewUpdatedAt:new Date().toISOString()})};return document.addEventListener("visibilitychange",p),p(),()=>{document.removeEventListener("visibilitychange",p),f.current&&(Ck=!1)}},[o]);const d=k.useCallback((p,m,E)=>{o({currentView:p,currentTaskId:m,activeTabId:E,viewUpdatedAt:new Date().toISOString()})},[o]);return{viewState:r,isLoading:i,getFocusedTerminal:u,setFocusedTerminal:l,updateViewTracking:d}}function no(e,t){const n=e.toLowerCase(),r=t.toLowerCase();if(n===r)return 100;if(n.startsWith(r))return 80;if(n.includes(r))return 60;let i=0,a=0,s=0;for(;i<n.length&&a<r.length;)n[i]===r[a]&&(s+=1,a++),i++;return a===r.length?s:0}function HRe(e,t){return t.trim()?e.map(r=>{let i=no(r.label,t);if(r.keywords)for(const a of r.keywords){const s=no(a,t);s>i&&(i=s)}return{command:r,score:i}}).filter(({score:r})=>r>0).sort((r,i)=>i.score-r.score).map(({command:r})=>r):e}function WRe(e){const t=new Map;for(const n of e){const r=t.get(n.category)||[];r.push(n),t.set(n.category,r)}return t}function VRe({open:e,onOpenChange:t,onNewTask:n,onShowShortcuts:r}){const{t:i}=rn("navigation"),[a,s]=k.useState(!1),o=e??a,l=t??s,[u,f]=k.useState(""),[d,p]=k.useState(0),m=k.useRef(null),E=k.useRef(null),S=Ri(),g=k.useMemo(()=>[{id:"goto-tasks",label:i("commandPalette.commands.goToTasks"),shortcut:"meta+1",keywords:["kanban","board","home"],category:"navigation",icon:b.jsx(fe,{icon:jp,size:16,strokeWidth:2}),action:()=>{S({to:"/tasks"}),l(!1)}},{id:"goto-terminals",label:i("commandPalette.commands.goToTerminals"),shortcut:"meta+2",keywords:["shell","console","cli"],category:"navigation",icon:b.jsx(fe,{icon:R1e,size:16,strokeWidth:2}),action:()=>{S({to:"/terminals"}),l(!1)}},{id:"goto-task-terminals",label:i("commandPalette.commands.goToTaskTerminals"),shortcut:"meta+i",keywords:["tasks","shell","console","cli"],category:"navigation",icon:b.jsx(fe,{icon:jp,size:16,strokeWidth:2}),action:()=>{S({to:"/terminals",search:{tab:"all-tasks"}}),l(!1)}},{id:"goto-repositories",label:i("commandPalette.commands.goToRepositories"),shortcut:"meta+3",keywords:["repos","git","projects"],category:"navigation",icon:b.jsx(fe,{icon:I1e,size:16,strokeWidth:2}),action:()=>{S({to:"/repositories"}),l(!1)}},{id:"goto-review",label:i("commandPalette.commands.goToReview"),shortcut:"meta+4",keywords:["pr","pull request","issues","github"],category:"navigation",icon:b.jsx(fe,{icon:ou,size:16,strokeWidth:2}),action:()=>{S({to:"/review"}),l(!1)}},{id:"goto-monitoring",label:i("commandPalette.commands.goToMonitoring"),shortcut:"meta+5",keywords:["system","cpu","memory","processes","usage"],category:"navigation",icon:b.jsx(fe,{icon:dte,size:16,strokeWidth:2}),action:()=>{S({to:"/monitoring"}),l(!1)}},{id:"goto-settings",label:i("commandPalette.commands.goToSettings"),shortcut:"meta+,",keywords:["preferences","config","configuration"],category:"navigation",icon:b.jsx(fe,{icon:Ete,size:16,strokeWidth:2}),action:()=>{S({to:"/settings"}),l(!1)}},{id:"new-task",label:i("commandPalette.commands.newTask"),shortcut:"meta+j",keywords:["create","add"],category:"actions",icon:b.jsx(fe,{icon:Nv,size:16,strokeWidth:2}),action:()=>{l(!1),n?.()}},{id:"show-shortcuts",label:i("commandPalette.commands.keyboardShortcuts"),shortcut:"meta+/",keywords:["help","hotkeys","keys"],category:"actions",icon:b.jsx(fe,{icon:gte,size:16,strokeWidth:2}),action:()=>{l(!1),r?.()}}],[S,n,r,l,i]),y=k.useMemo(()=>HRe(g,u),[g,u]),v=k.useMemo(()=>WRe(y),[y]),x=k.useMemo(()=>{const C=[],R=["navigation","actions"];for(const O of R){const N=v.get(O);N&&C.push(...N)}return C},[v]);k.useEffect(()=>{p(0)},[u]),k.useEffect(()=>{if(!E.current)return;const C=E.current.querySelector('[data-selected="true"]');C&&C.scrollIntoView({block:"nearest"})},[d]),Va("meta+k",()=>l(!0),{allowInInput:!0,allowInTerminal:!0}),Va("meta+1",()=>S({to:"/tasks"}),{allowInInput:!0,allowInTerminal:!0}),Va("meta+2",()=>S({to:"/terminals"}),{allowInInput:!0,allowInTerminal:!0}),Va("meta+i",()=>{S({to:"/terminals",search:{tab:"all-tasks"}})},{allowInInput:!0,allowInTerminal:!0}),Va("meta+3",()=>S({to:"/repositories"}),{allowInInput:!0,allowInTerminal:!0}),Va("meta+4",()=>S({to:"/review"}),{allowInInput:!0,allowInTerminal:!0}),Va("meta+5",()=>S({to:"/monitoring"}),{allowInInput:!0,allowInTerminal:!0}),Va("meta+,",()=>S({to:"/settings"}),{allowInInput:!0,allowInTerminal:!0}),Va("meta+j",()=>{n?.()},{allowInInput:!1,deps:[n]}),Va("meta+/",()=>{r?.()},{allowInInput:!0,allowInTerminal:!0,deps:[r]});const T=k.useCallback(C=>{switch(C.key){case"ArrowDown":C.preventDefault(),p(R=>Math.min(R+1,x.length-1));break;case"ArrowUp":C.preventDefault(),p(R=>Math.max(R-1,0));break;case"Enter":C.preventDefault(),x[d]&&x[d].action();break;case"Escape":C.preventDefault(),l(!1);break;case"1":C.preventDefault(),S({to:"/tasks"}),l(!1);break;case"2":C.preventDefault(),S({to:"/terminals"}),l(!1);break;case"3":C.preventDefault(),S({to:"/repositories"}),l(!1);break;case"4":C.preventDefault(),S({to:"/review"}),l(!1);break;case"5":C.preventDefault(),S({to:"/monitoring"}),l(!1);break}},[x,d,l,S]);k.useEffect(()=>{o&&(f(""),p(0),setTimeout(()=>m.current?.focus(),50))},[o]),k.useEffect(()=>{const C=R=>{if(R.data?.type==="vibora:action")switch(R.data.action){case"openCommandPalette":l(!0);break;case"openNewTask":n?.();break;case"showShortcuts":r?.();break}};return window.addEventListener("message",C),()=>window.removeEventListener("message",C)},[l,n,r]);let w=0;return b.jsx(ed,{open:o,onOpenChange:l,children:b.jsxs(td,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden",showCloseButton:!1,onKeyDown:T,children:[b.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[b.jsx("span",{className:"text-muted-foreground mr-2",children:">"}),b.jsx(dn,{ref:m,value:u,onChange:C=>f(C.target.value),placeholder:i("commandPalette.placeholder"),className:"border-0 ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 px-0 h-12"}),b.jsx("kbd",{className:"pointer-events-none ml-2 inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:"Esc"})]}),b.jsx("div",{ref:E,className:"max-h-80 overflow-y-auto p-2",children:y.length===0?b.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:i("commandPalette.noResults")}):b.jsx(b.Fragment,{children:["navigation","actions"].map(C=>{const R=v.get(C);return!R||R.length===0?null:b.jsxs("div",{className:"mb-2 last:mb-0",children:[b.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:i(`commandPalette.categories.${C}`)}),R.map(O=>{const N=w++,D=N===d;return b.jsxs("button",{"data-selected":D,onClick:()=>O.action(),onMouseEnter:()=>p(N),className:Be("flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm",D?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[O.icon&&b.jsx("span",{className:"text-muted-foreground",children:O.icon}),b.jsx("span",{className:"flex-1 text-left",children:O.label}),O.shortcut&&b.jsx("kbd",{className:"pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:Tte(O.shortcut)})]},O.id)})]},C)})})})]})})}const eH={sm:"w-8 h-8",md:"w-9 h-9 md:w-12 md:h-12",lg:"w-12 h-12 md:w-16 md:h-16"};function GRe({className:e,rows:t=100,cols:n=10,tileClassName:r,tileSize:i="md"}){return b.jsx("div",{className:Be("relative z-0 flex w-full h-full justify-center",e),children:Array.from({length:t}).map((a,s)=>b.jsx("div",{className:Be(eH[i],"border-l dark:border-neutral-900 border-neutral-200 relative",r),children:Array.from({length:n}).map((o,l)=>b.jsx("div",{className:Be(eH[i],"border-r border-t dark:border-neutral-900 border-neutral-200 relative hover:bg-tile transition-colors",r)},`col-${l}`))},`row-${s}`))})}const qRe=["/","/tasks","/terminals","/worktrees","/repositories","/review","/monitoring","/settings"];function KRe(){const e=ri({select:n=>n.location.pathname});return qRe.some(n=>e===n||e.startsWith(n+"/"))?b.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none -z-10",children:b.jsx(GRe,{rows:100,cols:50,tileSize:"sm"})}):null}if(!k.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!Ire)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function YRe(e){e()}function XRe(e){e||(e=YRe),_ke({reactionScheduler:e})}function ZRe(e){return Ske(e)}var QRe=1e4,JRe=1e4,e2e=(function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(r){r===void 0&&(r=QRe),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var i=Date.now();n.registrations.forEach(function(a,s){i-a.registeredAt>=r&&(n.finalize(a.value),n.registrations.delete(s))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){this.registrations.set(r,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,JRe))}}),e})(),t2e=typeof FinalizationRegistry<"u"?FinalizationRegistry:e2e,vD=new t2e(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null});function tH(e){e.reaction=new ul("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function n2e(e,t){t===void 0&&(t="observed");var n=oe.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(o){return vD.unregister(r),r.onStoreChange=o,r.reaction||(tH(r),r.stateVersion=Symbol()),function(){var l;r.onStoreChange=null,(l=r.reaction)===null||l===void 0||l.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var i=n.current;i.reaction||(tH(i),vD.register(n,i,i)),oe.useDebugValue(i.reaction,ZRe),DP.useSyncExternalStore(i.subscribe,i.getSnapshot,i.getSnapshot);var a,s;if(i.reaction.track(function(){try{a=e()}catch(o){s=o}}),s)throw s;return a}var Ak,kk,xie=typeof Symbol=="function"&&Symbol.for,r2e=(kk=(Ak=Object.getOwnPropertyDescriptor(function(){},"name"))===null||Ak===void 0?void 0:Ak.configurable)!==null&&kk!==void 0?kk:!1,nH=xie?Symbol.for("react.forward_ref"):typeof k.forwardRef=="function"&&k.forwardRef(function(e){return null}).$$typeof,rH=xie?Symbol.for("react.memo"):typeof k.memo=="function"&&k.memo(function(e){return null}).$$typeof;function u0(e,t){var n;if(rH&&e.$$typeof===rH)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var r=(n=void 0)!==null&&n!==void 0?n:!1,i=e,a=e.displayName||e.name;if(nH&&e.$$typeof===nH&&(r=!0,i=e.render,typeof i!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var s=function(o,l){return n2e(function(){return i(o,l)},a)};return s.displayName=e.displayName,r2e&&Object.defineProperty(s,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(s.contextTypes=e.contextTypes),r&&(s=k.forwardRef(s)),s=k.memo(s),a2e(e,s),s}var i2e={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function a2e(e,t){Object.keys(e).forEach(function(n){i2e[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var Ok;XRe(xr.unstable_batchedUpdates);Ok=vD.finalizeAllImmediately;const s2e=u0(function(){const t=Um();if(t.connected||!t.hasEverConnected)return null;const n=t.reconnectAttempt>0&&t.reconnectAttempt<t.maxReconnectAttempts,r=t.reconnectAttempt>=t.maxReconnectAttempts;return b.jsx("div",{className:Be("flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium","border-b",r?"bg-destructive/10 border-destructive/30 text-destructive":"bg-amber-500/10 border-amber-500/30 text-amber-600 dark:text-amber-400"),role:"alert","aria-live":"polite",children:r?b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:rs,size:16,strokeWidth:2}),b.jsx("span",{children:"Connection lost. Please check if the server is running."})]}):n?b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:tn,size:16,strokeWidth:2,className:"animate-spin"}),b.jsxs("span",{children:["Reconnecting... (attempt ",t.reconnectAttempt,"/",t.maxReconnectAttempts,")"]})]}):b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:rs,size:16,strokeWidth:2}),b.jsx("span",{children:"Disconnected from server"})]})})});function o2e(){return qn({queryKey:["system","dependencies"],queryFn:()=>zt("/api/system/dependencies"),staleTime:30*1e3,refetchOnWindowFocus:!0})}const iH="npm install -g @anthropic/claude-code",l2e="https://docs.anthropic.com/en/docs/claude-code/overview";function u2e(){const{data:e,isLoading:t}=o2e(),[n,r]=k.useState(!1),[i,a]=k.useState(!1),s=k.useCallback(async()=>{try{await navigator.clipboard.writeText(iH),a(!0),setTimeout(()=>a(!1),2e3)}catch{}},[]),o=k.useCallback(()=>{r(!0)},[]);return t||n||e?.claudeCode?.installed?null:b.jsxs("div",{className:Be("flex items-center justify-between gap-4 px-4 py-3","border-b bg-amber-500/10 border-amber-500/30"),role:"alert",children:[b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx(fe,{icon:rs,size:18,strokeWidth:2,className:"shrink-0 text-amber-600 dark:text-amber-400"}),b.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-4",children:[b.jsx("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:"Claude Code CLI not found"}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("code",{className:"rounded bg-amber-500/20 px-2 py-0.5 text-xs font-mono text-amber-700 dark:text-amber-300",children:iH}),b.jsx("button",{onClick:s,className:Be("p-1 rounded transition-colors","text-amber-600 hover:text-amber-700 hover:bg-amber-500/20","dark:text-amber-400 dark:hover:text-amber-300"),title:i?"Copied!":"Copy to clipboard",children:b.jsx(fe,{icon:i?pl:N1e,size:14,strokeWidth:2})})]})]})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("a",{href:l2e,target:"_blank",rel:"noopener noreferrer",className:Be("text-xs font-medium px-2 py-1 rounded transition-colors","text-amber-600 hover:text-amber-700 hover:bg-amber-500/20","dark:text-amber-400 dark:hover:text-amber-300"),children:"View Docs"}),b.jsx("button",{onClick:o,className:Be("p-1 rounded transition-colors","text-amber-600 hover:text-amber-700 hover:bg-amber-500/20","dark:text-amber-400 dark:hover:text-amber-300"),title:"Dismiss",children:b.jsx(fe,{icon:fi,size:16,strokeWidth:2})})]})]})}const c2e=[{titleKey:"navigation",items:[{labelKey:"goToTasks",shortcut:"meta+1"},{labelKey:"goToTerminals",shortcut:"meta+2"},{labelKey:"goToTaskTerminals",shortcut:"meta+i"},{labelKey:"goToRepositories",shortcut:"meta+3"},{labelKey:"goToReview",shortcut:"meta+4"},{labelKey:"goToMonitoring",shortcut:"meta+5"},{labelKey:"goToSettings",shortcut:"meta+,"}]},{titleKey:"actions",items:[{labelKey:"commandPalette",shortcut:"meta+k"},{labelKey:"newTask",shortcut:"meta+j"},{labelKey:"keyboardShortcuts",shortcut:"meta+/"}]},{titleKey:"terminals",items:[{labelKey:"newTerminal",shortcut:"meta+d"},{labelKey:"closeTerminal",shortcut:"meta+w"}]},{titleKey:"general",items:[{labelKey:"closeModal",shortcut:"escape"},{labelKey:"submitForm",shortcut:"meta+enter"}]}];function d2e({open:e,onOpenChange:t}){const{t:n}=rn("navigation");return b.jsx(ed,{open:e,onOpenChange:t,children:b.jsxs(td,{className:"sm:max-w-md",children:[b.jsx(Gf,{children:b.jsx(qf,{children:n("shortcuts.title")})}),b.jsx("div",{className:"space-y-4 mt-2",children:c2e.map(r=>b.jsxs("div",{children:[b.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:n(`shortcuts.groups.${r.titleKey}`)}),b.jsx("div",{className:"space-y-1",children:r.items.map(i=>b.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[b.jsx("span",{className:"text-sm",children:n(`shortcuts.labels.${i.labelKey}`)}),b.jsx("kbd",{className:"pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:Tte(i.shortcut)})]},i.shortcut))})]},r.titleKey))})]})})}const f2e=({...e})=>{const{resolvedTheme:t}=Kc();return b.jsx(k_e,{theme:t,className:"toaster group",icons:{success:b.jsx(fe,{icon:fte,strokeWidth:2,className:"size-4"}),info:b.jsx(fe,{icon:B1e,strokeWidth:2,className:"size-4"}),warning:b.jsx(fe,{icon:rs,strokeWidth:2,className:"size-4"}),error:b.jsx(fe,{icon:H1e,strokeWidth:2,className:"size-4"}),loading:b.jsx(fe,{icon:tn,strokeWidth:2,className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...e})},ko=nme({component:v2e});function h2e(){return wwe(),null}function p2e(){return zne(),null}function m2e(){return Eie(),null}function g2e(){const e=ri({select:n=>n.location}),{updateViewTracking:t}=Sie();return k.useEffect(()=>{const n=e.pathname;let r="other",i=null,a=null;n.startsWith("/tasks/")?(r="task-detail",i=n.split("/")[2]||null):n==="/terminals"&&(r="terminals",a=new URLSearchParams(e.search).get("tab")),t(r,i,a)},[e.pathname,e.search,t]),null}function b2e(){const e=ri({select:t=>t.location});return k.useEffect(()=>{window.parent!==window&&window.parent.postMessage({type:"vibora:route",pathname:e.pathname,search:e.search},"*")},[e.pathname,e.search]),null}function v2e(){const[e,t]=k.useState(null),[n,r]=k.useState(!1),[i,a]=k.useState(!1),s=typeof window<"u"&&window.parent!==window,o=k.useCallback(d=>{t(()=>d)},[]),l=k.useCallback(()=>{e?.()},[e]),u=k.useCallback(()=>{r(!0)},[]),f=k.useCallback(()=>{a(!0)},[]);return b.jsx(I_e,{children:b.jsxs("div",{className:"flex h-screen flex-col overflow-x-hidden bg-background text-foreground",children:[b.jsx(h2e,{}),b.jsx(p2e,{}),b.jsx(m2e,{}),b.jsx(g2e,{}),b.jsx(b2e,{}),b.jsx(s2e,{}),b.jsx(u2e,{}),b.jsx(_we,{onNewTaskRef:o,onOpenCommandPalette:f}),b.jsxs("main",{className:"isolate flex-1 overflow-hidden relative",children:[b.jsx(KRe,{}),b.jsx(cJ,{})]}),b.jsx(VRe,{open:i,onOpenChange:a,onNewTask:l,onShowShortcuts:u}),b.jsx(d2e,{open:n,onOpenChange:r}),b.jsx(f2e,{position:s?"bottom-center":"bottom-right"})]})})}const y2e=js("/")({beforeLoad:()=>{throw KQ({to:"/tasks"})}}),yD="";function wie(){const[e,t]=k.useState(new Map),[n,r]=k.useState(null),[i,a]=k.useState(!0),[s,o]=k.useState(!1),[l,u]=k.useState(null),f=k.useRef(null),d=k.useRef(0),p=k.useRef(!1),m=k.useCallback(async()=>{a(!0),u(null);try{const g=await fetch(`${yD}/api/worktrees/json`);if(!g.ok)throw new Error("Failed to fetch worktrees");const y=await g.json();t(new Map(y.worktrees.map(v=>[v.path,{...v,size:v.size||0,sizeFormatted:v.sizeFormatted||"0 B",branch:v.branch||"unknown"}]))),r(y.summary),a(!1),o(!1)}catch(g){u(g instanceof Error?g:new Error("Failed to load worktrees")),a(!1),o(!1)}},[]),E=k.useCallback(()=>{if(p.current){m();return}f.current?.close(),a(!0),o(!1),u(null),t(new Map),r(null);const g=new EventSource(`${yD}/api/worktrees`);f.current=g,g.addEventListener("worktree:basic",y=>{const v=JSON.parse(y.data);d.current=v.length,t(new Map(v.map(x=>[x.path,{...x,size:0,sizeFormatted:"...",branch:"..."}]))),a(!1),o(v.length>0)}),g.addEventListener("worktree:details",y=>{const v=JSON.parse(y.data);t(x=>{const T=new Map(x),w=T.get(v.path);return w&&T.set(v.path,{...w,size:v.size,sizeFormatted:v.sizeFormatted,branch:v.branch}),T}),d.current--,d.current<=0&&o(!1)}),g.addEventListener("worktree:complete",y=>{const v=JSON.parse(y.data);r(v),o(!1),g.close()}),g.addEventListener("worktree:error",y=>{const{path:v}=JSON.parse(y.data);At.viewer.error("Error loading worktree details",{path:v}),d.current--,d.current<=0&&o(!1)}),g.onerror=()=>{g.close(),At.viewer.info("SSE connection failed, trying JSON fallback"),p.current=!0,m()}},[m]);return k.useEffect(()=>(E(),()=>{f.current?.close()}),[E]),{worktrees:k.useMemo(()=>Array.from(e.values()).sort((y,v)=>y.isOrphaned!==v.isOrphaned?y.isOrphaned?-1:1:new Date(v.lastModified).getTime()-new Date(y.lastModified).getTime()),[e]),summary:n,isLoading:i,isLoadingDetails:s,error:l,refetch:E}}function Tie(){const e=wr();return Fn({mutationFn:({worktreePath:t,repoPath:n,deleteLinkedTask:r})=>zt(`${yD}/api/worktrees`,{method:"DELETE",body:JSON.stringify({worktreePath:t,repoPath:n,deleteLinkedTask:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worktrees"]}),e.invalidateQueries({queryKey:["tasks"]})}})}const _2e=Xc("h-5 gap-1 rounded-full border border-transparent px-2 py-0.5 text-[0.625rem] font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-2.5! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-colors overflow-hidden group/badge",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground bg-input/20 dark:bg-input/30",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function co({className:e,variant:t="default",render:n,...r}){return Axe({defaultTagName:"span",props:ol({className:Be(_2e({className:e,variant:t}))},r),render:n,state:{slot:"badge",variant:t}})}function wa({className:e,size:t="default",...n}){return b.jsx("div",{"data-slot":"card","data-size":t,className:Be("ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-lg py-4 text-xs/relaxed ring-1 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg group/card flex flex-col",e),...n})}function E2e({className:e,...t}){return b.jsx("div",{"data-slot":"card-header",className:Be("gap-1 rounded-t-lg px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]",e),...t})}function S2e({className:e,...t}){return b.jsx("div",{"data-slot":"card-title",className:Be("text-sm font-medium",e),...t})}function Mf({className:e,...t}){return b.jsx("div",{"data-slot":"card-content",className:Be("px-4 group-data-[size=sm]/card:px-3",e),...t})}function go({...e}){return b.jsx(zEe,{"data-slot":"alert-dialog",...e})}function wu({...e}){return b.jsx(Pte,{"data-slot":"alert-dialog-trigger",...e})}function x2e({...e}){return b.jsx(Nte,{"data-slot":"alert-dialog-portal",...e})}function w2e({className:e,...t}){return b.jsx(Ate,{"data-slot":"alert-dialog-overlay",className:Be("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50",e),...t})}function bo({className:e,size:t="default",...n}){return b.jsxs(x2e,{children:[b.jsx(w2e,{}),b.jsx(Rte,{"data-slot":"alert-dialog-content","data-size":t,className:Be("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/10 gap-3 rounded-xl p-4 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none",e),...n})]})}function vo({className:e,...t}){return b.jsx("div",{"data-slot":"alert-dialog-header",className:Be("grid grid-rows-[auto_1fr] place-items-center gap-1 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 yo({className:e,...t}){return b.jsx("div",{"data-slot":"alert-dialog-footer",className:Be("flex flex-col-reverse gap-2 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 _o({className:e,...t}){return b.jsx(Lte,{"data-slot":"alert-dialog-title",className:Be("text-sm 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 Eo({className:e,...t}){return b.jsx(kte,{"data-slot":"alert-dialog-description",className:Be("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",e),...t})}function qp({className:e,...t}){return b.jsx(qe,{"data-slot":"alert-dialog-action",className:Be(e),...t})}function So({className:e,variant:t="outline",size:n="default",...r}){return b.jsx(qx,{"data-slot":"alert-dialog-cancel",className:Be(e),render:b.jsx(qe,{variant:t,size:n}),...r})}const hi=k.forwardRef(({className:e,...t},n)=>b.jsx(bSe,{ref:n,className:Be("peer size-4 shrink-0 rounded border border-input ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","data-checked:bg-primary data-checked:border-primary data-checked:text-primary-foreground","flex items-center justify-center transition-colors",e),...t,children:b.jsx(vSe,{className:"flex items-center justify-center",children:b.jsx(fe,{icon:pl,size:12,strokeWidth:3})})}));hi.displayName="Checkbox";const _D={IN_PROGRESS:"bg-muted-foreground/20 text-muted-foreground",IN_REVIEW:"bg-primary/20 text-primary",DONE:"bg-accent/20 text-accent",CANCELED:"bg-destructive/20 text-destructive",ORPHANED:"bg-destructive/20 text-destructive"},T2e=js("/worktrees/")({component:O2e});function C2e(){const{t:e}=rn("common");return t=>{const n=new Date(t),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3),s=Math.floor(a/60),o=Math.floor(s/60),l=Math.floor(o/24);return l>0?l===1?e("time.dayAgo"):e("time.daysAgo",{count:l}):o>0?o===1?e("time.hourAgo"):e("time.hoursAgo",{count:o}):s>0?s===1?e("time.minuteAgo"):e("time.minutesAgo",{count:s}):e("time.justNow")}}function aH({className:e}){return b.jsx("span",{className:`inline-block animate-pulse rounded bg-muted ${e}`})}function A2e({worktree:e,onDelete:t}){const{t:n}=rn("common"),{t:r}=rn("worktrees"),i=C2e(),[a,s]=k.useState(!1),[o,l]=k.useState(!1),[u,f]=k.useState(!1),d=e.sizeFormatted==="..."||e.branch==="...",p=!e.isOrphaned&&e.taskId,m=async()=>{l(!0);try{await t(e,u),s(!1)}catch{}finally{l(!1)}},E=S=>{s(S),S||f(!1)};return b.jsx(wa,{className:"transition-colors hover:border-border/80",children:b.jsxs(Mf,{className:"flex items-start justify-between gap-4 py-4",children:[b.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"truncate font-medium",children:e.name}),e.isOrphaned?b.jsx(co,{className:Be("shrink-0",_D.ORPHANED),children:n("statuses.ORPHANED")}):e.taskStatus?b.jsx(co,{className:Be("shrink-0",_D[e.taskStatus]),children:n(`statuses.${e.taskStatus}`)}):null]}),b.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Vi,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate font-mono",children:e.path})]}),b.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Vx,size:12,strokeWidth:2,className:"shrink-0"}),e.branch==="..."?b.jsx(aH,{className:"h-3 w-16"}):b.jsx("span",{className:"font-mono",children:e.branch})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:mte,size:12,strokeWidth:2,className:"shrink-0"}),e.sizeFormatted==="..."?b.jsx(aH,{className:"h-3 w-12"}):b.jsx("span",{children:e.sizeFormatted})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:cte,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{children:i(e.lastModified)})]})]}),e.taskId&&e.taskTitle&&b.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:b.jsxs(Ai,{to:"/tasks/$taskId",params:{taskId:e.taskId},className:"inline-flex items-center gap-1 text-foreground hover:underline",children:[b.jsx("span",{className:"truncate",children:e.taskTitle}),b.jsx(fe,{icon:Xy,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),b.jsxs(go,{open:a,onOpenChange:E,children:[b.jsx(wu,{render:b.jsx(qe,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:d}),children:b.jsx(fe,{icon:bu,size:14,strokeWidth:2})}),b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsx(_o,{children:r("delete.title")}),b.jsxs(Eo,{children:[r("delete.description")," ",b.jsx("span",{className:"font-mono",children:e.name}),".",u&&p&&b.jsxs(b.Fragment,{children:[" ",r("delete.linkedTaskWillBeDeleted",{title:e.taskTitle})]})," ",r("delete.cannotUndo")]}),p&&b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(hi,{checked:u,onCheckedChange:S=>f(S===!0),disabled:o}),r("delete.alsoDeleteLinkedTask",{title:e.taskTitle})]})]}),b.jsxs(yo,{children:[b.jsx(So,{disabled:o,children:n("buttons.cancel")}),b.jsxs(qe,{variant:"destructive",onClick:m,disabled:o,className:"gap-2",children:[o&&b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}),n(o?"status.deleting":"buttons.delete")]})]})]})]})]})})}const k2e=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function O2e(){const{t:e}=rn("common"),{t}=rn("worktrees"),{worktrees:n,summary:r,isLoading:i,isLoadingDetails:a,error:s,refetch:o}=wie(),l=Tie(),[u,f]=k.useState(new Set),[d,p]=k.useState(!1),[m,E]=k.useState(!1),[S,g]=k.useState(!1),y=O=>{f(N=>{const D=new Set(N);return D.has(O)?D.delete(O):D.add(O),D})},v=()=>{f(new Set)},x=k.useMemo(()=>u.size===0?n:n.filter(O=>!!(O.isOrphaned&&u.has("ORPHANED")||O.taskStatus&&u.has(O.taskStatus))),[n,u]),T=k.useMemo(()=>n.filter(O=>O.taskStatus==="DONE"||O.taskStatus==="CANCELED"),[n]),w=async()=>{if(T.length!==0){E(!0);try{for(const O of T)await l.mutateAsync({worktreePath:O.path,repoPath:O.repoPath,deleteLinkedTask:S});p(!1),o()}catch{}finally{E(!1)}}},C=O=>{p(O),O||g(!1)},R=async(O,N)=>{await l.mutateAsync({worktreePath:O.path,repoPath:O.repoPath,deleteLinkedTask:N}),o()};return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsx("h1",{className:"text-sm font-medium",children:t("title")}),(r||n.length>0)&&b.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[b.jsx("span",{children:t("summary.total",{count:r?.total??n.length})}),(r?.orphaned??n.filter(O=>O.isOrphaned).length)>0&&b.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:r?.orphaned??n.filter(O=>O.isOrphaned).length})}),a?b.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):r?b.jsx("span",{children:r.totalSizeFormatted}):null]})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[T.length>0&&b.jsxs(go,{open:d,onOpenChange:C,children:[b.jsxs(wu,{render:b.jsx(qe,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:a}),children:[b.jsx(fe,{icon:hte,size:12,strokeWidth:2}),t("cleanup.button",{count:T.length})]}),b.jsxs(bo,{children:[b.jsxs(vo,{children:[b.jsx(_o,{children:t("cleanup.title")}),b.jsxs(Eo,{children:[t("cleanup.description",{count:T.length}),S&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("p",{className:"text-sm text-muted-foreground",children:[T.filter(O=>O.taskStatus==="DONE").length>0&&b.jsxs("span",{className:"mr-3",children:[b.jsx("span",{className:"font-medium text-accent",children:T.filter(O=>O.taskStatus==="DONE").length})," ",t("cleanup.done")]}),T.filter(O=>O.taskStatus==="CANCELED").length>0&&b.jsxs("span",{children:[b.jsx("span",{className:"font-medium text-destructive",children:T.filter(O=>O.taskStatus==="CANCELED").length})," ",t("cleanup.canceled")]})]}),b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(hi,{checked:S,onCheckedChange:O=>g(O===!0),disabled:m}),t("cleanup.alsoDeleteLinkedTasks")]}),b.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),b.jsxs(yo,{children:[b.jsx(So,{disabled:m,children:e("buttons.cancel")}),b.jsxs(qe,{variant:"destructive",onClick:w,disabled:m,className:"gap-2",children:[m&&b.jsx(fe,{icon:tn,size:14,strokeWidth:2,className:"animate-spin"}),m?e("status.deleting"):t("delete.button",{count:T.length})]})]})]})]}),u.size>0&&b.jsxs(qe,{variant:"ghost",size:"sm",onClick:v,className:"gap-1.5 text-xs",children:[b.jsx(fe,{icon:fi,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),b.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:k2e.map(O=>{const N=u.has(O);return b.jsx("button",{onClick:()=>y(O),className:Be("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",N?_D[O]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${O}`)},O)})})]}),b.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[i&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:tn,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),s&&b.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[b.jsx(fe,{icon:rs,size:20,strokeWidth:2}),b.jsx("span",{className:"text-sm",children:t("error.failedToLoad",{message:s.message})})]}),!i&&!s&&x.length===0&&b.jsx("div",{className:"py-12 text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:u.size>0?t("empty.noMatch"):t("empty.noWorktrees")})}),!i&&b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:x.map(O=>b.jsx(A2e,{worktree:O,onDelete:R},O.path))})]})]})}function Wn(e,t="Assertion error"){if(!e)throw Error(t)}function Kp({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,i)=>(r+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function ED(e,t){return t.sort(e==="horizontal"?R2e:N2e)}function R2e(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function N2e(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Cie(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function I2e({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let i,a=Number.MAX_VALUE;for(const s of t){const{x:o,y:l}=Cie(r,s),u=e==="horizontal"?o:l;u<a&&(a=u,i=s)}return Wn(i,"No rect found"),i}function Aie(e){const{element:t,orientation:n,panels:r,separators:i}=e,a=ED(n,Array.from(t.children).filter(f=>f instanceof HTMLElement).map(f=>({element:f}))).map(({element:f})=>f),s=[];let o=!1,l,u=[];for(const f of a)if(f.hasAttribute("data-panel")){const d=r.find(p=>p.element===f);if(d){if(l){const p=l.element.getBoundingClientRect(),m=f.getBoundingClientRect();let E;if(o){const S=n==="horizontal"?new DOMRect(p.right,p.top,0,p.height):new DOMRect(p.left,p.bottom,p.width,0),g=n==="horizontal"?new DOMRect(m.left,m.top,0,m.height):new DOMRect(m.left,m.top,m.width,0);switch(u.length){case 0:{E=[S,g];break}case 1:{const y=u[0],v=I2e({orientation:n,rects:[p,m],targetRect:y.element.getBoundingClientRect()});E=[y,v===p?g:S];break}default:{E=u;break}}}else u.length?E=u:E=[n==="horizontal"?new DOMRect(p.right,m.top,m.left-p.right,m.height):new DOMRect(m.left,p.bottom,m.width,m.top-p.bottom)];for(const S of E)s.push({group:e,groupSize:Kp({group:e}),panels:[l,d],separator:"width"in S?void 0:S,rect:"width"in S?S:S.element.getBoundingClientRect()})}o=!1,l=d,u=[]}}else if(f.hasAttribute("data-separator")){const d=i.find(p=>p.element===f);d?u.push(d):(l=void 0,u=[])}else o=!0;return s}function D2e(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function L2e(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function P2e(e){return e/100*window.innerHeight}function M2e(e){return e/100*window.innerWidth}function j2e(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function k_({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,a]=j2e(n);switch(a){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=L2e(t,i);break}case"em":{r=D2e(t,i);break}case"vh":{r=P2e(i);break}case"vw":{r=M2e(i);break}}return r}function ao(e){return parseFloat(e.toFixed(3))}function sH(e){const{panels:t}=e,n=Kp({group:e});return n===0?t.map(r=>({collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:i,panelConstraints:a}=r;let s=0;if(a.collapsedSize){const f=k_({groupSize:n,panelElement:i,styleProp:a.collapsedSize});s=ao(f/n*100)}let o;if(a.defaultSize){const f=k_({groupSize:n,panelElement:i,styleProp:a.defaultSize});o=ao(f/n*100)}let l=0;if(a.minSize){const f=k_({groupSize:n,panelElement:i,styleProp:a.minSize});l=ao(f/n*100)}let u=100;if(a.maxSize){const f=k_({groupSize:n,panelElement:i,styleProp:a.maxSize});u=ao(f/n*100)}return{collapsedSize:s,collapsible:a.collapsible===!0,defaultSize:o,minSize:l,maxSize:u,panelId:r.id}})}class F2e{#e={};addListener(t,n){const r=this.#e[t];return r===void 0?this.#e[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=this.#e[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let i=!1,a=null;const s=Array.from(r);for(let o=0;o<s.length;o++){const l=s[o];try{l.call(null,n)}catch(u){a===null&&(i=!0,a=u)}}if(i)throw a}}removeAllListeners(){this.#e={}}removeListener(t,n){const r=this.#e[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}}function Ji(e,t,n=0){return Math.abs(ao(e)-ao(t))<=n}let Es={cursorFlags:0,interactionState:{state:"inactive"},mountedGroups:new Map};const _f=new F2e;function vl(){return Es}function Ls(e){const t=typeof e=="function"?e(Es):e;if(Es===t)return Es;const n=Es;return Es={...Es,...t},t.cursorFlags!==void 0&&_f.emit("cursorFlagsChange",Es.cursorFlags),t.interactionState!==void 0&&_f.emit("interactionStateChange",Es.interactionState),t.mountedGroups!==void 0&&(Es.mountedGroups.forEach((r,i)=>{r.derivedPanelConstraints.forEach(a=>{if(a.collapsible){const{layout:s}=n.mountedGroups.get(i)??{};if(s){const o=Ji(a.collapsedSize,r.layout[a.panelId]),l=Ji(a.collapsedSize,s[a.panelId]);o&&!l&&(i.inMemoryLastExpandedPanelSizes[a.panelId]=s[a.panelId])}}})}),_f.emit("mountedGroupsChange",Es.mountedGroups)),Es}const B2e=e=>e,Rk=()=>{},kie=1,Oie=2,Rie=4,Nie=8,oH={coarse:10,precise:5};function U2e({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(a=>{if(!a.disableCursor)switch(a.orientation){case"horizontal":{r++;break}case"vertical":{i++;break}}})}if(r===0&&i===0)return null;switch(n){case"active":{const a=(e&kie)!==0,s=(e&Oie)!==0,o=(e&Rie)!==0,l=(e&Nie)!==0;if(e){if(a)return o?"se-resize":l?"ne-resize":"e-resize";if(s)return o?"sw-resize":l?"nw-resize":"w-resize";if(o)return"s-resize";if(l)return"n-resize"}break}}return r>0&&i>0?"move":r>0?"ew-resize":"ns-resize"}let Nk,jo;function QM(){jo===void 0&&(jo=new CSSStyleSheet,document.adoptedStyleSheets=[jo]);const{cursorFlags:e,interactionState:t}=vl();switch(t.state){case"active":case"hover":{const n=U2e({cursorFlags:e,groups:t.hitRegions.map(i=>i.group),state:t.state}),r=`*{cursor: ${n} !important; ${t.state==="active"?"touch-action: none;":""} }`;if(Nk===r)return;Nk=r,n?jo.cssRules.length===0?jo.insertRule(r):jo.replaceSync(r):jo.cssRules.length===1&&jo.deleteRule(0);break}case"inactive":{Nk=void 0,jo.cssRules.length===1&&jo.deleteRule(0);break}}}function $2e(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Uv(e,t){return Ji(e,t)?0:e>t?1:-1}function up({panelConstraints:e,size:t}){const{collapsedSize:n=0,collapsible:r,maxSize:i=100,minSize:a=0}=e;if(Uv(t,a)<0)if(r){const s=(n+a)/2;Uv(t,s)<0?t=n:t=a}else t=a;return t=Math.min(i,t),t=ao(t),t}function $v({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Ji(e,0))return t;const s=Object.values(t),o=Object.values(i),l=[...s],[u,f]=r;Wn(u!=null,"Invalid first pivot index"),Wn(f!=null,"Invalid second pivot index");let d=0;if(a==="keyboard"){{const E=e<0?f:u,S=n[E];Wn(S,`Panel constraints not found for index ${E}`);const{collapsedSize:g=0,collapsible:y,minSize:v=0}=S;if(y){const x=s[E];if(Wn(x!=null,`Previous layout not found for panel index ${E}`),Ji(x,g)){const T=v-x;Uv(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}{const E=e<0?u:f,S=n[E];Wn(S,`No panel constraints found for index ${E}`);const{collapsedSize:g=0,collapsible:y,minSize:v=0}=S;if(y){const x=s[E];if(Wn(x!=null,`Previous layout not found for panel index ${E}`),Ji(x,v)){const T=x-g;Uv(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}}{const E=e<0?1:-1;let S=e<0?f:u,g=0;for(;;){const v=s[S];Wn(v!=null,`Previous layout not found for panel index ${S}`);const x=up({panelConstraints:n[S],size:100})-v;if(g+=x,S+=E,S<0||S>=n.length)break}const y=Math.min(Math.abs(e),Math.abs(g));e=e<0?0-y:y}{let E=e<0?u:f;for(;E>=0&&E<n.length;){const S=Math.abs(e)-Math.abs(d),g=s[E];Wn(g!=null,`Previous layout not found for panel index ${E}`);const y=g-S,v=up({panelConstraints:n[E],size:y});if(!Ji(g,v)&&(d+=g-v,l[E]=v,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?E--:E++}}if($2e(o,l))return i;{const E=e<0?f:u,S=s[E];Wn(S!=null,`Previous layout not found for panel index ${E}`);const g=S+d,y=up({panelConstraints:n[E],size:g});if(l[E]=y,!Ji(y,g)){let v=g-y,x=e<0?f:u;for(;x>=0&&x<n.length;){const T=l[x];Wn(T!=null,`Previous layout not found for panel index ${x}`);const w=T+v,C=up({panelConstraints:n[x],size:w});if(Ji(T,C)||(v-=C-T,l[x]=C),Ji(v,0))break;e>0?x--:x++}}}const p=Object.values(l).reduce((E,S)=>S+E,0);if(!Ji(p,100,.1))return i;const m=Object.keys(i);return l.reduce((E,S,g)=>(E[m[g]]=S,E),{})}function $m(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Uv(e[n],t[n])!==0)return!1;return!0}function Iie({event:e,hitRegions:t,initialLayoutMap:n,mountedGroups:r,pointerDownAtPoint:i}){let a=0;const s=new Map(r);t.forEach(o=>{const{group:l,groupSize:u}=o,{disableCursor:f,orientation:d,panels:p}=l;let m=0;i?d==="horizontal"?m=(e.clientX-i.x)/u*100:m=(e.clientY-i.y)/u*100:d==="horizontal"?m=e.clientX<0?-100:100:m=e.clientY<0?-100:100;const E=n.get(l),{defaultLayoutDeferred:S,derivedPanelConstraints:g,layout:y,separatorToPanels:v}=r.get(l)??{defaultLayoutDeferred:!1};if(g&&E&&y&&v){const x=$v({delta:m,initialLayout:E,panelConstraints:g,pivotIndices:o.panels.map(T=>p.indexOf(T)),prevLayout:y,trigger:"mouse-or-touch"});if($m(x,y)){if(m!==0&&!f)switch(d){case"horizontal":{a|=m<0?kie:Oie;break}case"vertical":{a|=m<0?Rie:Nie;break}}}else{s.set(o.group,{defaultLayoutDeferred:S,derivedPanelConstraints:g,layout:x,separatorToPanels:v});const T=o.group.panels.map(({id:w})=>w).join(",");o.group.inMemoryLayouts[T]=x}}}),Ls({cursorFlags:a,mountedGroups:s}),QM()}function lH(e){if(e.defaultPrevented||e.relatedTarget!==null||e.clientX===0&&e.clientY===0)return;const{interactionState:t,mountedGroups:n}=vl();t.state==="active"&&t.hitRegions.forEach(r=>{e.currentTarget===r.group.element&&Iie({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n})})}function mE(e){const t=e.parentElement;Wn(t,"Parent group element not found");const{mountedGroups:n}=vl();for(const[r]of n)if(r.element===t)return r;throw Error("Could not find parent Group for separator element")}function jf({layout:e,panelConstraints:t}){const n=[...Object.values(e)],r=n.reduce((s,o)=>s+o,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!Ji(r,100)&&n.length>0)for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=100/r*o;n[s]=l}let i=0;for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=up({panelConstraints:t[s],size:o});o!=l&&(i+=o-l,n[s]=l)}if(!Ji(i,0))for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=o+i,u=up({panelConstraints:t[s],size:l});if(o!==u&&(i-=u-o,n[s]=u,Ji(i,0)))break}const a=Object.keys(e);return n.reduce((s,o,l)=>(s[a[l]]=o,s),{})}function Die({groupId:e}){const t=()=>{const{mountedGroups:n}=vl();for(const[r,i]of n)if(r.id===e)return{group:r,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:a,layout:s,separatorToPanels:o}=t(),l=jf({layout:n,panelConstraints:i});return r?s:($m(s,l)||Ls(u=>({mountedGroups:new Map(u.mountedGroups).set(a,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:l,separatorToPanels:o})})),l)}}}function Lie(e){const{mountedGroups:t}=vl(),n=t.get(e);return Wn(n,`Mounted Group ${e.id} not found`),n}function Pd(e,t){const n=mE(e),r=Lie(n),i=n.separators.find(f=>f.element===e);Wn(i,"Matching separator not found");const a=r.separatorToPanels.get(i);Wn(a,"Matching panels not found");const s=a.map(f=>n.panels.indexOf(f)),o=Die({groupId:n.id}).getLayout(),l=$v({delta:t,initialLayout:o,panelConstraints:r.derivedPanelConstraints,pivotIndices:s,prevLayout:o,trigger:"keyboard"}),u=jf({layout:l,panelConstraints:r.derivedPanelConstraints});$m(o,u)||Ls(f=>({mountedGroups:new Map(f.mountedGroups).set(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,layout:u,separatorToPanels:r.separatorToPanels})}))}function uH(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=mE(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Pd(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Pd(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Pd(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Pd(t,-5);break}case"End":{e.preventDefault(),Pd(t,100);break}case"Enter":{e.preventDefault();const r=mE(t),{derivedPanelConstraints:i,layout:a,separatorToPanels:s}=Lie(r),o=r.separators.find(d=>d.element===t);Wn(o,"Matching separator not found");const l=s.get(o);Wn(l,"Matching panels not found");const u=l[0],f=i.find(d=>d.panelId===u.id);if(Wn(f,"Panel metadata not found"),f.collapsible){const d=a[u.id],p=f.collapsedSize===d?r.inMemoryLastExpandedPanelSizes[u.id]??f.minSize:f.collapsedSize;Pd(t,p-d)}break}case"F6":{e.preventDefault();const r=mE(t).separators.map(s=>s.element),i=Array.from(r).findIndex(s=>s===e.currentTarget);Wn(i!==null,"Index not found");const a=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[a].focus();break}case"Home":{e.preventDefault(),Pd(t,-100);break}}}function z2e(e,t,n){let r,i={x:1/0,y:1/0};for(const a of t){const s=Cie(n,a.rect);switch(e){case"horizontal":{s.x<=i.x&&(r=a,i=s);break}case"vertical":{s.y<=i.y&&(r=a,i=s);break}}}return r?{distance:i,hitRegion:r}:void 0}let O_;function H2e(){return O_===void 0&&(typeof matchMedia=="function"?O_=!!matchMedia("(pointer:coarse)").matches:O_=!1),O_}function W2e(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:fH(e),b:fH(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Wn(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:dH(cH(n.a)),b:dH(cH(n.b))};if(i.a===i.b){const a=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let o=a.length;for(;o--;){const l=a[o];if(l===s.a)return 1;if(l===s.b)return-1}}return Math.sign(i.a-i.b)}const V2e=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function G2e(e){const t=getComputedStyle(Pie(e)??e).display;return t==="flex"||t==="inline-flex"}function q2e(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||G2e(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||V2e.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function cH(e){let t=e.length;for(;t--;){const n=e[t];if(Wn(n,"Missing node"),q2e(n))return n}return null}function dH(e){return e&&Number(getComputedStyle(e).zIndex)||0}function fH(e){const t=[];for(;e;)t.push(e),e=Pie(e);return t}function Pie(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}function K2e(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Y2e({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!(n instanceof HTMLElement)||n.contains(e)||e.contains(n))return!0;if(W2e(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(K2e(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Mie(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const a=H2e()?oH.coarse:oH.precise,s=Aie(i),o=z2e(i.orientation,s,{x:e.clientX,y:e.clientY});o&&o.distance.x<=a&&o.distance.y<=a&&Y2e({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function hH(e){if(e.defaultPrevented)return;const{mountedGroups:t}=vl(),n=Mie(e,t),r=new Set,i=new Set,a=new Set,s=new Map;let o=!1;n.forEach(l=>{r.add(l.group),l.panels.forEach(f=>{i.add(f)}),l.separator&&(a.add(l.separator),o||(o=!0,l.separator.element.focus()));const u=t.get(l.group);u&&s.set(l.group,u.layout)}),Ls({interactionState:{hitRegions:n,initialLayoutMap:s,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}}),n.length&&e.preventDefault()}function pH(e){if(e.defaultPrevented)return;const{interactionState:t,mountedGroups:n}=vl();switch(t.state){case"active":{if(e.type!=="pointerleave"&&e.buttons===0){Ls(r=>r.interactionState.state==="inactive"?r:{cursorFlags:0,interactionState:{state:"inactive"}});return}Iie({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint});break}default:{const r=Mie(e,n);r.length===0?t.state!=="inactive"&&Ls({interactionState:{state:"inactive"}}):Ls({interactionState:{hitRegions:r,state:"hover"}}),QM();break}}}function mH(e){if(e.defaultPrevented)return;e.preventDefault();const{interactionState:t}=vl();t.state==="active"&&(Ls({cursorFlags:0,interactionState:{state:"inactive"}}),QM())}function gH(e){let t=0,n=0;const r={};for(const a of e)if(a.defaultSize!==void 0){t++;const s=ao(a.defaultSize);n+=s,r[a.panelId]=s}else r[a.panelId]=void 0;const i=e.length-t;if(i!==0){const a=ao((100-n)/i);for(const s of e)s.defaultSize===void 0&&(r[s.panelId]=a)}return r}function X2e(e,t,n){const r=n[0];if(!r)return;const i=e.panels.find(s=>s.element===t);if(!i||!i.onResize)return;const a=Kp({group:e});i.onResize({asPercentage:ao(r.inlineSize/a*100),inPixels:r.inlineSize},i.id)}function Z2e(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Q2e(e){let t=!0;const n=new Set,r=new Set,i=new ResizeObserver(m=>{for(const E of m){const{borderBoxSize:S,target:g}=E;if(g===e.element){if(t){if(Kp({group:e})===0)return;Ls(y=>{const v=y.mountedGroups.get(e);if(v){const x=sH(e),T=v.defaultLayoutDeferred?gH(x):v.layout,w=jf({layout:T,panelConstraints:x});return!v.defaultLayoutDeferred&&$m(T,w)&&Z2e(v.derivedPanelConstraints,x)?y:{mountedGroups:new Map(y.mountedGroups).set(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:x,layout:w,separatorToPanels:v.separatorToPanels})}}return y})}}else X2e(e,g,S)}});i.observe(e.element),e.panels.forEach(m=>{Wn(!n.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),n.add(m.id),m.onResize&&i.observe(m.element)});const a=Kp({group:e}),s=sH(e),o=e.panels.map(({id:m})=>m).join(",");let l=e.defaultLayout;l&&e.panels.length!==Object.keys(l).length&&(l=void 0);const u=e.inMemoryLayouts[o]??l??gH(s),f=jf({layout:u,panelConstraints:s}),d=Aie(e),p=Ls(m=>{const E=new Map;return d.forEach(S=>{S.separator&&E.set(S.separator,S.panels)}),{mountedGroups:new Map(m.mountedGroups).set(e,{defaultLayoutDeferred:a===0,derivedPanelConstraints:s,layout:f,separatorToPanels:E})}});return e.element.addEventListener("pointerleave",lH),e.separators.forEach(m=>{Wn(!r.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.element.addEventListener("keydown",uH)}),p.mountedGroups.size===1&&(window.addEventListener("pointerdown",hH),window.addEventListener("pointermove",pH),window.addEventListener("pointerup",mH)),function(){t=!1;const m=Ls(E=>{const S=new Map(E.mountedGroups);return S.delete(e),{mountedGroups:S}});e.element.removeEventListener("pointerleave",lH),e.separators.forEach(E=>{E.element.removeEventListener("keydown",uH)}),m.mountedGroups.size===0&&(window.removeEventListener("pointerdown",hH),window.removeEventListener("pointermove",pH),window.removeEventListener("pointerup",mH)),i.disconnect()}}function JM(e){const t=k.useId();return`${e??t}`}const Jf=typeof window<"u"?k.useLayoutEffect:k.useEffect;function e3(e){const t=k.useRef(e);return Jf(()=>{t.current=e},[e]),k.useCallback(n=>t.current?.(n),[t])}function t3(...e){return e3(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function J2e(e){const t=k.useRef({...e});return Jf(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const jie="--react-resizable-panels--panel--pointer-events";function Fie(e,t){const n=e.replace(/[^a-zA-Z0-9\-_]/g,""),r=t.replace(/[^a-zA-Z0-9\-_]/g,"");return`--react-resizable-panels--${n}--${r}`}const Bie=k.createContext(null);function eNe(e,t){const n=k.useRef({getLayout:()=>({}),setLayout:B2e});k.useImperativeHandle(t,()=>n.current,[]),Jf(()=>{Object.assign(n.current,Die({groupId:e}))})}function tNe({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:s,id:o,onLayoutChange:l,orientation:u="horizontal",style:f,...d}){const p=k.useRef({}),m=e3(H=>{$m(p.current,H)||(p.current=H,l?.(H))}),E=JM(o),[S,g]=k.useState(!1),[y,v]=k.useState(null),[x,T]=k.useState(n??{}),[w,C]=k.useState([]),[R,O]=k.useState([]),N=k.useRef({lastExpandedPanelSizes:{},layouts:{}}),D=t3(v,a);eNe(E,s);const L=k.useMemo(()=>({id:E,orientation:u,registerPanel:H=>(C(B=>ED(u,[...B,H])),()=>{C(B=>B.filter(q=>q!==H))}),registerSeparator:H=>(O(B=>ED(u,[...B,H])),()=>{O(B=>B.filter(q=>q!==H))})}),[E,u]),z=J2e({defaultLayout:n,disableCursor:r}),M=k.useRef(null);Jf(()=>{if(y===null)return;const H={defaultLayout:z.defaultLayout,disableCursor:!!z.disableCursor,disabled:!!i,element:y,id:E,inMemoryLastExpandedPanelSizes:N.current.lastExpandedPanelSizes,inMemoryLayouts:N.current.layouts,orientation:u,panels:w,separators:R};M.current=H;const B=Q2e(H),q=vl().mountedGroups.get(H);if(q){const{defaultLayoutDeferred:j,derivedPanelConstraints:$,layout:Y}=q;!j&&$.length>0&&(T(Y),m?.(Y))}const K=_f.addListener("interactionStateChange",j=>{j.state==="active"?g(j.hitRegions.some($=>$.group===H)):g(!1)}),U=_f.addListener("mountedGroupsChange",j=>{const $=j.get(H);if($){const{defaultLayoutDeferred:Y,derivedPanelConstraints:W,layout:J}=$;if(Y||W.length===0)return;T(J),m?.(J)}});return()=>{M.current=null,B(),K(),U()}},[i,y,E,m,u,w,R,z]),k.useEffect(()=>{const H=M.current;H&&(H.defaultLayout=n,H.disableCursor=!!r)});const V={[jie]:S?"none":void 0};for(const H in x){const B=Fie(E,H),q=x[H];V[B]=q}return b.jsx(Bie.Provider,{value:L,children:b.jsx("div",{...d,"aria-orientation":u,className:t,"data-group":!0,"data-testid":E,id:E,ref:D,style:{...f,...V,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap"},children:e})})}function n3(){const e=k.useContext(Bie);return Wn(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function nNe({groupId:e,panelId:t}){const n=()=>{const{mountedGroups:o}=vl();for(const[l,{defaultLayoutDeferred:u,derivedPanelConstraints:f,layout:d,separatorToPanels:p}]of o)if(l.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:f,group:l,layout:d,separatorToPanels:p};throw Error(`Group ${e} not found`)},r=()=>{const o=n().derivedPanelConstraints.find(l=>l.panelId===t);if(o!==void 0)return o;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const o=n().group.panels.find(l=>l.id===t);if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},a=()=>{const o=n().layout[t];if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},s=o=>{const l=a();if(o===l)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:f,group:d,layout:p,separatorToPanels:m}=n(),E=d.panels.findIndex(v=>v.id===t),S=E===d.panels.length-1,g=$v({delta:S?l-o:o-l,initialLayout:p,panelConstraints:f,pivotIndices:S?[E-1,E]:[E,E+1],prevLayout:p,trigger:"imperative-api"}),y=jf({layout:g,panelConstraints:f});$m(p,y)||Ls(v=>({mountedGroups:new Map(v.mountedGroups).set(d,{defaultLayoutDeferred:u,derivedPanelConstraints:f,layout:y,separatorToPanels:m})}))};return{collapse:()=>{const{collapsible:o,collapsedSize:l}=r(),u=a();o&&u!==l&&s(l)},expand:()=>{const{collapsible:o,collapsedSize:l,minSize:u}=r(),f=a();o&&f===l&&s(u)},getSize:()=>{const{group:o}=n(),l=a(),{element:u}=i(),f=o.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:l,inPixels:f}},isCollapsed:()=>{const{collapsible:o,collapsedSize:l}=r(),u=a();return o&&Ji(l,u)},resize:o=>{if(a()!==o){let l;switch(typeof o){case"number":{const{group:u}=n(),f=Kp({group:u});l=ao(o/f*100);break}case"string":{l=parseFloat(o);break}}s(l)}}}}function rNe(e,t){const{id:n}=n3(),r=k.useRef({collapse:Rk,expand:Rk,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Rk});k.useImperativeHandle(t,()=>r.current,[]),Jf(()=>{Object.assign(r.current,nNe({groupId:n,panelId:e}))})}function iNe({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,elementRef:a,id:s,maxSize:o="100%",minSize:l="0%",onResize:u,panelRef:f,style:d,...p}){const m=!!s,E=JM(s),[S,g]=k.useState(null),y=t3(g,a),{id:v,registerPanel:x}=n3(),T=u!==null,w=e3(R=>{u?.(R,s)});Jf(()=>{if(S!==null)return x({element:S,id:E,idIsStable:m,onResize:T?w:void 0,panelConstraints:{collapsedSize:n,collapsible:r,defaultSize:i,maxSize:o,minSize:l}})},[n,r,i,S,T,E,m,o,l,w,x]),rNe(E,f);const C=Fie(v,E);return b.jsx("div",{...p,"data-panel":!0,"data-testid":E,id:E,ref:y,style:{...aNe,flexBasis:0,flexGrow:`var(${C}, 1)`,flexShrink:1,overflow:"hidden",pointerEvents:`var(${jie})`},children:b.jsx("div",{className:t,style:{width:"100%",height:"100%",...d},children:e})})}const aNe={minHeight:"unset",maxHeight:"unset",height:"unset",minWidth:"unset",maxWidth:"unset",width:"unset",flex:"unset",flexBasis:"unset",flexShrink:"unset",flexGrow:"unset",border:"unset",borderWidth:"unset",padding:"unset",margin:"unset"};function sNe({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a;const s=e[n],o=t.find(l=>l.panelId===n);if(o){const l=o.maxSize,u=a=o.collapsible?o.collapsedSize:o.minSize,f=[r,r+1];a=jf({layout:$v({delta:u-s,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n],i=jf({layout:$v({delta:l-s,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:s}}function oNe({children:e,className:t,elementRef:n,id:r,style:i,...a}){const s=JM(r),[o,l]=k.useState({}),[u,f]=k.useState("inactive"),[d,p]=k.useState(null),m=t3(p,n),{id:E,orientation:S,registerSeparator:g}=n3(),y=S==="horizontal"?"vertical":"horizontal";return Jf(()=>{if(d!==null){const v={element:d,id:s},x=g(v),T=_f.addListener("interactionStateChange",C=>{f(C.state!=="inactive"&&C.hitRegions.some(R=>R.separator===v)?C.state:"inactive")}),w=_f.addListener("mountedGroupsChange",C=>{C.forEach(({derivedPanelConstraints:R,layout:O,separatorToPanels:N},D)=>{if(D.id===E){const L=N.get(v);if(L){const z=L[0],M=D.panels.indexOf(z);l(sNe({layout:O,panelConstraints:R,panelId:z.id,panelIndex:M}))}}})});return()=>{T(),w(),x()}}},[d,E,s,g]),b.jsx("div",{...a,"aria-controls":o.valueControls,"aria-orientation":y,"aria-valuemax":o.valueMax,"aria-valuemin":o.valueMin,"aria-valuenow":o.valueNow,children:e,className:t,"data-separator":u,"data-testid":s,id:s,ref:m,role:"separator",style:{flexBasis:"auto",...i,flexGrow:0,flexShrink:0},tabIndex:0})}function Vd({className:e,direction:t,...n}){return b.jsx(tNe,{"data-slot":"resizable-panel-group",orientation:t,className:Be("flex h-full w-full data-[orientation=vertical]:flex-col",e),...n})}function xs({...e}){return b.jsx(iNe,{"data-slot":"resizable-panel",...e})}function Gd({withHandle:e,className:t,...n}){return b.jsx(oNe,{"data-slot":"resizable-handle",className:Be("relative flex w-px items-center justify-center bg-border cursor-grab active:cursor-grabbing group touch-none","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","focus-visible:ring-offset-1 focus-visible:ring-offset-background","data-[orientation=vertical]:h-px data-[orientation=vertical]:w-full data-[orientation=vertical]:cursor-row-resize","[&[data-orientation=vertical]>div]:rotate-90",t),...n,children:e&&b.jsxs("div",{className:"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center gap-1 bg-muted/90 border border-border rounded-full px-1 py-3 opacity-70 group-hover:opacity-100 group-focus:opacity-100 transition-opacity shadow-sm",children:[b.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-muted-foreground"}),b.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-muted-foreground"}),b.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-muted-foreground"})]})})}var Ik={exports:{}},bH;function lNe(){return bH||(bH=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(s,o,l){var u=this&&this.__decorate||function(v,x,T,w){var C,R=arguments.length,O=R<3?x:w===null?w=Object.getOwnPropertyDescriptor(x,T):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(v,x,T,w);else for(var N=v.length-1;N>=0;N--)(C=v[N])&&(O=(R<3?C(O):R>3?C(x,T,O):C(x,T))||O);return R>3&&O&&Object.defineProperty(x,T,O),O},f=this&&this.__param||function(v,x){return function(T,w){x(T,w,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=l(9042),p=l(9924),m=l(844),E=l(4725),S=l(2585),g=l(3656);let y=o.AccessibilityManager=class extends m.Disposable{constructor(v,x,T,w){super(),this._terminal=v,this._coreBrowserService=T,this._renderService=w,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let C=0;C<this._terminal.rows;C++)this._rowElements[C]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[C]);if(this._topBoundaryFocusListener=C=>this._handleBoundaryFocus(C,0),this._bottomBoundaryFocusListener=C=>this._handleBoundaryFocus(C,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new p.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((C=>this._handleResize(C.rows)))),this.register(this._terminal.onRender((C=>this._refreshRows(C.start,C.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((C=>this._handleChar(C)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
32
32
  `)))),this.register(this._terminal.onA11yTab((C=>this._handleTab(C)))),this.register(this._terminal.onKey((C=>this._handleKey(C.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,g.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,m.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(v){for(let x=0;x<v;x++)this._handleChar(" ")}_handleChar(v){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==v&&(this._charsToAnnounce+=v):this._charsToAnnounce+=v,v===`
33
33
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(v){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(v)||this._charsToConsume.push(v)}_refreshRows(v,x){this._liveRegionDebouncer.refresh(v,x,this._terminal.rows)}_renderRows(v,x){const T=this._terminal.buffer,w=T.lines.length.toString();for(let C=v;C<=x;C++){const R=T.lines.get(T.ydisp+C),O=[],N=R?.translateToString(!0,void 0,void 0,O)||"",D=(T.ydisp+C+1).toString(),L=this._rowElements[C];L&&(N.length===0?(L.innerText=" ",this._rowColumns.set(L,[0,1])):(L.textContent=N,this._rowColumns.set(L,O)),L.setAttribute("aria-posinset",D),L.setAttribute("aria-setsize",w))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(v,x){const T=v.target,w=this._rowElements[x===0?1:this._rowElements.length-2];if(T.getAttribute("aria-posinset")===(x===0?"1":`${this._terminal.buffer.lines.length}`)||v.relatedTarget!==w)return;let C,R;if(x===0?(C=T,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(C=this._rowElements.shift(),R=T,this._rowContainer.removeChild(C)),C.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),x===0){const O=this._createAccessibilityTreeNode();this._rowElements.unshift(O),this._rowContainer.insertAdjacentElement("afterbegin",O)}else{const O=this._createAccessibilityTreeNode();this._rowElements.push(O),this._rowContainer.appendChild(O)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(x===0?-1:1),this._rowElements[x===0?1:this._rowElements.length-2].focus(),v.preventDefault(),v.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;const v=document.getSelection();if(!v)return;if(v.isCollapsed)return void(this._rowContainer.contains(v.anchorNode)&&this._terminal.clearSelection());if(!v.anchorNode||!v.focusNode)return void console.error("anchorNode and/or focusNode are null");let x={node:v.anchorNode,offset:v.anchorOffset},T={node:v.focusNode,offset:v.focusOffset};if((x.node.compareDocumentPosition(T.node)&Node.DOCUMENT_POSITION_PRECEDING||x.node===T.node&&x.offset>T.offset)&&([x,T]=[T,x]),x.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(x={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(x.node))return;const w=this._rowElements.slice(-1)[0];if(T.node.compareDocumentPosition(w)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(T={node:w,offset:w.textContent?.length??0}),!this._rowContainer.contains(T.node))return;const C=({node:N,offset:D})=>{const L=N instanceof Text?N.parentNode:N;let z=parseInt(L?.getAttribute("aria-posinset"),10)-1;if(isNaN(z))return console.warn("row is invalid. Race condition?"),null;const M=this._rowColumns.get(L);if(!M)return console.warn("columns is null. Race condition?"),null;let V=D<M.length?M[D]:M.slice(-1)[0]+1;return V>=this._terminal.cols&&(++z,V=0),{row:z,column:V}},R=C(x),O=C(T);if(R&&O){if(R.row>O.row||R.row===O.row&&R.column>=O.column)throw new Error("invalid range");this._terminal.select(R.column,R.row,(O.row-R.row)*this._terminal.cols-R.column+O.column)}}_handleResize(v){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let x=this._rowContainer.children.length;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);for(;this._rowElements.length>v;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const v=this._coreBrowserService.mainDocument.createElement("div");return v.setAttribute("role","listitem"),v.tabIndex=-1,this._refreshRowDimensions(v),v}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let v=0;v<this._terminal.rows;v++)this._refreshRowDimensions(this._rowElements[v])}}_refreshRowDimensions(v){v.style.height=`${this._renderService.dimensions.css.cell.height}px`}};o.AccessibilityManager=y=u([f(1,S.IInstantiationService),f(2,E.ICoreBrowserService),f(3,E.IRenderService)],y)},3614:(s,o)=>{function l(p){return p.replace(/\r?\n/g,"\r")}function u(p,m){return m?"\x1B[200~"+p+"\x1B[201~":p}function f(p,m,E,S){p=u(p=l(p),E.decPrivateModes.bracketedPasteMode&&S.rawOptions.ignoreBracketedPasteMode!==!0),E.triggerDataEvent(p,!0),m.value=""}function d(p,m,E){const S=E.getBoundingClientRect(),g=p.clientX-S.left-10,y=p.clientY-S.top-10;m.style.width="20px",m.style.height="20px",m.style.left=`${g}px`,m.style.top=`${y}px`,m.style.zIndex="1000",m.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=l,o.bracketTextForPaste=u,o.copyHandler=function(p,m){p.clipboardData&&p.clipboardData.setData("text/plain",m.selectionText),p.preventDefault()},o.handlePasteEvent=function(p,m,E,S){p.stopPropagation(),p.clipboardData&&f(p.clipboardData.getData("text/plain"),m,E,S)},o.paste=f,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(p,m,E,S,g){d(p,m,E),g&&S.rightClickSelect(p),m.value=S.selectionText,m.select()}},7239:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const u=l(1505);o.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(f,d,p){this._css.set(f,d,p)}getCss(f,d){return this._css.get(f,d)}setColor(f,d,p){this._color.set(f,d,p)}getColor(f,d){return this._color.get(f,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(l,u,f,d){l.addEventListener(u,f,d);let p=!1;return{dispose:()=>{p||(p=!0,l.removeEventListener(u,f,d))}}}},3551:function(s,o,l){var u=this&&this.__decorate||function(y,v,x,T){var w,C=arguments.length,R=C<3?v:T===null?T=Object.getOwnPropertyDescriptor(v,x):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,v,x,T);else for(var O=y.length-1;O>=0;O--)(w=y[O])&&(R=(C<3?w(R):C>3?w(v,x,R):w(v,x))||R);return C>3&&R&&Object.defineProperty(v,x,R),R},f=this&&this.__param||function(y,v){return function(x,T){v(x,T,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=l(3656),p=l(8460),m=l(844),E=l(2585),S=l(4725);let g=o.Linkifier=class extends m.Disposable{get currentLink(){return this._currentLink}constructor(y,v,x,T,w){super(),this._element=y,this._mouseService=v,this._renderService=x,this._bufferService=T,this._linkProviderService=w,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,m.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,m.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(y){this._lastMouseEvent=y;const v=this._positionFromMouseEvent(y,this._element,this._mouseService);if(!v)return;this._isMouseOut=!1;const x=y.composedPath();for(let T=0;T<x.length;T++){const w=x[T];if(w.classList.contains("xterm"))break;if(w.classList.contains("xterm-hover"))return}this._lastBufferCell&&v.x===this._lastBufferCell.x&&v.y===this._lastBufferCell.y||(this._handleHover(v),this._lastBufferCell=v)}_handleHover(y){if(this._activeLine!==y.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(y,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,y)||(this._clearCurrentLink(),this._askForLink(y,!0))}_askForLink(y,v){this._activeProviderReplies&&v||(this._activeProviderReplies?.forEach((T=>{T?.forEach((w=>{w.link.dispose&&w.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=y.y);let x=!1;for(const[T,w]of this._linkProviderService.linkProviders.entries())v?this._activeProviderReplies?.get(T)&&(x=this._checkLinkProviderResult(T,y,x)):w.provideLinks(y.y,(C=>{if(this._isMouseOut)return;const R=C?.map((O=>({link:O})));this._activeProviderReplies?.set(T,R),x=this._checkLinkProviderResult(T,y,x),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(y.y,this._activeProviderReplies)}))}_removeIntersectingLinks(y,v){const x=new Set;for(let T=0;T<v.size;T++){const w=v.get(T);if(w)for(let C=0;C<w.length;C++){const R=w[C],O=R.link.range.start.y<y?0:R.link.range.start.x,N=R.link.range.end.y>y?this._bufferService.cols:R.link.range.end.x;for(let D=O;D<=N;D++){if(x.has(D)){w.splice(C--,1);break}x.add(D)}}}}_checkLinkProviderResult(y,v,x){if(!this._activeProviderReplies)return x;const T=this._activeProviderReplies.get(y);let w=!1;for(let C=0;C<y;C++)this._activeProviderReplies.has(C)&&!this._activeProviderReplies.get(C)||(w=!0);if(!w&&T){const C=T.find((R=>this._linkAtPosition(R.link,v)));C&&(x=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!x)for(let C=0;C<this._activeProviderReplies.size;C++){const R=this._activeProviderReplies.get(C)?.find((O=>this._linkAtPosition(O.link,v)));if(R){x=!0,this._handleNewLink(R);break}}return x}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(y){if(!this._currentLink)return;const v=this._positionFromMouseEvent(y,this._element,this._mouseService);v&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,v)&&this._currentLink.link.activate(y,this._currentLink.link.text)}_clearCurrentLink(y,v){this._currentLink&&this._lastMouseEvent&&(!y||!v||this._currentLink.link.range.start.y>=y&&this._currentLink.link.range.end.y<=v)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,m.disposeArray)(this._linkCacheDisposables))}_handleNewLink(y){if(!this._lastMouseEvent)return;const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._linkAtPosition(y.link,v)&&(this._currentLink=y,this._currentLink.state={decorations:{underline:y.link.decorations===void 0||y.link.decorations.underline,pointerCursor:y.link.decorations===void 0||y.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,y.link,this._lastMouseEvent),y.link.decorations={},Object.defineProperties(y.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:x=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==x&&(this._currentLink.state.decorations.pointerCursor=x,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",x))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:x=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==x&&(this._currentLink.state.decorations.underline=x,this._currentLink.state.isHovered&&this._fireUnderlineEvent(y.link,x))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((x=>{if(!this._currentLink)return;const T=x.start===0?0:x.start+1+this._bufferService.buffer.ydisp,w=this._bufferService.buffer.ydisp+1+x.end;if(this._currentLink.link.range.start.y>=T&&this._currentLink.link.range.end.y<=w&&(this._clearCurrentLink(T,w),this._lastMouseEvent)){const C=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);C&&this._askForLink(C,!1)}}))))}_linkHover(y,v,x){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!0),this._currentLink.state.decorations.pointerCursor&&y.classList.add("xterm-cursor-pointer")),v.hover&&v.hover(x,v.text)}_fireUnderlineEvent(y,v){const x=y.range,T=this._bufferService.buffer.ydisp,w=this._createLinkUnderlineEvent(x.start.x-1,x.start.y-T-1,x.end.x,x.end.y-T-1,void 0);(v?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(w)}_linkLeave(y,v,x){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!1),this._currentLink.state.decorations.pointerCursor&&y.classList.remove("xterm-cursor-pointer")),v.leave&&v.leave(x,v.text)}_linkAtPosition(y,v){const x=y.range.start.y*this._bufferService.cols+y.range.start.x,T=y.range.end.y*this._bufferService.cols+y.range.end.x,w=v.y*this._bufferService.cols+v.x;return x<=w&&w<=T}_positionFromMouseEvent(y,v,x){const T=x.getCoords(y,v,this._bufferService.cols,this._bufferService.rows);if(T)return{x:T[0],y:T[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(y,v,x,T,w){return{x1:y,y1:v,x2:x,y2:T,cols:this._bufferService.cols,fg:w}}};o.Linkifier=g=u([f(1,S.IMouseService),f(2,S.IRenderService),f(3,E.IBufferService),f(4,S.ILinkProviderService)],g)},9042:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(s,o,l){var u=this&&this.__decorate||function(S,g,y,v){var x,T=arguments.length,w=T<3?g:v===null?v=Object.getOwnPropertyDescriptor(g,y):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(S,g,y,v);else for(var C=S.length-1;C>=0;C--)(x=S[C])&&(w=(T<3?x(w):T>3?x(g,y,w):x(g,y))||w);return T>3&&w&&Object.defineProperty(g,y,w),w},f=this&&this.__param||function(S,g){return function(y,v){g(y,v,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=l(511),p=l(2585);let m=o.OscLinkProvider=class{constructor(S,g,y){this._bufferService=S,this._optionsService=g,this._oscLinkService=y}provideLinks(S,g){const y=this._bufferService.buffer.lines.get(S-1);if(!y)return void g(void 0);const v=[],x=this._optionsService.rawOptions.linkHandler,T=new d.CellData,w=y.getTrimmedLength();let C=-1,R=-1,O=!1;for(let N=0;N<w;N++)if(R!==-1||y.hasContent(N)){if(y.loadCell(N,T),T.hasExtendedAttrs()&&T.extended.urlId){if(R===-1){R=N,C=T.extended.urlId;continue}O=T.extended.urlId!==C}else R!==-1&&(O=!0);if(O||R!==-1&&N===w-1){const D=this._oscLinkService.getLinkData(C)?.uri;if(D){const L={start:{x:R+1,y:S},end:{x:N+(O||N!==w-1?0:1),y:S}};let z=!1;if(!x?.allowNonHttpProtocols)try{const M=new URL(D);["http:","https:"].includes(M.protocol)||(z=!0)}catch{z=!0}z||v.push({text:D,range:L,activate:(M,V)=>x?x.activate(M,V,L):E(0,V),hover:(M,V)=>x?.hover?.(M,V,L),leave:(M,V)=>x?.leave?.(M,V,L)})}O=!1,T.hasExtendedAttrs()&&T.extended.urlId?(R=N,C=T.extended.urlId):(R=-1,C=-1)}}g(v)}};function E(S,g){if(confirm(`Do you want to navigate to ${g}?
34
34