@staff0rd/assist 0.1089.0 → 0.1090.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +2 -2
- package/dist/index.js +53 -9
- package/package.json +1 -1
package/dist/built-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.1090.0
|
|
@@ -3813,7 +3813,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
|
|
|
3813
3813
|
${e.palette.mode==="light"?e.lighten(e.alpha(e.palette.divider,1),.88):e.darken(e.alpha(e.palette.divider,1),.68)}`,textAlign:"left",padding:16,variants:[{props:{variant:"head"},style:{color:(e.vars||e).palette.text.primary,lineHeight:e.typography.pxToRem(24),fontWeight:e.typography.fontWeightMedium}},{props:{variant:"body"},style:{color:(e.vars||e).palette.text.primary}},{props:{variant:"footer"},style:{color:(e.vars||e).palette.text.secondary,lineHeight:e.typography.pxToRem(21),fontSize:e.typography.pxToRem(12)}},{props:{size:"small"},style:{padding:"6px 16px",[`&.${u1t.paddingCheckbox}`]:{width:24,padding:"0 12px 0 16px","& > *":{padding:0}}}},{props:{padding:"checkbox"},style:{width:48,padding:"0 0 0 4px"}},{props:{padding:"none"},style:{padding:0}},{props:{align:"left"},style:{textAlign:"left"}},{props:{align:"center"},style:{textAlign:"center"}},{props:{align:"right"},style:{textAlign:"right",flexDirection:"row-reverse"}},{props:{align:"justify"},style:{textAlign:"justify"}},{props:({ownerState:t})=>t.stickyHeader,style:{position:"sticky",top:0,zIndex:2,backgroundColor:(e.vars||e).palette.background.default}}]}))),Zgn=tK.forwardRef(function(t,r){let n=_t({props:t,name:"MuiTableCell"}),{align:o="inherit",className:i,component:a,padding:s,scope:l,size:u,sortDirection:d,variant:f,...p}=n,h=tK.useContext(wce),m=tK.useContext(Bk),g=m&&m.variant==="head",y;a?y=a:y=g?"th":"td";let v=l;y==="td"?v=void 0:!v&&g&&(v="col");let b=f||m&&m.variant,x={...n,align:o,component:y,padding:s||(h&&h.padding?h.padding:"normal"),size:u||(h&&h.size?h.size:"medium"),sortDirection:d,stickyHeader:b==="head"&&h&&h.stickyHeader,variant:b},w=Kgn(x),C=null;return d&&(C=d==="asc"?"ascending":"descending"),(0,d1t.jsx)(Xgn,{as:y,ref:r,className:gt(w.root,i),"aria-sort":C,scope:v,ownerState:x,...p})}),Zr=Zgn;var p1t=S(ie(),1);function f1t(e){return Tt("MuiTableContainer",e)}var _Ci=Ct("MuiTableContainer",["root"]);var h1t=S(R(),1),Qgn=e=>{let{classes:t}=e;return wt({root:["root"]},f1t,t)},Jgn=nt("div",{name:"MuiTableContainer",slot:"Root"})({width:"100%",overflowX:"auto"}),e0n=p1t.forwardRef(function(t,r){let n=_t({props:t,name:"MuiTableContainer"}),{className:o,component:i="div",...a}=n,s={...n,component:i},l=Qgn(s);return(0,h1t.jsx)(Jgn,{ref:r,as:i,className:gt(l.root,o),ownerState:s,...a})}),aS=e0n;var y1t=S(ie(),1);function m1t(e){return Tt("MuiTableHead",e)}var FCi=Ct("MuiTableHead",["root"]);var nLe=S(R(),1),t0n=e=>{let{classes:t}=e;return wt({root:["root"]},m1t,t)},r0n=nt("thead",{name:"MuiTableHead",slot:"Root"})({display:"table-header-group"}),n0n={variant:"head"},g1t="thead",o0n=y1t.forwardRef(function(t,r){let n=_t({props:t,name:"MuiTableHead"}),{className:o,component:i=g1t,...a}=n,s={...n,component:i},l=t0n(s);return(0,nLe.jsx)(Bk.Provider,{value:n0n,children:(0,nLe.jsx)(r0n,{as:i,className:gt(l.root,o),ref:r,role:i===g1t?null:"rowgroup",ownerState:s,...a})})}),sS=o0n;var R1t=S(ie(),1);var b1t=S(ie(),1);function v1t(e){return Tt("MuiToolbar",e)}var JCi=Ct("MuiToolbar",["root","gutters","regular","dense"]);var x1t=S(R(),1),i0n=e=>{let{classes:t,disableGutters:r,variant:n}=e;return wt({root:["root",!r&&"gutters",n]},v1t,t)},a0n=nt("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,!r.disableGutters&&t.gutters,t[r.variant]]}})(Dt(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",variants:[{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}},{props:{variant:"dense"},style:{minHeight:48}},{props:{variant:"regular"},style:e.mixins.toolbar}]}))),s0n=b1t.forwardRef(function(t,r){let n=_t({props:t,name:"MuiToolbar"}),{className:o,component:i="div",disableGutters:a=!1,variant:s="regular",...l}=n,u={...n,component:i,disableGutters:a,variant:s},d=i0n(u);return(0,x1t.jsx)(a0n,{as:i,className:gt(d.root,o),ref:r,ownerState:u,...l})}),gP=s0n;var C1t=S(ie(),1);var S1t=S(R(),1),kce=ot((0,S1t.jsx)("path",{d:"M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"}),"KeyboardArrowLeft");var T1t=S(R(),1),_ce=ot((0,T1t.jsx)("path",{d:"M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"}),"KeyboardArrowRight");function w1t(e){return Tt("MuiTablePaginationActions",e)}var yki=Ct("MuiTablePaginationActions",["root"]);var gf=S(R(),1),l0n=e=>{let{classes:t}=e;return wt({root:["root"]},w1t,t)},c0n=nt("div",{name:"MuiTablePaginationActions",slot:"Root"})({}),u0n=C1t.forwardRef(function(t,r){let n=_t({props:t,name:"MuiTablePaginationActions"}),{className:o,count:i,disabled:a=!1,getItemAriaLabel:s,onPageChange:l,page:u,rowsPerPage:d,showFirstButton:f,showLastButton:p,slots:h={},slotProps:m={},...g}=n,y=Sd(),b=l0n(n),x=q=>{l(q,0)},w=q=>{l(q,u-1)},C=q=>{l(q,u+1)},k=q=>{l(q,Math.max(0,Math.ceil(i/d)-1))},_=h.firstButton??Kt,E=h.lastButton??Kt,D=h.nextButton??Kt,N=h.previousButton??Kt,$=h.firstButtonIcon??Avt,P=h.lastButtonIcon??Ivt,A=h.nextButtonIcon??_ce,L=h.previousButtonIcon??kce,I=y?E:_,M=y?D:N,F=y?N:D,O=y?_:E,z=y?m.lastButton:m.firstButton,H=y?m.nextButton:m.previousButton,V=y?m.previousButton:m.nextButton,U=y?m.firstButton:m.lastButton;return(0,gf.jsxs)(c0n,{ref:r,className:gt(b.root,o),...g,children:[f&&(0,gf.jsx)(I,{onClick:x,disabled:a||u===0,"aria-label":s("first",u),title:s("first",u),...z,children:y?(0,gf.jsx)(P,{...m.lastButtonIcon}):(0,gf.jsx)($,{...m.firstButtonIcon})}),(0,gf.jsx)(M,{onClick:w,disabled:a||u===0,color:"inherit","aria-label":s("previous",u),title:s("previous",u),...H,children:y?(0,gf.jsx)(A,{...m.nextButtonIcon}):(0,gf.jsx)(L,{...m.previousButtonIcon})}),(0,gf.jsx)(F,{onClick:C,disabled:a||(i!==-1?u>=Math.ceil(i/d)-1:!1),color:"inherit","aria-label":s("next",u),title:s("next",u),...V,children:y?(0,gf.jsx)(L,{...m.previousButtonIcon}):(0,gf.jsx)(A,{...m.nextButtonIcon})}),p&&(0,gf.jsx)(O,{onClick:k,disabled:a||u>=Math.ceil(i/d)-1,"aria-label":s("last",u),title:s("last",u),...U,children:y?(0,gf.jsx)($,{...m.firstButtonIcon}):(0,gf.jsx)(P,{...m.lastButtonIcon})})]})}),oLe=u0n;function k1t(e){return Tt("MuiTablePagination",e)}var d0n=Ct("MuiTablePagination",["root","toolbar","spacer","selectLabel","selectRoot","select","selectIcon","input","menuItem","displayedRows","actions"]),b7=d0n;var f0n=e=>{let t;if(typeof Intl<"u"&&Intl.NumberFormat)try{t=new Intl.NumberFormat(e)}catch{}return r=>Number.isFinite(r)&&t?t.format(r):String(r)},_1t=f0n;var m1=S(R(),1),P1t=S(ie(),1),E1t,Ece=_1t("en-US"),p0n=nt(Zr,{name:"MuiTablePagination",slot:"Root"})(Dt(({theme:e})=>({overflow:"auto",color:(e.vars||e).palette.text.primary,fontSize:e.typography.pxToRem(14),"&:last-child":{padding:0}}))),h0n=nt(gP,{name:"MuiTablePagination",slot:"Toolbar",overridesResolver:(e,t)=>({[`& .${b7.actions}`]:t.actions,...t.toolbar})})(Dt(({theme:e})=>({minHeight:52,paddingRight:2,[`${e.breakpoints.up("xs")} and (orientation: landscape)`]:{minHeight:52},[e.breakpoints.up("sm")]:{minHeight:52,paddingRight:2},[`& .${b7.actions}`]:{flexShrink:0,marginLeft:20}}))),m0n=nt("div",{name:"MuiTablePagination",slot:"Spacer"})({flex:"1 1 100%"}),g0n=nt("p",{name:"MuiTablePagination",slot:"SelectLabel"})(Dt(({theme:e})=>({...e.typography.body2,flexShrink:0}))),y0n=nt(Nk,{name:"MuiTablePagination",slot:"Select",overridesResolver:(e,t)=>({[`& .${b7.selectIcon}`]:t.selectIcon,[`& .${b7.select}`]:t.select,...t.input,...t.selectRoot})})({color:"inherit",fontSize:"inherit",flexShrink:0,marginRight:32,marginLeft:8,[`& .${b7.select}`]:{paddingLeft:8,paddingRight:24,textAlign:"right",textAlignLast:"right"}}),v0n=nt(Gr,{name:"MuiTablePagination",slot:"MenuItem"})({}),b0n=nt("p",{name:"MuiTablePagination",slot:"DisplayedRows"})(Dt(({theme:e})=>({...e.typography.body2,flexShrink:0})));function x0n({from:e,to:t,count:r}){return`${Ece(e)}\u2013${Ece(t)} of ${r!==-1?Ece(r):`more than ${Ece(t)}`}`}function S0n(e){return`Go to ${e} page`}var T0n=e=>{let{classes:t}=e;return wt({root:["root"],toolbar:["toolbar"],spacer:["spacer"],selectLabel:["selectLabel"],select:["select"],input:["input"],selectIcon:["selectIcon"],menuItem:["menuItem"],displayedRows:["displayedRows"],actions:["actions"]},k1t,t)},w0n=R1t.forwardRef(function(t,r){let n=_t({props:t,name:"MuiTablePagination"}),{ActionsComponent:o=oLe,colSpan:i,component:a=Zr,count:s,disabled:l=!1,getItemAriaLabel:u=S0n,labelDisplayedRows:d=x0n,labelRowsPerPage:f="Rows per page:",onPageChange:p,onRowsPerPageChange:h,page:m,rowsPerPage:g,rowsPerPageOptions:y=[10,25,50,100],showFirstButton:v=!1,showLastButton:b=!1,slotProps:x={},slots:w={},...C}=n,k=n,_=T0n(k),E=typeof x?.select=="function"?x.select(k):x?.select??{},D=E.native?"option":v0n,N;(a===Zr||a==="td")&&(N=i||1e3);let $=cg(E.id),P=cg(E.labelId),A=()=>s===-1?(m+1)*g:g===-1?s:Math.min(s,(m+1)*g),L={slots:w,slotProps:x},[I,M]=sr("root",{ref:r,className:_.root,elementType:p0n,externalForwardedProps:{...L,component:a,...C},ownerState:k,additionalProps:{colSpan:N}}),[F,O]=sr("toolbar",{className:_.toolbar,elementType:h0n,externalForwardedProps:L,ownerState:k}),[z,H]=sr("spacer",{className:_.spacer,elementType:m0n,externalForwardedProps:L,ownerState:k}),[V,U]=sr("selectLabel",{className:_.selectLabel,elementType:g0n,externalForwardedProps:L,ownerState:k,additionalProps:{id:P}}),[q,Y]=sr("select",{className:_.select,elementType:y0n,externalForwardedProps:L,ownerState:k}),[Z,ee]=sr("menuItem",{className:_.menuItem,elementType:D,externalForwardedProps:L,ownerState:k}),[K,ce]=sr("displayedRows",{className:_.displayedRows,elementType:b0n,externalForwardedProps:L,ownerState:k});return(0,m1.jsx)(I,{...M,children:(0,m1.jsxs)(F,{...O,children:[(0,m1.jsx)(z,{...H}),y.length>1&&(0,m1.jsx)(V,{...U,children:f}),y.length>1&&(0,m1.jsx)(q,{variant:"standard",...!E.variant&&{input:E1t||(E1t=(0,m1.jsx)(ea,{}))},value:g,onChange:h,id:$,labelId:P,...E,classes:{...E.classes,root:gt(_.input,_.selectRoot,(E.classes||{}).root),select:gt(_.select,(E.classes||{}).select),icon:gt(_.selectIcon,(E.classes||{}).icon)},disabled:l,...Y,children:y.map(ne=>(0,P1t.createElement)(Z,{...ee,key:ne.label?ne.label:ne,value:ne.value?ne.value:ne},ne.label?ne.label:ne))}),(0,m1.jsx)(K,{...ce,children:d({from:s===0?0:m*g+1,to:A(),count:s===-1?-1:s,page:m})}),(0,m1.jsx)(o,{className:_.actions,count:s,onPageChange:p,page:m,rowsPerPage:g,showFirstButton:v,showLastButton:b,slotProps:x.actions,slots:w.actions,getItemAriaLabel:u,disabled:l})]})})}),yP=w0n;var Rce=S(ie(),1);function A1t(e){return Tt("MuiTableRow",e)}var C0n=Ct("MuiTableRow",["root","selected","hover","head","footer"]),iLe=C0n;var I1t=S(R(),1),k0n=e=>{let{classes:t,selected:r,hover:n,head:o,footer:i}=e;return wt({root:["root",r&&"selected",n&&"hover",o&&"head",i&&"footer"]},A1t,t)},_0n=nt("tr",{name:"MuiTableRow",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,r.head&&t.head,r.footer&&t.footer]}})(Dt(({theme:e})=>({color:"inherit",display:"table-row",verticalAlign:"middle",outline:0,[`&.${iLe.hover}:hover`]:{backgroundColor:(e.vars||e).palette.action.hover},[`&.${iLe.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`)}}}))),L1t="tr",E0n=Rce.forwardRef(function(t,r){let n=_t({props:t,name:"MuiTableRow"}),{className:o,component:i=L1t,hover:a=!1,selected:s=!1,...l}=n,u=Rce.useContext(Bk),d={...n,component:i,hover:a,selected:s,head:u&&u.variant==="head",footer:u&&u.variant==="footer"},f=k0n(d);return(0,I1t.jsx)(_0n,{as:i,ref:r,className:gt(f.root,o),role:i===L1t?null:"row",ownerState:d,...l})}),lc=E0n;var O1t=S(ie(),1);var D1t=S(R(),1),M1t=ot((0,D1t.jsx)("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownward");function N1t(e){return Tt("MuiTableSortLabel",e)}var R0n=Ct("MuiTableSortLabel",["root","active","icon","directionDesc","directionAsc"]),Pce=R0n;var Ace=S(R(),1),P0n=e=>{let{classes:t,direction:r,active:n}=e,o={root:["root",n&&"active",`direction${It(r)}`],icon:["icon"]};return wt(o,N1t,t)},A0n=nt(nr,{name:"MuiTableSortLabel",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,r.active&&t.active]}})(Dt(({theme:e})=>({cursor:"pointer",display:"inline-flex",justifyContent:"flex-start",flexDirection:"inherit",alignItems:"center","&:focus":{color:(e.vars||e).palette.text.secondary},"&:hover":{color:(e.vars||e).palette.text.secondary,[`& .${Pce.icon}`]:{opacity:.5}},[`&.${Pce.active}`]:{color:(e.vars||e).palette.text.primary,[`& .${Pce.icon}`]:{opacity:1,color:(e.vars||e).palette.text.secondary}}}))),L0n=nt("span",{name:"MuiTableSortLabel",slot:"Icon"})(Dt(({theme:e})=>({fontSize:18,marginRight:4,marginLeft:4,opacity:0,transition:e.transitions.create(["opacity","transform"],{duration:e.transitions.duration.shorter}),userSelect:"none",variants:[{props:{direction:"desc"},style:{transform:"rotate(0deg)"}},{props:{direction:"asc"},style:{transform:"rotate(180deg)"}}]}))),I0n=O1t.forwardRef(function(t,r){let n=_t({props:t,name:"MuiTableSortLabel"}),{active:o=!1,children:i,className:a,direction:s="asc",hideSortIcon:l=!1,IconComponent:u=M1t,slots:d={},slotProps:f={},...p}=n,h={...n,active:o,direction:s,hideSortIcon:l,IconComponent:u},m=P0n(h),g={slots:d,slotProps:f},[y,v]=sr("root",{elementType:A0n,externalForwardedProps:g,ownerState:h,className:gt(m.root,a),ref:r,additionalProps:{internalNativeButton:!1}}),[b,x]=sr("icon",{elementType:L0n,externalForwardedProps:g,ownerState:h,className:m.icon});return(0,Ace.jsxs)(y,{disableRipple:!0,component:"span",...v,...p,children:[i,l&&!o?null:(0,Ace.jsx)(b,{as:u,...x})]})}),aLe=I0n;var Vi=S(ie(),1);function D0n(e){return(1+Math.sin(Math.PI*e-Math.PI/2))/2}function sLe(e,t,r,n={},o=()=>{}){let{ease:i=D0n,duration:a=300}=n,s=null,l=t[e],u=!1,d=()=>{u=!0},f=p=>{if(u){o(new Error("Animation cancelled"));return}s===null&&(s=p);let h=Math.min(1,(p-s)/a);if(t[e]=i(h)*(r-l)+l,h>=1){requestAnimationFrame(()=>{o(null)});return}requestAnimationFrame(f)};return l===r?(o(new Error("Element already at target position")),d):(requestAnimationFrame(f),d)}var rK=S(ie(),1);var B1t=S(R(),1),M0n={width:99,height:99,position:"absolute",top:-9999,overflow:"scroll"};function lLe(e){let{onChange:t,...r}=e,n=rK.useRef(),o=rK.useRef(null),i=()=>{n.current=o.current.offsetHeight-o.current.clientHeight};return py(()=>{let a=gk(()=>{let l=n.current;i(),l!==n.current&&t(n.current)}),s=Ih(o.current);return s.addEventListener("resize",a),()=>{a.clear(),s.removeEventListener("resize",a)}},[t]),rK.useEffect(()=>{i(),t(n.current)},[t]),(0,B1t.jsx)("div",{style:M0n,...r,ref:o})}var z1t=S(ie(),1);function $1t(e){return Tt("MuiTabScrollButton",e)}var N0n=Ct("MuiTabScrollButton",["root","vertical","horizontal","disabled"]),F1t=N0n;var Lce=S(R(),1),O0n=e=>{let{classes:t,orientation:r,disabled:n}=e;return wt({root:["root",r,n&&"disabled"]},$1t,t)},B0n=nt(nr,{name:"MuiTabScrollButton",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,r.orientation&&t[r.orientation]]}})({width:40,flexShrink:0,opacity:.8,[`&.${F1t.disabled}`]:{opacity:0},variants:[{props:{orientation:"vertical"},style:{width:"100%",height:40,"& svg":{transform:"var(--TabScrollButton-svgRotate)"}}}]}),$0n=z1t.forwardRef(function(t,r){let n=_t({props:t,name:"MuiTabScrollButton"}),{className:o,slots:i={},slotProps:a={},direction:s,orientation:l,disabled:u,...d}=n,{nativeButton:f,...p}=d,h=Sd(),m={isRtl:h,...n},g=O0n(m),y=i.StartScrollButtonIcon??kce,v=i.EndScrollButtonIcon??_ce,b=by({elementType:y,externalSlotProps:a.startScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:m}),x=by({elementType:v,externalSlotProps:a.endScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:m});return(0,Lce.jsx)(B0n,{component:"div",className:gt(g.root,o),ref:r,role:null,ownerState:m,tabIndex:null,...p,style:{...p.style,...l==="vertical"&&{"--TabScrollButton-svgRotate":`rotate(${h?-90:90}deg)`}},children:s==="left"?(0,Lce.jsx)(y,{...b}):(0,Lce.jsx)(v,{...x})})}),cLe=$0n;function H1t(e){return Tt("MuiTabs",e)}var F0n=Ct("MuiTabs",["root","vertical","list","centered","scroller","fixed","scrollableX","scrollableY","hideScrollbar","scrollButtons","scrollButtonsHideMobile","indicator"]),Ice=F0n;var g1=S(R(),1),z0n=e=>{let{vertical:t,fixed:r,hideScrollbar:n,scrollableX:o,scrollableY:i,centered:a,scrollButtonsHideMobile:s,classes:l}=e;return wt({root:["root",t&&"vertical"],scroller:["scroller",r&&"fixed",n&&"hideScrollbar",o&&"scrollableX",i&&"scrollableY"],list:["list",t&&"vertical",a&&"centered"],indicator:["indicator"],scrollButtons:["scrollButtons",s&&"scrollButtonsHideMobile"],scrollableX:[o&&"scrollableX"],hideScrollbar:[n&&"hideScrollbar"]},H1t,l)},H0n=nt("div",{name:"MuiTabs",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[{[`& .${Ice.scrollButtons}`]:t.scrollButtons},{[`& .${Ice.scrollButtons}`]:r.scrollButtonsHideMobile&&t.scrollButtonsHideMobile},t.root,r.vertical&&t.vertical]}})(Dt(({theme:e})=>({overflow:"hidden",minHeight:48,WebkitOverflowScrolling:"touch",display:"flex",variants:[{props:({ownerState:t})=>t.vertical,style:{flexDirection:"column"}},{props:({ownerState:t})=>t.scrollButtonsHideMobile,style:{[`& .${Ice.scrollButtons}`]:{[e.breakpoints.down("sm")]:{display:"none"}}}}]}))),U0n=nt("div",{name:"MuiTabs",slot:"Scroller",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.scroller,r.fixed&&t.fixed,r.hideScrollbar&&t.hideScrollbar,r.scrollableX&&t.scrollableX,r.scrollableY&&t.scrollableY]}})({position:"relative",display:"inline-block",flex:"1 1 auto",whiteSpace:"nowrap",variants:[{props:({ownerState:e})=>e.fixed,style:{overflowX:"hidden",width:"100%"}},{props:({ownerState:e})=>e.hideScrollbar,style:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}},{props:({ownerState:e})=>e.scrollableX,style:{overflowX:"auto",overflowY:"hidden"}},{props:({ownerState:e})=>e.scrollableY,style:{overflowY:"auto",overflowX:"hidden"}}]}),V0n=nt("div",{name:"MuiTabs",slot:"List",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.list,r.centered&&t.centered]}})({display:"flex",variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:"column"}},{props:({ownerState:e})=>e.centered,style:{justifyContent:"center"}}]}),W0n=nt("span",{name:"MuiTabs",slot:"Indicator"})(Dt(({theme:e})=>({position:"absolute",height:2,bottom:0,width:"100%",transition:e.transitions.create(),variants:[{props:{indicatorColor:"primary"},style:{backgroundColor:(e.vars||e).palette.primary.main}},{props:{indicatorColor:"secondary"},style:{backgroundColor:(e.vars||e).palette.secondary.main}},{props:({ownerState:t})=>t.vertical,style:{height:"100%",width:2,right:0}}]}))),G0n=nt(lLe)({overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}),U1t={};var q0n=Vi.forwardRef(function(t,r){let n=_t({props:t,name:"MuiTabs"}),o=Cn(),i=Sd(),{"aria-label":a,"aria-labelledby":s,action:l,centered:u=!1,children:d,className:f,component:p="div",allowScrollButtonsMobile:h=!1,indicatorColor:m="primary",onChange:g,orientation:y="horizontal",scrollButtons:v="auto",selectionFollowsFocus:b,slots:x={},slotProps:w={},textColor:C="primary",value:k,variant:_="standard",visibleScrollbar:E=!1,...D}=n,N=_==="scrollable",$=y==="vertical",P=$?"scrollTop":"scrollLeft",A=$?"top":"left",L=$?"bottom":"right",I=$?"clientHeight":"clientWidth",M=$?"height":"width",F={...n,component:p,allowScrollButtonsMobile:h,indicatorColor:m,orientation:y,vertical:$,scrollButtons:v,textColor:C,variant:_,visibleScrollbar:E,fixed:!N,hideScrollbar:N&&!E,scrollableX:N&&!$,scrollableY:N&&$,centered:u&&!N,scrollButtonsHideMobile:!h},O=z0n(F),z=by({elementType:x.startScrollButtonIcon,externalSlotProps:w.startScrollButtonIcon,ownerState:F}),H=by({elementType:x.endScrollButtonIcon,externalSlotProps:w.endScrollButtonIcon,ownerState:F}),[V,U]=Vi.useState(!1),[q,Y]=Vi.useState(U1t),[Z,ee]=Vi.useState(!1),[K,ce]=Vi.useState(!1),[ne,ge]=Vi.useState(!1),he=k===!1?null:k,[me,Ce]=Vi.useState(!1),[Se,We]=Vi.useState({overflow:"hidden",scrollbarWidth:0}),je=new Map,Ye=Vi.useRef(null),be=Vi.useRef(null),Pe={slots:x,slotProps:w},Me=()=>{let yt=Ye.current,Re;if(yt){let Ue=yt.getBoundingClientRect();Re={clientWidth:yt.clientWidth,scrollLeft:yt.scrollLeft,scrollTop:yt.scrollTop,scrollWidth:yt.scrollWidth,top:Ue.top,bottom:Ue.bottom,left:Ue.left,right:Ue.right}}let se;if(yt&&k!==!1){let Ue=be.current.children;if(Ue.length>0){let et=Ue[je.get(k)];se=et?et.getBoundingClientRect():null}}return{tabsMeta:Re,tabMeta:se}},He=uf(()=>{let{tabsMeta:yt,tabMeta:Re}=Me(),se=0,Ue;$?(Ue="top",Re&&yt&&(se=Re.top-yt.top+yt.scrollTop)):(Ue=i?"right":"left",Re&&yt&&(se=(i?-1:1)*(Re[Ue]-yt[Ue]+yt.scrollLeft)));let et={[Ue]:se,[M]:Re?Re[M]:0};if(typeof q[Ue]!="number"||typeof q[M]!="number")Y(et);else{let Xe=Math.abs(q[Ue]-et[Ue]),vt=Math.abs(q[M]-et[M]);(Xe>=1||vt>=1)&&Y(et)}}),le=(yt,{animation:Re=!0}={})=>{Re?sLe(P,Ye.current,yt,{duration:o.transitions.duration.standard}):Ye.current[P]=yt},fe=yt=>{let Re=Ye.current[P];$?Re+=yt:Re+=yt*(i?-1:1),le(Re)},ye=()=>{let yt=Ye.current[I],Re=0,se=Array.from(be.current.children);for(let Ue=0;Ue<se.length;Ue+=1){let et=se[Ue];if(Re+et[I]>yt){Ue===0&&(Re=yt);break}Re+=et[I]}return Re},ve=()=>{fe(-1*ye())},ke=()=>{fe(ye())},[de,{onChange:G,...J}]=sr("scrollbar",{className:gt(O.scrollableX,O.hideScrollbar),elementType:G0n,shouldForwardComponentProp:!0,externalForwardedProps:Pe,ownerState:F}),ae=Vi.useCallback(yt=>{G?.(yt),We({overflow:null,scrollbarWidth:yt})},[G]),[j,ue]=sr("scrollButtons",{className:O.scrollButtons,elementType:cLe,externalForwardedProps:Pe,ownerState:F,additionalProps:{orientation:y,slots:{StartScrollButtonIcon:x.startScrollButtonIcon,EndScrollButtonIcon:x.endScrollButtonIcon},slotProps:{startScrollButtonIcon:z,endScrollButtonIcon:H}}}),re=()=>{let yt={};yt.scrollbarSizeListener=N?(0,g1.jsx)(de,{...J,onChange:ae}):null;let se=N&&(v==="auto"&&(Z||K)||v===!0);return yt.scrollButtonStart=se?(0,g1.jsx)(j,{direction:i?"right":"left",onClick:ve,disabled:!Z,...ue}):null,yt.scrollButtonEnd=se?(0,g1.jsx)(j,{direction:i?"left":"right",onClick:ke,disabled:!K,...ue}):null,yt},X=uf(yt=>{let{tabsMeta:Re,tabMeta:se}=Me();if(!(!se||!Re)){if(se[A]<Re[A]){let Ue=Re[P]+(se[A]-Re[A]);le(Ue,{animation:yt})}else if(se[L]>Re[L]){let Ue=Re[P]+(se[L]-Re[L]);le(Ue,{animation:yt})}}}),Q=uf(()=>{N&&v!==!1&&ge(!ne)});Vi.useEffect(()=>{let yt=gk(()=>{Ye.current&&He()}),Re,se=Xe=>{Xe.forEach(vt=>{vt.removedNodes.forEach(Ft=>{Re?.unobserve(Ft)}),vt.addedNodes.forEach(Ft=>{Re?.observe(Ft)})}),yt(),Q()},Ue=Ih(Ye.current);Ue.addEventListener("resize",yt);let et;return typeof ResizeObserver<"u"&&(Re=new ResizeObserver(yt),Array.from(be.current.children).forEach(Xe=>{Re.observe(Xe)})),typeof MutationObserver<"u"&&(et=new MutationObserver(se),et.observe(be.current,{childList:!0})),()=>{yt.clear(),Ue.removeEventListener("resize",yt),et?.disconnect(),Re?.disconnect()}},[He,Q]),Vi.useEffect(()=>{let yt=Array.from(be.current.children),Re=yt.length;if(typeof IntersectionObserver<"u"&&Re>0&&N&&v!==!1){let se=yt[0],Ue=yt[Re-1],et={root:Ye.current,threshold:.99},Xe=Qe=>{ee(!Qe[0].isIntersecting)},vt=new IntersectionObserver(Xe,et);vt.observe(se);let Ft=Qe=>{ce(!Qe[0].isIntersecting)},Fe=new IntersectionObserver(Ft,et);return Fe.observe(Ue),()=>{vt.disconnect(),Fe.disconnect()}}},[N,v,ne,d?.length]),Vi.useEffect(()=>{U(!0)},[]),Vi.useEffect(()=>{He()}),Vi.useEffect(()=>{X(U1t!==q)},[X,q]),Vi.useImperativeHandle(l,()=>({updateIndicator:He,updateScrollButtons:Q}),[He,Q]);let[$e,we]=sr("indicator",{className:O.indicator,elementType:W0n,externalForwardedProps:Pe,ownerState:F,additionalProps:{style:q}}),Ie=(0,g1.jsx)($e,{...we}),De=zY({activeItemId:me?void 0:he,orientation:y,isRtl:i}),Oe=De.getContainerProps(),Ge=Vi.Children.toArray(d).filter(Vi.isValidElement).map((yt,Re)=>{let se=yt.props.value===void 0?Re:yt.props.value;return je.set(se,Re),{child:yt,index:Re,childValue:se}}).map(({child:yt,childValue:Re})=>{let se=Re===k;return Vi.cloneElement(yt,{fullWidth:_==="fullWidth",indicator:se&&!V&&Ie,selected:se,selectionFollowsFocus:b,onChange:g,textColor:C,value:Re})}),Be=re(),[tt,Ee]=sr("root",{ref:r,className:gt(O.root,f),elementType:H0n,externalForwardedProps:{...Pe,...D,component:p},ownerState:F}),[Rt,qe]=sr("scroller",{ref:Ye,className:O.scroller,elementType:U0n,externalForwardedProps:Pe,ownerState:F,additionalProps:{style:{overflow:Se.overflow,[$?`margin${i?"Left":"Right"}`:"marginBottom"]:E?void 0:-Se.scrollbarWidth}}}),Lt=Ii(Oe.ref,be),Zt=yt=>{let Re=be.current;c1(u1(Re))?.getAttribute("role")==="tab"&&Oe.onKeyDown(yt)},[fr,Nt]=sr("list",{ref:Lt,className:O.list,elementType:V0n,externalForwardedProps:Pe,ownerState:F,getSlotProps:yt=>({...yt,onBlur:Re=>{Re.currentTarget.contains(Re.relatedTarget)||Ce(!1),yt.onBlur?.(Re)},onKeyDown:Re=>{Zt(Re),yt.onKeyDown?.(Re)},onFocus:Re=>{Ce(!0),Oe.onFocus(Re),yt.onFocus?.(Re)}})});return(0,g1.jsxs)(tt,{...Ee,children:[Be.scrollButtonStart,Be.scrollbarSizeListener,(0,g1.jsxs)(Rt,{...qe,children:[(0,g1.jsx)(fr,{"aria-label":a,"aria-labelledby":s,"aria-orientation":y==="vertical"?"vertical":null,role:"tablist",...Nt,children:(0,g1.jsx)(d7.Provider,{value:De,children:Ge})}),V&&Ie]}),Be.scrollButtonEnd]})}),vP=q0n;var W1t=S(ie(),1);function V1t(e){return Tt("MuiTextField",e)}var AEi=Ct("MuiTextField",["root"]);var bP=S(R(),1),j0n={standard:OY,filled:MY,outlined:YY},Y0n=e=>{let{classes:t}=e;return wt({root:["root"]},V1t,t)},K0n=nt(b6e,{name:"MuiTextField",slot:"Root"})({}),X0n=W1t.forwardRef(function(t,r){let n=_t({props:t,name:"MuiTextField"}),{autoComplete:o,autoFocus:i=!1,children:a,className:s,color:l="primary",defaultValue:u,disabled:d=!1,error:f=!1,fullWidth:p=!1,helperText:h,id:m,inputRef:g,label:y,maxRows:v,minRows:b,multiline:x=!1,name:w,onBlur:C,onChange:k,onFocus:_,placeholder:E,required:D=!1,rows:N,select:$=!1,slots:P={},slotProps:A={},type:L,value:I,variant:M="outlined",...F}=n,O={...n,autoFocus:i,color:l,disabled:d,error:f,fullWidth:p,multiline:x,required:D,select:$,variant:M},z=Y0n(O),H=Lh(m),V=h&&H?`${H}-helper-text`:void 0,U=y&&H?`${H}-label`:void 0,q=j0n[M],Y={slots:P,slotProps:A},[Z,ee]=sr("select",{elementType:Nk,externalForwardedProps:Y,ownerState:O}),K=$&&ee.native,ce={},ne=Y.slotProps.inputLabel;M==="outlined"&&(ne&&typeof ne.shrink<"u"&&(ce.notched=ne.shrink),ce.label=y),$&&(K||(ce.id=void 0),ce["aria-describedby"]=void 0);let[ge,he]=sr("root",{elementType:K0n,shouldForwardComponentProp:!0,externalForwardedProps:{...Y,...F},ownerState:O,className:gt(z.root,s),ref:r,additionalProps:{disabled:d,error:f,fullWidth:p,required:D,color:l,variant:M}}),[me,Ce]=sr("input",{elementType:q,externalForwardedProps:Y,additionalProps:ce,ownerState:O}),[Se,We]=sr("inputLabel",{elementType:P6e,externalForwardedProps:Y,ownerState:O}),[je,Ye]=sr("htmlInput",{elementType:"input",externalForwardedProps:Y,ownerState:O}),[be,Pe]=sr("formHelperText",{elementType:w6e,externalForwardedProps:Y,ownerState:O}),Me=(0,bP.jsx)(me,{"aria-describedby":V,autoComplete:o,autoFocus:i,defaultValue:u,fullWidth:p,multiline:x,name:w,rows:N,maxRows:v,minRows:b,type:L,value:I,id:H,inputRef:g,onBlur:C,onChange:k,onFocus:_,placeholder:E,inputProps:Ye,slots:{input:P.htmlInput?je:void 0},...Ce});return(0,bP.jsxs)(ge,{...he,children:[y!=null&&y!==""&&(0,bP.jsx)(Se,{htmlFor:$&&!K?void 0:H,id:U,...$&&!K&&{component:"div"},...We,children:y}),$?(0,bP.jsx)(Z,{"aria-describedby":V,id:H,labelId:U,value:I,input:Me,...ee,children:a}):Me,h&&(0,bP.jsx)(be,{id:V,...Pe,children:h})]})}),xn=X0n;var nK=S(ie(),1);function G1t(e){return Tt("MuiToggleButton",e)}var Z0n=Ct("MuiToggleButton",["root","disabled","selected","standard","primary","secondary","sizeSmall","sizeMedium","sizeLarge","fullWidth"]),lS=Z0n;var q1t=S(ie(),1),Q0n=q1t.createContext({}),Dce=Q0n;var j1t=S(ie(),1),J0n=j1t.createContext(void 0),Mce=J0n;function uLe(e,t){return t===void 0||e===void 0?!1:Array.isArray(t)?t.includes(e):e===t}var Y1t=S(R(),1),eyn=e=>{let{classes:t,fullWidth:r,selected:n,disabled:o,size:i,color:a}=e,s={root:["root",n&&"selected",o&&"disabled",r&&"fullWidth",`size${It(i)}`,a]};return wt(s,G1t,t)},tyn=nt(nr,{name:"MuiToggleButton",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,t[`size${It(r.size)}`]]}})(Dt(({theme:e})=>({...e.typography.button,borderRadius:(e.vars||e).shape.borderRadius,padding:11,border:`1px solid ${(e.vars||e).palette.divider}`,color:(e.vars||e).palette.action.active,[`&.${lS.disabled}`]:{color:(e.vars||e).palette.action.disabled,border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`},"&:hover":{textDecoration:"none",backgroundColor:e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[{props:{color:"standard"},style:{[`&.${lS.selected}`]:{color:(e.vars||e).palette.text.primary,backgroundColor:e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.text.primary,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.selectedOpacity)}}}}},...Object.entries(e.palette).filter(bn()).map(([t])=>({props:{color:t},style:{[`&.${lS.selected}`]:{color:(e.vars||e).palette[t].main,backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.selectedOpacity)}}}}})),{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{padding:7,fontSize:e.typography.pxToRem(13)}},{props:{size:"large"},style:{padding:15,fontSize:e.typography.pxToRem(15)}}]}))),ryn=nK.forwardRef(function(t,r){let{value:n,...o}=nK.useContext(Dce),i=nK.useContext(Mce),a=sg({...o,selected:uLe(t.value,n)},t),s=_t({props:a,name:"MuiToggleButton"}),{children:l,className:u,color:d="standard",disabled:f=!1,disableFocusRipple:p=!1,fullWidth:h=!1,onChange:m,onClick:g,selected:y,size:v="medium",value:b,...x}=s,w={...s,color:d,disabled:f,disableFocusRipple:p,fullWidth:h,size:v},C=eyn(w),k=E=>{g&&(g(E,b),E.defaultPrevented)||m&&m(E,b)},_=i||"";return(0,Y1t.jsx)(tyn,{className:gt(o.className,C.root,u,_),internalNativeButton:!0,disabled:f,focusRipple:!p,ref:r,onClick:k,onChange:m,value:b,ownerState:w,"aria-pressed":y,...x,children:l})}),Ts=ryn;var xP=S(ie(),1);function K1t(e){return Tt("MuiToggleButtonGroup",e)}var nyn=Ct("MuiToggleButtonGroup",["root","selected","horizontal","vertical","disabled","grouped","fullWidth","firstButton","lastButton","middleButton"]),Ba=nyn;var Nce=S(R(),1),oyn=e=>{let{classes:t,orientation:r,fullWidth:n,disabled:o}=e;return wt({root:["root",r,n&&"fullWidth"],grouped:["grouped",o&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]},K1t,t)},iyn=nt("div",{name:"MuiToggleButtonGroup",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[{[`& .${Ba.grouped}`]:t.grouped},{[`& .${Ba.firstButton}`]:t.firstButton},{[`& .${Ba.lastButton}`]:t.lastButton},{[`& .${Ba.middleButton}`]:t.middleButton},t.root,r.orientation==="vertical"&&t.vertical,r.fullWidth&&t.fullWidth]}})(Dt(({theme:e})=>({display:"inline-flex",borderRadius:(e.vars||e).shape.borderRadius,variants:[{props:{orientation:"vertical"},style:{flexDirection:"column",[`& .${Ba.grouped}`]:{[`&.${Ba.selected} + .${Ba.grouped}.${Ba.selected}`]:{borderTop:0,marginTop:0}},[`& .${Ba.firstButton},& .${Ba.middleButton}`]:{borderBottomLeftRadius:0,borderBottomRightRadius:0},[`& .${Ba.lastButton},& .${Ba.middleButton}`]:{marginTop:-1,borderTop:"1px solid transparent",borderTopLeftRadius:0,borderTopRightRadius:0},[`& .${Ba.lastButton}.${lS.disabled},& .${Ba.middleButton}.${lS.disabled}`]:{borderTop:"1px solid transparent"}}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{orientation:"horizontal"},style:{[`& .${Ba.grouped}`]:{[`&.${Ba.selected} + .${Ba.grouped}.${Ba.selected}`]:{borderLeft:0,marginLeft:0}},[`& .${Ba.firstButton},& .${Ba.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${Ba.lastButton},& .${Ba.middleButton}`]:{marginLeft:-1,borderLeft:"1px solid transparent",borderTopLeftRadius:0,borderBottomLeftRadius:0},[`& .${Ba.lastButton}.${lS.disabled},& .${Ba.middleButton}.${lS.disabled}`]:{borderLeft:"1px solid transparent"}}}]}))),ayn=xP.forwardRef(function(t,r){let n=_t({props:t,name:"MuiToggleButtonGroup"}),{children:o,className:i,color:a="standard",disabled:s=!1,exclusive:l=!1,fullWidth:u=!1,onChange:d,orientation:f="horizontal",size:p="medium",value:h,...m}=n,g={...n,disabled:s,fullWidth:u,orientation:f,size:p},y=oyn(g),v=xP.useCallback((_,E)=>{if(!d)return;let D=h&&h.indexOf(E),N;h&&D>=0?(N=h.slice(),N.splice(D,1)):N=h?h.concat(E):[E],d(_,N)},[d,h]),b=xP.useCallback((_,E)=>{d&&d(_,h===E?null:E)},[d,h]),x=xP.useMemo(()=>({className:y.grouped,onChange:l?b:v,value:h,size:p,fullWidth:u,color:a,disabled:s}),[y.grouped,l,b,v,h,p,u,a,s]),w=QN(o),C=w.length,k=_=>{let E=_===0,D=_===C-1;return E&&D?"":E?y.firstButton:D?y.lastButton:y.middleButton};return(0,Nce.jsx)(iyn,{role:"group",className:gt(y.root,i),ref:r,ownerState:g,...m,children:(0,Nce.jsx)(Dce.Provider,{value:x,children:w.map((_,E)=>(0,Nce.jsx)(Mce.Provider,{value:k(E),children:_},E))})})}),Gc=ayn;var syn=rAe({themeId:oc}),X1t=syn;var gin=S(ie(),1);var yin=S(wTt(),1);var _p=S(ie(),1),Fr=S(ie(),1),dn=S(ie(),1),vMe=S(ie(),1),jwt=S(ie(),1),Oo=S(ie(),1),Exn=S(ie(),1),Rxn=S(ie(),1),Pxn=S(ie(),1),fn=S(ie(),1),iCt=S(ie(),1),Vxn={};var ewt=e=>{throw TypeError(e)},twt=(e,t,r)=>t.has(e)||ewt("Cannot "+r),Rg=(e,t,r)=>(twt(e,t,"read from private field"),r?r.call(e):t.get(e)),aX=(e,t,r)=>t.has(e)?ewt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),C1=(e,t,r,n)=>(twt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Sde=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Tde=/^[\\/]{2}/;function rwt(e,t){return t+e.replace(/\\/g,"/")}var CTt="popstate";function kTt(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function nwt(e={}){function t(n,o){let i=o.state?.masked,{pathname:a,search:s,hash:l}=i||n.location;return cX("",{pathname:a,search:s,hash:l},o.state&&o.state.usr||null,o.state&&o.state.key||"default",i?{pathname:n.location.pathname,search:n.location.search,hash:n.location.hash}:void 0)}function r(n,o){return typeof o=="string"?o:Id(o)}return N1n(t,r,null,e)}function Wn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function os(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function M1n(){return Math.random().toString(36).substring(2,10)}function _Tt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function cX(e,t,r=null,n,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Lg(t):t,state:r,key:t&&t.key||n||M1n(),mask:o}}function Id({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Lg(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function N1n(e,t,r,n={}){let{window:o=document.defaultView,v5Compat:i=!1}=n,a=o.history,s="POP",l=null,u=d();u==null&&(u=0,a.replaceState({...a.state,idx:u},""));function d(){return(a.state||{idx:null}).idx}function f(){s="POP";let y=d(),v=y==null?null:y-u;u=y,l&&l({action:s,location:g.location,delta:v})}function p(y,v){s="PUSH";let b=kTt(y)?y:cX(g.location,y,v);r&&r(b,y),u=d()+1;let x=_Tt(b,u),w=g.createHref(b.mask||b);try{a.pushState(x,"",w)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;o.location.assign(w)}i&&l&&l({action:s,location:g.location,delta:1})}function h(y,v){s="REPLACE";let b=kTt(y)?y:cX(g.location,y,v);r&&r(b,y),u=d();let x=_Tt(b,u),w=g.createHref(b.mask||b);a.replaceState(x,"",w),i&&l&&l({action:s,location:g.location,delta:0})}function m(y){return owt(o,y)}let g={get action(){return s},get location(){return e(o,a)},listen(y){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(CTt,f),l=y,()=>{o.removeEventListener(CTt,f),l=null}},createHref(y){return t(o,y)},createURL:m,encodeLocation(y){let v=m(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:h,go(y){return a.go(y)}};return g}function owt(e,t,r=!1){let n="http://localhost";e&&(n=e.location.origin!=="null"?e.location.origin:e.location.href),Wn(n,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:Id(t);return o=o.replace(/ $/,"%20"),!r&&Tde.test(o)&&(o=n+o),new URL(o,n)}var sX,YDe=class{constructor(e){if(aX(this,sX,new Map),e)for(let[t,r]of e)this.set(t,r)}get(e){if(Rg(this,sX).has(e))return Rg(this,sX).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){Rg(this,sX).set(e,t)}};sX=new WeakMap;var O1n=new Set(["lazy","caseSensitive","path","id","index","children"]);function B1n(e){return O1n.has(e)}var $1n=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function F1n(e){return $1n.has(e)}function z1n(e){return e.index===!0}function uX(e,t,r=[],n={},o=!1){return e.map((i,a)=>{let s=[...r,String(a)],l=typeof i.id=="string"?i.id:s.join("-");if(Wn(i.index!==!0||!i.children,"Cannot specify children on an index route"),Wn(o||!n[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),z1n(i)){let u={...i,id:l};return n[l]=ETt(u,t(u)),u}else{let u={...i,id:l,children:void 0};return n[l]=ETt(u,t(u)),i.children&&(u.children=uX(i.children,t,s,n,o)),u}})}function ETt(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function tMe(e,t,r="/"){return Ly(e,t,r,!1)}function Ly(e,t,r,n,o){let i=typeof t=="string"?Lg(t):t,a=vf(i.pathname||"/",r);if(a==null)return null;let s=o??hde(e),l=null,u=uwt(a);for(let d=0;l==null&&d<s.length;++d)l=X1n(s[d],u,n);return l}function iwt(e,t){let{route:r,pathname:n,params:o}=e;return{id:r.id,pathname:n,params:o,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function hde(e){let t=awt(e);return H1n(t),t}function awt(e,t=[],r=[],n="",o=!1){let i=(a,s,l=o,u)=>{let d={relativePath:u===void 0?a.path||"":u,caseSensitive:a.caseSensitive===!0,childrenIndex:s,route:a};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(n)&&l)return;Wn(d.relativePath.startsWith(n),`Absolute route path "${d.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(n.length)}let f=Ag([n,d.relativePath]),p=r.concat(d);a.children&&a.children.length>0&&(Wn(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),awt(a.children,t,p,f,l)),!(a.path==null&&!a.index)&&t.push({path:f,score:Y1n(f,a.index),routesMeta:p.map((h,m)=>{let[g,y]=cwt(h.relativePath,h.caseSensitive,m===p.length-1);return{...h,matcher:g,compiledParams:y}})})};return e.forEach((a,s)=>{if(a.path===""||!a.path?.includes("?"))i(a,s);else for(let l of swt(a.path))i(a,s,!0,l)}),t}function swt(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,o=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return o?[i,""]:[i];let a=swt(n.join("/")),s=[];return s.push(...a.map(l=>l===""?i:[i,l].join("/"))),o&&s.push(...a),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function H1n(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:K1n(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var U1n=/^:[\w-]+$/,V1n=3,W1n=2,G1n=1,q1n=10,j1n=-2,RTt=e=>e==="*";function Y1n(e,t){let r=e.split("/"),n=r.length;return r.some(RTt)&&(n+=j1n),t&&(n+=W1n),r.filter(o=>!RTt(o)).reduce((o,i)=>o+(U1n.test(i)?V1n:i===""?G1n:q1n),n)}function K1n(e,t){return e.length===t.length&&e.slice(0,-1).every((n,o)=>n===t[o])?e[e.length-1]-t[t.length-1]:0}function X1n(e,t,r=!1){let{routesMeta:n}=e,o={},i="/",a=[];for(let s=0;s<n.length;++s){let l=n[s],u=s===n.length-1,d=i==="/"?t:t.slice(i.length)||"/",f={path:l.relativePath,caseSensitive:l.caseSensitive,end:u},p=l.matcher&&l.compiledParams?lwt(f,d,l.matcher,l.compiledParams):y8(f,d),h=l.route;if(!p&&u&&r&&!n[n.length-1].route.index&&(p=y8({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!p)return null;Object.assign(o,p.params),a.push({params:o,pathname:Ag([i,p.pathname]),pathnameBase:Q1n(Ag([i,p.pathnameBase])),route:h}),p.pathnameBase!=="/"&&(i=Ag([i,p.pathnameBase]))}return a}function y8(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=cwt(e.path,e.caseSensitive,e.end);return lwt(e,t,r,n)}function lwt(e,t,r,n){let o=t.match(r);if(!o)return null;let i=o[0],a=v8(i,1),s=o.slice(1);return{params:n.reduce((u,{paramName:d,isOptional:f},p)=>{if(d==="*"){let m=s[p]||"";a=v8(i.slice(0,i.length-m.length),1)}let h=s[p];return f&&!h?u[d]=void 0:u[d]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:a,pattern:e}}function cwt(e,t=!1,r=!0){os(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,s,l,u,d)=>{if(n.push({paramName:s,isOptional:l!=null}),l){let f=d.charAt(u+a.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}function uwt(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return os(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function vf(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}function Z1n({basename:e,pathname:t}){return t==="/"?e:Ag([e,t])}var rMe=e=>Sde.test(e);function dwt(e,t="/"){let{pathname:r,search:n="",hash:o=""}=typeof e=="string"?Lg(e):e,i;return r?(r=nMe(r),r.startsWith("/")||r.startsWith("\\")?i=PTt(r.substring(1),"/"):i=PTt(r,t)):i=t,{pathname:i,search:J1n(n),hash:ebn(o)}}function PTt(e,t){let r=v8(t).split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function VDe(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function fwt(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function wde(e){let t=fwt(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}function dX(e,t,r,n=!1){let o;typeof e=="string"?o=Lg(e):(o={...e},Wn(!o.pathname||!o.pathname.includes("?"),VDe("?","pathname","search",o)),Wn(!o.pathname||!o.pathname.includes("#"),VDe("#","pathname","hash",o)),Wn(!o.search||!o.search.includes("#"),VDe("#","search","hash",o)));let i=e===""||o.pathname==="",a=i?"/":o.pathname,s;if(a==null)s=r;else{let f=t.length-1;if(!n&&a.startsWith("..")){let p=a.split("/");for(;p[0]==="..";)p.shift(),f-=1;o.pathname=p.join("/")}s=f>=0?t[f]:"/"}let l=dwt(o,s),u=a&&a!=="/"&&a.endsWith("/"),d=(i||a===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}var nMe=e=>e.replace(/[\\/]{2,}/g,"/"),Ag=e=>nMe(e.join("/"));function v8(e,t=0){let r=e.length;for(;r>t&&e.charCodeAt(r-1)===47;)r--;return r===e.length?e:e.slice(0,r)}var Q1n=e=>v8(e).replace(/^\/*/,"/"),J1n=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ebn=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var tbn=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],x8=class{constructor(e,t,r,n=!1){this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function b8(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function fX(e){let t=e.map(r=>r.route.path).filter(Boolean);return Ag(t)||"/"}var pwt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function hwt(e,t){let r=e;if(typeof r!="string"||!Sde.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,o=!1;if(pwt)try{let i=new URL(window.location.href),a=Tde.test(r)?new URL(rwt(r,i.protocol)):new URL(r),s=vf(a.pathname,t);a.origin===i.origin&&s!=null?r=s+a.search+a.hash:o=!0}catch{os(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:o,to:r}}var p_=Symbol("Uninstrumented");function rbn(e,t){let r={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(o=>o({id:t.id,index:t.index,path:t.path,instrument(i){let a=Object.keys(r);for(let s of a)i[s]&&r[s].push(i[s])}}));let n={};if(typeof t.lazy=="function"&&r.lazy.length>0){let o=p8(r.lazy,t.lazy,()=>{});o&&(n.lazy=o)}if(typeof t.lazy=="object"){let o=t.lazy;["middleware","loader","action"].forEach(i=>{let a=o[i],s=r[`lazy.${i}`];if(typeof a=="function"&&s.length>0){let l=p8(s,a,()=>{});l&&(n.lazy=Object.assign(n.lazy||{},{[i]:l}))}})}return["loader","action"].forEach(o=>{let i=t[o];if(typeof i=="function"&&r[o].length>0){let a=i[p_]??i,s=p8(r[o],a,(...l)=>ATt(l[0]));s&&(o==="loader"&&a.hydrate===!0&&(s.hydrate=!0),s[p_]=a,n[o]=s)}}),t.middleware&&t.middleware.length>0&&r.middleware.length>0&&(n.middleware=t.middleware.map(o=>{let i=o[p_]??o,a=p8(r.middleware,i,(...s)=>ATt(s[0]));return a?(a[p_]=i,a):o})),n}function nbn(e,t){let r={navigate:[],fetch:[]};if(t.forEach(n=>n({instrument(o){let i=Object.keys(o);for(let a of i)o[a]&&r[a].push(o[a])}})),r.navigate.length>0){let n=e.navigate[p_]??e.navigate,o=p8(r.navigate,n,(...i)=>{let[a,s]=i;return{to:typeof a=="number"||typeof a=="string"?a:a?Id(a):".",...LTt(e,s??{})}});o&&(o[p_]=n,e.navigate=o)}if(r.fetch.length>0){let n=e.fetch[p_]??e.fetch,o=p8(r.fetch,n,(...i)=>{let[a,,s,l]=i;return{href:s??".",fetcherKey:a,...LTt(e,l??{})}});o&&(o[p_]=n,e.fetch=o)}return e}function p8(e,t,r){return e.length===0?null:async(...n)=>{let o=await mwt(e,r(...n),()=>t(...n),e.length-1);if(o.type==="error")throw o.value;return o.value}}async function mwt(e,t,r,n){let o=e[n],i;if(o){let a,s=async()=>(a?console.error("You cannot call instrumented handlers more than once"):a=mwt(e,t,r,n-1),i=await a,Wn(i,"Expected a result"),i.type==="error"&&i.value instanceof Error?{status:"error",error:i.value}:{status:"success",error:void 0});try{await o(s,t)}catch(l){console.error("An instrumentation function threw an error:",l)}a||await s(),await a}else try{i={type:"success",value:await r()}}catch(a){i={type:"error",value:a}}return i||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function ATt(e){let{request:t,context:r,params:n,pattern:o}=e;return{request:obn(t),params:{...n},pattern:o,context:ibn(r)}}function LTt(e,t){return{currentUrl:Id(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function obn(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function ibn(e){if(sbn(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var abn=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function sbn(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===abn}var ITt=new URL("http://localhost");function oMe(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),ITt)}catch{return ITt}}function WDe(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function lbn(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return e.toLowerCase().startsWith(r)?t.host===""||e.slice(r.length).startsWith("//"):!1}function h8(e,t,r,n){let o=null;try{o=e==null?null:new URL(e,r)}catch{}let i=new URL(t,r),a=o!=null&&!WDe(o,r),s=!WDe(i,r);if(n==="reject"){if(a||s)throw new Error("External navigation is not allowed")}else if(s&&(o==null||!lbn(e,o)||!WDe(o,i)))throw new Error("External navigation is not allowed")}var gwt=["POST","PUT","PATCH","DELETE"],cbn=new Set(gwt),ubn=["GET",...gwt],dbn=new Set(ubn),ywt=new Set([301,302,303,307,308]),fbn=new Set([307,308]),mde={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},vwt={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},UP={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},pbn=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),bwt="remix-router-transitions",xwt=Symbol("ResetLoaderData"),HP,u8,d_,d8,hbn=class{constructor(e){aX(this,HP),aX(this,u8),aX(this,d_),aX(this,d8),C1(this,HP,e),C1(this,u8,hde(e))}get stableRoutes(){return Rg(this,HP)}get activeRoutes(){return Rg(this,d_)??Rg(this,HP)}get branches(){return Rg(this,d8)??Rg(this,u8)}get hasHMRRoutes(){return Rg(this,d_)!=null}setRoutes(e){C1(this,HP,e),C1(this,u8,hde(e))}setHmrRoutes(e){C1(this,d_,e),C1(this,d8,hde(e))}commitHmrRoutes(){Rg(this,d_)&&(C1(this,HP,Rg(this,d_)),C1(this,u8,Rg(this,d8)),C1(this,d_,void 0),C1(this,d8,void 0))}};HP=new WeakMap;u8=new WeakMap;d_=new WeakMap;d8=new WeakMap;function Swt(e){let t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";Wn(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let n=e.hydrationRouteProperties||[],o=e.mapRouteProperties||pbn,i=o;if(e.instrumentations){let Re=e.instrumentations;i=se=>({...o(se),...rbn(Re.map(Ue=>Ue.route).filter(Boolean),se)})}let a={},s=new hbn(uX(e.routes,i,void 0,a)),l=e.basename||"/";l.startsWith("/")||(l=`/${l}`);let u=e.dataStrategy||bbn,d={...e.future},f=null,p=new Set,h=null,m=null,g=null,y=null,v=e.hydrationData!=null,b=Ly(s.activeRoutes,e.history.location,l,!1,s.branches),x=!1,w=null,C,k;if(b==null&&!e.patchRoutesOnNavigation){let Re=Pg(404,{pathname:e.history.location.pathname}),{matches:se,route:Ue}=ude(s.activeRoutes);C=!0,k=!C,b=se,w={[Ue.id]:Re}}else if(b&&!e.hydrationData&&Lt(b,s.activeRoutes,e.history.location.pathname).active&&(b=null),b)if(b.some(Re=>Re.route.lazy))C=!1,k=!C;else if(!b.some(Re=>iMe(Re.route)))C=!0,k=!C;else{let Re=e.hydrationData?e.hydrationData.loaderData:null,se=e.hydrationData?e.hydrationData.errors:null,Ue=b;if(se){let et=b.findIndex(Xe=>se[Xe.route.id]!==void 0);Ue=Ue.slice(0,et+1)}k=!1,C=!0,Ue.forEach(et=>{let Xe=Twt(et.route,Re,se);k=k||Xe.renderFallback,C=C&&!Xe.shouldLoad})}else{C=!1,k=!C,b=[];let Re=Lt(null,s.activeRoutes,e.history.location.pathname);Re.active&&Re.matches&&(x=!0,b=Re.matches)}let _,E={historyAction:e.history.action,location:e.history.location,matches:b,initialized:C,renderFallback:k,navigation:mde,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||w,fetchers:new Map,blockers:new Map},D="POP",N=null,$=!1,P,A=!1,L=new Map,I=null,M=!1,F=!1,O=new Set,z=new Map,H=0,V=-1,U=new Map,q=new Set,Y=new Map,Z=new Map,ee=new Set,K=new Map,ce,ne=null;function ge(){if(f=e.history.listen(({action:Re,location:se,delta:Ue})=>{if(ce){ce(),ce=void 0;return}os(K.size===0||Ue!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let et=Ge({currentLocation:E.location,nextLocation:se,historyAction:Re});if(et&&Ue!=null){let Xe=new Promise(vt=>{ce=vt});e.history.go(Ue*-1),Le(et,{state:"blocked",location:se,proceed(){Le(et,{state:"proceeding",proceed:void 0,reset:void 0,location:se}),Xe.then(()=>e.history.go(Ue))},reset(){let vt=new Map(E.blockers);vt.set(et,UP),Ce({blockers:vt})}}),N?.resolve(),N=null;return}return Ye(Re,se)}),r){$bn(t,L);let Re=()=>Fbn(t,L);t.addEventListener("pagehide",Re),I=()=>t.removeEventListener("pagehide",Re)}return E.initialized||Ye("POP",E.location,{initialHydration:!0}),_}function he(){f&&f(),I&&I(),p.clear(),P&&P.abort(),E.fetchers.forEach((Re,se)=>re(E.fetchers,se)),E.blockers.forEach((Re,se)=>Oe(se))}function me(Re){if(p.add(Re),h){let{newErrors:se}=h;h=null,Re(E,{deletedFetchers:[],newErrors:se,viewTransitionOpts:void 0,flushSync:!1})}return()=>p.delete(Re)}function Ce(Re,se={}){Re.matches&&(Re.matches=Re.matches.map(Xe=>{let vt=a[Xe.route.id],Ft=Xe.route;return Ft.element!==vt.element||Ft.errorElement!==vt.errorElement||Ft.hydrateFallbackElement!==vt.hydrateFallbackElement?{...Xe,route:vt}:Xe})),E={...E,...Re};let Ue=[],et=[];E.fetchers.forEach((Xe,vt)=>{Xe.state==="idle"&&(ee.has(vt)?Ue.push(vt):et.push(vt))}),ee.forEach(Xe=>{!E.fetchers.has(Xe)&&!z.has(Xe)&&Ue.push(Xe)}),p.size===0&&(h={newErrors:Re.errors??null}),[...p].forEach(Xe=>Xe(E,{deletedFetchers:Ue,newErrors:Re.errors??null,viewTransitionOpts:se.viewTransitionOpts,flushSync:se.flushSync===!0})),Ue.forEach(Xe=>re(E.fetchers,Xe)),et.forEach(Xe=>E.fetchers.delete(Xe))}function Se(Re,se,{flushSync:Ue}={}){let et=E.actionData!=null&&E.navigation.formMethod!=null&&Ld(E.navigation.formMethod)&&E.navigation.state==="loading"&&Re.state?._isRedirect!==!0,Xe;se.actionData?Object.keys(se.actionData).length>0?Xe=se.actionData:Xe=null:et?Xe=E.actionData:Xe=null;let vt=se.loaderData?UTt(E.loaderData,se.loaderData,se.matches||[],se.errors):E.loaderData,Ft=E.blockers;Ft.size>0&&(Ft=new Map(Ft),Ft.forEach((ht,Ht)=>Ft.set(Ht,UP)));let Fe=M?!1:qe(Re,se.matches||E.matches),Qe=$===!0||E.navigation.formMethod!=null&&Ld(E.navigation.formMethod)&&Re.state?._isRedirect!==!0;s.commitHmrRoutes(),M||D==="POP"||(D==="PUSH"?e.history.push(Re,Re.state):D==="REPLACE"&&e.history.replace(Re,Re.state));let mt;if(D==="POP"&&!M&&Re!==E.location){let ht=L.get(E.location.pathname);ht&&ht.has(Re.pathname)?mt={currentLocation:E.location,nextLocation:Re}:L.has(Re.pathname)&&(mt={currentLocation:Re,nextLocation:E.location})}else if(A){let ht=L.get(E.location.pathname);ht?ht.add(Re.pathname):(ht=new Set([Re.pathname]),L.set(E.location.pathname,ht)),mt={currentLocation:E.location,nextLocation:Re}}Ce({...se,actionData:Xe,loaderData:vt,historyAction:D,location:Re,initialized:!0,renderFallback:!1,navigation:mde,revalidation:"idle",restoreScrollPosition:Fe,preventScrollReset:Qe,blockers:Ft},{viewTransitionOpts:mt,flushSync:Ue===!0}),D="POP",$=!1,A=!1,M=!1,F=!1,N?.resolve(),N=null,ne?.resolve(),ne=null}async function We(Re,se){if(N?.resolve(),N=null,typeof Re=="number"){N||(N=qTt());let Qt=N.promise;return e.history.go(Re),Qt}let Ue=KDe(E.location,E.matches,l,Re,se?.fromRouteId,se?.relative),{path:et,submission:Xe,error:vt}=DTt(!1,Ue,se),Ft;if(se?.mask){let Qt=typeof se.mask=="string"?Lg(se.mask):{...E.location.mask,...se.mask};if(Ft={pathname:Qt.pathname??"",search:Qt.search??"",hash:Qt.hash??""},Tde.test(Ft.pathname))throw new Error("External navigation is not allowed");Ft.pathname.startsWith("\\")&&(Ft.pathname=Ft.pathname.replace(/^\\+/,"/")),h8(typeof se.mask=="string"?se.mask:Id(se.mask),Id(Ft),e.history.createURL("/"),"reject")}let Fe=E.location,Qe=cX(Fe,et,se&&se.state,void 0,Ft);Qe={...Qe,...e.history.encodeLocation(Qe)},h8(Re==null?e.history.createHref(E.location):typeof Re=="string"?Re:Id(Re),e.history.createHref(Qe.mask||Qe),e.history.createURL("/"),"reject");let mt=se&&se.replace!=null?se.replace:void 0,ht="PUSH";mt===!0?ht="REPLACE":mt===!1||Xe!=null&&Ld(Xe.formMethod)&&Xe.formAction===E.location.pathname+E.location.search&&(ht="REPLACE");let Ht=se&&"preventScrollReset"in se?se.preventScrollReset===!0:void 0,or=(se&&se.flushSync)===!0,cr=Ge({currentLocation:Fe,nextLocation:Qe,historyAction:ht});if(cr){Le(cr,{state:"blocked",location:Qe,proceed(){Le(cr,{state:"proceeding",proceed:void 0,reset:void 0,location:Qe}),We(Re,se)},reset(){let Qt=new Map(E.blockers);Qt.set(cr,UP),Ce({blockers:Qt})}});return}await Ye(ht,Qe,{submission:Xe,pendingError:vt,preventScrollReset:Ht,replace:se&&se.replace,enableViewTransition:se&&se.viewTransition,flushSync:or,callSiteDefaultShouldRevalidate:se&&se.defaultShouldRevalidate})}function je(){ne||(ne=qTt()),G(),Ce({revalidation:"loading"});let Re=ne.promise;return E.navigation.state==="submitting"?Re:E.navigation.state==="idle"?(Ye(E.historyAction,E.location,{startUninterruptedRevalidation:!0}),Re):(Ye(D||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation,enableViewTransition:A===!0}),Re)}async function Ye(Re,se,Ue){P&&P.abort(),P=null,D=Re,M=(Ue&&Ue.startUninterruptedRevalidation)===!0,Rt(E.location,E.matches),$=(Ue&&Ue.preventScrollReset)===!0,A=(Ue&&Ue.enableViewTransition)===!0;let et=s.activeRoutes,Xe=Ue?.initialHydration&&E.matches&&E.matches.length>0&&!x?E.matches:Ly(et,se,l,!1,s.branches),vt=(Ue&&Ue.flushSync)===!0;if(Xe&&E.initialized&&!F&&Rbn(E.location,se)&&!(Ue&&Ue.submission&&Ld(Ue.submission.formMethod))){Se(se,{matches:Xe},{flushSync:vt});return}let Ft=Lt(Xe,et,se.pathname);if(Ft.active&&Ft.matches&&(Xe=Ft.matches),!Xe){let{error:at,notFoundMatches:ft,route:Mt}=Be(se.pathname);Se(se,{matches:ft,loaderData:{},errors:{[Mt.id]:at}},{flushSync:vt});return}let Fe=Ue&&Ue.overrideNavigation?{...Ue.overrideNavigation,matches:Xe,historyAction:Re}:void 0;P=new AbortController;let Qe=f8(e.history,se,P.signal,Ue&&Ue.submission),mt=e.getContext?await e.getContext():new YDe,ht;if(Ue&&Ue.pendingError)ht=[f_(Xe).route.id,{type:"error",error:Ue.pendingError}];else if(Ue&&Ue.submission&&Ld(Ue.submission.formMethod)){let at=await be(Qe,se,Ue.submission,Xe,Re,mt,Ft.active,Ue&&Ue.initialHydration===!0,{replace:Ue.replace,flushSync:vt});if(at.shortCircuited)return;if(at.pendingActionResult){let[ft,Mt]=at.pendingActionResult;if(Yh(Mt)&&b8(Mt.error)&&Mt.error.status===404){P=null,Se(se,{matches:at.matches,loaderData:{},errors:{[ft]:Mt.error}});return}}Xe=at.matches||Xe,ht=at.pendingActionResult,Fe=GDe(se,Xe,Re,Ue.submission),vt=!1,Ft.active=!1,Qe=f8(e.history,Qe.url,Qe.signal)}let{shortCircuited:Ht,matches:or,loaderData:cr,errors:Qt,workingFetchers:Tr}=await Pe(Qe,se,Xe,Re,mt,Ft.active,Fe,Ue&&Ue.submission,Ue&&Ue.fetcherSubmission,Ue&&Ue.replace,Ue&&Ue.initialHydration===!0,vt,ht,Ue&&Ue.callSiteDefaultShouldRevalidate);Ht||(P=null,Se(se,{matches:or||Xe,...VTt(ht),loaderData:cr,errors:Qt,...Tr?{fetchers:Tr}:{}}))}async function be(Re,se,Ue,et,Xe,vt,Ft,Fe,Qe={}){G();let mt=Obn(se,et,Xe,Ue);if(Ce({navigation:mt},{flushSync:Qe.flushSync===!0}),Ft){let or=await Zt(et,se.pathname,Re.signal);if(or.type==="aborted")return{shortCircuited:!0};if(or.type==="error"){if(or.partialMatches.length===0){let{matches:Qt,route:Tr}=ude(s.activeRoutes);return{matches:Qt,pendingActionResult:[Tr.id,{type:"error",error:or.error}]}}let cr=f_(or.partialMatches).route.id;return{matches:or.partialMatches,pendingActionResult:[cr,{type:"error",error:or.error}]}}else if(or.matches)et=or.matches;else{let{notFoundMatches:cr,error:Qt,route:Tr}=Be(se.pathname);return{matches:cr,pendingActionResult:[Tr.id,{type:"error",error:Qt}]}}}let ht,Ht=gde(et,se);if(!Ht.route.action&&!Ht.route.lazy)ht={type:"error",error:Pg(405,{method:Re.method,pathname:se.pathname,routeId:Ht.route.id})};else{let or=m8(i,a,Re,se,et,Ht,Fe?[]:n,vt),cr=await ke(Re,se,or,vt,null);if(ht=cr[Ht.route.id],!ht){for(let Qt of et)if(cr[Qt.route.id]){ht=cr[Qt.route.id];break}}if(Re.signal.aborted)return{shortCircuited:!0}}if(VP(ht)){let or;return Qe&&Qe.replace!=null?or=Qe.replace:or=FTt(ht.response.headers.get("Location"),new URL(Re.url),l,e.history)===E.location.pathname+E.location.search,await ve(Re,ht,!0,{submission:Ue,replace:or}),{shortCircuited:!0}}if(Yh(ht)){let or=f_(et,Ht.route.id);return(Qe&&Qe.replace)!==!0&&(D="PUSH"),{matches:et,pendingActionResult:[or.route.id,ht,Ht.route.id]}}return{matches:et,pendingActionResult:[Ht.route.id,ht]}}async function Pe(Re,se,Ue,et,Xe,vt,Ft,Fe,Qe,mt,ht,Ht,or,cr){let Qt=Ft||GDe(se,Ue,et,Fe),Tr=Fe||Qe||GTt(Qt),at=!M&&!ht;if(vt){if(at){let Zn=Me(or);Ce({navigation:Qt,...Zn!==void 0?{actionData:Zn}:{}},{flushSync:Ht})}let Ne=await Zt(Ue,se.pathname,Re.signal);if(Ne.type==="aborted")return{shortCircuited:!0};if(Ne.type==="error"){if(Ne.partialMatches.length===0){let{matches:Ke,route:jr}=ude(s.activeRoutes);return{matches:Ke,loaderData:{},errors:{[jr.id]:Ne.error}}}let Zn=f_(Ne.partialMatches).route.id;return{matches:Ne.partialMatches,loaderData:{},errors:{[Zn]:Ne.error}}}else if(Ne.matches)Ue=Ne.matches;else{let{error:Zn,notFoundMatches:Ke,route:jr}=Be(se.pathname);return{matches:Ke,loaderData:{},errors:{[jr.id]:Zn}}}}let ft=s.activeRoutes,{dsMatches:Mt,revalidatingFetchers:Cr}=MTt(Re,Xe,i,a,e.history,E,Ue,Tr,se,ht?[]:n,ht===!0,F,O,ee,Y,q,ft,l,e.patchRoutesOnNavigation!=null,s.branches,or,cr);if(V=++H,!e.dataStrategy&&!Mt.some(Ne=>Ne.shouldLoad)&&!Mt.some(Ne=>Ne.route.middleware&&Ne.route.middleware.length>0)&&Cr.length===0){let Ne=new Map(E.fetchers),Zn=we(Ne);return Se(se,{matches:Ue,loaderData:{},errors:or&&Yh(or[1])?{[or[0]]:or[1].error}:null,...VTt(or),...Zn?{fetchers:Ne}:{}},{flushSync:Ht}),{shortCircuited:!0}}if(at){let Ne={};if(!vt){Ne.navigation=Qt;let Zn=Me(or);Zn!==void 0&&(Ne.actionData=Zn)}Cr.length>0&&(Ne.fetchers=He(Cr)),Ce(Ne,{flushSync:Ht})}Cr.forEach(Ne=>{Q(Ne.key),Ne.controller&&z.set(Ne.key,Ne.controller)});let Ar=()=>Cr.forEach(Ne=>Q(Ne.key));P&&P.signal.addEventListener("abort",Ar);let{loaderResults:hn,fetcherResults:so}=await de(Mt,Cr,Re,se,Xe);if(Re.signal.aborted)return{shortCircuited:!0};P&&P.signal.removeEventListener("abort",Ar),Cr.forEach(Ne=>z.delete(Ne.key));let rn=dde(hn);if(rn)return await ve(Re,rn.result,!0,{replace:mt}),{shortCircuited:!0};if(rn=dde(so),rn)return q.add(rn.key),await ve(Re,rn.result,!0,{replace:mt}),{shortCircuited:!0};let Jt=new Map(E.fetchers),{loaderData:Gt,errors:ur}=HTt(E,Ue,hn,or,Cr,so,Jt);ht&&E.errors&&(ur={...E.errors,...ur});let hr=we(Jt),qt=Ie(V,Jt),qr=hr||qt||Cr.length>0;return{matches:Ue,loaderData:Gt,errors:ur,...qr?{workingFetchers:Jt}:{}}}function Me(Re){if(Re&&!Yh(Re[1]))return{[Re[0]]:Re[1].data};if(E.actionData)return Object.keys(E.actionData).length===0?null:E.actionData}function He(Re){let se=new Map(E.fetchers);return Re.forEach(Ue=>{let et=se.get(Ue.key),Xe=oX(void 0,et?et.data:void 0);se.set(Ue.key,Xe)}),se}async function le(Re,se,Ue,et){Q(Re);let Xe=(et&&et.flushSync)===!0,vt=s.activeRoutes,Ft=KDe(E.location,E.matches,l,Ue,se,et?.relative),Fe=Ly(vt,Ft,l,!1,s.branches),Qe=Lt(Fe,vt,Ft);if(Qe.active&&Qe.matches&&(Fe=Qe.matches),!Fe){ae(Re,se,Pg(404,{pathname:Ft}),{flushSync:Xe});return}let{path:mt,submission:ht,error:Ht}=DTt(!0,Ft,et);if(Ht){ae(Re,se,Ht,{flushSync:Xe});return}let or=e.getContext?await e.getContext():new YDe,cr=(et&&et.preventScrollReset)===!0;if(ht&&Ld(ht.formMethod)){await fe(Re,se,mt,Fe,or,Qe.active,Xe,cr,ht,et&&et.defaultShouldRevalidate);return}Y.set(Re,{routeId:se,path:mt}),await ye(Re,se,mt,Fe,or,Qe.active,Xe,cr,ht)}async function fe(Re,se,Ue,et,Xe,vt,Ft,Fe,Qe,mt){G(),Y.delete(Re);let ht=E.fetchers.get(Re);J(Re,Bbn(Qe,ht),{flushSync:Ft});let Ht=new AbortController,or=f8(e.history,Ue,Ht.signal,Qe);if(vt){let Yo=await Zt(et,new URL(or.url).pathname,or.signal,Re);if(Yo.type==="aborted")return;if(Yo.type==="error"){ae(Re,se,Yo.error,{flushSync:Ft});return}else if(Yo.matches)et=Yo.matches;else{ae(Re,se,Pg(404,{pathname:Ue}),{flushSync:Ft});return}}let cr=gde(et,Ue);if(!cr.route.action&&!cr.route.lazy){let Yo=Pg(405,{method:Qe.formMethod,pathname:Ue,routeId:se});ae(Re,se,Yo,{flushSync:Ft});return}z.set(Re,Ht);let Qt=H,Tr=m8(i,a,or,Ue,et,cr,n,Xe),at=await ke(or,Ue,Tr,Xe,Re),ft=at[cr.route.id];if(!ft){for(let Yo of Tr)if(at[Yo.route.id]){ft=at[Yo.route.id];break}}if(or.signal.aborted){z.get(Re)===Ht&&z.delete(Re);return}if(ee.has(Re)){if(VP(ft)||Yh(ft)){J(Re,k1(void 0));return}}else{if(VP(ft))if(z.delete(Re),V>Qt){J(Re,k1(void 0));return}else return q.add(Re),J(Re,oX(Qe)),ve(or,ft,!1,{fetcherSubmission:Qe,preventScrollReset:Fe});if(Yh(ft)){ae(Re,se,ft.error);return}}let Mt=E.navigation.location||E.location,Cr=f8(e.history,Mt,Ht.signal),Ar=s.activeRoutes,hn=E.navigation.state!=="idle"?Ly(Ar,E.navigation.location,l,!1,s.branches):E.matches;Wn(hn,"Didn't find any matches after fetcher action");let so=++H;U.set(Re,so);let{dsMatches:rn,revalidatingFetchers:Jt}=MTt(Cr,Xe,i,a,e.history,E,hn,Qe,Mt,n,!1,F,O,ee,Y,q,Ar,l,e.patchRoutesOnNavigation!=null,s.branches,[cr.route.id,ft],mt),Gt=oX(Qe,ft.data),ur=new Map(E.fetchers);ur.set(Re,Gt),Jt.filter(Yo=>Yo.key!==Re).forEach(Yo=>{let bd=Yo.key,t1=ur.get(bd),Ma=oX(void 0,t1?t1.data:void 0);ur.set(bd,Ma),Q(bd),Yo.controller&&z.set(bd,Yo.controller)}),Ce({fetchers:ur});let hr=()=>Jt.forEach(Yo=>Q(Yo.key));Ht.signal.addEventListener("abort",hr);let{loaderResults:qt,fetcherResults:qr}=await de(rn,Jt,Cr,Mt,Xe);if(Ht.signal.aborted)return;Ht.signal.removeEventListener("abort",hr),U.delete(Re),z.delete(Re),Jt.forEach(Yo=>z.delete(Yo.key));let Ne=E.fetchers.has(Re),Zn=Yo=>{if(!Ne)return Yo;let bd=new Map(Yo.fetchers);return bd.set(Re,k1(ft.data)),{...Yo,fetchers:bd}},Ke=dde(qt);if(Ke)return E=Zn(E),ve(Cr,Ke.result,!1,{preventScrollReset:Fe});if(Ke=dde(qr),Ke)return q.add(Ke.key),E=Zn(E),ve(Cr,Ke.result,!1,{preventScrollReset:Fe});let jr=new Map(E.fetchers);Ne&&jr.set(Re,k1(ft.data));let{loaderData:Ms,errors:rf}=HTt(E,hn,qt,void 0,Jt,qr,jr);Ie(so,jr),E.navigation.state==="loading"&&so>V?(Wn(D,"Expected pending action"),P&&P.abort(),Se(E.navigation.location,{matches:hn,loaderData:Ms,errors:rf,fetchers:jr})):(Ce({errors:rf,loaderData:UTt(E.loaderData,Ms,hn,rf),fetchers:jr}),F=!1)}async function ye(Re,se,Ue,et,Xe,vt,Ft,Fe,Qe){let mt=E.fetchers.get(Re);J(Re,oX(Qe,mt?mt.data:void 0),{flushSync:Ft});let ht=new AbortController,Ht=f8(e.history,Ue,ht.signal);if(vt){let ft=await Zt(et,new URL(Ht.url).pathname,Ht.signal,Re);if(ft.type==="aborted")return;if(ft.type==="error"){ae(Re,se,ft.error,{flushSync:Ft});return}else if(ft.matches)et=ft.matches;else{ae(Re,se,Pg(404,{pathname:Ue}),{flushSync:Ft});return}}let or=gde(et,Ue);z.set(Re,ht);let cr=H,Qt=m8(i,a,Ht,Ue,et,or,n,Xe),Tr=await ke(Ht,Ue,Qt,Xe,Re),at=Tr[or.route.id];if(!at){for(let ft of et)if(Tr[ft.route.id]){at=Tr[ft.route.id];break}}if(z.get(Re)===ht&&z.delete(Re),!Ht.signal.aborted){if(ee.has(Re)){J(Re,k1(void 0));return}if(VP(at))if(V>cr){J(Re,k1(void 0));return}else{q.add(Re),await ve(Ht,at,!1,{preventScrollReset:Fe});return}if(Yh(at)){ae(Re,se,at.error);return}J(Re,k1(at.data))}}async function ve(Re,se,Ue,{submission:et,fetcherSubmission:Xe,preventScrollReset:vt,replace:Ft}={}){Ue||(N?.resolve(),N=null),se.response.headers.has("X-Remix-Revalidate")&&(F=!0);let Fe=se.response.headers.get("Location");Wn(Fe,"Expected a Location header on the redirect Response");let Qe=Fe,mt=new URL(Re.url);Fe=FTt(Fe,mt,l,e.history),h8(Qe,Fe,mt,"allow-explicit");let ht=cX(E.location,Fe,{_isRedirect:!0});if(r){let at=!1;if(se.response.headers.has("X-Remix-Reload-Document"))at=!0;else if(rMe(Fe)){let ft=owt(t,Fe,!0);at=ft.origin!==t.location.origin||vf(ft.pathname,l)==null}if(at){Ft?t.location.replace(Fe):t.location.assign(Fe);return}}P=null;let Ht=Ft===!0||se.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:or,formAction:cr,formEncType:Qt}=E.navigation;!et&&!Xe&&or&&cr&&Qt&&(et=GTt(E.navigation));let Tr=et||Xe;if(fbn.has(se.response.status)&&Tr&&Ld(Tr.formMethod))await Ye(Ht,ht,{submission:{...Tr,formAction:Fe},preventScrollReset:vt||$,enableViewTransition:Ue?A:void 0});else{let at=GDe(ht,[],Ht,et);await Ye(Ht,ht,{overrideNavigation:at,fetcherSubmission:Xe,preventScrollReset:vt||$,enableViewTransition:Ue?A:void 0})}}async function ke(Re,se,Ue,et,Xe){let vt,Ft={};try{vt=await Sbn(u,Re,se,Ue,Xe,et,!1)}catch(Fe){return Ue.filter(Qe=>Qe.shouldLoad).forEach(Qe=>{Ft[Qe.route.id]={type:"error",error:Fe}}),Ft}if(Re.signal.aborted)return Ft;if(!Ld(Re.method))for(let Fe of Ue){if(vt[Fe.route.id]?.type==="error")break;!vt.hasOwnProperty(Fe.route.id)&&!E.loaderData.hasOwnProperty(Fe.route.id)&&(!E.errors||!E.errors.hasOwnProperty(Fe.route.id))&&Fe.shouldCallHandler()&&(vt[Fe.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Fe.route.id}`)})}for(let[Fe,Qe]of Object.entries(vt))if(Ibn(Qe)){let mt=Qe.result;Ft[Fe]={type:"redirect",response:kbn(mt,Re,Fe,Ue,l)}}else Ft[Fe]=await Cbn(Qe);return Ft}async function de(Re,se,Ue,et,Xe){let vt=ke(Ue,et,Re,Xe,null),Ft=Promise.all(se.map(async mt=>{if(mt.matches&&mt.match&&mt.request&&mt.controller){let Ht=(await ke(mt.request,mt.path,mt.matches,Xe,mt.key))[mt.match.route.id];return{[mt.key]:Ht}}else return Promise.resolve({[mt.key]:{type:"error",error:Pg(404,{pathname:mt.path})}})})),Fe=await vt,Qe=(await Ft).reduce((mt,ht)=>Object.assign(mt,ht),{});return{loaderResults:Fe,fetcherResults:Qe}}function G(){F=!0,Y.forEach((Re,se)=>{z.has(se)&&O.add(se),Q(se)})}function J(Re,se,Ue={}){let et=new Map(E.fetchers);et.set(Re,se),Ce({fetchers:et},{flushSync:(Ue&&Ue.flushSync)===!0})}function ae(Re,se,Ue,et={}){let Xe=f_(E.matches,se),vt=new Map(E.fetchers);re(vt,Re),Ce({errors:{[Xe.route.id]:Ue},fetchers:vt},{flushSync:(et&&et.flushSync)===!0})}function j(Re){return Z.set(Re,(Z.get(Re)||0)+1),ee.has(Re)&&ee.delete(Re),E.fetchers.get(Re)||vwt}function ue(Re,se){Q(Re,se?.reason),J(Re,k1(null))}function re(Re,se){let Ue=E.fetchers.get(se);z.has(se)&&!(Ue&&Ue.state==="loading"&&U.has(se))&&Q(se),Y.delete(se),U.delete(se),q.delete(se),ee.delete(se),O.delete(se),Re.delete(se)}function X(Re){let se=(Z.get(Re)||0)-1;se<=0?(Z.delete(Re),ee.add(Re)):Z.set(Re,se),Ce({fetchers:new Map(E.fetchers)})}function Q(Re,se){let Ue=z.get(Re);Ue&&(Ue.abort(se),z.delete(Re))}function $e(Re,se){for(let Ue of Re){let et=se.get(Ue);Wn(et,`Expected fetcher: ${Ue}`);let Xe=k1(et.data);se.set(Ue,Xe)}}function we(Re){let se=[],Ue=!1;for(let et of q){let Xe=Re.get(et);Wn(Xe,`Expected fetcher: ${et}`),Xe.state==="loading"&&(q.delete(et),se.push(et),Ue=!0)}return $e(se,Re),Ue}function Ie(Re,se){let Ue=[];for(let[et,Xe]of U)if(Xe<Re){let vt=se.get(et);Wn(vt,`Expected fetcher: ${et}`),vt.state==="loading"&&(Q(et),U.delete(et),Ue.push(et))}return $e(Ue,se),Ue.length>0}function De(Re,se){let Ue=E.blockers.get(Re)||UP;return K.get(Re)!==se&&K.set(Re,se),Ue}function Oe(Re){E.blockers.delete(Re),K.delete(Re)}function Le(Re,se){let Ue=E.blockers.get(Re)||UP;Wn(Ue.state==="unblocked"&&se.state==="blocked"||Ue.state==="blocked"&&se.state==="blocked"||Ue.state==="blocked"&&se.state==="proceeding"||Ue.state==="blocked"&&se.state==="unblocked"||Ue.state==="proceeding"&&se.state==="unblocked",`Invalid blocker state transition: ${Ue.state} -> ${se.state}`);let et=new Map(E.blockers);et.set(Re,se),Ce({blockers:et})}function Ge({currentLocation:Re,nextLocation:se,historyAction:Ue}){if(K.size===0)return;K.size>1&&os(!1,"A router only supports one blocker at a time");let et=Array.from(K.entries()),[Xe,vt]=et[et.length-1],Ft=E.blockers.get(Xe);if(!(Ft&&Ft.state==="proceeding")&&vt({currentLocation:Re,nextLocation:se,historyAction:Ue}))return Xe}function Be(Re){let se=Pg(404,{pathname:Re}),Ue=s.activeRoutes,{matches:et,route:Xe}=ude(Ue);return{notFoundMatches:et,route:Xe,error:se}}function tt(Re,se,Ue){if(m=Re,y=se,g=Ue||null,!v&&E.navigation===mde){v=!0;let et=qe(E.location,E.matches);et!=null&&Ce({restoreScrollPosition:et})}return()=>{m=null,y=null,g=null}}function Ee(Re,se){return g&&g(Re,se.map(et=>iwt(et,E.loaderData)))||Re.key}function Rt(Re,se){if(m&&y){let Ue=Ee(Re,se);m[Ue]=y()}}function qe(Re,se){if(m){let Ue=Ee(Re,se),et=m[Ue];if(typeof et=="number")return et}return null}function Lt(Re,se,Ue){if(e.patchRoutesOnNavigation){let et=s.branches;if(Re){if(Object.keys(Re[0].params).length>0)return{active:!0,matches:Ly(se,Ue,l,!0,et)}}else return{active:!0,matches:Ly(se,Ue,l,!0,et)||[]}}return{active:!1,matches:null}}async function Zt(Re,se,Ue,et){if(!e.patchRoutesOnNavigation)return{type:"success",matches:Re};let Xe=Re;for(;;){let vt=a;try{await e.patchRoutesOnNavigation({signal:Ue,path:se,matches:Xe,fetcherKey:et,patch:(mt,ht)=>{Ue.aborted||NTt(mt,ht,s,vt,i,!1)}})}catch(mt){return{type:"error",error:mt,partialMatches:Xe}}if(Ue.aborted)return{type:"aborted"};let Ft=s.branches,Fe=Ly(s.activeRoutes,se,l,!1,Ft),Qe=null;if(Fe){if(Object.keys(Fe[0].params).length===0)return{type:"success",matches:Fe};if(Qe=Ly(s.activeRoutes,se,l,!0,Ft),!(Qe&&Xe.length<Qe.length&&fr(Xe,Qe.slice(0,Xe.length))))return{type:"success",matches:Fe}}if(Qe||(Qe=Ly(s.activeRoutes,se,l,!0,Ft)),!Qe||fr(Xe,Qe))return{type:"success",matches:null};Xe=Qe}}function fr(Re,se){return Re.length===se.length&&Re.every((Ue,et)=>Ue.route.id===se[et].route.id)}function Nt(Re){a={},s.setHmrRoutes(uX(Re,i,void 0,a))}function yt(Re,se,Ue=!1){NTt(Re,se,s,a,i,Ue),s.hasHMRRoutes||Ce({})}return _={get basename(){return l},get future(){return d},get state(){return E},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return a},get window(){return t},initialize:ge,subscribe:me,enableScrollRestoration:tt,navigate:We,fetch:le,revalidate:je,createHref:Re=>e.history.createHref(Re),createURL:Re=>e.history.createURL(Re),encodeLocation:Re=>e.history.encodeLocation(Re),getFetcher:j,resetFetcher:ue,deleteFetcher:X,dispose:he,getBlocker:De,deleteBlocker:Oe,patchRoutes:yt,_internalFetchControllers:z,_internalSetRoutes:Nt,_internalSetStateDoNotUseOrYouWillBreakYourApp(Re){Ce(Re)}},e.instrumentations&&(_=nbn(_,e.instrumentations.map(Re=>Re.router).filter(Boolean))),_}function mbn(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function KDe(e,t,r,n,o,i){let a,s;if(o){a=[];for(let u of t)if(a.push(u),u.route.id===o){s=u;break}}else a=t,s=t[t.length-1];let l=dX(n||".",wde(a),vf(e.pathname,r)||e.pathname,i==="path");if(n==null&&(l.search=e.search,l.hash=e.hash),(n==null||n===""||n===".")&&s){let u=sMe(l.search);if(s.route.index&&!u)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!s.route.index&&u){let d=new URLSearchParams(l.search),f=d.getAll("index");d.delete("index"),f.filter(h=>h).forEach(h=>d.append("index",h));let p=d.toString();l.search=p?`?${p}`:""}}return r!=="/"&&(l.pathname=Z1n({basename:r,pathname:l.pathname})),Id(l)}function DTt(e,t,r){if(!r||!mbn(r))return{path:t};if(r.formMethod&&!Nbn(r.formMethod))return{path:t,error:Pg(405,{method:r.formMethod})};let n=()=>({path:t,error:Pg(400,{type:"invalid-body"})}),i=(r.formMethod||"get").toUpperCase(),a=Pwt(t);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!Ld(i))return n();let f=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((p,[h,m])=>`${p}${h}=${m}
|
|
3814
3814
|
`,""):String(r.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:r.formEncType,formData:void 0,json:void 0,text:f}}}else if(r.formEncType==="application/json"){if(!Ld(i))return n();try{let f=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:r.formEncType,formData:void 0,json:f,text:void 0}}}catch{return n()}}}Wn(typeof FormData=="function","FormData is not available in this environment");let s,l;if(r.formData)s=QDe(r.formData),l=r.formData;else if(r.body instanceof FormData)s=QDe(r.body),l=r.body;else if(r.body instanceof URLSearchParams)s=r.body,l=zTt(s);else if(r.body==null)s=new URLSearchParams,l=new FormData;else try{s=new URLSearchParams(r.body),l=zTt(s)}catch{return n()}let u={formMethod:i,formAction:a,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(Ld(u.formMethod))return{path:t,submission:u};let d=Lg(t);return e&&d.search&&sMe(d.search)&&s.append("index",""),d.search=`?${s}`,{path:Id(d),submission:u}}function MTt(e,t,r,n,o,i,a,s,l,u,d,f,p,h,m,g,y,v,b,x,w,C){let k=w?Yh(w[1])?w[1].error:w[1].data:void 0,_=o.createURL(i.location),E=o.createURL(l),D;if(d&&i.errors){let M=Object.keys(i.errors)[0];D=a.findIndex(F=>F.route.id===M)}else if(w&&Yh(w[1])){let M=w[0];D=a.findIndex(F=>F.route.id===M)-1}let N=w?w[1].statusCode:void 0,$=N&&N>=400,P={currentUrl:_,currentParams:i.matches[0]?.params||{},nextUrl:E,nextParams:a[0].params,...s,actionResult:k,actionStatus:N},A=fX(a),L=a.map((M,F)=>{let{route:O}=M,z=null;if(D!=null&&F>D)z=!1;else if(O.lazy)z=!0;else if(!iMe(O))z=!1;else if(d){let{shouldLoad:q}=Twt(O,i.loaderData,i.errors);z=q}else gbn(i.loaderData,i.matches[F],M)&&(z=!0);if(z!==null)return XDe(r,n,e,l,A,M,u,t,z);let H=!1;typeof C=="boolean"?H=C:$?H=!1:(f||_.pathname+_.search===E.pathname+E.search||_.search!==E.search||ybn(i.matches[F],M))&&(H=!0);let V={...P,defaultShouldRevalidate:H},U=lX(M,V);return XDe(r,n,e,l,A,M,u,t,U,V,C)}),I=[];return m.forEach((M,F)=>{if(d||!a.some(Z=>Z.route.id===M.routeId)||h.has(F))return;let O=i.fetchers.get(F),z=O&&O.state!=="idle"&&O.data===void 0,H=Ly(y,M.path,v??"/",!1,x);if(!H){if(b&&z)return;I.push({key:F,routeId:M.routeId,path:M.path,matches:null,match:null,request:null,controller:null});return}if(g.has(F))return;let V=gde(H,M.path),U=new AbortController,q=f8(o,M.path,U.signal),Y=null;if(p.has(F))p.delete(F),Y=m8(r,n,q,M.path,H,V,u,t);else if(z)f&&(Y=m8(r,n,q,M.path,H,V,u,t));else{let Z;typeof C=="boolean"?Z=C:$?Z=!1:Z=f;let ee={...P,defaultShouldRevalidate:Z};lX(V,ee)&&(Y=m8(r,n,q,M.path,H,V,u,t,ee))}Y&&I.push({key:F,routeId:M.routeId,path:M.path,matches:Y,match:V,request:q,controller:U})}),{dsMatches:L,revalidatingFetchers:I}}function iMe(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function Twt(e,t,r){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!iMe(e))return{shouldLoad:!1,renderFallback:!1};let n=t!=null&&e.id in t,o=r!=null&&r[e.id]!==void 0;if(!n&&o)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!n};let i=!n&&!o;return{shouldLoad:i,renderFallback:i}}function gbn(e,t,r){let n=!t||r.route.id!==t.route.id,o=!e.hasOwnProperty(r.route.id);return n||o}function ybn(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function lX(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function NTt(e,t,r,n,o,i){let a;if(e){let u=n[e];Wn(u,`No route found to patch children into: routeId = ${e}`),u.children||(u.children=[]),a=u.children}else a=r.activeRoutes;let s=[],l=[];if(t.forEach(u=>{let d=a.find(f=>wwt(u,f));d?l.push({existingRoute:d,newRoute:u}):s.push(u)}),s.length>0){let u=uX(s,o,[e||"_","patch",String(a?.length||"0")],n);a.push(...u)}if(i&&l.length>0)for(let u=0;u<l.length;u++){let{existingRoute:d,newRoute:f}=l[u],p=d,[h]=uX([f],o,[],{},!0);Object.assign(p,{element:h.element?h.element:p.element,errorElement:h.errorElement?h.errorElement:p.errorElement,hydrateFallbackElement:h.hydrateFallbackElement?h.hydrateFallbackElement:p.hydrateFallbackElement})}r.hasHMRRoutes||r.setRoutes([...r.activeRoutes])}function wwt(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((r,n)=>t.children?.some(o=>wwt(r,o)))??!1:!1}var OTt=new WeakMap,Cwt=({key:e,route:t,manifest:r,mapRouteProperties:n})=>{let o=r[t.id];if(Wn(o,"No route found in manifest"),!o.lazy||typeof o.lazy!="object")return;let i=o.lazy[e];if(!i)return;let a=OTt.get(o);a||(a={},OTt.set(o,a));let s=a[e];if(s)return s;let l=(async()=>{let u=B1n(e),f=o[e]!==void 0&&e!=="hasErrorBoundary";if(u)os(!u,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),a[e]=Promise.resolve();else if(f)os(!1,`Route "${o.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let p=await i();p!=null&&(Object.assign(o,{[e]:p}),Object.assign(o,n(o)))}typeof o.lazy=="object"&&(o.lazy[e]=void 0,Object.values(o.lazy).every(p=>p===void 0)&&(o.lazy=void 0))})();return a[e]=l,l},BTt=new WeakMap;function vbn(e,t,r,n,o){let i=r[e.id];if(Wn(i,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let d=BTt.get(i);if(d)return{lazyRoutePromise:d,lazyHandlerPromise:d};let f=(async()=>{Wn(typeof e.lazy=="function","No lazy route function found");let p=await e.lazy(),h={};for(let m in p){let g=p[m];if(g===void 0)continue;let y=F1n(m),b=i[m]!==void 0&&m!=="hasErrorBoundary";y?os(!y,"Route property "+m+" is not a supported property to be returned from a lazy route function. This property will be ignored."):b?os(!b,`Route "${i.id}" has a static property "${m}" defined but its lazy function is also returning a value for this property. The lazy route property "${m}" will be ignored.`):h[m]=g}Object.assign(i,h),Object.assign(i,{...n(i),lazy:void 0})})();return BTt.set(i,f),f.catch(()=>{}),{lazyRoutePromise:f,lazyHandlerPromise:f}}let a=Object.keys(e.lazy),s=[],l;for(let d of a){if(o&&o.includes(d))continue;let f=Cwt({key:d,route:e,manifest:r,mapRouteProperties:n});f&&(s.push(f),d===t&&(l=f))}let u=s.length>0?Promise.all(s).then(()=>{}):void 0;return u?.catch(()=>{}),l?.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:l}}async function $Tt(e){let t=e.matches.filter(o=>o.shouldLoad),r={};return(await Promise.all(t.map(o=>o.resolve()))).forEach((o,i)=>{r[t[i].route.id]=o}),r}async function bbn(e){return e.matches.some(t=>t.route.middleware)?kwt(e,()=>$Tt(e)):$Tt(e)}function kwt(e,t){return xbn(e,t,n=>{if(Mbn(n))throw n;return n},Abn,r);function r(n,o,i){if(i)return Promise.resolve(Object.assign(i.value,{[o]:{type:"error",result:n}}));{let{matches:a}=e,s=Math.min(Math.max(a.findIndex(u=>u.route.id===o),0),Math.max(a.findIndex(u=>u.shouldCallHandler()),0)),l=f_(a,a[s].route.id).route.id;return Promise.resolve({[l]:{type:"error",result:n}})}}}async function xbn(e,t,r,n,o){let{matches:i,...a}=e,s=i.flatMap(u=>u.route.middleware?u.route.middleware.map(d=>[u.route.id,d]):[]);return await _wt(a,s,t,r,n,o)}async function _wt(e,t,r,n,o,i,a=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??new Error(`Request aborted: ${s.method} ${s.url}`);let l=t[a];if(!l)return await r();let[u,d]=l,f,p=async()=>{if(f)throw new Error("You may only call `next()` once per middleware");try{return f={value:await _wt(e,t,r,n,o,i,a+1)},f.value}catch(h){return f={value:await i(h,u,f)},f.value}};try{let h=await d(e,p),m=h!=null?n(h):void 0;return o(m)?m:f?m??f.value:(f={value:await p()},f.value)}catch(h){return await i(h,u,f)}}function Ewt(e,t,r,n,o){let i=Cwt({key:"middleware",route:n.route,manifest:t,mapRouteProperties:e}),a=vbn(n.route,Ld(r.method)?"action":"loader",t,e,o);return{middleware:i,route:a.lazyRoutePromise,handler:a.lazyHandlerPromise}}function XDe(e,t,r,n,o,i,a,s,l,u=null,d){let f=!1,p=Ewt(e,t,r,i,a);return{...i,_lazyPromises:p,shouldLoad:l,shouldRevalidateArgs:u,shouldCallHandler(h){return f=!0,u?typeof d=="boolean"?lX(i,{...u,defaultShouldRevalidate:d}):typeof h=="boolean"?lX(i,{...u,defaultShouldRevalidate:h}):lX(i,u):l},resolve(h){let{lazy:m,loader:g,middleware:y}=i.route,v=f||l||h&&!Ld(r.method)&&(m||g),b=y&&y.length>0&&!g&&!m;return v&&(Ld(r.method)||!b)?Tbn({request:r,path:n,pattern:o,match:i,lazyHandlerPromise:p?.handler,lazyRoutePromise:p?.route,handlerOverride:h,scopedContext:s}):Promise.resolve({type:"data",result:void 0})}}}function m8(e,t,r,n,o,i,a,s,l=null){return o.map(u=>u.route.id!==i.route.id?{...u,shouldLoad:!1,shouldRevalidateArgs:l,shouldCallHandler:()=>!1,_lazyPromises:Ewt(e,t,r,u,a),resolve:()=>Promise.resolve({type:"data",result:void 0})}:XDe(e,t,r,n,fX(o),u,a,s,!0,l))}async function Sbn(e,t,r,n,o,i,a){n.some(d=>d._lazyPromises?.middleware)&&await Promise.all(n.map(d=>d._lazyPromises?.middleware));let s={request:t,url:Rwt(t,r),pattern:fX(n),params:n[0].params,context:i,matches:n},u=await e({...s,fetcherKey:o,runClientMiddleware:a?()=>{throw new Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:d=>{let f=s;return kwt(f,()=>d({...f,fetcherKey:o,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(n.flatMap(d=>[d._lazyPromises?.handler,d._lazyPromises?.route]))}catch{}return u}async function Tbn({request:e,path:t,pattern:r,match:n,lazyHandlerPromise:o,lazyRoutePromise:i,handlerOverride:a,scopedContext:s}){let l,u,d=Ld(e.method),f=d?"action":"loader",p=h=>{let m,g=new Promise((b,x)=>m=x);u=()=>m(),e.signal.addEventListener("abort",u);let y=b=>typeof h!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${f}" [routeId: ${n.route.id}]`)):h({request:e,url:Rwt(e,t),pattern:r,params:n.params,context:s},...b!==void 0?[b]:[]),v=(async()=>{try{return{type:"data",result:await(a?a(x=>y(x)):y())}}catch(b){return{type:"error",result:b}}})();return Promise.race([v,g])};try{let h=d?n.route.action:n.route.loader;if(o||i)if(h){let m,[g]=await Promise.all([p(h).catch(y=>{m=y}),o,i]);if(m!==void 0)throw m;l=g}else{await o;let m=d?n.route.action:n.route.loader;if(m)[l]=await Promise.all([p(m),i]);else if(f==="action"){let g=new URL(e.url),y=g.pathname+g.search;throw Pg(405,{method:e.method,pathname:y,routeId:n.route.id})}else return{type:"data",result:void 0}}else if(h)l=await p(h);else{let m=new URL(e.url),g=m.pathname+m.search;throw Pg(404,{pathname:g})}}catch(h){return{type:"error",result:h}}finally{u&&e.signal.removeEventListener("abort",u)}return l}async function wbn(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function Cbn(e){let{result:t,type:r}=e;if(aMe(t)){let n;try{n=await wbn(t)}catch(o){return{type:"error",error:o}}return r==="error"?{type:"error",error:new x8(t.status,t.statusText,n),statusCode:t.status,headers:t.headers}:{type:"data",data:n,statusCode:t.status,headers:t.headers}}return r==="error"?WTt(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:Pbn(t),statusCode:b8(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:b8(t)?t.status:void 0}:WTt(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function kbn(e,t,r,n,o){let i=e.headers.get("Location");if(Wn(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!rMe(i)){let a=n.slice(0,n.findIndex(s=>s.route.id===r)+1);i=KDe(new URL(t.url),a,o,i),e.headers.set("Location",i)}return e}var _bn=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function ZDe(e){try{return _bn.includes(new URL(e).protocol)}catch{return!1}}function FTt(e,t,r,n){if(rMe(e)){let o=e,i=Tde.test(o)?new URL(rwt(o,t.protocol)):new URL(o);if(ZDe(i.toString()))throw new Error("Invalid redirect location");let a=vf(i.pathname,r)!=null;if(i.origin===t.origin&&a)return nMe(i.pathname)+i.search+i.hash}try{let o=n.createURL(e);if(ZDe(o.toString()))throw new Error("Invalid redirect location")}catch{}return e}function f8(e,t,r,n){let o=e.createURL(Pwt(t)).toString(),i={signal:r};if(n&&Ld(n.formMethod)){let{formMethod:a,formEncType:s}=n;i.method=a.toUpperCase(),s==="application/json"?(i.headers=new Headers({"Content-Type":s}),i.body=JSON.stringify(n.json)):s==="text/plain"?i.body=n.text:s==="application/x-www-form-urlencoded"&&n.formData?i.body=QDe(n.formData):i.body=n.formData}return new Request(o,i)}function Rwt(e,t){let r=new URL(e.url),n=typeof t=="string"?Lg(t):t;if(r.pathname=n.pathname||"/",n.search){let o=new URLSearchParams(n.search),i=o.getAll("index");o.delete("index");for(let a of i.filter(Boolean))o.append("index",a);r.search=o.size?`?${o.toString()}`:""}else r.search="";return r.hash=n.hash||"",r}function QDe(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,typeof n=="string"?n:n.name);return t}function zTt(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function Ebn(e,t,r,n=!1,o=!1){let i={},a=null,s,l=!1,u={},d=r&&Yh(r[1])?r[1].error:void 0;return e.forEach(f=>{if(!(f.route.id in t))return;let p=f.route.id,h=t[p];if(Wn(!VP(h),"Cannot handle redirect results in processLoaderData"),Yh(h)){let m=h.error;if(d!==void 0&&(m=d,d=void 0),a=a||{},o)a[p]=m;else{let g=f_(e,p);a[g.route.id]==null&&(a[g.route.id]=m)}n||(i[p]=xwt),l||(l=!0,s=b8(h.error)?h.error.status:500),h.headers&&(u[p]=h.headers)}else i[p]=h.data,h.statusCode&&h.statusCode!==200&&!l&&(s=h.statusCode),h.headers&&(u[p]=h.headers)}),d!==void 0&&r&&(a={[r[0]]:d},r[2]&&(i[r[2]]=void 0)),{loaderData:i,errors:a,statusCode:s||200,loaderHeaders:u}}function HTt(e,t,r,n,o,i,a){let{loaderData:s,errors:l}=Ebn(t,r,n);return o.filter(u=>!u.matches||u.matches.some(d=>d.shouldLoad)).forEach(u=>{let{key:d,match:f,controller:p}=u;if(p&&p.signal.aborted)return;let h=i[d];if(Wn(h,"Did not find corresponding fetcher result"),Yh(h)){let m=f_(e.matches,f?.route.id);l&&l[m.route.id]||(l={...l,[m.route.id]:h.error}),a.delete(d)}else if(VP(h))Wn(!1,"Unhandled fetcher revalidation redirect");else{let m=k1(h.data);a.set(d,m)}}),{loaderData:s,errors:l}}function UTt(e,t,r,n){let o=Object.entries(t).filter(([,i])=>i!==xwt).reduce((i,[a,s])=>(i[a]=s,i),{});for(let i of r){let a=i.route.id;if(!t.hasOwnProperty(a)&&e.hasOwnProperty(a)&&i.route.loader&&(o[a]=e[a]),n&&n.hasOwnProperty(a))break}return o}function VTt(e){return e?Yh(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function f_(e,t){return(t?e.slice(0,e.findIndex(n=>n.route.id===t)+1):[...e]).reverse().find(n=>n.route.hasErrorBoundary===!0)||e[0]}function ude(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Pg(e,{pathname:t,routeId:r,method:n,type:o,message:i}={}){let a="Unknown Server Error",s="Unknown @remix-run/router error";return e===400?(a="Bad Request",n&&t&&r?s=`You made a ${n} request to "${t}" but did not provide a \`loader\` for route "${r}", so there is no way to handle the request.`:o==="invalid-body"&&(s="Unable to encode submission body")):e===403?(a="Forbidden",s=`Route "${r}" does not match URL "${t}"`):e===404?(a="Not Found",s=`No route matches URL "${t}"`):e===405&&(a="Method Not Allowed",n&&t&&r?s=`You made a ${n.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${r}", so there is no way to handle the request.`:n&&(s=`Invalid request method "${n.toUpperCase()}"`)),new x8(e||500,a,new Error(s),!0)}function dde(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[n,o]=t[r];if(VP(o))return{key:n,result:o}}}function Pwt(e){let t=typeof e=="string"?Lg(e):e;return Id({...t,hash:""})}function Rbn(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Pbn(e){return new x8(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function Abn(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,r])=>typeof t=="string"&&Lbn(r))}function Lbn(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function Ibn(e){return aMe(e.result)&&ywt.has(e.result.status)}function Yh(e){return e.type==="error"}function VP(e){return(e&&e.type)==="redirect"}function WTt(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function aMe(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Dbn(e){return ywt.has(e)}function Mbn(e){return aMe(e)&&Dbn(e.status)&&e.headers.has("Location")}function Nbn(e){return dbn.has(e.toUpperCase())}function Ld(e){return cbn.has(e.toUpperCase())}function sMe(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function gde(e,t){let r=typeof t=="string"?Lg(t).search:t.search;if(e[e.length-1].route.index&&sMe(r||""))return e[e.length-1];let n=fwt(e);return n[n.length-1]}function GTt(e){let{formMethod:t,formAction:r,formEncType:n,text:o,formData:i,json:a}=e;if(!(!t||!r||!n)){if(o!=null)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:o};if(i!=null)return{formMethod:t,formAction:r,formEncType:n,formData:i,json:void 0,text:void 0};if(a!==void 0)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:a,text:void 0}}}function GDe(e,t,r,n){return n?{state:"loading",location:e,matches:t,historyAction:r,formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.text}:{state:"loading",location:e,matches:t,historyAction:r,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Obn(e,t,r,n){return{state:"submitting",location:e,matches:t,historyAction:r,formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.text}}function oX(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Bbn(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function k1(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function $bn(e,t){try{let r=e.sessionStorage.getItem(bwt);if(r){let n=JSON.parse(r);for(let[o,i]of Object.entries(n||{}))i&&Array.isArray(i)&&t.set(o,new Set(i||[]))}}catch{}}function Fbn(e,t){if(t.size>0){let r={};for(let[n,o]of t)r[n]=[...o];try{e.sessionStorage.setItem(bwt,JSON.stringify(r))}catch(n){os(!1,`Failed to save applied view transitions in sessionStorage (${n}).`)}}}function qTt(){let e,t,r=new Promise((n,o)=>{e=async i=>{n(i);try{await r}catch{}},t=async i=>{o(i);try{await r}catch{}}});return{promise:r,resolve:e,reject:t}}var h_=_p.createContext(null);h_.displayName="DataRouter";var WP=_p.createContext(null);WP.displayName="DataRouterState";var Awt=_p.createContext(!1);function Lwt(){return _p.useContext(Awt)}var Cde=_p.createContext({isTransitioning:!1});Cde.displayName="ViewTransition";var lMe=_p.createContext(new Map);lMe.displayName="Fetchers";var zbn=_p.createContext(null);zbn.displayName="Await";var Dd=_p.createContext(null);Dd.displayName="Navigation";var S8=_p.createContext(null);S8.displayName="Location";var Kh=_p.createContext({outlet:null,matches:[],isDataRoute:!1});Kh.displayName="Route";var cMe=_p.createContext(null);cMe.displayName="RouteError";var g8=!0,Iwt="REACT_ROUTER_ERROR",Hbn="REDIRECT",Ubn="ROUTE_ERROR_RESPONSE";function Vbn(e){if(e.startsWith(`${Iwt}:${Hbn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function Wbn(e){if(e.startsWith(`${Iwt}:${Ubn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new x8(t.status,t.statusText,t.data)}catch{}}function Dwt(e,{relative:t}={}){Wn(m_(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=Fr.useContext(Dd),{hash:o,pathname:i,search:a}=T8(e,{relative:t}),s=i;return r!=="/"&&(s=i==="/"?r:Ag([r,i])),n.createHref({pathname:s,search:a,hash:o})}function m_(){return Fr.useContext(S8)!=null}function yi(){return Wn(m_(),"useLocation() may be used only in the context of a <Router> component."),Fr.useContext(S8).location}function uMe(e){Wn(m_(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:t}=yi();return Fr.useMemo(()=>y8(e,uwt(t)),[t,e])}var Mwt="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Nwt(e){Fr.useContext(Dd).static||Fr.useLayoutEffect(e)}function sn(){let{isDataRoute:e}=Fr.useContext(Kh);return e?txn():Gbn()}function Gbn(){Wn(m_(),"useNavigate() may be used only in the context of a <Router> component.");let e=Fr.useContext(h_),{basename:t,navigator:r}=Fr.useContext(Dd),{matches:n}=Fr.useContext(Kh),{pathname:o}=yi(),i=JSON.stringify(wde(n)),a=Fr.useRef(!1);return Nwt(()=>{a.current=!0}),Fr.useCallback((l,u={})=>{if(os(a.current,Mwt),!a.current)return;if(typeof l=="number"){r.go(l);return}let d=dX(l,JSON.parse(i),o,u.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Ag([t,d.pathname])),h8(typeof l=="string"?l:Id(l),r.createHref(d),oMe(r),"reject"),(u.replace?r.replace:r.push)(d,u.state,u)},[t,r,i,o,e])}var qbn=Fr.createContext(null);function Owt(e){let t=Fr.useContext(Kh).outlet;return Fr.useMemo(()=>t&&Fr.createElement(qbn.Provider,{value:e},t),[t,e])}function PS(){let{matches:e}=Fr.useContext(Kh);return e[e.length-1]?.params??{}}function T8(e,{relative:t}={}){let{matches:r}=Fr.useContext(Kh),{pathname:n}=yi(),o=JSON.stringify(wde(r));return Fr.useMemo(()=>dX(e,JSON.parse(o),n,t==="path"),[e,o,n,t])}function Bwt(e,t){return $wt(e,t)}function $wt(e,t,r){Wn(m_(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=Fr.useContext(Dd),{matches:o}=Fr.useContext(Kh),i=o[o.length-1],a=i?i.params:{},s=i?i.pathname:"/",l=i?i.pathnameBase:"/",u=i&&i.route;if(g8){let y=u&&u.path||"";Vwt(s,!u||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${y}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
3815
3815
|
|
|
3816
|
-
Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}/*`}">.`)}let d=yi(),f;if(t){let y=typeof t=="string"?Lg(t):t;Wn(l==="/"||y.pathname?.startsWith(l),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${y.pathname}" was given in the \`location\` prop.`),f=y}else f=d;let p=f.pathname||"/",h=p;if(l!=="/"){let y=l.replace(/^\//,"").split("/");h="/"+p.replace(/^\//,"").split("/").slice(y.length).join("/")}let m=r&&r.state.matches.length?r.state.matches.map(y=>Object.assign(y,{route:r.manifest[y.route.id]||y.route})):tMe(e,{pathname:h});g8&&(os(u||m!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),os(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`));let g=Zbn(m&&m.map(y=>Object.assign({},y,{params:Object.assign({},a,y.params),pathname:Ag([l,n.encodeLocation?n.encodeLocation(y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:Ag([l,n.encodeLocation?n.encodeLocation(y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),o,r);return t&&g?Fr.createElement(S8.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...f},navigationType:"POP"}},g):g}function jbn(){let e=Uwt(),t=b8(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:n},i={padding:"2px 4px",backgroundColor:n},a=null;return g8&&(console.error("Error handled by React Router default ErrorBoundary:",e),a=Fr.createElement(Fr.Fragment,null,Fr.createElement("p",null,"\u{1F4BF} Hey developer \u{1F44B}"),Fr.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",Fr.createElement("code",{style:i},"ErrorBoundary")," or"," ",Fr.createElement("code",{style:i},"errorElement")," prop on your route."))),Fr.createElement(Fr.Fragment,null,Fr.createElement("h2",null,"Unexpected Application Error!"),Fr.createElement("h3",{style:{fontStyle:"italic"}},t),r?Fr.createElement("pre",{style:o},r):null,a)}var Ybn=Fr.createElement(jbn,null),Fwt=class extends Fr.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=Wbn(e.digest);r&&(e=r)}let t=e!==void 0?Fr.createElement(Kh.Provider,{value:this.props.routeContext},Fr.createElement(cMe.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?Fr.createElement(Kbn,{error:e},t):t}};Fwt.contextType=Awt;var qDe=new WeakMap;function Kbn({children:e,error:t}){let{basename:r,navigator:n}=Fr.useContext(Dd);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let o=Vbn(t.digest);if(o){let i=qDe.get(t);if(i)throw i;let a=hwt(o.location,r),s=a.absoluteURL||a.to;if(h8(o.location,s,oMe(n),"allow-explicit"),ZDe(s))throw new Error("Invalid redirect location");if(pwt&&!qDe.get(t))if(a.isExternal||o.reloadDocument)window.location.href=s;else{let l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:o.replace}));throw qDe.set(t,l),l}return Fr.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s}`})}}return e}function Xbn({routeContext:e,match:t,children:r}){let n=Fr.useContext(h_);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),Fr.createElement(Kh.Provider,{value:e},r)}function Zbn(e,t=[],r){let n=r?.state;if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,i=n?.errors;if(i!=null){let d=o.findIndex(f=>f.route.id&&i?.[f.route.id]!==void 0);Wn(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,d+1))}let a=!1,s=-1;if(r&&n){a=n.renderFallback;for(let d=0;d<o.length;d++){let f=o[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(s=d),f.route.id){let{loaderData:p,errors:h}=n,m=f.route.loader&&!p.hasOwnProperty(f.route.id)&&(!h||h[f.route.id]===void 0);if(f.route.lazy||m){r.isStatic&&(a=!0),s>=0?o=o.slice(0,s+1):o=[o[0]];break}}}}let l=r?.onError,u=n&&l?(d,f)=>{l(d,{location:n.location,params:n.matches?.[0]?.params??{},pattern:fX(n.matches),errorInfo:f})}:void 0;return o.reduceRight((d,f,p)=>{let h,m=!1,g=null,y=null;n&&(h=i&&f.route.id?i[f.route.id]:void 0,g=f.route.errorElement||Ybn,a&&(s<0&&p===0?(Vwt("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),m=!0,y=null):s===p&&(m=!0,y=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,p+1)),b=()=>{let x;return h?x=g:m?x=y:f.route.Component?x=Fr.createElement(f.route.Component,null):f.route.element?x=f.route.element:x=d,Fr.createElement(Xbn,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:x})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?Fr.createElement(Fwt,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:u}):b()},null)}function dMe(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zwt(e){let t=Fr.useContext(h_);return Wn(t,dMe(e)),t}function kde(e){let t=Fr.useContext(WP);return Wn(t,dMe(e)),t}function Qbn(e){let t=Fr.useContext(Kh);return Wn(t,dMe(e)),t}function fMe(e){let t=Qbn(e),r=t.matches[t.matches.length-1];return Wn(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function Jbn(){return fMe("useRouteId")}function Hwt(){let e=kde("useNavigation");return Fr.useMemo(()=>{let{matches:t,historyAction:r,...n}=e.navigation;return n},[e.navigation])}function pMe(){let{matches:e,loaderData:t}=kde("useMatches");return Fr.useMemo(()=>e.map(r=>iwt(r,t)),[e,t])}function Uwt(){let e=Fr.useContext(cMe),t=kde("useRouteError"),r=fMe("useRouteError");return e!==void 0?e:t.errors?.[r]}var exn=0;function hMe(e){let{router:t,basename:r}=zwt("useBlocker"),n=kde("useBlocker"),[o,i]=Fr.useState(""),a=Fr.useCallback(s=>{if(typeof e!="function")return!!e;if(r==="/")return e(s);let{currentLocation:l,nextLocation:u,historyAction:d}=s;return e({currentLocation:{...l,pathname:vf(l.pathname,r)||l.pathname},nextLocation:{...u,pathname:vf(u.pathname,r)||u.pathname},historyAction:d})},[r,e]);return Fr.useEffect(()=>{let s=String(++exn);return i(s),()=>t.deleteBlocker(s)},[t]),Fr.useEffect(()=>{o!==""&&t.getBlocker(o,a)},[t,o,a]),o&&n.blockers.has(o)?n.blockers.get(o):UP}function txn(){let{router:e}=zwt("useNavigate"),t=fMe("useNavigate"),r=Fr.useRef(!1);return Nwt(()=>{r.current=!0}),Fr.useCallback(async(o,i={})=>{os(r.current,Mwt),r.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var jTt={};function Vwt(e,t,r){!t&&!jTt[e]&&(jTt[e]=!0,os(!1,r))}var YTt={};function KTt(e,t){!e&&!YTt[t]&&(YTt[t]=!0,console.warn(t))}var rxn="useOptimistic",XTt=dn[rxn],nxn=()=>{};function oxn(e){return XTt?XTt(e):[e,nxn]}function Wwt(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(g8&&e.element&&os(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:dn.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(g8&&e.hydrateFallbackElement&&os(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:dn.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(g8&&e.errorElement&&os(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:dn.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var Gwt=["HydrateFallback","hydrateFallbackElement"];var ixn=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",e(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",t(r))}})}};function mMe({router:e,flushSync:t,onError:r,useTransitions:n}){n=Lwt()||n;let[i,a]=dn.useState(e.state),[s,l]=oxn(i),[u,d]=dn.useState(),[f,p]=dn.useState({isTransitioning:!1}),[h,m]=dn.useState(),[g,y]=dn.useState(),[v,b]=dn.useState(),x=dn.useRef(new Map),w=dn.useCallback((E,{deletedFetchers:D,newErrors:N,flushSync:$,viewTransitionOpts:P})=>{N&&r&&Object.values(N).forEach(L=>r(L,{location:E.location,params:E.matches[0]?.params??{},pattern:fX(E.matches)})),E.fetchers.forEach((L,I)=>{L.data!==void 0&&x.current.set(I,L.data)}),D.forEach(L=>x.current.delete(L)),KTt($===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let A=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(KTt(P==null||A,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!P||!A){t&&$?t(()=>a(E)):n===!1?a(E):dn.startTransition(()=>{n===!0&&l(L=>ZTt(L,E)),a(E)});return}if(t&&$){t(()=>{g&&(h?.resolve(),g.skipTransition()),p({isTransitioning:!0,flushSync:!0,currentLocation:P.currentLocation,nextLocation:P.nextLocation})});let L=e.window.document.startViewTransition(()=>{t(()=>a(E))});L.finished.finally(()=>{t(()=>{m(void 0),y(void 0),d(void 0),p({isTransitioning:!1})})}),t(()=>y(L));return}g?(h?.resolve(),g.skipTransition(),b({state:E,currentLocation:P.currentLocation,nextLocation:P.nextLocation})):(d(E),p({isTransitioning:!0,flushSync:!1,currentLocation:P.currentLocation,nextLocation:P.nextLocation}))},[e.window,t,g,h,n,l,r]);dn.useLayoutEffect(()=>e.subscribe(w),[e,w]),dn.useEffect(()=>{f.isTransitioning&&!f.flushSync&&m(new ixn)},[f]),dn.useEffect(()=>{if(h&&u&&e.window){let E=u,D=h.promise,N=e.window.document.startViewTransition(async()=>{n===!1?a(E):dn.startTransition(()=>{n===!0&&l($=>ZTt($,E)),a(E)}),await D});N.finished.finally(()=>{m(void 0),y(void 0),d(void 0),p({isTransitioning:!1})}),y(N)}},[u,h,e.window,n,l]),dn.useEffect(()=>{h&&u&&s.location.key===u.location.key&&h.resolve()},[h,g,s.location,u]),dn.useEffect(()=>{!f.isTransitioning&&v&&(d(v.state),p({isTransitioning:!0,flushSync:!1,currentLocation:v.currentLocation,nextLocation:v.nextLocation}),b(void 0))},[f.isTransitioning,v]);let C=dn.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:E=>e.navigate(E),push:(E,D,N)=>e.navigate(E,{state:D,preventScrollReset:N?.preventScrollReset}),replace:(E,D,N)=>e.navigate(E,{replace:!0,state:D,preventScrollReset:N?.preventScrollReset})}),[e]),k=e.basename||"/",_=dn.useMemo(()=>({router:e,navigator:C,static:!1,basename:k,onError:r}),[e,C,k,r]);return dn.createElement(dn.Fragment,null,dn.createElement(h_.Provider,{value:_},dn.createElement(WP.Provider,{value:s},dn.createElement(lMe.Provider,{value:x.current},dn.createElement(Cde.Provider,{value:f},dn.createElement(yMe,{basename:k,location:s.location,navigationType:s.historyAction,navigator:C,useTransitions:n},dn.createElement(axn,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:r})))))),null)}function ZTt(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var axn=dn.memo(sxn);function sxn({routes:e,manifest:t,future:r,state:n,isStatic:o,onError:i}){return $wt(e,void 0,{manifest:t,state:n,isStatic:o,onError:i,future:r})}function pX({to:e,replace:t,state:r,relative:n}){Wn(m_(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o,navigator:i}=dn.useContext(Dd);os(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=dn.useContext(Kh),{pathname:s}=yi(),l=sn(),u=dX(e,wde(a),s,n==="path");h8(typeof e=="string"?e:Id(e),i.createHref(u),oMe(i),"reject");let d=JSON.stringify(u);return dn.useEffect(()=>{l(JSON.parse(d),{replace:t,state:r,relative:n})},[l,d,n,t,r]),null}function gMe(e){return Owt(e.context)}function Go(e){Wn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function yMe({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:o,static:i=!1,useTransitions:a}){Wn(!m_(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=dn.useMemo(()=>({basename:s,navigator:o,static:i,useTransitions:a,future:{}}),[s,o,i,a]);typeof r=="string"&&(r=Lg(r));let{pathname:u="/",search:d="",hash:f="",state:p=null,key:h="default",mask:m}=r,g=dn.useMemo(()=>{let y=vf(u,s);return y==null?null:{location:{pathname:y,search:d,hash:f,state:p,key:h,mask:m},navigationType:n}},[s,u,d,f,p,h,n,m]);return os(g!=null,`<Router basename="${s}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:dn.createElement(Dd.Provider,{value:l},dn.createElement(S8.Provider,{children:t,value:g}))}function AS({children:e,location:t}){return Bwt(bde(e),t)}function bde(e,t=[]){let r=[];return dn.Children.forEach(e,(n,o)=>{if(!dn.isValidElement(n))return;let i=[...t,o];if(n.type===dn.Fragment){r.push.apply(r,bde(n.props.children,i));return}Wn(n.type===Go,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Wn(!n.props.index||!n.props.children,"An index route cannot have child routes.");let a={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(a.children=bde(n.props.children,i)),r.push(a)}),r}var yde="get",vde="application/x-www-form-urlencoded";function _de(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function lxn(e){return _de(e)&&e.tagName.toLowerCase()==="button"}function cxn(e){return _de(e)&&e.tagName.toLowerCase()==="form"}function uxn(e){return _de(e)&&e.tagName.toLowerCase()==="input"}function dxn(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function fxn(e,t){return e.button===0&&(!t||t==="_self")&&!dxn(e)}function xde(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(o=>[r,o]):[[r,n]])},[]))}function pxn(e,t){let r=xde(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(i=>{r.append(o,i)})}),r}var fde=null;function hxn(){if(fde===null)try{new FormData(document.createElement("form"),0),fde=!1}catch{fde=!0}return fde}var mxn=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function jDe(e){return e!=null&&!mxn.has(e)?(os(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${vde}"`),null):e}function gxn(e,t){let r,n,o,i,a;if(cxn(e)){let s=e.getAttribute("action");n=s?vf(s,t):null,r=e.getAttribute("method")||yde,o=jDe(e.getAttribute("enctype"))||vde,i=new FormData(e)}else if(lxn(e)||uxn(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||s.getAttribute("action");if(n=l?vf(l,t):null,r=e.getAttribute("formmethod")||s.getAttribute("method")||yde,o=jDe(e.getAttribute("formenctype"))||jDe(s.getAttribute("enctype"))||vde,i=new FormData(s,e),!hxn()){let{name:u,type:d,value:f}=e;if(d==="image"){let p=u?`${u}.`:"";i.append(`${p}x`,"0"),i.append(`${p}y`,"0")}else u&&i.append(u,f)}}else{if(_de(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=yde,n=null,o=vde,a=e}return i&&o==="text/plain"&&(a=i,i=void 0),{action:n,method:r.toLowerCase(),encType:o,formData:i,body:a}}var oPi=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var yxn={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},vxn=/[&><\u2028\u2029]/g;function QTt(e){return e.replace(vxn,t=>yxn[t])}function bMe(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function qwt(e,t,r,n){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${n}`:o.pathname=`${o.pathname}.${n}`:o.pathname==="/"?o.pathname=`_root.${n}`:t&&vf(o.pathname,t)==="/"?o.pathname=`${v8(t)}/_root.${n}`:o.pathname=`${v8(o.pathname)}.${n}`,o}async function bxn(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){if(console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode&&Vxn.hot)throw r;return window.location.reload(),new Promise(()=>{})}}function xxn(e){return e!=null&&typeof e.page=="string"}function Sxn(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Txn(e,t,r){let n=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let a=await bxn(i,r);return a.links?a.links():[]}return[]}));return _xn(n.flat(1).filter(Sxn).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function JTt(e,t,r,n,o,i){let a=(l,u)=>r[u]?l.route.id!==r[u].route.id:!0,s=(l,u)=>r[u].pathname!==l.pathname||r[u].route.path?.endsWith("*")&&r[u].params["*"]!==l.params["*"];return i==="assets"?t.filter((l,u)=>a(l,u)||s(l,u)):i==="data"?t.filter((l,u)=>{let d=n.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(a(l,u)||s(l,u))return!0;if(l.route.shouldRevalidate){let f=l.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function wxn(e,t,{includeHydrateFallback:r}={}){return Cxn(e.map(n=>{let o=t.routes[n.route.id];if(!o)return[];let i=[o.module];return o.clientActionModule&&(i=i.concat(o.clientActionModule)),o.clientLoaderModule&&(i=i.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(i=i.concat(o.hydrateFallbackModule)),o.imports&&(i=i.concat(o.imports)),i}).flat(1))}function Cxn(e){return[...new Set(e)]}function kxn(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function _xn(e,t){let r=new Set,n=new Set(t);return e.reduce((o,i)=>{if(t&&!xxn(i)&&i.as==="script"&&i.href&&n.has(i.href))return o;let s=JSON.stringify(kxn(i));return r.has(s)||(r.add(s),o.push({key:s,link:i})),o},[])}function xMe(){let e=Oo.useContext(h_);return bMe(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Axn(){let e=Oo.useContext(WP);return bMe(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var hX=Oo.createContext(void 0);hX.displayName="FrameworkContext";function Ede(){let e=Oo.useContext(hX);return bMe(e,"You must render this element inside a <HydratedRouter> element"),e}function Lxn(e,t){let r=Oo.useContext(hX),[n,o]=Oo.useState(!1),[i,a]=Oo.useState(!1),{onFocus:s,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=Oo.useRef(null);Oo.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let g=v=>{v.forEach(b=>{a(b.isIntersecting)})},y=new IntersectionObserver(g,{threshold:.5});return p.current&&y.observe(p.current),()=>{y.disconnect()}}},[e]),Oo.useEffect(()=>{if(n){let g=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(g)}}},[n]);let h=()=>{o(!0)},m=()=>{o(!1),a(!1)};return r?e!=="intent"?[i,p,{}]:[i,p,{onFocus:iX(s,h),onBlur:iX(l,m),onMouseEnter:iX(u,h),onMouseLeave:iX(d,m),onTouchStart:iX(f,h)}]:[!1,p,{}]}function iX(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Ywt({page:e,...t}){let r=Lwt(),{nonce:n}=Ede(),{router:o}=xMe(),i=Oo.useMemo(()=>tMe(o.routes,e,o.basename),[o.routes,e,o.basename]);return i?(t.nonce==null&&n&&(t={...t,nonce:n}),r?Oo.createElement(Dxn,{page:e,matches:i,...t}):Oo.createElement(Mxn,{page:e,matches:i,...t})):null}function Ixn(e){let{manifest:t,routeModules:r}=Ede(),[n,o]=Oo.useState([]);return Oo.useEffect(()=>{let i=!1;return Txn(e,t,r).then(a=>{i||o(a)}),()=>{i=!0}},[e,t,r]),n}function Dxn({page:e,matches:t,...r}){let n=yi(),{future:o}=Ede(),{basename:i}=xMe(),a=Oo.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let s=qwt(e,i,o.v8_trailingSlashAwareDataRequests,"rsc"),l=!1,u=[];for(let d of t)typeof d.route.shouldRevalidate=="function"?l=!0:u.push(d.route.id);return l&&u.length>0&&s.searchParams.set("_routes",u.join(",")),[s.pathname+s.search]},[i,o.v8_trailingSlashAwareDataRequests,e,n,t]);return Oo.createElement(Oo.Fragment,null,a.map(s=>Oo.createElement("link",{key:s,rel:"prefetch",as:"fetch",href:s,...r})))}function Mxn({page:e,matches:t,...r}){let n=yi(),{future:o,manifest:i,routeModules:a}=Ede(),{basename:s}=xMe(),{loaderData:l,matches:u}=Axn(),d=Oo.useMemo(()=>JTt(e,t,u,i,n,"data"),[e,t,u,i,n]),f=Oo.useMemo(()=>JTt(e,t,u,i,n,"assets"),[e,t,u,i,n]),p=Oo.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let g=new Set,y=!1;if(t.forEach(b=>{let x=i.routes[b.route.id];!x||!x.hasLoader||(!d.some(w=>w.route.id===b.route.id)&&b.route.id in l&&a[b.route.id]?.shouldRevalidate||x.hasClientLoader?y=!0:g.add(b.route.id))}),g.size===0)return[];let v=qwt(e,s,o.v8_trailingSlashAwareDataRequests,"data");return y&&g.size>0&&v.searchParams.set("_routes",t.filter(b=>g.has(b.route.id)).map(b=>b.route.id).join(",")),[v.pathname+v.search]},[s,o.v8_trailingSlashAwareDataRequests,l,n,i,d,t,e,a]),h=Oo.useMemo(()=>wxn(f,i),[f,i]),m=Ixn(f);return Oo.createElement(Oo.Fragment,null,p.map(g=>Oo.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...r})),h.map(g=>Oo.createElement("link",{key:g,rel:"modulepreload",href:g,...r})),m.map(({key:g,link:y})=>Oo.createElement("link",{key:g,nonce:r.nonce,...y,crossOrigin:y.crossOrigin??r.crossOrigin})))}function Nxn(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var Oxn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Oxn&&(window.__reactRouterVersion="7.18.5")}catch{}function SMe(e,t){return Swt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:nwt({window:t?.window}),hydrationData:t?.hydrationData||Bxn(),routes:e,mapRouteProperties:Wwt,hydrationRouteProperties:Gwt,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function Bxn(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:$xn(e.errors)}),e}function $xn(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,o]of t)if(o&&o.__type==="RouteErrorResponse")r[n]=new x8(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(typeof o.__subType=="string"&&tbn.includes(o.__subType)){let i=window[o.__subType];if(typeof i=="function")try{let a=new i(o.message);a.stack="",r[n]=a}catch{}}if(r[n]==null){let i=new Error(o.message);i.stack="",r[n]=i}}else r[n]=o;return r}function Kwt({basename:e,children:t,history:r,useTransitions:n}){let[o,i]=fn.useState({action:r.action,location:r.location}),a=fn.useCallback(s=>{n===!1?i(s):fn.startTransition(()=>i(s))},[n]);return fn.useLayoutEffect(()=>r.listen(a),[r,a]),fn.createElement(yMe,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:r,useTransitions:n})}Kwt.displayName="unstable_HistoryRouter";var va=fn.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:o,reloadDocument:i,replace:a,mask:s,state:l,target:u,to:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:h,...m},g){let{basename:y,navigator:v,useTransitions:b}=fn.useContext(Dd),x=typeof d=="string"&&Sde.test(d),w=hwt(d,y);d=w.to;let C=Dwt(d,{relative:o}),k=yi(),_=null;if(s){let I=dX(s,[],k.mask?k.mask.pathname:"/",!0);y!=="/"&&(I.pathname=I.pathname==="/"?y:Ag([y,I.pathname])),_=v.createHref(I)}let[E,D,N]=Lxn(n,m),$=eCt(d,{replace:a,mask:s,state:l,target:u,preventScrollReset:f,relative:o,viewTransition:p,defaultShouldRevalidate:h,useTransitions:b});function P(I){t&&t(I),I.defaultPrevented||$(I)}let A=!(w.isExternal||i),L=fn.createElement("a",{...m,...N,href:(A?_:void 0)||w.absoluteURL||C,onClick:A?P:t,ref:Nxn(g,D),target:u,"data-discover":!x&&r==="render"?"true":void 0});return E&&!x?fn.createElement(fn.Fragment,null,L,fn.createElement(Ywt,{page:C})):L});va.displayName="Link";var Xwt=fn.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:o=!1,style:i,to:a,viewTransition:s,children:l,...u},d){let f=T8(a,{relative:u.relative}),p=yi(),h=fn.useContext(WP),{navigator:m,basename:g}=fn.useContext(Dd),y=h!=null&&oCt(f)&&s===!0,v=m.encodeLocation?m.encodeLocation(f).pathname:f.pathname,b=p.pathname,x=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;r||(b=b.toLowerCase(),x=x?x.toLowerCase():null,v=v.toLowerCase()),x&&g&&(x=vf(x,g)||x);let w=v!=="/"&&v.endsWith("/")?v.length-1:v.length,C=b===v||!o&&b.startsWith(v)&&b.charAt(w)==="/",k=x!=null&&(x===v||!o&&x.startsWith(v)&&x.charAt(v.length)==="/"),_={isActive:C,isPending:k,isTransitioning:y},E=C?t:void 0,D;typeof n=="function"?D=n(_):D=[n,C?"active":null,k?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let N=typeof i=="function"?i(_):i;return fn.createElement(va,{...u,"aria-current":E,className:D,ref:d,style:N,to:a,viewTransition:s},typeof l=="function"?l(_):l)});Xwt.displayName="NavLink";var Zwt=fn.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:o,state:i,method:a=yde,action:s,onSubmit:l,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...h},m)=>{let{useTransitions:g}=fn.useContext(Dd),y=tCt(),v=rCt(s,{relative:u}),b=a.toLowerCase()==="get"?"get":"post",x=typeof s=="string"&&Sde.test(s);return fn.createElement("form",{ref:m,method:b,action:v,onSubmit:n?l:C=>{if(l&&l(C),C.defaultPrevented)return;C.preventDefault();let k=C.nativeEvent.submitter,_=k?.getAttribute("formmethod")||a,E=()=>y(k||C.currentTarget,{fetcherKey:t,method:_,navigate:r,replace:o,state:i,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p});g&&r!==!1?fn.startTransition(()=>E()):E()},...h,"data-discover":!x&&e==="render"?"true":void 0})});Zwt.displayName="Form";function Qwt({getKey:e,storageKey:t,...r}){let n=fn.useContext(hX),{basename:o}=fn.useContext(Dd),i=yi(),a=pMe();nCt({getKey:e,storageKey:t});let s=fn.useMemo(()=>{if(!n||!e)return null;let u=eMe(i,a,o,e);return u!==i.key?u:null},[]);if(!n||n.isSpaMode)return null;let l=((u,d)=>{if(!window.history.state||!window.history.state.key){let f=Math.random().toString(32).slice(2);window.history.replaceState({key:f},"")}try{let p=JSON.parse(sessionStorage.getItem(u)||"{}")[d||window.history.state.key];typeof p=="number"&&window.scrollTo(0,p)}catch(f){console.error(f),sessionStorage.removeItem(u)}}).toString();return r.nonce==null&&n?.nonce&&(r.nonce=n.nonce),fn.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${l})(${QTt(JSON.stringify(t||JDe))}, ${QTt(JSON.stringify(s))})`}})}Qwt.displayName="ScrollRestoration";function Jwt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function TMe(e){let t=fn.useContext(h_);return Wn(t,Jwt(e)),t}function Fxn(e){let t=fn.useContext(WP);return Wn(t,Jwt(e)),t}function eCt(e,{target:t,replace:r,mask:n,state:o,preventScrollReset:i,relative:a,viewTransition:s,defaultShouldRevalidate:l,useTransitions:u}={}){let d=sn(),f=yi(),p=T8(e,{relative:a});return fn.useCallback(h=>{if(fxn(h,t)){h.preventDefault();let m=r!==void 0?r:Id(f)===Id(p),g=()=>d(e,{replace:m,mask:n,state:o,preventScrollReset:i,relative:a,viewTransition:s,defaultShouldRevalidate:l});u?fn.startTransition(()=>g()):g()}},[f,d,p,r,n,o,t,e,i,a,s,l,u])}function gl(e){os(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=fn.useRef(xde(e)),r=fn.useRef(!1),n=yi(),o=fn.useMemo(()=>pxn(n.search,r.current?null:t.current),[n.search]),i=sn(),a=fn.useCallback((s,l)=>{let u=xde(typeof s=="function"?s(new URLSearchParams(o)):s);r.current=!0,i("?"+u,l)},[i,o]);return[o,a]}var zxn=0,Hxn=()=>`__${String(++zxn)}__`;function tCt(){let{router:e}=TMe("useSubmit"),{basename:t}=fn.useContext(Dd),r=Jbn(),n=e.fetch,o=e.navigate;return fn.useCallback(async(i,a={})=>{let{action:s,method:l,encType:u,formData:d,body:f}=gxn(i,t);if(a.navigate===!1){let p=a.fetcherKey||Hxn();await n(p,r,a.action||s,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:f,formMethod:a.method||l,formEncType:a.encType||u,flushSync:a.flushSync})}else await o(a.action||s,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:f,formMethod:a.method||l,formEncType:a.encType||u,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[n,o,t,r])}function rCt(e,{relative:t}={}){let{basename:r}=fn.useContext(Dd),n=fn.useContext(Kh);Wn(n,"useFormAction must be used inside a RouteContext");let[o]=n.matches.slice(-1),i={...T8(e||".",{relative:t})},a=yi();if(e==null){i.search=a.search;let s=new URLSearchParams(i.search),l=s.getAll("index");if(l.some(d=>d==="")){s.delete("index"),l.filter(f=>f).forEach(f=>s.append("index",f));let d=s.toString();i.search=d?`?${d}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(i.pathname=i.pathname==="/"?r:Ag([r,i.pathname])),Id(i)}var JDe="react-router-scroll-positions",pde={};function eMe(e,t,r,n){let o=null;return n&&(r!=="/"?o=n({...e,pathname:vf(e.pathname,r)||e.pathname},t):o=n(e,t)),o==null&&(o=e.key),o}function nCt({getKey:e,storageKey:t}={}){let{router:r}=TMe("useScrollRestoration"),{restoreScrollPosition:n,preventScrollReset:o}=Fxn("useScrollRestoration"),{basename:i}=fn.useContext(Dd),a=yi(),s=pMe(),l=Hwt();fn.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),Uxn(fn.useCallback(()=>{if(l.state==="idle"){let u=eMe(a,s,i,e);pde[u]=window.scrollY}try{sessionStorage.setItem(t||JDe,JSON.stringify(pde))}catch(u){os(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${u}).`)}window.history.scrollRestoration="auto"},[l.state,e,i,a,s,t])),typeof document<"u"&&(fn.useLayoutEffect(()=>{try{let u=sessionStorage.getItem(t||JDe);u&&(pde=JSON.parse(u))}catch{}},[t]),fn.useLayoutEffect(()=>{let u=r?.enableScrollRestoration(pde,()=>window.scrollY,e?(d,f)=>eMe(d,f,i,e):void 0);return()=>u&&u()},[r,i,e]),fn.useLayoutEffect(()=>{if(n!==!1){if(typeof n=="number"){window.scrollTo(0,n);return}try{if(a.hash){let u=document.getElementById(decodeURIComponent(a.hash.slice(1)));if(u){u.scrollIntoView();return}}}catch{os(!1,`"${a.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}o!==!0&&window.scrollTo(0,0)}},[a,n,o]))}function Uxn(e,t){let{capture:r}=t||{};fn.useEffect(()=>{let n=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,n),()=>{window.removeEventListener("pagehide",e,n)}},[e,r])}function oCt(e,{relative:t}={}){let r=fn.useContext(Cde);Wn(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=TMe("useViewTransitionState"),o=T8(e,{relative:t});if(!r.isTransitioning)return!1;let i=vf(r.currentLocation.pathname,n)||r.currentLocation.pathname,a=vf(r.nextLocation.pathname,n)||r.nextLocation.pathname;return y8(o.pathname,a)!=null||y8(o.pathname,i)!=null}var WQr=S(ie(),1);var Rde=S(ie(),1),wMe=(0,Rde.createContext)({nodes:null,transfer:()=>{},cancel:()=>{}});function Pde(){return(0,Rde.useContext)(wMe)}var aCt=S(R(),1);function g_({inputRef:e,value:t,onChange:r,onKeyDown:n,placeholder:o,autoFocus:i}){return(0,aCt.jsx)(xn,{autoFocus:i,inputRef:e,value:t,onChange:a=>r(a.target.value),onKeyDown:n,placeholder:o,size:"small",fullWidth:!0,slotProps:{input:{sx:{fontSize:12}}},sx:{p:.5}})}var LS=S(ie(),1),uCt=S(R(),1),sCt=(0,LS.createContext)({query:"",setQuery:()=>{},viewedTerm:"",setViewedTerm:()=>{}});function lCt({children:e}){let[t,r]=(0,LS.useState)(""),[n,o]=(0,LS.useState)(""),i=(0,LS.useMemo)(()=>({query:t,setQuery:r,viewedTerm:n,setViewedTerm:o}),[t,n]);return(0,uCt.jsx)(sCt.Provider,{value:i,children:e})}function mX(){return(0,LS.useContext)(sCt)}function cCt(){let{query:e,viewedTerm:t}=mX();return e.trim()?t:""}var dCt=S(R(),1),Iy=ot((0,dCt.jsx)("path",{d:"M8 5v14l11-7z"}),"PlayArrow");function Ade(e){return{display:"block",width:"100%",textAlign:"left",p:"5px 10px",borderRadius:0,bgcolor:e?"action.selected":"background.default",borderLeft:2,borderLeftColor:e?"primary.main":"transparent",cursor:e?"default":"pointer",transition:"background 0.15s","&:hover":e?void 0:{bgcolor:"action.hover"}}}var TAi=S(ie(),1);var fCt=S(R(),1),Lde=ot((0,fCt.jsx)("path",{d:"M12 1.27a11 11 0 00-3.48 21.46c.55.09.73-.28.73-.55v-1.84c-3.03.64-3.67-1.46-3.67-1.46-.55-1.29-1.28-1.65-1.28-1.65-.92-.65.1-.65.1-.65 1.1 0 1.73 1.1 1.73 1.1.92 1.65 2.57 1.2 3.21.92a2 2 0 01.64-1.47c-2.47-.27-5.04-1.19-5.04-5.5 0-1.1.46-2.1 1.2-2.84a3.76 3.76 0 010-2.93s.91-.28 3.11 1.1c1.8-.49 3.7-.49 5.5 0 2.1-1.38 3.02-1.1 3.02-1.1a3.76 3.76 0 010 2.93c.83.74 1.2 1.74 1.2 2.94 0 4.21-2.57 5.13-5.04 5.4.45.37.82.92.82 2.02v3.03c0 .27.1.64.73.55A11 11 0 0012 1.27"}),"GitHub");var Wxn=/^([^/\s]+)\/([^/\s]+)#(\d+)$/;function Ide(e){let t=Wxn.exec(e);if(!t)return;let[,r,n,o]=t;return`https://github.com/${r}/${n}/issues/${o}`}var Gxn=/^[^/\s]+\/[^/\s]+#(\d+)$/;function pCt(e){let t=Gxn.exec(e);return t?`#${t[1]}`:e}var qxn=/^([^/\s]+)\/([^/\s]+)#(\d+)$/;function hCt(e,t){let r=qxn.exec(e);if(!r||!t)return e;let[,n,o,i]=r;return`github.com/${n}/${o}`.toLowerCase()===t.toLowerCase()?`#${i}`:e}var CMe=S(R(),1),mCt={height:18,fontSize:"0.65rem"};function gCt({label:e,url:t,title:r}){return t?(0,CMe.jsx)(zn,{label:e,title:r,size:"small",sx:mCt,clickable:!0,component:"a",href:t,target:"_blank",rel:"noopener",onClick:n=>n.stopPropagation()}):(0,CMe.jsx)(zn,{label:e,title:r,size:"small",sx:mCt,clickable:!1,onClick:n=>n.stopPropagation()})}var w8=S(R(),1),yCt={display:"inline-flex",alignItems:"center",gap:.375,whiteSpace:"nowrap","& svg":{fontSize:14}};function vCt({icon:e,label:t,title:r,url:n}){return n?(0,w8.jsx)(pr,{title:r,children:(0,w8.jsxs)(Xr,{href:n,target:"_blank",rel:"noopener",underline:"hover",sx:yCt,children:[e,t]})}):(0,w8.jsx)(pr,{title:r,children:(0,w8.jsxs)(W,{component:"span",sx:{...yCt,color:"text.disabled"},children:[e,t]})})}var xCt=S(R(),1),jxn={color:"primary.main",opacity:.85,whiteSpace:"nowrap"};function bCt({label:e,url:t,title:r}){return t?(0,xCt.jsx)(Xr,{href:t,title:r,target:"_blank",rel:"noopener",underline:"hover",sx:jxn,onMouseDown:n=>n.stopPropagation(),onClick:n=>n.stopPropagation(),children:e}):e}var C8=S(R(),1),SCt={fontSize:"0.875rem"};function Dde({label:e,url:t,variant:r="link",icon:n,title:o}){return r==="chip"?(0,C8.jsx)(gCt,{label:e,url:t,title:o}):r==="token"?(0,C8.jsx)(bCt,{label:e,url:t,title:o}):r==="icon"?(0,C8.jsx)(vCt,{icon:n,label:e,title:o??e,url:t}):t?(0,C8.jsx)(Xr,{href:t,target:"_blank",rel:"noopener",onClick:i=>i.stopPropagation(),sx:SCt,children:e}):(0,C8.jsx)(Te,{variant:"body2",color:"text.disabled",sx:SCt,children:e})}var kMe=S(R(),1);function y_({githubIssue:e,origin:t,variant:r="link"}){return e?(0,kMe.jsx)(Dde,{label:r==="link"?hCt(e,t):pCt(e),title:e,url:Ide(e),icon:(0,kMe.jsx)(Lde,{}),variant:r}):null}var Mde=S(ie(),1);function TCt(){let[e,t]=(0,Mde.useState)(null);return(0,Mde.useEffect)(()=>{let r=!1;return(async()=>{try{let o=await(await fetch("/api/jira-site")).json();r||t(o?.site??null)}catch{r||t(null)}})(),()=>{r=!0}},[]),e}var wCt=S(R(),1);function k8({jiraKey:e,variant:t="link"}){let r=TCt();if(!e)return null;let n=r?`https://${r}/browse/${e}`:void 0;return(0,wCt.jsx)(Dde,{label:e,url:n,variant:t})}var _Me=S(R(),1);function Nde({tracker:e,variant:t="link"}){return e?.jiraKey?(0,_Me.jsx)(k8,{jiraKey:e.jiraKey,variant:t}):e?.githubIssue?(0,_Me.jsx)(y_,{githubIssue:e.githubIssue,origin:e.origin,variant:t}):null}var EMe=class extends Error{constructor(){super(...arguments);gr(this,"name","InvalidItemIdError")}};function gn(e){return`a${e}`}var Yxn=/^a?(\d+)$/;function _8(e){let t=Yxn.exec(e.trim());if(!t)throw new EMe(`Invalid backlog item id "${e}" (e.g. a574 or 574).`);return Number.parseInt(t[1],10)}function Yr(e,t){if(!t)return e;let r=e.includes("?")?"&":"?";return`${e}${r}node=${encodeURIComponent(t)}`}function dc(e,t,r){if(!t)return Yr(e,r);let n=e.includes("?")?"&":"?";return Yr(`${e}${n}cwd=${encodeURIComponent(t)}`,r)}function Md(e,t,r){return dc(`/backlog/items/${gn(e)}`,t,t&&r)}function Kxn(e,t){if(t==="neutral")return{color:e.palette.text.secondary,borderColor:e.palette.divider};let{main:r}=e.palette[t];return{color:r,borderColor:Vr(r,.35)}}function bi(e){return t=>({display:"inline-block",fontFamily:t.typography.fontFamilyMono,fontSize:10,fontWeight:400,lineHeight:"16px",px:"5px",border:1,borderRadius:"4px",whiteSpace:"nowrap",opacity:1,...Kxn(t,e)})}var Ode=S(ie(),1),fc=(0,Ode.createContext)(void 0);function br(){return(0,Ode.useContext)(fc)}var kCt=S(R(),1),Xxn=[bi("primary"),{flexShrink:0,textDecoration:"none"}],CCt=e=>e.stopPropagation();function Bde({itemId:e,cwd:t}){let r=br();return(0,kCt.jsx)(W,{component:va,to:Md(e,t,r),onMouseDown:CCt,onClick:CCt,sx:Xxn,children:gn(e)})}var Zxn={claude:"Claude",codex:"Codex",pi:"pi"},Qxn={claude:"Claude Code",codex:"Codex",pi:"pi"};function IS(e){return e??"claude"}function Il(e){return Zxn[IS(e)]}function _Ct(e){return Qxn[IS(e)]}var ECt=S(R(),1),Jxn=bi("neutral");function $de({harness:e}){return IS(e)==="claude"?null:(0,ECt.jsx)(W,{component:"span",sx:Jxn,children:Il(e).toLowerCase()})}var e2n=["update"];function E8(e){return!e||!e2n.includes(e)}function is(e){if(!e)return"";let t=e.split(/[/\\]/).filter(Boolean);return t[t.length-1]??""}function Dy(e){return e.repoGroup?.origin||e.cwd||void 0}function Dl(e){return e.repoGroup?.clone||e.cwd||void 0}function R8(e,t){if(!e)return e;for(let r of t){let n=r.repoGroup;if(n&&(n.clone===e||r.cwd===e))return n.origin}return e}var Hde=S(ie(),1);var RCt="";function RMe(e){RCt=e.replace(/\/+$/,"")}function DS(e){return`${RCt}${e}`}function PCt(e){let t=new URL(DS(e),location.href);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.toString()}var ACt=new WeakSet;function GP(e){typeof e=="object"&&e!==null&&ACt.add(e)}function gX(e){return typeof e=="object"&&e!==null&&ACt.has(e)}var t2n="/api/client-errors",IMe=1e3,r2n=6e4,n2n=1e4,o2n=50,i2n=500,P8=[],PMe,AMe=!1,Fde=IMe;function LMe(e){PMe||AMe||(PMe=setTimeout(()=>{PMe=void 0,s2n()},e))}async function a2n(e){try{return(await fetch(DS(t2n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({failures:e}),signal:AbortSignal.timeout(n2n)})).ok}catch{return!1}}async function s2n(){let e=P8.slice(0,o2n);if(e.length===0)return;AMe=!0;let t=await a2n(e);if(AMe=!1,t){P8=P8.slice(e.length),Fde=IMe,P8.length>0&&LMe(0);return}Fde=Math.min(Fde*2,r2n),LMe(Fde)}function LCt(e){P8=[...P8,e].slice(-i2n),LMe(IMe)}var l2n=100,MMe=[],DMe=new Set;function ICt(e){MMe=e;for(let t of DMe)t()}function A8(e){ICt([e,...MMe].slice(0,l2n)),LCt(e)}function NMe(){return MMe}function DCt(){ICt([])}function MCt(e){return DMe.add(e),()=>{DMe.delete(e)}}function c2n(e){return new URL(e,"http://local").searchParams.get("node")??void 0}function NCt(e,t,r){let n=Date.now();return o=>{r&&A8({at:new Date(n).toISOString(),method:(t??"GET").toUpperCase(),path:e,base:DS("")||location.origin,node:c2n(e),durationMs:Date.now()-n,...o})}}var u2n="x-assist-trace-id";async function d2n(e){try{let t=await e.clone().json();if(t&&typeof t=="object"&&"error"in t){let{error:r}=t;if(typeof r=="string"&&r)return r}}catch{}}async function OCt(e){let t=await d2n(e)??(e.statusText||void 0),r=e.headers?.get(u2n);return r?t?`${t} (trace=${r})`:`trace=${r}`:t}function BCt(e,t){let r=new AbortController,n=()=>r.abort(e?.reason);e?.aborted?n():e?.addEventListener("abort",n,{once:!0});let o=setTimeout(()=>r.abort(new DOMException(`timed out after ${t/1e3}s`,"TimeoutError")),t);return{signal:r.signal,clear:()=>{clearTimeout(o),e?.removeEventListener("abort",n)}}}var f2n=3e4;function p2n(e){return e instanceof DOMException&&e.name==="TimeoutError"}async function er(e,t={}){let{timeoutMs:r=f2n,capture:n=!0,blipGate:o,signal:i,...a}=t,{signal:s,clear:l}=BCt(i,r),u=NCt(e,a.method,n);try{let d=await fetch(DS(e),{...a,signal:s});return d.ok?o?.reset():(o?.shouldRecord(d.status)??!0)&&u({status:d.status,error:await OCt(d)}),d}catch(d){let f=s.aborted?s.reason:d;throw(!s.aborted||p2n(f))&&(u({error:f instanceof Error?f.message:String(f)}),GP(f)),f}finally{l()}}var h2n={error:"ERROR",rejection:"REJECT",caught:"CAUGHT"};function yX(e,t){A8({at:new Date().toISOString(),kind:e,method:h2n[e],path:location.pathname+location.search,base:location.origin,error:t,durationMs:0})}function Pr(e,t){if(gX(e))return;GP(e);let r=e instanceof Error?e.message:String(e);yX("caught",`${t}: ${r}`)}var $Ct=new Map;function zde(e,t){let r=`${t??""}\0${e??""}`,n=$Ct.get(r);return n||(n=(async()=>{let i=await(await er(dc("/api/items",e,t))).json(),a=new Map;for(let s of i)!s.jiraKey&&!s.githubIssue||a.set(s.id,{jiraKey:s.jiraKey,githubIssue:s.githubIssue,origin:s.origin});return a})().catch(o=>(Pr(o,"item trackers"),new Map)),$Ct.set(r,n)),n}function Ude(e){let[t,r]=(0,Hde.useState)(()=>new Map),n=br();return(0,Hde.useEffect)(()=>{let o=!1;return zde(e,n).then(i=>{o||r(i)}),()=>{o=!0}},[e,n]),o=>o==null?void 0:t.get(o)}var OMe=S(R(),1),m2n=bi("neutral");function Vde({node:e}){return e?(0,OMe.jsx)(pr,{title:`Running on ${e}`,children:(0,OMe.jsx)(W,{component:"span",sx:m2n,children:e})}):null}var My=S(R(),1),FCt={height:18,fontSize:"0.65rem"};function zCt({session:e}){let t=E8(e.sessionType)?is(e.cwd):"",r=Ude(e.cwd);return(0,My.jsxs)(My.Fragment,{children:[t&&(0,My.jsx)(zn,{label:t,size:"small",sx:FCt}),(0,My.jsx)($de,{harness:e.harness}),(0,My.jsx)(Vde,{node:e.node}),e.sessionType&&e.sessionType!=="next"&&(0,My.jsx)(zn,{label:e.sessionType,size:"small",color:"primary",variant:"outlined",sx:FCt}),e.itemId!=null&&(0,My.jsx)(Bde,{itemId:e.itemId,cwd:Dl(e)}),(0,My.jsx)(Nde,{variant:"chip",tracker:r(e.itemId)})]})}function wo(e){let t=Date.now()-new Date(e).getTime(),r=Math.floor(t/1e3);if(r<60)return"just now";let n=Math.floor(r/60);if(n<60)return`${n}m ago`;let o=Math.floor(n/60);if(o<24)return`${o}h ago`;let i=Math.floor(o/24);return i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}var HCt=S(R(),1);function na({children:e}){let t=r=>r.stopPropagation();return(0,HCt.jsx)(W,{sx:{display:"contents"},onClick:t,onMouseDown:t,onTouchStart:t,children:e})}var L8=S(ie(),1),g2n=1200;function I8(e){let[t,r]=(0,L8.useState)(!1),n=(0,L8.useRef)(void 0);return(0,L8.useEffect)(()=>()=>clearTimeout(n.current),[]),{copied:t,copy:()=>{navigator.clipboard?.writeText(e).then(()=>{r(!0),clearTimeout(n.current),n.current=setTimeout(()=>r(!1),g2n)})}}}var vX=S(R(),1);function UCt({sessionId:e,harness:t}){let{copied:r,copy:n}=I8(e),o=i=>{i.stopPropagation(),n()};return(0,vX.jsx)(na,{children:(0,vX.jsx)(pr,{title:r?"Copied!":`Copy ${Il(t)} session id`,open:r||void 0,children:(0,vX.jsx)(nr,{onClick:o,sx:{borderRadius:.5,px:.25},children:(0,vX.jsx)(Te,{variant:"caption",color:"text.disabled",sx:{fontFamily:"fontFamilyMono"},children:e.slice(0,8)})})})})}var bX=S(R(),1);function VCt({session:e}){return(0,bX.jsxs)(W,{sx:{display:"flex",alignItems:"center",gap:1,alignSelf:"flex-end"},children:[e.sessionId&&(0,bX.jsx)(UCt,{sessionId:e.sessionId,harness:e.harness}),(0,bX.jsx)(Te,{variant:"caption",color:"text.disabled",children:wo(e.timestamp)})]})}var WCt=S(R(),1);function Wde({children:e}){return(0,WCt.jsx)(W,{component:"mark",sx:{bgcolor:"warning.main",color:"warning.contrastText",borderRadius:.5,px:.25},children:e})}var Gde=S(R(),1);function GCt({snippet:e}){return(0,Gde.jsxs)(Te,{variant:"caption",sx:{color:"text.secondary",overflowWrap:"anywhere"},children:[e.before,(0,Gde.jsx)(Wde,{children:e.match}),e.after]})}function qCt(e){return e.prompt||e.name}var qP=S(R(),1);function jCt({session:e}){return(0,qP.jsxs)(qP.Fragment,{children:[e.title&&(0,qP.jsx)(Te,{variant:"body2",sx:{color:"text.primary",fontWeight:500,overflowWrap:"anywhere"},children:e.title}),(0,qP.jsx)(Te,{variant:e.title?"caption":"body2",sx:{color:e.title?"text.secondary":"text.primary",overflowWrap:"anywhere"},children:qCt(e)})]})}var bf=S(R(),1);function y2n({onResume:e}){return(0,bf.jsx)(Kt,{size:"small",onClick:t=>{t.stopPropagation(),e()},title:"Resume",sx:{color:"text.disabled","&:hover":{color:"text.primary"}},children:(0,bf.jsx)(Iy,{sx:{fontSize:14}})})}function YCt({session:e,selected:t=!1,onView:r,onResume:n}){return(0,bf.jsx)(fc.Provider,{value:e.node,children:(0,bf.jsx)(nr,{onClick:()=>r(e),sx:Ade(t),"aria-current":t||void 0,children:(0,bf.jsxs)(W,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[(0,bf.jsxs)(W,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,bf.jsx)(zCt,{session:e}),(0,bf.jsx)(W,{sx:{flex:1}}),(0,bf.jsx)(na,{children:(0,bf.jsx)(y2n,{onResume:()=>n(e)})})]}),(0,bf.jsx)(jCt,{session:e}),e.snippet&&(0,bf.jsx)(GCt,{snippet:e.snippet}),(0,bf.jsx)(VCt,{session:e})]})})})}var jde=S(R(),1);function qde({sessions:e,viewingId:t,onView:r,onResume:n,empty:o}){return(0,jde.jsxs)(W,{sx:{flex:1,overflow:"auto",p:1},children:[e.map(i=>(0,jde.jsx)(YCt,{session:i,selected:i.sessionId===t,onView:r,onResume:n},i.sessionId)),e.length===0&&o]})}var KCt=S(R(),1);function D8({children:e,color:t="text.disabled"}){return(0,KCt.jsx)(Te,{variant:"caption",color:t,role:"status",sx:{display:"block",textAlign:"center",p:2},children:e})}var M8=S(R(),1);function XCt({search:e,viewingId:t,...r}){return e.status==="loading"?(0,M8.jsx)(D8,{children:"Searching\u2026"}):e.status==="error"?(0,M8.jsxs)(D8,{color:"error.main",children:["Search failed: ",e.message]}):(0,M8.jsx)(qde,{sessions:e.sessions,viewingId:t,empty:(0,M8.jsx)(D8,{children:"No sessions match"}),...r})}var Yde=S(ie(),1);async function ZCt(e,t,r,n){let o=await er(Yr(`/api/history/search?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,r),{signal:n}),i=await o.json().catch(()=>({}));if(!o.ok)throw new Error(i.error??`HTTP ${o.status}`);let a=Array.isArray(i.sessions)?i.sessions:[];return r?a.map(s=>({...s,node:r})):a}var v2n=300;function QCt(e,t,r){let n=r.trim(),[o,i]=(0,Yde.useState)({status:"idle"});return(0,Yde.useEffect)(()=>{if(!e||!n){i({status:"idle"});return}i({status:"loading"});let a=new AbortController,s=setTimeout(()=>{ZCt(e,n,t,a.signal).then(l=>{a.signal.aborted||i({status:"done",sessions:l})},l=>{if(a.signal.aborted)return;let u=l instanceof Error?l.message:String(l);i({status:"error",message:u})})},v2n);return()=>{clearTimeout(s),a.abort()}},[e,t,n]),o}var Kde=S(ie(),1),xX=(0,Kde.createContext)({repos:[],selectedCwd:"",worktreeCwd:"",setSelectedCwd:()=>{},cloneOn:e=>e,originOf:()=>{}});function Gn(){return(0,Kde.useContext)(xX)}var jP=S(R(),1);function JCt({sessions:e,...t}){let{selectedCwd:r,selectedNode:n}=Gn(),{query:o,setQuery:i}=mX(),a=QCt(r,n,o),s=R8(r,e),l=r?e.filter(u=>Dy(u)===s||Dl(u)===r):[];return(0,jP.jsxs)(W,{sx:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[r&&(0,jP.jsx)(g_,{value:o,onChange:i,placeholder:"Search history..."}),a.status==="idle"?(0,jP.jsx)(qde,{sessions:l,empty:(0,jP.jsx)(D8,{children:"No history for this repo"}),...t}):(0,jP.jsx)(XCt,{search:a,...t,onView:u=>t.onView(u,o.trim())})]})}var Skt=S(ie(),1);function ekt(e,t,r){if(e.length===0)return null;let n=t===null?-1:e.indexOf(t);return n===-1?r===1?e[0]:e.at(-1):e[(n+r+e.length)%e.length]}var BMe=null;function Xde(e){BMe=e,e.focus({preventScroll:!0})}function Zde(){let e=globalThis.document;return e.querySelector('[role="dialog"][aria-modal="true"]')?!0:BMe!==null&&e.activeElement===BMe}function Qde(e){let t=globalThis.document.querySelector(`[data-session-id="${e}"]`);t&&Xde(t)}function Jde(e){globalThis.requestAnimationFrame(()=>{globalThis.document.querySelector(`[data-session-id="${e}"]`)?.scrollIntoView({block:"nearest"})})}function efe(e){return e.key==="Tab"&&!e.ctrlKey&&!e.altKey&&!e.metaKey}var YP=S(ie(),1);var tkt="assist:group-collapse",$Me=new Set;function FMe(){try{return localStorage.getItem(tkt)??""}catch{return""}}function zMe(e){if(!e)return{};try{let t=JSON.parse(e);return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([,r])=>r&&typeof r=="object"))}catch{return{}}}function rkt(e){try{localStorage.setItem(tkt,JSON.stringify(e))}catch{}for(let t of $Me)t()}function b2n(e,t){rkt({...zMe(FMe()),[e]:t})}function x2n(e){let t=zMe(FMe()),r=Object.fromEntries(Object.entries(t).filter(([n])=>!e.includes(n)));Object.keys(r).length!==Object.keys(t).length&&rkt(r)}function S2n(e){return $Me.add(e),()=>{$Me.delete(e)}}var MS={getRaw:FMe,parse:zMe,setChoice:b2n,removeChoices:x2n,subscribe:S2n};function N8(){let e=(0,YP.useSyncExternalStore)(MS.subscribe,MS.getRaw),t=(0,YP.useMemo)(()=>MS.parse(e),[e]),r=(0,YP.useCallback)(n=>{let o=t[n];return o!==void 0&&"collapsedAt"in o},[t]);return(0,YP.useMemo)(()=>({isCollapsed:r,setCollapsed:(n,o)=>MS.setChoice(n,o?{collapsedAt:Date.now()}:{openedAt:Date.now()})}),[r])}var NS=S(ie(),1);function T2n(e,t){let r=new URLSearchParams;e&&r.set("q",e),t&&t!=="todo"&&r.set("filter",t);let n=r.toString();return n?`/api/items?${n}`:"/api/items"}async function v_({query:e,cwd:t,node:r,signal:n,filter:o}={}){let i=await er(dc(T2n(e,o),t,r),{signal:n});if(!i.ok){let a=await i.json().catch(()=>null);throw new Error(a?.error??`HTTP ${i.status}`)}return i.json()}function SX(e){let t=e.activity?.itemId;if(!(!e.cwd||e.activity?.kind!=="backlog"||t==null))return{cwd:e.cwd,itemId:t}}function TX(e,t){return`${e}::${t}`}function nkt(e){let t=new Set;for(let r of e){let n=SX(r);n&&t.add(n.cwd)}return[...t].sort()}async function w2n(e){try{return(await v_({cwd:e,filter:"all"})).filter(r=>r.starred).map(r=>TX(e,r.id))}catch(t){return Pr(t,"starred keys"),[]}}async function okt(e){let t=await Promise.all(e.map(w2n));return new Set(t.flat())}var nfe=S(ie(),1);var ikt="/api/backlog/docs-refresh";async function tfe(e,t,r){let n=await er(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)throw new Error(`${t} ${e} failed: ${n.status}`);return n.json()}async function akt(e,t,r){await er(dc(`/api/items/${gn(e)}`,t,r),{method:"DELETE"})}function O8(e,t,r,n){return tfe(dc(`/api/items/${gn(e)}`,r,n),"PATCH",{status:t})}function rfe(e,t,r,n){return tfe(dc(`/api/items/${gn(e)}/star`,r,n),"POST",{starred:t})}function skt(e,t,r,n,o){return tfe(dc(`/api/items/${gn(e)}/rewind`,n,o),"POST",{phase:t,reason:r})}async function lkt(e,t,r){return(await er(dc(ikt,e,t),{signal:r})).json()}function ckt(e,t){return tfe(dc(ikt,e,t),"POST",{})}function C2n(e,t,r){let n=new Set(e);return r?n.add(t):n.delete(t),n}function ukt(e,t){let r=SX(t);return r?e.has(TX(r.cwd,r.itemId)):t.starred??!1}function dkt(e,t,r){let n=SX(r);if(!n){t(r.id,!(r.starred??!1));return}let o=TX(n.cwd,n.itemId);e(i=>{let a=!i.has(o);return rfe(n.itemId,a,n.cwd),C2n(i,o,a)})}function k2n(e,t){let r=!1,n=e?e.split("|"):[];return okt(n).then(o=>{r||t(o)}),()=>{r=!0}}function fkt(e){let[t,r]=(0,nfe.useState)(new Set);return(0,nfe.useEffect)(()=>k2n(e,r),[e]),[t,r]}var hkt=S(R(),1),pkt=(0,NS.createContext)(null);function ofe({sessions:e,setSessionStarred:t,children:r}){let n=nkt(e).join("|"),[o,i]=fkt(n),a=(0,NS.useCallback)(u=>ukt(o,u),[o]),s=(0,NS.useCallback)(u=>dkt(i,t,u),[i,t]),l=(0,NS.useMemo)(()=>({isStarred:a,toggleStar:s}),[a,s]);return(0,hkt.jsx)(pkt.Provider,{value:l,children:r})}function Ig(){let e=(0,NS.useContext)(pkt);if(!e)throw new Error("useStarredSessions must be used within a StarredSessionsProvider");return e}function ife(e){return e.flatMap(t=>t.kind==="single"?[t.session]:t.rows.flatMap(r=>[r.session,...r.children]))}var HMe="assist:group-order";var KP=null;function _2n(){if(KP)return KP;try{let e=JSON.parse(localStorage.getItem(HMe)??"[]");KP=Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}catch{KP=[]}return KP}function E2n(e){KP=e;try{localStorage.setItem(HMe,JSON.stringify(e))}catch{}}function R2n(e,t){let r=e.length-200;return r<=0?e:e.filter(n=>t.has(n)||r--<=0)}function P2n(e){let t=_2n(),r=e.filter(o=>!t.includes(o)),n=r.length>0?R2n([...t,...r],new Set(e)):t;return n!==t&&E2n(n),new Map(n.map((o,i)=>[o,i]))}function A2n(){KP=null;try{localStorage.removeItem(HMe)}catch{}}var mkt={rank:P2n,clear:A2n};function gkt(e){let t=new Map;for(let n of e){let o=Dy(n)??` nogroup:${n.id}`,i=t.get(o);if(i){i.members.push(n);continue}t.set(o,{key:o,label:is(Dl(n)??o),members:[n]})}let r=mkt.rank([...t.keys()]);return[...t.values()].sort((n,o)=>(r.get(n.key)??0)-(r.get(o.key)??0))}function ykt(e){let t=new Map(e.map(o=>[o.id,o])),r=L2n(e),n=new Map;for(let o of e){let i=I2n(o,t)??M2n(o,r);i&&n.set(o,i)}return n}function L2n(e){let t=new Map;for(let r of e){let n=bkt(r);!n||!vkt(r)||t.has(n)||t.set(n,r)}return t}function I2n(e,t){let r=e.launchedFrom?t.get(e.launchedFrom):void 0;if(!(!r||r===e))return D2n(e,r)?r:void 0}function D2n(e,t){return e.cwd!==void 0&&e.cwd===t.cwd}function M2n(e,t){if(vkt(e))return;let r=bkt(e),n=r?t.get(r):void 0;return n===e?void 0:n}function vkt(e){return e.activity?.kind==="backlog"}function bkt(e){let{cwd:t,repoGroup:r}=e;if(!(!t||!r||r.clone===t))return t}function afe(e){let t=ykt(e),r=new Map;for(let i of e){let a=N2n(i,t);a&&r.set(i,a)}let n=new Map,o=[];for(let i of e){if(r.has(i))continue;let a={session:i,children:[]};n.set(i,a),o.push(a)}for(let i of e){let a=r.get(i);a&&n.get(a)?.children.push(i)}return o}function N2n(e,t){let r=new Set([e]),n=t.get(e);for(;n;){if(r.has(n))return;let o=t.get(n);if(!o)return n;r.add(n),n=o}}function UMe(e,t){return[...e.filter(r=>t(r)),...e.filter(r=>!t(r))]}function sfe(e,t,r=2){let n=gkt(e).map(({key:o,label:i,members:a})=>a.length<r?{kind:"single",session:a[0]}:{kind:"repo",key:o,label:i,rows:UMe(afe(a),s=>xkt(s).some(t))});return UMe(n,o=>O2n(o).some(t))}function xkt(e){return[e.session,...e.children]}function O2n(e){return e.kind==="repo"?e.rows.flatMap(xkt):[e.session]}var B2n=()=>!1;function lfe(e,t,r=B2n,n=2){return ife(sfe(e,t,n).filter(o=>o.kind==="single"||!r(o.key)))}function Tkt({sessions:e,onSelect:t}){let{isStarred:r}=Ig(),{isCollapsed:n}=N8();return(0,Skt.useCallback)(o=>{if(!efe(o.nativeEvent))return;let i=o.target.closest("[data-session-id]");if(!i)return;let a=lfe(e,r,n,1).map(u=>u.id),s=i.getAttribute("data-session-id"),l=ekt(a,s,o.shiftKey?-1:1);!l||l===s||(o.preventDefault(),t(l),Qde(l),Jde(l))},[e,r,n,t])}var VMe=S(R(),1),$2n={flex:1,overflow:"auto"},F2n={py:.5};function wkt({sessions:e,onSelect:t,children:r}){let n=Tkt({sessions:e,onSelect:t});return(0,VMe.jsx)(W,{sx:$2n,onKeyDown:n,children:(0,VMe.jsx)(W,{sx:F2n,children:r})})}var kkt=S(R(),1),z2n={display:"block",textAlign:"center",p:2};function Ckt(){return(0,kkt.jsx)(Te,{variant:"caption",color:"text.disabled",sx:z2n,children:"No sessions yet"})}var _kt=S(R(),1),Bo=ot((0,_kt.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var Ekt=S(R(),1),B8=ot((0,Ekt.jsx)("path",{d:"M12 7c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1s-1-.45-1-1V8c0-.55.45-1 1-1m-.01-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m1-3h-2v-2h2z"}),"ErrorOutlineRounded");var _1=S(R(),1),H2n={...Ade(!1),cursor:"default",position:"relative"},U2n={position:"absolute",top:4,right:4,color:"text.disabled","&:hover":{color:"text.primary"}},V2n={display:"flex",alignItems:"center",gap:1,pr:3},W2n={color:"text.primary",overflowWrap:"anywhere"};function G2n(e){return{display:"block",mt:.5,color:e?"error.main":"text.secondary",overflowWrap:"anywhere"}}function q2n(e){return e.node?`Starting session on ${e.node}\u2026`:"Starting session\u2026"}function Rkt({launch:e,onDismiss:t}){let r=e.status==="error";return(0,_1.jsxs)(W,{sx:H2n,children:[(0,_1.jsx)(Kt,{size:"small",onClick:()=>t(e.id),title:"Dismiss",sx:U2n,children:(0,_1.jsx)(Bo,{sx:{fontSize:16}})}),(0,_1.jsxs)(W,{sx:V2n,children:[r?(0,_1.jsx)(B8,{color:"error",sx:{fontSize:18}}):(0,_1.jsx)(mo,{size:16}),(0,_1.jsx)(Te,{variant:"body2",sx:W2n,children:e.title})]}),(0,_1.jsx)(Te,{variant:"caption",sx:G2n(r),children:r?e.error:q2n(e)})]})}function Pkt(e){return new Set(e.filter(t=>t.cwd&&t.cwd===t.repoGroup?.clone).map(t=>t.id))}function WMe(e){return e.commandType==="run"&&e.server===!0&&e.status!=="done"&&e.status!=="error"}function Akt(e){return e.filter(WMe)}var Lkt=S(R(),1),cfe=ot((0,Lkt.jsx)("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"}),"Launch");var ufe=S(ie(),1),GMe=(0,ufe.createContext)({nodes:null,names:[],visible:!1,selected:void 0,select:()=>{}});function Fs(){return(0,ufe.useContext)(GMe)}function Ikt(e,t,r){let n=t&&t!==r?.local?r?.links.find(o=>o.name===t):void 0;return n?{url:`http://${new URL(n.url).hostname}:${e}`,remote:!0}:{url:`http://localhost:${e}`,remote:!1}}var Dkt=S(R(),1);function dfe({port:e,node:t}){let{nodes:r}=Fs(),{url:n,remote:o}=Ikt(e,t,r);return(0,Dkt.jsxs)(Xr,{href:n,title:o?`Opens ${n} on ${t}; the dev server must listen on the tailnet (e.g. --host 0.0.0.0)`:void 0,target:"_blank",rel:"noopener noreferrer",color:"inherit",onMouseDown:i=>i.stopPropagation(),onClick:i=>i.stopPropagation(),children:[":",e]})}var E1=S(R(),1),j2n={display:"flex",alignItems:"center",gap:.5,px:"10px",py:.25,borderRadius:0,borderLeft:2,borderLeftColor:"success.main",bgcolor:"success.dark"},Y2n={flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"success.contrastText"};function Mkt({serving:e,onJump:t}){let r=is(e.cwd),n=r?` \xB7 ${r} \xB7 ${e.name}`:` \xB7 ${e.name}`,o=`${e.port?`serving :${e.port}`:"serving"}${n}`;return(0,E1.jsxs)(W,{sx:j2n,children:[(0,E1.jsxs)(Te,{variant:"caption",title:o,sx:Y2n,children:["serving",e.port?(0,E1.jsxs)(E1.Fragment,{children:[" ",(0,E1.jsx)(dfe,{port:e.port,node:e.node})]}):null,n]}),(0,E1.jsx)(it,{size:"small",startIcon:(0,E1.jsx)(cfe,{sx:{fontSize:14}}),onClick:i=>{i.stopPropagation(),t()},sx:{color:"success.contrastText",minWidth:0},children:"Jump"})]})}var wX=S(R(),1);function Nkt({sessions:e,onJump:t}){let r=Akt(e);return r.length===0?null:(0,wX.jsx)(wX.Fragment,{children:r.map(n=>(0,wX.jsx)(Mkt,{serving:n,onJump:()=>t(n.id)},n.id))})}function Okt(e){return e.flatMap(t=>[t.session,...t.children])}var CX=S(R(),1),K2n={position:"relative","&::before":{content:'""',position:"absolute",left:0,top:"-1px",width:"6px",height:"19.5px",borderLeft:1,borderBottom:1,borderColor:"divider"},"&:not(:last-of-type)::after":{content:'""',position:"absolute",left:0,top:0,bottom:"-1px",borderLeft:1,borderColor:"divider"}},X2n={ml:"13px"};function Bkt({rows:e,renderCard:t}){let r=(n,o,i=!0)=>(0,CX.jsx)(W,{sx:i?K2n:void 0,children:t(n,o)},n.id);return e.map(n=>n.children.length===0?r(n.session,void 0,!1):(0,CX.jsxs)(W,{children:[r(n.session,n.children,!1),(0,CX.jsx)(W,{sx:X2n,children:n.children.map(o=>r(o))})]},n.session.id))}var OS=S(R(),1);function qo({onConfirm:e,onCancel:t,title:r="Confirm deletion",message:n="Are you sure you want to delete this item?",confirmLabel:o="Delete",confirmColor:i="error",busy:a=!1,autoFocusConfirm:s=!1}){return(0,OS.jsxs)(ts,{open:!0,onClose:a?void 0:t,maxWidth:"xs",fullWidth:!0,children:[(0,OS.jsx)(Wc,{children:r}),(0,OS.jsx)(Vc,{children:(0,OS.jsx)(Pk,{children:n})}),(0,OS.jsxs)(Cd,{children:[(0,OS.jsx)(it,{onClick:t,disabled:a,children:"Cancel"}),(0,OS.jsx)(it,{variant:"contained",color:i,onClick:e,loading:a,autoFocus:s,children:o})]})]})}var $kt=S(ie(),1),Z2n="(Shift skips confirmation)";function zs(e,{needsConfirm:t=!0,onOpen:r}={}){let[n,o]=(0,$kt.useState)(!1),i=r??(()=>o(!0));return{confirming:n,close:()=>o(!1),triggerHandlers:{onClick:a=>{a.stopPropagation(),a.shiftKey||!t?e():i()},onKeyDown:a=>{a.key!=="Enter"||!a.shiftKey||(a.preventDefault(),a.stopPropagation(),e())}},withHint:a=>`${a} ${Z2n}`}}var BS=S(R(),1),qMe="group-close",Q2n={p:"2px",my:"-2px",opacity:0,color:"text.disabled","&:hover":{color:"text.primary"},"&:focus-visible":{opacity:1}};function Fkt({label:e,sessionIds:t,onDismiss:r}){let n=()=>{for(let d of t)r(d)},{confirming:o,close:i,triggerHandlers:a,withHint:s}=zs(n),l=t.length,u=l===1?"session":"sessions";return(0,BS.jsxs)(BS.Fragment,{children:[(0,BS.jsx)(Kt,{size:"small",className:qMe,...a,title:s(`Close all sessions in ${e}`),sx:Q2n,children:(0,BS.jsx)(Bo,{sx:{fontSize:14}})}),o&&(0,BS.jsx)(na,{children:(0,BS.jsx)(qo,{title:`Close ${e}`,message:`This will close all ${l} ${u} in ${e}, including starred and nested sessions. Running sessions will be stopped.`,confirmLabel:`Close ${l}`,onConfirm:()=>{i(),n()},onCancel:i})})]})}function oa(e){let t=e.pendingPrPreview;return t&&t.kind!=="show"&&(e.status==="running"||e.status==="waiting")?t.kind==="question"||t.kind==="backlog-item"?"question":t.kind==="check"||t.kind==="design"?"check":"waiting":e.status}var J2n=["check","waiting","running","done"];function eSn(e){return e==="question"?"waiting":e}function zkt(e){return J2n.map(t=>({status:t,count:e.filter(r=>eSn(oa(r))===t).length})).filter(t=>t.count>0)}var tSn={claude:{red:30,yellow:20},codex:{red:75,yellow:50},pi:{red:30,yellow:20}};function Hkt(e,t){let{red:r,yellow:n}=tSn[IS(t)];return e>=r?"red":e>=n?"yellow":"dim"}var Uu={running:"success.main",idle:"text.disabled",waiting:"warning.main",question:"warning.main",check:"warning.main",done:"info.main",error:"error.main",stopped:"text.secondary"};function ffe(e,t){switch(Hkt(e,t)){case"red":return"error.main";case"yellow":return"warning.main";default:return"text.disabled"}}var Vu={running:"\u25CF",idle:"\u25CF",waiting:"\u25C6",question:"?",check:"\u25B2",done:"\u2713",error:"\u2715",stopped:"\u25CB"};var kX=S(R(),1),rSn={display:"flex",gap:1,flexShrink:0,color:"text.secondary",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};function Ukt({sessions:e}){return(0,kX.jsx)(W,{sx:rSn,children:zkt(e).map(({status:t,count:r})=>(0,kX.jsxs)(Te,{variant:"caption","data-tally":t,children:[(0,kX.jsx)(W,{component:"span",sx:{color:Uu[t]},children:Vu[t]})," ",r," ",t]},t))})}var Vkt=S(R(),1),Co=ot((0,Vkt.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight");var Wkt=S(R(),1),ka=ot((0,Wkt.jsx)("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore");var qkt=S(R(),1),nSn={fontSize:12,color:"text.secondary",flexShrink:0};function Gkt({collapsed:e}){return(0,qkt.jsx)(e?Co:ka,{sx:nSn})}var jkt=S(R(),1),Ykt=ot((0,jkt.jsx)("path",{d:"M14 4v5c0 1.12.37 2.16 1 3H9c.65-.86 1-1.9 1-3V4zm3-2H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3V4h1c.55 0 1-.45 1-1s-.45-1-1-1"}),"PushPinOutlined");var b_=S(R(),1),oSn={minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:11,fontWeight:600,lineHeight:"16px",letterSpacing:"0.06em",textTransform:"uppercase",color:"text.secondary"},iSn={fontSize:14,color:"text.disabled",flexShrink:0};function Kkt({label:e,pinned:t}){return(0,b_.jsxs)(b_.Fragment,{children:[(0,b_.jsx)(Te,{variant:"body1",title:e,sx:oSn,children:e}),t&&(0,b_.jsx)(pr,{title:"Collapsed by you. Stays collapsed until you open it.",children:(0,b_.jsx)(Ykt,{"data-testid":"group-pinned","aria-label":"Collapsed by you",sx:iSn})})]})}var jMe={toggle:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:.75,justifyContent:"flex-start",textAlign:"left",borderRadius:.5,"&:focus-visible":{outline:1,outlineColor:"primary.main"}},count:{color:"text.disabled",fontVariantNumeric:"tabular-nums",fontFamily:"fontFamilyMono",fontSize:11,lineHeight:1}};var $8=S(R(),1);function Xkt({label:e,count:t,collapsedSummary:r,collapsed:n,pinned:o,onToggle:i}){return(0,$8.jsxs)(nr,{"aria-expanded":!n,onClick:i,sx:jMe.toggle,children:[(0,$8.jsx)(Gkt,{collapsed:n}),(0,$8.jsx)(Kkt,{label:e,pinned:o}),n?r:(0,$8.jsx)(Te,{variant:"caption",sx:jMe.count,children:t})]})}var F8=S(R(),1),aSn={display:"flex",alignItems:"center",gap:.75,p:"8px 12px 4px",bgcolor:"background.paper",position:"sticky",top:0,zIndex:1,[`&:hover .${qMe}`]:{opacity:1}};function Zkt({label:e,sessions:t,collapsed:r,pinned:n,onToggle:o,onDismiss:i}){return(0,F8.jsxs)(W,{sx:aSn,children:[(0,F8.jsx)(Xkt,{label:e,count:t.length,collapsedSummary:(0,F8.jsx)(Ukt,{sessions:t}),collapsed:r,pinned:n,onToggle:o}),(0,F8.jsx)(Fkt,{label:e,sessionIds:t.map(a=>a.id),onDismiss:i})]})}var pfe=S(ie(),1),YMe=(0,pfe.createContext)(!1);function Qkt(){return(0,pfe.useContext)(YMe)}var _X=S(R(),1),sSn={mb:.5};function Jkt({groupKey:e,label:t,sessions:r,onDismiss:n,children:o}){let{isCollapsed:i,setCollapsed:a}=N8(),s=i(e);return(0,_X.jsxs)(W,{sx:sSn,children:[(0,_X.jsx)(Zkt,{label:t,sessions:r,collapsed:s,pinned:s,onToggle:()=>a(e,!s),onDismiss:n}),!s&&(0,_X.jsx)(YMe.Provider,{value:!0,children:o})]})}function hfe(e,t,r){if(t.length===0)return;let n=()=>{for(let o of t)r(o.id)};return{childCount:t.length,onDismissAll:()=>{r(e.id),n()},onDismissChildren:n}}function mfe(e,t){return!t.has(e.id)&&e.status!=="done"&&e.status!=="error"&&e.status!=="stopped"}var XP="branch";function e_t(e,t){return[{value:"all",label:"All changes"},{value:"uncommitted",label:"Uncommitted"},...t?[{value:XP,label:"Branch",note:`vs ${t}`}]:[],...e.map(r=>({value:r.sha,label:r.title||r.sha.slice(0,7)}))]}function t_t(e,t){return e.find(r=>r.value===t)??{value:"all",label:"All changes"}}var gfe=S(ie(),1);var x_=S(ie(),1);function r_t(e,t,r){let n=e[t];return n&&n.cwd===r.cwd&&n.scope===r.scope?KMe(e,t):{...e,[t]:{...r,mode:n?.mode??"half"}}}function KMe(e,t){let{[t]:r,...n}=e;return r?n:e}function n_t(e,t){let r=new Set(t),n=Object.entries(e).filter(([o])=>r.has(o));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function o_t(e,t,r){let n=e[t];return n?{...e,[t]:{...n,scope:r}}:e}function i_t(e,t){let r=e[t];if(!r)return e;let n=r.mode==="half"?"full":"half";return{...e,[t]:{...r,mode:n}}}function a_t(e,t){let[r,n]=(0,x_.useState)({}),o=e.join(" ");(0,x_.useEffect)(()=>{let a=o===""?[]:o.split(" ");n(s=>n_t(s,a))},[o]);let i=(0,x_.useCallback)((a,s)=>{t(a),n(l=>r_t(l,a,s))},[t]);return(0,x_.useMemo)(()=>({panelFor:a=>a===null?void 0:r[a],togglePanel:i,closePanel:a=>n(s=>KMe(s,a)),setPanelScope:(a,s)=>n(l=>o_t(l,a,s)),togglePanelMode:a=>n(s=>i_t(s,a))}),[r,i])}var c_t=S(R(),1),s_t=(0,gfe.createContext)(null);function l_t({sessionIds:e,onActivateSession:t,children:r}){let n=a_t(e,t);return(0,c_t.jsx)(s_t.Provider,{value:n,children:r})}function Dg(){let e=(0,gfe.useContext)(s_t);if(!e)throw new Error("useDiffPanels must be used within a DiffPanelsProvider");return e}var d_t=S(R(),1);function u_t({panelSessionId:e,cwd:t,sessionId:r,defaultBranch:n}){let{togglePanel:o}=Dg(),i=br(),a=`Diff against ${n}`;return(0,d_t.jsxs)(Xr,{component:"button",type:"button",title:a,"aria-label":a,onClick:()=>o(e,{cwd:t,claudeSessionId:r,scope:XP,node:i}),variant:"caption",underline:"hover",color:"inherit",sx:{border:0,p:0,bgcolor:"transparent",cursor:"pointer",fontFamily:"fontFamilyMono",whiteSpace:"nowrap",color:"text.disabled","&:hover":{color:"text.primary"}},children:["vs ",n]})}function z8(){return/Mac|iPhone|iPad/.test(globalThis.navigator?.platform??"")}var lSn={Ctrl:"\u2303",Alt:"\u2325",Shift:"\u21E7",Mod:"\u2318",Meta:"\u2318"},cSn={Mod:"Ctrl"};function f_t(e,t=z8()){let r=t?lSn:cSn;return e.map(n=>r[n]??n)}function yfe(e,t=z8()){return f_t(e,t).join(t?"":"+")}var p_t=S(R(),1),uSn={px:.5,border:1,borderColor:"grey.500",borderRadius:.5,fontFamily:"fontFamilyMono",fontSize:11,whiteSpace:"nowrap"};function vfe({chords:e}){return e.map(t=>{let r=yfe(t);return(0,p_t.jsx)(W,{component:"kbd",sx:uSn,children:r},r)})}var EX=S(R(),1);function Nd({label:e,chords:t}){return(0,EX.jsxs)(kt,{direction:"row",spacing:.75,sx:{alignItems:"center"},children:[(0,EX.jsx)("span",{children:e}),(0,EX.jsx)(vfe,{chords:t})]})}var dSn={"/":"Slash",".":"Period",",":"Comma",";":"Semicolon","'":"Quote","[":"BracketLeft","]":"BracketRight","\\":"Backslash","-":"Minus","=":"Equal","`":"Backquote"},fSn=["Enter","Space","Escape","Backspace","Delete","Insert","Home","End","PageUp","PageDown","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"];function h_t(e){if(/^[a-z]$/i.test(e)){let n=e.toUpperCase();return{code:`Key${n}`,label:n}}if(/^\d$/.test(e))return{code:`Digit${e}`,label:e};let t=dSn[e];if(t)return{code:t,label:e};if(/^F([1-9]|1[0-2])$/i.test(e)){let n=e.toUpperCase();return{code:n,label:n}}let r=fSn.find(n=>n.toLowerCase()===e.toLowerCase());return r?{code:r,label:r}:void 0}var pSn={mod:"Mod",ctrl:"Ctrl",control:"Ctrl",alt:"Alt",option:"Alt",opt:"Alt",shift:"Shift",meta:"Meta",cmd:"Meta",command:"Meta",win:"Meta"},hSn=["Mod","Ctrl","Alt","Shift","Meta"];function m_t(e,t){let r=new Set;for(let n of e){let o=pSn[n.toLowerCase()];if(!o)return{ok:!1,error:`"${n}" is not a modifier in "${t}"`};if(r.has(o))return{ok:!1,error:`"${n}" is repeated in "${t}"`};r.add(o)}return[...r].some(n=>n!=="Shift")?r.has("Mod")&&(r.has("Ctrl")||r.has("Meta"))?{ok:!1,error:`"${t}" combines Mod with Ctrl or Meta, which Mod already means`}:{ok:!0,modifiers:hSn.filter(n=>r.has(n))}:{ok:!1,error:`"${t}" needs at least one of Mod, Ctrl, Alt or Meta`}}function g_t(e,{modifiersOnly:t=!1}={}){let r=e.split("+").map(s=>s.trim()),n=t?void 0:r.pop(),o=m_t(r,e);if(!o.ok)return o;let{modifiers:i}=o;if(n===void 0)return{ok:!0,chord:{modifiers:i}};let a=h_t(n);return a?{ok:!0,chord:{modifiers:i,key:a}}:{ok:!1,error:`"${n}" is not a key in "${e}"`}}function bfe({modifiers:e,key:t},r,n=z8()){if(r.type!=="keydown"||t&&r.code!==t.code)return!1;let o=e.includes("Mod");return r.ctrlKey===(e.includes("Ctrl")||o&&!n)&&r.metaKey===(e.includes("Meta")||o&&n)&&r.altKey===e.includes("Alt")&&r.shiftKey===e.includes("Shift")}var mSn=/^Digit([1-6])$/;function RX(e,t){if(!t.some(n=>bfe(n,e)))return;let r=mSn.exec(e.code);return r?Number(r[1])-1:void 0}var H8={navTab:{label:"Switch top-level tab",group:"Navigate"},focusSidebar:{label:"Focus sidebar (backlog: last-selected session card)",group:"Navigate"},focusTerminal:{label:"Focus terminal (backlog: search / back)",group:"Navigate"},toggleDiff:{label:"Open / close diff panel, or focus preview pane",group:"Navigate"},focusRepoPicker:{label:"Focus repo picker",group:"Navigate"},openUpdates:{label:"Open updates",group:"Navigate"},openConfig:{label:"Open config",group:"Navigate"},openMenu:{label:"Open menu",group:"Navigate"},cycleCards:{label:"Next / previous sidebar card",group:"Navigate"},nextWaiting:{label:"Next waiting session",group:"Sessions"},focusAddAgent:{label:"Focus add agent",group:"Sessions"},focusVsCode:{label:"Focus VS Code",group:"Sessions"},focusDone:{label:"Focus done",group:"Sessions"},newSession:{label:"New session",group:"Sessions"},quickOpen:{label:"Quick open file",group:"Files"},save:{label:"Save file",group:"Files"},shortcutsSheet:{label:"Keyboard shortcuts",group:"Help"}};var gSn="1\u20136",y_t=new WeakMap;function S_(e,t){let r=y_t.get(t);r||(r=new Map,y_t.set(t,r));let n=r.get(e);return n||(n=ySn(e,t),r.set(e,n)),n}function ySn(e,t){let{label:r,group:n}=H8[e];if(e==="cycleCards")return{label:r,group:n,chords:[["Tab"],["Shift","Tab"]],bound:[],matches:efe};let o=e==="navTab",i=t[e].flatMap(a=>{let s=g_t(a,{modifiersOnly:o});return s.ok?[s.chord]:[]});return{label:r,group:n,chords:i.map(a=>vSn(a)),bound:i,matches:o?a=>RX(a,i)!==void 0:a=>i.some(s=>bfe(s,a))}}function vSn({modifiers:e,key:t}){return[...e,t?.label??gSn]}var x_t=S(ie(),1);var v_t={navTab:["Alt"],focusSidebar:["Alt+A"],focusTerminal:["Alt+S"],toggleDiff:["Alt+D"],focusRepoPicker:["Alt+R"],openUpdates:["Alt+Q"],openConfig:["Alt+W"],openMenu:["Alt+E"],focusAddAgent:["Alt+Z"],focusVsCode:["Alt+X"],focusDone:["Alt+C"],nextWaiting:["Mod+."],newSession:["Mod+N","Alt+N"],quickOpen:["Mod+P"],save:["Mod+S"],shortcutsSheet:["Mod+/"]};var b_t=v_t,XMe=new Set,ZP={get:()=>b_t,set(e){b_t=e;for(let t of XMe)t()},subscribe(e){return XMe.add(e),()=>XMe.delete(e)}};function U8(){return(0,x_t.useSyncExternalStore)(ZP.subscribe,ZP.get)}function go(e){return S_(e,U8())}var ZMe=S(R(),1);function S_t({show:e,children:t}){let{label:r,chords:n}=go("toggleDiff");return(0,ZMe.jsx)(pr,{describeChild:!0,title:e?(0,ZMe.jsx)(Nd,{label:r,chords:n}):"",children:t})}function T_t(e){return t=>({px:1,py:"3px",border:1,borderRadius:`${t.tokens.radius.sm}px`,borderColor:e?Vr(t.palette.primary.main,.55):"divider",bgcolor:e?t.tokens.color.selected:"background.default",fontSize:11,textDecoration:"none",transition:"border-color .2s ease, background-color .2s ease","&:hover":{textDecoration:"none",borderColor:e?Vr(t.palette.primary.main,.55):t.palette.text.disabled}})}function w_t(e,t,r){let n=Dg().panelFor(e);if(!r)return;let o=n!==void 0&&(t==="uncommitted"?n.scope===t:n.scope!=="uncommitted");return{pressed:o,sx:T_t(o)}}var k_t=S(R(),1);function C_t({groups:e}){return e.map(t=>(0,k_t.jsxs)(W,{component:"span",sx:{color:t.color},children:[t.prefix,t.count]},t.key))}var QP=S(R(),1),bSn={display:"flex",alignItems:"center",gap:.75,fontFamily:"fontFamilyMono",whiteSpace:"nowrap",border:0,p:0,bgcolor:"transparent",cursor:"pointer"};function QMe({panelSessionId:e,cwd:t,sessionId:r,scope:n,groups:o,bracketed:i,toggleChordHint:a=!1,countButton:s=!1}){let{togglePanel:l}=Dg(),u=br(),d=w_t(e,n,s);return(0,QP.jsx)(S_t,{show:a,children:(0,QP.jsxs)(Xr,{component:"button",type:"button",onClick:()=>l(e,{cwd:t,claudeSessionId:r,scope:n,node:u}),variant:"caption",underline:d?"none":"hover",color:"inherit","aria-pressed":d?.pressed,sx:[bSn,d?.sx??{}],children:[i&&(0,QP.jsx)(W,{component:"span",children:"("}),(0,QP.jsx)(C_t,{groups:o}),i&&(0,QP.jsx)(W,{component:"span",children:")"})]})})}var V8=S(R(),1),xSn={display:"flex",alignItems:"center",gap:.75,minWidth:0},__t=[{key:"new",prefix:"+",color:"success.main"},{key:"modified",prefix:"~",color:"warning.main"},{key:"deleted",prefix:"-",color:"error.main"}];function E_t({panelSessionId:e,cwd:t,sessionId:r,groups:n,uncommitted:o,toggleChordHint:i,countButton:a}){return(0,V8.jsx)(na,{children:(0,V8.jsxs)(W,{sx:xSn,"data-testid":"git-status-counts",children:[n.length>0&&(0,V8.jsx)(QMe,{panelSessionId:e,cwd:t,sessionId:r,scope:"all",groups:n,toggleChordHint:i,countButton:a}),o&&o.length>0&&(0,V8.jsx)(QMe,{panelSessionId:e,cwd:t,sessionId:r,scope:"uncommitted",groups:o,bracketed:!0,countButton:a})]})})}function R_t(e){return __t.map(t=>({...t,count:e[t.key]?.length??0})).filter(t=>t.count>0)}function P_t(e){if(!e)return null;let t=R_t(e),r=e.hasCommits&&e.uncommitted?R_t(e.uncommitted):void 0;return t.length>0||(r?.length??0)>0?{kind:"counts",groups:t,uncommitted:r}:e.defaultBranch&&e.onDefaultBranch===!1?{kind:"branch",defaultBranch:e.defaultBranch}:null}var T_=S(ie(),1);var SSn=new Set([502,504]);function A_t(){let e=!1;return{shouldRecord:t=>SSn.has(t)?e?!0:(e=!0,!1):(e=!1,!0),reset:()=>{e=!1}}}function W8(e,t,r){let n=new URLSearchParams({cwd:e});return t&&n.set("session",t),r&&r!=="all"&&n.set("scope",r),n.toString()}async function L_t(e,t){try{let r=await er(e,{blipGate:t});return r.ok?await r.json().then(n=>({counts:n??null}),()=>{}):{counts:null}}catch(r){return Pr(r,"git status counts"),{counts:null}}}var TSn=5e3;function xfe(e,t,r=!0){let[n,o]=(0,T_.useState)(null),i=(0,T_.useRef)(()=>{}),a=br();return(0,T_.useEffect)(()=>{if(i.current=()=>{},!e||!r){o(null);return}let s=!1,l=A_t(),u=Yr(`/api/git-status?${W8(e,t)}`,a),d=async()=>{let p=await L_t(u,l);p&&!s&&o(p.counts)};i.current=d,d();let f=setInterval(d,TSn);return()=>{s=!0,clearInterval(f)}},[e,t,a,r]),{counts:n,refresh:(0,T_.useCallback)(()=>i.current(),[])}}function I_t(e,t){return xfe(e,t).counts}var JMe=S(R(),1);function Sfe({panelSessionId:e,cwd:t,sessionId:r,offerBranchDiff:n=!1,toggleChordHint:o=!1,countButton:i=!1}){let a=P_t(I_t(t,r));return a?a.kind==="branch"?n?(0,JMe.jsx)(u_t,{panelSessionId:e,cwd:t,sessionId:r,defaultBranch:a.defaultBranch}):null:(0,JMe.jsx)(E_t,{panelSessionId:e,cwd:t,sessionId:r,groups:a.groups,uncommitted:a.uncommitted,toggleChordHint:o,countButton:i}):null}var w_=S(R(),1);function D_t({restored:e,usedPct:t,harness:r,undurable:n}){return(0,w_.jsxs)(w_.Fragment,{children:[n&&(0,w_.jsx)(Te,{variant:"caption",sx:{color:"warning.main"},children:n.reason}),e!==void 0&&(0,w_.jsx)(Te,{variant:"caption",sx:{color:e?"success.main":"warning.main"},children:e?"restored":"not restored"}),t!==void 0&&(0,w_.jsxs)(Te,{variant:"caption",sx:{color:ffe(t,r),opacity:.6,fontSize:"0.8rem"},children:[Math.round(t),"%"]})]})}var PX=S(R(),1),wSn={gridColumn:3,gridRow:2,display:"flex",alignItems:"center",justifyContent:"flex-end",gap:.75,minWidth:0};function M_t({session:e}){return(0,PX.jsxs)(W,{sx:wSn,children:[(0,PX.jsx)(D_t,{usedPct:e.usedPct,harness:e.harness,undurable:e.undurable}),e.cwd&&(0,PX.jsx)(Sfe,{panelSessionId:e.id,cwd:e.cwd,sessionId:e.claudeSessionId})]})}function Tfe(e,t){if(t)return!0;let r=e.commandType==="assist"&&e.activity===void 0,n=e.status==="done"||e.status==="error";return r&&!n}var eNe=S(R(),1),CSn=bi("neutral");function N_t({clone:e}){return(0,eNe.jsx)(pr,{title:`Clone \u2014 ${e}`,children:(0,eNe.jsx)(W,{component:"span",sx:CSn,children:"clone"})})}var wfe=[bi("primary"),e=>({bgcolor:e.palette.primary.main,borderColor:e.palette.primary.main,color:e.palette.primary.contrastText})];var tNe=S(R(),1),kSn=bi("success");function O_t({session:e}){return WMe(e)?(0,tNe.jsx)(W,{component:"span",sx:kSn,children:e.port?(0,tNe.jsx)(dfe,{port:e.port,node:e.node}):"serving"}):null}var Cfe=S(ie(),1),rNe=(0,Cfe.createContext)(new Set);function B_t(){return(0,Cfe.useContext)(rNe)}var Mg=S(R(),1),_Sn=bi("check");function ESn({label:e}){return(0,Mg.jsx)(W,{component:"span",sx:wfe,children:e})}function $_t({session:e}){let t=B_t().has(e.id),r=e.repoGroup?.clone,{activity:n}=e,o=n?.kind==="backlog"&&n.phase===n.totalPhases;return(0,Mg.jsxs)(Mg.Fragment,{children:[oa(e)==="check"&&(0,Mg.jsx)(W,{component:"span",sx:_Sn,children:"Check"}),(0,Mg.jsx)(O_t,{session:e}),(0,Mg.jsx)($de,{harness:e.harness}),t&&r&&(0,Mg.jsx)(N_t,{clone:r}),(0,Mg.jsx)(Vde,{node:e.node}),o&&(0,Mg.jsx)(ESn,{label:`${n.phase}/${n.totalPhases}`})]})}var K_t=S(ie(),1);function kfe(e){return e?.itemIds?.length?e.itemIds:e?.itemId==null?[]:[e.itemId]}var z_t=S(R(),1),RSn=bi("primary");function F_t({itemId:e,session:t}){let r=br();return(0,z_t.jsx)(Xr,{component:va,to:Md(e,Dl(t),r),underline:"hover",sx:RSn,onMouseDown:n=>n.stopPropagation(),onClick:n=>n.stopPropagation(),children:gn(e)})}var nNe=S(R(),1),H_t=bi("secondary");function U_t({prNumber:e,url:t}){let r=`#${e}`;return t?(0,nNe.jsx)(Xr,{href:t,target:"_blank",rel:"noopener noreferrer",underline:"hover",sx:H_t,onMouseDown:n=>n.stopPropagation(),onClick:n=>n.stopPropagation(),children:r}):(0,nNe.jsx)(W,{component:"span",sx:H_t,children:r})}var W_t=S(R(),1),PSn={color:"text.secondary",whiteSpace:"nowrap"};function V_t(e,t){let r=E8(t)?is(e):"";if(r)return{key:"repo",node:(0,W_t.jsx)(W,{component:"span",sx:PSn,children:r})}}function G_t(e,t){return!e?.jiraKey&&e?.githubIssue?.toLowerCase()===t.toLowerCase()}var j_t=S(R(),1);function q_t(e,t){if(!(!e||G_t(t,e)))return{key:"prompt-issue",node:(0,j_t.jsx)(y_,{githubIssue:e,variant:"token"})}}function C_(e){if(e.activity?.kind==="backlog")return"next";if(e.design)return"design";switch(e.commandType){case"assist":{let t=e.assistArgs?.[0];return t==="review-pr-comments"||t==="fix-conflict"?"review":t==="draft"||t==="bug"||t==="next"||t==="refine"||t==="review"||t==="update"?t:"prompt"}case"run":return"run";default:return e.promptType??"prompt"}}var _fe=S(R(),1);function Y_t(e,t,r,n){let o=[],i=C_(e),a=t?void 0:V_t(e.cwd,i),{activity:s}=e;a&&o.push(a),s?.kind==="backlog"?s.phase!==s.totalPhases&&o.push({key:"phase",node:`${s.phase}/${s.totalPhases}`}):o.push({key:"type",node:i}),r.number!==void 0&&o.push({key:"pr",badge:!0,node:(0,_fe.jsx)(U_t,{prNumber:r.number,url:r.url})});for(let u of kfe(s))o.push({key:`item-${u}`,badge:!0,node:(0,_fe.jsx)(F_t,{itemId:u,session:e})});n&&o.push({key:"tracker",node:(0,_fe.jsx)(Nde,{tracker:n,variant:"token"})});let l=q_t(e.promptIssue,n);return l&&o.push(l),o}var ASn=["review","review-pr-comments","fix-conflict"];function R1(e){let t=e.assistArgs?.[0];if(!t||!ASn.includes(t))return;let r=e.assistArgs?.slice(1).map(o=>Number(o)).find(o=>Number.isInteger(o)&&o>0);if(r!==void 0)return r;let n=e.subtitle?.match(/^#(\d+)/);return n?Number(n[1]):void 0}var Efe=S(ie(),1);function G8(e,t,r){let[n,o]=(0,Efe.useState)(null),i=br();return(0,Efe.useEffect)(()=>{if(!e){o(null);return}let a=!1,s=t!==void 0?`&number=${t}`:"";return er(Yr(`/api/pr-status?cwd=${encodeURIComponent(e)}${s}`,i)).then(l=>l.json()).then(l=>{a||o(typeof l?.pr?.number=="number"?l.pr:null)}).catch(l=>{Pr(l,"PR status"),a||o(null)}),()=>{a=!0}},[e,i,t,r]),n}var JP=S(R(),1),LSn={opacity:.35,mx:.5};function X_t({session:e}){let t=Qkt(),r=Ude(e.cwd),n=R1(e)??e.promptPr,o=G8(e.cwd,n,e.status),i=Y_t(e,t,{number:n??o?.number,url:o?.url},r(e.activity?.itemId)),a=s=>s>0&&!i[s].badge&&!i[s-1].badge;return(0,JP.jsx)(JP.Fragment,{children:i.map((s,l)=>(0,JP.jsxs)(K_t.Fragment,{children:[a(l)&&(0,JP.jsx)(W,{component:"span",sx:LSn,children:"\xB7"}),s.node]},s.key))})}var eA=S(R(),1);function Z_t({session:e}){return(0,eA.jsxs)(eA.Fragment,{children:[(0,eA.jsx)(X_t,{session:e}),(0,eA.jsx)($_t,{session:e})]})}var oNe=S(R(),1),ISn={color:"text.disabled",fontSize:"0.65rem",lineHeight:1.4};function Q_t({toggles:e}){let t=e.flatMap(r=>r.caption??[]);return t.length===0?null:(0,oNe.jsx)(W,{sx:{display:"flex",gap:1,minWidth:0},children:t.map(r=>(0,oNe.jsx)(Te,{sx:ISn,children:r},r))})}function q8(e){let t=[],r=C_(e);if(r==="draft"||r==="bug"||r==="refine"){let o=e.autoApprove??!1;t.push({key:"autoApprove",label:"Auto start",checked:o,...o?{caption:"will auto start"}:{}})}let{activity:n}=e;if(n?.kind==="backlog"){let o=n.phase!==void 0&&n.phase===n.totalPhases,i=e.autoAdvance??!0;o||t.push({key:"autoAdvance",label:"Continue",checked:i,...i?{}:{caption:"won't continue"}})}return t}var AX=S(R(),1),DSn={gridColumn:2,gridRow:2,display:"flex",alignItems:"center",gap:.625,minWidth:0,overflow:"hidden",fontSize:"0.6875rem",lineHeight:"16px",color:"text.secondary"};function J_t({session:e}){return Tfe(e,!1)?null:(0,AX.jsxs)(W,{sx:DSn,children:[(0,AX.jsx)(Z_t,{session:e}),(0,AX.jsx)(Q_t,{toggles:q8(e)})]})}var tA=S(R(),1);function eEt({session:e,loading:t}){return t?null:(0,tA.jsxs)(tA.Fragment,{children:[(0,tA.jsx)(J_t,{session:e}),(0,tA.jsx)(M_t,{session:e})]})}var Rfe="session-card-title";var k_="session-card-close";var tEt=S(R(),1),rEt=ot((0,tEt.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zm2.46-7.12 1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14zM15.5 4l-1-1h-5l-1 1H5v2h14V4z"}),"DeleteForever");var Pfe=S(ie(),1),iNe=(0,Pfe.createContext)({onStop:()=>{},onStart:()=>{},onDiscard:()=>{}});function j8(){return(0,Pfe.useContext)(iNe)}var $S=S(R(),1);function nEt({id:e,reason:t,path:r,removesTree:n}){let{onDiscard:o}=j8(),{confirming:i,close:a,triggerHandlers:s,withHint:l}=zs(()=>o(e)),u=t?` (${t})`:"",d=r??"its working tree";return(0,$S.jsxs)($S.Fragment,{children:[(0,$S.jsx)(Kt,{size:"small",...s,title:l(n?"Discard changes and remove worktree":"Drop this card and stop tracking its unlanded work"),sx:{color:"text.disabled","&:hover":{color:"error.main"}},children:(0,$S.jsx)(rEt,{sx:{fontSize:16}})}),i&&(0,$S.jsx)(na,{children:(0,$S.jsx)(qo,{title:n?"Discard all changes":"Stop tracking this work",message:n?`This permanently deletes the worktree ${d} and the work it holds${u}. This cannot be undone.`:`This drops the card and stops tracking the unlanded work in ${d}${u}. Nothing on disk is deleted.`,confirmLabel:n?"Discard changes":"Drop card",onConfirm:()=>{a(),o(e)},onCancel:a})})]})}var P1=S(R(),1);function oEt({childCount:e,onDismissThis:t,onDismissAll:r,onCancel:n}){let o=e===1?"session":"sessions";return(0,P1.jsxs)(ts,{open:!0,onClose:n,maxWidth:"xs",fullWidth:!0,children:[(0,P1.jsx)(Wc,{children:"Close nested sessions?"}),(0,P1.jsx)(Vc,{children:(0,P1.jsx)(Pk,{children:`This session has ${e} nested ${o}. Close just this session, or close it along with its nested ${o}? Running sessions will be stopped.`})}),(0,P1.jsxs)(Cd,{children:[(0,P1.jsx)(it,{onClick:n,children:"Cancel"}),(0,P1.jsx)(it,{onClick:t,children:"Close this only"}),(0,P1.jsx)(it,{variant:"contained",color:"error",onClick:r,children:`Close all ${e+1}`})]})]})}var Afe=S(R(),1);function iEt({onDismiss:e,childDismiss:t,onClose:r}){let n=o=>{r(),o()};return(0,Afe.jsx)(na,{children:t?(0,Afe.jsx)(oEt,{childCount:t.childCount,onDismissThis:()=>n(e),onDismissAll:()=>n(t.onDismissAll),onCancel:r}):(0,Afe.jsx)(qo,{title:"End session",message:"This will stop the running session and kill its process. Are you sure?",confirmLabel:"End session",onConfirm:()=>n(e),onCancel:r})})}var __=S(R(),1);function Lfe({id:e,status:t,onDismiss:r,childDismiss:n}){let{confirming:o,close:i,triggerHandlers:a,withHint:s}=zs(n?.onDismissAll??r,{needsConfirm:t!=="done"||!!n});return(0,__.jsxs)(__.Fragment,{children:[(0,__.jsx)(Kt,{size:"small",...a,title:s(`Dismiss session ${e}`),sx:{color:"text.disabled","&:hover":{color:"text.primary"}},children:(0,__.jsx)(Bo,{sx:{fontSize:16}})}),o&&(0,__.jsx)(iEt,{onDismiss:r,childDismiss:n,onClose:i})]})}var aEt=S(R(),1),Y8=ot((0,aEt.jsx)("path",{d:"M12 5V2L8 6l4 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8m-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91"}),"RestartAlt");var MSn={claude:!0,codex:!0,pi:!1};function Ife(e){return MSn[IS(e)]}function sEt({label:e,onClick:t,onKeyDown:r,title:n,ariaLabel:o,disabled:i,pressed:a,shortcut:s}){return{onClick:t,onKeyDown:r,disabled:i,title:s?void 0:n,"aria-label":o??n??e,"aria-pressed":a,"data-shortcut":s}}var NSn={muted:{color:"text.disabled",labelled:"text.secondary",hover:"text.primary"},start:{color:"text.disabled",labelled:"text.secondary",hover:"success.main"},stop:{color:"success.main",hover:"error.main"},starred:{color:"warning.main",hover:"warning.main"},inherit:{color:"inherit"},secondary:{color:"text.secondary",hover:"text.primary"}};function aNe(e,t){let{color:r,labelled:n,hover:o}=NSn[e],i=t&&n?n:r;return o?{color:i,"&:hover":{color:o}}:{color:i}}var Dfe=S(R(),1);function lEt({label:e,shortcut:t,children:r}){return t?(0,Dfe.jsx)(pr,{describeChild:!0,title:(0,Dfe.jsx)(OSn,{label:e,shortcut:t}),children:r}):r}function OSn({label:e,shortcut:t}){return(0,Dfe.jsx)(Nd,{label:e,chords:go(t).chords})}var Mfe=S(ie(),1),sNe=(0,Mfe.createContext)(!1);function cEt(){return(0,Mfe.useContext)(sNe)}var Nfe=S(R(),1),BSn={textTransform:"none",flexShrink:0,minWidth:0,px:1,whiteSpace:"nowrap"};function Hs({label:e,icon:t,tone:r="muted",size:n="small",...o}){let i=cEt(),a=sEt({label:e,...o});return(0,Nfe.jsx)(lEt,{label:o.title??e,shortcut:o.shortcut,children:i?(0,Nfe.jsx)(it,{...a,size:"small",startIcon:t,sx:{...BSn,...aNe(r,!0)},children:e}):(0,Nfe.jsx)(Kt,{...a,size:n,sx:aNe(r,!1),children:t})})}var E_=S(R(),1);function $Sn(e){return Ife(e)?"resumes the conversation":"relaunches it from the start"}function Ofe({id:e,onRestart:t,harness:r}){let{confirming:n,close:o,triggerHandlers:i,withHint:a}=zs(t);return(0,E_.jsxs)(E_.Fragment,{children:[(0,E_.jsx)(Hs,{label:"Restart",title:a(`Restart session ${e}`),icon:(0,E_.jsx)(Y8,{sx:{fontSize:14}}),...i}),n&&(0,E_.jsx)(qo,{title:`Restart session ${e}`,message:`Restart this ${Il(r)} session? It ${$Sn(r)}, stopping the running process first.`,confirmLabel:"Restart",onConfirm:()=>{o(),t()},onCancel:o})]})}var A1=S(R(),1);function uEt({session:e,onRestart:t,onDismiss:r,childDismiss:n}){let{status:o,id:i,harness:a}=e;return e.closing?null:o!=="stopped"?(0,A1.jsx)("span",{className:k_,children:(0,A1.jsx)(Lfe,{id:i,status:o,onDismiss:r,childDismiss:n})}):(0,A1.jsxs)(A1.Fragment,{children:[e.undurable&&(0,A1.jsx)("span",{className:k_,children:(0,A1.jsx)(nEt,{id:i,reason:e.undurable.reason,path:e.cwd,removesTree:e.undurable.removesTree})}),t&&(0,A1.jsx)(Ofe,{id:i,onRestart:t,harness:a})]})}var lNe=S(R(),1);function dEt({session:e,onRestart:t,onDismiss:r,childDismiss:n}){return(0,lNe.jsx)(na,{children:(0,lNe.jsx)(uEt,{session:e,onRestart:t,onDismiss:r,childDismiss:n})})}var cNe=S(R(),1),FSn={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"flex-end",gap:.25};function fEt({session:e,loading:t,onRetry:r,onRestart:n,onDismiss:o,childDismiss:i}){return(0,cNe.jsx)(W,{sx:FSn,children:(0,cNe.jsx)(dEt,{session:e,loading:t,onRetry:r,onRestart:n,onDismiss:o,childDismiss:i})})}function Bfe(e){return e.verifying===!0&&oa(e)==="running"}var K8=S(R(),1),zSn=Ui`
|
|
3816
|
+
Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}/*`}">.`)}let d=yi(),f;if(t){let y=typeof t=="string"?Lg(t):t;Wn(l==="/"||y.pathname?.startsWith(l),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${y.pathname}" was given in the \`location\` prop.`),f=y}else f=d;let p=f.pathname||"/",h=p;if(l!=="/"){let y=l.replace(/^\//,"").split("/");h="/"+p.replace(/^\//,"").split("/").slice(y.length).join("/")}let m=r&&r.state.matches.length?r.state.matches.map(y=>Object.assign(y,{route:r.manifest[y.route.id]||y.route})):tMe(e,{pathname:h});g8&&(os(u||m!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),os(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`));let g=Zbn(m&&m.map(y=>Object.assign({},y,{params:Object.assign({},a,y.params),pathname:Ag([l,n.encodeLocation?n.encodeLocation(y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:Ag([l,n.encodeLocation?n.encodeLocation(y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),o,r);return t&&g?Fr.createElement(S8.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...f},navigationType:"POP"}},g):g}function jbn(){let e=Uwt(),t=b8(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:n},i={padding:"2px 4px",backgroundColor:n},a=null;return g8&&(console.error("Error handled by React Router default ErrorBoundary:",e),a=Fr.createElement(Fr.Fragment,null,Fr.createElement("p",null,"\u{1F4BF} Hey developer \u{1F44B}"),Fr.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",Fr.createElement("code",{style:i},"ErrorBoundary")," or"," ",Fr.createElement("code",{style:i},"errorElement")," prop on your route."))),Fr.createElement(Fr.Fragment,null,Fr.createElement("h2",null,"Unexpected Application Error!"),Fr.createElement("h3",{style:{fontStyle:"italic"}},t),r?Fr.createElement("pre",{style:o},r):null,a)}var Ybn=Fr.createElement(jbn,null),Fwt=class extends Fr.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=Wbn(e.digest);r&&(e=r)}let t=e!==void 0?Fr.createElement(Kh.Provider,{value:this.props.routeContext},Fr.createElement(cMe.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?Fr.createElement(Kbn,{error:e},t):t}};Fwt.contextType=Awt;var qDe=new WeakMap;function Kbn({children:e,error:t}){let{basename:r,navigator:n}=Fr.useContext(Dd);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let o=Vbn(t.digest);if(o){let i=qDe.get(t);if(i)throw i;let a=hwt(o.location,r),s=a.absoluteURL||a.to;if(h8(o.location,s,oMe(n),"allow-explicit"),ZDe(s))throw new Error("Invalid redirect location");if(pwt&&!qDe.get(t))if(a.isExternal||o.reloadDocument)window.location.href=s;else{let l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:o.replace}));throw qDe.set(t,l),l}return Fr.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s}`})}}return e}function Xbn({routeContext:e,match:t,children:r}){let n=Fr.useContext(h_);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),Fr.createElement(Kh.Provider,{value:e},r)}function Zbn(e,t=[],r){let n=r?.state;if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,i=n?.errors;if(i!=null){let d=o.findIndex(f=>f.route.id&&i?.[f.route.id]!==void 0);Wn(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,d+1))}let a=!1,s=-1;if(r&&n){a=n.renderFallback;for(let d=0;d<o.length;d++){let f=o[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(s=d),f.route.id){let{loaderData:p,errors:h}=n,m=f.route.loader&&!p.hasOwnProperty(f.route.id)&&(!h||h[f.route.id]===void 0);if(f.route.lazy||m){r.isStatic&&(a=!0),s>=0?o=o.slice(0,s+1):o=[o[0]];break}}}}let l=r?.onError,u=n&&l?(d,f)=>{l(d,{location:n.location,params:n.matches?.[0]?.params??{},pattern:fX(n.matches),errorInfo:f})}:void 0;return o.reduceRight((d,f,p)=>{let h,m=!1,g=null,y=null;n&&(h=i&&f.route.id?i[f.route.id]:void 0,g=f.route.errorElement||Ybn,a&&(s<0&&p===0?(Vwt("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),m=!0,y=null):s===p&&(m=!0,y=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,p+1)),b=()=>{let x;return h?x=g:m?x=y:f.route.Component?x=Fr.createElement(f.route.Component,null):f.route.element?x=f.route.element:x=d,Fr.createElement(Xbn,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:x})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?Fr.createElement(Fwt,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:u}):b()},null)}function dMe(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zwt(e){let t=Fr.useContext(h_);return Wn(t,dMe(e)),t}function kde(e){let t=Fr.useContext(WP);return Wn(t,dMe(e)),t}function Qbn(e){let t=Fr.useContext(Kh);return Wn(t,dMe(e)),t}function fMe(e){let t=Qbn(e),r=t.matches[t.matches.length-1];return Wn(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function Jbn(){return fMe("useRouteId")}function Hwt(){let e=kde("useNavigation");return Fr.useMemo(()=>{let{matches:t,historyAction:r,...n}=e.navigation;return n},[e.navigation])}function pMe(){let{matches:e,loaderData:t}=kde("useMatches");return Fr.useMemo(()=>e.map(r=>iwt(r,t)),[e,t])}function Uwt(){let e=Fr.useContext(cMe),t=kde("useRouteError"),r=fMe("useRouteError");return e!==void 0?e:t.errors?.[r]}var exn=0;function hMe(e){let{router:t,basename:r}=zwt("useBlocker"),n=kde("useBlocker"),[o,i]=Fr.useState(""),a=Fr.useCallback(s=>{if(typeof e!="function")return!!e;if(r==="/")return e(s);let{currentLocation:l,nextLocation:u,historyAction:d}=s;return e({currentLocation:{...l,pathname:vf(l.pathname,r)||l.pathname},nextLocation:{...u,pathname:vf(u.pathname,r)||u.pathname},historyAction:d})},[r,e]);return Fr.useEffect(()=>{let s=String(++exn);return i(s),()=>t.deleteBlocker(s)},[t]),Fr.useEffect(()=>{o!==""&&t.getBlocker(o,a)},[t,o,a]),o&&n.blockers.has(o)?n.blockers.get(o):UP}function txn(){let{router:e}=zwt("useNavigate"),t=fMe("useNavigate"),r=Fr.useRef(!1);return Nwt(()=>{r.current=!0}),Fr.useCallback(async(o,i={})=>{os(r.current,Mwt),r.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var jTt={};function Vwt(e,t,r){!t&&!jTt[e]&&(jTt[e]=!0,os(!1,r))}var YTt={};function KTt(e,t){!e&&!YTt[t]&&(YTt[t]=!0,console.warn(t))}var rxn="useOptimistic",XTt=dn[rxn],nxn=()=>{};function oxn(e){return XTt?XTt(e):[e,nxn]}function Wwt(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(g8&&e.element&&os(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:dn.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(g8&&e.hydrateFallbackElement&&os(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:dn.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(g8&&e.errorElement&&os(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:dn.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var Gwt=["HydrateFallback","hydrateFallbackElement"];var ixn=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",e(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",t(r))}})}};function mMe({router:e,flushSync:t,onError:r,useTransitions:n}){n=Lwt()||n;let[i,a]=dn.useState(e.state),[s,l]=oxn(i),[u,d]=dn.useState(),[f,p]=dn.useState({isTransitioning:!1}),[h,m]=dn.useState(),[g,y]=dn.useState(),[v,b]=dn.useState(),x=dn.useRef(new Map),w=dn.useCallback((E,{deletedFetchers:D,newErrors:N,flushSync:$,viewTransitionOpts:P})=>{N&&r&&Object.values(N).forEach(L=>r(L,{location:E.location,params:E.matches[0]?.params??{},pattern:fX(E.matches)})),E.fetchers.forEach((L,I)=>{L.data!==void 0&&x.current.set(I,L.data)}),D.forEach(L=>x.current.delete(L)),KTt($===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let A=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(KTt(P==null||A,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!P||!A){t&&$?t(()=>a(E)):n===!1?a(E):dn.startTransition(()=>{n===!0&&l(L=>ZTt(L,E)),a(E)});return}if(t&&$){t(()=>{g&&(h?.resolve(),g.skipTransition()),p({isTransitioning:!0,flushSync:!0,currentLocation:P.currentLocation,nextLocation:P.nextLocation})});let L=e.window.document.startViewTransition(()=>{t(()=>a(E))});L.finished.finally(()=>{t(()=>{m(void 0),y(void 0),d(void 0),p({isTransitioning:!1})})}),t(()=>y(L));return}g?(h?.resolve(),g.skipTransition(),b({state:E,currentLocation:P.currentLocation,nextLocation:P.nextLocation})):(d(E),p({isTransitioning:!0,flushSync:!1,currentLocation:P.currentLocation,nextLocation:P.nextLocation}))},[e.window,t,g,h,n,l,r]);dn.useLayoutEffect(()=>e.subscribe(w),[e,w]),dn.useEffect(()=>{f.isTransitioning&&!f.flushSync&&m(new ixn)},[f]),dn.useEffect(()=>{if(h&&u&&e.window){let E=u,D=h.promise,N=e.window.document.startViewTransition(async()=>{n===!1?a(E):dn.startTransition(()=>{n===!0&&l($=>ZTt($,E)),a(E)}),await D});N.finished.finally(()=>{m(void 0),y(void 0),d(void 0),p({isTransitioning:!1})}),y(N)}},[u,h,e.window,n,l]),dn.useEffect(()=>{h&&u&&s.location.key===u.location.key&&h.resolve()},[h,g,s.location,u]),dn.useEffect(()=>{!f.isTransitioning&&v&&(d(v.state),p({isTransitioning:!0,flushSync:!1,currentLocation:v.currentLocation,nextLocation:v.nextLocation}),b(void 0))},[f.isTransitioning,v]);let C=dn.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:E=>e.navigate(E),push:(E,D,N)=>e.navigate(E,{state:D,preventScrollReset:N?.preventScrollReset}),replace:(E,D,N)=>e.navigate(E,{replace:!0,state:D,preventScrollReset:N?.preventScrollReset})}),[e]),k=e.basename||"/",_=dn.useMemo(()=>({router:e,navigator:C,static:!1,basename:k,onError:r}),[e,C,k,r]);return dn.createElement(dn.Fragment,null,dn.createElement(h_.Provider,{value:_},dn.createElement(WP.Provider,{value:s},dn.createElement(lMe.Provider,{value:x.current},dn.createElement(Cde.Provider,{value:f},dn.createElement(yMe,{basename:k,location:s.location,navigationType:s.historyAction,navigator:C,useTransitions:n},dn.createElement(axn,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:r})))))),null)}function ZTt(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var axn=dn.memo(sxn);function sxn({routes:e,manifest:t,future:r,state:n,isStatic:o,onError:i}){return $wt(e,void 0,{manifest:t,state:n,isStatic:o,onError:i,future:r})}function pX({to:e,replace:t,state:r,relative:n}){Wn(m_(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o,navigator:i}=dn.useContext(Dd);os(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=dn.useContext(Kh),{pathname:s}=yi(),l=sn(),u=dX(e,wde(a),s,n==="path");h8(typeof e=="string"?e:Id(e),i.createHref(u),oMe(i),"reject");let d=JSON.stringify(u);return dn.useEffect(()=>{l(JSON.parse(d),{replace:t,state:r,relative:n})},[l,d,n,t,r]),null}function gMe(e){return Owt(e.context)}function Go(e){Wn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function yMe({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:o,static:i=!1,useTransitions:a}){Wn(!m_(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=dn.useMemo(()=>({basename:s,navigator:o,static:i,useTransitions:a,future:{}}),[s,o,i,a]);typeof r=="string"&&(r=Lg(r));let{pathname:u="/",search:d="",hash:f="",state:p=null,key:h="default",mask:m}=r,g=dn.useMemo(()=>{let y=vf(u,s);return y==null?null:{location:{pathname:y,search:d,hash:f,state:p,key:h,mask:m},navigationType:n}},[s,u,d,f,p,h,n,m]);return os(g!=null,`<Router basename="${s}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:dn.createElement(Dd.Provider,{value:l},dn.createElement(S8.Provider,{children:t,value:g}))}function AS({children:e,location:t}){return Bwt(bde(e),t)}function bde(e,t=[]){let r=[];return dn.Children.forEach(e,(n,o)=>{if(!dn.isValidElement(n))return;let i=[...t,o];if(n.type===dn.Fragment){r.push.apply(r,bde(n.props.children,i));return}Wn(n.type===Go,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Wn(!n.props.index||!n.props.children,"An index route cannot have child routes.");let a={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(a.children=bde(n.props.children,i)),r.push(a)}),r}var yde="get",vde="application/x-www-form-urlencoded";function _de(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function lxn(e){return _de(e)&&e.tagName.toLowerCase()==="button"}function cxn(e){return _de(e)&&e.tagName.toLowerCase()==="form"}function uxn(e){return _de(e)&&e.tagName.toLowerCase()==="input"}function dxn(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function fxn(e,t){return e.button===0&&(!t||t==="_self")&&!dxn(e)}function xde(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(o=>[r,o]):[[r,n]])},[]))}function pxn(e,t){let r=xde(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(i=>{r.append(o,i)})}),r}var fde=null;function hxn(){if(fde===null)try{new FormData(document.createElement("form"),0),fde=!1}catch{fde=!0}return fde}var mxn=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function jDe(e){return e!=null&&!mxn.has(e)?(os(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${vde}"`),null):e}function gxn(e,t){let r,n,o,i,a;if(cxn(e)){let s=e.getAttribute("action");n=s?vf(s,t):null,r=e.getAttribute("method")||yde,o=jDe(e.getAttribute("enctype"))||vde,i=new FormData(e)}else if(lxn(e)||uxn(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||s.getAttribute("action");if(n=l?vf(l,t):null,r=e.getAttribute("formmethod")||s.getAttribute("method")||yde,o=jDe(e.getAttribute("formenctype"))||jDe(s.getAttribute("enctype"))||vde,i=new FormData(s,e),!hxn()){let{name:u,type:d,value:f}=e;if(d==="image"){let p=u?`${u}.`:"";i.append(`${p}x`,"0"),i.append(`${p}y`,"0")}else u&&i.append(u,f)}}else{if(_de(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=yde,n=null,o=vde,a=e}return i&&o==="text/plain"&&(a=i,i=void 0),{action:n,method:r.toLowerCase(),encType:o,formData:i,body:a}}var oPi=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var yxn={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},vxn=/[&><\u2028\u2029]/g;function QTt(e){return e.replace(vxn,t=>yxn[t])}function bMe(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function qwt(e,t,r,n){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${n}`:o.pathname=`${o.pathname}.${n}`:o.pathname==="/"?o.pathname=`_root.${n}`:t&&vf(o.pathname,t)==="/"?o.pathname=`${v8(t)}/_root.${n}`:o.pathname=`${v8(o.pathname)}.${n}`,o}async function bxn(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){if(console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode&&Vxn.hot)throw r;return window.location.reload(),new Promise(()=>{})}}function xxn(e){return e!=null&&typeof e.page=="string"}function Sxn(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Txn(e,t,r){let n=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let a=await bxn(i,r);return a.links?a.links():[]}return[]}));return _xn(n.flat(1).filter(Sxn).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function JTt(e,t,r,n,o,i){let a=(l,u)=>r[u]?l.route.id!==r[u].route.id:!0,s=(l,u)=>r[u].pathname!==l.pathname||r[u].route.path?.endsWith("*")&&r[u].params["*"]!==l.params["*"];return i==="assets"?t.filter((l,u)=>a(l,u)||s(l,u)):i==="data"?t.filter((l,u)=>{let d=n.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(a(l,u)||s(l,u))return!0;if(l.route.shouldRevalidate){let f=l.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function wxn(e,t,{includeHydrateFallback:r}={}){return Cxn(e.map(n=>{let o=t.routes[n.route.id];if(!o)return[];let i=[o.module];return o.clientActionModule&&(i=i.concat(o.clientActionModule)),o.clientLoaderModule&&(i=i.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(i=i.concat(o.hydrateFallbackModule)),o.imports&&(i=i.concat(o.imports)),i}).flat(1))}function Cxn(e){return[...new Set(e)]}function kxn(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function _xn(e,t){let r=new Set,n=new Set(t);return e.reduce((o,i)=>{if(t&&!xxn(i)&&i.as==="script"&&i.href&&n.has(i.href))return o;let s=JSON.stringify(kxn(i));return r.has(s)||(r.add(s),o.push({key:s,link:i})),o},[])}function xMe(){let e=Oo.useContext(h_);return bMe(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Axn(){let e=Oo.useContext(WP);return bMe(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var hX=Oo.createContext(void 0);hX.displayName="FrameworkContext";function Ede(){let e=Oo.useContext(hX);return bMe(e,"You must render this element inside a <HydratedRouter> element"),e}function Lxn(e,t){let r=Oo.useContext(hX),[n,o]=Oo.useState(!1),[i,a]=Oo.useState(!1),{onFocus:s,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=Oo.useRef(null);Oo.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let g=v=>{v.forEach(b=>{a(b.isIntersecting)})},y=new IntersectionObserver(g,{threshold:.5});return p.current&&y.observe(p.current),()=>{y.disconnect()}}},[e]),Oo.useEffect(()=>{if(n){let g=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(g)}}},[n]);let h=()=>{o(!0)},m=()=>{o(!1),a(!1)};return r?e!=="intent"?[i,p,{}]:[i,p,{onFocus:iX(s,h),onBlur:iX(l,m),onMouseEnter:iX(u,h),onMouseLeave:iX(d,m),onTouchStart:iX(f,h)}]:[!1,p,{}]}function iX(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Ywt({page:e,...t}){let r=Lwt(),{nonce:n}=Ede(),{router:o}=xMe(),i=Oo.useMemo(()=>tMe(o.routes,e,o.basename),[o.routes,e,o.basename]);return i?(t.nonce==null&&n&&(t={...t,nonce:n}),r?Oo.createElement(Dxn,{page:e,matches:i,...t}):Oo.createElement(Mxn,{page:e,matches:i,...t})):null}function Ixn(e){let{manifest:t,routeModules:r}=Ede(),[n,o]=Oo.useState([]);return Oo.useEffect(()=>{let i=!1;return Txn(e,t,r).then(a=>{i||o(a)}),()=>{i=!0}},[e,t,r]),n}function Dxn({page:e,matches:t,...r}){let n=yi(),{future:o}=Ede(),{basename:i}=xMe(),a=Oo.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let s=qwt(e,i,o.v8_trailingSlashAwareDataRequests,"rsc"),l=!1,u=[];for(let d of t)typeof d.route.shouldRevalidate=="function"?l=!0:u.push(d.route.id);return l&&u.length>0&&s.searchParams.set("_routes",u.join(",")),[s.pathname+s.search]},[i,o.v8_trailingSlashAwareDataRequests,e,n,t]);return Oo.createElement(Oo.Fragment,null,a.map(s=>Oo.createElement("link",{key:s,rel:"prefetch",as:"fetch",href:s,...r})))}function Mxn({page:e,matches:t,...r}){let n=yi(),{future:o,manifest:i,routeModules:a}=Ede(),{basename:s}=xMe(),{loaderData:l,matches:u}=Axn(),d=Oo.useMemo(()=>JTt(e,t,u,i,n,"data"),[e,t,u,i,n]),f=Oo.useMemo(()=>JTt(e,t,u,i,n,"assets"),[e,t,u,i,n]),p=Oo.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let g=new Set,y=!1;if(t.forEach(b=>{let x=i.routes[b.route.id];!x||!x.hasLoader||(!d.some(w=>w.route.id===b.route.id)&&b.route.id in l&&a[b.route.id]?.shouldRevalidate||x.hasClientLoader?y=!0:g.add(b.route.id))}),g.size===0)return[];let v=qwt(e,s,o.v8_trailingSlashAwareDataRequests,"data");return y&&g.size>0&&v.searchParams.set("_routes",t.filter(b=>g.has(b.route.id)).map(b=>b.route.id).join(",")),[v.pathname+v.search]},[s,o.v8_trailingSlashAwareDataRequests,l,n,i,d,t,e,a]),h=Oo.useMemo(()=>wxn(f,i),[f,i]),m=Ixn(f);return Oo.createElement(Oo.Fragment,null,p.map(g=>Oo.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...r})),h.map(g=>Oo.createElement("link",{key:g,rel:"modulepreload",href:g,...r})),m.map(({key:g,link:y})=>Oo.createElement("link",{key:g,nonce:r.nonce,...y,crossOrigin:y.crossOrigin??r.crossOrigin})))}function Nxn(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var Oxn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Oxn&&(window.__reactRouterVersion="7.18.5")}catch{}function SMe(e,t){return Swt({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:nwt({window:t?.window}),hydrationData:t?.hydrationData||Bxn(),routes:e,mapRouteProperties:Wwt,hydrationRouteProperties:Gwt,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function Bxn(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:$xn(e.errors)}),e}function $xn(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,o]of t)if(o&&o.__type==="RouteErrorResponse")r[n]=new x8(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(typeof o.__subType=="string"&&tbn.includes(o.__subType)){let i=window[o.__subType];if(typeof i=="function")try{let a=new i(o.message);a.stack="",r[n]=a}catch{}}if(r[n]==null){let i=new Error(o.message);i.stack="",r[n]=i}}else r[n]=o;return r}function Kwt({basename:e,children:t,history:r,useTransitions:n}){let[o,i]=fn.useState({action:r.action,location:r.location}),a=fn.useCallback(s=>{n===!1?i(s):fn.startTransition(()=>i(s))},[n]);return fn.useLayoutEffect(()=>r.listen(a),[r,a]),fn.createElement(yMe,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:r,useTransitions:n})}Kwt.displayName="unstable_HistoryRouter";var va=fn.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:o,reloadDocument:i,replace:a,mask:s,state:l,target:u,to:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:h,...m},g){let{basename:y,navigator:v,useTransitions:b}=fn.useContext(Dd),x=typeof d=="string"&&Sde.test(d),w=hwt(d,y);d=w.to;let C=Dwt(d,{relative:o}),k=yi(),_=null;if(s){let I=dX(s,[],k.mask?k.mask.pathname:"/",!0);y!=="/"&&(I.pathname=I.pathname==="/"?y:Ag([y,I.pathname])),_=v.createHref(I)}let[E,D,N]=Lxn(n,m),$=eCt(d,{replace:a,mask:s,state:l,target:u,preventScrollReset:f,relative:o,viewTransition:p,defaultShouldRevalidate:h,useTransitions:b});function P(I){t&&t(I),I.defaultPrevented||$(I)}let A=!(w.isExternal||i),L=fn.createElement("a",{...m,...N,href:(A?_:void 0)||w.absoluteURL||C,onClick:A?P:t,ref:Nxn(g,D),target:u,"data-discover":!x&&r==="render"?"true":void 0});return E&&!x?fn.createElement(fn.Fragment,null,L,fn.createElement(Ywt,{page:C})):L});va.displayName="Link";var Xwt=fn.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:o=!1,style:i,to:a,viewTransition:s,children:l,...u},d){let f=T8(a,{relative:u.relative}),p=yi(),h=fn.useContext(WP),{navigator:m,basename:g}=fn.useContext(Dd),y=h!=null&&oCt(f)&&s===!0,v=m.encodeLocation?m.encodeLocation(f).pathname:f.pathname,b=p.pathname,x=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;r||(b=b.toLowerCase(),x=x?x.toLowerCase():null,v=v.toLowerCase()),x&&g&&(x=vf(x,g)||x);let w=v!=="/"&&v.endsWith("/")?v.length-1:v.length,C=b===v||!o&&b.startsWith(v)&&b.charAt(w)==="/",k=x!=null&&(x===v||!o&&x.startsWith(v)&&x.charAt(v.length)==="/"),_={isActive:C,isPending:k,isTransitioning:y},E=C?t:void 0,D;typeof n=="function"?D=n(_):D=[n,C?"active":null,k?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let N=typeof i=="function"?i(_):i;return fn.createElement(va,{...u,"aria-current":E,className:D,ref:d,style:N,to:a,viewTransition:s},typeof l=="function"?l(_):l)});Xwt.displayName="NavLink";var Zwt=fn.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:o,state:i,method:a=yde,action:s,onSubmit:l,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...h},m)=>{let{useTransitions:g}=fn.useContext(Dd),y=tCt(),v=rCt(s,{relative:u}),b=a.toLowerCase()==="get"?"get":"post",x=typeof s=="string"&&Sde.test(s);return fn.createElement("form",{ref:m,method:b,action:v,onSubmit:n?l:C=>{if(l&&l(C),C.defaultPrevented)return;C.preventDefault();let k=C.nativeEvent.submitter,_=k?.getAttribute("formmethod")||a,E=()=>y(k||C.currentTarget,{fetcherKey:t,method:_,navigate:r,replace:o,state:i,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p});g&&r!==!1?fn.startTransition(()=>E()):E()},...h,"data-discover":!x&&e==="render"?"true":void 0})});Zwt.displayName="Form";function Qwt({getKey:e,storageKey:t,...r}){let n=fn.useContext(hX),{basename:o}=fn.useContext(Dd),i=yi(),a=pMe();nCt({getKey:e,storageKey:t});let s=fn.useMemo(()=>{if(!n||!e)return null;let u=eMe(i,a,o,e);return u!==i.key?u:null},[]);if(!n||n.isSpaMode)return null;let l=((u,d)=>{if(!window.history.state||!window.history.state.key){let f=Math.random().toString(32).slice(2);window.history.replaceState({key:f},"")}try{let p=JSON.parse(sessionStorage.getItem(u)||"{}")[d||window.history.state.key];typeof p=="number"&&window.scrollTo(0,p)}catch(f){console.error(f),sessionStorage.removeItem(u)}}).toString();return r.nonce==null&&n?.nonce&&(r.nonce=n.nonce),fn.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${l})(${QTt(JSON.stringify(t||JDe))}, ${QTt(JSON.stringify(s))})`}})}Qwt.displayName="ScrollRestoration";function Jwt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function TMe(e){let t=fn.useContext(h_);return Wn(t,Jwt(e)),t}function Fxn(e){let t=fn.useContext(WP);return Wn(t,Jwt(e)),t}function eCt(e,{target:t,replace:r,mask:n,state:o,preventScrollReset:i,relative:a,viewTransition:s,defaultShouldRevalidate:l,useTransitions:u}={}){let d=sn(),f=yi(),p=T8(e,{relative:a});return fn.useCallback(h=>{if(fxn(h,t)){h.preventDefault();let m=r!==void 0?r:Id(f)===Id(p),g=()=>d(e,{replace:m,mask:n,state:o,preventScrollReset:i,relative:a,viewTransition:s,defaultShouldRevalidate:l});u?fn.startTransition(()=>g()):g()}},[f,d,p,r,n,o,t,e,i,a,s,l,u])}function gl(e){os(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=fn.useRef(xde(e)),r=fn.useRef(!1),n=yi(),o=fn.useMemo(()=>pxn(n.search,r.current?null:t.current),[n.search]),i=sn(),a=fn.useCallback((s,l)=>{let u=xde(typeof s=="function"?s(new URLSearchParams(o)):s);r.current=!0,i("?"+u,l)},[i,o]);return[o,a]}var zxn=0,Hxn=()=>`__${String(++zxn)}__`;function tCt(){let{router:e}=TMe("useSubmit"),{basename:t}=fn.useContext(Dd),r=Jbn(),n=e.fetch,o=e.navigate;return fn.useCallback(async(i,a={})=>{let{action:s,method:l,encType:u,formData:d,body:f}=gxn(i,t);if(a.navigate===!1){let p=a.fetcherKey||Hxn();await n(p,r,a.action||s,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:f,formMethod:a.method||l,formEncType:a.encType||u,flushSync:a.flushSync})}else await o(a.action||s,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:f,formMethod:a.method||l,formEncType:a.encType||u,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[n,o,t,r])}function rCt(e,{relative:t}={}){let{basename:r}=fn.useContext(Dd),n=fn.useContext(Kh);Wn(n,"useFormAction must be used inside a RouteContext");let[o]=n.matches.slice(-1),i={...T8(e||".",{relative:t})},a=yi();if(e==null){i.search=a.search;let s=new URLSearchParams(i.search),l=s.getAll("index");if(l.some(d=>d==="")){s.delete("index"),l.filter(f=>f).forEach(f=>s.append("index",f));let d=s.toString();i.search=d?`?${d}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(i.pathname=i.pathname==="/"?r:Ag([r,i.pathname])),Id(i)}var JDe="react-router-scroll-positions",pde={};function eMe(e,t,r,n){let o=null;return n&&(r!=="/"?o=n({...e,pathname:vf(e.pathname,r)||e.pathname},t):o=n(e,t)),o==null&&(o=e.key),o}function nCt({getKey:e,storageKey:t}={}){let{router:r}=TMe("useScrollRestoration"),{restoreScrollPosition:n,preventScrollReset:o}=Fxn("useScrollRestoration"),{basename:i}=fn.useContext(Dd),a=yi(),s=pMe(),l=Hwt();fn.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),Uxn(fn.useCallback(()=>{if(l.state==="idle"){let u=eMe(a,s,i,e);pde[u]=window.scrollY}try{sessionStorage.setItem(t||JDe,JSON.stringify(pde))}catch(u){os(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${u}).`)}window.history.scrollRestoration="auto"},[l.state,e,i,a,s,t])),typeof document<"u"&&(fn.useLayoutEffect(()=>{try{let u=sessionStorage.getItem(t||JDe);u&&(pde=JSON.parse(u))}catch{}},[t]),fn.useLayoutEffect(()=>{let u=r?.enableScrollRestoration(pde,()=>window.scrollY,e?(d,f)=>eMe(d,f,i,e):void 0);return()=>u&&u()},[r,i,e]),fn.useLayoutEffect(()=>{if(n!==!1){if(typeof n=="number"){window.scrollTo(0,n);return}try{if(a.hash){let u=document.getElementById(decodeURIComponent(a.hash.slice(1)));if(u){u.scrollIntoView();return}}}catch{os(!1,`"${a.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}o!==!0&&window.scrollTo(0,0)}},[a,n,o]))}function Uxn(e,t){let{capture:r}=t||{};fn.useEffect(()=>{let n=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,n),()=>{window.removeEventListener("pagehide",e,n)}},[e,r])}function oCt(e,{relative:t}={}){let r=fn.useContext(Cde);Wn(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=TMe("useViewTransitionState"),o=T8(e,{relative:t});if(!r.isTransitioning)return!1;let i=vf(r.currentLocation.pathname,n)||r.currentLocation.pathname,a=vf(r.nextLocation.pathname,n)||r.nextLocation.pathname;return y8(o.pathname,a)!=null||y8(o.pathname,i)!=null}var WQr=S(ie(),1);var Rde=S(ie(),1),wMe=(0,Rde.createContext)({nodes:null,transfer:()=>{},cancel:()=>{}});function Pde(){return(0,Rde.useContext)(wMe)}var aCt=S(R(),1);function g_({inputRef:e,value:t,onChange:r,onKeyDown:n,placeholder:o,autoFocus:i}){return(0,aCt.jsx)(xn,{autoFocus:i,inputRef:e,value:t,onChange:a=>r(a.target.value),onKeyDown:n,placeholder:o,size:"small",fullWidth:!0,slotProps:{input:{sx:{fontSize:12}}},sx:{p:.5}})}var LS=S(ie(),1),uCt=S(R(),1),sCt=(0,LS.createContext)({query:"",setQuery:()=>{},viewedTerm:"",setViewedTerm:()=>{}});function lCt({children:e}){let[t,r]=(0,LS.useState)(""),[n,o]=(0,LS.useState)(""),i=(0,LS.useMemo)(()=>({query:t,setQuery:r,viewedTerm:n,setViewedTerm:o}),[t,n]);return(0,uCt.jsx)(sCt.Provider,{value:i,children:e})}function mX(){return(0,LS.useContext)(sCt)}function cCt(){let{query:e,viewedTerm:t}=mX();return e.trim()?t:""}var dCt=S(R(),1),Iy=ot((0,dCt.jsx)("path",{d:"M8 5v14l11-7z"}),"PlayArrow");function Ade(e){return{display:"block",width:"100%",textAlign:"left",p:"5px 10px",borderRadius:0,bgcolor:e?"action.selected":"background.default",borderLeft:2,borderLeftColor:e?"primary.main":"transparent",cursor:e?"default":"pointer",transition:"background 0.15s","&:hover":e?void 0:{bgcolor:"action.hover"}}}var TAi=S(ie(),1);var fCt=S(R(),1),Lde=ot((0,fCt.jsx)("path",{d:"M12 1.27a11 11 0 00-3.48 21.46c.55.09.73-.28.73-.55v-1.84c-3.03.64-3.67-1.46-3.67-1.46-.55-1.29-1.28-1.65-1.28-1.65-.92-.65.1-.65.1-.65 1.1 0 1.73 1.1 1.73 1.1.92 1.65 2.57 1.2 3.21.92a2 2 0 01.64-1.47c-2.47-.27-5.04-1.19-5.04-5.5 0-1.1.46-2.1 1.2-2.84a3.76 3.76 0 010-2.93s.91-.28 3.11 1.1c1.8-.49 3.7-.49 5.5 0 2.1-1.38 3.02-1.1 3.02-1.1a3.76 3.76 0 010 2.93c.83.74 1.2 1.74 1.2 2.94 0 4.21-2.57 5.13-5.04 5.4.45.37.82.92.82 2.02v3.03c0 .27.1.64.73.55A11 11 0 0012 1.27"}),"GitHub");var Wxn=/^([^/\s]+)\/([^/\s]+)#(\d+)$/;function Ide(e){let t=Wxn.exec(e);if(!t)return;let[,r,n,o]=t;return`https://github.com/${r}/${n}/issues/${o}`}var Gxn=/^[^/\s]+\/[^/\s]+#(\d+)$/;function pCt(e){let t=Gxn.exec(e);return t?`#${t[1]}`:e}var qxn=/^([^/\s]+)\/([^/\s]+)#(\d+)$/;function hCt(e,t){let r=qxn.exec(e);if(!r||!t)return e;let[,n,o,i]=r;return`github.com/${n}/${o}`.toLowerCase()===t.toLowerCase()?`#${i}`:e}var CMe=S(R(),1),mCt={height:18,fontSize:"0.65rem"};function gCt({label:e,url:t,title:r}){return t?(0,CMe.jsx)(zn,{label:e,title:r,size:"small",sx:mCt,clickable:!0,component:"a",href:t,target:"_blank",rel:"noopener",onClick:n=>n.stopPropagation()}):(0,CMe.jsx)(zn,{label:e,title:r,size:"small",sx:mCt,clickable:!1,onClick:n=>n.stopPropagation()})}var w8=S(R(),1),yCt={display:"inline-flex",alignItems:"center",gap:.375,whiteSpace:"nowrap","& svg":{fontSize:14}};function vCt({icon:e,label:t,title:r,url:n}){return n?(0,w8.jsx)(pr,{title:r,children:(0,w8.jsxs)(Xr,{href:n,target:"_blank",rel:"noopener",underline:"hover",sx:yCt,children:[e,t]})}):(0,w8.jsx)(pr,{title:r,children:(0,w8.jsxs)(W,{component:"span",sx:{...yCt,color:"text.disabled"},children:[e,t]})})}var xCt=S(R(),1),jxn={color:"primary.main",opacity:.85,whiteSpace:"nowrap"};function bCt({label:e,url:t,title:r}){return t?(0,xCt.jsx)(Xr,{href:t,title:r,target:"_blank",rel:"noopener",underline:"hover",sx:jxn,onMouseDown:n=>n.stopPropagation(),onClick:n=>n.stopPropagation(),children:e}):e}var C8=S(R(),1),SCt={fontSize:"0.875rem"};function Dde({label:e,url:t,variant:r="link",icon:n,title:o}){return r==="chip"?(0,C8.jsx)(gCt,{label:e,url:t,title:o}):r==="token"?(0,C8.jsx)(bCt,{label:e,url:t,title:o}):r==="icon"?(0,C8.jsx)(vCt,{icon:n,label:e,title:o??e,url:t}):t?(0,C8.jsx)(Xr,{href:t,target:"_blank",rel:"noopener",onClick:i=>i.stopPropagation(),sx:SCt,children:e}):(0,C8.jsx)(Te,{variant:"body2",color:"text.disabled",sx:SCt,children:e})}var kMe=S(R(),1);function y_({githubIssue:e,origin:t,variant:r="link"}){return e?(0,kMe.jsx)(Dde,{label:r==="link"?hCt(e,t):pCt(e),title:e,url:Ide(e),icon:(0,kMe.jsx)(Lde,{}),variant:r}):null}var Mde=S(ie(),1);function TCt(){let[e,t]=(0,Mde.useState)(null);return(0,Mde.useEffect)(()=>{let r=!1;return(async()=>{try{let o=await(await fetch("/api/jira-site")).json();r||t(o?.site??null)}catch{r||t(null)}})(),()=>{r=!0}},[]),e}var wCt=S(R(),1);function k8({jiraKey:e,variant:t="link"}){let r=TCt();if(!e)return null;let n=r?`https://${r}/browse/${e}`:void 0;return(0,wCt.jsx)(Dde,{label:e,url:n,variant:t})}var _Me=S(R(),1);function Nde({tracker:e,variant:t="link"}){return e?.jiraKey?(0,_Me.jsx)(k8,{jiraKey:e.jiraKey,variant:t}):e?.githubIssue?(0,_Me.jsx)(y_,{githubIssue:e.githubIssue,origin:e.origin,variant:t}):null}var EMe=class extends Error{constructor(){super(...arguments);gr(this,"name","InvalidItemIdError")}};function gn(e){return`a${e}`}var Yxn=/^a?(\d+)$/;function _8(e){let t=Yxn.exec(e.trim());if(!t)throw new EMe(`Invalid backlog item id "${e}" (e.g. a574 or 574).`);return Number.parseInt(t[1],10)}function Yr(e,t){if(!t)return e;let r=e.includes("?")?"&":"?";return`${e}${r}node=${encodeURIComponent(t)}`}function dc(e,t,r){if(!t)return Yr(e,r);let n=e.includes("?")?"&":"?";return Yr(`${e}${n}cwd=${encodeURIComponent(t)}`,r)}function Md(e,t,r){return dc(`/backlog/items/${gn(e)}`,t,t&&r)}function Kxn(e,t){if(t==="neutral")return{color:e.palette.text.secondary,borderColor:e.palette.divider};let{main:r}=e.palette[t];return{color:r,borderColor:Vr(r,.35)}}function bi(e){return t=>({display:"inline-block",fontFamily:t.typography.fontFamilyMono,fontSize:10,fontWeight:400,lineHeight:"16px",px:"5px",border:1,borderRadius:"4px",whiteSpace:"nowrap",opacity:1,...Kxn(t,e)})}var Ode=S(ie(),1),fc=(0,Ode.createContext)(void 0);function br(){return(0,Ode.useContext)(fc)}var kCt=S(R(),1),Xxn=[bi("primary"),{flexShrink:0,textDecoration:"none"}],CCt=e=>e.stopPropagation();function Bde({itemId:e,cwd:t}){let r=br();return(0,kCt.jsx)(W,{component:va,to:Md(e,t,r),onMouseDown:CCt,onClick:CCt,sx:Xxn,children:gn(e)})}var Zxn={claude:"Claude",codex:"Codex",pi:"pi"},Qxn={claude:"Claude Code",codex:"Codex",pi:"pi"};function IS(e){return e??"claude"}function Il(e){return Zxn[IS(e)]}function _Ct(e){return Qxn[IS(e)]}var ECt=S(R(),1),Jxn=bi("neutral");function $de({harness:e}){return IS(e)==="claude"?null:(0,ECt.jsx)(W,{component:"span",sx:Jxn,children:Il(e).toLowerCase()})}var e2n=["update"];function E8(e){return!e||!e2n.includes(e)}function is(e){if(!e)return"";let t=e.split(/[/\\]/).filter(Boolean);return t[t.length-1]??""}function Dy(e){return e.repoGroup?.origin||e.cwd||void 0}function Dl(e){return e.repoGroup?.clone||e.cwd||void 0}function R8(e,t){if(!e)return e;for(let r of t){let n=r.repoGroup;if(n&&(n.clone===e||r.cwd===e))return n.origin}return e}var Hde=S(ie(),1);var RCt="";function RMe(e){RCt=e.replace(/\/+$/,"")}function DS(e){return`${RCt}${e}`}function PCt(e){let t=new URL(DS(e),location.href);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.toString()}var ACt=new WeakSet;function GP(e){typeof e=="object"&&e!==null&&ACt.add(e)}function gX(e){return typeof e=="object"&&e!==null&&ACt.has(e)}var t2n="/api/client-errors",IMe=1e3,r2n=6e4,n2n=1e4,o2n=50,i2n=500,P8=[],PMe,AMe=!1,Fde=IMe;function LMe(e){PMe||AMe||(PMe=setTimeout(()=>{PMe=void 0,s2n()},e))}async function a2n(e){try{return(await fetch(DS(t2n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({failures:e}),signal:AbortSignal.timeout(n2n)})).ok}catch{return!1}}async function s2n(){let e=P8.slice(0,o2n);if(e.length===0)return;AMe=!0;let t=await a2n(e);if(AMe=!1,t){P8=P8.slice(e.length),Fde=IMe,P8.length>0&&LMe(0);return}Fde=Math.min(Fde*2,r2n),LMe(Fde)}function LCt(e){P8=[...P8,e].slice(-i2n),LMe(IMe)}var l2n=100,MMe=[],DMe=new Set;function ICt(e){MMe=e;for(let t of DMe)t()}function A8(e){ICt([e,...MMe].slice(0,l2n)),LCt(e)}function NMe(){return MMe}function DCt(){ICt([])}function MCt(e){return DMe.add(e),()=>{DMe.delete(e)}}function c2n(e){return new URL(e,"http://local").searchParams.get("node")??void 0}function NCt(e,t,r){let n=Date.now();return o=>{r&&A8({at:new Date(n).toISOString(),method:(t??"GET").toUpperCase(),path:e,base:DS("")||location.origin,node:c2n(e),durationMs:Date.now()-n,...o})}}var u2n="x-assist-trace-id";async function d2n(e){try{let t=await e.clone().json();if(t&&typeof t=="object"&&"error"in t){let{error:r}=t;if(typeof r=="string"&&r)return r}}catch{}}async function OCt(e){let t=await d2n(e)??(e.statusText||void 0),r=e.headers?.get(u2n);return r?t?`${t} (trace=${r})`:`trace=${r}`:t}function BCt(e,t){let r=new AbortController,n=()=>r.abort(e?.reason);e?.aborted?n():e?.addEventListener("abort",n,{once:!0});let o=setTimeout(()=>r.abort(new DOMException(`timed out after ${t/1e3}s`,"TimeoutError")),t);return{signal:r.signal,clear:()=>{clearTimeout(o),e?.removeEventListener("abort",n)}}}var f2n=3e4;function p2n(e){return e instanceof DOMException&&e.name==="TimeoutError"}async function er(e,t={}){let{timeoutMs:r=f2n,capture:n=!0,blipGate:o,signal:i,...a}=t,{signal:s,clear:l}=BCt(i,r),u=NCt(e,a.method,n);try{let d=await fetch(DS(e),{...a,signal:s});return d.ok?o?.reset():(o?.shouldRecord(d.status)??!0)&&u({status:d.status,error:await OCt(d)}),d}catch(d){let f=s.aborted?s.reason:d;throw(!s.aborted||p2n(f))&&(u({error:f instanceof Error?f.message:String(f)}),GP(f)),f}finally{l()}}var h2n={error:"ERROR",rejection:"REJECT",caught:"CAUGHT"};function yX(e,t){A8({at:new Date().toISOString(),kind:e,method:h2n[e],path:location.pathname+location.search,base:location.origin,error:t,durationMs:0})}function Pr(e,t){if(gX(e))return;GP(e);let r=e instanceof Error?e.message:String(e);yX("caught",`${t}: ${r}`)}var $Ct=new Map;function zde(e,t){let r=`${t??""}\0${e??""}`,n=$Ct.get(r);return n||(n=(async()=>{let i=await(await er(dc("/api/items",e,t))).json(),a=new Map;for(let s of i)!s.jiraKey&&!s.githubIssue||a.set(s.id,{jiraKey:s.jiraKey,githubIssue:s.githubIssue,origin:s.origin});return a})().catch(o=>(Pr(o,"item trackers"),new Map)),$Ct.set(r,n)),n}function Ude(e){let[t,r]=(0,Hde.useState)(()=>new Map),n=br();return(0,Hde.useEffect)(()=>{let o=!1;return zde(e,n).then(i=>{o||r(i)}),()=>{o=!0}},[e,n]),o=>o==null?void 0:t.get(o)}var OMe=S(R(),1),m2n=bi("neutral");function Vde({node:e}){return e?(0,OMe.jsx)(pr,{title:`Running on ${e}`,children:(0,OMe.jsx)(W,{component:"span",sx:m2n,children:e})}):null}var My=S(R(),1),FCt={height:18,fontSize:"0.65rem"};function zCt({session:e}){let t=E8(e.sessionType)?is(e.cwd):"",r=Ude(e.cwd);return(0,My.jsxs)(My.Fragment,{children:[t&&(0,My.jsx)(zn,{label:t,size:"small",sx:FCt}),(0,My.jsx)($de,{harness:e.harness}),(0,My.jsx)(Vde,{node:e.node}),e.sessionType&&e.sessionType!=="next"&&(0,My.jsx)(zn,{label:e.sessionType,size:"small",color:"primary",variant:"outlined",sx:FCt}),e.itemId!=null&&(0,My.jsx)(Bde,{itemId:e.itemId,cwd:Dl(e)}),(0,My.jsx)(Nde,{variant:"chip",tracker:r(e.itemId)})]})}function wo(e){let t=Date.now()-new Date(e).getTime(),r=Math.floor(t/1e3);if(r<60)return"just now";let n=Math.floor(r/60);if(n<60)return`${n}m ago`;let o=Math.floor(n/60);if(o<24)return`${o}h ago`;let i=Math.floor(o/24);return i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}var HCt=S(R(),1);function na({children:e}){let t=r=>r.stopPropagation();return(0,HCt.jsx)(W,{sx:{display:"contents"},onClick:t,onMouseDown:t,onTouchStart:t,children:e})}var L8=S(ie(),1),g2n=1200;function I8(e){let[t,r]=(0,L8.useState)(!1),n=(0,L8.useRef)(void 0);return(0,L8.useEffect)(()=>()=>clearTimeout(n.current),[]),{copied:t,copy:()=>{navigator.clipboard?.writeText(e).then(()=>{r(!0),clearTimeout(n.current),n.current=setTimeout(()=>r(!1),g2n)})}}}var vX=S(R(),1);function UCt({sessionId:e,harness:t}){let{copied:r,copy:n}=I8(e),o=i=>{i.stopPropagation(),n()};return(0,vX.jsx)(na,{children:(0,vX.jsx)(pr,{title:r?"Copied!":`Copy ${Il(t)} session id`,open:r||void 0,children:(0,vX.jsx)(nr,{onClick:o,sx:{borderRadius:.5,px:.25},children:(0,vX.jsx)(Te,{variant:"caption",color:"text.disabled",sx:{fontFamily:"fontFamilyMono"},children:e.slice(0,8)})})})})}var bX=S(R(),1);function VCt({session:e}){return(0,bX.jsxs)(W,{sx:{display:"flex",alignItems:"center",gap:1,alignSelf:"flex-end"},children:[e.sessionId&&(0,bX.jsx)(UCt,{sessionId:e.sessionId,harness:e.harness}),(0,bX.jsx)(Te,{variant:"caption",color:"text.disabled",children:wo(e.timestamp)})]})}var WCt=S(R(),1);function Wde({children:e}){return(0,WCt.jsx)(W,{component:"mark",sx:{bgcolor:"warning.main",color:"warning.contrastText",borderRadius:.5,px:.25},children:e})}var Gde=S(R(),1);function GCt({snippet:e}){return(0,Gde.jsxs)(Te,{variant:"caption",sx:{color:"text.secondary",overflowWrap:"anywhere"},children:[e.before,(0,Gde.jsx)(Wde,{children:e.match}),e.after]})}function qCt(e){return e.prompt||e.name}var qP=S(R(),1);function jCt({session:e}){return(0,qP.jsxs)(qP.Fragment,{children:[e.title&&(0,qP.jsx)(Te,{variant:"body2",sx:{color:"text.primary",fontWeight:500,overflowWrap:"anywhere"},children:e.title}),(0,qP.jsx)(Te,{variant:e.title?"caption":"body2",sx:{color:e.title?"text.secondary":"text.primary",overflowWrap:"anywhere"},children:qCt(e)})]})}var bf=S(R(),1);function y2n({onResume:e}){return(0,bf.jsx)(Kt,{size:"small",onClick:t=>{t.stopPropagation(),e()},title:"Resume",sx:{color:"text.disabled","&:hover":{color:"text.primary"}},children:(0,bf.jsx)(Iy,{sx:{fontSize:14}})})}function YCt({session:e,selected:t=!1,onView:r,onResume:n}){return(0,bf.jsx)(fc.Provider,{value:e.node,children:(0,bf.jsx)(nr,{onClick:()=>r(e),sx:Ade(t),"aria-current":t||void 0,children:(0,bf.jsxs)(W,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[(0,bf.jsxs)(W,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,bf.jsx)(zCt,{session:e}),(0,bf.jsx)(W,{sx:{flex:1}}),(0,bf.jsx)(na,{children:(0,bf.jsx)(y2n,{onResume:()=>n(e)})})]}),(0,bf.jsx)(jCt,{session:e}),e.snippet&&(0,bf.jsx)(GCt,{snippet:e.snippet}),(0,bf.jsx)(VCt,{session:e})]})})})}var jde=S(R(),1);function qde({sessions:e,viewingId:t,onView:r,onResume:n,empty:o}){return(0,jde.jsxs)(W,{sx:{flex:1,overflow:"auto",p:1},children:[e.map(i=>(0,jde.jsx)(YCt,{session:i,selected:i.sessionId===t,onView:r,onResume:n},i.sessionId)),e.length===0&&o]})}var KCt=S(R(),1);function D8({children:e,color:t="text.disabled"}){return(0,KCt.jsx)(Te,{variant:"caption",color:t,role:"status",sx:{display:"block",textAlign:"center",p:2},children:e})}var M8=S(R(),1);function XCt({search:e,viewingId:t,...r}){return e.status==="loading"?(0,M8.jsx)(D8,{children:"Searching\u2026"}):e.status==="error"?(0,M8.jsxs)(D8,{color:"error.main",children:["Search failed: ",e.message]}):(0,M8.jsx)(qde,{sessions:e.sessions,viewingId:t,empty:(0,M8.jsx)(D8,{children:"No sessions match"}),...r})}var Yde=S(ie(),1);async function ZCt(e,t,r,n){let o=await er(Yr(`/api/history/search?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,r),{signal:n}),i=await o.json().catch(()=>({}));if(!o.ok)throw new Error(i.error??`HTTP ${o.status}`);let a=Array.isArray(i.sessions)?i.sessions:[];return r?a.map(s=>({...s,node:r})):a}var v2n=300;function QCt(e,t,r){let n=r.trim(),[o,i]=(0,Yde.useState)({status:"idle"});return(0,Yde.useEffect)(()=>{if(!e||!n){i({status:"idle"});return}i({status:"loading"});let a=new AbortController,s=setTimeout(()=>{ZCt(e,n,t,a.signal).then(l=>{a.signal.aborted||i({status:"done",sessions:l})},l=>{if(a.signal.aborted)return;let u=l instanceof Error?l.message:String(l);i({status:"error",message:u})})},v2n);return()=>{clearTimeout(s),a.abort()}},[e,t,n]),o}var Kde=S(ie(),1),xX=(0,Kde.createContext)({repos:[],selectedCwd:"",worktreeCwd:"",setSelectedCwd:()=>{},cloneOn:e=>e,originOf:()=>{}});function Gn(){return(0,Kde.useContext)(xX)}var jP=S(R(),1);function JCt({sessions:e,...t}){let{selectedCwd:r,selectedNode:n}=Gn(),{query:o,setQuery:i}=mX(),a=QCt(r,n,o),s=R8(r,e),l=r?e.filter(u=>Dy(u)===s||Dl(u)===r):[];return(0,jP.jsxs)(W,{sx:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[r&&(0,jP.jsx)(g_,{value:o,onChange:i,placeholder:"Search history..."}),a.status==="idle"?(0,jP.jsx)(qde,{sessions:l,empty:(0,jP.jsx)(D8,{children:"No history for this repo"}),...t}):(0,jP.jsx)(XCt,{search:a,...t,onView:u=>t.onView(u,o.trim())})]})}var Skt=S(ie(),1);function ekt(e,t,r){if(e.length===0)return null;let n=t===null?-1:e.indexOf(t);return n===-1?r===1?e[0]:e.at(-1):e[(n+r+e.length)%e.length]}var BMe=null;function Xde(e){BMe=e,e.focus({preventScroll:!0})}function Zde(){let e=globalThis.document;return e.querySelector('[role="dialog"][aria-modal="true"]')?!0:BMe!==null&&e.activeElement===BMe}function Qde(e){let t=globalThis.document.querySelector(`[data-session-id="${e}"]`);t&&Xde(t)}function Jde(e){globalThis.requestAnimationFrame(()=>{globalThis.document.querySelector(`[data-session-id="${e}"]`)?.scrollIntoView({block:"nearest"})})}function efe(e){return e.key==="Tab"&&!e.ctrlKey&&!e.altKey&&!e.metaKey}var YP=S(ie(),1);var tkt="assist:group-collapse",$Me=new Set;function FMe(){try{return localStorage.getItem(tkt)??""}catch{return""}}function zMe(e){if(!e)return{};try{let t=JSON.parse(e);return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([,r])=>r&&typeof r=="object"))}catch{return{}}}function rkt(e){try{localStorage.setItem(tkt,JSON.stringify(e))}catch{}for(let t of $Me)t()}function b2n(e,t){rkt({...zMe(FMe()),[e]:t})}function x2n(e){let t=zMe(FMe()),r=Object.fromEntries(Object.entries(t).filter(([n])=>!e.includes(n)));Object.keys(r).length!==Object.keys(t).length&&rkt(r)}function S2n(e){return $Me.add(e),()=>{$Me.delete(e)}}var MS={getRaw:FMe,parse:zMe,setChoice:b2n,removeChoices:x2n,subscribe:S2n};function N8(){let e=(0,YP.useSyncExternalStore)(MS.subscribe,MS.getRaw),t=(0,YP.useMemo)(()=>MS.parse(e),[e]),r=(0,YP.useCallback)(n=>{let o=t[n];return o!==void 0&&"collapsedAt"in o},[t]);return(0,YP.useMemo)(()=>({isCollapsed:r,setCollapsed:(n,o)=>MS.setChoice(n,o?{collapsedAt:Date.now()}:{openedAt:Date.now()})}),[r])}var NS=S(ie(),1);function T2n(e,t){let r=new URLSearchParams;e&&r.set("q",e),t&&t!=="todo"&&r.set("filter",t);let n=r.toString();return n?`/api/items?${n}`:"/api/items"}async function v_({query:e,cwd:t,node:r,signal:n,filter:o}={}){let i=await er(dc(T2n(e,o),t,r),{signal:n});if(!i.ok){let a=await i.json().catch(()=>null);throw new Error(a?.error??`HTTP ${i.status}`)}return i.json()}function SX(e){let t=e.activity?.itemId;if(!(!e.cwd||e.activity?.kind!=="backlog"||t==null))return{cwd:e.cwd,itemId:t}}function TX(e,t){return`${e}::${t}`}function nkt(e){let t=new Set;for(let r of e){let n=SX(r);n&&t.add(n.cwd)}return[...t].sort()}async function w2n(e){try{return(await v_({cwd:e,filter:"all"})).filter(r=>r.starred).map(r=>TX(e,r.id))}catch(t){return Pr(t,"starred keys"),[]}}async function okt(e){let t=await Promise.all(e.map(w2n));return new Set(t.flat())}var nfe=S(ie(),1);var ikt="/api/backlog/docs-refresh";async function tfe(e,t,r){let n=await er(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)throw new Error(`${t} ${e} failed: ${n.status}`);return n.json()}async function akt(e,t,r){await er(dc(`/api/items/${gn(e)}`,t,r),{method:"DELETE"})}function O8(e,t,r,n){return tfe(dc(`/api/items/${gn(e)}`,r,n),"PATCH",{status:t})}function rfe(e,t,r,n){return tfe(dc(`/api/items/${gn(e)}/star`,r,n),"POST",{starred:t})}function skt(e,t,r,n,o){return tfe(dc(`/api/items/${gn(e)}/rewind`,n,o),"POST",{phase:t,reason:r})}async function lkt(e,t,r){return(await er(dc(ikt,e,t),{signal:r})).json()}function ckt(e,t){return tfe(dc(ikt,e,t),"POST",{})}function C2n(e,t,r){let n=new Set(e);return r?n.add(t):n.delete(t),n}function ukt(e,t){let r=SX(t);return r?e.has(TX(r.cwd,r.itemId)):t.starred??!1}function dkt(e,t,r){let n=SX(r);if(!n){t(r.id,!(r.starred??!1));return}let o=TX(n.cwd,n.itemId);e(i=>{let a=!i.has(o);return rfe(n.itemId,a,n.cwd),C2n(i,o,a)})}function k2n(e,t){let r=!1,n=e?e.split("|"):[];return okt(n).then(o=>{r||t(o)}),()=>{r=!0}}function fkt(e){let[t,r]=(0,nfe.useState)(new Set);return(0,nfe.useEffect)(()=>k2n(e,r),[e]),[t,r]}var hkt=S(R(),1),pkt=(0,NS.createContext)(null);function ofe({sessions:e,setSessionStarred:t,children:r}){let n=nkt(e).join("|"),[o,i]=fkt(n),a=(0,NS.useCallback)(u=>ukt(o,u),[o]),s=(0,NS.useCallback)(u=>dkt(i,t,u),[i,t]),l=(0,NS.useMemo)(()=>({isStarred:a,toggleStar:s}),[a,s]);return(0,hkt.jsx)(pkt.Provider,{value:l,children:r})}function Ig(){let e=(0,NS.useContext)(pkt);if(!e)throw new Error("useStarredSessions must be used within a StarredSessionsProvider");return e}function ife(e){return e.flatMap(t=>t.kind==="single"?[t.session]:t.rows.flatMap(r=>[r.session,...r.children]))}var HMe="assist:group-order";var KP=null;function _2n(){if(KP)return KP;try{let e=JSON.parse(localStorage.getItem(HMe)??"[]");KP=Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}catch{KP=[]}return KP}function E2n(e){KP=e;try{localStorage.setItem(HMe,JSON.stringify(e))}catch{}}function R2n(e,t){let r=e.length-200;return r<=0?e:e.filter(n=>t.has(n)||r--<=0)}function P2n(e){let t=_2n(),r=e.filter(o=>!t.includes(o)),n=r.length>0?R2n([...t,...r],new Set(e)):t;return n!==t&&E2n(n),new Map(n.map((o,i)=>[o,i]))}function A2n(){KP=null;try{localStorage.removeItem(HMe)}catch{}}var mkt={rank:P2n,clear:A2n};function gkt(e){let t=new Map;for(let n of e){let o=Dy(n)??` nogroup:${n.id}`,i=t.get(o);if(i){i.members.push(n);continue}t.set(o,{key:o,label:is(Dl(n)??o),members:[n]})}let r=mkt.rank([...t.keys()]);return[...t.values()].sort((n,o)=>(r.get(n.key)??0)-(r.get(o.key)??0))}function ykt(e){let t=new Map(e.map(o=>[o.id,o])),r=L2n(e),n=new Map;for(let o of e){let i=I2n(o,t)??M2n(o,r);i&&n.set(o,i)}return n}function L2n(e){let t=new Map;for(let r of e){let n=bkt(r);!n||!vkt(r)||t.has(n)||t.set(n,r)}return t}function I2n(e,t){let r=e.launchedFrom?t.get(e.launchedFrom):void 0;if(!(!r||r===e))return D2n(e,r)?r:void 0}function D2n(e,t){return e.cwd!==void 0&&e.cwd===t.cwd}function M2n(e,t){if(vkt(e))return;let r=bkt(e),n=r?t.get(r):void 0;return n===e?void 0:n}function vkt(e){return e.activity?.kind==="backlog"}function bkt(e){let{cwd:t,repoGroup:r}=e;if(!(!t||!r||r.clone===t))return t}function afe(e){let t=ykt(e),r=new Map;for(let i of e){let a=N2n(i,t);a&&r.set(i,a)}let n=new Map,o=[];for(let i of e){if(r.has(i))continue;let a={session:i,children:[]};n.set(i,a),o.push(a)}for(let i of e){let a=r.get(i);a&&n.get(a)?.children.push(i)}return o}function N2n(e,t){let r=new Set([e]),n=t.get(e);for(;n;){if(r.has(n))return;let o=t.get(n);if(!o)return n;r.add(n),n=o}}function UMe(e,t){return[...e.filter(r=>t(r)),...e.filter(r=>!t(r))]}function sfe(e,t,r=2){let n=gkt(e).map(({key:o,label:i,members:a})=>a.length<r?{kind:"single",session:a[0]}:{kind:"repo",key:o,label:i,rows:UMe(afe(a),s=>xkt(s).some(t))});return UMe(n,o=>O2n(o).some(t))}function xkt(e){return[e.session,...e.children]}function O2n(e){return e.kind==="repo"?e.rows.flatMap(xkt):[e.session]}var B2n=()=>!1;function lfe(e,t,r=B2n,n=2){return ife(sfe(e,t,n).filter(o=>o.kind==="single"||!r(o.key)))}function Tkt({sessions:e,onSelect:t}){let{isStarred:r}=Ig(),{isCollapsed:n}=N8();return(0,Skt.useCallback)(o=>{if(!efe(o.nativeEvent))return;let i=o.target.closest("[data-session-id]");if(!i)return;let a=lfe(e,r,n,1).map(u=>u.id),s=i.getAttribute("data-session-id"),l=ekt(a,s,o.shiftKey?-1:1);!l||l===s||(o.preventDefault(),t(l),Qde(l),Jde(l))},[e,r,n,t])}var VMe=S(R(),1),$2n={flex:1,overflow:"auto"},F2n={py:.5};function wkt({sessions:e,onSelect:t,children:r}){let n=Tkt({sessions:e,onSelect:t});return(0,VMe.jsx)(W,{sx:$2n,onKeyDown:n,children:(0,VMe.jsx)(W,{sx:F2n,children:r})})}var kkt=S(R(),1),z2n={display:"block",textAlign:"center",p:2};function Ckt(){return(0,kkt.jsx)(Te,{variant:"caption",color:"text.disabled",sx:z2n,children:"No sessions yet"})}var _kt=S(R(),1),Bo=ot((0,_kt.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var Ekt=S(R(),1),B8=ot((0,Ekt.jsx)("path",{d:"M12 7c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1s-1-.45-1-1V8c0-.55.45-1 1-1m-.01-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m1-3h-2v-2h2z"}),"ErrorOutlineRounded");var _1=S(R(),1),H2n={...Ade(!1),cursor:"default",position:"relative"},U2n={position:"absolute",top:4,right:4,color:"text.disabled","&:hover":{color:"text.primary"}},V2n={display:"flex",alignItems:"center",gap:1,pr:3},W2n={color:"text.primary",overflowWrap:"anywhere"};function G2n(e){return{display:"block",mt:.5,color:e?"error.main":"text.secondary",overflowWrap:"anywhere"}}function q2n(e){return e.node?`Starting session on ${e.node}\u2026`:"Starting session\u2026"}function Rkt({launch:e,onDismiss:t}){let r=e.status==="error";return(0,_1.jsxs)(W,{sx:H2n,children:[(0,_1.jsx)(Kt,{size:"small",onClick:()=>t(e.id),title:"Dismiss",sx:U2n,children:(0,_1.jsx)(Bo,{sx:{fontSize:16}})}),(0,_1.jsxs)(W,{sx:V2n,children:[r?(0,_1.jsx)(B8,{color:"error",sx:{fontSize:18}}):(0,_1.jsx)(mo,{size:16}),(0,_1.jsx)(Te,{variant:"body2",sx:W2n,children:e.title})]}),(0,_1.jsx)(Te,{variant:"caption",sx:G2n(r),children:r?e.error:q2n(e)})]})}function Pkt(e){return new Set(e.filter(t=>t.cwd&&t.cwd===t.repoGroup?.clone).map(t=>t.id))}function WMe(e){return e.commandType==="run"&&e.server===!0&&e.status!=="done"&&e.status!=="error"}function Akt(e){return e.filter(WMe)}var Lkt=S(R(),1),cfe=ot((0,Lkt.jsx)("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"}),"Launch");var ufe=S(ie(),1),GMe=(0,ufe.createContext)({nodes:null,names:[],visible:!1,selected:void 0,select:()=>{}});function Fs(){return(0,ufe.useContext)(GMe)}function Ikt(e,t,r,n="http"){let o=t&&t!==r?.local?r?.links.find(i=>i.name===t):void 0;return o?{url:`${n}://${new URL(o.url).hostname}:${e}`,remote:!0}:{url:`${n}://localhost:${e}`,remote:!1}}var Dkt=S(R(),1);function dfe({port:e,node:t,protocol:r}){let{nodes:n}=Fs(),{url:o,remote:i}=Ikt(e,t,n,r);return(0,Dkt.jsxs)(Xr,{href:o,title:i?`Opens ${o} on ${t}; the dev server must listen on the tailnet (e.g. --host 0.0.0.0)`:o,target:"_blank",rel:"noopener noreferrer",color:"inherit",onMouseDown:a=>a.stopPropagation(),onClick:a=>a.stopPropagation(),children:[":",e]})}var E1=S(R(),1),j2n={display:"flex",alignItems:"center",gap:.5,px:"10px",py:.25,borderRadius:0,borderLeft:2,borderLeftColor:"success.main",bgcolor:"success.dark"},Y2n={flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"success.contrastText"};function Mkt({serving:e,onJump:t}){let r=is(e.cwd),n=r?` \xB7 ${r} \xB7 ${e.name}`:` \xB7 ${e.name}`,o=`${e.port?`serving :${e.port}`:"serving"}${n}`;return(0,E1.jsxs)(W,{sx:j2n,children:[(0,E1.jsxs)(Te,{variant:"caption",title:o,sx:Y2n,children:["serving",e.port?(0,E1.jsxs)(E1.Fragment,{children:[" ",(0,E1.jsx)(dfe,{port:e.port,node:e.node,protocol:e.protocol})]}):null,n]}),(0,E1.jsx)(it,{size:"small",startIcon:(0,E1.jsx)(cfe,{sx:{fontSize:14}}),onClick:i=>{i.stopPropagation(),t()},sx:{color:"success.contrastText",minWidth:0},children:"Jump"})]})}var wX=S(R(),1);function Nkt({sessions:e,onJump:t}){let r=Akt(e);return r.length===0?null:(0,wX.jsx)(wX.Fragment,{children:r.map(n=>(0,wX.jsx)(Mkt,{serving:n,onJump:()=>t(n.id)},n.id))})}function Okt(e){return e.flatMap(t=>[t.session,...t.children])}var CX=S(R(),1),K2n={position:"relative","&::before":{content:'""',position:"absolute",left:0,top:"-1px",width:"6px",height:"19.5px",borderLeft:1,borderBottom:1,borderColor:"divider"},"&:not(:last-of-type)::after":{content:'""',position:"absolute",left:0,top:0,bottom:"-1px",borderLeft:1,borderColor:"divider"}},X2n={ml:"13px"};function Bkt({rows:e,renderCard:t}){let r=(n,o,i=!0)=>(0,CX.jsx)(W,{sx:i?K2n:void 0,children:t(n,o)},n.id);return e.map(n=>n.children.length===0?r(n.session,void 0,!1):(0,CX.jsxs)(W,{children:[r(n.session,n.children,!1),(0,CX.jsx)(W,{sx:X2n,children:n.children.map(o=>r(o))})]},n.session.id))}var OS=S(R(),1);function qo({onConfirm:e,onCancel:t,title:r="Confirm deletion",message:n="Are you sure you want to delete this item?",confirmLabel:o="Delete",confirmColor:i="error",busy:a=!1,autoFocusConfirm:s=!1}){return(0,OS.jsxs)(ts,{open:!0,onClose:a?void 0:t,maxWidth:"xs",fullWidth:!0,children:[(0,OS.jsx)(Wc,{children:r}),(0,OS.jsx)(Vc,{children:(0,OS.jsx)(Pk,{children:n})}),(0,OS.jsxs)(Cd,{children:[(0,OS.jsx)(it,{onClick:t,disabled:a,children:"Cancel"}),(0,OS.jsx)(it,{variant:"contained",color:i,onClick:e,loading:a,autoFocus:s,children:o})]})]})}var $kt=S(ie(),1),Z2n="(Shift skips confirmation)";function zs(e,{needsConfirm:t=!0,onOpen:r}={}){let[n,o]=(0,$kt.useState)(!1),i=r??(()=>o(!0));return{confirming:n,close:()=>o(!1),triggerHandlers:{onClick:a=>{a.stopPropagation(),a.shiftKey||!t?e():i()},onKeyDown:a=>{a.key!=="Enter"||!a.shiftKey||(a.preventDefault(),a.stopPropagation(),e())}},withHint:a=>`${a} ${Z2n}`}}var BS=S(R(),1),qMe="group-close",Q2n={p:"2px",my:"-2px",opacity:0,color:"text.disabled","&:hover":{color:"text.primary"},"&:focus-visible":{opacity:1}};function Fkt({label:e,sessionIds:t,onDismiss:r}){let n=()=>{for(let d of t)r(d)},{confirming:o,close:i,triggerHandlers:a,withHint:s}=zs(n),l=t.length,u=l===1?"session":"sessions";return(0,BS.jsxs)(BS.Fragment,{children:[(0,BS.jsx)(Kt,{size:"small",className:qMe,...a,title:s(`Close all sessions in ${e}`),sx:Q2n,children:(0,BS.jsx)(Bo,{sx:{fontSize:14}})}),o&&(0,BS.jsx)(na,{children:(0,BS.jsx)(qo,{title:`Close ${e}`,message:`This will close all ${l} ${u} in ${e}, including starred and nested sessions. Running sessions will be stopped.`,confirmLabel:`Close ${l}`,onConfirm:()=>{i(),n()},onCancel:i})})]})}function oa(e){let t=e.pendingPrPreview;return t&&t.kind!=="show"&&(e.status==="running"||e.status==="waiting")?t.kind==="question"||t.kind==="backlog-item"?"question":t.kind==="check"||t.kind==="design"?"check":"waiting":e.status}var J2n=["check","waiting","running","done"];function eSn(e){return e==="question"?"waiting":e}function zkt(e){return J2n.map(t=>({status:t,count:e.filter(r=>eSn(oa(r))===t).length})).filter(t=>t.count>0)}var tSn={claude:{red:30,yellow:20},codex:{red:75,yellow:50},pi:{red:30,yellow:20}};function Hkt(e,t){let{red:r,yellow:n}=tSn[IS(t)];return e>=r?"red":e>=n?"yellow":"dim"}var Uu={running:"success.main",idle:"text.disabled",waiting:"warning.main",question:"warning.main",check:"warning.main",done:"info.main",error:"error.main",stopped:"text.secondary"};function ffe(e,t){switch(Hkt(e,t)){case"red":return"error.main";case"yellow":return"warning.main";default:return"text.disabled"}}var Vu={running:"\u25CF",idle:"\u25CF",waiting:"\u25C6",question:"?",check:"\u25B2",done:"\u2713",error:"\u2715",stopped:"\u25CB"};var kX=S(R(),1),rSn={display:"flex",gap:1,flexShrink:0,color:"text.secondary",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};function Ukt({sessions:e}){return(0,kX.jsx)(W,{sx:rSn,children:zkt(e).map(({status:t,count:r})=>(0,kX.jsxs)(Te,{variant:"caption","data-tally":t,children:[(0,kX.jsx)(W,{component:"span",sx:{color:Uu[t]},children:Vu[t]})," ",r," ",t]},t))})}var Vkt=S(R(),1),Co=ot((0,Vkt.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight");var Wkt=S(R(),1),ka=ot((0,Wkt.jsx)("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore");var qkt=S(R(),1),nSn={fontSize:12,color:"text.secondary",flexShrink:0};function Gkt({collapsed:e}){return(0,qkt.jsx)(e?Co:ka,{sx:nSn})}var jkt=S(R(),1),Ykt=ot((0,jkt.jsx)("path",{d:"M14 4v5c0 1.12.37 2.16 1 3H9c.65-.86 1-1.9 1-3V4zm3-2H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3V4h1c.55 0 1-.45 1-1s-.45-1-1-1"}),"PushPinOutlined");var b_=S(R(),1),oSn={minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:11,fontWeight:600,lineHeight:"16px",letterSpacing:"0.06em",textTransform:"uppercase",color:"text.secondary"},iSn={fontSize:14,color:"text.disabled",flexShrink:0};function Kkt({label:e,pinned:t}){return(0,b_.jsxs)(b_.Fragment,{children:[(0,b_.jsx)(Te,{variant:"body1",title:e,sx:oSn,children:e}),t&&(0,b_.jsx)(pr,{title:"Collapsed by you. Stays collapsed until you open it.",children:(0,b_.jsx)(Ykt,{"data-testid":"group-pinned","aria-label":"Collapsed by you",sx:iSn})})]})}var jMe={toggle:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:.75,justifyContent:"flex-start",textAlign:"left",borderRadius:.5,"&:focus-visible":{outline:1,outlineColor:"primary.main"}},count:{color:"text.disabled",fontVariantNumeric:"tabular-nums",fontFamily:"fontFamilyMono",fontSize:11,lineHeight:1}};var $8=S(R(),1);function Xkt({label:e,count:t,collapsedSummary:r,collapsed:n,pinned:o,onToggle:i}){return(0,$8.jsxs)(nr,{"aria-expanded":!n,onClick:i,sx:jMe.toggle,children:[(0,$8.jsx)(Gkt,{collapsed:n}),(0,$8.jsx)(Kkt,{label:e,pinned:o}),n?r:(0,$8.jsx)(Te,{variant:"caption",sx:jMe.count,children:t})]})}var F8=S(R(),1),aSn={display:"flex",alignItems:"center",gap:.75,p:"8px 12px 4px",bgcolor:"background.paper",position:"sticky",top:0,zIndex:1,[`&:hover .${qMe}`]:{opacity:1}};function Zkt({label:e,sessions:t,collapsed:r,pinned:n,onToggle:o,onDismiss:i}){return(0,F8.jsxs)(W,{sx:aSn,children:[(0,F8.jsx)(Xkt,{label:e,count:t.length,collapsedSummary:(0,F8.jsx)(Ukt,{sessions:t}),collapsed:r,pinned:n,onToggle:o}),(0,F8.jsx)(Fkt,{label:e,sessionIds:t.map(a=>a.id),onDismiss:i})]})}var pfe=S(ie(),1),YMe=(0,pfe.createContext)(!1);function Qkt(){return(0,pfe.useContext)(YMe)}var _X=S(R(),1),sSn={mb:.5};function Jkt({groupKey:e,label:t,sessions:r,onDismiss:n,children:o}){let{isCollapsed:i,setCollapsed:a}=N8(),s=i(e);return(0,_X.jsxs)(W,{sx:sSn,children:[(0,_X.jsx)(Zkt,{label:t,sessions:r,collapsed:s,pinned:s,onToggle:()=>a(e,!s),onDismiss:n}),!s&&(0,_X.jsx)(YMe.Provider,{value:!0,children:o})]})}function hfe(e,t,r){if(t.length===0)return;let n=()=>{for(let o of t)r(o.id)};return{childCount:t.length,onDismissAll:()=>{r(e.id),n()},onDismissChildren:n}}function mfe(e,t){return!t.has(e.id)&&e.status!=="done"&&e.status!=="error"&&e.status!=="stopped"}var XP="branch";function e_t(e,t){return[{value:"all",label:"All changes"},{value:"uncommitted",label:"Uncommitted"},...t?[{value:XP,label:"Branch",note:`vs ${t}`}]:[],...e.map(r=>({value:r.sha,label:r.title||r.sha.slice(0,7)}))]}function t_t(e,t){return e.find(r=>r.value===t)??{value:"all",label:"All changes"}}var gfe=S(ie(),1);var x_=S(ie(),1);function r_t(e,t,r){let n=e[t];return n&&n.cwd===r.cwd&&n.scope===r.scope?KMe(e,t):{...e,[t]:{...r,mode:n?.mode??"half"}}}function KMe(e,t){let{[t]:r,...n}=e;return r?n:e}function n_t(e,t){let r=new Set(t),n=Object.entries(e).filter(([o])=>r.has(o));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function o_t(e,t,r){let n=e[t];return n?{...e,[t]:{...n,scope:r}}:e}function i_t(e,t){let r=e[t];if(!r)return e;let n=r.mode==="half"?"full":"half";return{...e,[t]:{...r,mode:n}}}function a_t(e,t){let[r,n]=(0,x_.useState)({}),o=e.join(" ");(0,x_.useEffect)(()=>{let a=o===""?[]:o.split(" ");n(s=>n_t(s,a))},[o]);let i=(0,x_.useCallback)((a,s)=>{t(a),n(l=>r_t(l,a,s))},[t]);return(0,x_.useMemo)(()=>({panelFor:a=>a===null?void 0:r[a],togglePanel:i,closePanel:a=>n(s=>KMe(s,a)),setPanelScope:(a,s)=>n(l=>o_t(l,a,s)),togglePanelMode:a=>n(s=>i_t(s,a))}),[r,i])}var c_t=S(R(),1),s_t=(0,gfe.createContext)(null);function l_t({sessionIds:e,onActivateSession:t,children:r}){let n=a_t(e,t);return(0,c_t.jsx)(s_t.Provider,{value:n,children:r})}function Dg(){let e=(0,gfe.useContext)(s_t);if(!e)throw new Error("useDiffPanels must be used within a DiffPanelsProvider");return e}var d_t=S(R(),1);function u_t({panelSessionId:e,cwd:t,sessionId:r,defaultBranch:n}){let{togglePanel:o}=Dg(),i=br(),a=`Diff against ${n}`;return(0,d_t.jsxs)(Xr,{component:"button",type:"button",title:a,"aria-label":a,onClick:()=>o(e,{cwd:t,claudeSessionId:r,scope:XP,node:i}),variant:"caption",underline:"hover",color:"inherit",sx:{border:0,p:0,bgcolor:"transparent",cursor:"pointer",fontFamily:"fontFamilyMono",whiteSpace:"nowrap",color:"text.disabled","&:hover":{color:"text.primary"}},children:["vs ",n]})}function z8(){return/Mac|iPhone|iPad/.test(globalThis.navigator?.platform??"")}var lSn={Ctrl:"\u2303",Alt:"\u2325",Shift:"\u21E7",Mod:"\u2318",Meta:"\u2318"},cSn={Mod:"Ctrl"};function f_t(e,t=z8()){let r=t?lSn:cSn;return e.map(n=>r[n]??n)}function yfe(e,t=z8()){return f_t(e,t).join(t?"":"+")}var p_t=S(R(),1),uSn={px:.5,border:1,borderColor:"grey.500",borderRadius:.5,fontFamily:"fontFamilyMono",fontSize:11,whiteSpace:"nowrap"};function vfe({chords:e}){return e.map(t=>{let r=yfe(t);return(0,p_t.jsx)(W,{component:"kbd",sx:uSn,children:r},r)})}var EX=S(R(),1);function Nd({label:e,chords:t}){return(0,EX.jsxs)(kt,{direction:"row",spacing:.75,sx:{alignItems:"center"},children:[(0,EX.jsx)("span",{children:e}),(0,EX.jsx)(vfe,{chords:t})]})}var dSn={"/":"Slash",".":"Period",",":"Comma",";":"Semicolon","'":"Quote","[":"BracketLeft","]":"BracketRight","\\":"Backslash","-":"Minus","=":"Equal","`":"Backquote"},fSn=["Enter","Space","Escape","Backspace","Delete","Insert","Home","End","PageUp","PageDown","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"];function h_t(e){if(/^[a-z]$/i.test(e)){let n=e.toUpperCase();return{code:`Key${n}`,label:n}}if(/^\d$/.test(e))return{code:`Digit${e}`,label:e};let t=dSn[e];if(t)return{code:t,label:e};if(/^F([1-9]|1[0-2])$/i.test(e)){let n=e.toUpperCase();return{code:n,label:n}}let r=fSn.find(n=>n.toLowerCase()===e.toLowerCase());return r?{code:r,label:r}:void 0}var pSn={mod:"Mod",ctrl:"Ctrl",control:"Ctrl",alt:"Alt",option:"Alt",opt:"Alt",shift:"Shift",meta:"Meta",cmd:"Meta",command:"Meta",win:"Meta"},hSn=["Mod","Ctrl","Alt","Shift","Meta"];function m_t(e,t){let r=new Set;for(let n of e){let o=pSn[n.toLowerCase()];if(!o)return{ok:!1,error:`"${n}" is not a modifier in "${t}"`};if(r.has(o))return{ok:!1,error:`"${n}" is repeated in "${t}"`};r.add(o)}return[...r].some(n=>n!=="Shift")?r.has("Mod")&&(r.has("Ctrl")||r.has("Meta"))?{ok:!1,error:`"${t}" combines Mod with Ctrl or Meta, which Mod already means`}:{ok:!0,modifiers:hSn.filter(n=>r.has(n))}:{ok:!1,error:`"${t}" needs at least one of Mod, Ctrl, Alt or Meta`}}function g_t(e,{modifiersOnly:t=!1}={}){let r=e.split("+").map(s=>s.trim()),n=t?void 0:r.pop(),o=m_t(r,e);if(!o.ok)return o;let{modifiers:i}=o;if(n===void 0)return{ok:!0,chord:{modifiers:i}};let a=h_t(n);return a?{ok:!0,chord:{modifiers:i,key:a}}:{ok:!1,error:`"${n}" is not a key in "${e}"`}}function bfe({modifiers:e,key:t},r,n=z8()){if(r.type!=="keydown"||t&&r.code!==t.code)return!1;let o=e.includes("Mod");return r.ctrlKey===(e.includes("Ctrl")||o&&!n)&&r.metaKey===(e.includes("Meta")||o&&n)&&r.altKey===e.includes("Alt")&&r.shiftKey===e.includes("Shift")}var mSn=/^Digit([1-6])$/;function RX(e,t){if(!t.some(n=>bfe(n,e)))return;let r=mSn.exec(e.code);return r?Number(r[1])-1:void 0}var H8={navTab:{label:"Switch top-level tab",group:"Navigate"},focusSidebar:{label:"Focus sidebar (backlog: last-selected session card)",group:"Navigate"},focusTerminal:{label:"Focus terminal (backlog: search / back)",group:"Navigate"},toggleDiff:{label:"Open / close diff panel, or focus preview pane",group:"Navigate"},focusRepoPicker:{label:"Focus repo picker",group:"Navigate"},openUpdates:{label:"Open updates",group:"Navigate"},openConfig:{label:"Open config",group:"Navigate"},openMenu:{label:"Open menu",group:"Navigate"},cycleCards:{label:"Next / previous sidebar card",group:"Navigate"},nextWaiting:{label:"Next waiting session",group:"Sessions"},focusAddAgent:{label:"Focus add agent",group:"Sessions"},focusVsCode:{label:"Focus VS Code",group:"Sessions"},focusDone:{label:"Focus done",group:"Sessions"},newSession:{label:"New session",group:"Sessions"},quickOpen:{label:"Quick open file",group:"Files"},save:{label:"Save file",group:"Files"},shortcutsSheet:{label:"Keyboard shortcuts",group:"Help"}};var gSn="1\u20136",y_t=new WeakMap;function S_(e,t){let r=y_t.get(t);r||(r=new Map,y_t.set(t,r));let n=r.get(e);return n||(n=ySn(e,t),r.set(e,n)),n}function ySn(e,t){let{label:r,group:n}=H8[e];if(e==="cycleCards")return{label:r,group:n,chords:[["Tab"],["Shift","Tab"]],bound:[],matches:efe};let o=e==="navTab",i=t[e].flatMap(a=>{let s=g_t(a,{modifiersOnly:o});return s.ok?[s.chord]:[]});return{label:r,group:n,chords:i.map(a=>vSn(a)),bound:i,matches:o?a=>RX(a,i)!==void 0:a=>i.some(s=>bfe(s,a))}}function vSn({modifiers:e,key:t}){return[...e,t?.label??gSn]}var x_t=S(ie(),1);var v_t={navTab:["Alt"],focusSidebar:["Alt+A"],focusTerminal:["Alt+S"],toggleDiff:["Alt+D"],focusRepoPicker:["Alt+R"],openUpdates:["Alt+Q"],openConfig:["Alt+W"],openMenu:["Alt+E"],focusAddAgent:["Alt+Z"],focusVsCode:["Alt+X"],focusDone:["Alt+C"],nextWaiting:["Mod+."],newSession:["Mod+N","Alt+N"],quickOpen:["Mod+P"],save:["Mod+S"],shortcutsSheet:["Mod+/"]};var b_t=v_t,XMe=new Set,ZP={get:()=>b_t,set(e){b_t=e;for(let t of XMe)t()},subscribe(e){return XMe.add(e),()=>XMe.delete(e)}};function U8(){return(0,x_t.useSyncExternalStore)(ZP.subscribe,ZP.get)}function go(e){return S_(e,U8())}var ZMe=S(R(),1);function S_t({show:e,children:t}){let{label:r,chords:n}=go("toggleDiff");return(0,ZMe.jsx)(pr,{describeChild:!0,title:e?(0,ZMe.jsx)(Nd,{label:r,chords:n}):"",children:t})}function T_t(e){return t=>({px:1,py:"3px",border:1,borderRadius:`${t.tokens.radius.sm}px`,borderColor:e?Vr(t.palette.primary.main,.55):"divider",bgcolor:e?t.tokens.color.selected:"background.default",fontSize:11,textDecoration:"none",transition:"border-color .2s ease, background-color .2s ease","&:hover":{textDecoration:"none",borderColor:e?Vr(t.palette.primary.main,.55):t.palette.text.disabled}})}function w_t(e,t,r){let n=Dg().panelFor(e);if(!r)return;let o=n!==void 0&&(t==="uncommitted"?n.scope===t:n.scope!=="uncommitted");return{pressed:o,sx:T_t(o)}}var k_t=S(R(),1);function C_t({groups:e}){return e.map(t=>(0,k_t.jsxs)(W,{component:"span",sx:{color:t.color},children:[t.prefix,t.count]},t.key))}var QP=S(R(),1),bSn={display:"flex",alignItems:"center",gap:.75,fontFamily:"fontFamilyMono",whiteSpace:"nowrap",border:0,p:0,bgcolor:"transparent",cursor:"pointer"};function QMe({panelSessionId:e,cwd:t,sessionId:r,scope:n,groups:o,bracketed:i,toggleChordHint:a=!1,countButton:s=!1}){let{togglePanel:l}=Dg(),u=br(),d=w_t(e,n,s);return(0,QP.jsx)(S_t,{show:a,children:(0,QP.jsxs)(Xr,{component:"button",type:"button",onClick:()=>l(e,{cwd:t,claudeSessionId:r,scope:n,node:u}),variant:"caption",underline:d?"none":"hover",color:"inherit","aria-pressed":d?.pressed,sx:[bSn,d?.sx??{}],children:[i&&(0,QP.jsx)(W,{component:"span",children:"("}),(0,QP.jsx)(C_t,{groups:o}),i&&(0,QP.jsx)(W,{component:"span",children:")"})]})})}var V8=S(R(),1),xSn={display:"flex",alignItems:"center",gap:.75,minWidth:0},__t=[{key:"new",prefix:"+",color:"success.main"},{key:"modified",prefix:"~",color:"warning.main"},{key:"deleted",prefix:"-",color:"error.main"}];function E_t({panelSessionId:e,cwd:t,sessionId:r,groups:n,uncommitted:o,toggleChordHint:i,countButton:a}){return(0,V8.jsx)(na,{children:(0,V8.jsxs)(W,{sx:xSn,"data-testid":"git-status-counts",children:[n.length>0&&(0,V8.jsx)(QMe,{panelSessionId:e,cwd:t,sessionId:r,scope:"all",groups:n,toggleChordHint:i,countButton:a}),o&&o.length>0&&(0,V8.jsx)(QMe,{panelSessionId:e,cwd:t,sessionId:r,scope:"uncommitted",groups:o,bracketed:!0,countButton:a})]})})}function R_t(e){return __t.map(t=>({...t,count:e[t.key]?.length??0})).filter(t=>t.count>0)}function P_t(e){if(!e)return null;let t=R_t(e),r=e.hasCommits&&e.uncommitted?R_t(e.uncommitted):void 0;return t.length>0||(r?.length??0)>0?{kind:"counts",groups:t,uncommitted:r}:e.defaultBranch&&e.onDefaultBranch===!1?{kind:"branch",defaultBranch:e.defaultBranch}:null}var T_=S(ie(),1);var SSn=new Set([502,504]);function A_t(){let e=!1;return{shouldRecord:t=>SSn.has(t)?e?!0:(e=!0,!1):(e=!1,!0),reset:()=>{e=!1}}}function W8(e,t,r){let n=new URLSearchParams({cwd:e});return t&&n.set("session",t),r&&r!=="all"&&n.set("scope",r),n.toString()}async function L_t(e,t){try{let r=await er(e,{blipGate:t});return r.ok?await r.json().then(n=>({counts:n??null}),()=>{}):{counts:null}}catch(r){return Pr(r,"git status counts"),{counts:null}}}var TSn=5e3;function xfe(e,t,r=!0){let[n,o]=(0,T_.useState)(null),i=(0,T_.useRef)(()=>{}),a=br();return(0,T_.useEffect)(()=>{if(i.current=()=>{},!e||!r){o(null);return}let s=!1,l=A_t(),u=Yr(`/api/git-status?${W8(e,t)}`,a),d=async()=>{let p=await L_t(u,l);p&&!s&&o(p.counts)};i.current=d,d();let f=setInterval(d,TSn);return()=>{s=!0,clearInterval(f)}},[e,t,a,r]),{counts:n,refresh:(0,T_.useCallback)(()=>i.current(),[])}}function I_t(e,t){return xfe(e,t).counts}var JMe=S(R(),1);function Sfe({panelSessionId:e,cwd:t,sessionId:r,offerBranchDiff:n=!1,toggleChordHint:o=!1,countButton:i=!1}){let a=P_t(I_t(t,r));return a?a.kind==="branch"?n?(0,JMe.jsx)(u_t,{panelSessionId:e,cwd:t,sessionId:r,defaultBranch:a.defaultBranch}):null:(0,JMe.jsx)(E_t,{panelSessionId:e,cwd:t,sessionId:r,groups:a.groups,uncommitted:a.uncommitted,toggleChordHint:o,countButton:i}):null}var w_=S(R(),1);function D_t({restored:e,usedPct:t,harness:r,undurable:n}){return(0,w_.jsxs)(w_.Fragment,{children:[n&&(0,w_.jsx)(Te,{variant:"caption",sx:{color:"warning.main"},children:n.reason}),e!==void 0&&(0,w_.jsx)(Te,{variant:"caption",sx:{color:e?"success.main":"warning.main"},children:e?"restored":"not restored"}),t!==void 0&&(0,w_.jsxs)(Te,{variant:"caption",sx:{color:ffe(t,r),opacity:.6,fontSize:"0.8rem"},children:[Math.round(t),"%"]})]})}var PX=S(R(),1),wSn={gridColumn:3,gridRow:2,display:"flex",alignItems:"center",justifyContent:"flex-end",gap:.75,minWidth:0};function M_t({session:e}){return(0,PX.jsxs)(W,{sx:wSn,children:[(0,PX.jsx)(D_t,{usedPct:e.usedPct,harness:e.harness,undurable:e.undurable}),e.cwd&&(0,PX.jsx)(Sfe,{panelSessionId:e.id,cwd:e.cwd,sessionId:e.claudeSessionId})]})}function Tfe(e,t){if(t)return!0;let r=e.commandType==="assist"&&e.activity===void 0,n=e.status==="done"||e.status==="error";return r&&!n}var eNe=S(R(),1),CSn=bi("neutral");function N_t({clone:e}){return(0,eNe.jsx)(pr,{title:`Clone \u2014 ${e}`,children:(0,eNe.jsx)(W,{component:"span",sx:CSn,children:"clone"})})}var wfe=[bi("primary"),e=>({bgcolor:e.palette.primary.main,borderColor:e.palette.primary.main,color:e.palette.primary.contrastText})];var tNe=S(R(),1),kSn=bi("success");function O_t({session:e}){return WMe(e)?(0,tNe.jsx)(W,{component:"span",sx:kSn,children:e.port?(0,tNe.jsx)(dfe,{port:e.port,node:e.node,protocol:e.protocol}):"serving"}):null}var Cfe=S(ie(),1),rNe=(0,Cfe.createContext)(new Set);function B_t(){return(0,Cfe.useContext)(rNe)}var Mg=S(R(),1),_Sn=bi("check");function ESn({label:e}){return(0,Mg.jsx)(W,{component:"span",sx:wfe,children:e})}function $_t({session:e}){let t=B_t().has(e.id),r=e.repoGroup?.clone,{activity:n}=e,o=n?.kind==="backlog"&&n.phase===n.totalPhases;return(0,Mg.jsxs)(Mg.Fragment,{children:[oa(e)==="check"&&(0,Mg.jsx)(W,{component:"span",sx:_Sn,children:"Check"}),(0,Mg.jsx)(O_t,{session:e}),(0,Mg.jsx)($de,{harness:e.harness}),t&&r&&(0,Mg.jsx)(N_t,{clone:r}),(0,Mg.jsx)(Vde,{node:e.node}),o&&(0,Mg.jsx)(ESn,{label:`${n.phase}/${n.totalPhases}`})]})}var K_t=S(ie(),1);function kfe(e){return e?.itemIds?.length?e.itemIds:e?.itemId==null?[]:[e.itemId]}var z_t=S(R(),1),RSn=bi("primary");function F_t({itemId:e,session:t}){let r=br();return(0,z_t.jsx)(Xr,{component:va,to:Md(e,Dl(t),r),underline:"hover",sx:RSn,onMouseDown:n=>n.stopPropagation(),onClick:n=>n.stopPropagation(),children:gn(e)})}var nNe=S(R(),1),H_t=bi("secondary");function U_t({prNumber:e,url:t}){let r=`#${e}`;return t?(0,nNe.jsx)(Xr,{href:t,target:"_blank",rel:"noopener noreferrer",underline:"hover",sx:H_t,onMouseDown:n=>n.stopPropagation(),onClick:n=>n.stopPropagation(),children:r}):(0,nNe.jsx)(W,{component:"span",sx:H_t,children:r})}var W_t=S(R(),1),PSn={color:"text.secondary",whiteSpace:"nowrap"};function V_t(e,t){let r=E8(t)?is(e):"";if(r)return{key:"repo",node:(0,W_t.jsx)(W,{component:"span",sx:PSn,children:r})}}function G_t(e,t){return!e?.jiraKey&&e?.githubIssue?.toLowerCase()===t.toLowerCase()}var j_t=S(R(),1);function q_t(e,t){if(!(!e||G_t(t,e)))return{key:"prompt-issue",node:(0,j_t.jsx)(y_,{githubIssue:e,variant:"token"})}}function C_(e){if(e.activity?.kind==="backlog")return"next";if(e.design)return"design";switch(e.commandType){case"assist":{let t=e.assistArgs?.[0];return t==="review-pr-comments"||t==="fix-conflict"?"review":t==="draft"||t==="bug"||t==="next"||t==="refine"||t==="review"||t==="update"?t:"prompt"}case"run":return"run";default:return e.promptType??"prompt"}}var _fe=S(R(),1);function Y_t(e,t,r,n){let o=[],i=C_(e),a=t?void 0:V_t(e.cwd,i),{activity:s}=e;a&&o.push(a),s?.kind==="backlog"?s.phase!==s.totalPhases&&o.push({key:"phase",node:`${s.phase}/${s.totalPhases}`}):o.push({key:"type",node:i}),r.number!==void 0&&o.push({key:"pr",badge:!0,node:(0,_fe.jsx)(U_t,{prNumber:r.number,url:r.url})});for(let u of kfe(s))o.push({key:`item-${u}`,badge:!0,node:(0,_fe.jsx)(F_t,{itemId:u,session:e})});n&&o.push({key:"tracker",node:(0,_fe.jsx)(Nde,{tracker:n,variant:"token"})});let l=q_t(e.promptIssue,n);return l&&o.push(l),o}var ASn=["review","review-pr-comments","fix-conflict"];function R1(e){let t=e.assistArgs?.[0];if(!t||!ASn.includes(t))return;let r=e.assistArgs?.slice(1).map(o=>Number(o)).find(o=>Number.isInteger(o)&&o>0);if(r!==void 0)return r;let n=e.subtitle?.match(/^#(\d+)/);return n?Number(n[1]):void 0}var Efe=S(ie(),1);function G8(e,t,r){let[n,o]=(0,Efe.useState)(null),i=br();return(0,Efe.useEffect)(()=>{if(!e){o(null);return}let a=!1,s=t!==void 0?`&number=${t}`:"";return er(Yr(`/api/pr-status?cwd=${encodeURIComponent(e)}${s}`,i)).then(l=>l.json()).then(l=>{a||o(typeof l?.pr?.number=="number"?l.pr:null)}).catch(l=>{Pr(l,"PR status"),a||o(null)}),()=>{a=!0}},[e,i,t,r]),n}var JP=S(R(),1),LSn={opacity:.35,mx:.5};function X_t({session:e}){let t=Qkt(),r=Ude(e.cwd),n=R1(e)??e.promptPr,o=G8(e.cwd,n,e.status),i=Y_t(e,t,{number:n??o?.number,url:o?.url},r(e.activity?.itemId)),a=s=>s>0&&!i[s].badge&&!i[s-1].badge;return(0,JP.jsx)(JP.Fragment,{children:i.map((s,l)=>(0,JP.jsxs)(K_t.Fragment,{children:[a(l)&&(0,JP.jsx)(W,{component:"span",sx:LSn,children:"\xB7"}),s.node]},s.key))})}var eA=S(R(),1);function Z_t({session:e}){return(0,eA.jsxs)(eA.Fragment,{children:[(0,eA.jsx)(X_t,{session:e}),(0,eA.jsx)($_t,{session:e})]})}var oNe=S(R(),1),ISn={color:"text.disabled",fontSize:"0.65rem",lineHeight:1.4};function Q_t({toggles:e}){let t=e.flatMap(r=>r.caption??[]);return t.length===0?null:(0,oNe.jsx)(W,{sx:{display:"flex",gap:1,minWidth:0},children:t.map(r=>(0,oNe.jsx)(Te,{sx:ISn,children:r},r))})}function q8(e){let t=[],r=C_(e);if(r==="draft"||r==="bug"||r==="refine"){let o=e.autoApprove??!1;t.push({key:"autoApprove",label:"Auto start",checked:o,...o?{caption:"will auto start"}:{}})}let{activity:n}=e;if(n?.kind==="backlog"){let o=n.phase!==void 0&&n.phase===n.totalPhases,i=e.autoAdvance??!0;o||t.push({key:"autoAdvance",label:"Continue",checked:i,...i?{}:{caption:"won't continue"}})}return t}var AX=S(R(),1),DSn={gridColumn:2,gridRow:2,display:"flex",alignItems:"center",gap:.625,minWidth:0,overflow:"hidden",fontSize:"0.6875rem",lineHeight:"16px",color:"text.secondary"};function J_t({session:e}){return Tfe(e,!1)?null:(0,AX.jsxs)(W,{sx:DSn,children:[(0,AX.jsx)(Z_t,{session:e}),(0,AX.jsx)(Q_t,{toggles:q8(e)})]})}var tA=S(R(),1);function eEt({session:e,loading:t}){return t?null:(0,tA.jsxs)(tA.Fragment,{children:[(0,tA.jsx)(J_t,{session:e}),(0,tA.jsx)(M_t,{session:e})]})}var Rfe="session-card-title";var k_="session-card-close";var tEt=S(R(),1),rEt=ot((0,tEt.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zm2.46-7.12 1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14zM15.5 4l-1-1h-5l-1 1H5v2h14V4z"}),"DeleteForever");var Pfe=S(ie(),1),iNe=(0,Pfe.createContext)({onStop:()=>{},onStart:()=>{},onDiscard:()=>{}});function j8(){return(0,Pfe.useContext)(iNe)}var $S=S(R(),1);function nEt({id:e,reason:t,path:r,removesTree:n}){let{onDiscard:o}=j8(),{confirming:i,close:a,triggerHandlers:s,withHint:l}=zs(()=>o(e)),u=t?` (${t})`:"",d=r??"its working tree";return(0,$S.jsxs)($S.Fragment,{children:[(0,$S.jsx)(Kt,{size:"small",...s,title:l(n?"Discard changes and remove worktree":"Drop this card and stop tracking its unlanded work"),sx:{color:"text.disabled","&:hover":{color:"error.main"}},children:(0,$S.jsx)(rEt,{sx:{fontSize:16}})}),i&&(0,$S.jsx)(na,{children:(0,$S.jsx)(qo,{title:n?"Discard all changes":"Stop tracking this work",message:n?`This permanently deletes the worktree ${d} and the work it holds${u}. This cannot be undone.`:`This drops the card and stops tracking the unlanded work in ${d}${u}. Nothing on disk is deleted.`,confirmLabel:n?"Discard changes":"Drop card",onConfirm:()=>{a(),o(e)},onCancel:a})})]})}var P1=S(R(),1);function oEt({childCount:e,onDismissThis:t,onDismissAll:r,onCancel:n}){let o=e===1?"session":"sessions";return(0,P1.jsxs)(ts,{open:!0,onClose:n,maxWidth:"xs",fullWidth:!0,children:[(0,P1.jsx)(Wc,{children:"Close nested sessions?"}),(0,P1.jsx)(Vc,{children:(0,P1.jsx)(Pk,{children:`This session has ${e} nested ${o}. Close just this session, or close it along with its nested ${o}? Running sessions will be stopped.`})}),(0,P1.jsxs)(Cd,{children:[(0,P1.jsx)(it,{onClick:n,children:"Cancel"}),(0,P1.jsx)(it,{onClick:t,children:"Close this only"}),(0,P1.jsx)(it,{variant:"contained",color:"error",onClick:r,children:`Close all ${e+1}`})]})]})}var Afe=S(R(),1);function iEt({onDismiss:e,childDismiss:t,onClose:r}){let n=o=>{r(),o()};return(0,Afe.jsx)(na,{children:t?(0,Afe.jsx)(oEt,{childCount:t.childCount,onDismissThis:()=>n(e),onDismissAll:()=>n(t.onDismissAll),onCancel:r}):(0,Afe.jsx)(qo,{title:"End session",message:"This will stop the running session and kill its process. Are you sure?",confirmLabel:"End session",onConfirm:()=>n(e),onCancel:r})})}var __=S(R(),1);function Lfe({id:e,status:t,onDismiss:r,childDismiss:n}){let{confirming:o,close:i,triggerHandlers:a,withHint:s}=zs(n?.onDismissAll??r,{needsConfirm:t!=="done"||!!n});return(0,__.jsxs)(__.Fragment,{children:[(0,__.jsx)(Kt,{size:"small",...a,title:s(`Dismiss session ${e}`),sx:{color:"text.disabled","&:hover":{color:"text.primary"}},children:(0,__.jsx)(Bo,{sx:{fontSize:16}})}),o&&(0,__.jsx)(iEt,{onDismiss:r,childDismiss:n,onClose:i})]})}var aEt=S(R(),1),Y8=ot((0,aEt.jsx)("path",{d:"M12 5V2L8 6l4 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8m-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91"}),"RestartAlt");var MSn={claude:!0,codex:!0,pi:!1};function Ife(e){return MSn[IS(e)]}function sEt({label:e,onClick:t,onKeyDown:r,title:n,ariaLabel:o,disabled:i,pressed:a,shortcut:s}){return{onClick:t,onKeyDown:r,disabled:i,title:s?void 0:n,"aria-label":o??n??e,"aria-pressed":a,"data-shortcut":s}}var NSn={muted:{color:"text.disabled",labelled:"text.secondary",hover:"text.primary"},start:{color:"text.disabled",labelled:"text.secondary",hover:"success.main"},stop:{color:"success.main",hover:"error.main"},starred:{color:"warning.main",hover:"warning.main"},inherit:{color:"inherit"},secondary:{color:"text.secondary",hover:"text.primary"}};function aNe(e,t){let{color:r,labelled:n,hover:o}=NSn[e],i=t&&n?n:r;return o?{color:i,"&:hover":{color:o}}:{color:i}}var Dfe=S(R(),1);function lEt({label:e,shortcut:t,children:r}){return t?(0,Dfe.jsx)(pr,{describeChild:!0,title:(0,Dfe.jsx)(OSn,{label:e,shortcut:t}),children:r}):r}function OSn({label:e,shortcut:t}){return(0,Dfe.jsx)(Nd,{label:e,chords:go(t).chords})}var Mfe=S(ie(),1),sNe=(0,Mfe.createContext)(!1);function cEt(){return(0,Mfe.useContext)(sNe)}var Nfe=S(R(),1),BSn={textTransform:"none",flexShrink:0,minWidth:0,px:1,whiteSpace:"nowrap"};function Hs({label:e,icon:t,tone:r="muted",size:n="small",...o}){let i=cEt(),a=sEt({label:e,...o});return(0,Nfe.jsx)(lEt,{label:o.title??e,shortcut:o.shortcut,children:i?(0,Nfe.jsx)(it,{...a,size:"small",startIcon:t,sx:{...BSn,...aNe(r,!0)},children:e}):(0,Nfe.jsx)(Kt,{...a,size:n,sx:aNe(r,!1),children:t})})}var E_=S(R(),1);function $Sn(e){return Ife(e)?"resumes the conversation":"relaunches it from the start"}function Ofe({id:e,onRestart:t,harness:r}){let{confirming:n,close:o,triggerHandlers:i,withHint:a}=zs(t);return(0,E_.jsxs)(E_.Fragment,{children:[(0,E_.jsx)(Hs,{label:"Restart",title:a(`Restart session ${e}`),icon:(0,E_.jsx)(Y8,{sx:{fontSize:14}}),...i}),n&&(0,E_.jsx)(qo,{title:`Restart session ${e}`,message:`Restart this ${Il(r)} session? It ${$Sn(r)}, stopping the running process first.`,confirmLabel:"Restart",onConfirm:()=>{o(),t()},onCancel:o})]})}var A1=S(R(),1);function uEt({session:e,onRestart:t,onDismiss:r,childDismiss:n}){let{status:o,id:i,harness:a}=e;return e.closing?null:o!=="stopped"?(0,A1.jsx)("span",{className:k_,children:(0,A1.jsx)(Lfe,{id:i,status:o,onDismiss:r,childDismiss:n})}):(0,A1.jsxs)(A1.Fragment,{children:[e.undurable&&(0,A1.jsx)("span",{className:k_,children:(0,A1.jsx)(nEt,{id:i,reason:e.undurable.reason,path:e.cwd,removesTree:e.undurable.removesTree})}),t&&(0,A1.jsx)(Ofe,{id:i,onRestart:t,harness:a})]})}var lNe=S(R(),1);function dEt({session:e,onRestart:t,onDismiss:r,childDismiss:n}){return(0,lNe.jsx)(na,{children:(0,lNe.jsx)(uEt,{session:e,onRestart:t,onDismiss:r,childDismiss:n})})}var cNe=S(R(),1),FSn={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"flex-end",gap:.25};function fEt({session:e,loading:t,onRetry:r,onRestart:n,onDismiss:o,childDismiss:i}){return(0,cNe.jsx)(W,{sx:FSn,children:(0,cNe.jsx)(dEt,{session:e,loading:t,onRetry:r,onRestart:n,onDismiss:o,childDismiss:i})})}function Bfe(e){return e.verifying===!0&&oa(e)==="running"}var K8=S(R(),1),zSn=Ui`
|
|
3817
3817
|
to { transform: rotate(360deg); }
|
|
3818
3818
|
`,$fe=8,HSn=3,USn=6.25,VSn=1.5,WSn={gridColumn:1,gridRow:1,justifySelf:"center",alignSelf:"center",display:"block",color:Uu.running,"& .verify-ring":{fill:"none",stroke:"currentColor",strokeWidth:VSn,strokeDasharray:"70 30",opacity:.45,transformBox:"fill-box",transformOrigin:"center",animation:`${zSn} 1.1s linear infinite`,"@media (prefers-reduced-motion: reduce)":{animation:"none",strokeDasharray:"none"}}};function Ffe({ring:e=!1,title:t="running"}){return(0,K8.jsxs)(W,{component:"svg",viewBox:"0 0 16 16",width:16,height:16,sx:WSn,children:[(0,K8.jsx)("title",{children:t}),(0,K8.jsx)("circle",{cx:$fe,cy:$fe,r:HSn,fill:"currentColor",shapeRendering:"geometricPrecision"}),e&&(0,K8.jsx)("circle",{className:"verify-ring",cx:$fe,cy:$fe,r:USn,pathLength:100})]})}function R_(e){return e==="waiting"||e==="question"||e==="check"}var uNe=S(R(),1),GSn=Ui`
|
|
3819
3819
|
0%, 100% { opacity: 1; }
|
|
@@ -4000,7 +4000,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4000
4000
|
`)){let n=t[t.length-1];r.startsWith("@@")||n===void 0?t.push(r):t[t.length-1]=`${n}
|
|
4001
4001
|
${r}`}return t}function p7r(e){return f7r(e??"").filter(t=>t.startsWith("@@"))}function gPo(e){return Number(/^@@ -(\d+)/.exec(e)?.[1]??1)}function yPo(e){return/^@@[^@]*@@/.exec(e)?.[0]??e.split(`
|
|
4002
4002
|
`)[0]??""}function h7r(e,t){return e.reduce((r,n)=>r+d7r(n,t),0)}function m7r(e,t,r){let n=p7r(e.patch),o=[],i=[];return n.forEach((a,s)=>{let l=r.get(`${e.path}#${s}`)??[];l.includes(t)?o.push(a):i.push({oldStart:gPo(a),header:yPo(a),slice:l[0]??0})}),o.length===0||i.length===0?e:{...e,patch:o.join(`
|
|
4003
|
-
`),additions:h7r(o,"+"),deletions:h7r(o,"-"),split:{hunks:o.length,of:n.length,elsewhere:i}}}function g7r(e){return e.flatMap(t=>{if(t.kind==="dir")return g7r(t.children);let{kind:r,name:n,...o}=t;return[o]})}function vPo(e){let t=new Map;return e.forEach((r,n)=>{for(let o of r.hunks)t.set(o,[...t.get(o)??[],n+1])}),t}function y7r(e,t,r=new Set,n=new Set){let o=g7r(e.tree).filter(a=>!r.has(a.path)).map(a=>n.has(a.path)?{...a,critical:!0}:a),i=vPo(t);return t.map((a,s)=>{let l=new Set(a.hunks.map(aG));return u7r(o.filter(u=>l.has(u.path)).map(u=>m7r(u,s+1,i)))})}function bPo(e,t){let r=-1,n=0;return t.forEach((o,i)=>{let a=o.hunks.filter(s=>aG(s)===e).length;a>n&&(r=i,n=a)}),r}function v7r(e,t){let r=t.map(()=>[]);for(let n of e)r[bPo(n.path,t)]?.push(n);return r}function b7r(e,t){let r=y7r(e.structure,t,new Set(e.tests.map(i=>i.path)),new Set(e.criticalDiffs.map(i=>i.path))),n=v7r(e.tests,t),o=Z_e(t);return t.map((i,a)=>{let s=a+1;return{number:s,slice:i,structure:r[a]??e.structure,tests:n[a]??[],critical:e.criticalDiffs.filter(l=>o.get(l.path)?.some(u=>u.number===s))}})}function x7r(e){if(!e.slices)return;let t=b7r(e,e.slices);return{entries:r7r(e,t),slicing:{count:t.length,noCritical:new Set(t.filter(r=>r.critical.length===0).map(r=>r.number))}}}var S7r="assist:high-level-progress:",xPo=720*60*60*1e3,woe=e=>`${S7r}${e}`;function T7r(e,t){px(S7r,xPo);let r=Ls(woe(e))[0];if(r||!t)return r;let n=Ls(woe(t))[0];return fx(woe(t)),n}function w7r(e,t){Zl(woe(e),[t])}function C7r(e){fx(woe(e))}function k7r(e){let t=e;return typeof t?.id=="string"&&typeof t.title=="string"&&typeof t.reason=="string"&&(t.kind==="deterministic"||t.kind==="manual")&&["pass","fail","manual"].includes(t.status)}function vD(e,t){return Array.isArray(e)?t?e.filter(t):e:[]}var mG={repo:"",prNumber:0,headSha:"",checks:[],structure:{tree:[],added:0,removed:0,modified:0,additions:0,deletions:0},criticalDiffs:[],criticalPaths:[],tests:[],testPaths:[],collapsedPaths:[]};function _7r(e){let t;try{t=JSON.parse(e)}catch{return mG}return typeof t!="object"||t===null?mG:{repo:typeof t.repo=="string"?t.repo:mG.repo,prNumber:typeof t.prNumber=="number"?t.prNumber:mG.prNumber,headSha:typeof t.headSha=="string"?t.headSha:mG.headSha,checks:vD(t.checks,k7r),structure:{...mG.structure,...t.structure},criticalDiffs:vD(t.criticalDiffs),criticalPaths:vD(t.criticalPaths),tests:vD(t.tests),testPaths:vD(t.testPaths),collapsedPaths:vD(t.collapsedPaths),...Array.isArray(t.slices)?{slices:t.slices}:{},...t.manualTesting?{manualTesting:t.manualTesting}:{},...t.saved?{saved:t.saved}:{},...t.draft?{draft:t.draft}:{}}}function E7r(e){let t=(0,vEe.useMemo)(()=>_7r(e.body),[e.body]),r=(0,vEe.useMemo)(()=>x7r(t),[t]),n=(0,vEe.useMemo)(()=>T7r(e.requestId,e.supersedes)??t.draft??t.saved,[e.requestId,e.supersedes,t]);return{payload:t,sliced:r,progress:n}}var R7r=S(ie(),1);function P7r(e){let[t,r]=(0,R7r.useState)(()=>e?.reviewComments??[]);return{queued:t,onQueue:n=>r(o=>[...o,n]),onRemove:n=>r(o=>o.filter((i,a)=>a!==n))}}var A7r=S(ie(),1);function L7r(e,t,r){(0,A7r.useEffect)(()=>{w7r(e,{items:t,reviewComments:r})},[e,t,r])}function D7r(e,t,r){let{payload:n,sliced:o,progress:i}=E7r(e),a=JNr(n.checks,i,o?.slicing),s=P7r(i),l=VNr(o?.entries??[]),{comments:u,sentTo:d,clearSent:f}=t7r(t,r),p={...u,onQueue:s.onQueue};L7r(e.requestId,a.items,s.queued);let h=(0,I7r.useMemo)(()=>YNr(n),[n]);return{payload:n,checklist:a,queue:s,details:jNr(n,p),counts:h,sentTo:d,clearSent:f,sliced:o,nav:l,diffComments:p}}var Dx=S(R(),1);function M7r({preview:e,session:t,sendInput:r,onDecision:n}){let o=D7r(e,t,r);return(0,Dx.jsxs)(W,{sx:w0,children:[(0,Dx.jsx)(dh,{preview:e,draft:!1}),(0,Dx.jsx)(pG,{items:e.metadata??[]}),(0,Dx.jsx)(ro,{}),(0,Dx.jsx)(INr,{payload:o.payload,checklist:o.checklist,details:o.details,counts:o.counts,sliced:o.sliced,nav:o.nav,comments:o.diffComments}),(0,Dx.jsx)(ro,{}),(0,Dx.jsx)(HNr,{pane:o,onDecision:(i,a)=>{C7r(e.requestId),n(i,a)}}),(0,Dx.jsx)(ux,{sessionName:o.sentTo,onClose:o.clearSent})]})}var U7r=S(ie(),1);var bD=S(R(),1);function SPo(e){return e.topLeft===null?"Click the top-left box":e.bottomRight===null?"Now click the bottom-right box":"Both anchors picked"}function N7r({selection:e,onConfirm:t,onReject:r}){let n=e.topLeft!==null&&e.bottomRight!==null;return(0,bD.jsxs)(kt,{direction:"row",spacing:1,sx:{p:2,alignItems:"center",justifyContent:"flex-end"},children:[(0,bD.jsx)(Te,{variant:"body2",sx:{flex:1,color:"text.secondary"},children:SPo(e)}),(0,bD.jsx)(it,{color:"error",variant:"outlined",onClick:r,children:"Cancel"}),(0,bD.jsx)(it,{variant:"outlined",onClick:e.reset,children:"Start over"}),(0,bD.jsx)(it,{color:"success",variant:"contained",disabled:!n,onClick:t,children:"Extract boxes"})]})}var TPo={"top-left":Xl.miro.topLeft,"bottom-right":Xl.miro.bottomRight};function O7r(e,t){let r=e.right-e.left,n=e.bottom-e.top;return{width:r,height:n,fontSize:Math.max(6,Math.min(n*.3,r/6,28)),radius:Math.min(8,n/4),colour:t?TPo[t]:Xl.miro.box,opacity:t?.75:.35,strokeWidth:Math.max(1,r*.004)}}var Coe=S(R(),1);function B7r({box:e,role:t,onSelect:r}){let n=O7r(e,t);return(0,Coe.jsxs)("g",{role:"button",tabIndex:0,"aria-label":t?`${e.text} (${t})`:e.text,onClick:()=>r(e.id),onKeyDown:o=>{o.key==="Enter"&&r(e.id)},style:{cursor:"pointer"},children:[(0,Coe.jsx)("rect",{x:e.left,y:e.top,width:n.width,height:n.height,rx:n.radius,fill:n.colour,fillOpacity:n.opacity,stroke:n.colour,strokeWidth:n.strokeWidth}),(0,Coe.jsx)("text",{x:e.left+n.width/2,y:e.top+n.height/2,textAnchor:"middle",dominantBaseline:"central",fontSize:n.fontSize,fill:Xl.miro.text,children:e.text})]})}function $7r(e){if(e.length===0)return"0 0 100 100";let t=Math.min(...e.map(a=>a.left)),r=Math.min(...e.map(a=>a.top)),n=Math.max(...e.map(a=>a.right))-t,o=Math.max(...e.map(a=>a.bottom))-r,i=Math.max(n*.02,8);return`${t-i} ${r-i} ${n+i*2} ${o+i*2}`}var bEe=S(R(),1);function F7r({boxes:e,selection:t}){return(0,bEe.jsx)(W,{sx:{flex:1,minHeight:0,overflow:"auto",p:2},children:(0,bEe.jsx)("svg",{role:"img","aria-label":"Miro board boxes",viewBox:$7r(e),preserveAspectRatio:"xMidYMid meet",style:{width:"100%",height:"100%"},children:e.map(r=>(0,bEe.jsx)(B7r,{box:r,role:t.roleOf(r.id),onSelect:t.choose},r.id))})})}function wPo(e){return typeof e?.id=="string"&&typeof e.text=="string"&&[e.left,e.top,e.right,e.bottom].every(t=>typeof t=="number"&&Number.isFinite(t))}function z7r(e){try{let t=JSON.parse(e);return Array.isArray(t?.boxes)?t.boxes.filter(wPo):[]}catch{return[]}}var Llt=S(ie(),1);function H7r(){let[e,t]=(0,Llt.useState)(null),[r,n]=(0,Llt.useState)(null);return{topLeft:e,bottomRight:r,choose:s=>{if(e===null||r!==null){t(s),n(null);return}n(s)},reset:()=>{t(null),n(null)},roleOf:s=>s===e?"top-left":s===r?"bottom-right":null}}var cR=S(R(),1);function V7r({preview:e,onDecision:t}){let r=(0,U7r.useMemo)(()=>z7r(e.body),[e.body]),n=H7r();return(0,cR.jsxs)(W,{sx:w0,children:[(0,cR.jsx)(dh,{preview:e,draft:!1}),(0,cR.jsx)(ro,{}),(0,cR.jsx)(F7r,{boxes:r,selection:n}),(0,cR.jsx)(ro,{}),(0,cR.jsx)(N7r,{selection:n,onConfirm:()=>{let{topLeft:i,bottomRight:a}=n;i===null||a===null||t("approve",Ic({topLeft:i,bottomRight:a}))},onReject:()=>t("reject",Ic())})]})}var x8r=S(ie(),1);function W7r(e){let t=[];return e.map(r=>(t.length=r+1,t[r]=(t[r]??0)+1,t.map(n=>n??1).join(".")))}function xEe(e){return e*22}function G7r(e){return Math.round(e/22)}var q7r={display:"flex",alignItems:"flex-start",gap:.25,"& .criterion-action":{opacity:0,transition:"opacity 120ms"},"&:hover .criterion-action":{opacity:1},"&:focus-within .criterion-action":{opacity:1},"& .criterion-action:focus-visible":{opacity:1}},j7r={p:.25,mt:"2px",color:"text.disabled",cursor:"grab",touchAction:"none","&:active":{cursor:"grabbing"}},Y7r={fontFamily:"fontFamilyMono",fontSize:"0.8rem",color:"text.secondary",minWidth:32,pt:"5px",textAlign:"right",userSelect:"none",whiteSpace:"nowrap"},K7r={flex:1,fontSize:"inherit",lineHeight:1.5,px:.75,py:0,borderRadius:1,"&:hover":{bgcolor:"action.hover"},"&.Mui-focused":{bgcolor:"action.selected"}},Ilt={p:.25,mt:"2px"},X7r={position:"absolute",right:8,height:2,borderRadius:1,bgcolor:"primary.main",pointerEvents:"none"};var Q7r=S(R(),1),CPo=8;function Z7r({drag:e}){return e?(0,Q7r.jsx)(W,{sx:X7r,style:{top:e.top-1,left:CPo+xEe(e.depth)}}):null}var J7r=S(R(),1),e8r=ot((0,J7r.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");var Dlt=S(R(),1);function t8r({number:e,onGrip:t}){return(0,Dlt.jsx)(Kt,{size:"small",className:"criterion-action",sx:j7r,"aria-label":`Reorder criterion ${e}`,onPointerDown:t,children:(0,Dlt.jsx)(e8r,{fontSize:"inherit"})})}var rC=S(R(),1);function r8r({number:e,onAdd:t,onDelete:r}){return(0,rC.jsxs)(rC.Fragment,{children:[(0,rC.jsx)(Kt,{size:"small",className:"criterion-action",sx:Ilt,"aria-label":`Add criterion after ${e}`,onClick:t,children:(0,rC.jsx)(Rp,{fontSize:"inherit"})}),(0,rC.jsx)(Kt,{size:"small",className:"criterion-action",sx:Ilt,"aria-label":`Delete criterion ${e}`,onClick:r,children:(0,rC.jsx)(Bo,{fontSize:"inherit"})})]})}var SEe=S(ie(),1);function n8r(e,t){return e==="start"?0:e==="end"?t:Math.min(Math.max(e,0),t)}function o8r(e){let t=(0,SEe.useRef)(null);return(0,SEe.useEffect)(()=>{let r=t.current;if(!e||!r)return;r.focus();let n=n8r(e.caret,r.value.length);r.setSelectionRange(n,n)},[e]),t}var xD=S(R(),1);function i8r({index:e,number:t,item:r,outline:n,dragging:o,onGrip:i}){let a=o8r(n.focus?.index===e?n.focus:null),s={marginLeft:xEe(r.depth),opacity:o?.4:1};return(0,xD.jsxs)(W,{sx:q7r,"data-criterion-row":!0,style:s,children:[(0,xD.jsx)(t8r,{number:t,onGrip:i}),(0,xD.jsx)(W,{component:"span",sx:Y7r,"aria-hidden":"true",children:`${t}.`}),(0,xD.jsx)(ea,{multiline:!0,value:r.text,sx:K7r,inputRef:a,inputProps:{"aria-label":`Criterion ${t}`},onChange:l=>n.onText(e,l.target.value),onKeyDown:l=>n.onKeyDown(e,l)}),(0,xD.jsx)(r8r,{number:t,onAdd:()=>n.onAdd(e),onDelete:()=>n.onDelete(e)})]})}var f8r=S(ie(),1);function a8r(e,t,{key:r,shift:n,alt:o,caret:i,text:a}){return o||n?null:r==="ArrowUp"&&i===0&&t>0?{kind:"focus",index:t-1}:r==="ArrowDown"&&i===a.length&&t<e.length-1?{kind:"focus",index:t+1}:null}function uR(e){if(e.length===0)return[{text:"",depth:0}];let t=-1;return e.map(r=>{let n=Math.min(Math.max(r.depth,0),t+1);return t=n,r.depth===n?r:{...r,depth:n}})}function TEe(e,t,r,n){let o=e[t]?.depth??0,i=e.map((a,s)=>s===t?{...a,text:r}:a);return{items:uR([...i.slice(0,t+1),{text:n,depth:o},...i.slice(t+1)]),index:t+1}}function Bm(e,t){let r=t+1;for(;r<e.length&&e[r].depth>e[t].depth;)r+=1;return r}function wEe(e,t){let r=e[t].depth;for(let n=t-1;n>=0;n-=1){if(e[n].depth<r)return-1;if(e[n].depth===r)return n}return-1}function s8r(e,t){let r=Bm(e,t);return r<e.length&&e[r].depth===e[t].depth?r:-1}function l8r(e,t,r){let n=r<0?wEe(e,t):s8r(e,t);if(n<0)return null;let o=Bm(e,t),i=e.slice(t,o),a=[...e.slice(0,t),...e.slice(o)],s=r<0?n:Bm(e,n)-(o-t);return{items:[...a.slice(0,s),...i,...a.slice(s)],index:s}}function CEe(e,t){let r=Bm(e,t),n=e.map((o,i)=>i>t&&i<r?{...o,depth:o.depth-1}:o).filter((o,i)=>i!==t);return{items:uR(n),index:Math.max(0,t-1)}}function c8r(e,t,r){if(r<0&&e[t].depth===0||r>0&&wEe(e,t)<0)return null;let n=Bm(e,t);return e.map((o,i)=>i>=t&&i<n?{...o,depth:o.depth+r}:o)}function kEe(e,t){return e?{kind:"edit",edit:e,caret:t}:null}function kPo(e,t,{caret:r,text:n}){let o=n.slice(0,r);return kEe(TEe(e,t,o,n.slice(r)),"start")}function _Po(e,t,{shift:r,caret:n}){let o=c8r(e,t,r?-1:1);return kEe(o?{items:o,index:t}:null,n)}function u8r(e,t,r){let{key:n,shift:o,alt:i,caret:a,text:s}=r;return n==="Enter"&&!o?kPo(e,t,r):n==="Tab"?_Po(e,t,r):i&&(n==="ArrowUp"||n==="ArrowDown")?kEe(l8r(e,t,n==="ArrowUp"?-1:1),a):n==="Backspace"&&a===0&&s===""?kEe(CEe(e,t),"end"):null}function d8r(e,t,r){return u8r(e,t,r)??a8r(e,t,r)}function p8r(e,t){let[r,n]=(0,f8r.useState)(null),o=(a,s)=>{a&&(t(a.items),n({index:a.index,caret:s}))};return{focus:r,onKeyDown:(a,s)=>{let l=s.currentTarget;(s.key==="Enter"||s.key==="Tab")&&s.preventDefault();let u=d8r(e,a,{key:s.key,shift:s.shiftKey,alt:s.altKey,caret:l.selectionStart??0,text:l.value});u&&(s.preventDefault(),u.kind==="focus"?n({index:u.index,caret:"end"}):o(u.edit,u.caret))},onDrop:a=>o(a,"end"),onText:(a,s)=>t(e.map((l,u)=>u===a?{...l,text:s}:l)),onAdd:a=>o(TEe(e,a,e[a].text,""),"start"),onDelete:a=>o(CEe(e,a),"end")}}var v8r=S(ie(),1);function EPo(e,t,r,n){let o=t.length;for(let a=0;a<e.length;a+=1)if(n<e[a].top+e[a].height/2){o=a;break}let i=Bm(t,r);return o>r&&o<i?r:o}function RPo(e,t,r,n){let o=Bm(e,t),i=r-1,a=i>=t&&i<o?t-1:i,s=a>=0?e[a].depth+1:0;return Math.max(0,Math.min(e[t].depth+G7r(n),s))}function PPo(e,t){if(t<e.length)return e[t].top;let r=e[e.length-1];return r?r.top+r.height:0}function h8r(e,t,r,n,o){let i=EPo(e,t,r,o);return{target:i,depth:RPo(t,r,i,n),top:PPo(e,i)}}function APo(e){let t=e.getBoundingClientRect().top;return{boxes:Array.from(e.querySelectorAll("[data-criterion-row]")).map(n=>{let o=n.getBoundingClientRect();return{top:o.top-t,height:o.height}}),origin:t}}function m8r(e,t,r,n){return o=>{let{boxes:i,origin:a}=APo(t);return h8r(i,e,r,o.clientX-n,o.clientY-a)}}function g8r(e,t,r,n,o){let i=new AbortController,a=null,s=d=>{a=r(d),n(a)},l=()=>{i.abort(),a&&o(a)},u={signal:i.signal};return e.setPointerCapture(t),e.addEventListener("pointermove",s,u),e.addEventListener("pointerup",l,u),e.addEventListener("pointercancel",l,u),s}function y8r(e,t,r,n){let o=Bm(e,t),i=n-e[t].depth,a=e.slice(t,o).map(u=>({...u,depth:Math.max(0,u.depth+i)})),s=[...e.slice(0,t),...e.slice(o)],l=r>t?r-a.length:r;return{items:uR([...s.slice(0,l),...a,...s.slice(l)]),index:l}}function b8r(e,t,r){let[n,o]=(0,v8r.useState)(null);return{drag:n,onGrip:a=>s=>{let l=t.current;if(!l||s.pointerType==="mouse"&&s.button!==0)return;s.preventDefault(),g8r(s.currentTarget,s.pointerId,m8r(e,l,a,s.clientX),d=>o({from:a,depth:d.depth,top:d.top}),d=>{o(null),r(y8r(e,a,d.target,d.depth))})(s)}}}var koe=S(R(),1),LPo={my:1,px:1,py:.5,border:1,borderColor:"divider",borderRadius:1,position:"relative",userSelect:"text",cursor:"auto"},IPo=[{text:"",depth:0}];function S8r({items:e,onChange:t}){let r=(0,x8r.useRef)(null),n=e.length>0?e:IPo,o=p8r(n,t),{drag:i,onGrip:a}=b8r(n,r,o.onDrop),s=W7r(n.map(l=>l.depth));return(0,koe.jsxs)(W,{sx:LPo,ref:r,"data-preview-skip":!0,"aria-label":"Acceptance criteria",children:[n.map((l,u)=>(0,koe.jsx)(i8r,{index:u,number:s[u],item:l,outline:o,dragging:i?.from===u,onGrip:a(u)},`criterion-${u}`)),(0,koe.jsx)(Z7r,{drag:i})]})}var T8r=S(R(),1),w8r=ot((0,T8r.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z"}),"FormatListNumbered");var _oe=S(R(),1),DPo={insert:"Add acceptance criteria",convert:"Convert to outline"};function C8r({kind:e,onClick:t}){return(0,_oe.jsx)(W,{sx:{my:1},"data-preview-skip":!0,children:(0,_oe.jsx)(it,{size:"small",variant:"outlined",startIcon:e==="insert"?(0,_oe.jsx)(Rp,{}):(0,_oe.jsx)(w8r,{}),onClick:t,children:DPo[e]})})}var Eoe=S(ie(),1);function k8r(e,t,{color:r,pin:n}){let o=pA(e),i=[],a=o.nextNode();for(;a;){let u=a;if(t.intersectsNode(u)){let d=u===t.startContainer?t.startOffset:0,f=u===t.endContainer?t.endOffset:u.length;d<f&&i.push({node:u,start:d,end:f})}a=o.nextNode()}let l=i.map(u=>MPo(u.node,u.start,u.end,r)).at(-1);l&&n&&(l.dataset.pin=n)}function MPo(e,t,r,n){let o=document.createRange();o.setStart(e,t),o.setEnd(e,r);let i=document.createElement("mark");return i.className="pr-comment",i.style.backgroundColor=n,o.surroundContents(i),i}function _8r(e){for(let t of e.querySelectorAll("mark.pr-comment"))if(t.parentNode){for(;t.firstChild;)t.before(t.firstChild);t.remove()}}function E8r(e,t){for(let r of t){let n=APt(e,r);n&&k8r(e,n,r)}}var Roe=S(R(),1);function R8r({content:e,control:t,trailing:r,ranges:n,contentRef:o}){let i=(0,Eoe.useMemo)(()=>Cw(e),[e]),a=(0,Eoe.useMemo)(()=>r?Cw(r):"",[r]);return(0,Eoe.useLayoutEffect)(()=>{let s=o.current;s&&(_8r(s),E8r(s,n))},[i,a,n,o]),(0,Roe.jsxs)(W,{ref:o,children:[(0,Roe.jsx)(Bl,{className:"markdown",html:i}),t,t?(0,Roe.jsx)(Bl,{className:"markdown",html:a}):null]})}var SD=e=>e.split(",").map(t=>`&& .markdown ${t.trim()}`).join(", ");function _Ee(e){let{color:t,radius:r}=e.tokens;return{px:2.5,py:2,fontSize:14,lineHeight:1.6,[SD("")]:{lineHeight:1.6},[SD("h1, h2, h3, h4, h5, h6")]:{fontSize:15,fontWeight:600,lineHeight:1.4,mt:2,mb:1},[SD("ul, ol")]:{pl:2.5,mb:2},[SD("li")]:{mb:"6px"},[SD("code")]:{fontFamily:e.typography.fontFamilyMono,fontSize:"0.86em",px:"5px",py:0,bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:"4px"},[SD("pre")]:{bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:`${r.sm}px`},[SD("pre code")]:{border:0,px:0,bgcolor:"transparent"}}}var P8r=e=>({flex:1,overflow:"auto",position:"relative",userSelect:"none",cursor:"text",wordBreak:"break-word","& .markdown":{...Mhe(e),maxWidth:"none"},"& a":{color:"primary.main"},"& mark.pr-comment":{color:"inherit",borderRadius:"2px"},..._Ee(e)});var gG=S(R(),1);function A8r({content:e,control:t,trailing:r,ranges:n,wrapperRef:o,contentRef:i,dragRects:a,dragColor:s,onMouseDown:l,footer:u}){return(0,gG.jsxs)(W,{ref:o,onMouseDown:l,sx:P8r,children:[(0,gG.jsx)(R8r,{content:e,control:t,trailing:r,ranges:n,contentRef:i}),u&&(0,gG.jsx)(W,{sx:{userSelect:"text"},children:u}),(0,gG.jsx)($O,{rects:a,color:s})]})}function L8r(e){let t=new Map,r=[];for(let n of e){if(!n.group){r.push(n);continue}t.set(n.group,[...t.get(n.group)??[],n])}return{groups:[...t],ungrouped:r}}var EEe=S(ie(),1),I8r=S(R(),1);function Mlt({label:e,value:t,onCommit:r,listId:n}){let[o,i]=(0,EEe.useState)(t);return(0,EEe.useEffect)(()=>i(t),[t]),(0,I8r.jsx)(xn,{size:"small",variant:"standard",fullWidth:!0,label:e,value:o,onChange:s=>i(s.target.value),onBlur:()=>{let s=o.trim();i(t),s!==t&&r(s)},onKeyDown:s=>{s.key==="Enter"&&s.target.blur()},onMouseDown:s=>s.stopPropagation(),slotProps:{htmlInput:{list:n}}})}var Poe=S(R(),1),Nlt="screenshot-groups";function NPo(e){return(e.split(/[\\/]/).pop()??e).replace(/\.[^.]+$/,"")}function D8r({screenshot:e,onUpdate:t}){return(0,Poe.jsxs)(kt,{direction:"row",spacing:1,sx:{mt:.5},children:[(0,Poe.jsx)(Mlt,{label:"Caption",value:e.alt,onCommit:r=>t(e.id,{alt:r||NPo(e.path)})}),(0,Poe.jsx)(Mlt,{label:"Group",value:e.group??"",listId:Nlt,onCommit:r=>t(e.id,{group:r})})]})}var dR=S(R(),1),M8r={display:"block",maxWidth:"100%",borderRadius:1,border:1,borderColor:"divider"},OPo={position:"absolute",top:4,right:4,bgcolor:"background.paper","&:hover":{bgcolor:"background.paper"}};function N8r({screenshot:e,onRemove:t,onUpdate:r}){let n=e.contentType.startsWith("video/");return(0,dR.jsxs)(W,{sx:{position:"relative"},children:[n?(0,dR.jsx)(W,{component:"video",controls:!0,src:e.url,"aria-label":"screenshot",sx:M8r}):(0,dR.jsx)(W,{component:"img",src:e.url,alt:"screenshot",sx:M8r}),(0,dR.jsx)(Kt,{size:"small","aria-label":"Remove screenshot",sx:OPo,onMouseDown:o=>o.stopPropagation(),onClick:()=>t(e.id),children:(0,dR.jsx)(Bo,{fontSize:"small"})}),(0,dR.jsx)(D8r,{screenshot:e,onUpdate:r})]})}var L0=S(R(),1);function BPo(){return(0,L0.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,L0.jsx)(mo,{size:16}),(0,L0.jsx)(Te,{variant:"caption",color:"text.secondary",children:"Attaching screenshot or video\u2026"})]})}function $Po({error:e}){return(0,L0.jsx)(Te,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:e})}function O8r({uploads:e,empty:t}){return e.length>0?(0,L0.jsx)(L0.Fragment,{children:e.map(r=>r.error?(0,L0.jsx)($Po,{error:r.error},r.id):(0,L0.jsx)(BPo,{},r.id))}):t?(0,L0.jsx)(Te,{variant:"caption",color:"text.secondary",children:"Drop or paste an image or video to attach"}):null}var I0=S(R(),1),FPo={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:1};function B8r({screenshots:e,uploads:t,onRemove:r,onUpdate:n}){let{groups:o,ungrouped:i}=L8r(e),a=s=>(0,I0.jsx)(N8r,{screenshot:s,onRemove:r,onUpdate:n},s.id);return(0,I0.jsxs)(W,{sx:{mt:3},children:[e.length>0&&(0,I0.jsx)(W,{component:"h2",children:"Screenshots"}),(0,I0.jsx)("datalist",{id:Nlt,children:o.map(([s])=>(0,I0.jsx)("option",{value:s},s))}),o.map(([s,l])=>(0,I0.jsxs)(W,{sx:{mb:2},children:[(0,I0.jsx)(W,{component:"h3",children:s}),(0,I0.jsx)(W,{sx:FPo,children:l.map(a)})]},s)),(0,I0.jsxs)(kt,{spacing:1,children:[i.map(a),(0,I0.jsx)(O8r,{uploads:t,empty:e.length===0})]})]})}var Aoe=S(R(),1);function zPo(e){let t=e.criteria;if(!t)return{content:e.body};let r={content:t.before,trailing:t.after};return t.kind==="outline"?{...r,control:(0,Aoe.jsx)(S8r,{items:t.items,onChange:e.onCriteriaChange})}:{...r,control:(0,Aoe.jsx)(C8r,{kind:t.kind,onClick:t.kind==="insert"?e.onCriteriaInsert:e.onCriteriaConvert})}}function REe({pane:e,screenshots:t}){return(0,Aoe.jsx)(A8r,{...zPo(e),ranges:e.ranges,wrapperRef:e.wrapperRef,contentRef:e.contentRef,dragRects:e.dragRects,dragColor:e.dragColor,onMouseDown:e.onMouseDown,footer:t?(0,Aoe.jsx)(B8r,{screenshots:e.screenshots,uploads:e.uploads,onRemove:e.removeScreenshot,onUpdate:e.updateScreenshot}):void 0})}var $8r=e=>({display:"grid",gap:1,maxHeight:220,overflow:"auto",px:2,py:1.25,borderTop:1,borderColor:e.tokens.color.lineSoft}),F8r={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"text.secondary"},z8r=e=>({display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:"4px 8px",px:1.25,py:1,borderRadius:`${e.tokens.radius.sm}px`,bgcolor:e.tokens.color.raised,border:1,borderColor:e.tokens.color.lineSoft,fontSize:12.5}),H8r={gridColumn:2,gridRow:1,width:20,height:20,color:"text.disabled","& .MuiSvgIcon-root":{fontSize:14}};var nC=S(R(),1);function U8r({comments:e,colors:t,onRemove:r}){return(0,nC.jsxs)(W,{sx:$8r,children:[(0,nC.jsxs)(Te,{sx:F8r,children:["Comments (",e.length,")"]}),e.map((n,o)=>(0,nC.jsxs)(W,{sx:z8r,children:[(0,nC.jsx)(MO,{text:n.quote,sx:{gridColumn:1,borderLeft:2,pl:1,borderColor:t[o]}}),(0,nC.jsx)(W,{sx:{gridColumn:1,wordBreak:"break-word"},children:n.note}),(0,nC.jsx)(Kt,{"aria-label":"Remove comment",onClick:()=>r(n.id),sx:H8r,children:(0,nC.jsx)(Bo,{})})]},n.id))]})}var W8r=S(R(),1);function V8r(e){return e.comments.length===0?null:(0,W8r.jsx)(U8r,{...e})}var G8r=S(R(),1),PEe=ot((0,G8r.jsx)("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"}),"Computer");var Z8r=S(ie(),1);var q8r=S(R(),1),j8r=ot((0,q8r.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var D0="0.1089.0";var HPo={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function Y8r(e){return e?HPo[e]:"success.main"}function K8r(e){return e.split("-")[0].split(".").map(Number)}function X8r(e,t){if(!e||!t||e===t)return;let r=K8r(e),n=K8r(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var AEe=S(ie(),1),Olt=(0,AEe.createContext)(null);function LEe(){return(0,AEe.useContext)(Olt)}var TD=S(R(),1),UPo={height:16,fontSize:10},VPo={opacity:.6,fontSize:"0.85em"};function WPo(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function fR({nodes:e,name:t,showVersion:r=!1}){let n=LEe()??D0,o=e.links.find(a=>a.name===t),i=X8r(o?.peerVersion,n);return(0,TD.jsx)(pr,{title:WPo(e,t),placement:"right",children:(0,TD.jsxs)(W,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,TD.jsx)(j8r,{sx:{fontSize:8,color:Y8r(o?.state)}}),t,r&&o?.peerVersion&&(0,TD.jsxs)(W,{component:"span",sx:VPo,children:["v",o.peerVersion]}),i&&(0,TD.jsx)(zn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:UPo})]})})}var M0=S(R(),1),GPo={textTransform:"none"};function IEe({nodes:e,options:t,target:r,onPick:n}){let[o,i]=(0,Z8r.useState)(null);return(0,M0.jsxs)(M0.Fragment,{children:[(0,M0.jsx)(it,{size:"small",color:"inherit",startIcon:(0,M0.jsx)(PEe,{fontSize:"small"}),"aria-label":"Start on node","aria-haspopup":"menu",onClick:a=>i(a.currentTarget),sx:GPo,children:(0,M0.jsx)(fR,{nodes:e,name:r.node})}),(0,M0.jsx)(wa,{anchorEl:o,open:!!o,onClose:()=>i(null),children:t.map(({name:a,cwd:s})=>(0,M0.jsx)(Gr,{disabled:!s,selected:a===r.node,onClick:()=>{n(a),i(null)},children:(0,M0.jsx)(mf,{primary:(0,M0.jsx)(fR,{nodes:e,name:a}),secondary:s?void 0:"no clone"})},a))})]})}var Q8r=S(ie(),1);function DEe(e){let{nodes:t,names:r,visible:n}=Fs(),{selectedCwd:o,selectedNode:i,cloneOn:a,originOf:s}=Gn(),[l,u]=(0,Q8r.useState)(),d=e&&s(e)?e:o,f=r.map(g=>({name:g,cwd:d?a(d,g):void 0})),p=g=>f.find(y=>y.name===g&&y.cwd),h=p(l)??p(i??t?.local)??f.find(g=>g.cwd),m=n&&h?.cwd?{node:h.name,cwd:h.cwd}:void 0;return{nodes:t,visible:n,options:f,target:m,pick:u}}var pR=S(R(),1);function J8r({canStart:e,cwd:t,onApprove:r,onApproveAndStart:n}){let o=qfe(),i=DEe(t);return(0,pR.jsxs)(pR.Fragment,{children:[(0,pR.jsx)(it,{color:"primary",variant:e?"tonal":"contained",onClick:r,...e?{}:o,children:"Approve"}),e&&i.nodes&&i.target&&(0,pR.jsx)(IEe,{nodes:i.nodes,options:i.options,target:i.target,onPick:i.pick}),e&&(0,pR.jsx)(it,{color:"primary",variant:"contained",onClick:()=>n(i.target),...o,children:"Approve & start"})]})}var Blt=S(R(),1),qPo={"& .MuiFormControlLabel-label":{fontSize:12}};function Loe({label:e,title:t,checked:r,onChange:n}){return(0,Blt.jsx)(_d,{control:(0,Blt.jsx)(yp,{size:"small",checked:r,onChange:o=>n(o.target.checked)}),label:e,title:t,sx:qPo})}var wD=S(R(),1);function MEe({chain:e,newPr:t,onChange:r}){return(0,wD.jsxs)(kt,{direction:"row",sx:{mr:"auto"},children:[t&&(0,wD.jsx)(Loe,{label:"Draft",title:"Create the PR as a draft rather than ready for review",checked:e.draft,onChange:n=>r({...e,draft:n,autoMerge:n?!1:e.autoMerge})}),(0,wD.jsx)(Loe,{label:"Auto-merge (squash)",title:"Squash-merge the PR automatically once its required checks pass",checked:e.autoMerge,onChange:n=>r({...e,autoMerge:n,draft:n?!1:e.draft})}),(0,wD.jsx)(Loe,{label:"Review PR",title:"After raising, run a review that posts its findings and then addresses them",checked:e.reviewAfter,onChange:n=>r({...e,reviewAfter:n})}),(0,wD.jsx)(Loe,{label:"Post to Slack",title:"Announce the PR in Slack at the tail of the chain",checked:e.announceAfter,onChange:n=>r({...e,announceAfter:n})})]})}var CD=S(R(),1);function eOr({commentCount:e,chain:t,newPr:r,canStart:n,onChainChange:o,onApprove:i,cwd:a,onApproveAndStart:s,onReject:l,onRequestChanges:u}){return(0,CD.jsxs)(kt,{direction:"row",spacing:1,sx:{px:2,py:1.5,alignItems:"center",justifyContent:"flex-end"},children:[t&&(0,CD.jsx)(MEe,{chain:t,newPr:r,onChange:o}),(0,CD.jsx)(it,{color:"error",variant:"outlined",onClick:l,children:"Reject"}),e>0&&(0,CD.jsxs)(it,{color:"warning",variant:"tonal",onClick:u,children:["Request changes (",e,")"]}),(0,CD.jsx)(J8r,{canStart:n,cwd:a,onApprove:i,onApproveAndStart:s})]})}var oC=S(R(),1);function tOr({comments:e,commentColors:t,pending:r,cwd:n,unavailable:o,onAdd:i,onQueue:a,onCite:s,onAddRule:l,onRemove:u,onCancel:d,onCollapse:f,onDecision:p,chain:h,editable:m,newPr:g,canStart:y,onChainChange:v}){let b=()=>e.map(x=>({quote:x.quote,note:x.note}));return(0,oC.jsxs)(oC.Fragment,{children:[(0,oC.jsx)(V8r,{comments:e,colors:t,onRemove:u}),(0,oC.jsx)(ro,{}),(0,oC.jsx)(eOr,{commentCount:e.length,chain:h,newPr:g,canStart:y,onChainChange:v,onApprove:()=>p("approve",b()),cwd:n,onApproveAndStart:x=>p("approve",b(),x??!0),onReject:()=>p("reject",[]),onRequestChanges:()=>p("reject",b())}),(0,oC.jsx)(nhe,{pending:r,editable:m,cwd:n,unavailable:o,onAdd:i,onQueue:a,onCite:s,onAddRule:l,onCancel:d,onCollapse:f})]})}var Ioe=S(R(),1),jPo={px:2,pb:2,display:"flex",alignItems:"center",gap:1.5,minWidth:0},YPo={color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function rOr({url:e}){return(0,Ioe.jsxs)(W,{sx:jPo,children:[(0,Ioe.jsx)(it,{variant:"contained",href:e,target:"_blank",rel:"noopener noreferrer",sx:{flexShrink:0},children:"Open design \u2197"}),(0,Ioe.jsx)(Te,{variant:"body2",sx:YPo,title:e,children:e})]})}var $lt=S(R(),1);function nOr({preview:e}){let t=e.kind==="design"?e.metadata?.[0]?.url:void 0;return t?(0,$lt.jsx)(rOr,{url:t}):(0,$lt.jsx)(pG,{items:e.metadata??[]})}function oOr({preview:e,pane:t,cwd:r,isPr:n,editable:o,sender:i,onCite:a,onAddRule:s}){return{comments:t.comments,commentColors:t.commentColors,pending:t.pending,cwd:r,unavailable:i.unavailable,onAdd:i.onSend,onQueue:t.onAdd,onCite:a,onAddRule:s,onRemove:t.remove,onCancel:t.onCancel,onCollapse:t.onCollapse,onDecision:t.onDecide,chain:n?t.chain:void 0,editable:o,newPr:n&&e.prNumber===null,canStart:e.kind==="backlog-item"&&e.canStart===!0,onChainChange:t.setChain}}function yG(e){let t=e??"pr";return{isPr:t==="pr",screenshots:t==="pr"||t==="github-issue",editable:t==="github-issue-edit",closeOnly:t==="show"}}function iOr(e,t){return e?`${e}:${t??"pr"}`:void 0}function NEe(e,t,r,n){return{...yG(e.kind),requestId:e.requestId,supersedes:e.supersedes,sessionId:t,cwd:r,onDecision:n,screenshotScope:iOr(t,e.kind),seededScreenshots:e.screenshots??[],chainDefaults:{draft:e.draft===!0,reviewAfter:e.reviewAfter??!0},initialBody:e.body}}function aOr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&Qd(t,e,FTe({quote:r,note:o})),n()}}function sOr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&Qd(t,e,dx(r,Kpe(o))),n()}}function OEe(e,t,r,n){return{onCite:sOr(e,t,r,n),onAddRule:aOr(e,t,r,n)}}function lOr(e){return{criteria:e.criteria,onCriteriaChange:e.writeCriteria,onCriteriaInsert:e.insertCriteria,onCriteriaConvert:e.convertCriteria}}var yOr=S(ie(),1);var iC=S(ie(),1);var cOr="assist:pr-preview-comments:",Flt=e=>`${cOr}${e}`;function zlt(e){return Ls(Flt(e))}function Doe(e,t){Zl(Flt(e),t)}function BEe(e){fx(Flt(e))}function uOr(){px(cOr)}function dOr(e){let t=pA(e),r="";for(let n=t.nextNode();n;n=t.nextNode())r+=n.textContent??"";return r}function KPo(e,t,r){let n=-1;for(let o=e.indexOf(t);o!==-1;o=e.indexOf(t,o+1))(n===-1||Math.abs(o-r)<Math.abs(n-r))&&(n=o);return n}function fOr(e,t){return e.flatMap(r=>{let n=KPo(t,r.quote,r.start);return n===-1?[]:[{...r,start:n,end:n+r.quote.length}]})}function pOr(e,t,r){let n=zlt(e);if(n.length>0||!t||!r)return n;let o=fOr(zlt(t),dOr(r));return Doe(e,o),BEe(t),o}function hOr(e,t,r){let[n,o]=(0,iC.useState)([]),i=(0,iC.useRef)(0);(0,iC.useEffect)(()=>{uOr(),o(pOr(e,t,r.current).map(l=>({...l,id:i.current++})))},[e,t,r]);let a=(0,iC.useCallback)(l=>{o(u=>{let d=[...u,{...l,id:i.current++}];return Doe(e,d),d})},[e]),s=(0,iC.useCallback)(l=>{o(u=>{let d=u.filter(f=>f.id!==l);return Doe(e,d),d})},[e]);return{comments:n,add:a,remove:s}}function mOr(e,t){let r=e.map((i,a)=>yV(a).solid),n=yV(e.length).fill,o=e.map((i,a)=>({start:i.start,end:i.end,color:yV(a).fill,pin:String(a+1)}));return t&&o.push({start:t.start,end:t.end,color:n}),{commentColors:r,dragColor:n,ranges:o}}function gOr(e,t,r,n){return{onAdd:o=>{e&&t({quote:e.quote,note:o,start:e.start,end:e.end}),n()},onCollapse:()=>{e&&r(e.quote),n()}}}function vOr(e,t,r){let{wrapperRef:n,contentRef:o,pending:i,dragRects:a,onMouseDown:s,clear:l,select:u}=bV(),{comments:d,add:f,remove:p}=hOr(e,t,o),{commentColors:h,dragColor:m,ranges:g}=(0,yOr.useMemo)(()=>mOr(d,i),[d,i]),{onAdd:y,onCollapse:v}=gOr(i,f,r,l);return{wrapperRef:n,contentRef:o,onMouseDown:s,comments:d,commentColors:h,remove:p,pending:i,ranges:g,dragRects:a,dragColor:m,onAdd:y,onCollapse:v,onCancel:l,onSelect:u}}var FEe=S(ie(),1);var Hlt="assist:preview-screenshots:",Ult=e=>`${Hlt}${e}`,$Ee=e=>`${Hlt}seeded:${e}`;function bOr(e){return e?(px(Hlt),Ls(Ult(e)).filter(t=>typeof t.path=="string")):[]}function kD(e,t){e&&Zl(Ult(e),t.map(({path:r,alt:n,group:o,contentType:i,seeded:a})=>({path:r,alt:n,group:o,contentType:i,seeded:a})))}function xOr(e){e&&(fx(Ult(e)),fx($Ee(e)))}var _D=S(ie(),1);var SOr={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","video/mp4":"mp4","video/webm":"webm","video/quicktime":"mov"};function XPo(e){let t=e.split(".").pop()?.toLowerCase();return Object.entries(SOr).find(([,n])=>n===t)?.[0]??"application/octet-stream"}function TOr(e){return e.map(t=>({...t,contentType:XPo(t.path),seeded:!0}))}function wOr(e,t,r){if(!e)return TOr(r);let n=bOr(e);if(Ls($Ee(e))[0]===t)return n;let o=[...TOr(r),...n.filter(i=>!i.seeded)];return kD(e,o),Zl($Ee(e),[t]),o}function COr(e,t){let r=new URLSearchParams({path:e});return t&&r.set("node",t),DS(`/api/pr-preview/image?${r}`)}function kOr(e,t,r){let[n,o]=(0,_D.useState)([]),i=(0,_D.useRef)(0),a=br(),s=(0,_D.useRef)(r);return s.current=r,(0,_D.useEffect)(()=>{o(wOr(e,t,s.current).map(l=>({...l,url:COr(l.path,a),id:i.current++})))},[e,t,a]),{screenshots:n,setScreenshots:o,nextId:i}}var _Or=S(ie(),1);function EOr(e,t){return(0,_Or.useCallback)((r,n)=>{t(o=>{let i=o.map(a=>a.id===r?{...a,...n}:a);return kD(e,i),i})},[e,t])}function ROr(e,t,r){let{screenshots:n,setScreenshots:o,nextId:i}=kOr(e,t,r),a=(0,FEe.useCallback)(d=>{o(f=>{let p=[...f,{...d,id:i.current++}];return kD(e,p),p})},[e,o,i]),s=(0,FEe.useCallback)(d=>{o(f=>{let p=f.find(m=>m.id===d);p?.url.startsWith("blob:")&&URL.revokeObjectURL(p.url);let h=f.filter(m=>m.id!==d);return kD(e,h),h})},[e,o]),l=EOr(e,o),u=(0,FEe.useCallback)(()=>xOr(e),[e]);return{screenshots:n,add:a,remove:s,update:l,clearPersisted:u}}var vG=S(ie(),1);async function POr(e,t,r){let n=new URLSearchParams;t&&n.set("cwd",t),r&&n.set("node",r),e instanceof File&&e.name&&n.set("name",e.name);let o=await er(`/api/pr-preview/upload-image?${n}`,{method:"POST",headers:{"Content-Type":e.type||"application/octet-stream"},body:e,timeoutMs:12e4}),i=await o.json().catch(()=>null);if(!o.ok||!i?.path)throw new Error(i?.error??"Failed to attach file");return{path:i.path,alt:i.alt??"screenshot"}}var DOr=S(ie(),1);function AOr(e){return e.startsWith("image/")||e.startsWith("video/")}function LOr(e){if(!e)return null;for(let t of e.items)if(t.kind==="file"&&AOr(t.type)){let r=t.getAsFile();if(r)return r}return null}function IOr(e){return e?Array.from(e.files).find(t=>AOr(t.type))??null:null}function MOr(e,t){return(0,DOr.useEffect)(()=>{if(!t)return;let o=i=>{let a=LOr(i.clipboardData);a&&(i.preventDefault(),e(a))};return globalThis.addEventListener("paste",o),()=>globalThis.removeEventListener("paste",o)},[e,t]),t?{onDrop:o=>{let i=IOr(o.dataTransfer);i&&(o.preventDefault(),e(i))},onDragOver:o=>{Array.from(o.dataTransfer.items).some(i=>i.kind==="file")&&o.preventDefault()}}:{onDrop:void 0,onDragOver:void 0}}function NOr(e,t,r){let[n,o]=(0,vG.useState)([]),i=(0,vG.useRef)(0),a=br(),s=(0,vG.useCallback)(async d=>{let f=i.current++;o(p=>[...p.filter(h=>!h.error),{id:f}]);try{let p=await POr(d,e,a);t({...p,url:URL.createObjectURL(d),contentType:d.type}),o(h=>h.filter(m=>m.id!==f))}catch(p){let h=p instanceof Error?p.message:"Failed to attach file";o(m=>m.map(g=>g.id===f?{id:f,error:h}:g))}},[e,a,t]),{onDrop:l,onDragOver:u}=MOr(s,r);return{uploads:n,onDrop:l,onDragOver:u}}function OOr({cwd:e,screenshots:t,screenshotScope:r,requestId:n,seededScreenshots:o}){let{screenshots:i,add:a,remove:s,update:l,clearPersisted:u}=ROr(t?r:void 0,n,t?o:[]),{uploads:d,onDrop:f,onDragOver:p}=NOr(e,a,t);return{screenshots:i,removeScreenshot:s,updateScreenshot:l,decision:{attachments:()=>i.map(({path:h,alt:m,group:g})=>g?{path:h,alt:m,group:g}:{path:h,alt:m}),clearPersisted:u},uploads:d,onDrop:f,onDragOver:p}}var GOr=S(ie(),1);var BOr="assist:pr-preview-chain:",Vlt=e=>`${BOr}${e}`;function $Or(e){if(e)return Ls(Vlt(e))[0]}function FOr(e,t){e&&Zl(Vlt(e),[t])}function zOr(e){e&&fx(Vlt(e))}function HOr(){px(BOr)}function UOr(e,t,r){if(!e)return{reviewAfter:!1,announceAfter:!1,draft:!1,autoMerge:!1};HOr();let n=$Or(t);return{reviewAfter:n?.reviewAfter??r.reviewAfter,announceAfter:n?.announceAfter??!0,draft:n?.draft??r.draft,autoMerge:n?.autoMerge??!1}}function VOr(e,t,r,n,o){return{comments:t,screenshots:n,reviewAfter:e&&r.reviewAfter,announceAfter:e&&r.announceAfter,draft:r.draft,autoMerge:e&&r.autoMerge,...o===void 0?{}:{body:o}}}function WOr(e,t){return!e||t===!1?{}:t===!0?{autostart:!0}:{autostart:!0,startOn:t}}function qOr(e,t,r,n,o,i,a){let[s,l]=(0,GOr.useState)(()=>UOr(n,t,o));return{chain:s,setChain:f=>{l(f),FOr(t,f)},onDecide:(f,p,h=!1)=>{let m=f==="approve";r(f,{...VOr(m,p,s,m?i.attachments():[],a()),...WOr(m,h)}),BEe(e),m&&(zOr(t),i.clearPersisted())}}}var rBr=S(ie(),1);var ZPo=/^ {0,3}#{1,6}[ \t]+acceptance criteria[ \t]*$/i,QPo=/^ {0,3}#{1,6}[ \t]/;function hR(e){let t=e.split(`
|
|
4003
|
+
`),additions:h7r(o,"+"),deletions:h7r(o,"-"),split:{hunks:o.length,of:n.length,elsewhere:i}}}function g7r(e){return e.flatMap(t=>{if(t.kind==="dir")return g7r(t.children);let{kind:r,name:n,...o}=t;return[o]})}function vPo(e){let t=new Map;return e.forEach((r,n)=>{for(let o of r.hunks)t.set(o,[...t.get(o)??[],n+1])}),t}function y7r(e,t,r=new Set,n=new Set){let o=g7r(e.tree).filter(a=>!r.has(a.path)).map(a=>n.has(a.path)?{...a,critical:!0}:a),i=vPo(t);return t.map((a,s)=>{let l=new Set(a.hunks.map(aG));return u7r(o.filter(u=>l.has(u.path)).map(u=>m7r(u,s+1,i)))})}function bPo(e,t){let r=-1,n=0;return t.forEach((o,i)=>{let a=o.hunks.filter(s=>aG(s)===e).length;a>n&&(r=i,n=a)}),r}function v7r(e,t){let r=t.map(()=>[]);for(let n of e)r[bPo(n.path,t)]?.push(n);return r}function b7r(e,t){let r=y7r(e.structure,t,new Set(e.tests.map(i=>i.path)),new Set(e.criticalDiffs.map(i=>i.path))),n=v7r(e.tests,t),o=Z_e(t);return t.map((i,a)=>{let s=a+1;return{number:s,slice:i,structure:r[a]??e.structure,tests:n[a]??[],critical:e.criticalDiffs.filter(l=>o.get(l.path)?.some(u=>u.number===s))}})}function x7r(e){if(!e.slices)return;let t=b7r(e,e.slices);return{entries:r7r(e,t),slicing:{count:t.length,noCritical:new Set(t.filter(r=>r.critical.length===0).map(r=>r.number))}}}var S7r="assist:high-level-progress:",xPo=720*60*60*1e3,woe=e=>`${S7r}${e}`;function T7r(e,t){px(S7r,xPo);let r=Ls(woe(e))[0];if(r||!t)return r;let n=Ls(woe(t))[0];return fx(woe(t)),n}function w7r(e,t){Zl(woe(e),[t])}function C7r(e){fx(woe(e))}function k7r(e){let t=e;return typeof t?.id=="string"&&typeof t.title=="string"&&typeof t.reason=="string"&&(t.kind==="deterministic"||t.kind==="manual")&&["pass","fail","manual"].includes(t.status)}function vD(e,t){return Array.isArray(e)?t?e.filter(t):e:[]}var mG={repo:"",prNumber:0,headSha:"",checks:[],structure:{tree:[],added:0,removed:0,modified:0,additions:0,deletions:0},criticalDiffs:[],criticalPaths:[],tests:[],testPaths:[],collapsedPaths:[]};function _7r(e){let t;try{t=JSON.parse(e)}catch{return mG}return typeof t!="object"||t===null?mG:{repo:typeof t.repo=="string"?t.repo:mG.repo,prNumber:typeof t.prNumber=="number"?t.prNumber:mG.prNumber,headSha:typeof t.headSha=="string"?t.headSha:mG.headSha,checks:vD(t.checks,k7r),structure:{...mG.structure,...t.structure},criticalDiffs:vD(t.criticalDiffs),criticalPaths:vD(t.criticalPaths),tests:vD(t.tests),testPaths:vD(t.testPaths),collapsedPaths:vD(t.collapsedPaths),...Array.isArray(t.slices)?{slices:t.slices}:{},...t.manualTesting?{manualTesting:t.manualTesting}:{},...t.saved?{saved:t.saved}:{},...t.draft?{draft:t.draft}:{}}}function E7r(e){let t=(0,vEe.useMemo)(()=>_7r(e.body),[e.body]),r=(0,vEe.useMemo)(()=>x7r(t),[t]),n=(0,vEe.useMemo)(()=>T7r(e.requestId,e.supersedes)??t.draft??t.saved,[e.requestId,e.supersedes,t]);return{payload:t,sliced:r,progress:n}}var R7r=S(ie(),1);function P7r(e){let[t,r]=(0,R7r.useState)(()=>e?.reviewComments??[]);return{queued:t,onQueue:n=>r(o=>[...o,n]),onRemove:n=>r(o=>o.filter((i,a)=>a!==n))}}var A7r=S(ie(),1);function L7r(e,t,r){(0,A7r.useEffect)(()=>{w7r(e,{items:t,reviewComments:r})},[e,t,r])}function D7r(e,t,r){let{payload:n,sliced:o,progress:i}=E7r(e),a=JNr(n.checks,i,o?.slicing),s=P7r(i),l=VNr(o?.entries??[]),{comments:u,sentTo:d,clearSent:f}=t7r(t,r),p={...u,onQueue:s.onQueue};L7r(e.requestId,a.items,s.queued);let h=(0,I7r.useMemo)(()=>YNr(n),[n]);return{payload:n,checklist:a,queue:s,details:jNr(n,p),counts:h,sentTo:d,clearSent:f,sliced:o,nav:l,diffComments:p}}var Dx=S(R(),1);function M7r({preview:e,session:t,sendInput:r,onDecision:n}){let o=D7r(e,t,r);return(0,Dx.jsxs)(W,{sx:w0,children:[(0,Dx.jsx)(dh,{preview:e,draft:!1}),(0,Dx.jsx)(pG,{items:e.metadata??[]}),(0,Dx.jsx)(ro,{}),(0,Dx.jsx)(INr,{payload:o.payload,checklist:o.checklist,details:o.details,counts:o.counts,sliced:o.sliced,nav:o.nav,comments:o.diffComments}),(0,Dx.jsx)(ro,{}),(0,Dx.jsx)(HNr,{pane:o,onDecision:(i,a)=>{C7r(e.requestId),n(i,a)}}),(0,Dx.jsx)(ux,{sessionName:o.sentTo,onClose:o.clearSent})]})}var U7r=S(ie(),1);var bD=S(R(),1);function SPo(e){return e.topLeft===null?"Click the top-left box":e.bottomRight===null?"Now click the bottom-right box":"Both anchors picked"}function N7r({selection:e,onConfirm:t,onReject:r}){let n=e.topLeft!==null&&e.bottomRight!==null;return(0,bD.jsxs)(kt,{direction:"row",spacing:1,sx:{p:2,alignItems:"center",justifyContent:"flex-end"},children:[(0,bD.jsx)(Te,{variant:"body2",sx:{flex:1,color:"text.secondary"},children:SPo(e)}),(0,bD.jsx)(it,{color:"error",variant:"outlined",onClick:r,children:"Cancel"}),(0,bD.jsx)(it,{variant:"outlined",onClick:e.reset,children:"Start over"}),(0,bD.jsx)(it,{color:"success",variant:"contained",disabled:!n,onClick:t,children:"Extract boxes"})]})}var TPo={"top-left":Xl.miro.topLeft,"bottom-right":Xl.miro.bottomRight};function O7r(e,t){let r=e.right-e.left,n=e.bottom-e.top;return{width:r,height:n,fontSize:Math.max(6,Math.min(n*.3,r/6,28)),radius:Math.min(8,n/4),colour:t?TPo[t]:Xl.miro.box,opacity:t?.75:.35,strokeWidth:Math.max(1,r*.004)}}var Coe=S(R(),1);function B7r({box:e,role:t,onSelect:r}){let n=O7r(e,t);return(0,Coe.jsxs)("g",{role:"button",tabIndex:0,"aria-label":t?`${e.text} (${t})`:e.text,onClick:()=>r(e.id),onKeyDown:o=>{o.key==="Enter"&&r(e.id)},style:{cursor:"pointer"},children:[(0,Coe.jsx)("rect",{x:e.left,y:e.top,width:n.width,height:n.height,rx:n.radius,fill:n.colour,fillOpacity:n.opacity,stroke:n.colour,strokeWidth:n.strokeWidth}),(0,Coe.jsx)("text",{x:e.left+n.width/2,y:e.top+n.height/2,textAnchor:"middle",dominantBaseline:"central",fontSize:n.fontSize,fill:Xl.miro.text,children:e.text})]})}function $7r(e){if(e.length===0)return"0 0 100 100";let t=Math.min(...e.map(a=>a.left)),r=Math.min(...e.map(a=>a.top)),n=Math.max(...e.map(a=>a.right))-t,o=Math.max(...e.map(a=>a.bottom))-r,i=Math.max(n*.02,8);return`${t-i} ${r-i} ${n+i*2} ${o+i*2}`}var bEe=S(R(),1);function F7r({boxes:e,selection:t}){return(0,bEe.jsx)(W,{sx:{flex:1,minHeight:0,overflow:"auto",p:2},children:(0,bEe.jsx)("svg",{role:"img","aria-label":"Miro board boxes",viewBox:$7r(e),preserveAspectRatio:"xMidYMid meet",style:{width:"100%",height:"100%"},children:e.map(r=>(0,bEe.jsx)(B7r,{box:r,role:t.roleOf(r.id),onSelect:t.choose},r.id))})})}function wPo(e){return typeof e?.id=="string"&&typeof e.text=="string"&&[e.left,e.top,e.right,e.bottom].every(t=>typeof t=="number"&&Number.isFinite(t))}function z7r(e){try{let t=JSON.parse(e);return Array.isArray(t?.boxes)?t.boxes.filter(wPo):[]}catch{return[]}}var Llt=S(ie(),1);function H7r(){let[e,t]=(0,Llt.useState)(null),[r,n]=(0,Llt.useState)(null);return{topLeft:e,bottomRight:r,choose:s=>{if(e===null||r!==null){t(s),n(null);return}n(s)},reset:()=>{t(null),n(null)},roleOf:s=>s===e?"top-left":s===r?"bottom-right":null}}var cR=S(R(),1);function V7r({preview:e,onDecision:t}){let r=(0,U7r.useMemo)(()=>z7r(e.body),[e.body]),n=H7r();return(0,cR.jsxs)(W,{sx:w0,children:[(0,cR.jsx)(dh,{preview:e,draft:!1}),(0,cR.jsx)(ro,{}),(0,cR.jsx)(F7r,{boxes:r,selection:n}),(0,cR.jsx)(ro,{}),(0,cR.jsx)(N7r,{selection:n,onConfirm:()=>{let{topLeft:i,bottomRight:a}=n;i===null||a===null||t("approve",Ic({topLeft:i,bottomRight:a}))},onReject:()=>t("reject",Ic())})]})}var x8r=S(ie(),1);function W7r(e){let t=[];return e.map(r=>(t.length=r+1,t[r]=(t[r]??0)+1,t.map(n=>n??1).join(".")))}function xEe(e){return e*22}function G7r(e){return Math.round(e/22)}var q7r={display:"flex",alignItems:"flex-start",gap:.25,"& .criterion-action":{opacity:0,transition:"opacity 120ms"},"&:hover .criterion-action":{opacity:1},"&:focus-within .criterion-action":{opacity:1},"& .criterion-action:focus-visible":{opacity:1}},j7r={p:.25,mt:"2px",color:"text.disabled",cursor:"grab",touchAction:"none","&:active":{cursor:"grabbing"}},Y7r={fontFamily:"fontFamilyMono",fontSize:"0.8rem",color:"text.secondary",minWidth:32,pt:"5px",textAlign:"right",userSelect:"none",whiteSpace:"nowrap"},K7r={flex:1,fontSize:"inherit",lineHeight:1.5,px:.75,py:0,borderRadius:1,"&:hover":{bgcolor:"action.hover"},"&.Mui-focused":{bgcolor:"action.selected"}},Ilt={p:.25,mt:"2px"},X7r={position:"absolute",right:8,height:2,borderRadius:1,bgcolor:"primary.main",pointerEvents:"none"};var Q7r=S(R(),1),CPo=8;function Z7r({drag:e}){return e?(0,Q7r.jsx)(W,{sx:X7r,style:{top:e.top-1,left:CPo+xEe(e.depth)}}):null}var J7r=S(R(),1),e8r=ot((0,J7r.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");var Dlt=S(R(),1);function t8r({number:e,onGrip:t}){return(0,Dlt.jsx)(Kt,{size:"small",className:"criterion-action",sx:j7r,"aria-label":`Reorder criterion ${e}`,onPointerDown:t,children:(0,Dlt.jsx)(e8r,{fontSize:"inherit"})})}var rC=S(R(),1);function r8r({number:e,onAdd:t,onDelete:r}){return(0,rC.jsxs)(rC.Fragment,{children:[(0,rC.jsx)(Kt,{size:"small",className:"criterion-action",sx:Ilt,"aria-label":`Add criterion after ${e}`,onClick:t,children:(0,rC.jsx)(Rp,{fontSize:"inherit"})}),(0,rC.jsx)(Kt,{size:"small",className:"criterion-action",sx:Ilt,"aria-label":`Delete criterion ${e}`,onClick:r,children:(0,rC.jsx)(Bo,{fontSize:"inherit"})})]})}var SEe=S(ie(),1);function n8r(e,t){return e==="start"?0:e==="end"?t:Math.min(Math.max(e,0),t)}function o8r(e){let t=(0,SEe.useRef)(null);return(0,SEe.useEffect)(()=>{let r=t.current;if(!e||!r)return;r.focus();let n=n8r(e.caret,r.value.length);r.setSelectionRange(n,n)},[e]),t}var xD=S(R(),1);function i8r({index:e,number:t,item:r,outline:n,dragging:o,onGrip:i}){let a=o8r(n.focus?.index===e?n.focus:null),s={marginLeft:xEe(r.depth),opacity:o?.4:1};return(0,xD.jsxs)(W,{sx:q7r,"data-criterion-row":!0,style:s,children:[(0,xD.jsx)(t8r,{number:t,onGrip:i}),(0,xD.jsx)(W,{component:"span",sx:Y7r,"aria-hidden":"true",children:`${t}.`}),(0,xD.jsx)(ea,{multiline:!0,value:r.text,sx:K7r,inputRef:a,inputProps:{"aria-label":`Criterion ${t}`},onChange:l=>n.onText(e,l.target.value),onKeyDown:l=>n.onKeyDown(e,l)}),(0,xD.jsx)(r8r,{number:t,onAdd:()=>n.onAdd(e),onDelete:()=>n.onDelete(e)})]})}var f8r=S(ie(),1);function a8r(e,t,{key:r,shift:n,alt:o,caret:i,text:a}){return o||n?null:r==="ArrowUp"&&i===0&&t>0?{kind:"focus",index:t-1}:r==="ArrowDown"&&i===a.length&&t<e.length-1?{kind:"focus",index:t+1}:null}function uR(e){if(e.length===0)return[{text:"",depth:0}];let t=-1;return e.map(r=>{let n=Math.min(Math.max(r.depth,0),t+1);return t=n,r.depth===n?r:{...r,depth:n}})}function TEe(e,t,r,n){let o=e[t]?.depth??0,i=e.map((a,s)=>s===t?{...a,text:r}:a);return{items:uR([...i.slice(0,t+1),{text:n,depth:o},...i.slice(t+1)]),index:t+1}}function Bm(e,t){let r=t+1;for(;r<e.length&&e[r].depth>e[t].depth;)r+=1;return r}function wEe(e,t){let r=e[t].depth;for(let n=t-1;n>=0;n-=1){if(e[n].depth<r)return-1;if(e[n].depth===r)return n}return-1}function s8r(e,t){let r=Bm(e,t);return r<e.length&&e[r].depth===e[t].depth?r:-1}function l8r(e,t,r){let n=r<0?wEe(e,t):s8r(e,t);if(n<0)return null;let o=Bm(e,t),i=e.slice(t,o),a=[...e.slice(0,t),...e.slice(o)],s=r<0?n:Bm(e,n)-(o-t);return{items:[...a.slice(0,s),...i,...a.slice(s)],index:s}}function CEe(e,t){let r=Bm(e,t),n=e.map((o,i)=>i>t&&i<r?{...o,depth:o.depth-1}:o).filter((o,i)=>i!==t);return{items:uR(n),index:Math.max(0,t-1)}}function c8r(e,t,r){if(r<0&&e[t].depth===0||r>0&&wEe(e,t)<0)return null;let n=Bm(e,t);return e.map((o,i)=>i>=t&&i<n?{...o,depth:o.depth+r}:o)}function kEe(e,t){return e?{kind:"edit",edit:e,caret:t}:null}function kPo(e,t,{caret:r,text:n}){let o=n.slice(0,r);return kEe(TEe(e,t,o,n.slice(r)),"start")}function _Po(e,t,{shift:r,caret:n}){let o=c8r(e,t,r?-1:1);return kEe(o?{items:o,index:t}:null,n)}function u8r(e,t,r){let{key:n,shift:o,alt:i,caret:a,text:s}=r;return n==="Enter"&&!o?kPo(e,t,r):n==="Tab"?_Po(e,t,r):i&&(n==="ArrowUp"||n==="ArrowDown")?kEe(l8r(e,t,n==="ArrowUp"?-1:1),a):n==="Backspace"&&a===0&&s===""?kEe(CEe(e,t),"end"):null}function d8r(e,t,r){return u8r(e,t,r)??a8r(e,t,r)}function p8r(e,t){let[r,n]=(0,f8r.useState)(null),o=(a,s)=>{a&&(t(a.items),n({index:a.index,caret:s}))};return{focus:r,onKeyDown:(a,s)=>{let l=s.currentTarget;(s.key==="Enter"||s.key==="Tab")&&s.preventDefault();let u=d8r(e,a,{key:s.key,shift:s.shiftKey,alt:s.altKey,caret:l.selectionStart??0,text:l.value});u&&(s.preventDefault(),u.kind==="focus"?n({index:u.index,caret:"end"}):o(u.edit,u.caret))},onDrop:a=>o(a,"end"),onText:(a,s)=>t(e.map((l,u)=>u===a?{...l,text:s}:l)),onAdd:a=>o(TEe(e,a,e[a].text,""),"start"),onDelete:a=>o(CEe(e,a),"end")}}var v8r=S(ie(),1);function EPo(e,t,r,n){let o=t.length;for(let a=0;a<e.length;a+=1)if(n<e[a].top+e[a].height/2){o=a;break}let i=Bm(t,r);return o>r&&o<i?r:o}function RPo(e,t,r,n){let o=Bm(e,t),i=r-1,a=i>=t&&i<o?t-1:i,s=a>=0?e[a].depth+1:0;return Math.max(0,Math.min(e[t].depth+G7r(n),s))}function PPo(e,t){if(t<e.length)return e[t].top;let r=e[e.length-1];return r?r.top+r.height:0}function h8r(e,t,r,n,o){let i=EPo(e,t,r,o);return{target:i,depth:RPo(t,r,i,n),top:PPo(e,i)}}function APo(e){let t=e.getBoundingClientRect().top;return{boxes:Array.from(e.querySelectorAll("[data-criterion-row]")).map(n=>{let o=n.getBoundingClientRect();return{top:o.top-t,height:o.height}}),origin:t}}function m8r(e,t,r,n){return o=>{let{boxes:i,origin:a}=APo(t);return h8r(i,e,r,o.clientX-n,o.clientY-a)}}function g8r(e,t,r,n,o){let i=new AbortController,a=null,s=d=>{a=r(d),n(a)},l=()=>{i.abort(),a&&o(a)},u={signal:i.signal};return e.setPointerCapture(t),e.addEventListener("pointermove",s,u),e.addEventListener("pointerup",l,u),e.addEventListener("pointercancel",l,u),s}function y8r(e,t,r,n){let o=Bm(e,t),i=n-e[t].depth,a=e.slice(t,o).map(u=>({...u,depth:Math.max(0,u.depth+i)})),s=[...e.slice(0,t),...e.slice(o)],l=r>t?r-a.length:r;return{items:uR([...s.slice(0,l),...a,...s.slice(l)]),index:l}}function b8r(e,t,r){let[n,o]=(0,v8r.useState)(null);return{drag:n,onGrip:a=>s=>{let l=t.current;if(!l||s.pointerType==="mouse"&&s.button!==0)return;s.preventDefault(),g8r(s.currentTarget,s.pointerId,m8r(e,l,a,s.clientX),d=>o({from:a,depth:d.depth,top:d.top}),d=>{o(null),r(y8r(e,a,d.target,d.depth))})(s)}}}var koe=S(R(),1),LPo={my:1,px:1,py:.5,border:1,borderColor:"divider",borderRadius:1,position:"relative",userSelect:"text",cursor:"auto"},IPo=[{text:"",depth:0}];function S8r({items:e,onChange:t}){let r=(0,x8r.useRef)(null),n=e.length>0?e:IPo,o=p8r(n,t),{drag:i,onGrip:a}=b8r(n,r,o.onDrop),s=W7r(n.map(l=>l.depth));return(0,koe.jsxs)(W,{sx:LPo,ref:r,"data-preview-skip":!0,"aria-label":"Acceptance criteria",children:[n.map((l,u)=>(0,koe.jsx)(i8r,{index:u,number:s[u],item:l,outline:o,dragging:i?.from===u,onGrip:a(u)},`criterion-${u}`)),(0,koe.jsx)(Z7r,{drag:i})]})}var T8r=S(R(),1),w8r=ot((0,T8r.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z"}),"FormatListNumbered");var _oe=S(R(),1),DPo={insert:"Add acceptance criteria",convert:"Convert to outline"};function C8r({kind:e,onClick:t}){return(0,_oe.jsx)(W,{sx:{my:1},"data-preview-skip":!0,children:(0,_oe.jsx)(it,{size:"small",variant:"outlined",startIcon:e==="insert"?(0,_oe.jsx)(Rp,{}):(0,_oe.jsx)(w8r,{}),onClick:t,children:DPo[e]})})}var Eoe=S(ie(),1);function k8r(e,t,{color:r,pin:n}){let o=pA(e),i=[],a=o.nextNode();for(;a;){let u=a;if(t.intersectsNode(u)){let d=u===t.startContainer?t.startOffset:0,f=u===t.endContainer?t.endOffset:u.length;d<f&&i.push({node:u,start:d,end:f})}a=o.nextNode()}let l=i.map(u=>MPo(u.node,u.start,u.end,r)).at(-1);l&&n&&(l.dataset.pin=n)}function MPo(e,t,r,n){let o=document.createRange();o.setStart(e,t),o.setEnd(e,r);let i=document.createElement("mark");return i.className="pr-comment",i.style.backgroundColor=n,o.surroundContents(i),i}function _8r(e){for(let t of e.querySelectorAll("mark.pr-comment"))if(t.parentNode){for(;t.firstChild;)t.before(t.firstChild);t.remove()}}function E8r(e,t){for(let r of t){let n=APt(e,r);n&&k8r(e,n,r)}}var Roe=S(R(),1);function R8r({content:e,control:t,trailing:r,ranges:n,contentRef:o}){let i=(0,Eoe.useMemo)(()=>Cw(e),[e]),a=(0,Eoe.useMemo)(()=>r?Cw(r):"",[r]);return(0,Eoe.useLayoutEffect)(()=>{let s=o.current;s&&(_8r(s),E8r(s,n))},[i,a,n,o]),(0,Roe.jsxs)(W,{ref:o,children:[(0,Roe.jsx)(Bl,{className:"markdown",html:i}),t,t?(0,Roe.jsx)(Bl,{className:"markdown",html:a}):null]})}var SD=e=>e.split(",").map(t=>`&& .markdown ${t.trim()}`).join(", ");function _Ee(e){let{color:t,radius:r}=e.tokens;return{px:2.5,py:2,fontSize:14,lineHeight:1.6,[SD("")]:{lineHeight:1.6},[SD("h1, h2, h3, h4, h5, h6")]:{fontSize:15,fontWeight:600,lineHeight:1.4,mt:2,mb:1},[SD("ul, ol")]:{pl:2.5,mb:2},[SD("li")]:{mb:"6px"},[SD("code")]:{fontFamily:e.typography.fontFamilyMono,fontSize:"0.86em",px:"5px",py:0,bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:"4px"},[SD("pre")]:{bgcolor:t.raised,border:1,borderColor:t.lineSoft,borderRadius:`${r.sm}px`},[SD("pre code")]:{border:0,px:0,bgcolor:"transparent"}}}var P8r=e=>({flex:1,overflow:"auto",position:"relative",userSelect:"none",cursor:"text",wordBreak:"break-word","& .markdown":{...Mhe(e),maxWidth:"none"},"& a":{color:"primary.main"},"& mark.pr-comment":{color:"inherit",borderRadius:"2px"},..._Ee(e)});var gG=S(R(),1);function A8r({content:e,control:t,trailing:r,ranges:n,wrapperRef:o,contentRef:i,dragRects:a,dragColor:s,onMouseDown:l,footer:u}){return(0,gG.jsxs)(W,{ref:o,onMouseDown:l,sx:P8r,children:[(0,gG.jsx)(R8r,{content:e,control:t,trailing:r,ranges:n,contentRef:i}),u&&(0,gG.jsx)(W,{sx:{userSelect:"text"},children:u}),(0,gG.jsx)($O,{rects:a,color:s})]})}function L8r(e){let t=new Map,r=[];for(let n of e){if(!n.group){r.push(n);continue}t.set(n.group,[...t.get(n.group)??[],n])}return{groups:[...t],ungrouped:r}}var EEe=S(ie(),1),I8r=S(R(),1);function Mlt({label:e,value:t,onCommit:r,listId:n}){let[o,i]=(0,EEe.useState)(t);return(0,EEe.useEffect)(()=>i(t),[t]),(0,I8r.jsx)(xn,{size:"small",variant:"standard",fullWidth:!0,label:e,value:o,onChange:s=>i(s.target.value),onBlur:()=>{let s=o.trim();i(t),s!==t&&r(s)},onKeyDown:s=>{s.key==="Enter"&&s.target.blur()},onMouseDown:s=>s.stopPropagation(),slotProps:{htmlInput:{list:n}}})}var Poe=S(R(),1),Nlt="screenshot-groups";function NPo(e){return(e.split(/[\\/]/).pop()??e).replace(/\.[^.]+$/,"")}function D8r({screenshot:e,onUpdate:t}){return(0,Poe.jsxs)(kt,{direction:"row",spacing:1,sx:{mt:.5},children:[(0,Poe.jsx)(Mlt,{label:"Caption",value:e.alt,onCommit:r=>t(e.id,{alt:r||NPo(e.path)})}),(0,Poe.jsx)(Mlt,{label:"Group",value:e.group??"",listId:Nlt,onCommit:r=>t(e.id,{group:r})})]})}var dR=S(R(),1),M8r={display:"block",maxWidth:"100%",borderRadius:1,border:1,borderColor:"divider"},OPo={position:"absolute",top:4,right:4,bgcolor:"background.paper","&:hover":{bgcolor:"background.paper"}};function N8r({screenshot:e,onRemove:t,onUpdate:r}){let n=e.contentType.startsWith("video/");return(0,dR.jsxs)(W,{sx:{position:"relative"},children:[n?(0,dR.jsx)(W,{component:"video",controls:!0,src:e.url,"aria-label":"screenshot",sx:M8r}):(0,dR.jsx)(W,{component:"img",src:e.url,alt:"screenshot",sx:M8r}),(0,dR.jsx)(Kt,{size:"small","aria-label":"Remove screenshot",sx:OPo,onMouseDown:o=>o.stopPropagation(),onClick:()=>t(e.id),children:(0,dR.jsx)(Bo,{fontSize:"small"})}),(0,dR.jsx)(D8r,{screenshot:e,onUpdate:r})]})}var L0=S(R(),1);function BPo(){return(0,L0.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,L0.jsx)(mo,{size:16}),(0,L0.jsx)(Te,{variant:"caption",color:"text.secondary",children:"Attaching screenshot or video\u2026"})]})}function $Po({error:e}){return(0,L0.jsx)(Te,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:e})}function O8r({uploads:e,empty:t}){return e.length>0?(0,L0.jsx)(L0.Fragment,{children:e.map(r=>r.error?(0,L0.jsx)($Po,{error:r.error},r.id):(0,L0.jsx)(BPo,{},r.id))}):t?(0,L0.jsx)(Te,{variant:"caption",color:"text.secondary",children:"Drop or paste an image or video to attach"}):null}var I0=S(R(),1),FPo={display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:1};function B8r({screenshots:e,uploads:t,onRemove:r,onUpdate:n}){let{groups:o,ungrouped:i}=L8r(e),a=s=>(0,I0.jsx)(N8r,{screenshot:s,onRemove:r,onUpdate:n},s.id);return(0,I0.jsxs)(W,{sx:{mt:3},children:[e.length>0&&(0,I0.jsx)(W,{component:"h2",children:"Screenshots"}),(0,I0.jsx)("datalist",{id:Nlt,children:o.map(([s])=>(0,I0.jsx)("option",{value:s},s))}),o.map(([s,l])=>(0,I0.jsxs)(W,{sx:{mb:2},children:[(0,I0.jsx)(W,{component:"h3",children:s}),(0,I0.jsx)(W,{sx:FPo,children:l.map(a)})]},s)),(0,I0.jsxs)(kt,{spacing:1,children:[i.map(a),(0,I0.jsx)(O8r,{uploads:t,empty:e.length===0})]})]})}var Aoe=S(R(),1);function zPo(e){let t=e.criteria;if(!t)return{content:e.body};let r={content:t.before,trailing:t.after};return t.kind==="outline"?{...r,control:(0,Aoe.jsx)(S8r,{items:t.items,onChange:e.onCriteriaChange})}:{...r,control:(0,Aoe.jsx)(C8r,{kind:t.kind,onClick:t.kind==="insert"?e.onCriteriaInsert:e.onCriteriaConvert})}}function REe({pane:e,screenshots:t}){return(0,Aoe.jsx)(A8r,{...zPo(e),ranges:e.ranges,wrapperRef:e.wrapperRef,contentRef:e.contentRef,dragRects:e.dragRects,dragColor:e.dragColor,onMouseDown:e.onMouseDown,footer:t?(0,Aoe.jsx)(B8r,{screenshots:e.screenshots,uploads:e.uploads,onRemove:e.removeScreenshot,onUpdate:e.updateScreenshot}):void 0})}var $8r=e=>({display:"grid",gap:1,maxHeight:220,overflow:"auto",px:2,py:1.25,borderTop:1,borderColor:e.tokens.color.lineSoft}),F8r={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"text.secondary"},z8r=e=>({display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:"4px 8px",px:1.25,py:1,borderRadius:`${e.tokens.radius.sm}px`,bgcolor:e.tokens.color.raised,border:1,borderColor:e.tokens.color.lineSoft,fontSize:12.5}),H8r={gridColumn:2,gridRow:1,width:20,height:20,color:"text.disabled","& .MuiSvgIcon-root":{fontSize:14}};var nC=S(R(),1);function U8r({comments:e,colors:t,onRemove:r}){return(0,nC.jsxs)(W,{sx:$8r,children:[(0,nC.jsxs)(Te,{sx:F8r,children:["Comments (",e.length,")"]}),e.map((n,o)=>(0,nC.jsxs)(W,{sx:z8r,children:[(0,nC.jsx)(MO,{text:n.quote,sx:{gridColumn:1,borderLeft:2,pl:1,borderColor:t[o]}}),(0,nC.jsx)(W,{sx:{gridColumn:1,wordBreak:"break-word"},children:n.note}),(0,nC.jsx)(Kt,{"aria-label":"Remove comment",onClick:()=>r(n.id),sx:H8r,children:(0,nC.jsx)(Bo,{})})]},n.id))]})}var W8r=S(R(),1);function V8r(e){return e.comments.length===0?null:(0,W8r.jsx)(U8r,{...e})}var G8r=S(R(),1),PEe=ot((0,G8r.jsx)("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"}),"Computer");var Z8r=S(ie(),1);var q8r=S(R(),1),j8r=ot((0,q8r.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var D0="0.1090.0";var HPo={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function Y8r(e){return e?HPo[e]:"success.main"}function K8r(e){return e.split("-")[0].split(".").map(Number)}function X8r(e,t){if(!e||!t||e===t)return;let r=K8r(e),n=K8r(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var AEe=S(ie(),1),Olt=(0,AEe.createContext)(null);function LEe(){return(0,AEe.useContext)(Olt)}var TD=S(R(),1),UPo={height:16,fontSize:10},VPo={opacity:.6,fontSize:"0.85em"};function WPo(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function fR({nodes:e,name:t,showVersion:r=!1}){let n=LEe()??D0,o=e.links.find(a=>a.name===t),i=X8r(o?.peerVersion,n);return(0,TD.jsx)(pr,{title:WPo(e,t),placement:"right",children:(0,TD.jsxs)(W,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,TD.jsx)(j8r,{sx:{fontSize:8,color:Y8r(o?.state)}}),t,r&&o?.peerVersion&&(0,TD.jsxs)(W,{component:"span",sx:VPo,children:["v",o.peerVersion]}),i&&(0,TD.jsx)(zn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:UPo})]})})}var M0=S(R(),1),GPo={textTransform:"none"};function IEe({nodes:e,options:t,target:r,onPick:n}){let[o,i]=(0,Z8r.useState)(null);return(0,M0.jsxs)(M0.Fragment,{children:[(0,M0.jsx)(it,{size:"small",color:"inherit",startIcon:(0,M0.jsx)(PEe,{fontSize:"small"}),"aria-label":"Start on node","aria-haspopup":"menu",onClick:a=>i(a.currentTarget),sx:GPo,children:(0,M0.jsx)(fR,{nodes:e,name:r.node})}),(0,M0.jsx)(wa,{anchorEl:o,open:!!o,onClose:()=>i(null),children:t.map(({name:a,cwd:s})=>(0,M0.jsx)(Gr,{disabled:!s,selected:a===r.node,onClick:()=>{n(a),i(null)},children:(0,M0.jsx)(mf,{primary:(0,M0.jsx)(fR,{nodes:e,name:a}),secondary:s?void 0:"no clone"})},a))})]})}var Q8r=S(ie(),1);function DEe(e){let{nodes:t,names:r,visible:n}=Fs(),{selectedCwd:o,selectedNode:i,cloneOn:a,originOf:s}=Gn(),[l,u]=(0,Q8r.useState)(),d=e&&s(e)?e:o,f=r.map(g=>({name:g,cwd:d?a(d,g):void 0})),p=g=>f.find(y=>y.name===g&&y.cwd),h=p(l)??p(i??t?.local)??f.find(g=>g.cwd),m=n&&h?.cwd?{node:h.name,cwd:h.cwd}:void 0;return{nodes:t,visible:n,options:f,target:m,pick:u}}var pR=S(R(),1);function J8r({canStart:e,cwd:t,onApprove:r,onApproveAndStart:n}){let o=qfe(),i=DEe(t);return(0,pR.jsxs)(pR.Fragment,{children:[(0,pR.jsx)(it,{color:"primary",variant:e?"tonal":"contained",onClick:r,...e?{}:o,children:"Approve"}),e&&i.nodes&&i.target&&(0,pR.jsx)(IEe,{nodes:i.nodes,options:i.options,target:i.target,onPick:i.pick}),e&&(0,pR.jsx)(it,{color:"primary",variant:"contained",onClick:()=>n(i.target),...o,children:"Approve & start"})]})}var Blt=S(R(),1),qPo={"& .MuiFormControlLabel-label":{fontSize:12}};function Loe({label:e,title:t,checked:r,onChange:n}){return(0,Blt.jsx)(_d,{control:(0,Blt.jsx)(yp,{size:"small",checked:r,onChange:o=>n(o.target.checked)}),label:e,title:t,sx:qPo})}var wD=S(R(),1);function MEe({chain:e,newPr:t,onChange:r}){return(0,wD.jsxs)(kt,{direction:"row",sx:{mr:"auto"},children:[t&&(0,wD.jsx)(Loe,{label:"Draft",title:"Create the PR as a draft rather than ready for review",checked:e.draft,onChange:n=>r({...e,draft:n,autoMerge:n?!1:e.autoMerge})}),(0,wD.jsx)(Loe,{label:"Auto-merge (squash)",title:"Squash-merge the PR automatically once its required checks pass",checked:e.autoMerge,onChange:n=>r({...e,autoMerge:n,draft:n?!1:e.draft})}),(0,wD.jsx)(Loe,{label:"Review PR",title:"After raising, run a review that posts its findings and then addresses them",checked:e.reviewAfter,onChange:n=>r({...e,reviewAfter:n})}),(0,wD.jsx)(Loe,{label:"Post to Slack",title:"Announce the PR in Slack at the tail of the chain",checked:e.announceAfter,onChange:n=>r({...e,announceAfter:n})})]})}var CD=S(R(),1);function eOr({commentCount:e,chain:t,newPr:r,canStart:n,onChainChange:o,onApprove:i,cwd:a,onApproveAndStart:s,onReject:l,onRequestChanges:u}){return(0,CD.jsxs)(kt,{direction:"row",spacing:1,sx:{px:2,py:1.5,alignItems:"center",justifyContent:"flex-end"},children:[t&&(0,CD.jsx)(MEe,{chain:t,newPr:r,onChange:o}),(0,CD.jsx)(it,{color:"error",variant:"outlined",onClick:l,children:"Reject"}),e>0&&(0,CD.jsxs)(it,{color:"warning",variant:"tonal",onClick:u,children:["Request changes (",e,")"]}),(0,CD.jsx)(J8r,{canStart:n,cwd:a,onApprove:i,onApproveAndStart:s})]})}var oC=S(R(),1);function tOr({comments:e,commentColors:t,pending:r,cwd:n,unavailable:o,onAdd:i,onQueue:a,onCite:s,onAddRule:l,onRemove:u,onCancel:d,onCollapse:f,onDecision:p,chain:h,editable:m,newPr:g,canStart:y,onChainChange:v}){let b=()=>e.map(x=>({quote:x.quote,note:x.note}));return(0,oC.jsxs)(oC.Fragment,{children:[(0,oC.jsx)(V8r,{comments:e,colors:t,onRemove:u}),(0,oC.jsx)(ro,{}),(0,oC.jsx)(eOr,{commentCount:e.length,chain:h,newPr:g,canStart:y,onChainChange:v,onApprove:()=>p("approve",b()),cwd:n,onApproveAndStart:x=>p("approve",b(),x??!0),onReject:()=>p("reject",[]),onRequestChanges:()=>p("reject",b())}),(0,oC.jsx)(nhe,{pending:r,editable:m,cwd:n,unavailable:o,onAdd:i,onQueue:a,onCite:s,onAddRule:l,onCancel:d,onCollapse:f})]})}var Ioe=S(R(),1),jPo={px:2,pb:2,display:"flex",alignItems:"center",gap:1.5,minWidth:0},YPo={color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function rOr({url:e}){return(0,Ioe.jsxs)(W,{sx:jPo,children:[(0,Ioe.jsx)(it,{variant:"contained",href:e,target:"_blank",rel:"noopener noreferrer",sx:{flexShrink:0},children:"Open design \u2197"}),(0,Ioe.jsx)(Te,{variant:"body2",sx:YPo,title:e,children:e})]})}var $lt=S(R(),1);function nOr({preview:e}){let t=e.kind==="design"?e.metadata?.[0]?.url:void 0;return t?(0,$lt.jsx)(rOr,{url:t}):(0,$lt.jsx)(pG,{items:e.metadata??[]})}function oOr({preview:e,pane:t,cwd:r,isPr:n,editable:o,sender:i,onCite:a,onAddRule:s}){return{comments:t.comments,commentColors:t.commentColors,pending:t.pending,cwd:r,unavailable:i.unavailable,onAdd:i.onSend,onQueue:t.onAdd,onCite:a,onAddRule:s,onRemove:t.remove,onCancel:t.onCancel,onCollapse:t.onCollapse,onDecision:t.onDecide,chain:n?t.chain:void 0,editable:o,newPr:n&&e.prNumber===null,canStart:e.kind==="backlog-item"&&e.canStart===!0,onChainChange:t.setChain}}function yG(e){let t=e??"pr";return{isPr:t==="pr",screenshots:t==="pr"||t==="github-issue",editable:t==="github-issue-edit",closeOnly:t==="show"}}function iOr(e,t){return e?`${e}:${t??"pr"}`:void 0}function NEe(e,t,r,n){return{...yG(e.kind),requestId:e.requestId,supersedes:e.supersedes,sessionId:t,cwd:r,onDecision:n,screenshotScope:iOr(t,e.kind),seededScreenshots:e.screenshots??[],chainDefaults:{draft:e.draft===!0,reviewAfter:e.reviewAfter??!0},initialBody:e.body}}function aOr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&Qd(t,e,FTe({quote:r,note:o})),n()}}function sOr(e,t,r,n){if(!(!e||!t))return o=>{r!==void 0&&Qd(t,e,dx(r,Kpe(o))),n()}}function OEe(e,t,r,n){return{onCite:sOr(e,t,r,n),onAddRule:aOr(e,t,r,n)}}function lOr(e){return{criteria:e.criteria,onCriteriaChange:e.writeCriteria,onCriteriaInsert:e.insertCriteria,onCriteriaConvert:e.convertCriteria}}var yOr=S(ie(),1);var iC=S(ie(),1);var cOr="assist:pr-preview-comments:",Flt=e=>`${cOr}${e}`;function zlt(e){return Ls(Flt(e))}function Doe(e,t){Zl(Flt(e),t)}function BEe(e){fx(Flt(e))}function uOr(){px(cOr)}function dOr(e){let t=pA(e),r="";for(let n=t.nextNode();n;n=t.nextNode())r+=n.textContent??"";return r}function KPo(e,t,r){let n=-1;for(let o=e.indexOf(t);o!==-1;o=e.indexOf(t,o+1))(n===-1||Math.abs(o-r)<Math.abs(n-r))&&(n=o);return n}function fOr(e,t){return e.flatMap(r=>{let n=KPo(t,r.quote,r.start);return n===-1?[]:[{...r,start:n,end:n+r.quote.length}]})}function pOr(e,t,r){let n=zlt(e);if(n.length>0||!t||!r)return n;let o=fOr(zlt(t),dOr(r));return Doe(e,o),BEe(t),o}function hOr(e,t,r){let[n,o]=(0,iC.useState)([]),i=(0,iC.useRef)(0);(0,iC.useEffect)(()=>{uOr(),o(pOr(e,t,r.current).map(l=>({...l,id:i.current++})))},[e,t,r]);let a=(0,iC.useCallback)(l=>{o(u=>{let d=[...u,{...l,id:i.current++}];return Doe(e,d),d})},[e]),s=(0,iC.useCallback)(l=>{o(u=>{let d=u.filter(f=>f.id!==l);return Doe(e,d),d})},[e]);return{comments:n,add:a,remove:s}}function mOr(e,t){let r=e.map((i,a)=>yV(a).solid),n=yV(e.length).fill,o=e.map((i,a)=>({start:i.start,end:i.end,color:yV(a).fill,pin:String(a+1)}));return t&&o.push({start:t.start,end:t.end,color:n}),{commentColors:r,dragColor:n,ranges:o}}function gOr(e,t,r,n){return{onAdd:o=>{e&&t({quote:e.quote,note:o,start:e.start,end:e.end}),n()},onCollapse:()=>{e&&r(e.quote),n()}}}function vOr(e,t,r){let{wrapperRef:n,contentRef:o,pending:i,dragRects:a,onMouseDown:s,clear:l,select:u}=bV(),{comments:d,add:f,remove:p}=hOr(e,t,o),{commentColors:h,dragColor:m,ranges:g}=(0,yOr.useMemo)(()=>mOr(d,i),[d,i]),{onAdd:y,onCollapse:v}=gOr(i,f,r,l);return{wrapperRef:n,contentRef:o,onMouseDown:s,comments:d,commentColors:h,remove:p,pending:i,ranges:g,dragRects:a,dragColor:m,onAdd:y,onCollapse:v,onCancel:l,onSelect:u}}var FEe=S(ie(),1);var Hlt="assist:preview-screenshots:",Ult=e=>`${Hlt}${e}`,$Ee=e=>`${Hlt}seeded:${e}`;function bOr(e){return e?(px(Hlt),Ls(Ult(e)).filter(t=>typeof t.path=="string")):[]}function kD(e,t){e&&Zl(Ult(e),t.map(({path:r,alt:n,group:o,contentType:i,seeded:a})=>({path:r,alt:n,group:o,contentType:i,seeded:a})))}function xOr(e){e&&(fx(Ult(e)),fx($Ee(e)))}var _D=S(ie(),1);var SOr={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","video/mp4":"mp4","video/webm":"webm","video/quicktime":"mov"};function XPo(e){let t=e.split(".").pop()?.toLowerCase();return Object.entries(SOr).find(([,n])=>n===t)?.[0]??"application/octet-stream"}function TOr(e){return e.map(t=>({...t,contentType:XPo(t.path),seeded:!0}))}function wOr(e,t,r){if(!e)return TOr(r);let n=bOr(e);if(Ls($Ee(e))[0]===t)return n;let o=[...TOr(r),...n.filter(i=>!i.seeded)];return kD(e,o),Zl($Ee(e),[t]),o}function COr(e,t){let r=new URLSearchParams({path:e});return t&&r.set("node",t),DS(`/api/pr-preview/image?${r}`)}function kOr(e,t,r){let[n,o]=(0,_D.useState)([]),i=(0,_D.useRef)(0),a=br(),s=(0,_D.useRef)(r);return s.current=r,(0,_D.useEffect)(()=>{o(wOr(e,t,s.current).map(l=>({...l,url:COr(l.path,a),id:i.current++})))},[e,t,a]),{screenshots:n,setScreenshots:o,nextId:i}}var _Or=S(ie(),1);function EOr(e,t){return(0,_Or.useCallback)((r,n)=>{t(o=>{let i=o.map(a=>a.id===r?{...a,...n}:a);return kD(e,i),i})},[e,t])}function ROr(e,t,r){let{screenshots:n,setScreenshots:o,nextId:i}=kOr(e,t,r),a=(0,FEe.useCallback)(d=>{o(f=>{let p=[...f,{...d,id:i.current++}];return kD(e,p),p})},[e,o,i]),s=(0,FEe.useCallback)(d=>{o(f=>{let p=f.find(m=>m.id===d);p?.url.startsWith("blob:")&&URL.revokeObjectURL(p.url);let h=f.filter(m=>m.id!==d);return kD(e,h),h})},[e,o]),l=EOr(e,o),u=(0,FEe.useCallback)(()=>xOr(e),[e]);return{screenshots:n,add:a,remove:s,update:l,clearPersisted:u}}var vG=S(ie(),1);async function POr(e,t,r){let n=new URLSearchParams;t&&n.set("cwd",t),r&&n.set("node",r),e instanceof File&&e.name&&n.set("name",e.name);let o=await er(`/api/pr-preview/upload-image?${n}`,{method:"POST",headers:{"Content-Type":e.type||"application/octet-stream"},body:e,timeoutMs:12e4}),i=await o.json().catch(()=>null);if(!o.ok||!i?.path)throw new Error(i?.error??"Failed to attach file");return{path:i.path,alt:i.alt??"screenshot"}}var DOr=S(ie(),1);function AOr(e){return e.startsWith("image/")||e.startsWith("video/")}function LOr(e){if(!e)return null;for(let t of e.items)if(t.kind==="file"&&AOr(t.type)){let r=t.getAsFile();if(r)return r}return null}function IOr(e){return e?Array.from(e.files).find(t=>AOr(t.type))??null:null}function MOr(e,t){return(0,DOr.useEffect)(()=>{if(!t)return;let o=i=>{let a=LOr(i.clipboardData);a&&(i.preventDefault(),e(a))};return globalThis.addEventListener("paste",o),()=>globalThis.removeEventListener("paste",o)},[e,t]),t?{onDrop:o=>{let i=IOr(o.dataTransfer);i&&(o.preventDefault(),e(i))},onDragOver:o=>{Array.from(o.dataTransfer.items).some(i=>i.kind==="file")&&o.preventDefault()}}:{onDrop:void 0,onDragOver:void 0}}function NOr(e,t,r){let[n,o]=(0,vG.useState)([]),i=(0,vG.useRef)(0),a=br(),s=(0,vG.useCallback)(async d=>{let f=i.current++;o(p=>[...p.filter(h=>!h.error),{id:f}]);try{let p=await POr(d,e,a);t({...p,url:URL.createObjectURL(d),contentType:d.type}),o(h=>h.filter(m=>m.id!==f))}catch(p){let h=p instanceof Error?p.message:"Failed to attach file";o(m=>m.map(g=>g.id===f?{id:f,error:h}:g))}},[e,a,t]),{onDrop:l,onDragOver:u}=MOr(s,r);return{uploads:n,onDrop:l,onDragOver:u}}function OOr({cwd:e,screenshots:t,screenshotScope:r,requestId:n,seededScreenshots:o}){let{screenshots:i,add:a,remove:s,update:l,clearPersisted:u}=ROr(t?r:void 0,n,t?o:[]),{uploads:d,onDrop:f,onDragOver:p}=NOr(e,a,t);return{screenshots:i,removeScreenshot:s,updateScreenshot:l,decision:{attachments:()=>i.map(({path:h,alt:m,group:g})=>g?{path:h,alt:m,group:g}:{path:h,alt:m}),clearPersisted:u},uploads:d,onDrop:f,onDragOver:p}}var GOr=S(ie(),1);var BOr="assist:pr-preview-chain:",Vlt=e=>`${BOr}${e}`;function $Or(e){if(e)return Ls(Vlt(e))[0]}function FOr(e,t){e&&Zl(Vlt(e),[t])}function zOr(e){e&&fx(Vlt(e))}function HOr(){px(BOr)}function UOr(e,t,r){if(!e)return{reviewAfter:!1,announceAfter:!1,draft:!1,autoMerge:!1};HOr();let n=$Or(t);return{reviewAfter:n?.reviewAfter??r.reviewAfter,announceAfter:n?.announceAfter??!0,draft:n?.draft??r.draft,autoMerge:n?.autoMerge??!1}}function VOr(e,t,r,n,o){return{comments:t,screenshots:n,reviewAfter:e&&r.reviewAfter,announceAfter:e&&r.announceAfter,draft:r.draft,autoMerge:e&&r.autoMerge,...o===void 0?{}:{body:o}}}function WOr(e,t){return!e||t===!1?{}:t===!0?{autostart:!0}:{autostart:!0,startOn:t}}function qOr(e,t,r,n,o,i,a){let[s,l]=(0,GOr.useState)(()=>UOr(n,t,o));return{chain:s,setChain:f=>{l(f),FOr(t,f)},onDecide:(f,p,h=!1)=>{let m=f==="approve";r(f,{...VOr(m,p,s,m?i.attachments():[],a()),...WOr(m,h)}),BEe(e),m&&(zOr(t),i.clearPersisted())}}}var rBr=S(ie(),1);var ZPo=/^ {0,3}#{1,6}[ \t]+acceptance criteria[ \t]*$/i,QPo=/^ {0,3}#{1,6}[ \t]/;function hR(e){let t=e.split(`
|
|
4004
4004
|
`),r=t.findIndex(a=>ZPo.test(a));if(r===-1)return null;let n=r+1;for(;n<t.length&&!QPo.test(t[n]);)n+=1;let o=r+1;for(;o<n&&t[o].trim()==="";)o+=1;let i=n;for(;i>o&&t[i-1].trim()==="";)i-=1;return o===n&&(o=r+1,i=r+1),{before:t.slice(0,o),lines:t.slice(o,i),after:t.slice(i)}}function zEe(e){let t=0;for(let r of e)t+=r===" "?4:1;return t}function HEe(e){let t=[];return e.map(r=>{for(;t.length>0&&r<t[t.length-1];)t.pop();return(t.length===0||r>t[t.length-1])&&t.push(r),t.length-1})}var JPo=" ";function eAo({text:e,depth:t}){let r=`${JPo.repeat(t)}1.`;return e===""?r:`${r} ${e}`}function UEe(e,t){let r=hR(e);return r?[...r.before,...t.map(eAo),...r.after].join(`
|
|
4005
4005
|
`):e}var tAo=/^([ \t]*)(?:[-*+]|\d+[.)])(?:[ \t]+(.*))?$/,rAo=/^\[[ xX]\][ \t]*/;function nAo(e){return e.slice(0,e.length-e.trimStart().length)}function jOr(e){let t=hR(e);if(!t)return e;let r=t.lines.filter(o=>o.trim()!=="").map(o=>{let i=tAo.exec(o);return{width:zEe(i?i[1]:nAo(o)),text:(i?i[2]??"":o.trim()).replace(rAo,"")}}),n=HEe(r.map(o=>o.width));return UEe(e,uR(r.map((o,i)=>({text:o.text,depth:n[i]}))))}var YOr=`## Acceptance criteria
|
|
4006
4006
|
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.1090.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -712,7 +712,8 @@ var runConfigSchema = z3.strictObject({
|
|
|
712
712
|
cwd: z3.string().optional(),
|
|
713
713
|
quiet: z3.boolean().optional(),
|
|
714
714
|
server: z3.union([z3.boolean(), z3.string().min(1)]).optional(),
|
|
715
|
-
port: z3.number().optional()
|
|
715
|
+
port: z3.number().optional(),
|
|
716
|
+
protocol: z3.enum(["http", "https"]).optional()
|
|
716
717
|
});
|
|
717
718
|
var runLinkSchema = z3.strictObject({
|
|
718
719
|
link: z3.string(),
|
|
@@ -14788,7 +14789,7 @@ function isBusy(session) {
|
|
|
14788
14789
|
if (session.node !== void 0 || session.commandType === "run") return false;
|
|
14789
14790
|
if (session.status !== "running") return false;
|
|
14790
14791
|
const preview = session.pendingPrPreview;
|
|
14791
|
-
return preview === void 0 || preview.kind === "show";
|
|
14792
|
+
return preview === void 0 || preview.kind === "show" || preview.requestId === session.resumedOverPreview;
|
|
14792
14793
|
}
|
|
14793
14794
|
|
|
14794
14795
|
// src/commands/sessions/web/updates/autoRestart/autoRestartBlocker.ts
|
|
@@ -15235,6 +15236,7 @@ function buildRunEntry(name, command, args, options2) {
|
|
|
15235
15236
|
if (options2?.cwd) entry.cwd = options2.cwd;
|
|
15236
15237
|
if (options2?.server !== void 0) entry.server = options2.server;
|
|
15237
15238
|
if (options2?.port !== void 0) entry.port = options2.port;
|
|
15239
|
+
if (options2?.protocol) entry.protocol = options2.protocol;
|
|
15238
15240
|
if (options2?.env) entry.env = options2.env;
|
|
15239
15241
|
if (options2?.pre) entry.pre = options2.pre;
|
|
15240
15242
|
if (options2?.filter) entry.filter = options2.filter;
|
|
@@ -50359,12 +50361,17 @@ function parseParamSpecs(specs) {
|
|
|
50359
50361
|
return specs.map(parseParamSpec);
|
|
50360
50362
|
}
|
|
50361
50363
|
|
|
50362
|
-
// src/commands/run/
|
|
50363
|
-
function
|
|
50364
|
-
|
|
50365
|
-
if (
|
|
50366
|
-
|
|
50364
|
+
// src/commands/run/parseProtocol.ts
|
|
50365
|
+
function parseProtocol(raw) {
|
|
50366
|
+
if (raw === void 0) return void 0;
|
|
50367
|
+
if (raw !== "http" && raw !== "https") {
|
|
50368
|
+
console.error(`--protocol must be http or https, got "${raw}"`);
|
|
50369
|
+
process.exit(1);
|
|
50370
|
+
}
|
|
50371
|
+
return raw;
|
|
50367
50372
|
}
|
|
50373
|
+
|
|
50374
|
+
// src/commands/run/parsePort.ts
|
|
50368
50375
|
function parsePort(raw) {
|
|
50369
50376
|
if (raw === void 0) return void 0;
|
|
50370
50377
|
const port = Number(raw);
|
|
@@ -50374,6 +50381,13 @@ function parsePort(raw) {
|
|
|
50374
50381
|
}
|
|
50375
50382
|
return port;
|
|
50376
50383
|
}
|
|
50384
|
+
|
|
50385
|
+
// src/commands/run/requireParsedArgs.ts
|
|
50386
|
+
function findAddIndex() {
|
|
50387
|
+
const addIndex = process.argv.indexOf("add");
|
|
50388
|
+
if (addIndex === -1 || addIndex + 2 >= process.argv.length) return -1;
|
|
50389
|
+
return addIndex;
|
|
50390
|
+
}
|
|
50377
50391
|
function extractAddArgs(addIndex) {
|
|
50378
50392
|
const rawArgs = process.argv.slice(addIndex + 3);
|
|
50379
50393
|
const env = extractRepeatedOption(rawArgs, "--env");
|
|
@@ -50383,7 +50397,8 @@ function extractAddArgs(addIndex) {
|
|
|
50383
50397
|
const filter = extractOption(quiet.remaining, "--filter");
|
|
50384
50398
|
const cwd = extractOption(filter.remaining, "--cwd");
|
|
50385
50399
|
const port = extractOption(cwd.remaining, "--port");
|
|
50386
|
-
const
|
|
50400
|
+
const protocol = extractOption(port.remaining, "--protocol");
|
|
50401
|
+
const server = extractOptionalValueFlag(protocol.remaining, "--server");
|
|
50387
50402
|
const repo = extractOptionalValueFlag(server.remaining, "--repo");
|
|
50388
50403
|
return {
|
|
50389
50404
|
name: process.argv[addIndex + 1],
|
|
@@ -50393,6 +50408,7 @@ function extractAddArgs(addIndex) {
|
|
|
50393
50408
|
cwd: cwd.value,
|
|
50394
50409
|
server: server.value,
|
|
50395
50410
|
port: parsePort(port.value),
|
|
50411
|
+
protocol: parseProtocol(protocol.value),
|
|
50396
50412
|
env: parseEnvPairs(env.values),
|
|
50397
50413
|
pre: pre.values.length > 0 ? pre.values : void 0,
|
|
50398
50414
|
filter: filter.value,
|
|
@@ -50477,6 +50493,11 @@ var properties = [
|
|
|
50477
50493
|
],
|
|
50478
50494
|
["server", "--server [group]", "singleton dev server, optionally grouped"],
|
|
50479
50495
|
["port", "--port <port>", "display-only port on the serving card"],
|
|
50496
|
+
[
|
|
50497
|
+
"protocol",
|
|
50498
|
+
"--protocol <http|https>",
|
|
50499
|
+
"protocol of the serving card's port link (default: http)"
|
|
50500
|
+
],
|
|
50480
50501
|
[
|
|
50481
50502
|
"pre",
|
|
50482
50503
|
"--pre <command>",
|
|
@@ -50529,6 +50550,9 @@ function registerRunAdd(runCommand) {
|
|
|
50529
50550
|
"--server [group]",
|
|
50530
50551
|
"Mark as a singleton dev server, optionally in a named group (default group: default)"
|
|
50531
50552
|
).option("--port <port>", "Display-only port shown on the serving card").option(
|
|
50553
|
+
"--protocol <http|https>",
|
|
50554
|
+
"Protocol for the serving card's port link (default: http)"
|
|
50555
|
+
).option(
|
|
50532
50556
|
"--env <KEY=VALUE>",
|
|
50533
50557
|
"Environment variable for the command (repeatable)"
|
|
50534
50558
|
).option("--pre <command>", "Shell command run first (repeatable)").option(
|
|
@@ -51256,6 +51280,7 @@ function toSessionRunInfo({
|
|
|
51256
51280
|
runArgs,
|
|
51257
51281
|
server,
|
|
51258
51282
|
serverPort,
|
|
51283
|
+
serverProtocol,
|
|
51259
51284
|
serverOrigin,
|
|
51260
51285
|
assistArgs,
|
|
51261
51286
|
cwd,
|
|
@@ -51274,6 +51299,7 @@ function toSessionRunInfo({
|
|
|
51274
51299
|
runArgs,
|
|
51275
51300
|
server,
|
|
51276
51301
|
port: serverPort,
|
|
51302
|
+
protocol: serverProtocol,
|
|
51277
51303
|
remoteOrigin: serverOrigin ?? originForCwd(cwd),
|
|
51278
51304
|
assistArgs,
|
|
51279
51305
|
activity: activity2,
|
|
@@ -51338,6 +51364,7 @@ function toSessionInfo(session) {
|
|
|
51338
51364
|
seeding,
|
|
51339
51365
|
pendingPrPreview,
|
|
51340
51366
|
pendingShow,
|
|
51367
|
+
resumedOverPreview,
|
|
51341
51368
|
undurable
|
|
51342
51369
|
} = session;
|
|
51343
51370
|
return {
|
|
@@ -51364,6 +51391,7 @@ function toSessionInfo(session) {
|
|
|
51364
51391
|
seeding,
|
|
51365
51392
|
pendingPrPreview,
|
|
51366
51393
|
pendingShow,
|
|
51394
|
+
resumedOverPreview,
|
|
51367
51395
|
undurable,
|
|
51368
51396
|
promptIssue: promptIssueRef(session.initialPrompt),
|
|
51369
51397
|
promptPr: promptPrNumber(session.initialPrompt),
|
|
@@ -52256,6 +52284,7 @@ function serverRunMeta(runName, cwd) {
|
|
|
52256
52284
|
server: true,
|
|
52257
52285
|
group: typeof config.server === "string" ? config.server : DEFAULT_SERVER_GROUP,
|
|
52258
52286
|
port: config.port,
|
|
52287
|
+
protocol: config.protocol,
|
|
52259
52288
|
origin: getCurrentOrigin(dir)
|
|
52260
52289
|
};
|
|
52261
52290
|
}
|
|
@@ -52333,6 +52362,7 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
52333
52362
|
cwd,
|
|
52334
52363
|
server: serverMeta.server || void 0,
|
|
52335
52364
|
serverPort: serverMeta.port,
|
|
52365
|
+
serverProtocol: serverMeta.protocol,
|
|
52336
52366
|
serverOrigin: serverMeta.origin,
|
|
52337
52367
|
serverGroup: serverMeta.group
|
|
52338
52368
|
};
|
|
@@ -55510,6 +55540,17 @@ function makeManagerStatusHandler(sessions, host) {
|
|
|
55510
55540
|
});
|
|
55511
55541
|
}
|
|
55512
55542
|
|
|
55543
|
+
// src/commands/sessions/daemon/markResumedOverPreview.ts
|
|
55544
|
+
function markResumedOverPreview(session) {
|
|
55545
|
+
const preview = session.pendingPrPreview;
|
|
55546
|
+
if (!preview || preview.kind === "show") return;
|
|
55547
|
+
if (session.resumedOverPreview === preview.requestId) return;
|
|
55548
|
+
session.resumedOverPreview = preview.requestId;
|
|
55549
|
+
daemonLog(
|
|
55550
|
+
`pr-preview resumed over: id=${session.id} requestId=${preview.requestId} kind=${preview.kind ?? "pr"}`
|
|
55551
|
+
);
|
|
55552
|
+
}
|
|
55553
|
+
|
|
55513
55554
|
// src/commands/sessions/daemon/applySetStatus.ts
|
|
55514
55555
|
function opensPrompt(status2, source) {
|
|
55515
55556
|
const askUserQuestion = source === "pretool" && status2 === "waiting";
|
|
@@ -55534,6 +55575,7 @@ function applySetStatus(sessions, id, status2, source, onStatusChange, rebind) {
|
|
|
55534
55575
|
if (opensPrompt(status2, source)) session.permissionActive = true;
|
|
55535
55576
|
if (status2 === "running" || source === "stop")
|
|
55536
55577
|
session.permissionActive = false;
|
|
55578
|
+
if (status2 === "running") markResumedOverPreview(session);
|
|
55537
55579
|
onStatusChange(session, status2);
|
|
55538
55580
|
}
|
|
55539
55581
|
|
|
@@ -56479,6 +56521,7 @@ function restoreServerRun(id, persisted, base) {
|
|
|
56479
56521
|
runArgs: persisted.runArgs,
|
|
56480
56522
|
server: true,
|
|
56481
56523
|
serverPort: meta.port,
|
|
56524
|
+
serverProtocol: meta.protocol,
|
|
56482
56525
|
serverOrigin: meta.origin,
|
|
56483
56526
|
serverGroup: meta.group
|
|
56484
56527
|
};
|
|
@@ -56998,6 +57041,7 @@ function stopServerSession(sessions, id) {
|
|
|
56998
57041
|
function tagServerSession(session, meta) {
|
|
56999
57042
|
session.server = meta.server || void 0;
|
|
57000
57043
|
session.serverPort = meta.port;
|
|
57044
|
+
session.serverProtocol = meta.protocol;
|
|
57001
57045
|
session.serverOrigin = meta.origin;
|
|
57002
57046
|
session.serverGroup = meta.group;
|
|
57003
57047
|
}
|