@software-dlc/cli 0.204.1 → 0.204.4
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/CHANGELOG.md +21 -0
- package/dist/cli-rebuild.d.ts +2 -1
- package/dist/cli-rebuild.d.ts.map +1 -1
- package/dist/cli-rebuild.js.map +1 -1
- package/dist/cli.js +42 -18
- package/dist/cli.js.map +1 -1
- package/dist/local/environment-switch.d.ts.map +1 -1
- package/dist/local/environment-switch.js +3 -0
- package/dist/local/environment-switch.js.map +1 -1
- package/dist/local/operation.d.ts +5 -0
- package/dist/local/operation.d.ts.map +1 -1
- package/dist/local/operation.js +12 -0
- package/dist/local/operation.js.map +1 -1
- package/dist/local/rebuild.d.ts +2 -1
- package/dist/local/rebuild.d.ts.map +1 -1
- package/dist/local/rebuild.js +5 -1
- package/dist/local/rebuild.js.map +1 -1
- package/dist/local/store.d.ts +9 -0
- package/dist/local/store.d.ts.map +1 -1
- package/dist/local/store.js +16 -0
- package/dist/local/store.js.map +1 -1
- package/dist/local/sync.d.ts +9 -1
- package/dist/local/sync.d.ts.map +1 -1
- package/dist/local/sync.js +55 -4
- package/dist/local/sync.js.map +1 -1
- package/dist/local/tree-save.d.ts +15 -0
- package/dist/local/tree-save.d.ts.map +1 -1
- package/dist/local/tree-save.js +36 -1
- package/dist/local/tree-save.js.map +1 -1
- package/dist/local/worktree-projection.d.ts +48 -1
- package/dist/local/worktree-projection.d.ts.map +1 -1
- package/dist/local/worktree-projection.js +182 -33
- package/dist/local/worktree-projection.js.map +1 -1
- package/dist/mcp/worktree.d.ts.map +1 -1
- package/dist/mcp/worktree.js +24 -10
- package/dist/mcp/worktree.js.map +1 -1
- package/package.json +2 -2
- package/viewer/assets/index-kuv6lIJF.js +433 -0
- package/viewer/index.html +1 -1
- package/viewer/assets/index-D258gyOC.js +0 -433
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
function qA(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in e)){const r=Object.getOwnPropertyDescriptor(s,a);r&&Object.defineProperty(e,a,r.get?r:{enumerable:!0,get:()=>s[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function Pj(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ij={exports:{}},Vh={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var YA=Symbol.for("react.transitional.element"),XA=Symbol.for("react.fragment");function Gj(e,t,n){var s=null;if(n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),"key"in t){n={};for(var a in t)a!=="key"&&(n[a]=t[a])}else n=t;return t=n.ref,{$$typeof:YA,type:e,key:s,ref:t!==void 0?t:null,props:n}}Vh.Fragment=XA;Vh.jsx=Gj;Vh.jsxs=Gj;Ij.exports=Vh;var i=Ij.exports,Hj={exports:{}},qe={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var bx=Symbol.for("react.transitional.element"),KA=Symbol.for("react.portal"),ZA=Symbol.for("react.fragment"),QA=Symbol.for("react.strict_mode"),JA=Symbol.for("react.profiler"),eR=Symbol.for("react.consumer"),tR=Symbol.for("react.context"),nR=Symbol.for("react.forward_ref"),sR=Symbol.for("react.suspense"),iR=Symbol.for("react.memo"),Vj=Symbol.for("react.lazy"),Yb=Symbol.iterator;function aR(e){return e===null||typeof e!="object"?null:(e=Yb&&e[Yb]||e["@@iterator"],typeof e=="function"?e:null)}var Uj={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Bj=Object.assign,Wj={};function Xo(e,t,n){this.props=e,this.context=t,this.refs=Wj,this.updater=n||Uj}Xo.prototype.isReactComponent={};Xo.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Xo.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Fj(){}Fj.prototype=Xo.prototype;function yx(e,t,n){this.props=e,this.context=t,this.refs=Wj,this.updater=n||Uj}var wx=yx.prototype=new Fj;wx.constructor=yx;Bj(wx,Xo.prototype);wx.isPureReactComponent=!0;var Xb=Array.isArray,Lt={H:null,A:null,T:null,S:null,V:null},qj=Object.prototype.hasOwnProperty;function _x(e,t,n,s,a,r){return n=r.ref,{$$typeof:bx,type:e,key:t,ref:n!==void 0?n:null,props:r}}function rR(e,t){return _x(e.type,t,void 0,void 0,void 0,e.props)}function jx(e){return typeof e=="object"&&e!==null&&e.$$typeof===bx}function oR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Kb=/\/+/g;function gm(e,t){return typeof e=="object"&&e!==null&&e.key!=null?oR(""+e.key):t.toString(36)}function Zb(){}function lR(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Zb,Zb):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function eo(e,t,n,s,a){var r=typeof e;(r==="undefined"||r==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(r){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case bx:case KA:o=!0;break;case Vj:return o=e._init,eo(o(e._payload),t,n,s,a)}}if(o)return a=a(e),o=s===""?"."+gm(e,0):s,Xb(a)?(n="",o!=null&&(n=o.replace(Kb,"$&/")+"/"),eo(a,t,n,"",function(d){return d})):a!=null&&(jx(a)&&(a=rR(a,n+(a.key==null||e&&e.key===a.key?"":(""+a.key).replace(Kb,"$&/")+"/")+o)),t.push(a)),1;o=0;var l=s===""?".":s+":";if(Xb(e))for(var c=0;c<e.length;c++)s=e[c],r=l+gm(s,c),o+=eo(s,t,n,r,a);else if(c=aR(e),typeof c=="function")for(e=c.call(e),c=0;!(s=e.next()).done;)s=s.value,r=l+gm(s,c++),o+=eo(s,t,n,r,a);else if(r==="object"){if(typeof e.then=="function")return eo(lR(e),t,n,s,a);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return o}function Rd(e,t,n){if(e==null)return e;var s=[],a=0;return eo(e,s,"","",function(r){return t.call(n,r,a++)}),s}function cR(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Qb=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function dR(){}qe.Children={map:Rd,forEach:function(e,t,n){Rd(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Rd(e,function(){t++}),t},toArray:function(e){return Rd(e,function(t){return t})||[]},only:function(e){if(!jx(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};qe.Component=Xo;qe.Fragment=ZA;qe.Profiler=JA;qe.PureComponent=yx;qe.StrictMode=QA;qe.Suspense=sR;qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Lt;qe.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Lt.H.useMemoCache(e)}};qe.cache=function(e){return function(){return e.apply(null,arguments)}};qe.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var s=Bj({},e.props),a=e.key,r=void 0;if(t!=null)for(o in t.ref!==void 0&&(r=void 0),t.key!==void 0&&(a=""+t.key),t)!qj.call(t,o)||o==="key"||o==="__self"||o==="__source"||o==="ref"&&t.ref===void 0||(s[o]=t[o]);var o=arguments.length-2;if(o===1)s.children=n;else if(1<o){for(var l=Array(o),c=0;c<o;c++)l[c]=arguments[c+2];s.children=l}return _x(e.type,a,void 0,void 0,r,s)};qe.createContext=function(e){return e={$$typeof:tR,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:eR,_context:e},e};qe.createElement=function(e,t,n){var s,a={},r=null;if(t!=null)for(s in t.key!==void 0&&(r=""+t.key),t)qj.call(t,s)&&s!=="key"&&s!=="__self"&&s!=="__source"&&(a[s]=t[s]);var o=arguments.length-2;if(o===1)a.children=n;else if(1<o){for(var l=Array(o),c=0;c<o;c++)l[c]=arguments[c+2];a.children=l}if(e&&e.defaultProps)for(s in o=e.defaultProps,o)a[s]===void 0&&(a[s]=o[s]);return _x(e,r,void 0,void 0,null,a)};qe.createRef=function(){return{current:null}};qe.forwardRef=function(e){return{$$typeof:nR,render:e}};qe.isValidElement=jx;qe.lazy=function(e){return{$$typeof:Vj,_payload:{_status:-1,_result:e},_init:cR}};qe.memo=function(e,t){return{$$typeof:iR,type:e,compare:t===void 0?null:t}};qe.startTransition=function(e){var t=Lt.T,n={};Lt.T=n;try{var s=e(),a=Lt.S;a!==null&&a(n,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(dR,Qb)}catch(r){Qb(r)}finally{Lt.T=t}};qe.unstable_useCacheRefresh=function(){return Lt.H.useCacheRefresh()};qe.use=function(e){return Lt.H.use(e)};qe.useActionState=function(e,t,n){return Lt.H.useActionState(e,t,n)};qe.useCallback=function(e,t){return Lt.H.useCallback(e,t)};qe.useContext=function(e){return Lt.H.useContext(e)};qe.useDebugValue=function(){};qe.useDeferredValue=function(e,t){return Lt.H.useDeferredValue(e,t)};qe.useEffect=function(e,t,n){var s=Lt.H;if(typeof n=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return s.useEffect(e,t)};qe.useId=function(){return Lt.H.useId()};qe.useImperativeHandle=function(e,t,n){return Lt.H.useImperativeHandle(e,t,n)};qe.useInsertionEffect=function(e,t){return Lt.H.useInsertionEffect(e,t)};qe.useLayoutEffect=function(e,t){return Lt.H.useLayoutEffect(e,t)};qe.useMemo=function(e,t){return Lt.H.useMemo(e,t)};qe.useOptimistic=function(e,t){return Lt.H.useOptimistic(e,t)};qe.useReducer=function(e,t,n){return Lt.H.useReducer(e,t,n)};qe.useRef=function(e){return Lt.H.useRef(e)};qe.useState=function(e){return Lt.H.useState(e)};qe.useSyncExternalStore=function(e,t,n){return Lt.H.useSyncExternalStore(e,t,n)};qe.useTransition=function(){return Lt.H.useTransition()};qe.version="19.1.0";Hj.exports=qe;var u=Hj.exports;const Te=Pj(u),Yj=qA({__proto__:null,default:Te},[u]);var Xj={exports:{}},Uh={},Kj={exports:{}},Zj={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t(C,R){var E=C.length;C.push(R);e:for(;0<E;){var M=E-1>>>1,H=C[M];if(0<a(H,R))C[M]=R,C[E]=H,E=M;else break e}}function n(C){return C.length===0?null:C[0]}function s(C){if(C.length===0)return null;var R=C[0],E=C.pop();if(E!==R){C[0]=E;e:for(var M=0,H=C.length,z=H>>>1;M<z;){var K=2*(M+1)-1,oe=C[K],re=K+1,ve=C[re];if(0>a(oe,E))re<H&&0>a(ve,oe)?(C[M]=ve,C[re]=E,M=re):(C[M]=oe,C[K]=E,M=K);else if(re<H&&0>a(ve,E))C[M]=ve,C[re]=E,M=re;else break e}}return R}function a(C,R){var E=C.sortIndex-R.sortIndex;return E!==0?E:C.id-R.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;e.unstable_now=function(){return r.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],d=[],h=1,f=null,m=3,p=!1,y=!1,g=!1,b=!1,v=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function _(C){for(var R=n(d);R!==null;){if(R.callback===null)s(d);else if(R.startTime<=C)s(d),R.sortIndex=R.expirationTime,t(c,R);else break;R=n(d)}}function S(C){if(g=!1,_(C),!y)if(n(c)!==null)y=!0,k||(k=!0,L());else{var R=n(d);R!==null&&D(S,R.startTime-C)}}var k=!1,j=-1,N=5,O=-1;function T(){return b?!0:!(e.unstable_now()-O<N)}function P(){if(b=!1,k){var C=e.unstable_now();O=C;var R=!0;try{e:{y=!1,g&&(g=!1,x(j),j=-1),p=!0;var E=m;try{t:{for(_(C),f=n(c);f!==null&&!(f.expirationTime>C&&T());){var M=f.callback;if(typeof M=="function"){f.callback=null,m=f.priorityLevel;var H=M(f.expirationTime<=C);if(C=e.unstable_now(),typeof H=="function"){f.callback=H,_(C),R=!0;break t}f===n(c)&&s(c),_(C)}else s(c);f=n(c)}if(f!==null)R=!0;else{var z=n(d);z!==null&&D(S,z.startTime-C),R=!1}}break e}finally{f=null,m=E,p=!1}R=void 0}}finally{R?L():k=!1}}}var L;if(typeof w=="function")L=function(){w(P)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,A=G.port2;G.port1.onmessage=P,L=function(){A.postMessage(null)}}else L=function(){v(P,0)};function D(C,R){j=v(function(){C(e.unstable_now())},R)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(C){C.callback=null},e.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<C?Math.floor(1e3/C):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(C){switch(m){case 1:case 2:case 3:var R=3;break;default:R=m}var E=m;m=R;try{return C()}finally{m=E}},e.unstable_requestPaint=function(){b=!0},e.unstable_runWithPriority=function(C,R){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var E=m;m=C;try{return R()}finally{m=E}},e.unstable_scheduleCallback=function(C,R,E){var M=e.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0<E?M+E:M):E=M,C){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=E+H,C={id:h++,callback:R,priorityLevel:C,startTime:E,expirationTime:H,sortIndex:-1},E>M?(C.sortIndex=E,t(d,C),n(c)===null&&C===n(d)&&(g?(x(j),j=-1):g=!0,D(S,E-M))):(C.sortIndex=H,t(c,C),y||p||(y=!0,k||(k=!0,L()))),C},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(C){var R=m;return function(){var E=m;m=R;try{return C.apply(this,arguments)}finally{m=E}}}})(Zj);Kj.exports=Zj;var uR=Kj.exports,Qj={exports:{}},Un={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var hR=u;function Jj(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Qi(){}var Hn={d:{f:Qi,r:function(){throw Error(Jj(522))},D:Qi,C:Qi,L:Qi,m:Qi,X:Qi,S:Qi,M:Qi},p:0,findDOMNode:null},fR=Symbol.for("react.portal");function mR(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:fR,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}var ql=hR.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Bh(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Un.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Hn;Un.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(Jj(299));return mR(e,t,null,n)};Un.flushSync=function(e){var t=ql.T,n=Hn.p;try{if(ql.T=null,Hn.p=2,e)return e()}finally{ql.T=t,Hn.p=n,Hn.d.f()}};Un.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Hn.d.C(e,t))};Un.prefetchDNS=function(e){typeof e=="string"&&Hn.d.D(e)};Un.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,s=Bh(n,t.crossOrigin),a=typeof t.integrity=="string"?t.integrity:void 0,r=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Hn.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:s,integrity:a,fetchPriority:r}):n==="script"&&Hn.d.X(e,{crossOrigin:s,integrity:a,fetchPriority:r,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Un.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Bh(t.as,t.crossOrigin);Hn.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&Hn.d.M(e)};Un.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,s=Bh(n,t.crossOrigin);Hn.d.L(e,n,{crossOrigin:s,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};Un.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Bh(t.as,t.crossOrigin);Hn.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else Hn.d.m(e)};Un.requestFormReset=function(e){Hn.d.r(e)};Un.unstable_batchedUpdates=function(e,t){return e(t)};Un.useFormState=function(e,t,n){return ql.H.useFormState(e,t,n)};Un.useFormStatus=function(){return ql.H.useHostTransitionStatus()};Un.version="19.1.0";function e0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e0)}catch(e){console.error(e)}}e0(),Qj.exports=Un;var Ko=Qj.exports;const t0=Pj(Ko);/**
|
|
34
|
+
* @license React
|
|
35
|
+
* react-dom-client.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var on=uR,n0=u,pR=Ko;function le(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s0(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Kc(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function i0(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Jb(e){if(Kc(e)!==e)throw Error(le(188))}function gR(e){var t=e.alternate;if(!t){if(t=Kc(e),t===null)throw Error(le(188));return t!==e?null:e}for(var n=e,s=t;;){var a=n.return;if(a===null)break;var r=a.alternate;if(r===null){if(s=a.return,s!==null){n=s;continue}break}if(a.child===r.child){for(r=a.child;r;){if(r===n)return Jb(a),e;if(r===s)return Jb(a),t;r=r.sibling}throw Error(le(188))}if(n.return!==s.return)n=a,s=r;else{for(var o=!1,l=a.child;l;){if(l===n){o=!0,n=a,s=r;break}if(l===s){o=!0,s=a,n=r;break}l=l.sibling}if(!o){for(l=r.child;l;){if(l===n){o=!0,n=r,s=a;break}if(l===s){o=!0,s=r,n=a;break}l=l.sibling}if(!o)throw Error(le(189))}}if(n.alternate!==s)throw Error(le(190))}if(n.tag!==3)throw Error(le(188));return n.stateNode.current===n?e:t}function a0(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=a0(e),t!==null)return t;e=e.sibling}return null}var Ot=Object.assign,xR=Symbol.for("react.element"),Td=Symbol.for("react.transitional.element"),Ll=Symbol.for("react.portal"),ro=Symbol.for("react.fragment"),r0=Symbol.for("react.strict_mode"),Ap=Symbol.for("react.profiler"),vR=Symbol.for("react.provider"),o0=Symbol.for("react.consumer"),Oi=Symbol.for("react.context"),Nx=Symbol.for("react.forward_ref"),Rp=Symbol.for("react.suspense"),Tp=Symbol.for("react.suspense_list"),kx=Symbol.for("react.memo"),ra=Symbol.for("react.lazy"),Op=Symbol.for("react.activity"),bR=Symbol.for("react.memo_cache_sentinel"),ey=Symbol.iterator;function _l(e){return e===null||typeof e!="object"?null:(e=ey&&e[ey]||e["@@iterator"],typeof e=="function"?e:null)}var yR=Symbol.for("react.client.reference");function zp(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===yR?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ro:return"Fragment";case Ap:return"Profiler";case r0:return"StrictMode";case Rp:return"Suspense";case Tp:return"SuspenseList";case Op:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Ll:return"Portal";case Oi:return(e.displayName||"Context")+".Provider";case o0:return(e._context.displayName||"Context")+".Consumer";case Nx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case kx:return t=e.displayName||null,t!==null?t:zp(e.type)||"Memo";case ra:t=e._payload,e=e._init;try{return zp(e(t))}catch{}}return null}var Pl=Array.isArray,Ue=n0.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,dt=pR.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,or={pending:!1,data:null,method:null,action:null},Mp=[],oo=-1;function bi(e){return{current:e}}function mn(e){0>oo||(e.current=Mp[oo],Mp[oo]=null,oo--)}function Pt(e,t){oo++,Mp[oo]=e.current,e.current=t}var ci=bi(null),xc=bi(null),_a=bi(null),Uu=bi(null);function Bu(e,t){switch(Pt(_a,t),Pt(xc,e),Pt(ci,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?aw(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=aw(t),e=Nk(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}mn(ci),Pt(ci,e)}function Mo(){mn(ci),mn(xc),mn(_a)}function $p(e){e.memoizedState!==null&&Pt(Uu,e);var t=ci.current,n=Nk(t,e.type);t!==n&&(Pt(xc,e),Pt(ci,n))}function Wu(e){xc.current===e&&(mn(ci),mn(xc)),Uu.current===e&&(mn(Uu),Cc._currentValue=or)}var Lp=Object.prototype.hasOwnProperty,Sx=on.unstable_scheduleCallback,xm=on.unstable_cancelCallback,wR=on.unstable_shouldYield,_R=on.unstable_requestPaint,di=on.unstable_now,jR=on.unstable_getCurrentPriorityLevel,l0=on.unstable_ImmediatePriority,c0=on.unstable_UserBlockingPriority,Fu=on.unstable_NormalPriority,NR=on.unstable_LowPriority,d0=on.unstable_IdlePriority,kR=on.log,SR=on.unstable_setDisableYieldValue,Zc=null,ms=null;function fa(e){if(typeof kR=="function"&&SR(e),ms&&typeof ms.setStrictMode=="function")try{ms.setStrictMode(Zc,e)}catch{}}var ps=Math.clz32?Math.clz32:ER,CR=Math.log,DR=Math.LN2;function ER(e){return e>>>=0,e===0?32:31-(CR(e)/DR|0)|0}var Od=256,zd=4194304;function nr(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Wh(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var a=0,r=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=s&134217727;return l!==0?(s=l&~r,s!==0?a=nr(s):(o&=l,o!==0?a=nr(o):n||(n=l&~e,n!==0&&(a=nr(n))))):(l=s&~r,l!==0?a=nr(l):o!==0?a=nr(o):n||(n=s&~e,n!==0&&(a=nr(n)))),a===0?0:t!==0&&t!==a&&!(t&r)&&(r=a&-a,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:a}function Qc(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function AR(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function u0(){var e=Od;return Od<<=1,!(Od&4194048)&&(Od=256),e}function h0(){var e=zd;return zd<<=1,!(zd&62914560)&&(zd=4194304),e}function vm(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Jc(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function RR(e,t,n,s,a,r){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var l=e.entanglements,c=e.expirationTimes,d=e.hiddenUpdates;for(n=o&~n;0<n;){var h=31-ps(n),f=1<<h;l[h]=0,c[h]=-1;var m=d[h];if(m!==null)for(d[h]=null,h=0;h<m.length;h++){var p=m[h];p!==null&&(p.lane&=-536870913)}n&=~f}s!==0&&f0(e,s,0),r!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=r&~(o&~t))}function f0(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-ps(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&4194090}function m0(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-ps(n),a=1<<s;a&t|e[s]&t&&(e[s]|=t),n&=~a}}function Cx(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Dx(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function p0(){var e=dt.p;return e!==0?e:(e=window.event,e===void 0?32:zk(e.type))}function TR(e,t){var n=dt.p;try{return dt.p=e,t()}finally{dt.p=n}}var Ha=Math.random().toString(36).slice(2),An="__reactFiber$"+Ha,ts="__reactProps$"+Ha,Zo="__reactContainer$"+Ha,Pp="__reactEvents$"+Ha,OR="__reactListeners$"+Ha,zR="__reactHandles$"+Ha,ty="__reactResources$"+Ha,ed="__reactMarker$"+Ha;function Ex(e){delete e[An],delete e[ts],delete e[Pp],delete e[OR],delete e[zR]}function lo(e){var t=e[An];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Zo]||n[An]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=lw(e);e!==null;){if(n=e[An])return n;e=lw(e)}return t}e=n,n=e.parentNode}return null}function Qo(e){if(e=e[An]||e[Zo]){var t=e.tag;if(t===5||t===6||t===13||t===26||t===27||t===3)return e}return null}function Il(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(le(33))}function _o(e){var t=e[ty];return t||(t=e[ty]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function hn(e){e[ed]=!0}var g0=new Set,x0={};function Er(e,t){$o(e,t),$o(e+"Capture",t)}function $o(e,t){for(x0[e]=t,e=0;e<t.length;e++)g0.add(t[e])}var MR=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),ny={},sy={};function $R(e){return Lp.call(sy,e)?!0:Lp.call(ny,e)?!1:MR.test(e)?sy[e]=!0:(ny[e]=!0,!1)}function vu(e,t,n){if($R(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Md(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Si(e,t,n,s){if(s===null)e.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+s)}}var bm,iy;function to(e){if(bm===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);bm=t&&t[1]||"",iy=-1<n.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+bm+e+iy}var ym=!1;function wm(e,t){if(!e||ym)return"";ym=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(p){var m=p}Reflect.construct(e,[],f)}else{try{f.call()}catch(p){m=p}e.call(f.prototype)}}else{try{throw Error()}catch(p){m=p}(f=e())&&typeof f.catch=="function"&&f.catch(function(){})}}catch(p){if(p&&m&&typeof p.stack=="string")return[p.stack,m.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var r=s.DetermineComponentFrameRoot(),o=r[0],l=r[1];if(o&&l){var c=o.split(`
|
|
44
|
+
`),d=l.split(`
|
|
45
|
+
`);for(a=s=0;s<c.length&&!c[s].includes("DetermineComponentFrameRoot");)s++;for(;a<d.length&&!d[a].includes("DetermineComponentFrameRoot");)a++;if(s===c.length||a===d.length)for(s=c.length-1,a=d.length-1;1<=s&&0<=a&&c[s]!==d[a];)a--;for(;1<=s&&0<=a;s--,a--)if(c[s]!==d[a]){if(s!==1||a!==1)do if(s--,a--,0>a||c[s]!==d[a]){var h=`
|
|
46
|
+
`+c[s].replace(" at new "," at ");return e.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",e.displayName)),h}while(1<=s&&0<=a);break}}}finally{ym=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?to(n):""}function LR(e){switch(e.tag){case 26:case 27:case 5:return to(e.type);case 16:return to("Lazy");case 13:return to("Suspense");case 19:return to("SuspenseList");case 0:case 15:return wm(e.type,!1);case 11:return wm(e.type.render,!1);case 1:return wm(e.type,!0);case 31:return to("Activity");default:return""}}function ay(e){try{var t="";do t+=LR(e),e=e.return;while(e);return t}catch(n){return`
|
|
47
|
+
Error generating stack: `+n.message+`
|
|
48
|
+
`+n.stack}}function _s(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function v0(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function PR(e){var t=v0(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,r=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(o){s=""+o,r.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(o){s=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qu(e){e._valueTracker||(e._valueTracker=PR(e))}function b0(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=v0(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Yu(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var IR=/[\n"\\]/g;function ks(e){return e.replace(IR,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ip(e,t,n,s,a,r,o,l){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+_s(t)):e.value!==""+_s(t)&&(e.value=""+_s(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?Gp(e,o,_s(t)):n!=null?Gp(e,o,_s(n)):s!=null&&e.removeAttribute("value"),a==null&&r!=null&&(e.defaultChecked=!!r),a!=null&&(e.checked=a&&typeof a!="function"&&typeof a!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+_s(l):e.removeAttribute("name")}function y0(e,t,n,s,a,r,o,l){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null))return;n=n!=null?""+_s(n):"",t=t!=null?""+_s(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}s=s??a,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=l?e.checked:!!s,e.defaultChecked=!!s,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o)}function Gp(e,t,n){t==="number"&&Yu(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function jo(e,t,n,s){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&s&&(e[n].defaultSelected=!0)}else{for(n=""+_s(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,s&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function w0(e,t,n){if(t!=null&&(t=""+_s(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+_s(n):""}function _0(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(le(92));if(Pl(s)){if(1<s.length)throw Error(le(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=_s(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s)}function Lo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var GR=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function ry(e,t,n){var s=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,n):typeof n!="number"||n===0||GR.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function j0(e,t,n){if(t!=null&&typeof t!="object")throw Error(le(62));if(e=e.style,n!=null){for(var s in n)!n.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var a in t)s=t[a],t.hasOwnProperty(a)&&n[a]!==s&&ry(e,a,s)}else for(var r in t)t.hasOwnProperty(r)&&ry(e,r,t[r])}function Ax(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var HR=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),VR=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function bu(e){return VR.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var Hp=null;function Rx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var co=null,No=null;function oy(e){var t=Qo(e);if(t&&(e=t.stateNode)){var n=e[ts]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ip(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+ks(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var a=s[ts]||null;if(!a)throw Error(le(90));Ip(s,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)s=n[t],s.form===e.form&&b0(s)}break e;case"textarea":w0(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&jo(e,!!n.multiple,t,!1)}}}var _m=!1;function N0(e,t,n){if(_m)return e(t,n);_m=!0;try{var s=e(t);return s}finally{if(_m=!1,(co!==null||No!==null)&&(tf(),co&&(t=co,e=No,No=co=null,oy(t),e)))for(t=0;t<e.length;t++)oy(e[t])}}function vc(e,t){var n=e.stateNode;if(n===null)return null;var s=n[ts]||null;if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(le(231,t,typeof n));return n}var Hi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vp=!1;if(Hi)try{var jl={};Object.defineProperty(jl,"passive",{get:function(){Vp=!0}}),window.addEventListener("test",jl,jl),window.removeEventListener("test",jl,jl)}catch{Vp=!1}var ma=null,Tx=null,yu=null;function k0(){if(yu)return yu;var e,t=Tx,n=t.length,s,a="value"in ma?ma.value:ma.textContent,r=a.length;for(e=0;e<n&&t[e]===a[e];e++);var o=n-e;for(s=1;s<=o&&t[n-s]===a[r-s];s++);return yu=a.slice(e,1<s?1-s:void 0)}function wu(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function $d(){return!0}function ly(){return!1}function ns(e){function t(n,s,a,r,o){this._reactName=n,this._targetInst=a,this.type=s,this.nativeEvent=r,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(r):r[l]);return this.isDefaultPrevented=(r.defaultPrevented!=null?r.defaultPrevented:r.returnValue===!1)?$d:ly,this.isPropagationStopped=ly,this}return Ot(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=$d)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=$d)},persist:function(){},isPersistent:$d}),t}var Ar={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Fh=ns(Ar),td=Ot({},Ar,{view:0,detail:0}),UR=ns(td),jm,Nm,Nl,qh=Ot({},td,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ox,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Nl&&(Nl&&e.type==="mousemove"?(jm=e.screenX-Nl.screenX,Nm=e.screenY-Nl.screenY):Nm=jm=0,Nl=e),jm)},movementY:function(e){return"movementY"in e?e.movementY:Nm}}),cy=ns(qh),BR=Ot({},qh,{dataTransfer:0}),WR=ns(BR),FR=Ot({},td,{relatedTarget:0}),km=ns(FR),qR=Ot({},Ar,{animationName:0,elapsedTime:0,pseudoElement:0}),YR=ns(qR),XR=Ot({},Ar,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),KR=ns(XR),ZR=Ot({},Ar,{data:0}),dy=ns(ZR),QR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},JR={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},eT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tT(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=eT[e])?!!t[e]:!1}function Ox(){return tT}var nT=Ot({},td,{key:function(e){if(e.key){var t=QR[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=wu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?JR[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ox,charCode:function(e){return e.type==="keypress"?wu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?wu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),sT=ns(nT),iT=Ot({},qh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),uy=ns(iT),aT=Ot({},td,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ox}),rT=ns(aT),oT=Ot({},Ar,{propertyName:0,elapsedTime:0,pseudoElement:0}),lT=ns(oT),cT=Ot({},qh,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),dT=ns(cT),uT=Ot({},Ar,{newState:0,oldState:0}),hT=ns(uT),fT=[9,13,27,32],zx=Hi&&"CompositionEvent"in window,Yl=null;Hi&&"documentMode"in document&&(Yl=document.documentMode);var mT=Hi&&"TextEvent"in window&&!Yl,S0=Hi&&(!zx||Yl&&8<Yl&&11>=Yl),hy=" ",fy=!1;function C0(e,t){switch(e){case"keyup":return fT.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function D0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var uo=!1;function pT(e,t){switch(e){case"compositionend":return D0(t);case"keypress":return t.which!==32?null:(fy=!0,hy);case"textInput":return e=t.data,e===hy&&fy?null:e;default:return null}}function gT(e,t){if(uo)return e==="compositionend"||!zx&&C0(e,t)?(e=k0(),yu=Tx=ma=null,uo=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return S0&&t.locale!=="ko"?null:t.data;default:return null}}var xT={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function my(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!xT[e.type]:t==="textarea"}function E0(e,t,n,s){co?No?No.push(s):No=[s]:co=s,t=hh(t,"onChange"),0<t.length&&(n=new Fh("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var Xl=null,bc=null;function vT(e){wk(e,0)}function Yh(e){var t=Il(e);if(b0(t))return e}function py(e,t){if(e==="change")return t}var A0=!1;if(Hi){var Sm;if(Hi){var Cm="oninput"in document;if(!Cm){var gy=document.createElement("div");gy.setAttribute("oninput","return;"),Cm=typeof gy.oninput=="function"}Sm=Cm}else Sm=!1;A0=Sm&&(!document.documentMode||9<document.documentMode)}function xy(){Xl&&(Xl.detachEvent("onpropertychange",R0),bc=Xl=null)}function R0(e){if(e.propertyName==="value"&&Yh(bc)){var t=[];E0(t,bc,e,Rx(e)),N0(vT,t)}}function bT(e,t,n){e==="focusin"?(xy(),Xl=t,bc=n,Xl.attachEvent("onpropertychange",R0)):e==="focusout"&&xy()}function yT(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Yh(bc)}function wT(e,t){if(e==="click")return Yh(t)}function _T(e,t){if(e==="input"||e==="change")return Yh(t)}function jT(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var bs=typeof Object.is=="function"?Object.is:jT;function yc(e,t){if(bs(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var a=n[s];if(!Lp.call(t,a)||!bs(e[a],t[a]))return!1}return!0}function vy(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function by(e,t){var n=vy(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=vy(n)}}function T0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?T0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function O0(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Yu(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Yu(e.document)}return t}function Mx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var NT=Hi&&"documentMode"in document&&11>=document.documentMode,ho=null,Up=null,Kl=null,Bp=!1;function yy(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Bp||ho==null||ho!==Yu(s)||(s=ho,"selectionStart"in s&&Mx(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Kl&&yc(Kl,s)||(Kl=s,s=hh(Up,"onSelect"),0<s.length&&(t=new Fh("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=ho)))}function er(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var fo={animationend:er("Animation","AnimationEnd"),animationiteration:er("Animation","AnimationIteration"),animationstart:er("Animation","AnimationStart"),transitionrun:er("Transition","TransitionRun"),transitionstart:er("Transition","TransitionStart"),transitioncancel:er("Transition","TransitionCancel"),transitionend:er("Transition","TransitionEnd")},Dm={},z0={};Hi&&(z0=document.createElement("div").style,"AnimationEvent"in window||(delete fo.animationend.animation,delete fo.animationiteration.animation,delete fo.animationstart.animation),"TransitionEvent"in window||delete fo.transitionend.transition);function Rr(e){if(Dm[e])return Dm[e];if(!fo[e])return e;var t=fo[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in z0)return Dm[e]=t[n];return e}var M0=Rr("animationend"),$0=Rr("animationiteration"),L0=Rr("animationstart"),kT=Rr("transitionrun"),ST=Rr("transitionstart"),CT=Rr("transitioncancel"),P0=Rr("transitionend"),I0=new Map,Wp="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Wp.push("scrollEnd");function Xs(e,t){I0.set(e,t),Er(t,[e])}var wy=new WeakMap;function Ss(e,t){if(typeof e=="object"&&e!==null){var n=wy.get(e);return n!==void 0?n:(t={value:e,source:t,stack:ay(t)},wy.set(e,t),t)}return{value:e,source:t,stack:ay(t)}}var ws=[],mo=0,$x=0;function Xh(){for(var e=mo,t=$x=mo=0;t<e;){var n=ws[t];ws[t++]=null;var s=ws[t];ws[t++]=null;var a=ws[t];ws[t++]=null;var r=ws[t];if(ws[t++]=null,s!==null&&a!==null){var o=s.pending;o===null?a.next=a:(a.next=o.next,o.next=a),s.pending=a}r!==0&&G0(n,a,r)}}function Kh(e,t,n,s){ws[mo++]=e,ws[mo++]=t,ws[mo++]=n,ws[mo++]=s,$x|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Lx(e,t,n,s){return Kh(e,t,n,s),Xu(e)}function Jo(e,t){return Kh(e,null,null,t),Xu(e)}function G0(e,t,n){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n);for(var a=!1,r=e.return;r!==null;)r.childLanes|=n,s=r.alternate,s!==null&&(s.childLanes|=n),r.tag===22&&(e=r.stateNode,e===null||e._visibility&1||(a=!0)),e=r,r=r.return;return e.tag===3?(r=e.stateNode,a&&t!==null&&(a=31-ps(n),e=r.hiddenUpdates,s=e[a],s===null?e[a]=[t]:s.push(t),t.lane=n|536870912),r):null}function Xu(e){if(50<rc)throw rc=0,hg=null,Error(le(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var po={};function DT(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fs(e,t,n,s){return new DT(e,t,n,s)}function Px(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ii(e,t){var n=e.alternate;return n===null?(n=fs(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function H0(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function _u(e,t,n,s,a,r){var o=0;if(s=e,typeof e=="function")Px(e)&&(o=1);else if(typeof e=="string")o=A2(e,n,ci.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Op:return e=fs(31,n,t,a),e.elementType=Op,e.lanes=r,e;case ro:return lr(n.children,a,r,t);case r0:o=8,a|=24;break;case Ap:return e=fs(12,n,t,a|2),e.elementType=Ap,e.lanes=r,e;case Rp:return e=fs(13,n,t,a),e.elementType=Rp,e.lanes=r,e;case Tp:return e=fs(19,n,t,a),e.elementType=Tp,e.lanes=r,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case vR:case Oi:o=10;break e;case o0:o=9;break e;case Nx:o=11;break e;case kx:o=14;break e;case ra:o=16,s=null;break e}o=29,n=Error(le(130,e===null?"null":typeof e,"")),s=null}return t=fs(o,n,t,a),t.elementType=e,t.type=s,t.lanes=r,t}function lr(e,t,n,s){return e=fs(7,e,s,t),e.lanes=n,e}function Em(e,t,n){return e=fs(6,e,null,t),e.lanes=n,e}function Am(e,t,n){return t=fs(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var go=[],xo=0,Ku=null,Zu=0,js=[],Ns=0,cr=null,zi=1,Mi="";function sr(e,t){go[xo++]=Zu,go[xo++]=Ku,Ku=e,Zu=t}function V0(e,t,n){js[Ns++]=zi,js[Ns++]=Mi,js[Ns++]=cr,cr=e;var s=zi;e=Mi;var a=32-ps(s)-1;s&=~(1<<a),n+=1;var r=32-ps(t)+a;if(30<r){var o=a-a%5;r=(s&(1<<o)-1).toString(32),s>>=o,a-=o,zi=1<<32-ps(t)+a|n<<a|s,Mi=r+e}else zi=1<<r|n<<a|s,Mi=e}function Ix(e){e.return!==null&&(sr(e,1),V0(e,1,0))}function Gx(e){for(;e===Ku;)Ku=go[--xo],go[xo]=null,Zu=go[--xo],go[xo]=null;for(;e===cr;)cr=js[--Ns],js[Ns]=null,Mi=js[--Ns],js[Ns]=null,zi=js[--Ns],js[Ns]=null}var Gn=null,Wt=null,ct=!1,dr=null,ni=!1,Fp=Error(le(519));function br(e){var t=Error(le(418,""));throw wc(Ss(t,e)),Fp}function _y(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[An]=e,t[ts]=s,n){case"dialog":Je("cancel",t),Je("close",t);break;case"iframe":case"object":case"embed":Je("load",t);break;case"video":case"audio":for(n=0;n<Nc.length;n++)Je(Nc[n],t);break;case"source":Je("error",t);break;case"img":case"image":case"link":Je("error",t),Je("load",t);break;case"details":Je("toggle",t);break;case"input":Je("invalid",t),y0(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0),qu(t);break;case"select":Je("invalid",t);break;case"textarea":Je("invalid",t),_0(t,s.value,s.defaultValue,s.children),qu(t)}n=s.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||s.suppressHydrationWarning===!0||jk(t.textContent,n)?(s.popover!=null&&(Je("beforetoggle",t),Je("toggle",t)),s.onScroll!=null&&Je("scroll",t),s.onScrollEnd!=null&&Je("scrollend",t),s.onClick!=null&&(t.onclick=af),t=!0):t=!1,t||br(e)}function jy(e){for(Gn=e.return;Gn;)switch(Gn.tag){case 5:case 13:ni=!1;return;case 27:case 3:ni=!0;return;default:Gn=Gn.return}}function kl(e){if(e!==Gn)return!1;if(!ct)return jy(e),ct=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||vg(e.type,e.memoizedProps)),n=!n),n&&Wt&&br(e),jy(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(le(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8)if(n=e.data,n==="/$"){if(t===0){Wt=Us(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++;e=e.nextSibling}Wt=null}}else t===27?(t=Wt,Va(e.type)?(e=wg,wg=null,Wt=e):Wt=t):Wt=Gn?Us(e.stateNode.nextSibling):null;return!0}function nd(){Wt=Gn=null,ct=!1}function Ny(){var e=dr;return e!==null&&(Kn===null?Kn=e:Kn.push.apply(Kn,e),dr=null),e}function wc(e){dr===null?dr=[e]:dr.push(e)}var qp=bi(null),Tr=null,$i=null;function la(e,t,n){Pt(qp,t._currentValue),t._currentValue=n}function Gi(e){e._currentValue=qp.current,mn(qp)}function Yp(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function Xp(e,t,n,s){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var r=a.dependencies;if(r!==null){var o=a.child;r=r.firstContext;e:for(;r!==null;){var l=r;r=a;for(var c=0;c<t.length;c++)if(l.context===t[c]){r.lanes|=n,l=r.alternate,l!==null&&(l.lanes|=n),Yp(r.return,n,e),s||(o=null);break e}r=l.next}}else if(a.tag===18){if(o=a.return,o===null)throw Error(le(341));o.lanes|=n,r=o.alternate,r!==null&&(r.lanes|=n),Yp(o,n,e),o=null}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===e){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}}function sd(e,t,n,s){e=null;for(var a=t,r=!1;a!==null;){if(!r){if(a.flags&524288)r=!0;else if(a.flags&262144)break}if(a.tag===10){var o=a.alternate;if(o===null)throw Error(le(387));if(o=o.memoizedProps,o!==null){var l=a.type;bs(a.pendingProps.value,o.value)||(e!==null?e.push(l):e=[l])}}else if(a===Uu.current){if(o=a.alternate,o===null)throw Error(le(387));o.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e!==null?e.push(Cc):e=[Cc])}a=a.return}e!==null&&Xp(t,e,n,s),t.flags|=262144}function Qu(e){for(e=e.firstContext;e!==null;){if(!bs(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function yr(e){Tr=e,$i=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Rn(e){return U0(Tr,e)}function Ld(e,t){return Tr===null&&yr(e),U0(e,t)}function U0(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},$i===null){if(e===null)throw Error(le(308));$i=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else $i=$i.next=t;return n}var ET=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},AT=on.unstable_scheduleCallback,RT=on.unstable_NormalPriority,an={$$typeof:Oi,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Hx(){return{controller:new ET,data:new Map,refCount:0}}function id(e){e.refCount--,e.refCount===0&&AT(RT,function(){e.controller.abort()})}var Zl=null,Kp=0,Po=0,ko=null;function TT(e,t){if(Zl===null){var n=Zl=[];Kp=0,Po=dv(),ko={status:"pending",value:void 0,then:function(s){n.push(s)}}}return Kp++,t.then(ky,ky),t}function ky(){if(--Kp===0&&Zl!==null){ko!==null&&(ko.status="fulfilled");var e=Zl;Zl=null,Po=0,ko=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function OT(e,t){var n=[],s={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var a=0;a<n.length;a++)(0,n[a])(t)},function(a){for(s.status="rejected",s.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),s}var Sy=Ue.S;Ue.S=function(e,t){typeof t=="object"&&t!==null&&typeof t.then=="function"&&TT(e,t),Sy!==null&&Sy(e,t)};var ur=bi(null);function Vx(){var e=ur.current;return e!==null?e:kt.pooledCache}function ju(e,t){t===null?Pt(ur,ur.current):Pt(ur,t.pool)}function B0(){var e=Vx();return e===null?null:{parent:an._currentValue,pool:e}}var ad=Error(le(460)),W0=Error(le(474)),Zh=Error(le(542)),Zp={then:function(){}};function Cy(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Pd(){}function F0(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Pd,Pd),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Ey(e),e;default:if(typeof t.status=="string")t.then(Pd,Pd);else{if(e=kt,e!==null&&100<e.shellSuspendCounter)throw Error(le(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var a=t;a.status="fulfilled",a.value=s}},function(s){if(t.status==="pending"){var a=t;a.status="rejected",a.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Ey(e),e}throw Ql=t,ad}}var Ql=null;function Dy(){if(Ql===null)throw Error(le(459));var e=Ql;return Ql=null,e}function Ey(e){if(e===ad||e===Zh)throw Error(le(483))}var oa=!1;function Ux(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Qp(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ja(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Na(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,pt&2){var a=s.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t,t=Xu(e),G0(e,null,n),t}return Kh(e,s,t,n),Xu(e)}function Jl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,m0(e,n)}}function Rm(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var a=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?a=r=o:r=r.next=o,n=n.next}while(n!==null);r===null?a=r=t:r=r.next=t}else a=r=t;n={baseState:s.baseState,firstBaseUpdate:a,lastBaseUpdate:r,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Jp=!1;function ec(){if(Jp){var e=ko;if(e!==null)throw e}}function tc(e,t,n,s){Jp=!1;var a=e.updateQueue;oa=!1;var r=a.firstBaseUpdate,o=a.lastBaseUpdate,l=a.shared.pending;if(l!==null){a.shared.pending=null;var c=l,d=c.next;c.next=null,o===null?r=d:o.next=d,o=c;var h=e.alternate;h!==null&&(h=h.updateQueue,l=h.lastBaseUpdate,l!==o&&(l===null?h.firstBaseUpdate=d:l.next=d,h.lastBaseUpdate=c))}if(r!==null){var f=a.baseState;o=0,h=d=c=null,l=r;do{var m=l.lane&-536870913,p=m!==l.lane;if(p?(st&m)===m:(s&m)===m){m!==0&&m===Po&&(Jp=!0),h!==null&&(h=h.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var y=e,g=l;m=t;var b=n;switch(g.tag){case 1:if(y=g.payload,typeof y=="function"){f=y.call(b,f,m);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=g.payload,m=typeof y=="function"?y.call(b,f,m):y,m==null)break e;f=Ot({},f,m);break e;case 2:oa=!0}}m=l.callback,m!==null&&(e.flags|=64,p&&(e.flags|=8192),p=a.callbacks,p===null?a.callbacks=[m]:p.push(m))}else p={lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},h===null?(d=h=p,c=f):h=h.next=p,o|=m;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;p=l,l=p.next,p.next=null,a.lastBaseUpdate=p,a.shared.pending=null}}while(!0);h===null&&(c=f),a.baseState=c,a.firstBaseUpdate=d,a.lastBaseUpdate=h,r===null&&(a.shared.lanes=0),$a|=o,e.lanes=o,e.memoizedState=f}}function q0(e,t){if(typeof e!="function")throw Error(le(191,e));e.call(t)}function Y0(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)q0(n[e],t)}var Io=bi(null),Ju=bi(0);function Ay(e,t){e=Bi,Pt(Ju,e),Pt(Io,t),Bi=e|t.baseLanes}function eg(){Pt(Ju,Bi),Pt(Io,Io.current)}function Bx(){Bi=Ju.current,mn(Io),mn(Ju)}var za=0,Ze=null,vt=null,Xt=null,eh=!1,So=!1,wr=!1,th=0,_c=0,Co=null,zT=0;function qt(){throw Error(le(321))}function Wx(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!bs(e[n],t[n]))return!1;return!0}function Fx(e,t,n,s,a,r){return za=r,Ze=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ue.H=e===null||e.memoizedState===null?kN:SN,wr=!1,r=n(s,a),wr=!1,So&&(r=K0(t,n,s,a)),X0(e),r}function X0(e){Ue.H=nh;var t=vt!==null&&vt.next!==null;if(za=0,Xt=vt=Ze=null,eh=!1,_c=0,Co=null,t)throw Error(le(300));e===null||fn||(e=e.dependencies,e!==null&&Qu(e)&&(fn=!0))}function K0(e,t,n,s){Ze=e;var a=0;do{if(So&&(Co=null),_c=0,So=!1,25<=a)throw Error(le(301));if(a+=1,Xt=vt=null,e.updateQueue!=null){var r=e.updateQueue;r.lastEffect=null,r.events=null,r.stores=null,r.memoCache!=null&&(r.memoCache.index=0)}Ue.H=HT,r=t(n,s)}while(So);return r}function MT(){var e=Ue.H,t=e.useState()[0];return t=typeof t.then=="function"?rd(t):t,e=e.useState()[0],(vt!==null?vt.memoizedState:null)!==e&&(Ze.flags|=1024),t}function qx(){var e=th!==0;return th=0,e}function Yx(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Xx(e){if(eh){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}eh=!1}za=0,Xt=vt=Ze=null,So=!1,_c=th=0,Co=null}function Yn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?Ze.memoizedState=Xt=e:Xt=Xt.next=e,Xt}function Jt(){if(vt===null){var e=Ze.alternate;e=e!==null?e.memoizedState:null}else e=vt.next;var t=Xt===null?Ze.memoizedState:Xt.next;if(t!==null)Xt=t,vt=e;else{if(e===null)throw Ze.alternate===null?Error(le(467)):Error(le(310));vt=e,e={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},Xt===null?Ze.memoizedState=Xt=e:Xt=Xt.next=e}return Xt}function Kx(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rd(e){var t=_c;return _c+=1,Co===null&&(Co=[]),e=F0(Co,e,t),t=Ze,(Xt===null?t.memoizedState:Xt.next)===null&&(t=t.alternate,Ue.H=t===null||t.memoizedState===null?kN:SN),e}function Qh(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return rd(e);if(e.$$typeof===Oi)return Rn(e)}throw Error(le(438,String(e)))}function Zx(e){var t=null,n=Ze.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=Ze.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(a){return a.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Kx(),Ze.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),s=0;s<e;s++)n[s]=bR;return t.index++,n}function Vi(e,t){return typeof t=="function"?t(e):t}function Nu(e){var t=Jt();return Qx(t,vt,e)}function Qx(e,t,n){var s=e.queue;if(s===null)throw Error(le(311));s.lastRenderedReducer=n;var a=e.baseQueue,r=s.pending;if(r!==null){if(a!==null){var o=a.next;a.next=r.next,r.next=o}t.baseQueue=a=r,s.pending=null}if(r=e.baseState,a===null)e.memoizedState=r;else{t=a.next;var l=o=null,c=null,d=t,h=!1;do{var f=d.lane&-536870913;if(f!==d.lane?(st&f)===f:(za&f)===f){var m=d.revertLane;if(m===0)c!==null&&(c=c.next={lane:0,revertLane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),f===Po&&(h=!0);else if((za&m)===m){d=d.next,m===Po&&(h=!0);continue}else f={lane:0,revertLane:d.revertLane,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},c===null?(l=c=f,o=r):c=c.next=f,Ze.lanes|=m,$a|=m;f=d.action,wr&&n(r,f),r=d.hasEagerState?d.eagerState:n(r,f)}else m={lane:f,revertLane:d.revertLane,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},c===null?(l=c=m,o=r):c=c.next=m,Ze.lanes|=f,$a|=f;d=d.next}while(d!==null&&d!==t);if(c===null?o=r:c.next=l,!bs(r,e.memoizedState)&&(fn=!0,h&&(n=ko,n!==null)))throw n;e.memoizedState=r,e.baseState=o,e.baseQueue=c,s.lastRenderedState=r}return a===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Tm(e){var t=Jt(),n=t.queue;if(n===null)throw Error(le(311));n.lastRenderedReducer=e;var s=n.dispatch,a=n.pending,r=t.memoizedState;if(a!==null){n.pending=null;var o=a=a.next;do r=e(r,o.action),o=o.next;while(o!==a);bs(r,t.memoizedState)||(fn=!0),t.memoizedState=r,t.baseQueue===null&&(t.baseState=r),n.lastRenderedState=r}return[r,s]}function Z0(e,t,n){var s=Ze,a=Jt(),r=ct;if(r){if(n===void 0)throw Error(le(407));n=n()}else n=t();var o=!bs((vt||a).memoizedState,n);o&&(a.memoizedState=n,fn=!0),a=a.queue;var l=eN.bind(null,s,a,e);if(od(2048,8,l,[e]),a.getSnapshot!==t||o||Xt!==null&&Xt.memoizedState.tag&1){if(s.flags|=2048,Go(9,Jh(),J0.bind(null,s,a,n,t),null),kt===null)throw Error(le(349));r||za&124||Q0(s,t,n)}return n}function Q0(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ze.updateQueue,t===null?(t=Kx(),Ze.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function J0(e,t,n,s){t.value=n,t.getSnapshot=s,tN(t)&&nN(e)}function eN(e,t,n){return n(function(){tN(t)&&nN(e)})}function tN(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!bs(e,n)}catch{return!0}}function nN(e){var t=Jo(e,2);t!==null&&xs(t,e,2)}function tg(e){var t=Yn();if(typeof e=="function"){var n=e;if(e=n(),wr){fa(!0);try{n()}finally{fa(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vi,lastRenderedState:e},t}function sN(e,t,n,s){return e.baseState=n,Qx(e,vt,typeof s=="function"?s:Vi)}function $T(e,t,n,s,a){if(ef(e))throw Error(le(485));if(e=t.action,e!==null){var r={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){r.listeners.push(o)}};Ue.T!==null?n(!0):r.isTransition=!1,s(r),n=t.pending,n===null?(r.next=t.pending=r,iN(t,r)):(r.next=n.next,t.pending=n.next=r)}}function iN(e,t){var n=t.action,s=t.payload,a=e.state;if(t.isTransition){var r=Ue.T,o={};Ue.T=o;try{var l=n(a,s),c=Ue.S;c!==null&&c(o,l),Ry(e,t,l)}catch(d){ng(e,t,d)}finally{Ue.T=r}}else try{r=n(a,s),Ry(e,t,r)}catch(d){ng(e,t,d)}}function Ry(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){Ty(e,t,s)},function(s){return ng(e,t,s)}):Ty(e,t,n)}function Ty(e,t,n){t.status="fulfilled",t.value=n,aN(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,iN(e,n)))}function ng(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,aN(t),t=t.next;while(t!==s)}e.action=null}function aN(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function rN(e,t){return t}function Oy(e,t){if(ct){var n=kt.formState;if(n!==null){e:{var s=Ze;if(ct){if(Wt){t:{for(var a=Wt,r=ni;a.nodeType!==8;){if(!r){a=null;break t}if(a=Us(a.nextSibling),a===null){a=null;break t}}r=a.data,a=r==="F!"||r==="F"?a:null}if(a){Wt=Us(a.nextSibling),s=a.data==="F!";break e}}br(s)}s=!1}s&&(t=n[0])}}return n=Yn(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rN,lastRenderedState:t},n.queue=s,n=_N.bind(null,Ze,s),s.dispatch=n,s=tg(!1),r=nv.bind(null,Ze,!1,s.queue),s=Yn(),a={state:t,dispatch:null,action:e,pending:null},s.queue=a,n=$T.bind(null,Ze,a,r,n),a.dispatch=n,s.memoizedState=e,[t,n,!1]}function zy(e){var t=Jt();return oN(t,vt,e)}function oN(e,t,n){if(t=Qx(e,t,rN)[0],e=Nu(Vi)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=rd(t)}catch(o){throw o===ad?Zh:o}else s=t;t=Jt();var a=t.queue,r=a.dispatch;return n!==t.memoizedState&&(Ze.flags|=2048,Go(9,Jh(),LT.bind(null,a,n),null)),[s,r,e]}function LT(e,t){e.action=t}function My(e){var t=Jt(),n=vt;if(n!==null)return oN(t,n,e);Jt(),t=t.memoizedState,n=Jt();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function Go(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=Ze.updateQueue,t===null&&(t=Kx(),Ze.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e),e}function Jh(){return{destroy:void 0,resource:void 0}}function lN(){return Jt().memoizedState}function ku(e,t,n,s){var a=Yn();s=s===void 0?null:s,Ze.flags|=e,a.memoizedState=Go(1|t,Jh(),n,s)}function od(e,t,n,s){var a=Jt();s=s===void 0?null:s;var r=a.memoizedState.inst;vt!==null&&s!==null&&Wx(s,vt.memoizedState.deps)?a.memoizedState=Go(t,r,n,s):(Ze.flags|=e,a.memoizedState=Go(1|t,r,n,s))}function $y(e,t){ku(8390656,8,e,t)}function cN(e,t){od(2048,8,e,t)}function dN(e,t){return od(4,2,e,t)}function uN(e,t){return od(4,4,e,t)}function hN(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function fN(e,t,n){n=n!=null?n.concat([e]):null,od(4,4,hN.bind(null,t,e),n)}function Jx(){}function mN(e,t){var n=Jt();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&Wx(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function pN(e,t){var n=Jt();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&Wx(t,s[1]))return s[0];if(s=e(),wr){fa(!0);try{e()}finally{fa(!1)}}return n.memoizedState=[s,t],s}function ev(e,t,n){return n===void 0||za&1073741824?e.memoizedState=t:(e.memoizedState=n,e=ak(),Ze.lanes|=e,$a|=e,n)}function gN(e,t,n,s){return bs(n,t)?n:Io.current!==null?(e=ev(e,n,s),bs(e,t)||(fn=!0),e):za&42?(e=ak(),Ze.lanes|=e,$a|=e,t):(fn=!0,e.memoizedState=n)}function xN(e,t,n,s,a){var r=dt.p;dt.p=r!==0&&8>r?r:8;var o=Ue.T,l={};Ue.T=l,nv(e,!1,t,n);try{var c=a(),d=Ue.S;if(d!==null&&d(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var h=OT(c,s);nc(e,t,h,gs(e))}else nc(e,t,s,gs(e))}catch(f){nc(e,t,{then:function(){},status:"rejected",reason:f},gs())}finally{dt.p=r,Ue.T=o}}function PT(){}function sg(e,t,n,s){if(e.tag!==5)throw Error(le(476));var a=vN(e).queue;xN(e,a,t,or,n===null?PT:function(){return bN(e),n(s)})}function vN(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:or,baseState:or,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vi,lastRenderedState:or},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vi,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function bN(e){var t=vN(e).next.queue;nc(e,t,{},gs())}function tv(){return Rn(Cc)}function yN(){return Jt().memoizedState}function wN(){return Jt().memoizedState}function IT(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=gs();e=ja(n);var s=Na(t,e,n);s!==null&&(xs(s,t,n),Jl(s,t,n)),t={cache:Hx()},e.payload=t;return}t=t.return}}function GT(e,t,n){var s=gs();n={lane:s,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},ef(e)?jN(t,n):(n=Lx(e,t,n,s),n!==null&&(xs(n,e,s),NN(n,t,s)))}function _N(e,t,n){var s=gs();nc(e,t,n,s)}function nc(e,t,n,s){var a={lane:s,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(ef(e))jN(t,a);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var o=t.lastRenderedState,l=r(o,n);if(a.hasEagerState=!0,a.eagerState=l,bs(l,o))return Kh(e,t,a,0),kt===null&&Xh(),!1}catch{}finally{}if(n=Lx(e,t,a,s),n!==null)return xs(n,e,s),NN(n,t,s),!0}return!1}function nv(e,t,n,s){if(s={lane:2,revertLane:dv(),action:s,hasEagerState:!1,eagerState:null,next:null},ef(e)){if(t)throw Error(le(479))}else t=Lx(e,n,s,2),t!==null&&xs(t,e,2)}function ef(e){var t=e.alternate;return e===Ze||t!==null&&t===Ze}function jN(e,t){So=eh=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function NN(e,t,n){if(n&4194048){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,m0(e,n)}}var nh={readContext:Rn,use:Qh,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useLayoutEffect:qt,useInsertionEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useSyncExternalStore:qt,useId:qt,useHostTransitionStatus:qt,useFormState:qt,useActionState:qt,useOptimistic:qt,useMemoCache:qt,useCacheRefresh:qt},kN={readContext:Rn,use:Qh,useCallback:function(e,t){return Yn().memoizedState=[e,t===void 0?null:t],e},useContext:Rn,useEffect:$y,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,ku(4194308,4,hN.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ku(4194308,4,e,t)},useInsertionEffect:function(e,t){ku(4,2,e,t)},useMemo:function(e,t){var n=Yn();t=t===void 0?null:t;var s=e();if(wr){fa(!0);try{e()}finally{fa(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=Yn();if(n!==void 0){var a=n(t);if(wr){fa(!0);try{n(t)}finally{fa(!1)}}}else a=t;return s.memoizedState=s.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},s.queue=e,e=e.dispatch=GT.bind(null,Ze,e),[s.memoizedState,e]},useRef:function(e){var t=Yn();return e={current:e},t.memoizedState=e},useState:function(e){e=tg(e);var t=e.queue,n=_N.bind(null,Ze,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Jx,useDeferredValue:function(e,t){var n=Yn();return ev(n,e,t)},useTransition:function(){var e=tg(!1);return e=xN.bind(null,Ze,e.queue,!0,!1),Yn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Ze,a=Yn();if(ct){if(n===void 0)throw Error(le(407));n=n()}else{if(n=t(),kt===null)throw Error(le(349));st&124||Q0(s,t,n)}a.memoizedState=n;var r={value:n,getSnapshot:t};return a.queue=r,$y(eN.bind(null,s,r,e),[e]),s.flags|=2048,Go(9,Jh(),J0.bind(null,s,r,n,t),null),n},useId:function(){var e=Yn(),t=kt.identifierPrefix;if(ct){var n=Mi,s=zi;n=(s&~(1<<32-ps(s)-1)).toString(32)+n,t="«"+t+"R"+n,n=th++,0<n&&(t+="H"+n.toString(32)),t+="»"}else n=zT++,t="«"+t+"r"+n.toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:tv,useFormState:Oy,useActionState:Oy,useOptimistic:function(e){var t=Yn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=nv.bind(null,Ze,!0,n),n.dispatch=t,[e,t]},useMemoCache:Zx,useCacheRefresh:function(){return Yn().memoizedState=IT.bind(null,Ze)}},SN={readContext:Rn,use:Qh,useCallback:mN,useContext:Rn,useEffect:cN,useImperativeHandle:fN,useInsertionEffect:dN,useLayoutEffect:uN,useMemo:pN,useReducer:Nu,useRef:lN,useState:function(){return Nu(Vi)},useDebugValue:Jx,useDeferredValue:function(e,t){var n=Jt();return gN(n,vt.memoizedState,e,t)},useTransition:function(){var e=Nu(Vi)[0],t=Jt().memoizedState;return[typeof e=="boolean"?e:rd(e),t]},useSyncExternalStore:Z0,useId:yN,useHostTransitionStatus:tv,useFormState:zy,useActionState:zy,useOptimistic:function(e,t){var n=Jt();return sN(n,vt,e,t)},useMemoCache:Zx,useCacheRefresh:wN},HT={readContext:Rn,use:Qh,useCallback:mN,useContext:Rn,useEffect:cN,useImperativeHandle:fN,useInsertionEffect:dN,useLayoutEffect:uN,useMemo:pN,useReducer:Tm,useRef:lN,useState:function(){return Tm(Vi)},useDebugValue:Jx,useDeferredValue:function(e,t){var n=Jt();return vt===null?ev(n,e,t):gN(n,vt.memoizedState,e,t)},useTransition:function(){var e=Tm(Vi)[0],t=Jt().memoizedState;return[typeof e=="boolean"?e:rd(e),t]},useSyncExternalStore:Z0,useId:yN,useHostTransitionStatus:tv,useFormState:My,useActionState:My,useOptimistic:function(e,t){var n=Jt();return vt!==null?sN(n,vt,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Zx,useCacheRefresh:wN},Do=null,jc=0;function Id(e){var t=jc;return jc+=1,Do===null&&(Do=[]),F0(Do,e,t)}function Sl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Gd(e,t){throw t.$$typeof===xR?Error(le(525)):(e=Object.prototype.toString.call(t),Error(le(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Ly(e){var t=e._init;return t(e._payload)}function CN(e){function t(v,x){if(e){var w=v.deletions;w===null?(v.deletions=[x],v.flags|=16):w.push(x)}}function n(v,x){if(!e)return null;for(;x!==null;)t(v,x),x=x.sibling;return null}function s(v){for(var x=new Map;v!==null;)v.key!==null?x.set(v.key,v):x.set(v.index,v),v=v.sibling;return x}function a(v,x){return v=Ii(v,x),v.index=0,v.sibling=null,v}function r(v,x,w){return v.index=w,e?(w=v.alternate,w!==null?(w=w.index,w<x?(v.flags|=67108866,x):w):(v.flags|=67108866,x)):(v.flags|=1048576,x)}function o(v){return e&&v.alternate===null&&(v.flags|=67108866),v}function l(v,x,w,_){return x===null||x.tag!==6?(x=Em(w,v.mode,_),x.return=v,x):(x=a(x,w),x.return=v,x)}function c(v,x,w,_){var S=w.type;return S===ro?h(v,x,w.props.children,_,w.key):x!==null&&(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===ra&&Ly(S)===x.type)?(x=a(x,w.props),Sl(x,w),x.return=v,x):(x=_u(w.type,w.key,w.props,null,v.mode,_),Sl(x,w),x.return=v,x)}function d(v,x,w,_){return x===null||x.tag!==4||x.stateNode.containerInfo!==w.containerInfo||x.stateNode.implementation!==w.implementation?(x=Am(w,v.mode,_),x.return=v,x):(x=a(x,w.children||[]),x.return=v,x)}function h(v,x,w,_,S){return x===null||x.tag!==7?(x=lr(w,v.mode,_,S),x.return=v,x):(x=a(x,w),x.return=v,x)}function f(v,x,w){if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return x=Em(""+x,v.mode,w),x.return=v,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Td:return w=_u(x.type,x.key,x.props,null,v.mode,w),Sl(w,x),w.return=v,w;case Ll:return x=Am(x,v.mode,w),x.return=v,x;case ra:var _=x._init;return x=_(x._payload),f(v,x,w)}if(Pl(x)||_l(x))return x=lr(x,v.mode,w,null),x.return=v,x;if(typeof x.then=="function")return f(v,Id(x),w);if(x.$$typeof===Oi)return f(v,Ld(v,x),w);Gd(v,x)}return null}function m(v,x,w,_){var S=x!==null?x.key:null;if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return S!==null?null:l(v,x,""+w,_);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Td:return w.key===S?c(v,x,w,_):null;case Ll:return w.key===S?d(v,x,w,_):null;case ra:return S=w._init,w=S(w._payload),m(v,x,w,_)}if(Pl(w)||_l(w))return S!==null?null:h(v,x,w,_,null);if(typeof w.then=="function")return m(v,x,Id(w),_);if(w.$$typeof===Oi)return m(v,x,Ld(v,w),_);Gd(v,w)}return null}function p(v,x,w,_,S){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return v=v.get(w)||null,l(x,v,""+_,S);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Td:return v=v.get(_.key===null?w:_.key)||null,c(x,v,_,S);case Ll:return v=v.get(_.key===null?w:_.key)||null,d(x,v,_,S);case ra:var k=_._init;return _=k(_._payload),p(v,x,w,_,S)}if(Pl(_)||_l(_))return v=v.get(w)||null,h(x,v,_,S,null);if(typeof _.then=="function")return p(v,x,w,Id(_),S);if(_.$$typeof===Oi)return p(v,x,w,Ld(x,_),S);Gd(x,_)}return null}function y(v,x,w,_){for(var S=null,k=null,j=x,N=x=0,O=null;j!==null&&N<w.length;N++){j.index>N?(O=j,j=null):O=j.sibling;var T=m(v,j,w[N],_);if(T===null){j===null&&(j=O);break}e&&j&&T.alternate===null&&t(v,j),x=r(T,x,N),k===null?S=T:k.sibling=T,k=T,j=O}if(N===w.length)return n(v,j),ct&&sr(v,N),S;if(j===null){for(;N<w.length;N++)j=f(v,w[N],_),j!==null&&(x=r(j,x,N),k===null?S=j:k.sibling=j,k=j);return ct&&sr(v,N),S}for(j=s(j);N<w.length;N++)O=p(j,v,N,w[N],_),O!==null&&(e&&O.alternate!==null&&j.delete(O.key===null?N:O.key),x=r(O,x,N),k===null?S=O:k.sibling=O,k=O);return e&&j.forEach(function(P){return t(v,P)}),ct&&sr(v,N),S}function g(v,x,w,_){if(w==null)throw Error(le(151));for(var S=null,k=null,j=x,N=x=0,O=null,T=w.next();j!==null&&!T.done;N++,T=w.next()){j.index>N?(O=j,j=null):O=j.sibling;var P=m(v,j,T.value,_);if(P===null){j===null&&(j=O);break}e&&j&&P.alternate===null&&t(v,j),x=r(P,x,N),k===null?S=P:k.sibling=P,k=P,j=O}if(T.done)return n(v,j),ct&&sr(v,N),S;if(j===null){for(;!T.done;N++,T=w.next())T=f(v,T.value,_),T!==null&&(x=r(T,x,N),k===null?S=T:k.sibling=T,k=T);return ct&&sr(v,N),S}for(j=s(j);!T.done;N++,T=w.next())T=p(j,v,N,T.value,_),T!==null&&(e&&T.alternate!==null&&j.delete(T.key===null?N:T.key),x=r(T,x,N),k===null?S=T:k.sibling=T,k=T);return e&&j.forEach(function(L){return t(v,L)}),ct&&sr(v,N),S}function b(v,x,w,_){if(typeof w=="object"&&w!==null&&w.type===ro&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Td:e:{for(var S=w.key;x!==null;){if(x.key===S){if(S=w.type,S===ro){if(x.tag===7){n(v,x.sibling),_=a(x,w.props.children),_.return=v,v=_;break e}}else if(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===ra&&Ly(S)===x.type){n(v,x.sibling),_=a(x,w.props),Sl(_,w),_.return=v,v=_;break e}n(v,x);break}else t(v,x);x=x.sibling}w.type===ro?(_=lr(w.props.children,v.mode,_,w.key),_.return=v,v=_):(_=_u(w.type,w.key,w.props,null,v.mode,_),Sl(_,w),_.return=v,v=_)}return o(v);case Ll:e:{for(S=w.key;x!==null;){if(x.key===S)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(v,x.sibling),_=a(x,w.children||[]),_.return=v,v=_;break e}else{n(v,x);break}else t(v,x);x=x.sibling}_=Am(w,v.mode,_),_.return=v,v=_}return o(v);case ra:return S=w._init,w=S(w._payload),b(v,x,w,_)}if(Pl(w))return y(v,x,w,_);if(_l(w)){if(S=_l(w),typeof S!="function")throw Error(le(150));return w=S.call(w),g(v,x,w,_)}if(typeof w.then=="function")return b(v,x,Id(w),_);if(w.$$typeof===Oi)return b(v,x,Ld(v,w),_);Gd(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint"?(w=""+w,x!==null&&x.tag===6?(n(v,x.sibling),_=a(x,w),_.return=v,v=_):(n(v,x),_=Em(w,v.mode,_),_.return=v,v=_),o(v)):n(v,x)}return function(v,x,w,_){try{jc=0;var S=b(v,x,w,_);return Do=null,S}catch(j){if(j===ad||j===Zh)throw j;var k=fs(29,j,null,v.mode);return k.lanes=_,k.return=v,k}finally{}}}var Ho=CN(!0),DN=CN(!1),zs=bi(null),ui=null;function ca(e){var t=e.alternate;Pt(rn,rn.current&1),Pt(zs,e),ui===null&&(t===null||Io.current!==null||t.memoizedState!==null)&&(ui=e)}function EN(e){if(e.tag===22){if(Pt(rn,rn.current),Pt(zs,e),ui===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(ui=e)}}else da()}function da(){Pt(rn,rn.current),Pt(zs,zs.current)}function Li(e){mn(zs),ui===e&&(ui=null),mn(rn)}var rn=bi(0);function sh(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||yg(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function Om(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:Ot({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ig={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=gs(),a=ja(s);a.payload=t,n!=null&&(a.callback=n),t=Na(e,a,s),t!==null&&(xs(t,e,s),Jl(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=gs(),a=ja(s);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=Na(e,a,s),t!==null&&(xs(t,e,s),Jl(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=gs(),s=ja(n);s.tag=2,t!=null&&(s.callback=t),t=Na(e,s,n),t!==null&&(xs(t,e,n),Jl(t,e,n))}};function Py(e,t,n,s,a,r,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,r,o):t.prototype&&t.prototype.isPureReactComponent?!yc(n,s)||!yc(a,r):!0}function Iy(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&ig.enqueueReplaceState(t,t.state,null)}function _r(e,t){var n=t;if("ref"in t){n={};for(var s in t)s!=="ref"&&(n[s]=t[s])}if(e=e.defaultProps){n===t&&(n=Ot({},n));for(var a in e)n[a]===void 0&&(n[a]=e[a])}return n}var ih=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function AN(e){ih(e)}function RN(e){console.error(e)}function TN(e){ih(e)}function ah(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Gy(e,t,n){try{var s=e.onCaughtError;s(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function ag(e,t,n){return n=ja(n),n.tag=3,n.payload={element:null},n.callback=function(){ah(e,t)},n}function ON(e){return e=ja(e),e.tag=3,e}function zN(e,t,n,s){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var r=s.value;e.payload=function(){return a(r)},e.callback=function(){Gy(t,n,s)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){Gy(t,n,s),typeof a!="function"&&(ka===null?ka=new Set([this]):ka.add(this));var l=s.stack;this.componentDidCatch(s.value,{componentStack:l!==null?l:""})})}function VT(e,t,n,s,a){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&sd(t,n,a,!0),n=zs.current,n!==null){switch(n.tag){case 13:return ui===null?fg():n.alternate===null&&Ft===0&&(Ft=3),n.flags&=-257,n.flags|=65536,n.lanes=a,s===Zp?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),Bm(e,s,a)),!1;case 22:return n.flags|=65536,s===Zp?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([s]):n.add(s)),Bm(e,s,a)),!1}throw Error(le(435,n.tag))}return Bm(e,s,a),fg(),!1}if(ct)return t=zs.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,s!==Fp&&(e=Error(le(422),{cause:s}),wc(Ss(e,n)))):(s!==Fp&&(t=Error(le(423),{cause:s}),wc(Ss(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,s=Ss(s,n),a=ag(e.stateNode,s,a),Rm(e,a),Ft!==4&&(Ft=2)),!1;var r=Error(le(520),{cause:s});if(r=Ss(r,n),ac===null?ac=[r]:ac.push(r),Ft!==4&&(Ft=2),t===null)return!0;s=Ss(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=ag(n.stateNode,s,e),Rm(n,e),!1;case 1:if(t=n.type,r=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||r!==null&&typeof r.componentDidCatch=="function"&&(ka===null||!ka.has(r))))return n.flags|=65536,a&=-a,n.lanes|=a,a=ON(a),zN(a,e,n,s),Rm(n,a),!1}n=n.return}while(n!==null);return!1}var MN=Error(le(461)),fn=!1;function vn(e,t,n,s){t.child=e===null?DN(t,null,n,s):Ho(t,e.child,n,s)}function Hy(e,t,n,s,a){n=n.render;var r=t.ref;if("ref"in s){var o={};for(var l in s)l!=="ref"&&(o[l]=s[l])}else o=s;return yr(t),s=Fx(e,t,n,o,r,a),l=qx(),e!==null&&!fn?(Yx(e,t,a),Ui(e,t,a)):(ct&&l&&Ix(t),t.flags|=1,vn(e,t,s,a),t.child)}function Vy(e,t,n,s,a){if(e===null){var r=n.type;return typeof r=="function"&&!Px(r)&&r.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=r,$N(e,t,r,s,a)):(e=_u(n.type,null,s,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(r=e.child,!sv(e,a)){var o=r.memoizedProps;if(n=n.compare,n=n!==null?n:yc,n(o,s)&&e.ref===t.ref)return Ui(e,t,a)}return t.flags|=1,e=Ii(r,s),e.ref=t.ref,e.return=t,t.child=e}function $N(e,t,n,s,a){if(e!==null){var r=e.memoizedProps;if(yc(r,s)&&e.ref===t.ref)if(fn=!1,t.pendingProps=s=r,sv(e,a))e.flags&131072&&(fn=!0);else return t.lanes=e.lanes,Ui(e,t,a)}return rg(e,t,n,s,a)}function LN(e,t,n){var s=t.pendingProps,a=s.children,r=e!==null?e.memoizedState:null;if(s.mode==="hidden"){if(t.flags&128){if(s=r!==null?r.baseLanes|n:n,e!==null){for(a=t.child=e.child,r=0;a!==null;)r=r|a.lanes|a.childLanes,a=a.sibling;t.childLanes=r&~s}else t.childLanes=0,t.child=null;return Uy(e,t,s,n)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ju(t,r!==null?r.cachePool:null),r!==null?Ay(t,r):eg(),EN(t);else return t.lanes=t.childLanes=536870912,Uy(e,t,r!==null?r.baseLanes|n:n,n)}else r!==null?(ju(t,r.cachePool),Ay(t,r),da(),t.memoizedState=null):(e!==null&&ju(t,null),eg(),da());return vn(e,t,a,n),t.child}function Uy(e,t,n,s){var a=Vx();return a=a===null?null:{parent:an._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ju(t,null),eg(),EN(t),e!==null&&sd(e,t,s,!0),null}function Su(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(le(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function rg(e,t,n,s,a){return yr(t),n=Fx(e,t,n,s,void 0,a),s=qx(),e!==null&&!fn?(Yx(e,t,a),Ui(e,t,a)):(ct&&s&&Ix(t),t.flags|=1,vn(e,t,n,a),t.child)}function By(e,t,n,s,a,r){return yr(t),t.updateQueue=null,n=K0(t,s,n,a),X0(e),s=qx(),e!==null&&!fn?(Yx(e,t,r),Ui(e,t,r)):(ct&&s&&Ix(t),t.flags|=1,vn(e,t,n,r),t.child)}function Wy(e,t,n,s,a){if(yr(t),t.stateNode===null){var r=po,o=n.contextType;typeof o=="object"&&o!==null&&(r=Rn(o)),r=new n(s,r),t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=ig,t.stateNode=r,r._reactInternals=t,r=t.stateNode,r.props=s,r.state=t.memoizedState,r.refs={},Ux(t),o=n.contextType,r.context=typeof o=="object"&&o!==null?Rn(o):po,r.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(Om(t,n,o,s),r.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(o=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),o!==r.state&&ig.enqueueReplaceState(r,r.state,null),tc(t,s,r,a),ec(),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){r=t.stateNode;var l=t.memoizedProps,c=_r(n,l);r.props=c;var d=r.context,h=n.contextType;o=po,typeof h=="object"&&h!==null&&(o=Rn(h));var f=n.getDerivedStateFromProps;h=typeof f=="function"||typeof r.getSnapshotBeforeUpdate=="function",l=t.pendingProps!==l,h||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(l||d!==o)&&Iy(t,r,s,o),oa=!1;var m=t.memoizedState;r.state=m,tc(t,s,r,a),ec(),d=t.memoizedState,l||m!==d||oa?(typeof f=="function"&&(Om(t,n,f,s),d=t.memoizedState),(c=oa||Py(t,n,c,s,m,d,o))?(h||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount()),typeof r.componentDidMount=="function"&&(t.flags|=4194308)):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=d),r.props=s,r.state=d,r.context=o,s=c):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{r=t.stateNode,Qp(e,t),o=t.memoizedProps,h=_r(n,o),r.props=h,f=t.pendingProps,m=r.context,d=n.contextType,c=po,typeof d=="object"&&d!==null&&(c=Rn(d)),l=n.getDerivedStateFromProps,(d=typeof l=="function"||typeof r.getSnapshotBeforeUpdate=="function")||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(o!==f||m!==c)&&Iy(t,r,s,c),oa=!1,m=t.memoizedState,r.state=m,tc(t,s,r,a),ec();var p=t.memoizedState;o!==f||m!==p||oa||e!==null&&e.dependencies!==null&&Qu(e.dependencies)?(typeof l=="function"&&(Om(t,n,l,s),p=t.memoizedState),(h=oa||Py(t,n,h,s,m,p,c)||e!==null&&e.dependencies!==null&&Qu(e.dependencies))?(d||typeof r.UNSAFE_componentWillUpdate!="function"&&typeof r.componentWillUpdate!="function"||(typeof r.componentWillUpdate=="function"&&r.componentWillUpdate(s,p,c),typeof r.UNSAFE_componentWillUpdate=="function"&&r.UNSAFE_componentWillUpdate(s,p,c)),typeof r.componentDidUpdate=="function"&&(t.flags|=4),typeof r.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof r.componentDidUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=p),r.props=s,r.state=p,r.context=c,s=h):(typeof r.componentDidUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),s=!1)}return r=s,Su(e,t),s=(t.flags&128)!==0,r||s?(r=t.stateNode,n=s&&typeof n.getDerivedStateFromError!="function"?null:r.render(),t.flags|=1,e!==null&&s?(t.child=Ho(t,e.child,null,a),t.child=Ho(t,null,n,a)):vn(e,t,n,a),t.memoizedState=r.state,e=t.child):e=Ui(e,t,a),e}function Fy(e,t,n,s){return nd(),t.flags|=256,vn(e,t,n,s),t.child}var zm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Mm(e){return{baseLanes:e,cachePool:B0()}}function $m(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Cs),e}function PN(e,t,n){var s=t.pendingProps,a=!1,r=(t.flags&128)!==0,o;if((o=r)||(o=e!==null&&e.memoizedState===null?!1:(rn.current&2)!==0),o&&(a=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(ct){if(a?ca(t):da(),ct){var l=Wt,c;if(c=l){e:{for(c=l,l=ni;c.nodeType!==8;){if(!l){l=null;break e}if(c=Us(c.nextSibling),c===null){l=null;break e}}l=c}l!==null?(t.memoizedState={dehydrated:l,treeContext:cr!==null?{id:zi,overflow:Mi}:null,retryLane:536870912,hydrationErrors:null},c=fs(18,null,null,0),c.stateNode=l,c.return=t,t.child=c,Gn=t,Wt=null,c=!0):c=!1}c||br(t)}if(l=t.memoizedState,l!==null&&(l=l.dehydrated,l!==null))return yg(l)?t.lanes=32:t.lanes=536870912,null;Li(t)}return l=s.children,s=s.fallback,a?(da(),a=t.mode,l=rh({mode:"hidden",children:l},a),s=lr(s,a,n,null),l.return=t,s.return=t,l.sibling=s,t.child=l,a=t.child,a.memoizedState=Mm(n),a.childLanes=$m(e,o,n),t.memoizedState=zm,s):(ca(t),og(t,l))}if(c=e.memoizedState,c!==null&&(l=c.dehydrated,l!==null)){if(r)t.flags&256?(ca(t),t.flags&=-257,t=Lm(e,t,n)):t.memoizedState!==null?(da(),t.child=e.child,t.flags|=128,t=null):(da(),a=s.fallback,l=t.mode,s=rh({mode:"visible",children:s.children},l),a=lr(a,l,n,null),a.flags|=2,s.return=t,a.return=t,s.sibling=a,t.child=s,Ho(t,e.child,null,n),s=t.child,s.memoizedState=Mm(n),s.childLanes=$m(e,o,n),t.memoizedState=zm,t=a);else if(ca(t),yg(l)){if(o=l.nextSibling&&l.nextSibling.dataset,o)var d=o.dgst;o=d,s=Error(le(419)),s.stack="",s.digest=o,wc({value:s,source:null,stack:null}),t=Lm(e,t,n)}else if(fn||sd(e,t,n,!1),o=(n&e.childLanes)!==0,fn||o){if(o=kt,o!==null&&(s=n&-n,s=s&42?1:Cx(s),s=s&(o.suspendedLanes|n)?0:s,s!==0&&s!==c.retryLane))throw c.retryLane=s,Jo(e,s),xs(o,e,s),MN;l.data==="$?"||fg(),t=Lm(e,t,n)}else l.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,Wt=Us(l.nextSibling),Gn=t,ct=!0,dr=null,ni=!1,e!==null&&(js[Ns++]=zi,js[Ns++]=Mi,js[Ns++]=cr,zi=e.id,Mi=e.overflow,cr=t),t=og(t,s.children),t.flags|=4096);return t}return a?(da(),a=s.fallback,l=t.mode,c=e.child,d=c.sibling,s=Ii(c,{mode:"hidden",children:s.children}),s.subtreeFlags=c.subtreeFlags&65011712,d!==null?a=Ii(d,a):(a=lr(a,l,n,null),a.flags|=2),a.return=t,s.return=t,s.sibling=a,t.child=s,s=a,a=t.child,l=e.child.memoizedState,l===null?l=Mm(n):(c=l.cachePool,c!==null?(d=an._currentValue,c=c.parent!==d?{parent:d,pool:d}:c):c=B0(),l={baseLanes:l.baseLanes|n,cachePool:c}),a.memoizedState=l,a.childLanes=$m(e,o,n),t.memoizedState=zm,s):(ca(t),n=e.child,e=n.sibling,n=Ii(n,{mode:"visible",children:s.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function og(e,t){return t=rh({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function rh(e,t){return e=fs(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function Lm(e,t,n){return Ho(t,e.child,null,n),e=og(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function qy(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Yp(e.return,t,n)}function Pm(e,t,n,s,a){var r=e.memoizedState;r===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:a}:(r.isBackwards=t,r.rendering=null,r.renderingStartTime=0,r.last=s,r.tail=n,r.tailMode=a)}function IN(e,t,n){var s=t.pendingProps,a=s.revealOrder,r=s.tail;if(vn(e,t,s.children,n),s=rn.current,s&2)s=s&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&qy(e,n,t);else if(e.tag===19)qy(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}switch(Pt(rn,s),a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&sh(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Pm(t,!1,a,n,r);break;case"backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&sh(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Pm(t,!0,n,null,r);break;case"together":Pm(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ui(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),$a|=t.lanes,!(n&t.childLanes))if(e!==null){if(sd(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(le(153));if(t.child!==null){for(e=t.child,n=Ii(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ii(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function sv(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Qu(e)))}function UT(e,t,n){switch(t.tag){case 3:Bu(t,t.stateNode.containerInfo),la(t,an,e.memoizedState.cache),nd();break;case 27:case 5:$p(t);break;case 4:Bu(t,t.stateNode.containerInfo);break;case 10:la(t,t.type,t.memoizedProps.value);break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(ca(t),t.flags|=128,null):n&t.child.childLanes?PN(e,t,n):(ca(t),e=Ui(e,t,n),e!==null?e.sibling:null);ca(t);break;case 19:var a=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(sd(e,t,n,!1),s=(n&t.childLanes)!==0),a){if(s)return IN(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Pt(rn,rn.current),s)break;return null;case 22:case 23:return t.lanes=0,LN(e,t,n);case 24:la(t,an,e.memoizedState.cache)}return Ui(e,t,n)}function GN(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)fn=!0;else{if(!sv(e,n)&&!(t.flags&128))return fn=!1,UT(e,t,n);fn=!!(e.flags&131072)}else fn=!1,ct&&t.flags&1048576&&V0(t,Zu,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var s=t.elementType,a=s._init;if(s=a(s._payload),t.type=s,typeof s=="function")Px(s)?(e=_r(s,e),t.tag=1,t=Wy(null,t,s,e,n)):(t.tag=0,t=rg(null,t,s,e,n));else{if(s!=null){if(a=s.$$typeof,a===Nx){t.tag=11,t=Hy(null,t,s,e,n);break e}else if(a===kx){t.tag=14,t=Vy(null,t,s,e,n);break e}}throw t=zp(s)||s,Error(le(306,t,""))}}return t;case 0:return rg(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,a=_r(s,t.pendingProps),Wy(e,t,s,a,n);case 3:e:{if(Bu(t,t.stateNode.containerInfo),e===null)throw Error(le(387));s=t.pendingProps;var r=t.memoizedState;a=r.element,Qp(e,t),tc(t,s,null,n);var o=t.memoizedState;if(s=o.cache,la(t,an,s),s!==r.cache&&Xp(t,[an],n,!0),ec(),s=o.element,r.isDehydrated)if(r={element:s,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=r,t.memoizedState=r,t.flags&256){t=Fy(e,t,s,n);break e}else if(s!==a){a=Ss(Error(le(424)),t),wc(a),t=Fy(e,t,s,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Wt=Us(e.firstChild),Gn=t,ct=!0,dr=null,ni=!0,n=DN(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(nd(),s===a){t=Ui(e,t,n);break e}vn(e,t,s,n)}t=t.child}return t;case 26:return Su(e,t),e===null?(n=dw(t.type,null,t.pendingProps,null))?t.memoizedState=n:ct||(n=t.type,e=t.pendingProps,s=fh(_a.current).createElement(n),s[An]=t,s[ts]=e,yn(s,n,e),hn(s),t.stateNode=s):t.memoizedState=dw(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return $p(t),e===null&&ct&&(s=t.stateNode=Sk(t.type,t.pendingProps,_a.current),Gn=t,ni=!0,a=Wt,Va(t.type)?(wg=a,Wt=Us(s.firstChild)):Wt=a),vn(e,t,t.pendingProps.children,n),Su(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ct&&((a=s=Wt)&&(s=x2(s,t.type,t.pendingProps,ni),s!==null?(t.stateNode=s,Gn=t,Wt=Us(s.firstChild),ni=!1,a=!0):a=!1),a||br(t)),$p(t),a=t.type,r=t.pendingProps,o=e!==null?e.memoizedProps:null,s=r.children,vg(a,r)?s=null:o!==null&&vg(a,o)&&(t.flags|=32),t.memoizedState!==null&&(a=Fx(e,t,MT,null,null,n),Cc._currentValue=a),Su(e,t),vn(e,t,s,n),t.child;case 6:return e===null&&ct&&((e=n=Wt)&&(n=v2(n,t.pendingProps,ni),n!==null?(t.stateNode=n,Gn=t,Wt=null,e=!0):e=!1),e||br(t)),null;case 13:return PN(e,t,n);case 4:return Bu(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Ho(t,null,s,n):vn(e,t,s,n),t.child;case 11:return Hy(e,t,t.type,t.pendingProps,n);case 7:return vn(e,t,t.pendingProps,n),t.child;case 8:return vn(e,t,t.pendingProps.children,n),t.child;case 12:return vn(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,la(t,t.type,s.value),vn(e,t,s.children,n),t.child;case 9:return a=t.type._context,s=t.pendingProps.children,yr(t),a=Rn(a),s=s(a),t.flags|=1,vn(e,t,s,n),t.child;case 14:return Vy(e,t,t.type,t.pendingProps,n);case 15:return $N(e,t,t.type,t.pendingProps,n);case 19:return IN(e,t,n);case 31:return s=t.pendingProps,n=t.mode,s={mode:s.mode,children:s.children},e===null?(n=rh(s,n),n.ref=t.ref,t.child=n,n.return=t,t=n):(n=Ii(e.child,s),n.ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return LN(e,t,n);case 24:return yr(t),s=Rn(an),e===null?(a=Vx(),a===null&&(a=kt,r=Hx(),a.pooledCache=r,r.refCount++,r!==null&&(a.pooledCacheLanes|=n),a=r),t.memoizedState={parent:s,cache:a},Ux(t),la(t,an,a)):(e.lanes&n&&(Qp(e,t),tc(t,null,null,n),ec()),a=e.memoizedState,r=t.memoizedState,a.parent!==s?(a={parent:s,cache:s},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),la(t,an,s)):(s=r.cache,la(t,an,s),s!==a.cache&&Xp(t,[an],n,!0))),vn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(le(156,t.tag))}function Ci(e){e.flags|=4}function Yy(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Ek(t)){if(t=zs.current,t!==null&&((st&4194048)===st?ui!==null:(st&62914560)!==st&&!(st&536870912)||t!==ui))throw Ql=Zp,W0;e.flags|=8192}}function Hd(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?h0():536870912,e.lanes|=t,Vo|=t)}function Cl(e,t){if(!ct)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Gt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,s|=a.subtreeFlags&65011712,s|=a.flags&65011712,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,s|=a.subtreeFlags,s|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function BT(e,t,n){var s=t.pendingProps;switch(Gx(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gt(t),null;case 1:return Gt(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Gi(an),Mo(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(kl(t)?Ci(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ny())),Gt(t),null;case 26:return n=t.memoizedState,e===null?(Ci(t),n!==null?(Gt(t),Yy(t,n)):(Gt(t),t.flags&=-16777217)):n?n!==e.memoizedState?(Ci(t),Gt(t),Yy(t,n)):(Gt(t),t.flags&=-16777217):(e.memoizedProps!==s&&Ci(t),Gt(t),t.flags&=-16777217),null;case 27:Wu(t),n=_a.current;var a=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Ci(t);else{if(!s){if(t.stateNode===null)throw Error(le(166));return Gt(t),null}e=ci.current,kl(t)?_y(t):(e=Sk(a,s,n),t.stateNode=e,Ci(t))}return Gt(t),null;case 5:if(Wu(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Ci(t);else{if(!s){if(t.stateNode===null)throw Error(le(166));return Gt(t),null}if(e=ci.current,kl(t))_y(t);else{switch(a=fh(_a.current),e){case 1:e=a.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=a.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=a.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=a.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild);break;case"select":e=typeof s.is=="string"?a.createElement("select",{is:s.is}):a.createElement("select"),s.multiple?e.multiple=!0:s.size&&(e.size=s.size);break;default:e=typeof s.is=="string"?a.createElement(n,{is:s.is}):a.createElement(n)}}e[An]=t,e[ts]=s;e:for(a=t.child;a!==null;){if(a.tag===5||a.tag===6)e.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=e;e:switch(yn(e,n,s),n){case"button":case"input":case"select":case"textarea":e=!!s.autoFocus;break e;case"img":e=!0;break e;default:e=!1}e&&Ci(t)}}return Gt(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Ci(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(le(166));if(e=_a.current,kl(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,a=Gn,a!==null)switch(a.tag){case 27:case 5:s=a.memoizedProps}e[An]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||jk(e.nodeValue,n)),e||br(t)}else e=fh(e).createTextNode(s),e[An]=t,t.stateNode=e}return Gt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=kl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!a)throw Error(le(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(le(317));a[An]=t}else nd(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Gt(t),a=!1}else a=Ny(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Li(t),t):(Li(t),null)}if(Li(t),t.flags&128)return t.lanes=n,t;if(n=s!==null,e=e!==null&&e.memoizedState!==null,n){s=t.child,a=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(a=s.alternate.memoizedState.cachePool.pool);var r=null;s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==a&&(s.flags|=2048)}return n!==e&&n&&(t.child.flags|=8192),Hd(t,t.updateQueue),Gt(t),null;case 4:return Mo(),e===null&&uv(t.stateNode.containerInfo),Gt(t),null;case 10:return Gi(t.type),Gt(t),null;case 19:if(mn(rn),a=t.memoizedState,a===null)return Gt(t),null;if(s=(t.flags&128)!==0,r=a.rendering,r===null)if(s)Cl(a,!1);else{if(Ft!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(r=sh(e),r!==null){for(t.flags|=128,Cl(a,!1),e=r.updateQueue,t.updateQueue=e,Hd(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)H0(n,e),n=n.sibling;return Pt(rn,rn.current&1|2),t.child}e=e.sibling}a.tail!==null&&di()>lh&&(t.flags|=128,s=!0,Cl(a,!1),t.lanes=4194304)}else{if(!s)if(e=sh(r),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Hd(t,e),Cl(a,!0),a.tail===null&&a.tailMode==="hidden"&&!r.alternate&&!ct)return Gt(t),null}else 2*di()-a.renderingStartTime>lh&&n!==536870912&&(t.flags|=128,s=!0,Cl(a,!1),t.lanes=4194304);a.isBackwards?(r.sibling=t.child,t.child=r):(e=a.last,e!==null?e.sibling=r:t.child=r,a.last=r)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=di(),t.sibling=null,e=rn.current,Pt(rn,s?e&1|2:e&1),t):(Gt(t),null);case 22:case 23:return Li(t),Bx(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?n&536870912&&!(t.flags&128)&&(Gt(t),t.subtreeFlags&6&&(t.flags|=8192)):Gt(t),n=t.updateQueue,n!==null&&Hd(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&mn(ur),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gi(an),Gt(t),null;case 25:return null;case 30:return null}throw Error(le(156,t.tag))}function WT(e,t){switch(Gx(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gi(an),Mo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Wu(t),null;case 13:if(Li(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(le(340));nd()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return mn(rn),null;case 4:return Mo(),null;case 10:return Gi(t.type),null;case 22:case 23:return Li(t),Bx(),e!==null&&mn(ur),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gi(an),null;case 25:return null;default:return null}}function HN(e,t){switch(Gx(t),t.tag){case 3:Gi(an),Mo();break;case 26:case 27:case 5:Wu(t);break;case 4:Mo();break;case 13:Li(t);break;case 19:mn(rn);break;case 10:Gi(t.type);break;case 22:case 23:Li(t),Bx(),e!==null&&mn(ur);break;case 24:Gi(an)}}function ld(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var a=s.next;n=a;do{if((n.tag&e)===e){s=void 0;var r=n.create,o=n.inst;s=r(),o.destroy=s}n=n.next}while(n!==a)}}catch(l){bt(t,t.return,l)}}function Ma(e,t,n){try{var s=t.updateQueue,a=s!==null?s.lastEffect:null;if(a!==null){var r=a.next;s=r;do{if((s.tag&e)===e){var o=s.inst,l=o.destroy;if(l!==void 0){o.destroy=void 0,a=t;var c=n,d=l;try{d()}catch(h){bt(a,c,h)}}}s=s.next}while(s!==r)}}catch(h){bt(t,t.return,h)}}function VN(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Y0(t,n)}catch(s){bt(e,e.return,s)}}}function UN(e,t,n){n.props=_r(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){bt(e,t,s)}}function sc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(a){bt(e,t,a)}}function ri(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(a){bt(e,t,a)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){bt(e,t,a)}else n.current=null}function BN(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(a){bt(e,e.return,a)}}function Im(e,t,n){try{var s=e.stateNode;h2(s,e.type,n,t),s[ts]=t}catch(a){bt(e,e.return,a)}}function WN(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Va(e.type)||e.tag===4}function Gm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||WN(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Va(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function lg(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=af));else if(s!==4&&(s===27&&Va(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(lg(e,t,n),e=e.sibling;e!==null;)lg(e,t,n),e=e.sibling}function oh(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&Va(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(oh(e,t,n),e=e.sibling;e!==null;)oh(e,t,n),e=e.sibling}function FN(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);yn(t,s,n),t[An]=e,t[ts]=n}catch(r){bt(e,e.return,r)}}var Ti=!1,Yt=!1,Hm=!1,Xy=typeof WeakSet=="function"?WeakSet:Set,un=null;function FT(e,t){if(e=e.containerInfo,gg=xh,e=O0(e),Mx(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var a=s.anchorOffset,r=s.focusNode;s=s.focusOffset;try{n.nodeType,r.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,d=0,h=0,f=e,m=null;t:for(;;){for(var p;f!==n||a!==0&&f.nodeType!==3||(l=o+a),f!==r||s!==0&&f.nodeType!==3||(c=o+s),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)m=f,f=p;for(;;){if(f===e)break t;if(m===n&&++d===a&&(l=o),m===r&&++h===s&&(c=o),(p=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(xg={focusedElem:e,selectionRange:n},xh=!1,un=t;un!==null;)if(t=un,e=t.child,(t.subtreeFlags&1024)!==0&&e!==null)e.return=t,un=e;else for(;un!==null;){switch(t=un,r=t.alternate,e=t.flags,t.tag){case 0:break;case 11:case 15:break;case 1:if(e&1024&&r!==null){e=void 0,n=t,a=r.memoizedProps,r=r.memoizedState,s=n.stateNode;try{var y=_r(n.type,a,n.elementType===n.type);e=s.getSnapshotBeforeUpdate(y,r),s.__reactInternalSnapshotBeforeUpdate=e}catch(g){bt(n,n.return,g)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)bg(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":bg(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(le(163))}if(e=t.sibling,e!==null){e.return=t.return,un=e;break}un=t.return}}function qN(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:Ji(e,n),s&4&&ld(5,n);break;case 1:if(Ji(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){bt(n,n.return,o)}else{var a=_r(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){bt(n,n.return,o)}}s&64&&VN(n),s&512&&sc(n,n.return);break;case 3:if(Ji(e,n),s&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Y0(e,t)}catch(o){bt(n,n.return,o)}}break;case 27:t===null&&s&4&&FN(n);case 26:case 5:Ji(e,n),t===null&&s&4&&BN(n),s&512&&sc(n,n.return);break;case 12:Ji(e,n);break;case 13:Ji(e,n),s&4&&KN(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=t2.bind(null,n),b2(e,n))));break;case 22:if(s=n.memoizedState!==null||Ti,!s){t=t!==null&&t.memoizedState!==null||Yt,a=Ti;var r=Yt;Ti=s,(Yt=t)&&!r?ia(e,n,(n.subtreeFlags&8772)!==0):Ji(e,n),Ti=a,Yt=r}break;case 30:break;default:Ji(e,n)}}function YN(e){var t=e.alternate;t!==null&&(e.alternate=null,YN(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ex(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var $t=null,Xn=!1;function Di(e,t,n){for(n=n.child;n!==null;)XN(e,t,n),n=n.sibling}function XN(e,t,n){if(ms&&typeof ms.onCommitFiberUnmount=="function")try{ms.onCommitFiberUnmount(Zc,n)}catch{}switch(n.tag){case 26:Yt||ri(n,t),Di(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Yt||ri(n,t);var s=$t,a=Xn;Va(n.type)&&($t=n.stateNode,Xn=!1),Di(e,t,n),oc(n.stateNode),$t=s,Xn=a;break;case 5:Yt||ri(n,t);case 6:if(s=$t,a=Xn,$t=null,Di(e,t,n),$t=s,Xn=a,$t!==null)if(Xn)try{($t.nodeType===9?$t.body:$t.nodeName==="HTML"?$t.ownerDocument.body:$t).removeChild(n.stateNode)}catch(r){bt(n,t,r)}else try{$t.removeChild(n.stateNode)}catch(r){bt(n,t,r)}break;case 18:$t!==null&&(Xn?(e=$t,ow(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Ac(e)):ow($t,n.stateNode));break;case 4:s=$t,a=Xn,$t=n.stateNode.containerInfo,Xn=!0,Di(e,t,n),$t=s,Xn=a;break;case 0:case 11:case 14:case 15:Yt||Ma(2,n,t),Yt||Ma(4,n,t),Di(e,t,n);break;case 1:Yt||(ri(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&UN(n,t,s)),Di(e,t,n);break;case 21:Di(e,t,n);break;case 22:Yt=(s=Yt)||n.memoizedState!==null,Di(e,t,n),Yt=s;break;default:Di(e,t,n)}}function KN(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ac(e)}catch(n){bt(t,t.return,n)}}function qT(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Xy),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Xy),t;default:throw Error(le(435,e.tag))}}function Vm(e,t){var n=qT(e);t.forEach(function(s){var a=n2.bind(null,e,s);n.has(s)||(n.add(s),s.then(a,a))})}function ls(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var a=n[s],r=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 27:if(Va(l.type)){$t=l.stateNode,Xn=!1;break e}break;case 5:$t=l.stateNode,Xn=!1;break e;case 3:case 4:$t=l.stateNode.containerInfo,Xn=!0;break e}l=l.return}if($t===null)throw Error(le(160));XN(r,o,a),$t=null,Xn=!1,r=a.alternate,r!==null&&(r.return=null),a.return=null}if(t.subtreeFlags&13878)for(t=t.child;t!==null;)ZN(t,e),t=t.sibling}var Gs=null;function ZN(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ls(t,e),cs(e),s&4&&(Ma(3,e,e.return),ld(3,e),Ma(5,e,e.return));break;case 1:ls(t,e),cs(e),s&512&&(Yt||n===null||ri(n,n.return)),s&64&&Ti&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?s:n.concat(s))));break;case 26:var a=Gs;if(ls(t,e),cs(e),s&512&&(Yt||n===null||ri(n,n.return)),s&4){var r=n!==null?n.memoizedState:null;if(s=e.memoizedState,n===null)if(s===null)if(e.stateNode===null){e:{s=e.type,n=e.memoizedProps,a=a.ownerDocument||a;t:switch(s){case"title":r=a.getElementsByTagName("title")[0],(!r||r[ed]||r[An]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))&&(r=a.createElement(s),a.head.insertBefore(r,a.querySelector("head > title"))),yn(r,s,n),r[An]=e,hn(r),s=r;break e;case"link":var o=hw("link","href",a).get(s+(n.href||""));if(o){for(var l=0;l<o.length;l++)if(r=o[l],r.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&r.getAttribute("rel")===(n.rel==null?null:n.rel)&&r.getAttribute("title")===(n.title==null?null:n.title)&&r.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(l,1);break t}}r=a.createElement(s),yn(r,s,n),a.head.appendChild(r);break;case"meta":if(o=hw("meta","content",a).get(s+(n.content||""))){for(l=0;l<o.length;l++)if(r=o[l],r.getAttribute("content")===(n.content==null?null:""+n.content)&&r.getAttribute("name")===(n.name==null?null:n.name)&&r.getAttribute("property")===(n.property==null?null:n.property)&&r.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute("charset")===(n.charSet==null?null:n.charSet)){o.splice(l,1);break t}}r=a.createElement(s),yn(r,s,n),a.head.appendChild(r);break;default:throw Error(le(468,s))}r[An]=e,hn(r),s=r}e.stateNode=s}else fw(a,e.type,e.stateNode);else e.stateNode=uw(a,s,e.memoizedProps);else r!==s?(r===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):r.count--,s===null?fw(a,e.type,e.stateNode):uw(a,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Im(e,e.memoizedProps,n.memoizedProps)}break;case 27:ls(t,e),cs(e),s&512&&(Yt||n===null||ri(n,n.return)),n!==null&&s&4&&Im(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ls(t,e),cs(e),s&512&&(Yt||n===null||ri(n,n.return)),e.flags&32){a=e.stateNode;try{Lo(a,"")}catch(p){bt(e,e.return,p)}}s&4&&e.stateNode!=null&&(a=e.memoizedProps,Im(e,a,n!==null?n.memoizedProps:a)),s&1024&&(Hm=!0);break;case 6:if(ls(t,e),cs(e),s&4){if(e.stateNode===null)throw Error(le(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(p){bt(e,e.return,p)}}break;case 3:if(Eu=null,a=Gs,Gs=mh(t.containerInfo),ls(t,e),Gs=a,cs(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Ac(t.containerInfo)}catch(p){bt(e,e.return,p)}Hm&&(Hm=!1,QN(e));break;case 4:s=Gs,Gs=mh(e.stateNode.containerInfo),ls(t,e),cs(e),Gs=s;break;case 12:ls(t,e),cs(e);break;case 13:ls(t,e),cs(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(lv=di()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Vm(e,s)));break;case 22:a=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,d=Ti,h=Yt;if(Ti=d||a,Yt=h||c,ls(t,e),Yt=h,Ti=d,cs(e),s&8192)e:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||c||Ti||Yt||ir(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(r=c.stateNode,a)o=r.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{l=c.stateNode;var f=c.memoizedProps.style,m=f!=null&&f.hasOwnProperty("display")?f.display:null;l.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(p){bt(c,c.return,p)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=a?"":c.memoizedProps}catch(p){bt(c,c.return,p)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(n=s.retryQueue,n!==null&&(s.retryQueue=null,Vm(e,n))));break;case 19:ls(t,e),cs(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Vm(e,s)));break;case 30:break;case 21:break;default:ls(t,e),cs(e)}}function cs(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(WN(s)){n=s;break}s=s.return}if(n==null)throw Error(le(160));switch(n.tag){case 27:var a=n.stateNode,r=Gm(e);oh(e,r,a);break;case 5:var o=n.stateNode;n.flags&32&&(Lo(o,""),n.flags&=-33);var l=Gm(e);oh(e,l,o);break;case 3:case 4:var c=n.stateNode.containerInfo,d=Gm(e);lg(e,d,c);break;default:throw Error(le(161))}}catch(h){bt(e,e.return,h)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function QN(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;QN(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ji(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)qN(e,t.alternate,t),t=t.sibling}function ir(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ma(4,t,t.return),ir(t);break;case 1:ri(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&UN(t,t.return,n),ir(t);break;case 27:oc(t.stateNode);case 26:case 5:ri(t,t.return),ir(t);break;case 22:t.memoizedState===null&&ir(t);break;case 30:ir(t);break;default:ir(t)}e=e.sibling}}function ia(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,a=e,r=t,o=r.flags;switch(r.tag){case 0:case 11:case 15:ia(a,r,n),ld(4,r);break;case 1:if(ia(a,r,n),s=r,a=s.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(d){bt(s,s.return,d)}if(s=r,a=s.updateQueue,a!==null){var l=s.stateNode;try{var c=a.shared.hiddenCallbacks;if(c!==null)for(a.shared.hiddenCallbacks=null,a=0;a<c.length;a++)q0(c[a],l)}catch(d){bt(s,s.return,d)}}n&&o&64&&VN(r),sc(r,r.return);break;case 27:FN(r);case 26:case 5:ia(a,r,n),n&&s===null&&o&4&&BN(r),sc(r,r.return);break;case 12:ia(a,r,n);break;case 13:ia(a,r,n),n&&o&4&&KN(a,r);break;case 22:r.memoizedState===null&&ia(a,r,n),sc(r,r.return);break;case 30:break;default:ia(a,r,n)}t=t.sibling}}function iv(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&id(n))}function av(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&id(e))}function Qs(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)JN(e,t,n,s),t=t.sibling}function JN(e,t,n,s){var a=t.flags;switch(t.tag){case 0:case 11:case 15:Qs(e,t,n,s),a&2048&&ld(9,t);break;case 1:Qs(e,t,n,s);break;case 3:Qs(e,t,n,s),a&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&id(e)));break;case 12:if(a&2048){Qs(e,t,n,s),e=t.stateNode;try{var r=t.memoizedProps,o=r.id,l=r.onPostCommit;typeof l=="function"&&l(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){bt(t,t.return,c)}}else Qs(e,t,n,s);break;case 13:Qs(e,t,n,s);break;case 23:break;case 22:r=t.stateNode,o=t.alternate,t.memoizedState!==null?r._visibility&2?Qs(e,t,n,s):ic(e,t):r._visibility&2?Qs(e,t,n,s):(r._visibility|=2,no(e,t,n,s,(t.subtreeFlags&10256)!==0)),a&2048&&iv(o,t);break;case 24:Qs(e,t,n,s),a&2048&&av(t.alternate,t);break;default:Qs(e,t,n,s)}}function no(e,t,n,s,a){for(a=a&&(t.subtreeFlags&10256)!==0,t=t.child;t!==null;){var r=e,o=t,l=n,c=s,d=o.flags;switch(o.tag){case 0:case 11:case 15:no(r,o,l,c,a),ld(8,o);break;case 23:break;case 22:var h=o.stateNode;o.memoizedState!==null?h._visibility&2?no(r,o,l,c,a):ic(r,o):(h._visibility|=2,no(r,o,l,c,a)),a&&d&2048&&iv(o.alternate,o);break;case 24:no(r,o,l,c,a),a&&d&2048&&av(o.alternate,o);break;default:no(r,o,l,c,a)}t=t.sibling}}function ic(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,s=t,a=s.flags;switch(s.tag){case 22:ic(n,s),a&2048&&iv(s.alternate,s);break;case 24:ic(n,s),a&2048&&av(s.alternate,s);break;default:ic(n,s)}t=t.sibling}}var Gl=8192;function Vr(e){if(e.subtreeFlags&Gl)for(e=e.child;e!==null;)ek(e),e=e.sibling}function ek(e){switch(e.tag){case 26:Vr(e),e.flags&Gl&&e.memoizedState!==null&&T2(Gs,e.memoizedState,e.memoizedProps);break;case 5:Vr(e);break;case 3:case 4:var t=Gs;Gs=mh(e.stateNode.containerInfo),Vr(e),Gs=t;break;case 22:e.memoizedState===null&&(t=e.alternate,t!==null&&t.memoizedState!==null?(t=Gl,Gl=16777216,Vr(e),Gl=t):Vr(e));break;default:Vr(e)}}function tk(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Dl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];un=s,sk(s,e)}tk(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)nk(e),e=e.sibling}function nk(e){switch(e.tag){case 0:case 11:case 15:Dl(e),e.flags&2048&&Ma(9,e,e.return);break;case 3:Dl(e);break;case 12:Dl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Cu(e)):Dl(e);break;default:Dl(e)}}function Cu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];un=s,sk(s,e)}tk(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ma(8,t,t.return),Cu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Cu(t));break;default:Cu(t)}e=e.sibling}}function sk(e,t){for(;un!==null;){var n=un;switch(n.tag){case 0:case 11:case 15:Ma(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var s=n.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:id(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,un=s;else e:for(n=e;un!==null;){s=un;var a=s.sibling,r=s.return;if(YN(s),s===n){un=null;break e}if(a!==null){a.return=r,un=a;break e}un=r}}}var YT={getCacheForType:function(e){var t=Rn(an),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n}},XT=typeof WeakMap=="function"?WeakMap:Map,pt=0,kt=null,et=null,st=0,mt=0,us=null,pa=!1,el=!1,rv=!1,Bi=0,Ft=0,$a=0,hr=0,ov=0,Cs=0,Vo=0,ac=null,Kn=null,cg=!1,lv=0,lh=1/0,ch=null,ka=null,bn=0,Sa=null,Uo=null,Eo=0,dg=0,ug=null,ik=null,rc=0,hg=null;function gs(){if(pt&2&&st!==0)return st&-st;if(Ue.T!==null){var e=Po;return e!==0?e:dv()}return p0()}function ak(){Cs===0&&(Cs=!(st&536870912)||ct?u0():536870912);var e=zs.current;return e!==null&&(e.flags|=32),Cs}function xs(e,t,n){(e===kt&&(mt===2||mt===9)||e.cancelPendingCommit!==null)&&(Bo(e,0),ga(e,st,Cs,!1)),Jc(e,n),(!(pt&2)||e!==kt)&&(e===kt&&(!(pt&2)&&(hr|=n),Ft===4&&ga(e,st,Cs,!1)),yi(e))}function rk(e,t,n){if(pt&6)throw Error(le(327));var s=!n&&(t&124)===0&&(t&e.expiredLanes)===0||Qc(e,t),a=s?QT(e,t):Um(e,t,!0),r=s;do{if(a===0){el&&!s&&ga(e,t,0,!1);break}else{if(n=e.current.alternate,r&&!KT(n)){a=Um(e,t,!1),r=!1;continue}if(a===2){if(r=t,e.errorRecoveryDisabledLanes&r)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var l=e;a=ac;var c=l.current.memoizedState.isDehydrated;if(c&&(Bo(l,o).flags|=256),o=Um(l,o,!1),o!==2){if(rv&&!c){l.errorRecoveryDisabledLanes|=r,hr|=r,a=4;break e}r=Kn,Kn=a,r!==null&&(Kn===null?Kn=r:Kn.push.apply(Kn,r))}a=o}if(r=!1,a!==2)continue}}if(a===1){Bo(e,0),ga(e,t,0,!0);break}e:{switch(s=e,r=a,r){case 0:case 1:throw Error(le(345));case 4:if((t&4194048)!==t)break;case 6:ga(s,t,Cs,!pa);break e;case 2:Kn=null;break;case 3:case 5:break;default:throw Error(le(329))}if((t&62914560)===t&&(a=lv+300-di(),10<a)){if(ga(s,t,Cs,!pa),Wh(s,0,!0)!==0)break e;s.timeoutHandle=kk(Ky.bind(null,s,n,Kn,ch,cg,t,Cs,hr,Vo,pa,r,2,-0,0),a);break e}Ky(s,n,Kn,ch,cg,t,Cs,hr,Vo,pa,r,0,-0,0)}}break}while(!0);yi(e)}function Ky(e,t,n,s,a,r,o,l,c,d,h,f,m,p){if(e.timeoutHandle=-1,f=t.subtreeFlags,(f&8192||(f&16785408)===16785408)&&(Sc={stylesheets:null,count:0,unsuspend:R2},ek(t),f=O2(),f!==null)){e.cancelPendingCommit=f(Qy.bind(null,e,t,r,n,s,a,o,l,c,h,1,m,p)),ga(e,r,o,!d);return}Qy(e,t,r,n,s,a,o,l,c)}function KT(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var s=0;s<n.length;s++){var a=n[s],r=a.getSnapshot;a=a.value;try{if(!bs(r(),a))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ga(e,t,n,s){t&=~ov,t&=~hr,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var a=t;0<a;){var r=31-ps(a),o=1<<r;s[r]=-1,a&=~o}n!==0&&f0(e,n,t)}function tf(){return pt&6?!0:(cd(0),!1)}function cv(){if(et!==null){if(mt===0)var e=et.return;else e=et,$i=Tr=null,Xx(e),Do=null,jc=0,e=et;for(;e!==null;)HN(e.alternate,e),e=e.return;et=null}}function Bo(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,m2(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),cv(),kt=e,et=n=Ii(e.current,null),st=t,mt=0,us=null,pa=!1,el=Qc(e,t),rv=!1,Vo=Cs=ov=hr=$a=Ft=0,Kn=ac=null,cg=!1,t&8&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var a=31-ps(s),r=1<<a;t|=e[a],s&=~r}return Bi=t,Xh(),n}function ok(e,t){Ze=null,Ue.H=nh,t===ad||t===Zh?(t=Dy(),mt=3):t===W0?(t=Dy(),mt=4):mt=t===MN?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,us=t,et===null&&(Ft=1,ah(e,Ss(t,e.current)))}function lk(){var e=Ue.H;return Ue.H=nh,e===null?nh:e}function ck(){var e=Ue.A;return Ue.A=YT,e}function fg(){Ft=4,pa||(st&4194048)!==st&&zs.current!==null||(el=!0),!($a&134217727)&&!(hr&134217727)||kt===null||ga(kt,st,Cs,!1)}function Um(e,t,n){var s=pt;pt|=2;var a=lk(),r=ck();(kt!==e||st!==t)&&(ch=null,Bo(e,t)),t=!1;var o=Ft;e:do try{if(mt!==0&&et!==null){var l=et,c=us;switch(mt){case 8:cv(),o=6;break e;case 3:case 2:case 9:case 6:zs.current===null&&(t=!0);var d=mt;if(mt=0,us=null,vo(e,l,c,d),n&&el){o=0;break e}break;default:d=mt,mt=0,us=null,vo(e,l,c,d)}}ZT(),o=Ft;break}catch(h){ok(e,h)}while(!0);return t&&e.shellSuspendCounter++,$i=Tr=null,pt=s,Ue.H=a,Ue.A=r,et===null&&(kt=null,st=0,Xh()),o}function ZT(){for(;et!==null;)dk(et)}function QT(e,t){var n=pt;pt|=2;var s=lk(),a=ck();kt!==e||st!==t?(ch=null,lh=di()+500,Bo(e,t)):el=Qc(e,t);e:do try{if(mt!==0&&et!==null){t=et;var r=us;t:switch(mt){case 1:mt=0,us=null,vo(e,t,r,1);break;case 2:case 9:if(Cy(r)){mt=0,us=null,Zy(t);break}t=function(){mt!==2&&mt!==9||kt!==e||(mt=7),yi(e)},r.then(t,t);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:Cy(r)?(mt=0,us=null,Zy(t)):(mt=0,us=null,vo(e,t,r,7));break;case 5:var o=null;switch(et.tag){case 26:o=et.memoizedState;case 5:case 27:var l=et;if(!o||Ek(o)){mt=0,us=null;var c=l.sibling;if(c!==null)et=c;else{var d=l.return;d!==null?(et=d,nf(d)):et=null}break t}}mt=0,us=null,vo(e,t,r,5);break;case 6:mt=0,us=null,vo(e,t,r,6);break;case 8:cv(),Ft=6;break e;default:throw Error(le(462))}}JT();break}catch(h){ok(e,h)}while(!0);return $i=Tr=null,Ue.H=s,Ue.A=a,pt=n,et!==null?0:(kt=null,st=0,Xh(),Ft)}function JT(){for(;et!==null&&!wR();)dk(et)}function dk(e){var t=GN(e.alternate,e,Bi);e.memoizedProps=e.pendingProps,t===null?nf(e):et=t}function Zy(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=By(n,t,t.pendingProps,t.type,void 0,st);break;case 11:t=By(n,t,t.pendingProps,t.type.render,t.ref,st);break;case 5:Xx(t);default:HN(n,t),t=et=H0(t,Bi),t=GN(n,t,Bi)}e.memoizedProps=e.pendingProps,t===null?nf(e):et=t}function vo(e,t,n,s){$i=Tr=null,Xx(t),Do=null,jc=0;var a=t.return;try{if(VT(e,a,t,n,st)){Ft=1,ah(e,Ss(n,e.current)),et=null;return}}catch(r){if(a!==null)throw et=a,r;Ft=1,ah(e,Ss(n,e.current)),et=null;return}t.flags&32768?(ct||s===1?e=!0:el||st&536870912?e=!1:(pa=e=!0,(s===2||s===9||s===3||s===6)&&(s=zs.current,s!==null&&s.tag===13&&(s.flags|=16384))),uk(t,e)):nf(t)}function nf(e){var t=e;do{if(t.flags&32768){uk(t,pa);return}e=t.return;var n=BT(t.alternate,t,Bi);if(n!==null){et=n;return}if(t=t.sibling,t!==null){et=t;return}et=t=e}while(t!==null);Ft===0&&(Ft=5)}function uk(e,t){do{var n=WT(e.alternate,e);if(n!==null){n.flags&=32767,et=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){et=e;return}et=e=n}while(e!==null);Ft=6,et=null}function Qy(e,t,n,s,a,r,o,l,c){e.cancelPendingCommit=null;do sf();while(bn!==0);if(pt&6)throw Error(le(327));if(t!==null){if(t===e.current)throw Error(le(177));if(r=t.lanes|t.childLanes,r|=$x,RR(e,n,r,o,l,c),e===kt&&(et=kt=null,st=0),Uo=t,Sa=e,Eo=n,dg=r,ug=a,ik=s,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,s2(Fu,function(){return gk(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,t.subtreeFlags&13878||s){s=Ue.T,Ue.T=null,a=dt.p,dt.p=2,o=pt,pt|=4;try{FT(e,t,n)}finally{pt=o,dt.p=a,Ue.T=s}}bn=1,hk(),fk(),mk()}}function hk(){if(bn===1){bn=0;var e=Sa,t=Uo,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=Ue.T,Ue.T=null;var s=dt.p;dt.p=2;var a=pt;pt|=4;try{ZN(t,e);var r=xg,o=O0(e.containerInfo),l=r.focusedElem,c=r.selectionRange;if(o!==l&&l&&l.ownerDocument&&T0(l.ownerDocument.documentElement,l)){if(c!==null&&Mx(l)){var d=c.start,h=c.end;if(h===void 0&&(h=d),"selectionStart"in l)l.selectionStart=d,l.selectionEnd=Math.min(h,l.value.length);else{var f=l.ownerDocument||document,m=f&&f.defaultView||window;if(m.getSelection){var p=m.getSelection(),y=l.textContent.length,g=Math.min(c.start,y),b=c.end===void 0?g:Math.min(c.end,y);!p.extend&&g>b&&(o=b,b=g,g=o);var v=by(l,g),x=by(l,b);if(v&&x&&(p.rangeCount!==1||p.anchorNode!==v.node||p.anchorOffset!==v.offset||p.focusNode!==x.node||p.focusOffset!==x.offset)){var w=f.createRange();w.setStart(v.node,v.offset),p.removeAllRanges(),g>b?(p.addRange(w),p.extend(x.node,x.offset)):(w.setEnd(x.node,x.offset),p.addRange(w))}}}}for(f=[],p=l;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<f.length;l++){var _=f[l];_.element.scrollLeft=_.left,_.element.scrollTop=_.top}}xh=!!gg,xg=gg=null}finally{pt=a,dt.p=s,Ue.T=n}}e.current=t,bn=2}}function fk(){if(bn===2){bn=0;var e=Sa,t=Uo,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=Ue.T,Ue.T=null;var s=dt.p;dt.p=2;var a=pt;pt|=4;try{qN(e,t.alternate,t)}finally{pt=a,dt.p=s,Ue.T=n}}bn=3}}function mk(){if(bn===4||bn===3){bn=0,_R();var e=Sa,t=Uo,n=Eo,s=ik;t.subtreeFlags&10256||t.flags&10256?bn=5:(bn=0,Uo=Sa=null,pk(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(ka=null),Dx(n),t=t.stateNode,ms&&typeof ms.onCommitFiberRoot=="function")try{ms.onCommitFiberRoot(Zc,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=Ue.T,a=dt.p,dt.p=2,Ue.T=null;try{for(var r=e.onRecoverableError,o=0;o<s.length;o++){var l=s[o];r(l.value,{componentStack:l.stack})}}finally{Ue.T=t,dt.p=a}}Eo&3&&sf(),yi(e),a=e.pendingLanes,n&4194090&&a&42?e===hg?rc++:(rc=0,hg=e):rc=0,cd(0)}}function pk(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,id(t)))}function sf(e){return hk(),fk(),mk(),gk()}function gk(){if(bn!==5)return!1;var e=Sa,t=dg;dg=0;var n=Dx(Eo),s=Ue.T,a=dt.p;try{dt.p=32>n?32:n,Ue.T=null,n=ug,ug=null;var r=Sa,o=Eo;if(bn=0,Uo=Sa=null,Eo=0,pt&6)throw Error(le(331));var l=pt;if(pt|=4,nk(r.current),JN(r,r.current,o,n),pt=l,cd(0,!1),ms&&typeof ms.onPostCommitFiberRoot=="function")try{ms.onPostCommitFiberRoot(Zc,r)}catch{}return!0}finally{dt.p=a,Ue.T=s,pk(e,t)}}function Jy(e,t,n){t=Ss(n,t),t=ag(e.stateNode,t,2),e=Na(e,t,2),e!==null&&(Jc(e,2),yi(e))}function bt(e,t,n){if(e.tag===3)Jy(e,e,n);else for(;t!==null;){if(t.tag===3){Jy(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(ka===null||!ka.has(s))){e=Ss(n,e),n=ON(2),s=Na(t,n,2),s!==null&&(zN(n,s,t,e),Jc(s,2),yi(s));break}}t=t.return}}function Bm(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new XT;var a=new Set;s.set(t,a)}else a=s.get(t),a===void 0&&(a=new Set,s.set(t,a));a.has(n)||(rv=!0,a.add(n),e=e2.bind(null,e,t,n),t.then(e,e))}function e2(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,kt===e&&(st&n)===n&&(Ft===4||Ft===3&&(st&62914560)===st&&300>di()-lv?!(pt&2)&&Bo(e,0):ov|=n,Vo===st&&(Vo=0)),yi(e)}function xk(e,t){t===0&&(t=h0()),e=Jo(e,t),e!==null&&(Jc(e,t),yi(e))}function t2(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),xk(e,n)}function n2(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(le(314))}s!==null&&s.delete(t),xk(e,n)}function s2(e,t){return Sx(e,t)}var dh=null,so=null,mg=!1,uh=!1,Wm=!1,fr=0;function yi(e){e!==so&&e.next===null&&(so===null?dh=so=e:so=so.next=e),uh=!0,mg||(mg=!0,a2())}function cd(e,t){if(!Wm&&uh){Wm=!0;do for(var n=!1,s=dh;s!==null;){if(e!==0){var a=s.pendingLanes;if(a===0)var r=0;else{var o=s.suspendedLanes,l=s.pingedLanes;r=(1<<31-ps(42|e)+1)-1,r&=a&~(o&~l),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,ew(s,r))}else r=st,r=Wh(s,s===kt?r:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(r&3)||Qc(s,r)||(n=!0,ew(s,r));s=s.next}while(n);Wm=!1}}function i2(){vk()}function vk(){uh=mg=!1;var e=0;fr!==0&&(f2()&&(e=fr),fr=0);for(var t=di(),n=null,s=dh;s!==null;){var a=s.next,r=bk(s,t);r===0?(s.next=null,n===null?dh=a:n.next=a,a===null&&(so=n)):(n=s,(e!==0||r&3)&&(uh=!0)),s=a}cd(e)}function bk(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,a=e.expirationTimes,r=e.pendingLanes&-62914561;0<r;){var o=31-ps(r),l=1<<o,c=a[o];c===-1?(!(l&n)||l&s)&&(a[o]=AR(l,t)):c<=t&&(e.expiredLanes|=l),r&=~l}if(t=kt,n=st,n=Wh(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(mt===2||mt===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&xm(s),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Qc(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&xm(s),Dx(n)){case 2:case 8:n=c0;break;case 32:n=Fu;break;case 268435456:n=d0;break;default:n=Fu}return s=yk.bind(null,e),n=Sx(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&xm(s),e.callbackPriority=2,e.callbackNode=null,2}function yk(e,t){if(bn!==0&&bn!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(sf()&&e.callbackNode!==n)return null;var s=st;return s=Wh(e,e===kt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(rk(e,s,t),bk(e,di()),e.callbackNode!=null&&e.callbackNode===n?yk.bind(null,e):null)}function ew(e,t){if(sf())return null;rk(e,t,!0)}function a2(){p2(function(){pt&6?Sx(l0,i2):vk()})}function dv(){return fr===0&&(fr=u0()),fr}function tw(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:bu(""+e)}function nw(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function r2(e,t,n,s,a){if(t==="submit"&&n&&n.stateNode===a){var r=tw((a[ts]||null).action),o=s.submitter;o&&(t=(t=o[ts]||null)?tw(t.formAction):o.getAttribute("formAction"),t!==null&&(r=t,o=null));var l=new Fh("action","action",null,s,a);e.push({event:l,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(fr!==0){var c=o?nw(a,o):new FormData(a);sg(n,{pending:!0,data:c,method:a.method,action:r},null,c)}}else typeof r=="function"&&(l.preventDefault(),c=o?nw(a,o):new FormData(a),sg(n,{pending:!0,data:c,method:a.method,action:r},r,c))},currentTarget:a}]})}}for(var Fm=0;Fm<Wp.length;Fm++){var qm=Wp[Fm],o2=qm.toLowerCase(),l2=qm[0].toUpperCase()+qm.slice(1);Xs(o2,"on"+l2)}Xs(M0,"onAnimationEnd");Xs($0,"onAnimationIteration");Xs(L0,"onAnimationStart");Xs("dblclick","onDoubleClick");Xs("focusin","onFocus");Xs("focusout","onBlur");Xs(kT,"onTransitionRun");Xs(ST,"onTransitionStart");Xs(CT,"onTransitionCancel");Xs(P0,"onTransitionEnd");$o("onMouseEnter",["mouseout","mouseover"]);$o("onMouseLeave",["mouseout","mouseover"]);$o("onPointerEnter",["pointerout","pointerover"]);$o("onPointerLeave",["pointerout","pointerover"]);Er("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Er("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Er("onBeforeInput",["compositionend","keypress","textInput","paste"]);Er("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Er("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Er("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Nc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),c2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Nc));function wk(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],a=s.event;s=s.listeners;e:{var r=void 0;if(t)for(var o=s.length-1;0<=o;o--){var l=s[o],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==r&&a.isPropagationStopped())break e;r=l,a.currentTarget=d;try{r(a)}catch(h){ih(h)}a.currentTarget=null,r=c}else for(o=0;o<s.length;o++){if(l=s[o],c=l.instance,d=l.currentTarget,l=l.listener,c!==r&&a.isPropagationStopped())break e;r=l,a.currentTarget=d;try{r(a)}catch(h){ih(h)}a.currentTarget=null,r=c}}}}function Je(e,t){var n=t[Pp];n===void 0&&(n=t[Pp]=new Set);var s=e+"__bubble";n.has(s)||(_k(t,e,2,!1),n.add(s))}function Ym(e,t,n){var s=0;t&&(s|=4),_k(n,e,s,t)}var Vd="_reactListening"+Math.random().toString(36).slice(2);function uv(e){if(!e[Vd]){e[Vd]=!0,g0.forEach(function(n){n!=="selectionchange"&&(c2.has(n)||Ym(n,!1,e),Ym(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Vd]||(t[Vd]=!0,Ym("selectionchange",!1,t))}}function _k(e,t,n,s){switch(zk(t)){case 2:var a=$2;break;case 8:a=L2;break;default:a=pv}n=a.bind(null,t,n,e),a=void 0,!Vp||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),s?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Xm(e,t,n,s,a){var r=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var l=s.stateNode.containerInfo;if(l===a)break;if(o===4)for(o=s.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===a)return;o=o.return}for(;l!==null;){if(o=lo(l),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){s=r=o;continue e}l=l.parentNode}}s=s.return}N0(function(){var d=r,h=Rx(n),f=[];e:{var m=I0.get(e);if(m!==void 0){var p=Fh,y=e;switch(e){case"keypress":if(wu(n)===0)break e;case"keydown":case"keyup":p=sT;break;case"focusin":y="focus",p=km;break;case"focusout":y="blur",p=km;break;case"beforeblur":case"afterblur":p=km;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=cy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=WR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=rT;break;case M0:case $0:case L0:p=YR;break;case P0:p=lT;break;case"scroll":case"scrollend":p=UR;break;case"wheel":p=dT;break;case"copy":case"cut":case"paste":p=KR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=uy;break;case"toggle":case"beforetoggle":p=hT}var g=(t&4)!==0,b=!g&&(e==="scroll"||e==="scrollend"),v=g?m!==null?m+"Capture":null:m;g=[];for(var x=d,w;x!==null;){var _=x;if(w=_.stateNode,_=_.tag,_!==5&&_!==26&&_!==27||w===null||v===null||(_=vc(x,v),_!=null&&g.push(kc(x,_,w))),b)break;x=x.return}0<g.length&&(m=new p(m,y,null,n,h),f.push({event:m,listeners:g}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",m&&n!==Hp&&(y=n.relatedTarget||n.fromElement)&&(lo(y)||y[Zo]))break e;if((p||m)&&(m=h.window===h?h:(m=h.ownerDocument)?m.defaultView||m.parentWindow:window,p?(y=n.relatedTarget||n.toElement,p=d,y=y?lo(y):null,y!==null&&(b=Kc(y),g=y.tag,y!==b||g!==5&&g!==27&&g!==6)&&(y=null)):(p=null,y=d),p!==y)){if(g=cy,_="onMouseLeave",v="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(g=uy,_="onPointerLeave",v="onPointerEnter",x="pointer"),b=p==null?m:Il(p),w=y==null?m:Il(y),m=new g(_,x+"leave",p,n,h),m.target=b,m.relatedTarget=w,_=null,lo(h)===d&&(g=new g(v,x+"enter",y,n,h),g.target=w,g.relatedTarget=b,_=g),b=_,p&&y)t:{for(g=p,v=y,x=0,w=g;w;w=Ur(w))x++;for(w=0,_=v;_;_=Ur(_))w++;for(;0<x-w;)g=Ur(g),x--;for(;0<w-x;)v=Ur(v),w--;for(;x--;){if(g===v||v!==null&&g===v.alternate)break t;g=Ur(g),v=Ur(v)}g=null}else g=null;p!==null&&sw(f,m,p,g,!1),y!==null&&b!==null&&sw(f,b,y,g,!0)}}e:{if(m=d?Il(d):window,p=m.nodeName&&m.nodeName.toLowerCase(),p==="select"||p==="input"&&m.type==="file")var S=py;else if(my(m))if(A0)S=_T;else{S=yT;var k=bT}else p=m.nodeName,!p||p.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?d&&Ax(d.elementType)&&(S=py):S=wT;if(S&&(S=S(e,d))){E0(f,S,n,h);break e}k&&k(e,m,d),e==="focusout"&&d&&m.type==="number"&&d.memoizedProps.value!=null&&Gp(m,"number",m.value)}switch(k=d?Il(d):window,e){case"focusin":(my(k)||k.contentEditable==="true")&&(ho=k,Up=d,Kl=null);break;case"focusout":Kl=Up=ho=null;break;case"mousedown":Bp=!0;break;case"contextmenu":case"mouseup":case"dragend":Bp=!1,yy(f,n,h);break;case"selectionchange":if(NT)break;case"keydown":case"keyup":yy(f,n,h)}var j;if(zx)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else uo?C0(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(S0&&n.locale!=="ko"&&(uo||N!=="onCompositionStart"?N==="onCompositionEnd"&&uo&&(j=k0()):(ma=h,Tx="value"in ma?ma.value:ma.textContent,uo=!0)),k=hh(d,N),0<k.length&&(N=new dy(N,e,null,n,h),f.push({event:N,listeners:k}),j?N.data=j:(j=D0(n),j!==null&&(N.data=j)))),(j=mT?pT(e,n):gT(e,n))&&(N=hh(d,"onBeforeInput"),0<N.length&&(k=new dy("onBeforeInput","beforeinput",null,n,h),f.push({event:k,listeners:N}),k.data=j)),r2(f,e,d,n,h)}wk(f,t)})}function kc(e,t,n){return{instance:e,listener:t,currentTarget:n}}function hh(e,t){for(var n=t+"Capture",s=[];e!==null;){var a=e,r=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||r===null||(a=vc(e,n),a!=null&&s.unshift(kc(e,a,r)),a=vc(e,t),a!=null&&s.push(kc(e,a,r))),e.tag===3)return s;e=e.return}return[]}function Ur(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function sw(e,t,n,s,a){for(var r=t._reactName,o=[];n!==null&&n!==s;){var l=n,c=l.alternate,d=l.stateNode;if(l=l.tag,c!==null&&c===s)break;l!==5&&l!==26&&l!==27||d===null||(c=d,a?(d=vc(n,r),d!=null&&o.unshift(kc(n,d,c))):a||(d=vc(n,r),d!=null&&o.push(kc(n,d,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var d2=/\r\n?/g,u2=/\u0000|\uFFFD/g;function iw(e){return(typeof e=="string"?e:""+e).replace(d2,`
|
|
49
|
+
`).replace(u2,"")}function jk(e,t){return t=iw(t),iw(e)===t}function af(){}function xt(e,t,n,s,a,r){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Lo(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Lo(e,""+s);break;case"className":Md(e,"class",s);break;case"tabIndex":Md(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Md(e,n,s);break;case"style":j0(e,s,r);break;case"data":if(t!=="object"){Md(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=bu(""+s),e.setAttribute(n,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof r=="function"&&(n==="formAction"?(t!=="input"&&xt(e,t,"name",a.name,a,null),xt(e,t,"formEncType",a.formEncType,a,null),xt(e,t,"formMethod",a.formMethod,a,null),xt(e,t,"formTarget",a.formTarget,a,null)):(xt(e,t,"encType",a.encType,a,null),xt(e,t,"method",a.method,a,null),xt(e,t,"target",a.target,a,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=bu(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=af);break;case"onScroll":s!=null&&Je("scroll",e);break;case"onScrollEnd":s!=null&&Je("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(le(61));if(n=s.__html,n!=null){if(a.children!=null)throw Error(le(60));e.innerHTML=n}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}n=bu(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""+s):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":s===!0?e.setAttribute(n,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,s):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(n,s):e.removeAttribute(n);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(n):e.setAttribute(n,s);break;case"popover":Je("beforetoggle",e),Je("toggle",e),vu(e,"popover",s);break;case"xlinkActuate":Si(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Si(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Si(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Si(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Si(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Si(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Si(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Si(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Si(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":vu(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=HR.get(n)||n,vu(e,n,s))}}function pg(e,t,n,s,a,r){switch(n){case"style":j0(e,s,r);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(le(61));if(n=s.__html,n!=null){if(a.children!=null)throw Error(le(60));e.innerHTML=n}}break;case"children":typeof s=="string"?Lo(e,s):(typeof s=="number"||typeof s=="bigint")&&Lo(e,""+s);break;case"onScroll":s!=null&&Je("scroll",e);break;case"onScrollEnd":s!=null&&Je("scrollend",e);break;case"onClick":s!=null&&(e.onclick=af);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!x0.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),t=n.slice(2,a?n.length-7:void 0),r=e[ts]||null,r=r!=null?r[n]:null,typeof r=="function"&&e.removeEventListener(t,r,a),typeof s=="function")){typeof r!="function"&&r!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,s,a);break e}n in e?e[n]=s:s===!0?e.setAttribute(n,""):vu(e,n,s)}}}function yn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Je("error",e),Je("load",e);var s=!1,a=!1,r;for(r in n)if(n.hasOwnProperty(r)){var o=n[r];if(o!=null)switch(r){case"src":s=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(le(137,t));default:xt(e,t,r,o,n,null)}}a&&xt(e,t,"srcSet",n.srcSet,n,null),s&&xt(e,t,"src",n.src,n,null);return;case"input":Je("invalid",e);var l=r=o=a=null,c=null,d=null;for(s in n)if(n.hasOwnProperty(s)){var h=n[s];if(h!=null)switch(s){case"name":a=h;break;case"type":o=h;break;case"checked":c=h;break;case"defaultChecked":d=h;break;case"value":r=h;break;case"defaultValue":l=h;break;case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(le(137,t));break;default:xt(e,t,s,h,n,null)}}y0(e,r,l,c,d,o,a,!1),qu(e);return;case"select":Je("invalid",e),s=o=r=null;for(a in n)if(n.hasOwnProperty(a)&&(l=n[a],l!=null))switch(a){case"value":r=l;break;case"defaultValue":o=l;break;case"multiple":s=l;default:xt(e,t,a,l,n,null)}t=r,n=o,e.multiple=!!s,t!=null?jo(e,!!s,t,!1):n!=null&&jo(e,!!s,n,!0);return;case"textarea":Je("invalid",e),r=a=s=null;for(o in n)if(n.hasOwnProperty(o)&&(l=n[o],l!=null))switch(o){case"value":s=l;break;case"defaultValue":a=l;break;case"children":r=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(le(91));break;default:xt(e,t,o,l,n,null)}_0(e,s,a,r),qu(e);return;case"option":for(c in n)if(n.hasOwnProperty(c)&&(s=n[c],s!=null))switch(c){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:xt(e,t,c,s,n,null)}return;case"dialog":Je("beforetoggle",e),Je("toggle",e),Je("cancel",e),Je("close",e);break;case"iframe":case"object":Je("load",e);break;case"video":case"audio":for(s=0;s<Nc.length;s++)Je(Nc[s],e);break;case"image":Je("error",e),Je("load",e);break;case"details":Je("toggle",e);break;case"embed":case"source":case"link":Je("error",e),Je("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(d in n)if(n.hasOwnProperty(d)&&(s=n[d],s!=null))switch(d){case"children":case"dangerouslySetInnerHTML":throw Error(le(137,t));default:xt(e,t,d,s,n,null)}return;default:if(Ax(t)){for(h in n)n.hasOwnProperty(h)&&(s=n[h],s!==void 0&&pg(e,t,h,s,n,void 0));return}}for(l in n)n.hasOwnProperty(l)&&(s=n[l],s!=null&&xt(e,t,l,s,n,null))}function h2(e,t,n,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,r=null,o=null,l=null,c=null,d=null,h=null;for(p in n){var f=n[p];if(n.hasOwnProperty(p)&&f!=null)switch(p){case"checked":break;case"value":break;case"defaultValue":c=f;default:s.hasOwnProperty(p)||xt(e,t,p,null,s,f)}}for(var m in s){var p=s[m];if(f=n[m],s.hasOwnProperty(m)&&(p!=null||f!=null))switch(m){case"type":r=p;break;case"name":a=p;break;case"checked":d=p;break;case"defaultChecked":h=p;break;case"value":o=p;break;case"defaultValue":l=p;break;case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(le(137,t));break;default:p!==f&&xt(e,t,m,p,s,f)}}Ip(e,o,l,c,d,h,r,a);return;case"select":p=o=l=m=null;for(r in n)if(c=n[r],n.hasOwnProperty(r)&&c!=null)switch(r){case"value":break;case"multiple":p=c;default:s.hasOwnProperty(r)||xt(e,t,r,null,s,c)}for(a in s)if(r=s[a],c=n[a],s.hasOwnProperty(a)&&(r!=null||c!=null))switch(a){case"value":m=r;break;case"defaultValue":l=r;break;case"multiple":o=r;default:r!==c&&xt(e,t,a,r,s,c)}t=l,n=o,s=p,m!=null?jo(e,!!n,m,!1):!!s!=!!n&&(t!=null?jo(e,!!n,t,!0):jo(e,!!n,n?[]:"",!1));return;case"textarea":p=m=null;for(l in n)if(a=n[l],n.hasOwnProperty(l)&&a!=null&&!s.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:xt(e,t,l,null,s,a)}for(o in s)if(a=s[o],r=n[o],s.hasOwnProperty(o)&&(a!=null||r!=null))switch(o){case"value":m=a;break;case"defaultValue":p=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(le(91));break;default:a!==r&&xt(e,t,o,a,s,r)}w0(e,m,p);return;case"option":for(var y in n)if(m=n[y],n.hasOwnProperty(y)&&m!=null&&!s.hasOwnProperty(y))switch(y){case"selected":e.selected=!1;break;default:xt(e,t,y,null,s,m)}for(c in s)if(m=s[c],p=n[c],s.hasOwnProperty(c)&&m!==p&&(m!=null||p!=null))switch(c){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:xt(e,t,c,m,s,p)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var g in n)m=n[g],n.hasOwnProperty(g)&&m!=null&&!s.hasOwnProperty(g)&&xt(e,t,g,null,s,m);for(d in s)if(m=s[d],p=n[d],s.hasOwnProperty(d)&&m!==p&&(m!=null||p!=null))switch(d){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(le(137,t));break;default:xt(e,t,d,m,s,p)}return;default:if(Ax(t)){for(var b in n)m=n[b],n.hasOwnProperty(b)&&m!==void 0&&!s.hasOwnProperty(b)&&pg(e,t,b,void 0,s,m);for(h in s)m=s[h],p=n[h],!s.hasOwnProperty(h)||m===p||m===void 0&&p===void 0||pg(e,t,h,m,s,p);return}}for(var v in n)m=n[v],n.hasOwnProperty(v)&&m!=null&&!s.hasOwnProperty(v)&&xt(e,t,v,null,s,m);for(f in s)m=s[f],p=n[f],!s.hasOwnProperty(f)||m===p||m==null&&p==null||xt(e,t,f,m,s,p)}var gg=null,xg=null;function fh(e){return e.nodeType===9?e:e.ownerDocument}function aw(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Nk(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function vg(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Km=null;function f2(){var e=window.event;return e&&e.type==="popstate"?e===Km?!1:(Km=e,!0):(Km=null,!1)}var kk=typeof setTimeout=="function"?setTimeout:void 0,m2=typeof clearTimeout=="function"?clearTimeout:void 0,rw=typeof Promise=="function"?Promise:void 0,p2=typeof queueMicrotask=="function"?queueMicrotask:typeof rw<"u"?function(e){return rw.resolve(null).then(e).catch(g2)}:kk;function g2(e){setTimeout(function(){throw e})}function Va(e){return e==="head"}function ow(e,t){var n=t,s=0,a=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(0<s&&8>s){n=s;var o=e.ownerDocument;if(n&1&&oc(o.documentElement),n&2&&oc(o.body),n&4)for(n=o.head,oc(n),o=n.firstChild;o;){var l=o.nextSibling,c=o.nodeName;o[ed]||c==="SCRIPT"||c==="STYLE"||c==="LINK"&&o.rel.toLowerCase()==="stylesheet"||n.removeChild(o),o=l}}if(a===0){e.removeChild(r),Ac(t);return}a--}else n==="$"||n==="$?"||n==="$!"?a++:s=n.charCodeAt(0)-48;else s=0;n=r}while(n);Ac(t)}function bg(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":bg(n),Ex(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function x2(e,t,n,s){for(;e.nodeType===1;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[ed])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(r=e.getAttribute("rel"),r==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(r!==a.rel||e.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||e.getAttribute("title")!==(a.title==null?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(r=e.getAttribute("src"),(r!==(a.src==null?null:a.src)||e.getAttribute("type")!==(a.type==null?null:a.type)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&r&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var r=a.name==null?null:""+a.name;if(a.type==="hidden"&&e.getAttribute("name")===r)return e}else return e;if(e=Us(e.nextSibling),e===null)break}return null}function v2(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Us(e.nextSibling),e===null))return null;return e}function yg(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function b2(e,t){var n=e.ownerDocument;if(e.data!=="$?"||n.readyState==="complete")t();else{var s=function(){t(),n.removeEventListener("DOMContentLoaded",s)};n.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function Us(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="F!"||t==="F")break;if(t==="/$")return null}}return e}var wg=null;function lw(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}function Sk(e,t,n){switch(t=fh(n),e){case"html":if(e=t.documentElement,!e)throw Error(le(452));return e;case"head":if(e=t.head,!e)throw Error(le(453));return e;case"body":if(e=t.body,!e)throw Error(le(454));return e;default:throw Error(le(451))}}function oc(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ex(e)}var Ms=new Map,cw=new Set;function mh(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Yi=dt.d;dt.d={f:y2,r:w2,D:_2,C:j2,L:N2,m:k2,X:C2,S:S2,M:D2};function y2(){var e=Yi.f(),t=tf();return e||t}function w2(e){var t=Qo(e);t!==null&&t.tag===5&&t.type==="form"?bN(t):Yi.r(e)}var tl=typeof document>"u"?null:document;function Ck(e,t,n){var s=tl;if(s&&typeof t=="string"&&t){var a=ks(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),cw.has(a)||(cw.add(a),e={rel:e,crossOrigin:n,href:t},s.querySelector(a)===null&&(t=s.createElement("link"),yn(t,"link",e),hn(t),s.head.appendChild(t)))}}function _2(e){Yi.D(e),Ck("dns-prefetch",e,null)}function j2(e,t){Yi.C(e,t),Ck("preconnect",e,t)}function N2(e,t,n){Yi.L(e,t,n);var s=tl;if(s&&e&&t){var a='link[rel="preload"][as="'+ks(t)+'"]';t==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+ks(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+ks(n.imageSizes)+'"]')):a+='[href="'+ks(e)+'"]';var r=a;switch(t){case"style":r=Wo(e);break;case"script":r=nl(e)}Ms.has(r)||(e=Ot({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Ms.set(r,e),s.querySelector(a)!==null||t==="style"&&s.querySelector(dd(r))||t==="script"&&s.querySelector(ud(r))||(t=s.createElement("link"),yn(t,"link",e),hn(t),s.head.appendChild(t)))}}function k2(e,t){Yi.m(e,t);var n=tl;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+ks(s)+'"][href="'+ks(e)+'"]',r=a;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=nl(e)}if(!Ms.has(r)&&(e=Ot({rel:"modulepreload",href:e},t),Ms.set(r,e),n.querySelector(a)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(ud(r)))return}s=n.createElement("link"),yn(s,"link",e),hn(s),n.head.appendChild(s)}}}function S2(e,t,n){Yi.S(e,t,n);var s=tl;if(s&&e){var a=_o(s).hoistableStyles,r=Wo(e);t=t||"default";var o=a.get(r);if(!o){var l={loading:0,preload:null};if(o=s.querySelector(dd(r)))l.loading=5;else{e=Ot({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Ms.get(r))&&hv(e,n);var c=o=s.createElement("link");hn(c),yn(c,"link",e),c._p=new Promise(function(d,h){c.onload=d,c.onerror=h}),c.addEventListener("load",function(){l.loading|=1}),c.addEventListener("error",function(){l.loading|=2}),l.loading|=4,Du(o,t,s)}o={type:"stylesheet",instance:o,count:1,state:l},a.set(r,o)}}}function C2(e,t){Yi.X(e,t);var n=tl;if(n&&e){var s=_o(n).hoistableScripts,a=nl(e),r=s.get(a);r||(r=n.querySelector(ud(a)),r||(e=Ot({src:e,async:!0},t),(t=Ms.get(a))&&fv(e,t),r=n.createElement("script"),hn(r),yn(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},s.set(a,r))}}function D2(e,t){Yi.M(e,t);var n=tl;if(n&&e){var s=_o(n).hoistableScripts,a=nl(e),r=s.get(a);r||(r=n.querySelector(ud(a)),r||(e=Ot({src:e,async:!0,type:"module"},t),(t=Ms.get(a))&&fv(e,t),r=n.createElement("script"),hn(r),yn(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},s.set(a,r))}}function dw(e,t,n,s){var a=(a=_a.current)?mh(a):null;if(!a)throw Error(le(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Wo(n.href),n=_o(a).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Wo(n.href);var r=_o(a).hoistableStyles,o=r.get(e);if(o||(a=a.ownerDocument||a,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,o),(r=a.querySelector(dd(e)))&&!r._p&&(o.instance=r,o.state.loading=5),Ms.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Ms.set(e,n),r||E2(a,e,n,o.state))),t&&s===null)throw Error(le(528,""));return o}if(t&&s!==null)throw Error(le(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=nl(n),n=_o(a).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(le(444,e))}}function Wo(e){return'href="'+ks(e)+'"'}function dd(e){return'link[rel="stylesheet"]['+e+"]"}function Dk(e){return Ot({},e,{"data-precedence":e.precedence,precedence:null})}function E2(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),yn(t,"link",n),hn(t),e.head.appendChild(t))}function nl(e){return'[src="'+ks(e)+'"]'}function ud(e){return"script[async]"+e}function uw(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+ks(n.href)+'"]');if(s)return t.instance=s,hn(s),s;var a=Ot({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),hn(s),yn(s,"style",a),Du(s,n.precedence,e),t.instance=s;case"stylesheet":a=Wo(n.href);var r=e.querySelector(dd(a));if(r)return t.state.loading|=4,t.instance=r,hn(r),r;s=Dk(n),(a=Ms.get(a))&&hv(s,a),r=(e.ownerDocument||e).createElement("link"),hn(r);var o=r;return o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),yn(r,"link",s),t.state.loading|=4,Du(r,n.precedence,e),t.instance=r;case"script":return r=nl(n.src),(a=e.querySelector(ud(r)))?(t.instance=a,hn(a),a):(s=n,(a=Ms.get(r))&&(s=Ot({},n),fv(s,a)),e=e.ownerDocument||e,a=e.createElement("script"),hn(a),yn(a,"link",s),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(le(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,Du(s,n.precedence,e));return t.instance}function Du(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=s.length?s[s.length-1]:null,r=a,o=0;o<s.length;o++){var l=s[o];if(l.dataset.precedence===t)r=l;else if(r!==a)break}r?r.parentNode.insertBefore(e,r.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function hv(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function fv(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Eu=null;function hw(e,t,n){if(Eu===null){var s=new Map,a=Eu=new Map;a.set(n,s)}else a=Eu,s=a.get(n),s||(s=new Map,a.set(n,s));if(s.has(e))return s;for(s.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var r=n[a];if(!(r[ed]||r[An]||e==="link"&&r.getAttribute("rel")==="stylesheet")&&r.namespaceURI!=="http://www.w3.org/2000/svg"){var o=r.getAttribute(t)||"";o=e+o;var l=s.get(o);l?l.push(r):s.set(o,[r])}}return s}function fw(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function A2(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Ek(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}var Sc=null;function R2(){}function T2(e,t,n){if(Sc===null)throw Error(le(475));var s=Sc;if(t.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&!(t.state.loading&4)){if(t.instance===null){var a=Wo(n.href),r=e.querySelector(dd(a));if(r){e=r._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(s.count++,s=ph.bind(s),e.then(s,s)),t.state.loading|=4,t.instance=r,hn(r);return}r=e.ownerDocument||e,n=Dk(n),(a=Ms.get(a))&&hv(n,a),r=r.createElement("link"),hn(r);var o=r;o._p=new Promise(function(l,c){o.onload=l,o.onerror=c}),yn(r,"link",n),t.instance=r}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(t,e),(e=t.state.preload)&&!(t.state.loading&3)&&(s.count++,t=ph.bind(s),e.addEventListener("load",t),e.addEventListener("error",t))}}function O2(){if(Sc===null)throw Error(le(475));var e=Sc;return e.stylesheets&&e.count===0&&_g(e,e.stylesheets),0<e.count?function(t){var n=setTimeout(function(){if(e.stylesheets&&_g(e,e.stylesheets),e.unsuspend){var s=e.unsuspend;e.unsuspend=null,s()}},6e4);return e.unsuspend=t,function(){e.unsuspend=null,clearTimeout(n)}}:null}function ph(){if(this.count--,this.count===0){if(this.stylesheets)_g(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var gh=null;function _g(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,gh=new Map,t.forEach(z2,e),gh=null,ph.call(e))}function z2(e,t){if(!(t.state.loading&4)){var n=gh.get(e);if(n)var s=n.get(null);else{n=new Map,gh.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r<a.length;r++){var o=a[r];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(n.set(o.dataset.precedence,o),s=o)}s&&n.set(null,s)}a=t.instance,o=a.getAttribute("data-precedence"),r=n.get(o)||s,r===s&&n.set(null,a),n.set(o,a),this.count++,s=ph.bind(this),a.addEventListener("load",s),a.addEventListener("error",s),r?r.parentNode.insertBefore(a,r.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(a,e.firstChild)),t.state.loading|=4}}var Cc={$$typeof:Oi,Provider:null,Consumer:null,_currentValue:or,_currentValue2:or,_threadCount:0};function M2(e,t,n,s,a,r,o,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=vm(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vm(0),this.hiddenUpdates=vm(null),this.identifierPrefix=s,this.onUncaughtError=a,this.onCaughtError=r,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function Ak(e,t,n,s,a,r,o,l,c,d,h,f){return e=new M2(e,t,n,o,l,c,d,f),t=1,r===!0&&(t|=24),r=fs(3,null,null,t),e.current=r,r.stateNode=e,t=Hx(),t.refCount++,e.pooledCache=t,t.refCount++,r.memoizedState={element:s,isDehydrated:n,cache:t},Ux(r),e}function Rk(e){return e?(e=po,e):po}function Tk(e,t,n,s,a,r){a=Rk(a),s.context===null?s.context=a:s.pendingContext=a,s=ja(t),s.payload={element:n},r=r===void 0?null:r,r!==null&&(s.callback=r),n=Na(e,s,t),n!==null&&(xs(n,e,t),Jl(n,e,t))}function mw(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function mv(e,t){mw(e,t),(e=e.alternate)&&mw(e,t)}function Ok(e){if(e.tag===13){var t=Jo(e,67108864);t!==null&&xs(t,e,67108864),mv(e,67108864)}}var xh=!0;function $2(e,t,n,s){var a=Ue.T;Ue.T=null;var r=dt.p;try{dt.p=2,pv(e,t,n,s)}finally{dt.p=r,Ue.T=a}}function L2(e,t,n,s){var a=Ue.T;Ue.T=null;var r=dt.p;try{dt.p=8,pv(e,t,n,s)}finally{dt.p=r,Ue.T=a}}function pv(e,t,n,s){if(xh){var a=jg(s);if(a===null)Xm(e,t,s,vh,n),pw(e,s);else if(I2(a,e,t,n,s))s.stopPropagation();else if(pw(e,s),t&4&&-1<P2.indexOf(e)){for(;a!==null;){var r=Qo(a);if(r!==null)switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var o=nr(r.pendingLanes);if(o!==0){var l=r;for(l.pendingLanes|=2,l.entangledLanes|=2;o;){var c=1<<31-ps(o);l.entanglements[1]|=c,o&=~c}yi(r),!(pt&6)&&(lh=di()+500,cd(0))}}break;case 13:l=Jo(r,2),l!==null&&xs(l,r,2),tf(),mv(r,2)}if(r=jg(s),r===null&&Xm(e,t,s,vh,n),r===a)break;a=r}a!==null&&s.stopPropagation()}else Xm(e,t,s,null,n)}}function jg(e){return e=Rx(e),gv(e)}var vh=null;function gv(e){if(vh=null,e=lo(e),e!==null){var t=Kc(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=i0(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return vh=e,null}function zk(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(jR()){case l0:return 2;case c0:return 8;case Fu:case NR:return 32;case d0:return 268435456;default:return 32}default:return 32}}var Ng=!1,Ca=null,Da=null,Ea=null,Dc=new Map,Ec=new Map,ua=[],P2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function pw(e,t){switch(e){case"focusin":case"focusout":Ca=null;break;case"dragenter":case"dragleave":Da=null;break;case"mouseover":case"mouseout":Ea=null;break;case"pointerover":case"pointerout":Dc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ec.delete(t.pointerId)}}function El(e,t,n,s,a,r){return e===null||e.nativeEvent!==r?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:r,targetContainers:[a]},t!==null&&(t=Qo(t),t!==null&&Ok(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function I2(e,t,n,s,a){switch(t){case"focusin":return Ca=El(Ca,e,t,n,s,a),!0;case"dragenter":return Da=El(Da,e,t,n,s,a),!0;case"mouseover":return Ea=El(Ea,e,t,n,s,a),!0;case"pointerover":var r=a.pointerId;return Dc.set(r,El(Dc.get(r)||null,e,t,n,s,a)),!0;case"gotpointercapture":return r=a.pointerId,Ec.set(r,El(Ec.get(r)||null,e,t,n,s,a)),!0}return!1}function Mk(e){var t=lo(e.target);if(t!==null){var n=Kc(t);if(n!==null){if(t=n.tag,t===13){if(t=i0(n),t!==null){e.blockedOn=t,TR(e.priority,function(){if(n.tag===13){var s=gs();s=Cx(s);var a=Jo(n,s);a!==null&&xs(a,n,s),mv(n,s)}});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Au(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=jg(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Hp=s,n.target.dispatchEvent(s),Hp=null}else return t=Qo(n),t!==null&&Ok(t),e.blockedOn=n,!1;t.shift()}return!0}function gw(e,t,n){Au(e)&&n.delete(t)}function G2(){Ng=!1,Ca!==null&&Au(Ca)&&(Ca=null),Da!==null&&Au(Da)&&(Da=null),Ea!==null&&Au(Ea)&&(Ea=null),Dc.forEach(gw),Ec.forEach(gw)}function Ud(e,t){e.blockedOn===t&&(e.blockedOn=null,Ng||(Ng=!0,on.unstable_scheduleCallback(on.unstable_NormalPriority,G2)))}var Bd=null;function xw(e){Bd!==e&&(Bd=e,on.unstable_scheduleCallback(on.unstable_NormalPriority,function(){Bd===e&&(Bd=null);for(var t=0;t<e.length;t+=3){var n=e[t],s=e[t+1],a=e[t+2];if(typeof s!="function"){if(gv(s||n)===null)continue;break}var r=Qo(n);r!==null&&(e.splice(t,3),t-=3,sg(r,{pending:!0,data:a,method:n.method,action:s},s,a))}}))}function Ac(e){function t(c){return Ud(c,e)}Ca!==null&&Ud(Ca,e),Da!==null&&Ud(Da,e),Ea!==null&&Ud(Ea,e),Dc.forEach(t),Ec.forEach(t);for(var n=0;n<ua.length;n++){var s=ua[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<ua.length&&(n=ua[0],n.blockedOn===null);)Mk(n),n.blockedOn===null&&ua.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(s=0;s<n.length;s+=3){var a=n[s],r=n[s+1],o=a[ts]||null;if(typeof r=="function")o||xw(n);else if(o){var l=null;if(r&&r.hasAttribute("formAction")){if(a=r,o=r[ts]||null)l=o.formAction;else if(gv(a)!==null)continue}else l=o.action;typeof l=="function"?n[s+1]=l:(n.splice(s,3),s-=3),xw(n)}}}function xv(e){this._internalRoot=e}rf.prototype.render=xv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(le(409));var n=t.current,s=gs();Tk(n,s,e,t,null,null)};rf.prototype.unmount=xv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Tk(e.current,2,null,e,null,null),tf(),t[Zo]=null}};function rf(e){this._internalRoot=e}rf.prototype.unstable_scheduleHydration=function(e){if(e){var t=p0();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ua.length&&t!==0&&t<ua[n].priority;n++);ua.splice(n,0,e),n===0&&Mk(e)}};var vw=n0.version;if(vw!=="19.1.0")throw Error(le(527,vw,"19.1.0"));dt.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(le(188)):(e=Object.keys(e).join(","),Error(le(268,e)));return e=gR(t),e=e!==null?a0(e):null,e=e===null?null:e.stateNode,e};var H2={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:Ue,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wd.isDisabled&&Wd.supportsFiber)try{Zc=Wd.inject(H2),ms=Wd}catch{}}Uh.createRoot=function(e,t){if(!s0(e))throw Error(le(299));var n=!1,s="",a=AN,r=RN,o=TN,l=null;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(a=t.onUncaughtError),t.onCaughtError!==void 0&&(r=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(l=t.unstable_transitionCallbacks)),t=Ak(e,1,!1,null,null,n,s,a,r,o,l,null),e[Zo]=t.current,uv(e),new xv(t)};Uh.hydrateRoot=function(e,t,n){if(!s0(e))throw Error(le(299));var s=!1,a="",r=AN,o=RN,l=TN,c=null,d=null;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(r=n.onUncaughtError),n.onCaughtError!==void 0&&(o=n.onCaughtError),n.onRecoverableError!==void 0&&(l=n.onRecoverableError),n.unstable_transitionCallbacks!==void 0&&(c=n.unstable_transitionCallbacks),n.formState!==void 0&&(d=n.formState)),t=Ak(e,1,!0,t,n??null,s,a,r,o,l,c,d),t.context=Rk(null),n=t.current,s=gs(),s=Cx(s),a=ja(s),a.callback=null,Na(n,a,s),n=s,t.current.lanes=n,Jc(t,n),yi(t),e[Zo]=t.current,uv(e),new rf(t)};Uh.version="19.1.0";function $k(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($k)}catch(e){console.error(e)}}$k(),Xj.exports=Uh;var V2=Xj.exports;function Lk(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Lk(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function Pk(){for(var e,t,n=0,s="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Lk(e))&&(s&&(s+=" "),s+=t);return s}const bw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,yw=Pk,hd=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return yw(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:r}=t,o=Object.keys(a).map(d=>{const h=n==null?void 0:n[d],f=r==null?void 0:r[d];if(h===null)return null;const m=bw(h)||bw(f);return a[d][m]}),l=n&&Object.entries(n).reduce((d,h)=>{let[f,m]=h;return m===void 0||(d[f]=m),d},{}),c=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((d,h)=>{let{class:f,className:m,...p}=h;return Object.entries(p).every(y=>{let[g,b]=y;return Array.isArray(b)?b.includes({...r,...l}[g]):{...r,...l}[g]===b})?[...d,f,m]:d},[]);return yw(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},vv="-",U2=e=>{const t=W2(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{const l=o.split(vv);return l[0]===""&&l.length!==1&&l.shift(),Ik(l,t)||B2(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&s[o]?[...c,...s[o]]:c}}},Ik=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),a=s?Ik(e.slice(1),s):void 0;if(a)return a;if(t.validators.length===0)return;const r=e.join(vv);return(o=t.validators.find(({validator:l})=>l(r)))==null?void 0:o.classGroupId},ww=/^\[(.+)\]$/,B2=e=>{if(ww.test(e)){const t=ww.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},W2=e=>{const{theme:t,classGroups:n}=e,s={nextPart:new Map,validators:[]};for(const a in n)kg(n[a],s,a,t);return s},kg=(e,t,n,s)=>{e.forEach(a=>{if(typeof a=="string"){const r=a===""?t:_w(t,a);r.classGroupId=n;return}if(typeof a=="function"){if(F2(a)){kg(a(s),t,n,s);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([r,o])=>{kg(o,_w(t,r),n,s)})})},_w=(e,t)=>{let n=e;return t.split(vv).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},F2=e=>e.isThemeGetter,q2=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const a=(r,o)=>{n.set(r,o),t++,t>e&&(t=0,s=n,n=new Map)};return{get(r){let o=n.get(r);if(o!==void 0)return o;if((o=s.get(r))!==void 0)return a(r,o),o},set(r,o){n.has(r)?n.set(r,o):a(r,o)}}},Sg="!",Cg=":",Y2=Cg.length,X2=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=a=>{const r=[];let o=0,l=0,c=0,d;for(let y=0;y<a.length;y++){let g=a[y];if(o===0&&l===0){if(g===Cg){r.push(a.slice(c,y)),c=y+Y2;continue}if(g==="/"){d=y;continue}}g==="["?o++:g==="]"?o--:g==="("?l++:g===")"&&l--}const h=r.length===0?a:a.substring(c),f=K2(h),m=f!==h,p=d&&d>c?d-c:void 0;return{modifiers:r,hasImportantModifier:m,baseClassName:f,maybePostfixModifierPosition:p}};if(t){const a=t+Cg,r=s;s=o=>o.startsWith(a)?r(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const a=s;s=r=>n({className:r,parseClassName:a})}return s},K2=e=>e.endsWith(Sg)?e.substring(0,e.length-1):e.startsWith(Sg)?e.substring(1):e,Z2=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const a=[];let r=[];return s.forEach(o=>{o[0]==="["||t[o]?(a.push(...r.sort(),o),r=[]):r.push(o)}),a.push(...r.sort()),a}},Q2=e=>({cache:q2(e.cacheSize),parseClassName:X2(e),sortModifiers:Z2(e),...U2(e)}),J2=/\s+/,eO=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a,sortModifiers:r}=t,o=[],l=e.trim().split(J2);let c="";for(let d=l.length-1;d>=0;d-=1){const h=l[d],{isExternal:f,modifiers:m,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:g}=n(h);if(f){c=h+(c.length>0?" "+c:c);continue}let b=!!g,v=s(b?y.substring(0,g):y);if(!v){if(!b){c=h+(c.length>0?" "+c:c);continue}if(v=s(y),!v){c=h+(c.length>0?" "+c:c);continue}b=!1}const x=r(m).join(":"),w=p?x+Sg:x,_=w+v;if(o.includes(_))continue;o.push(_);const S=a(v,b);for(let k=0;k<S.length;++k){const j=S[k];o.push(w+j)}c=h+(c.length>0?" "+c:c)}return c};function tO(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Gk(t))&&(s&&(s+=" "),s+=n);return s}const Gk=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Gk(e[s]))&&(n&&(n+=" "),n+=t);return n};function nO(e,...t){let n,s,a,r=o;function o(c){const d=t.reduce((h,f)=>f(h),e());return n=Q2(d),s=n.cache.get,a=n.cache.set,r=l,l(c)}function l(c){const d=s(c);if(d)return d;const h=eO(c,n);return a(c,h),h}return function(){return r(tO.apply(null,arguments))}}const nn=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Hk=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Vk=/^\((?:(\w[\w-]*):)?(.+)\)$/i,sO=/^\d+\/\d+$/,iO=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aO=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,rO=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,oO=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lO=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Br=e=>sO.test(e),Ke=e=>!!e&&!Number.isNaN(Number(e)),ea=e=>!!e&&Number.isInteger(Number(e)),Zm=e=>e.endsWith("%")&&Ke(e.slice(0,-1)),Ei=e=>iO.test(e),cO=()=>!0,dO=e=>aO.test(e)&&!rO.test(e),Uk=()=>!1,uO=e=>oO.test(e),hO=e=>lO.test(e),fO=e=>!Ae(e)&&!Re(e),mO=e=>sl(e,Fk,Uk),Ae=e=>Hk.test(e),tr=e=>sl(e,qk,dO),Qm=e=>sl(e,bO,Ke),jw=e=>sl(e,Bk,Uk),pO=e=>sl(e,Wk,hO),Fd=e=>sl(e,Yk,uO),Re=e=>Vk.test(e),Al=e=>il(e,qk),gO=e=>il(e,yO),Nw=e=>il(e,Bk),xO=e=>il(e,Fk),vO=e=>il(e,Wk),qd=e=>il(e,Yk,!0),sl=(e,t,n)=>{const s=Hk.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},il=(e,t,n=!1)=>{const s=Vk.exec(e);return s?s[1]?t(s[1]):n:!1},Bk=e=>e==="position"||e==="percentage",Wk=e=>e==="image"||e==="url",Fk=e=>e==="length"||e==="size"||e==="bg-size",qk=e=>e==="length",bO=e=>e==="number",yO=e=>e==="family-name",Yk=e=>e==="shadow",wO=()=>{const e=nn("color"),t=nn("font"),n=nn("text"),s=nn("font-weight"),a=nn("tracking"),r=nn("leading"),o=nn("breakpoint"),l=nn("container"),c=nn("spacing"),d=nn("radius"),h=nn("shadow"),f=nn("inset-shadow"),m=nn("text-shadow"),p=nn("drop-shadow"),y=nn("blur"),g=nn("perspective"),b=nn("aspect"),v=nn("ease"),x=nn("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[..._(),Re,Ae],k=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],N=()=>[Re,Ae,c],O=()=>[Br,"full","auto",...N()],T=()=>[ea,"none","subgrid",Re,Ae],P=()=>["auto",{span:["full",ea,Re,Ae]},ea,Re,Ae],L=()=>[ea,"auto",Re,Ae],G=()=>["auto","min","max","fr",Re,Ae],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],D=()=>["start","end","center","stretch","center-safe","end-safe"],C=()=>["auto",...N()],R=()=>[Br,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],E=()=>[e,Re,Ae],M=()=>[..._(),Nw,jw,{position:[Re,Ae]}],H=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",xO,mO,{size:[Re,Ae]}],K=()=>[Zm,Al,tr],oe=()=>["","none","full",d,Re,Ae],re=()=>["",Ke,Al,tr],ve=()=>["solid","dashed","dotted","double"],ke=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[Ke,Zm,Nw,jw],Ne=()=>["","none",y,Re,Ae],q=()=>["none",Ke,Re,Ae],B=()=>["none",Ke,Re,Ae],Z=()=>[Ke,Re,Ae],Q=()=>[Br,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ei],breakpoint:[Ei],color:[cO],container:[Ei],"drop-shadow":[Ei],ease:["in","out","in-out"],font:[fO],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ei],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ei],shadow:[Ei],spacing:["px",Ke],text:[Ei],"text-shadow":[Ei],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Br,Ae,Re,b]}],container:["container"],columns:[{columns:[Ke,Ae,Re,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{start:O()}],end:[{end:O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[ea,"auto",Re,Ae]}],basis:[{basis:[Br,"full","auto",l,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ke,Br,"auto","initial","none",Ae]}],grow:[{grow:["",Ke,Re,Ae]}],shrink:[{shrink:["",Ke,Re,Ae]}],order:[{order:[ea,"first","last","none",Re,Ae]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":G()}],"auto-rows":[{"auto-rows":G()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...D(),"normal"]}],"justify-self":[{"justify-self":["auto",...D()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...D(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...D(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...D(),"baseline"]}],"place-self":[{"place-self":["auto",...D()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:R()}],w:[{w:[l,"screen",...R()]}],"min-w":[{"min-w":[l,"screen","none",...R()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...R()]}],h:[{h:["screen","lh",...R()]}],"min-h":[{"min-h":["screen","lh","none",...R()]}],"max-h":[{"max-h":["screen","lh",...R()]}],"font-size":[{text:["base",n,Al,tr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,Re,Qm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zm,Ae]}],"font-family":[{font:[gO,Ae,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Re,Ae]}],"line-clamp":[{"line-clamp":[Ke,"none",Re,Qm]}],leading:[{leading:[r,...N()]}],"list-image":[{"list-image":["none",Re,Ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Re,Ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ke,"from-font","auto",Re,tr]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[Ke,"auto",Re,Ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Re,Ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Re,Ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:M()}],"bg-repeat":[{bg:H()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ea,Re,Ae],radial:["",Re,Ae],conic:[ea,Re,Ae]},vO,pO]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:K()}],"gradient-via-pos":[{via:K()}],"gradient-to-pos":[{to:K()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ve(),"hidden","none"]}],"divide-style":[{divide:[...ve(),"hidden","none"]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...ve(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ke,Re,Ae]}],"outline-w":[{outline:["",Ke,Al,tr]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",h,qd,Fd]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",f,qd,Fd]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[Ke,tr]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",m,qd,Fd]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[Ke,Re,Ae]}],"mix-blend":[{"mix-blend":[...ke(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ke()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ke]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[Re,Ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[Ke]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:M()}],"mask-repeat":[{mask:H()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Re,Ae]}],filter:[{filter:["","none",Re,Ae]}],blur:[{blur:Ne()}],brightness:[{brightness:[Ke,Re,Ae]}],contrast:[{contrast:[Ke,Re,Ae]}],"drop-shadow":[{"drop-shadow":["","none",p,qd,Fd]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",Ke,Re,Ae]}],"hue-rotate":[{"hue-rotate":[Ke,Re,Ae]}],invert:[{invert:["",Ke,Re,Ae]}],saturate:[{saturate:[Ke,Re,Ae]}],sepia:[{sepia:["",Ke,Re,Ae]}],"backdrop-filter":[{"backdrop-filter":["","none",Re,Ae]}],"backdrop-blur":[{"backdrop-blur":Ne()}],"backdrop-brightness":[{"backdrop-brightness":[Ke,Re,Ae]}],"backdrop-contrast":[{"backdrop-contrast":[Ke,Re,Ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ke,Re,Ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ke,Re,Ae]}],"backdrop-invert":[{"backdrop-invert":["",Ke,Re,Ae]}],"backdrop-opacity":[{"backdrop-opacity":[Ke,Re,Ae]}],"backdrop-saturate":[{"backdrop-saturate":[Ke,Re,Ae]}],"backdrop-sepia":[{"backdrop-sepia":["",Ke,Re,Ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Re,Ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ke,"initial",Re,Ae]}],ease:[{ease:["linear","initial",v,Re,Ae]}],delay:[{delay:[Ke,Re,Ae]}],animate:[{animate:["none",x,Re,Ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,Re,Ae]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:q()}],"rotate-x":[{"rotate-x":q()}],"rotate-y":[{"rotate-y":q()}],"rotate-z":[{"rotate-z":q()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:Z()}],"skew-x":[{"skew-x":Z()}],"skew-y":[{"skew-y":Z()}],transform:[{transform:[Re,Ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Q()}],"translate-x":[{"translate-x":Q()}],"translate-y":[{"translate-y":Q()}],"translate-z":[{"translate-z":Q()}],"translate-none":["translate-none"],accent:[{accent:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Re,Ae]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Re,Ae]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[Ke,Al,tr,Qm]}],stroke:[{stroke:["none",...E()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},_O=nO(wO);function we(...e){return _O(Pk(e))}const jO=hd("relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground *:data-[slot=alert-description]:text-muted-foreground",info:"border-info/40 bg-info/10 text-info",success:"border-success/40 bg-success/10 text-success",warning:"border-warning/40 bg-warning/10 text-warning",destructive:"border-destructive/40 bg-destructive/10 text-destructive"}},defaultVariants:{variant:"default"}});function me({className:e,variant:t,...n}){return i.jsx("div",{"data-slot":"alert",role:"alert",className:we(jO({variant:t}),e),...n})}function je({className:e,...t}){return i.jsx("div",{"data-slot":"alert-title",className:we("col-start-2 min-h-4 font-medium tracking-tight",e),...t})}function pe({className:e,...t}){return i.jsx("div",{"data-slot":"alert-description",className:we("col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function Ce(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function kw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function of(...e){return t=>{let n=!1;const s=e.map(a=>{const r=kw(a,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let a=0;a<s.length;a++){const r=s[a];typeof r=="function"?r():kw(e[a],null)}}}}function ut(...e){return u.useCallback(of(...e),e)}function NO(e,t){const n=u.createContext(t),s=r=>{const{children:o,...l}=r,c=u.useMemo(()=>l,Object.values(l));return i.jsx(n.Provider,{value:c,children:o})};s.displayName=e+"Provider";function a(r){const o=u.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}return[s,a]}function wi(e,t=[]){let n=[];function s(r,o){const l=u.createContext(o),c=n.length;n=[...n,o];const d=f=>{var v;const{scope:m,children:p,...y}=f,g=((v=m==null?void 0:m[e])==null?void 0:v[c])||l,b=u.useMemo(()=>y,Object.values(y));return i.jsx(g.Provider,{value:b,children:p})};d.displayName=r+"Provider";function h(f,m){var g;const p=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,y=u.useContext(p);if(y)return y;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${r}\``)}return[d,h]}const a=()=>{const r=n.map(o=>u.createContext(o));return function(l){const c=(l==null?void 0:l[e])||r;return u.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[s,kO(a,...t)]}function kO(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(r){const o=s.reduce((l,{useScope:c,scopeName:d})=>{const f=c(r)[`__scope${d}`];return{...l,...f}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Tn=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},SO=Yj[" useId ".trim().toString()]||(()=>{}),CO=0;function Bs(e){const[t,n]=u.useState(SO());return Tn(()=>{n(s=>s??String(CO++))},[e]),t?`radix-${t}`:""}var DO=Yj[" useInsertionEffect ".trim().toString()]||Tn;function La({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[a,r,o]=EO({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:a;{const h=u.useRef(e!==void 0);u.useEffect(()=>{const f=h.current;f!==l&&console.warn(`${s} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=l},[l,s])}const d=u.useCallback(h=>{var f;if(l){const m=AO(h)?h(e):h;m!==e&&((f=o.current)==null||f.call(o,m))}else r(h)},[l,e,r,o]);return[c,d]}function EO({defaultProp:e,onChange:t}){const[n,s]=u.useState(e),a=u.useRef(n),r=u.useRef(t);return DO(()=>{r.current=t},[t]),u.useEffect(()=>{var o;a.current!==n&&((o=r.current)==null||o.call(r,n),a.current=n)},[n,a]),[n,s,r]}function AO(e){return typeof e=="function"}function jr(e){const t=TO(e),n=u.forwardRef((s,a)=>{const{children:r,...o}=s,l=u.Children.toArray(r),c=l.find(zO);if(c){const d=c.props.children,h=l.map(f=>f===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:f);return i.jsx(t,{...o,ref:a,children:u.isValidElement(d)?u.cloneElement(d,void 0,h):null})}return i.jsx(t,{...o,ref:a,children:r})});return n.displayName=`${e}.Slot`,n}var RO=jr("Slot");function TO(e){const t=u.forwardRef((n,s)=>{const{children:a,...r}=n;if(u.isValidElement(a)){const o=$O(a),l=MO(r,a.props);return a.type!==u.Fragment&&(l.ref=s?of(s,o):o),u.cloneElement(a,l)}return u.Children.count(a)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Xk=Symbol("radix.slottable");function OO(e){const t=({children:n})=>i.jsx(i.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Xk,t}function zO(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Xk}function MO(e,t){const n={...t};for(const s in t){const a=e[s],r=t[s];/^on[A-Z]/.test(s)?a&&r?n[s]=(...l)=>{const c=r(...l);return a(...l),c}:a&&(n[s]=a):s==="style"?n[s]={...a,...r}:s==="className"&&(n[s]=[a,r].filter(Boolean).join(" "))}return{...e,...n}}function $O(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var LO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],We=LO.reduce((e,t)=>{const n=jr(`Primitive.${t}`),s=u.forwardRef((a,r)=>{const{asChild:o,...l}=a,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:r})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function Kk(e,t){e&&Ko.flushSync(()=>e.dispatchEvent(t))}function mi(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function PO(e,t=globalThis==null?void 0:globalThis.document){const n=mi(e);u.useEffect(()=>{const s=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var IO="DismissableLayer",Dg="dismissableLayer.update",GO="dismissableLayer.pointerDownOutside",HO="dismissableLayer.focusOutside",Sw,Zk=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fd=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:r,onInteractOutside:o,onDismiss:l,...c}=e,d=u.useContext(Zk),[h,f]=u.useState(null),m=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=u.useState({}),y=ut(t,j=>f(j)),g=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(b),x=h?g.indexOf(h):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=v,S=BO(j=>{const N=j.target,O=[...d.branches].some(T=>T.contains(N));!_||O||(a==null||a(j),o==null||o(j),j.defaultPrevented||l==null||l())},m),k=WO(j=>{const N=j.target;[...d.branches].some(T=>T.contains(N))||(r==null||r(j),o==null||o(j),j.defaultPrevented||l==null||l())},m);return PO(j=>{x===d.layers.size-1&&(s==null||s(j),!j.defaultPrevented&&l&&(j.preventDefault(),l()))},m),u.useEffect(()=>{if(h)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Sw=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),Cw(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Sw)}},[h,m,n,d]),u.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),Cw())},[h,d]),u.useEffect(()=>{const j=()=>p({});return document.addEventListener(Dg,j),()=>document.removeEventListener(Dg,j)},[]),i.jsx(We.div,{...c,ref:y,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:Ce(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Ce(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Ce(e.onPointerDownCapture,S.onPointerDownCapture)})});fd.displayName=IO;var VO="DismissableLayerBranch",UO=u.forwardRef((e,t)=>{const n=u.useContext(Zk),s=u.useRef(null),a=ut(t,s);return u.useEffect(()=>{const r=s.current;if(r)return n.branches.add(r),()=>{n.branches.delete(r)}},[n.branches]),i.jsx(We.div,{...e,ref:a})});UO.displayName=VO;function BO(e,t=globalThis==null?void 0:globalThis.document){const n=mi(e),s=u.useRef(!1),a=u.useRef(()=>{});return u.useEffect(()=>{const r=l=>{if(l.target&&!s.current){let c=function(){Qk(GO,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);s.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",r)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",r),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function WO(e,t=globalThis==null?void 0:globalThis.document){const n=mi(e),s=u.useRef(!1);return u.useEffect(()=>{const a=r=>{r.target&&!s.current&&Qk(HO,n,{originalEvent:r},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Cw(){const e=new CustomEvent(Dg);document.dispatchEvent(e)}function Qk(e,t,n,{discrete:s}){const a=n.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),s?Kk(a,r):a.dispatchEvent(r)}var Jm="focusScope.autoFocusOnMount",ep="focusScope.autoFocusOnUnmount",Dw={bubbles:!1,cancelable:!0},FO="FocusScope",lf=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:r,...o}=e,[l,c]=u.useState(null),d=mi(a),h=mi(r),f=u.useRef(null),m=ut(t,g=>c(g)),p=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(s){let g=function(w){if(p.paused||!l)return;const _=w.target;l.contains(_)?f.current=_:aa(f.current,{select:!0})},b=function(w){if(p.paused||!l)return;const _=w.relatedTarget;_!==null&&(l.contains(_)||aa(f.current,{select:!0}))},v=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&aa(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",b);const x=new MutationObserver(v);return l&&x.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",b),x.disconnect()}}},[s,l,p.paused]),u.useEffect(()=>{if(l){Aw.add(p);const g=document.activeElement;if(!l.contains(g)){const v=new CustomEvent(Jm,Dw);l.addEventListener(Jm,d),l.dispatchEvent(v),v.defaultPrevented||(qO(QO(Jk(l)),{select:!0}),document.activeElement===g&&aa(l))}return()=>{l.removeEventListener(Jm,d),setTimeout(()=>{const v=new CustomEvent(ep,Dw);l.addEventListener(ep,h),l.dispatchEvent(v),v.defaultPrevented||aa(g??document.body,{select:!0}),l.removeEventListener(ep,h),Aw.remove(p)},0)}}},[l,d,h,p]);const y=u.useCallback(g=>{if(!n&&!s||p.paused)return;const b=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(b&&v){const x=g.currentTarget,[w,_]=YO(x);w&&_?!g.shiftKey&&v===_?(g.preventDefault(),n&&aa(w,{select:!0})):g.shiftKey&&v===w&&(g.preventDefault(),n&&aa(_,{select:!0})):v===x&&g.preventDefault()}},[n,s,p.paused]);return i.jsx(We.div,{tabIndex:-1,...o,ref:m,onKeyDown:y})});lf.displayName=FO;function qO(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(aa(s,{select:t}),document.activeElement!==n)return}function YO(e){const t=Jk(e),n=Ew(t,e),s=Ew(t.reverse(),e);return[n,s]}function Jk(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ew(e,t){for(const n of e)if(!XO(n,{upTo:t}))return n}function XO(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function KO(e){return e instanceof HTMLInputElement&&"select"in e}function aa(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&KO(e)&&t&&e.select()}}var Aw=ZO();function ZO(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Rw(e,t),e.unshift(t)},remove(t){var n;e=Rw(e,t),(n=e[0])==null||n.resume()}}}function Rw(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function QO(e){return e.filter(t=>t.tagName!=="A")}var JO="Portal",md=u.forwardRef((e,t)=>{var l;const{container:n,...s}=e,[a,r]=u.useState(!1);Tn(()=>r(!0),[]);const o=n||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?t0.createPortal(i.jsx(We.div,{...s,ref:t}),o):null});md.displayName=JO;function ez(e,t){return u.useReducer((n,s)=>t[n][s]??n,e)}var $s=e=>{const{present:t,children:n}=e,s=tz(t),a=typeof n=="function"?n({present:s.isPresent}):u.Children.only(n),r=ut(s.ref,nz(a));return typeof n=="function"||s.isPresent?u.cloneElement(a,{ref:r}):null};$s.displayName="Presence";function tz(e){const[t,n]=u.useState(),s=u.useRef(null),a=u.useRef(e),r=u.useRef("none"),o=e?"mounted":"unmounted",[l,c]=ez(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=Yd(s.current);r.current=l==="mounted"?d:"none"},[l]),Tn(()=>{const d=s.current,h=a.current;if(h!==e){const m=r.current,p=Yd(d);e?c("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(h&&m!==p?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),Tn(()=>{if(t){let d;const h=t.ownerDocument.defaultView??window,f=p=>{const g=Yd(s.current).includes(p.animationName);if(p.target===t&&g&&(c("ANIMATION_END"),!a.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",d=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},m=p=>{p.target===t&&(r.current=Yd(s.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{h.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:u.useCallback(d=>{s.current=d?getComputedStyle(d):null,n(d)},[])}}function Yd(e){return(e==null?void 0:e.animationName)||"none"}function nz(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tp=0;function bv(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Tw()),document.body.insertAdjacentElement("beforeend",e[1]??Tw()),tp++,()=>{tp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),tp--}},[])}function Tw(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var si=function(){return si=Object.assign||function(t){for(var n,s=1,a=arguments.length;s<a;s++){n=arguments[s];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},si.apply(this,arguments)};function eS(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(e);a<s.length;a++)t.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(n[s[a]]=e[s[a]]);return n}function sz(e,t,n){if(n||arguments.length===2)for(var s=0,a=t.length,r;s<a;s++)(r||!(s in t))&&(r||(r=Array.prototype.slice.call(t,0,s)),r[s]=t[s]);return e.concat(r||Array.prototype.slice.call(t))}var Ru="right-scroll-bar-position",Tu="width-before-scroll-bar",iz="with-scroll-bars-hidden",az="--removed-body-scroll-bar-size";function np(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function rz(e,t){var n=u.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var a=n.value;a!==s&&(n.value=s,n.callback(s,a))}}}})[0];return n.callback=t,n.facade}var oz=typeof window<"u"?u.useLayoutEffect:u.useEffect,Ow=new WeakMap;function lz(e,t){var n=rz(null,function(s){return e.forEach(function(a){return np(a,s)})});return oz(function(){var s=Ow.get(n);if(s){var a=new Set(s),r=new Set(e),o=n.current;a.forEach(function(l){r.has(l)||np(l,null)}),r.forEach(function(l){a.has(l)||np(l,o)})}Ow.set(n,e)},[e]),n}function cz(e){return e}function dz(e,t){t===void 0&&(t=cz);var n=[],s=!1,a={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(r){var o=t(r,s);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(r){for(s=!0;n.length;){var o=n;n=[],o.forEach(r)}n={push:function(l){return r(l)},filter:function(){return n}}},assignMedium:function(r){s=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(r),o=n}var c=function(){var h=o;o=[],h.forEach(r)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(h){o.push(h),d()},filter:function(h){return o=o.filter(h),n}}}};return a}function uz(e){e===void 0&&(e={});var t=dz(null);return t.options=si({async:!0,ssr:!1},e),t}var tS=function(e){var t=e.sideCar,n=eS(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return u.createElement(s,si({},n))};tS.isSideCarExport=!0;function hz(e,t){return e.useMedium(t),tS}var nS=uz(),sp=function(){},cf=u.forwardRef(function(e,t){var n=u.useRef(null),s=u.useState({onScrollCapture:sp,onWheelCapture:sp,onTouchMoveCapture:sp}),a=s[0],r=s[1],o=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,h=e.enabled,f=e.shards,m=e.sideCar,p=e.noRelative,y=e.noIsolation,g=e.inert,b=e.allowPinchZoom,v=e.as,x=v===void 0?"div":v,w=e.gapMode,_=eS(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=m,k=lz([n,t]),j=si(si({},_),a);return u.createElement(u.Fragment,null,h&&u.createElement(S,{sideCar:nS,removeScrollBar:d,shards:f,noRelative:p,noIsolation:y,inert:g,setCallbacks:r,allowPinchZoom:!!b,lockRef:n,gapMode:w}),o?u.cloneElement(u.Children.only(l),si(si({},j),{ref:k})):u.createElement(x,si({},j,{className:c,ref:k}),l))});cf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};cf.classNames={fullWidth:Tu,zeroRight:Ru};var fz=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function mz(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=fz();return t&&e.setAttribute("nonce",t),e}function pz(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function gz(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var xz=function(){var e=0,t=null;return{add:function(n){e==0&&(t=mz())&&(pz(t,n),gz(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},vz=function(){var e=xz();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},sS=function(){var e=vz(),t=function(n){var s=n.styles,a=n.dynamic;return e(s,a),null};return t},bz={left:0,top:0,right:0,gap:0},ip=function(e){return parseInt(e||"",10)||0},yz=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[ip(n),ip(s),ip(a)]},wz=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return bz;var t=yz(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},_z=sS(),Ao="data-scroll-locked",jz=function(e,t,n,s){var a=e.left,r=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
50
|
+
.`.concat(iz,` {
|
|
51
|
+
overflow: hidden `).concat(s,`;
|
|
52
|
+
padding-right: `).concat(l,"px ").concat(s,`;
|
|
53
|
+
}
|
|
54
|
+
body[`).concat(Ao,`] {
|
|
55
|
+
overflow: hidden `).concat(s,`;
|
|
56
|
+
overscroll-behavior: contain;
|
|
57
|
+
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
58
|
+
padding-left: `.concat(a,`px;
|
|
59
|
+
padding-top: `).concat(r,`px;
|
|
60
|
+
padding-right: `).concat(o,`px;
|
|
61
|
+
margin-left:0;
|
|
62
|
+
margin-top:0;
|
|
63
|
+
margin-right: `).concat(l,"px ").concat(s,`;
|
|
64
|
+
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.`).concat(Ru,` {
|
|
68
|
+
right: `).concat(l,"px ").concat(s,`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.`).concat(Tu,` {
|
|
72
|
+
margin-right: `).concat(l,"px ").concat(s,`;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.`).concat(Ru," .").concat(Ru,` {
|
|
76
|
+
right: 0 `).concat(s,`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.`).concat(Tu," .").concat(Tu,` {
|
|
80
|
+
margin-right: 0 `).concat(s,`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
body[`).concat(Ao,`] {
|
|
84
|
+
`).concat(az,": ").concat(l,`px;
|
|
85
|
+
}
|
|
86
|
+
`)},zw=function(){var e=parseInt(document.body.getAttribute(Ao)||"0",10);return isFinite(e)?e:0},Nz=function(){u.useEffect(function(){return document.body.setAttribute(Ao,(zw()+1).toString()),function(){var e=zw()-1;e<=0?document.body.removeAttribute(Ao):document.body.setAttribute(Ao,e.toString())}},[])},kz=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,a=s===void 0?"margin":s;Nz();var r=u.useMemo(function(){return wz(a)},[a]);return u.createElement(_z,{styles:jz(r,!t,a,n?"":"!important")})},Eg=!1;if(typeof window<"u")try{var Xd=Object.defineProperty({},"passive",{get:function(){return Eg=!0,!0}});window.addEventListener("test",Xd,Xd),window.removeEventListener("test",Xd,Xd)}catch{Eg=!1}var Wr=Eg?{passive:!1}:!1,Sz=function(e){return e.tagName==="TEXTAREA"},iS=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Sz(e)&&n[t]==="visible")},Cz=function(e){return iS(e,"overflowY")},Dz=function(e){return iS(e,"overflowX")},Mw=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=aS(e,s);if(a){var r=rS(e,s),o=r[1],l=r[2];if(o>l)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},Ez=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},Az=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},aS=function(e,t){return e==="v"?Cz(t):Dz(t)},rS=function(e,t){return e==="v"?Ez(t):Az(t)},Rz=function(e,t){return e==="h"&&t==="rtl"?-1:1},Tz=function(e,t,n,s,a){var r=Rz(e,window.getComputedStyle(t).direction),o=r*s,l=n.target,c=t.contains(l),d=!1,h=o>0,f=0,m=0;do{if(!l)break;var p=rS(e,l),y=p[0],g=p[1],b=p[2],v=g-b-r*y;(y||v)&&aS(e,l)&&(f+=v,m+=y);var x=l.parentNode;l=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(h&&Math.abs(f)<1||!h&&Math.abs(m)<1)&&(d=!0),d},Kd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},$w=function(e){return[e.deltaX,e.deltaY]},Lw=function(e){return e&&"current"in e?e.current:e},Oz=function(e,t){return e[0]===t[0]&&e[1]===t[1]},zz=function(e){return`
|
|
87
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
88
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
89
|
+
`)},Mz=0,Fr=[];function $z(e){var t=u.useRef([]),n=u.useRef([0,0]),s=u.useRef(),a=u.useState(Mz++)[0],r=u.useState(sS)[0],o=u.useRef(e);u.useEffect(function(){o.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var g=sz([e.lockRef.current],(e.shards||[]).map(Lw),!0).filter(Boolean);return g.forEach(function(b){return b.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),g.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=u.useCallback(function(g,b){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var v=Kd(g),x=n.current,w="deltaX"in g?g.deltaX:x[0]-v[0],_="deltaY"in g?g.deltaY:x[1]-v[1],S,k=g.target,j=Math.abs(w)>Math.abs(_)?"h":"v";if("touches"in g&&j==="h"&&k.type==="range")return!1;var N=Mw(j,k);if(!N)return!0;if(N?S=j:(S=j==="v"?"h":"v",N=Mw(j,k)),!N)return!1;if(!s.current&&"changedTouches"in g&&(w||_)&&(s.current=S),!S)return!0;var O=s.current||S;return Tz(O,b,g,O==="h"?w:_)},[]),c=u.useCallback(function(g){var b=g;if(!(!Fr.length||Fr[Fr.length-1]!==r)){var v="deltaY"in b?$w(b):Kd(b),x=t.current.filter(function(S){return S.name===b.type&&(S.target===b.target||b.target===S.shadowParent)&&Oz(S.delta,v)})[0];if(x&&x.should){b.cancelable&&b.preventDefault();return}if(!x){var w=(o.current.shards||[]).map(Lw).filter(Boolean).filter(function(S){return S.contains(b.target)}),_=w.length>0?l(b,w[0]):!o.current.noIsolation;_&&b.cancelable&&b.preventDefault()}}},[]),d=u.useCallback(function(g,b,v,x){var w={name:g,delta:b,target:v,should:x,shadowParent:Lz(v)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(_){return _!==w})},1)},[]),h=u.useCallback(function(g){n.current=Kd(g),s.current=void 0},[]),f=u.useCallback(function(g){d(g.type,$w(g),g.target,l(g,e.lockRef.current))},[]),m=u.useCallback(function(g){d(g.type,Kd(g),g.target,l(g,e.lockRef.current))},[]);u.useEffect(function(){return Fr.push(r),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Wr),document.addEventListener("touchmove",c,Wr),document.addEventListener("touchstart",h,Wr),function(){Fr=Fr.filter(function(g){return g!==r}),document.removeEventListener("wheel",c,Wr),document.removeEventListener("touchmove",c,Wr),document.removeEventListener("touchstart",h,Wr)}},[]);var p=e.removeScrollBar,y=e.inert;return u.createElement(u.Fragment,null,y?u.createElement(r,{styles:zz(a)}):null,p?u.createElement(kz,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Lz(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Pz=hz(nS,$z);var df=u.forwardRef(function(e,t){return u.createElement(cf,si({},e,{ref:t,sideCar:Pz}))});df.classNames=cf.classNames;var Iz=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},qr=new WeakMap,Zd=new WeakMap,Qd={},ap=0,oS=function(e){return e&&(e.host||oS(e.parentNode))},Gz=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=oS(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Hz=function(e,t,n,s){var a=Gz(t,Array.isArray(e)?e:[e]);Qd[n]||(Qd[n]=new WeakMap);var r=Qd[n],o=[],l=new Set,c=new Set(a),d=function(f){!f||l.has(f)||(l.add(f),d(f.parentNode))};a.forEach(d);var h=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(m){if(l.has(m))h(m);else try{var p=m.getAttribute(s),y=p!==null&&p!=="false",g=(qr.get(m)||0)+1,b=(r.get(m)||0)+1;qr.set(m,g),r.set(m,b),o.push(m),g===1&&y&&Zd.set(m,!0),b===1&&m.setAttribute(n,"true"),y||m.setAttribute(s,"true")}catch(v){console.error("aria-hidden: cannot operate on ",m,v)}})};return h(t),l.clear(),ap++,function(){o.forEach(function(f){var m=qr.get(f)-1,p=r.get(f)-1;qr.set(f,m),r.set(f,p),m||(Zd.has(f)||f.removeAttribute(s),Zd.delete(f)),p||f.removeAttribute(n)}),ap--,ap||(qr=new WeakMap,qr=new WeakMap,Zd=new WeakMap,Qd={})}},yv=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),a=Iz(e);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live], script"))),Hz(s,a,n,"aria-hidden")):function(){return null}},uf="Dialog",[lS]=wi(uf),[Vz,Ks]=lS(uf),cS=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:a,onOpenChange:r,modal:o=!0}=e,l=u.useRef(null),c=u.useRef(null),[d,h]=La({prop:s,defaultProp:a??!1,onChange:r,caller:uf});return i.jsx(Vz,{scope:t,triggerRef:l,contentRef:c,contentId:Bs(),titleId:Bs(),descriptionId:Bs(),open:d,onOpenChange:h,onOpenToggle:u.useCallback(()=>h(f=>!f),[h]),modal:o,children:n})};cS.displayName=uf;var dS="DialogTrigger",Uz=u.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Ks(dS,n),r=ut(t,a.triggerRef);return i.jsx(We.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":jv(a.open),...s,ref:r,onClick:Ce(e.onClick,a.onOpenToggle)})});Uz.displayName=dS;var wv="DialogPortal",[Bz,uS]=lS(wv,{forceMount:void 0}),hS=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:a}=e,r=Ks(wv,t);return i.jsx(Bz,{scope:t,forceMount:n,children:u.Children.map(s,o=>i.jsx($s,{present:n||r.open,children:i.jsx(md,{asChild:!0,container:a,children:o})}))})};hS.displayName=wv;var bh="DialogOverlay",fS=u.forwardRef((e,t)=>{const n=uS(bh,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,r=Ks(bh,e.__scopeDialog);return r.modal?i.jsx($s,{present:s||r.open,children:i.jsx(Fz,{...a,ref:t})}):null});fS.displayName=bh;var Wz=jr("DialogOverlay.RemoveScroll"),Fz=u.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Ks(bh,n);return i.jsx(df,{as:Wz,allowPinchZoom:!0,shards:[a.contentRef],children:i.jsx(We.div,{"data-state":jv(a.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Nr="DialogContent",mS=u.forwardRef((e,t)=>{const n=uS(Nr,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,r=Ks(Nr,e.__scopeDialog);return i.jsx($s,{present:s||r.open,children:r.modal?i.jsx(qz,{...a,ref:t}):i.jsx(Yz,{...a,ref:t})})});mS.displayName=Nr;var qz=u.forwardRef((e,t)=>{const n=Ks(Nr,e.__scopeDialog),s=u.useRef(null),a=ut(t,n.contentRef,s);return u.useEffect(()=>{const r=s.current;if(r)return yv(r)},[]),i.jsx(pS,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ce(e.onCloseAutoFocus,r=>{var o;r.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Ce(e.onPointerDownOutside,r=>{const o=r.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&r.preventDefault()}),onFocusOutside:Ce(e.onFocusOutside,r=>r.preventDefault())})}),Yz=u.forwardRef((e,t)=>{const n=Ks(Nr,e.__scopeDialog),s=u.useRef(!1),a=u.useRef(!1);return i.jsx(pS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,r),r.defaultPrevented||(s.current||(l=n.triggerRef.current)==null||l.focus(),r.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:r=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,r),r.defaultPrevented||(s.current=!0,r.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=r.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&a.current&&r.preventDefault()}})}),pS=u.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:r,...o}=e,l=Ks(Nr,n),c=u.useRef(null),d=ut(t,c);return bv(),i.jsxs(i.Fragment,{children:[i.jsx(lf,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:r,children:i.jsx(fd,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":jv(l.open),...o,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(Xz,{titleId:l.titleId}),i.jsx(Zz,{contentRef:c,descriptionId:l.descriptionId})]})]})}),_v="DialogTitle",gS=u.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Ks(_v,n);return i.jsx(We.h2,{id:a.titleId,...s,ref:t})});gS.displayName=_v;var xS="DialogDescription",vS=u.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Ks(xS,n);return i.jsx(We.p,{id:a.descriptionId,...s,ref:t})});vS.displayName=xS;var bS="DialogClose",yS=u.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Ks(bS,n);return i.jsx(We.button,{type:"button",...s,ref:t,onClick:Ce(e.onClick,()=>a.onOpenChange(!1))})});yS.displayName=bS;function jv(e){return e?"open":"closed"}var wS="DialogTitleWarning",[pW,_S]=NO(wS,{contentName:Nr,titleName:_v,docsSlug:"dialog"}),Xz=({titleId:e})=>{const t=_S(wS),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
90
|
+
|
|
91
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
92
|
+
|
|
93
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return u.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Kz="DialogDescriptionWarning",Zz=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${_S(Kz).contentName}}.`;return u.useEffect(()=>{var r;const a=(r=e.current)==null?void 0:r.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},jS=cS,NS=hS,kS=fS,SS=mS,CS=gS,DS=vS,Nv=yS;/**
|
|
94
|
+
* @license lucide-react v0.511.0 - ISC
|
|
95
|
+
*
|
|
96
|
+
* This source code is licensed under the ISC license.
|
|
97
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
+
*/const Qz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Jz=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase()),Pw=e=>{const t=Jz(e);return t.charAt(0).toUpperCase()+t.slice(1)},ES=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim(),eM=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
99
|
+
* @license lucide-react v0.511.0 - ISC
|
|
100
|
+
*
|
|
101
|
+
* This source code is licensed under the ISC license.
|
|
102
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
+
*/var tM={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
104
|
+
* @license lucide-react v0.511.0 - ISC
|
|
105
|
+
*
|
|
106
|
+
* This source code is licensed under the ISC license.
|
|
107
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
108
|
+
*/const nM=u.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:r,iconNode:o,...l},c)=>u.createElement("svg",{ref:c,...tM,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:ES("lucide",a),...!r&&!eM(l)&&{"aria-hidden":"true"},...l},[...o.map(([d,h])=>u.createElement(d,h)),...Array.isArray(r)?r:[r]]));/**
|
|
109
|
+
* @license lucide-react v0.511.0 - ISC
|
|
110
|
+
*
|
|
111
|
+
* This source code is licensed under the ISC license.
|
|
112
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
113
|
+
*/const ze=(e,t)=>{const n=u.forwardRef(({className:s,...a},r)=>u.createElement(nM,{ref:r,iconNode:t,className:ES(`lucide-${Qz(Pw(e))}`,`lucide-${e}`,s),...a}));return n.displayName=Pw(e),n};/**
|
|
114
|
+
* @license lucide-react v0.511.0 - ISC
|
|
115
|
+
*
|
|
116
|
+
* This source code is licensed under the ISC license.
|
|
117
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
118
|
+
*/const sM=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],iM=ze("archive-restore",sM);/**
|
|
119
|
+
* @license lucide-react v0.511.0 - ISC
|
|
120
|
+
*
|
|
121
|
+
* This source code is licensed under the ISC license.
|
|
122
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
123
|
+
*/const aM=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Iw=ze("archive",aM);/**
|
|
124
|
+
* @license lucide-react v0.511.0 - ISC
|
|
125
|
+
*
|
|
126
|
+
* This source code is licensed under the ISC license.
|
|
127
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
128
|
+
*/const rM=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],oM=ze("arrow-down",rM);/**
|
|
129
|
+
* @license lucide-react v0.511.0 - ISC
|
|
130
|
+
*
|
|
131
|
+
* This source code is licensed under the ISC license.
|
|
132
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
133
|
+
*/const lM=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],AS=ze("arrow-left",lM);/**
|
|
134
|
+
* @license lucide-react v0.511.0 - ISC
|
|
135
|
+
*
|
|
136
|
+
* This source code is licensed under the ISC license.
|
|
137
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
138
|
+
*/const cM=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],dM=ze("arrow-up",cM);/**
|
|
139
|
+
* @license lucide-react v0.511.0 - ISC
|
|
140
|
+
*
|
|
141
|
+
* This source code is licensed under the ISC license.
|
|
142
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
143
|
+
*/const uM=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],kv=ze("bot",uM);/**
|
|
144
|
+
* @license lucide-react v0.511.0 - ISC
|
|
145
|
+
*
|
|
146
|
+
* This source code is licensed under the ISC license.
|
|
147
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
148
|
+
*/const hM=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],fM=ze("briefcase",hM);/**
|
|
149
|
+
* @license lucide-react v0.511.0 - ISC
|
|
150
|
+
*
|
|
151
|
+
* This source code is licensed under the ISC license.
|
|
152
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
153
|
+
*/const mM=[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]],pM=ze("building-2",mM);/**
|
|
154
|
+
* @license lucide-react v0.511.0 - ISC
|
|
155
|
+
*
|
|
156
|
+
* This source code is licensed under the ISC license.
|
|
157
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
158
|
+
*/const gM=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Or=ze("check",gM);/**
|
|
159
|
+
* @license lucide-react v0.511.0 - ISC
|
|
160
|
+
*
|
|
161
|
+
* This source code is licensed under the ISC license.
|
|
162
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
163
|
+
*/const xM=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],hf=ze("chevron-down",xM);/**
|
|
164
|
+
* @license lucide-react v0.511.0 - ISC
|
|
165
|
+
*
|
|
166
|
+
* This source code is licensed under the ISC license.
|
|
167
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
168
|
+
*/const vM=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],pd=ze("chevron-right",vM);/**
|
|
169
|
+
* @license lucide-react v0.511.0 - ISC
|
|
170
|
+
*
|
|
171
|
+
* This source code is licensed under the ISC license.
|
|
172
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
173
|
+
*/const bM=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],yM=ze("chevron-up",bM);/**
|
|
174
|
+
* @license lucide-react v0.511.0 - ISC
|
|
175
|
+
*
|
|
176
|
+
* This source code is licensed under the ISC license.
|
|
177
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
178
|
+
*/const wM=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],RS=ze("chevrons-up-down",wM);/**
|
|
179
|
+
* @license lucide-react v0.511.0 - ISC
|
|
180
|
+
*
|
|
181
|
+
* This source code is licensed under the ISC license.
|
|
182
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
183
|
+
*/const _M=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],rt=ze("circle-alert",_M);/**
|
|
184
|
+
* @license lucide-react v0.511.0 - ISC
|
|
185
|
+
*
|
|
186
|
+
* This source code is licensed under the ISC license.
|
|
187
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
188
|
+
*/const jM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ff=ze("circle-check",jM);/**
|
|
189
|
+
* @license lucide-react v0.511.0 - ISC
|
|
190
|
+
*
|
|
191
|
+
* This source code is licensed under the ISC license.
|
|
192
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
193
|
+
*/const NM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],kM=ze("circle",NM);/**
|
|
194
|
+
* @license lucide-react v0.511.0 - ISC
|
|
195
|
+
*
|
|
196
|
+
* This source code is licensed under the ISC license.
|
|
197
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
198
|
+
*/const SM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],TS=ze("clock",SM);/**
|
|
199
|
+
* @license lucide-react v0.511.0 - ISC
|
|
200
|
+
*
|
|
201
|
+
* This source code is licensed under the ISC license.
|
|
202
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
203
|
+
*/const CM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],DM=ze("columns-2",CM);/**
|
|
204
|
+
* @license lucide-react v0.511.0 - ISC
|
|
205
|
+
*
|
|
206
|
+
* This source code is licensed under the ISC license.
|
|
207
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
208
|
+
*/const EM=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Sv=ze("copy",EM);/**
|
|
209
|
+
* @license lucide-react v0.511.0 - ISC
|
|
210
|
+
*
|
|
211
|
+
* This source code is licensed under the ISC license.
|
|
212
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
213
|
+
*/const AM=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Cv=ze("ellipsis",AM);/**
|
|
214
|
+
* @license lucide-react v0.511.0 - ISC
|
|
215
|
+
*
|
|
216
|
+
* This source code is licensed under the ISC license.
|
|
217
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
218
|
+
*/const RM=[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]],TM=ze("eraser",RM);/**
|
|
219
|
+
* @license lucide-react v0.511.0 - ISC
|
|
220
|
+
*
|
|
221
|
+
* This source code is licensed under the ISC license.
|
|
222
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
223
|
+
*/const OM=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],gd=ze("eye",OM);/**
|
|
224
|
+
* @license lucide-react v0.511.0 - ISC
|
|
225
|
+
*
|
|
226
|
+
* This source code is licensed under the ISC license.
|
|
227
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
228
|
+
*/const zM=[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],MM=ze("file-question",zM);/**
|
|
229
|
+
* @license lucide-react v0.511.0 - ISC
|
|
230
|
+
*
|
|
231
|
+
* This source code is licensed under the ISC license.
|
|
232
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
233
|
+
*/const $M=[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],Dv=ze("folder-git-2",$M);/**
|
|
234
|
+
* @license lucide-react v0.511.0 - ISC
|
|
235
|
+
*
|
|
236
|
+
* This source code is licensed under the ISC license.
|
|
237
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
238
|
+
*/const LM=[["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M14 13h3",key:"1dgedf"}],["path",{d:"M7 13h3",key:"1pygq7"}]],OS=ze("folder-git",LM);/**
|
|
239
|
+
* @license lucide-react v0.511.0 - ISC
|
|
240
|
+
*
|
|
241
|
+
* This source code is licensed under the ISC license.
|
|
242
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
243
|
+
*/const PM=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],zS=ze("git-fork",PM);/**
|
|
244
|
+
* @license lucide-react v0.511.0 - ISC
|
|
245
|
+
*
|
|
246
|
+
* This source code is licensed under the ISC license.
|
|
247
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
248
|
+
*/const IM=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}]],Ag=ze("git-pull-request-arrow",IM);/**
|
|
249
|
+
* @license lucide-react v0.511.0 - ISC
|
|
250
|
+
*
|
|
251
|
+
* This source code is licensed under the ISC license.
|
|
252
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
253
|
+
*/const GM=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],HM=ze("hard-drive",GM);/**
|
|
254
|
+
* @license lucide-react v0.511.0 - ISC
|
|
255
|
+
*
|
|
256
|
+
* This source code is licensed under the ISC license.
|
|
257
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
258
|
+
*/const VM=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],UM=ze("history",VM);/**
|
|
259
|
+
* @license lucide-react v0.511.0 - ISC
|
|
260
|
+
*
|
|
261
|
+
* This source code is licensed under the ISC license.
|
|
262
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
263
|
+
*/const BM=[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]],MS=ze("hourglass",BM);/**
|
|
264
|
+
* @license lucide-react v0.511.0 - ISC
|
|
265
|
+
*
|
|
266
|
+
* This source code is licensed under the ISC license.
|
|
267
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
268
|
+
*/const WM=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],$S=ze("house",WM);/**
|
|
269
|
+
* @license lucide-react v0.511.0 - ISC
|
|
270
|
+
*
|
|
271
|
+
* This source code is licensed under the ISC license.
|
|
272
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
273
|
+
*/const FM=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],qM=ze("inbox",FM);/**
|
|
274
|
+
* @license lucide-react v0.511.0 - ISC
|
|
275
|
+
*
|
|
276
|
+
* This source code is licensed under the ISC license.
|
|
277
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
278
|
+
*/const YM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],pn=ze("info",YM);/**
|
|
279
|
+
* @license lucide-react v0.511.0 - ISC
|
|
280
|
+
*
|
|
281
|
+
* This source code is licensed under the ISC license.
|
|
282
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
283
|
+
*/const XM=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],KM=ze("laptop",XM);/**
|
|
284
|
+
* @license lucide-react v0.511.0 - ISC
|
|
285
|
+
*
|
|
286
|
+
* This source code is licensed under the ISC license.
|
|
287
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
288
|
+
*/const ZM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],QM=ze("life-buoy",ZM);/**
|
|
289
|
+
* @license lucide-react v0.511.0 - ISC
|
|
290
|
+
*
|
|
291
|
+
* This source code is licensed under the ISC license.
|
|
292
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
293
|
+
*/const JM=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],mf=ze("list-checks",JM);/**
|
|
294
|
+
* @license lucide-react v0.511.0 - ISC
|
|
295
|
+
*
|
|
296
|
+
* This source code is licensed under the ISC license.
|
|
297
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
298
|
+
*/const e$=[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]],Ev=ze("list-ordered",e$);/**
|
|
299
|
+
* @license lucide-react v0.511.0 - ISC
|
|
300
|
+
*
|
|
301
|
+
* This source code is licensed under the ISC license.
|
|
302
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
303
|
+
*/const t$=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],n$=ze("loader-circle",t$);/**
|
|
304
|
+
* @license lucide-react v0.511.0 - ISC
|
|
305
|
+
*
|
|
306
|
+
* This source code is licensed under the ISC license.
|
|
307
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
308
|
+
*/const s$=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],i$=ze("lock",s$);/**
|
|
309
|
+
* @license lucide-react v0.511.0 - ISC
|
|
310
|
+
*
|
|
311
|
+
* This source code is licensed under the ISC license.
|
|
312
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
313
|
+
*/const a$=[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]],Rc=ze("messages-square",a$);/**
|
|
314
|
+
* @license lucide-react v0.511.0 - ISC
|
|
315
|
+
*
|
|
316
|
+
* This source code is licensed under the ISC license.
|
|
317
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
318
|
+
*/const r$=[["path",{d:"M5 12h14",key:"1ays0h"}]],o$=ze("minus",r$);/**
|
|
319
|
+
* @license lucide-react v0.511.0 - ISC
|
|
320
|
+
*
|
|
321
|
+
* This source code is licensed under the ISC license.
|
|
322
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
323
|
+
*/const l$=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],LS=ze("network",l$);/**
|
|
324
|
+
* @license lucide-react v0.511.0 - ISC
|
|
325
|
+
*
|
|
326
|
+
* This source code is licensed under the ISC license.
|
|
327
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
328
|
+
*/const c$=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],pf=ze("package",c$);/**
|
|
329
|
+
* @license lucide-react v0.511.0 - ISC
|
|
330
|
+
*
|
|
331
|
+
* This source code is licensed under the ISC license.
|
|
332
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
333
|
+
*/const d$=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],u$=ze("panel-left",d$);/**
|
|
334
|
+
* @license lucide-react v0.511.0 - ISC
|
|
335
|
+
*
|
|
336
|
+
* This source code is licensed under the ISC license.
|
|
337
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
338
|
+
*/const h$=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],PS=ze("pause",h$);/**
|
|
339
|
+
* @license lucide-react v0.511.0 - ISC
|
|
340
|
+
*
|
|
341
|
+
* This source code is licensed under the ISC license.
|
|
342
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
343
|
+
*/const f$=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],gf=ze("pencil",f$);/**
|
|
344
|
+
* @license lucide-react v0.511.0 - ISC
|
|
345
|
+
*
|
|
346
|
+
* This source code is licensed under the ISC license.
|
|
347
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
348
|
+
*/const m$=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],p$=ze("play",m$);/**
|
|
349
|
+
* @license lucide-react v0.511.0 - ISC
|
|
350
|
+
*
|
|
351
|
+
* This source code is licensed under the ISC license.
|
|
352
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
353
|
+
*/const g$=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Pa=ze("plus",g$);/**
|
|
354
|
+
* @license lucide-react v0.511.0 - ISC
|
|
355
|
+
*
|
|
356
|
+
* This source code is licensed under the ISC license.
|
|
357
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
358
|
+
*/const x$=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],zr=ze("refresh-cw",x$);/**
|
|
359
|
+
* @license lucide-react v0.511.0 - ISC
|
|
360
|
+
*
|
|
361
|
+
* This source code is licensed under the ISC license.
|
|
362
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
363
|
+
*/const v$=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],b$=ze("rotate-ccw",v$);/**
|
|
364
|
+
* @license lucide-react v0.511.0 - ISC
|
|
365
|
+
*
|
|
366
|
+
* This source code is licensed under the ISC license.
|
|
367
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
368
|
+
*/const y$=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],w$=ze("rows-2",y$);/**
|
|
369
|
+
* @license lucide-react v0.511.0 - ISC
|
|
370
|
+
*
|
|
371
|
+
* This source code is licensed under the ISC license.
|
|
372
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
373
|
+
*/const _$=[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],xf=ze("search-x",_$);/**
|
|
374
|
+
* @license lucide-react v0.511.0 - ISC
|
|
375
|
+
*
|
|
376
|
+
* This source code is licensed under the ISC license.
|
|
377
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
378
|
+
*/const j$=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],N$=ze("search",j$);/**
|
|
379
|
+
* @license lucide-react v0.511.0 - ISC
|
|
380
|
+
*
|
|
381
|
+
* This source code is licensed under the ISC license.
|
|
382
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
383
|
+
*/const k$=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],S$=ze("shield-alert",k$);/**
|
|
384
|
+
* @license lucide-react v0.511.0 - ISC
|
|
385
|
+
*
|
|
386
|
+
* This source code is licensed under the ISC license.
|
|
387
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
388
|
+
*/const C$=[["path",{d:"m10 20-1.25-2.5L6 18",key:"18frcb"}],["path",{d:"M10 4 8.75 6.5 6 6",key:"7mghy3"}],["path",{d:"m14 20 1.25-2.5L18 18",key:"1chtki"}],["path",{d:"m14 4 1.25 2.5L18 6",key:"1b4wsy"}],["path",{d:"m17 21-3-6h-4",key:"15hhxa"}],["path",{d:"m17 3-3 6 1.5 3",key:"11697g"}],["path",{d:"M2 12h6.5L10 9",key:"kv9z4n"}],["path",{d:"m20 10-1.5 2 1.5 2",key:"1swlpi"}],["path",{d:"M22 12h-6.5L14 15",key:"1mxi28"}],["path",{d:"m4 10 1.5 2L4 14",key:"k9enpj"}],["path",{d:"m7 21 3-6-1.5-3",key:"j8hb9u"}],["path",{d:"m7 3 3 6h4",key:"1otusx"}]],D$=ze("snowflake",C$);/**
|
|
389
|
+
* @license lucide-react v0.511.0 - ISC
|
|
390
|
+
*
|
|
391
|
+
* This source code is licensed under the ISC license.
|
|
392
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
393
|
+
*/const E$=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Tc=ze("tag",E$);/**
|
|
394
|
+
* @license lucide-react v0.511.0 - ISC
|
|
395
|
+
*
|
|
396
|
+
* This source code is licensed under the ISC license.
|
|
397
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
398
|
+
*/const A$=[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],R$=ze("ticket-check",A$);/**
|
|
399
|
+
* @license lucide-react v0.511.0 - ISC
|
|
400
|
+
*
|
|
401
|
+
* This source code is licensed under the ISC license.
|
|
402
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
403
|
+
*/const T$=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Nt=ze("triangle-alert",T$);/**
|
|
404
|
+
* @license lucide-react v0.511.0 - ISC
|
|
405
|
+
*
|
|
406
|
+
* This source code is licensed under the ISC license.
|
|
407
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
408
|
+
*/const O$=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],z$=ze("user-check",O$);/**
|
|
409
|
+
* @license lucide-react v0.511.0 - ISC
|
|
410
|
+
*
|
|
411
|
+
* This source code is licensed under the ISC license.
|
|
412
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
413
|
+
*/const M$=[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],$$=ze("user-cog",M$);/**
|
|
414
|
+
* @license lucide-react v0.511.0 - ISC
|
|
415
|
+
*
|
|
416
|
+
* This source code is licensed under the ISC license.
|
|
417
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
418
|
+
*/const L$=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Av=ze("user",L$);/**
|
|
419
|
+
* @license lucide-react v0.511.0 - ISC
|
|
420
|
+
*
|
|
421
|
+
* This source code is licensed under the ISC license.
|
|
422
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
423
|
+
*/const P$=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],xd=ze("x",P$);function wn({className:e,...t}){return i.jsx(n$,{role:"status","aria-label":"Loading",className:we("size-4 animate-spin",e),...t})}const lc="aria-pressed:border aria-pressed:border-primary aria-pressed:bg-accent aria-pressed:text-accent-foreground",I$="border border-primary bg-accent text-accent-foreground hover:bg-accent",vf=hd("inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",warning:"bg-warning text-warning-foreground hover:bg-warning/90",success:"bg-success text-success-foreground hover:bg-success/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",text:"underline-offset-2 hover:underline"},size:{"inline-sm":"p-1 text-sm",inline:"p-1 text-base",default:"h-9 px-4 py-2 text-sm",sm:"h-8 px-3 text-sm",control:"h-7 px-2 text-xs",lg:"h-10 px-6 text-base",icon:"size-9 text-sm","sm-icon":"size-8 text-sm","control-icon":"size-7 text-xs","xs-icon":"size-6 text-xs"}},defaultVariants:{variant:"default",size:"default"}}),U=u.forwardRef(({className:e,disabled:t,variant:n,size:s,asChild:a=!1,loading:r,children:o,...l},c)=>{const d=a?RO:"button",h=s==="icon"||s==="sm-icon"||s==="control-icon"||s==="xs-icon",f=i.jsx(wn,{"aria-hidden":"true","aria-label":void 0,role:void 0,className:we(!h&&"mr-2")}),m=a?o:r&&h?f:i.jsxs(i.Fragment,{children:[r?f:null,o]});return i.jsx(d,{className:we(vf({variant:n,size:s,className:e})),ref:c,disabled:t||r,...l,children:m})});U.displayName="Button";const IS=u.createContext(null);function G$({container:e,children:t}){return i.jsx(IS.Provider,{value:e,children:t})}function vd(){return u.useContext(IS)??void 0}function bf(e){return i.jsx(jS,{"data-slot":"alert-dialog",...e})}function H$({className:e,...t}){return i.jsx(kS,{"data-slot":"alert-dialog-overlay",className:we("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function yf({className:e,onOpenAutoFocus:t,onPointerDownOutside:n,onInteractOutside:s,...a}){return i.jsxs(NS,{container:vd(),children:[i.jsx(H$,{}),i.jsx(SS,{"data-slot":"alert-dialog-content",role:"alertdialog",className:we("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),onOpenAutoFocus:r=>{if(t==null||t(r),r.defaultPrevented)return;const o=r.currentTarget,l=o instanceof HTMLElement?o.querySelector('[data-slot="alert-dialog-cancel"]'):null;l&&(r.preventDefault(),l.focus())},onPointerDownOutside:r=>{n==null||n(r),r.preventDefault()},onInteractOutside:r=>{s==null||s(r),r.preventDefault()},...a})]})}function wf({className:e,...t}){return i.jsx("div",{"data-slot":"alert-dialog-header",className:we("flex flex-col gap-2 text-center sm:text-left",e),...t})}function _f({className:e,...t}){return i.jsx("div",{"data-slot":"alert-dialog-footer",className:we("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function jf({className:e,...t}){return i.jsx(CS,{"data-slot":"alert-dialog-title",className:we("text-lg font-semibold",e),...t})}function Nf({className:e,...t}){return i.jsx(DS,{"data-slot":"alert-dialog-description",className:we("text-muted-foreground text-sm",e),...t})}function GS({className:e,variant:t,...n}){return i.jsx(Nv,{"data-slot":"alert-dialog-action",className:we(vf({variant:t}),e),...n})}function Rv({className:e,...t}){return i.jsx(Nv,{"data-slot":"alert-dialog-cancel",className:we(vf({variant:"outline"}),e),...t})}function V$(){if(typeof document>"u")return null;const e=document.activeElement;if(!(e instanceof HTMLElement)||e===document.body)return null;const t=e.closest('[role="menu"]');if(t!=null&&t.id){const n=document.querySelector(`[aria-controls="${CSS.escape(t.id)}"]`);if(n)return n}return e}function U$(e,t){t!=null&&t.isConnected&&(e.preventDefault(),t.focus())}function al(){const[e,t]=u.useState(null),n=u.useRef(null),s=u.useRef(null),a=u.useCallback(l=>{var c;(c=n.current)==null||c.resolve(l),n.current=null,t(null)},[]),r=u.useCallback(l=>new Promise(c=>{var h;(h=n.current)==null||h.resolve(!1),s.current=V$();const d={...l,resolve:c};n.current=d,t(d)}),[]);u.useEffect(()=>()=>{var l;return(l=n.current)==null?void 0:l.resolve(!1)},[]);const o=i.jsx(bf,{open:e!==null,onOpenChange:l=>{l||a(!1)},children:i.jsxs(yf,{onCloseAutoFocus:l=>U$(l,s.current),children:[i.jsxs(wf,{children:[i.jsx(jf,{children:e==null?void 0:e.title}),i.jsx(Nf,{className:"whitespace-pre-line",children:e==null?void 0:e.description})]}),i.jsxs(_f,{children:[i.jsx(Rv,{children:"Cancel"}),i.jsx(GS,{variant:e!=null&&e.destructive?"destructive":"default",onClick:()=>a(!0),children:e==null?void 0:e.action_label})]})]})});return{confirm:r,confirm_dialog:o}}const Ai="px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",B$=hd("inline-flex items-center rounded-md border transition-colors",{variants:{variant:{default:`${Ai} border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80`,secondary:`${Ai} border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`${Ai} border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80`,outline:`${Ai} text-foreground`,success:`${Ai} border-success/40 bg-success/10 text-success`,warning:`${Ai} border-warning/40 bg-warning/10 text-warning`,info:`${Ai} border-info/40 bg-info/10 text-info`,error:`${Ai} border-destructive/40 bg-destructive/10 text-destructive`,neutral:`${Ai} border-border bg-muted text-muted-foreground`,count:"h-5 min-w-5 justify-center border-transparent bg-primary px-1 text-2xs font-medium tabular-nums text-primary-foreground"},size:{default:"",dense:"px-1.5 py-0.5 text-2xs font-medium"}},defaultVariants:{variant:"default",size:"default"}});function be({className:e,variant:t,size:n,...s}){return i.jsx("div",{className:we(B$({variant:t,size:n}),e),...s})}function HS(e){const t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function VS(e){const[t,n]=u.useState(void 0);return Tn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const r=a[0];let o,l;if("borderBoxSize"in r){const c=r.borderBoxSize,d=Array.isArray(c)?c[0]:c;o=d.inlineSize,l=d.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var kf="Checkbox",[W$]=wi(kf),[F$,Tv]=W$(kf);function q$(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:a,disabled:r,form:o,name:l,onCheckedChange:c,required:d,value:h="on",internal_do_not_use_render:f}=e,[m,p]=La({prop:n,defaultProp:a??!1,onChange:c,caller:kf}),[y,g]=u.useState(null),[b,v]=u.useState(null),x=u.useRef(!1),w=y?!!o||!!y.closest("form"):!0,_={checked:m,disabled:r,setChecked:p,control:y,setControl:g,name:l,form:o,value:h,hasConsumerStoppedPropagationRef:x,required:d,defaultChecked:Aa(a)?!1:a,isFormControl:w,bubbleInput:b,setBubbleInput:v};return i.jsx(F$,{scope:t,..._,children:Y$(f)?f(_):s})}var US="CheckboxTrigger",BS=u.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},a)=>{const{control:r,value:o,disabled:l,checked:c,required:d,setControl:h,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:y}=Tv(US,e),g=ut(a,h),b=u.useRef(c);return u.useEffect(()=>{const v=r==null?void 0:r.form;if(v){const x=()=>f(b.current);return v.addEventListener("reset",x),()=>v.removeEventListener("reset",x)}},[r,f]),i.jsx(We.button,{type:"button",role:"checkbox","aria-checked":Aa(c)?"mixed":c,"aria-required":d,"data-state":XS(c),"data-disabled":l?"":void 0,disabled:l,value:o,...s,ref:g,onKeyDown:Ce(t,v=>{v.key==="Enter"&&v.preventDefault()}),onClick:Ce(n,v=>{f(x=>Aa(x)?!0:!x),y&&p&&(m.current=v.isPropagationStopped(),m.current||v.stopPropagation())})})});BS.displayName=US;var Ov=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:a,defaultChecked:r,required:o,disabled:l,value:c,onCheckedChange:d,form:h,...f}=e;return i.jsx(q$,{__scopeCheckbox:n,checked:a,defaultChecked:r,disabled:l,required:o,onCheckedChange:d,name:s,form:h,value:c,internal_do_not_use_render:({isFormControl:m})=>i.jsxs(i.Fragment,{children:[i.jsx(BS,{...f,ref:t,__scopeCheckbox:n}),m&&i.jsx(YS,{__scopeCheckbox:n})]})})});Ov.displayName=kf;var WS="CheckboxIndicator",FS=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...a}=e,r=Tv(WS,n);return i.jsx($s,{present:s||Aa(r.checked)||r.checked===!0,children:i.jsx(We.span,{"data-state":XS(r.checked),"data-disabled":r.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});FS.displayName=WS;var qS="CheckboxBubbleInput",YS=u.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:a,checked:r,defaultChecked:o,required:l,disabled:c,name:d,value:h,form:f,bubbleInput:m,setBubbleInput:p}=Tv(qS,e),y=ut(n,p),g=HS(r),b=VS(s);u.useEffect(()=>{const x=m;if(!x)return;const w=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(w,"checked").set,k=!a.current;if(g!==r&&S){const j=new Event("click",{bubbles:k});x.indeterminate=Aa(r),S.call(x,Aa(r)?!1:r),x.dispatchEvent(j)}},[m,g,r,a]);const v=u.useRef(Aa(r)?!1:r);return i.jsx(We.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??v.current,required:l,disabled:c,name:d,value:h,form:f,...t,tabIndex:-1,ref:y,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});YS.displayName=qS;function Y$(e){return typeof e=="function"}function Aa(e){return e==="indeterminate"}function XS(e){return Aa(e)?"indeterminate":e?"checked":"unchecked"}const rl=u.forwardRef(({className:e,...t},n)=>i.jsx(Ov,{ref:n,className:we("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=indeterminate]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:text-primary-foreground",e),...t,children:i.jsx(FS,{className:we("flex items-center justify-center text-current"),children:t.checked==="indeterminate"?i.jsx(o$,{className:"size-4","aria-hidden":"true"}):i.jsx(Or,{className:"size-4","aria-hidden":"true"})})}));rl.displayName=Ov.displayName;const X$=hd("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] overflow-y-auto translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200",{variants:{size:{sm:"sm:max-w-sm",md:"sm:max-w-lg",lg:"sm:max-w-2xl",xl:"sm:max-w-4xl","2xl":"sm:max-w-6xl",full:"sm:max-w-[calc(100%-2rem)]"}},defaultVariants:{size:"md"}});function jn({...e}){return i.jsx(jS,{"data-slot":"dialog",...e})}function K$({...e}){const t=vd();return i.jsx(NS,{"data-slot":"dialog-portal",container:t,...e})}function Z$({className:e,...t}){return i.jsx(kS,{"data-slot":"dialog-overlay",className:we("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function Nn({className:e,children:t,showCloseButton:n=!0,size:s,...a}){return i.jsxs(K$,{"data-slot":"dialog-portal",children:[i.jsx(Z$,{}),i.jsxs(SS,{"data-slot":"dialog-content",className:we(X$({size:s}),e),...a,children:[t,n&&i.jsxs(Nv,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground text-muted-foreground hover:text-foreground absolute top-4 right-4 rounded-xs transition-colors focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[i.jsx(xd,{}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function kn({className:e,...t}){return i.jsx("div",{"data-slot":"dialog-header",className:we("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Sn({className:e,...t}){return i.jsx("div",{"data-slot":"dialog-footer",className:we("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Cn({className:e,...t}){return i.jsx(CS,{"data-slot":"dialog-title",className:we("text-lg leading-none font-semibold",e),...t})}function Dn({className:e,...t}){return i.jsx(DS,{"data-slot":"dialog-description",className:we("text-muted-foreground text-sm",e),...t})}function zv(e){const t=e+"CollectionProvider",[n,s]=wi(t),[a,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=g=>{const{scope:b,children:v}=g,x=Te.useRef(null),w=Te.useRef(new Map).current;return i.jsx(a,{scope:b,itemMap:w,collectionRef:x,children:v})};o.displayName=t;const l=e+"CollectionSlot",c=jr(l),d=Te.forwardRef((g,b)=>{const{scope:v,children:x}=g,w=r(l,v),_=ut(b,w.collectionRef);return i.jsx(c,{ref:_,children:x})});d.displayName=l;const h=e+"CollectionItemSlot",f="data-radix-collection-item",m=jr(h),p=Te.forwardRef((g,b)=>{const{scope:v,children:x,...w}=g,_=Te.useRef(null),S=ut(b,_),k=r(h,v);return Te.useEffect(()=>(k.itemMap.set(_,{ref:_,...w}),()=>void k.itemMap.delete(_))),i.jsx(m,{[f]:"",ref:S,children:x})});p.displayName=h;function y(g){const b=r(e+"CollectionConsumer",g);return Te.useCallback(()=>{const x=b.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(b.itemMap.values()).sort((k,j)=>w.indexOf(k.ref.current)-w.indexOf(j.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:o,Slot:d,ItemSlot:p},y,s]}var Q$=u.createContext(void 0);function Sf(e){const t=u.useContext(Q$);return e||t||"ltr"}const J$=["top","right","bottom","left"],Ia=Math.min,hs=Math.max,yh=Math.round,Jd=Math.floor,hi=e=>({x:e,y:e}),eL={left:"right",right:"left",bottom:"top",top:"bottom"},tL={start:"end",end:"start"};function Rg(e,t,n){return hs(e,Ia(t,n))}function Wi(e,t){return typeof e=="function"?e(t):e}function Fi(e){return e.split("-")[0]}function ol(e){return e.split("-")[1]}function Mv(e){return e==="x"?"y":"x"}function $v(e){return e==="y"?"height":"width"}function oi(e){return["top","bottom"].includes(Fi(e))?"y":"x"}function Lv(e){return Mv(oi(e))}function nL(e,t,n){n===void 0&&(n=!1);const s=ol(e),a=Lv(e),r=$v(a);let o=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(o=wh(o)),[o,wh(o)]}function sL(e){const t=wh(e);return[Tg(e),t,Tg(t)]}function Tg(e){return e.replace(/start|end/g,t=>tL[t])}function iL(e,t,n){const s=["left","right"],a=["right","left"],r=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?a:s:t?s:a;case"left":case"right":return t?r:o;default:return[]}}function aL(e,t,n,s){const a=ol(e);let r=iL(Fi(e),n==="start",s);return a&&(r=r.map(o=>o+"-"+a),t&&(r=r.concat(r.map(Tg)))),r}function wh(e){return e.replace(/left|right|bottom|top/g,t=>eL[t])}function rL(e){return{top:0,right:0,bottom:0,left:0,...e}}function KS(e){return typeof e!="number"?rL(e):{top:e,right:e,bottom:e,left:e}}function _h(e){const{x:t,y:n,width:s,height:a}=e;return{width:s,height:a,top:n,left:t,right:t+s,bottom:n+a,x:t,y:n}}function Gw(e,t,n){let{reference:s,floating:a}=e;const r=oi(t),o=Lv(t),l=$v(o),c=Fi(t),d=r==="y",h=s.x+s.width/2-a.width/2,f=s.y+s.height/2-a.height/2,m=s[l]/2-a[l]/2;let p;switch(c){case"top":p={x:h,y:s.y-a.height};break;case"bottom":p={x:h,y:s.y+s.height};break;case"right":p={x:s.x+s.width,y:f};break;case"left":p={x:s.x-a.width,y:f};break;default:p={x:s.x,y:s.y}}switch(ol(t)){case"start":p[o]-=m*(n&&d?-1:1);break;case"end":p[o]+=m*(n&&d?-1:1);break}return p}const oL=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:r=[],platform:o}=n,l=r.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:h,y:f}=Gw(d,s,c),m=s,p={},y=0;for(let g=0;g<l.length;g++){const{name:b,fn:v}=l[g],{x,y:w,data:_,reset:S}=await v({x:h,y:f,initialPlacement:s,placement:m,strategy:a,middlewareData:p,rects:d,platform:o,elements:{reference:e,floating:t}});h=x??h,f=w??f,p={...p,[b]:{...p[b],..._}},S&&y<=50&&(y++,typeof S=="object"&&(S.placement&&(m=S.placement),S.rects&&(d=S.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:a}):S.rects),{x:h,y:f}=Gw(d,m,c)),g=-1)}return{x:h,y:f,placement:m,strategy:a,middlewareData:p}};async function Oc(e,t){var n;t===void 0&&(t={});const{x:s,y:a,platform:r,rects:o,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:h="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=Wi(t,e),y=KS(p),b=l[m?f==="floating"?"reference":"floating":f],v=_h(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(b)))==null||n?b:b.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(l.floating)),boundary:d,rootBoundary:h,strategy:c})),x=f==="floating"?{x:s,y:a,width:o.floating.width,height:o.floating.height}:o.reference,w=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l.floating)),_=await(r.isElement==null?void 0:r.isElement(w))?await(r.getScale==null?void 0:r.getScale(w))||{x:1,y:1}:{x:1,y:1},S=_h(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:w,strategy:c}):x);return{top:(v.top-S.top+y.top)/_.y,bottom:(S.bottom-v.bottom+y.bottom)/_.y,left:(v.left-S.left+y.left)/_.x,right:(S.right-v.right+y.right)/_.x}}const lL=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:a,rects:r,platform:o,elements:l,middlewareData:c}=t,{element:d,padding:h=0}=Wi(e,t)||{};if(d==null)return{};const f=KS(h),m={x:n,y:s},p=Lv(a),y=$v(p),g=await o.getDimensions(d),b=p==="y",v=b?"top":"left",x=b?"bottom":"right",w=b?"clientHeight":"clientWidth",_=r.reference[y]+r.reference[p]-m[p]-r.floating[y],S=m[p]-r.reference[p],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let j=k?k[w]:0;(!j||!await(o.isElement==null?void 0:o.isElement(k)))&&(j=l.floating[w]||r.floating[y]);const N=_/2-S/2,O=j/2-g[y]/2-1,T=Ia(f[v],O),P=Ia(f[x],O),L=T,G=j-g[y]-P,A=j/2-g[y]/2+N,D=Rg(L,A,G),C=!c.arrow&&ol(a)!=null&&A!==D&&r.reference[y]/2-(A<L?T:P)-g[y]/2<0,R=C?A<L?A-L:A-G:0;return{[p]:m[p]+R,data:{[p]:D,centerOffset:A-D-R,...C&&{alignmentOffset:R}},reset:C}}}),cL=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:a,middlewareData:r,rects:o,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:h=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:g=!0,...b}=Wi(e,t);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const v=Fi(a),x=oi(l),w=Fi(l)===l,_=await(c.isRTL==null?void 0:c.isRTL(d.floating)),S=m||(w||!g?[wh(l)]:sL(l)),k=y!=="none";!m&&k&&S.push(...aL(l,g,y,_));const j=[l,...S],N=await Oc(t,b),O=[];let T=((s=r.flip)==null?void 0:s.overflows)||[];if(h&&O.push(N[v]),f){const A=nL(a,o,_);O.push(N[A[0]],N[A[1]])}if(T=[...T,{placement:a,overflows:O}],!O.every(A=>A<=0)){var P,L;const A=(((P=r.flip)==null?void 0:P.index)||0)+1,D=j[A];if(D&&(!(f==="alignment"?x!==oi(D):!1)||T.every(E=>E.overflows[0]>0&&oi(E.placement)===x)))return{data:{index:A,overflows:T},reset:{placement:D}};let C=(L=T.filter(R=>R.overflows[0]<=0).sort((R,E)=>R.overflows[1]-E.overflows[1])[0])==null?void 0:L.placement;if(!C)switch(p){case"bestFit":{var G;const R=(G=T.filter(E=>{if(k){const M=oi(E.placement);return M===x||M==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(M=>M>0).reduce((M,H)=>M+H,0)]).sort((E,M)=>E[1]-M[1])[0])==null?void 0:G[0];R&&(C=R);break}case"initialPlacement":C=l;break}if(a!==C)return{reset:{placement:C}}}return{}}}};function Hw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Vw(e){return J$.some(t=>e[t]>=0)}const dL=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:s="referenceHidden",...a}=Wi(e,t);switch(s){case"referenceHidden":{const r=await Oc(t,{...a,elementContext:"reference"}),o=Hw(r,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Vw(o)}}}case"escaped":{const r=await Oc(t,{...a,altBoundary:!0}),o=Hw(r,n.floating);return{data:{escapedOffsets:o,escaped:Vw(o)}}}default:return{}}}}};async function uL(e,t){const{placement:n,platform:s,elements:a}=e,r=await(s.isRTL==null?void 0:s.isRTL(a.floating)),o=Fi(n),l=ol(n),c=oi(n)==="y",d=["left","top"].includes(o)?-1:1,h=r&&c?-1:1,f=Wi(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(p=l==="end"?y*-1:y),c?{x:p*h,y:m*d}:{x:m*d,y:p*h}}const hL=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:a,y:r,placement:o,middlewareData:l}=t,c=await uL(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(s=l.arrow)!=null&&s.alignmentOffset?{}:{x:a+c.x,y:r+c.y,data:{...c,placement:o}}}}},fL=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:a}=t,{mainAxis:r=!0,crossAxis:o=!1,limiter:l={fn:b=>{let{x:v,y:x}=b;return{x:v,y:x}}},...c}=Wi(e,t),d={x:n,y:s},h=await Oc(t,c),f=oi(Fi(a)),m=Mv(f);let p=d[m],y=d[f];if(r){const b=m==="y"?"top":"left",v=m==="y"?"bottom":"right",x=p+h[b],w=p-h[v];p=Rg(x,p,w)}if(o){const b=f==="y"?"top":"left",v=f==="y"?"bottom":"right",x=y+h[b],w=y-h[v];y=Rg(x,y,w)}const g=l.fn({...t,[m]:p,[f]:y});return{...g,data:{x:g.x-n,y:g.y-s,enabled:{[m]:r,[f]:o}}}}}},mL=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:a,rects:r,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=Wi(e,t),h={x:n,y:s},f=oi(a),m=Mv(f);let p=h[m],y=h[f];const g=Wi(l,t),b=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const w=m==="y"?"height":"width",_=r.reference[m]-r.floating[w]+b.mainAxis,S=r.reference[m]+r.reference[w]-b.mainAxis;p<_?p=_:p>S&&(p=S)}if(d){var v,x;const w=m==="y"?"width":"height",_=["top","left"].includes(Fi(a)),S=r.reference[f]-r.floating[w]+(_&&((v=o.offset)==null?void 0:v[f])||0)+(_?0:b.crossAxis),k=r.reference[f]+r.reference[w]+(_?0:((x=o.offset)==null?void 0:x[f])||0)-(_?b.crossAxis:0);y<S?y=S:y>k&&(y=k)}return{[m]:p,[f]:y}}}},pL=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:a,rects:r,platform:o,elements:l}=t,{apply:c=()=>{},...d}=Wi(e,t),h=await Oc(t,d),f=Fi(a),m=ol(a),p=oi(a)==="y",{width:y,height:g}=r.floating;let b,v;f==="top"||f==="bottom"?(b=f,v=m===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(v=f,b=m==="end"?"top":"bottom");const x=g-h.top-h.bottom,w=y-h.left-h.right,_=Ia(g-h[b],x),S=Ia(y-h[v],w),k=!t.middlewareData.shift;let j=_,N=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=w),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(j=x),k&&!m){const T=hs(h.left,0),P=hs(h.right,0),L=hs(h.top,0),G=hs(h.bottom,0);p?N=y-2*(T!==0||P!==0?T+P:hs(h.left,h.right)):j=g-2*(L!==0||G!==0?L+G:hs(h.top,h.bottom))}await c({...t,availableWidth:N,availableHeight:j});const O=await o.getDimensions(l.floating);return y!==O.width||g!==O.height?{reset:{rects:!0}}:{}}}};function Cf(){return typeof window<"u"}function ll(e){return ZS(e)?(e.nodeName||"").toLowerCase():"#document"}function vs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function _i(e){var t;return(t=(ZS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ZS(e){return Cf()?e instanceof Node||e instanceof vs(e).Node:!1}function Fs(e){return Cf()?e instanceof Element||e instanceof vs(e).Element:!1}function pi(e){return Cf()?e instanceof HTMLElement||e instanceof vs(e).HTMLElement:!1}function Uw(e){return!Cf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof vs(e).ShadowRoot}function bd(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=qs(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(a)}function gL(e){return["table","td","th"].includes(ll(e))}function Df(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Pv(e){const t=Iv(),n=Fs(e)?qs(e):e;return["transform","translate","scale","rotate","perspective"].some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(s=>(n.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(n.contain||"").includes(s))}function xL(e){let t=Ga(e);for(;pi(t)&&!Fo(t);){if(Pv(t))return t;if(Df(t))return null;t=Ga(t)}return null}function Iv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Fo(e){return["html","body","#document"].includes(ll(e))}function qs(e){return vs(e).getComputedStyle(e)}function Ef(e){return Fs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ga(e){if(ll(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Uw(e)&&e.host||_i(e);return Uw(t)?t.host:t}function QS(e){const t=Ga(e);return Fo(t)?e.ownerDocument?e.ownerDocument.body:e.body:pi(t)&&bd(t)?t:QS(t)}function zc(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=QS(e),r=a===((s=e.ownerDocument)==null?void 0:s.body),o=vs(a);if(r){const l=Og(o);return t.concat(o,o.visualViewport||[],bd(a)?a:[],l&&n?zc(l):[])}return t.concat(a,zc(a,[],n))}function Og(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function JS(e){const t=qs(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=pi(e),r=a?e.offsetWidth:n,o=a?e.offsetHeight:s,l=yh(n)!==r||yh(s)!==o;return l&&(n=r,s=o),{width:n,height:s,$:l}}function Gv(e){return Fs(e)?e:e.contextElement}function Ro(e){const t=Gv(e);if(!pi(t))return hi(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:r}=JS(t);let o=(r?yh(n.width):n.width)/s,l=(r?yh(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const vL=hi(0);function eC(e){const t=vs(e);return!Iv()||!t.visualViewport?vL:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bL(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==vs(e)?!1:t}function kr(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),r=Gv(e);let o=hi(1);t&&(s?Fs(s)&&(o=Ro(s)):o=Ro(e));const l=bL(r,n,s)?eC(r):hi(0);let c=(a.left+l.x)/o.x,d=(a.top+l.y)/o.y,h=a.width/o.x,f=a.height/o.y;if(r){const m=vs(r),p=s&&Fs(s)?vs(s):s;let y=m,g=Og(y);for(;g&&s&&p!==y;){const b=Ro(g),v=g.getBoundingClientRect(),x=qs(g),w=v.left+(g.clientLeft+parseFloat(x.paddingLeft))*b.x,_=v.top+(g.clientTop+parseFloat(x.paddingTop))*b.y;c*=b.x,d*=b.y,h*=b.x,f*=b.y,c+=w,d+=_,y=vs(g),g=Og(y)}}return _h({width:h,height:f,x:c,y:d})}function Hv(e,t){const n=Ef(e).scrollLeft;return t?t.left+n:kr(_i(e)).left+n}function tC(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=s.left+t.scrollLeft-(n?0:Hv(e,s)),r=s.top+t.scrollTop;return{x:a,y:r}}function yL(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const r=a==="fixed",o=_i(s),l=t?Df(t.floating):!1;if(s===o||l&&r)return n;let c={scrollLeft:0,scrollTop:0},d=hi(1);const h=hi(0),f=pi(s);if((f||!f&&!r)&&((ll(s)!=="body"||bd(o))&&(c=Ef(s)),pi(s))){const p=kr(s);d=Ro(s),h.x=p.x+s.clientLeft,h.y=p.y+s.clientTop}const m=o&&!f&&!r?tC(o,c,!0):hi(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+h.x+m.x,y:n.y*d.y-c.scrollTop*d.y+h.y+m.y}}function wL(e){return Array.from(e.getClientRects())}function _L(e){const t=_i(e),n=Ef(e),s=e.ownerDocument.body,a=hs(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),r=hs(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let o=-n.scrollLeft+Hv(e);const l=-n.scrollTop;return qs(s).direction==="rtl"&&(o+=hs(t.clientWidth,s.clientWidth)-a),{width:a,height:r,x:o,y:l}}function jL(e,t){const n=vs(e),s=_i(e),a=n.visualViewport;let r=s.clientWidth,o=s.clientHeight,l=0,c=0;if(a){r=a.width,o=a.height;const d=Iv();(!d||d&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}return{width:r,height:o,x:l,y:c}}function NL(e,t){const n=kr(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,r=pi(e)?Ro(e):hi(1),o=e.clientWidth*r.x,l=e.clientHeight*r.y,c=a*r.x,d=s*r.y;return{width:o,height:l,x:c,y:d}}function Bw(e,t,n){let s;if(t==="viewport")s=jL(e,n);else if(t==="document")s=_L(_i(e));else if(Fs(t))s=NL(t,n);else{const a=eC(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return _h(s)}function nC(e,t){const n=Ga(e);return n===t||!Fs(n)||Fo(n)?!1:qs(n).position==="fixed"||nC(n,t)}function kL(e,t){const n=t.get(e);if(n)return n;let s=zc(e,[],!1).filter(l=>Fs(l)&&ll(l)!=="body"),a=null;const r=qs(e).position==="fixed";let o=r?Ga(e):e;for(;Fs(o)&&!Fo(o);){const l=qs(o),c=Pv(o);!c&&l.position==="fixed"&&(a=null),(r?!c&&!a:!c&&l.position==="static"&&!!a&&["absolute","fixed"].includes(a.position)||bd(o)&&!c&&nC(e,o))?s=s.filter(h=>h!==o):a=l,o=Ga(o)}return t.set(e,s),s}function SL(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const o=[...n==="clippingAncestors"?Df(t)?[]:kL(t,this._c):[].concat(n),s],l=o[0],c=o.reduce((d,h)=>{const f=Bw(t,h,a);return d.top=hs(f.top,d.top),d.right=Ia(f.right,d.right),d.bottom=Ia(f.bottom,d.bottom),d.left=hs(f.left,d.left),d},Bw(t,l,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function CL(e){const{width:t,height:n}=JS(e);return{width:t,height:n}}function DL(e,t,n){const s=pi(t),a=_i(t),r=n==="fixed",o=kr(e,!0,r,t);let l={scrollLeft:0,scrollTop:0};const c=hi(0);function d(){c.x=Hv(a)}if(s||!s&&!r)if((ll(t)!=="body"||bd(a))&&(l=Ef(t)),s){const p=kr(t,!0,r,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else a&&d();r&&!s&&a&&d();const h=a&&!s&&!r?tC(a,l):hi(0),f=o.left+l.scrollLeft-c.x-h.x,m=o.top+l.scrollTop-c.y-h.y;return{x:f,y:m,width:o.width,height:o.height}}function rp(e){return qs(e).position==="static"}function Ww(e,t){if(!pi(e)||qs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return _i(e)===n&&(n=n.ownerDocument.body),n}function sC(e,t){const n=vs(e);if(Df(e))return n;if(!pi(e)){let a=Ga(e);for(;a&&!Fo(a);){if(Fs(a)&&!rp(a))return a;a=Ga(a)}return n}let s=Ww(e,t);for(;s&&gL(s)&&rp(s);)s=Ww(s,t);return s&&Fo(s)&&rp(s)&&!Pv(s)?n:s||xL(e)||n}const EL=async function(e){const t=this.getOffsetParent||sC,n=this.getDimensions,s=await n(e.floating);return{reference:DL(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function AL(e){return qs(e).direction==="rtl"}const RL={convertOffsetParentRelativeRectToViewportRelativeRect:yL,getDocumentElement:_i,getClippingRect:SL,getOffsetParent:sC,getElementRects:EL,getClientRects:wL,getDimensions:CL,getScale:Ro,isElement:Fs,isRTL:AL};function iC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function TL(e,t){let n=null,s;const a=_i(e);function r(){var l;clearTimeout(s),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),r();const d=e.getBoundingClientRect(),{left:h,top:f,width:m,height:p}=d;if(l||t(),!m||!p)return;const y=Jd(f),g=Jd(a.clientWidth-(h+m)),b=Jd(a.clientHeight-(f+p)),v=Jd(h),w={rootMargin:-y+"px "+-g+"px "+-b+"px "+-v+"px",threshold:hs(0,Ia(1,c))||1};let _=!0;function S(k){const j=k[0].intersectionRatio;if(j!==c){if(!_)return o();j?o(!1,j):s=setTimeout(()=>{o(!1,1e-7)},1e3)}j===1&&!iC(d,e.getBoundingClientRect())&&o(),_=!1}try{n=new IntersectionObserver(S,{...w,root:a.ownerDocument})}catch{n=new IntersectionObserver(S,w)}n.observe(e)}return o(!0),r}function OL(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:r=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,d=Gv(e),h=a||r?[...d?zc(d):[],...zc(t)]:[];h.forEach(v=>{a&&v.addEventListener("scroll",n,{passive:!0}),r&&v.addEventListener("resize",n)});const f=d&&l?TL(d,n):null;let m=-1,p=null;o&&(p=new ResizeObserver(v=>{let[x]=v;x&&x.target===d&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),d&&!c&&p.observe(d),p.observe(t));let y,g=c?kr(e):null;c&&b();function b(){const v=kr(e);g&&!iC(g,v)&&n(),g=v,y=requestAnimationFrame(b)}return n(),()=>{var v;h.forEach(x=>{a&&x.removeEventListener("scroll",n),r&&x.removeEventListener("resize",n)}),f==null||f(),(v=p)==null||v.disconnect(),p=null,c&&cancelAnimationFrame(y)}}const zL=hL,ML=fL,$L=cL,LL=pL,PL=dL,Fw=lL,IL=mL,GL=(e,t,n)=>{const s=new Map,a={platform:RL,...n},r={...a.platform,_c:s};return oL(e,t,{...a,platform:r})};var HL=typeof document<"u",VL=function(){},Ou=HL?u.useLayoutEffect:VL;function jh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!jh(e[s],t[s]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,a[s]))return!1;for(s=n;s--!==0;){const r=a[s];if(!(r==="_owner"&&e.$$typeof)&&!jh(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}function aC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qw(e,t){const n=aC(e);return Math.round(t*n)/n}function op(e){const t=u.useRef(e);return Ou(()=>{t.current=e}),t}function UL(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:r,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[h,f]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=u.useState(s);jh(m,s)||p(s);const[y,g]=u.useState(null),[b,v]=u.useState(null),x=u.useCallback(E=>{E!==k.current&&(k.current=E,g(E))},[]),w=u.useCallback(E=>{E!==j.current&&(j.current=E,v(E))},[]),_=r||y,S=o||b,k=u.useRef(null),j=u.useRef(null),N=u.useRef(h),O=c!=null,T=op(c),P=op(a),L=op(d),G=u.useCallback(()=>{if(!k.current||!j.current)return;const E={placement:t,strategy:n,middleware:m};P.current&&(E.platform=P.current),GL(k.current,j.current,E).then(M=>{const H={...M,isPositioned:L.current!==!1};A.current&&!jh(N.current,H)&&(N.current=H,Ko.flushSync(()=>{f(H)}))})},[m,t,n,P,L]);Ou(()=>{d===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,f(E=>({...E,isPositioned:!1})))},[d]);const A=u.useRef(!1);Ou(()=>(A.current=!0,()=>{A.current=!1}),[]),Ou(()=>{if(_&&(k.current=_),S&&(j.current=S),_&&S){if(T.current)return T.current(_,S,G);G()}},[_,S,G,T,O]);const D=u.useMemo(()=>({reference:k,floating:j,setReference:x,setFloating:w}),[x,w]),C=u.useMemo(()=>({reference:_,floating:S}),[_,S]),R=u.useMemo(()=>{const E={position:n,left:0,top:0};if(!C.floating)return E;const M=qw(C.floating,h.x),H=qw(C.floating,h.y);return l?{...E,transform:"translate("+M+"px, "+H+"px)",...aC(C.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:H}},[n,l,C.floating,h.x,h.y]);return u.useMemo(()=>({...h,update:G,refs:D,elements:C,floatingStyles:R}),[h,G,D,C,R])}const BL=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:a}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?Fw({element:s.current,padding:a}).fn(n):{}:s?Fw({element:s,padding:a}).fn(n):{}}}},WL=(e,t)=>({...zL(e),options:[e,t]}),FL=(e,t)=>({...ML(e),options:[e,t]}),qL=(e,t)=>({...IL(e),options:[e,t]}),YL=(e,t)=>({...$L(e),options:[e,t]}),XL=(e,t)=>({...LL(e),options:[e,t]}),KL=(e,t)=>({...PL(e),options:[e,t]}),ZL=(e,t)=>({...BL(e),options:[e,t]});var QL="Arrow",rC=u.forwardRef((e,t)=>{const{children:n,width:s=10,height:a=5,...r}=e;return i.jsx(We.svg,{...r,ref:t,width:s,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});rC.displayName=QL;var JL=rC,Vv="Popper",[oC,cl]=wi(Vv),[eP,lC]=oC(Vv),cC=e=>{const{__scopePopper:t,children:n}=e,[s,a]=u.useState(null);return i.jsx(eP,{scope:t,anchor:s,onAnchorChange:a,children:n})};cC.displayName=Vv;var dC="PopperAnchor",uC=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,r=lC(dC,n),o=u.useRef(null),l=ut(t,o);return u.useEffect(()=>{r.onAnchorChange((s==null?void 0:s.current)||o.current)}),s?null:i.jsx(We.div,{...a,ref:l})});uC.displayName=dC;var Uv="PopperContent",[tP,nP]=oC(Uv),hC=u.forwardRef((e,t)=>{var ae,Ne,q,B,Z,Q;const{__scopePopper:n,side:s="bottom",sideOffset:a=0,align:r="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:h=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:y,...g}=e,b=lC(Uv,n),[v,x]=u.useState(null),w=ut(t,ie=>x(ie)),[_,S]=u.useState(null),k=VS(_),j=(k==null?void 0:k.width)??0,N=(k==null?void 0:k.height)??0,O=s+(r!=="center"?"-"+r:""),T=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},P=Array.isArray(d)?d:[d],L=P.length>0,G={padding:T,boundary:P.filter(iP),altBoundary:L},{refs:A,floatingStyles:D,placement:C,isPositioned:R,middlewareData:E}=UL({strategy:"fixed",placement:O,whileElementsMounted:(...ie)=>OL(...ie,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[WL({mainAxis:a+N,alignmentAxis:o}),c&&FL({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?qL():void 0,...G}),c&&YL({...G}),XL({...G,apply:({elements:ie,rects:ce,availableWidth:$,availableHeight:F})=>{const{width:ee,height:se}=ce.reference,ge=ie.floating.style;ge.setProperty("--radix-popper-available-width",`${$}px`),ge.setProperty("--radix-popper-available-height",`${F}px`),ge.setProperty("--radix-popper-anchor-width",`${ee}px`),ge.setProperty("--radix-popper-anchor-height",`${se}px`)}}),_&&ZL({element:_,padding:l}),aP({arrowWidth:j,arrowHeight:N}),m&&KL({strategy:"referenceHidden",...G})]}),[M,H]=pC(C),z=mi(y);Tn(()=>{R&&(z==null||z())},[R,z]);const K=(ae=E.arrow)==null?void 0:ae.x,oe=(Ne=E.arrow)==null?void 0:Ne.y,re=((q=E.arrow)==null?void 0:q.centerOffset)!==0,[ve,ke]=u.useState();return Tn(()=>{v&&ke(window.getComputedStyle(v).zIndex)},[v]),i.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:R?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ve,"--radix-popper-transform-origin":[(B=E.transformOrigin)==null?void 0:B.x,(Z=E.transformOrigin)==null?void 0:Z.y].join(" "),...((Q=E.hide)==null?void 0:Q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(tP,{scope:n,placedSide:M,onArrowChange:S,arrowX:K,arrowY:oe,shouldHideArrow:re,children:i.jsx(We.div,{"data-side":M,"data-align":H,...g,ref:w,style:{...g.style,animation:R?void 0:"none"}})})})});hC.displayName=Uv;var fC="PopperArrow",sP={top:"bottom",right:"left",bottom:"top",left:"right"},mC=u.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,r=nP(fC,s),o=sP[r.placedSide];return i.jsx("span",{ref:r.onArrowChange,style:{position:"absolute",left:r.arrowX,top:r.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[r.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[r.placedSide],visibility:r.shouldHideArrow?"hidden":void 0},children:i.jsx(JL,{...a,ref:n,style:{...a.style,display:"block"}})})});mC.displayName=fC;function iP(e){return e!==null}var aP=e=>({name:"transformOrigin",options:e,fn(t){var b,v,x;const{placement:n,rects:s,middlewareData:a}=t,o=((b=a.arrow)==null?void 0:b.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,h]=pC(n),f={start:"0%",center:"50%",end:"100%"}[h],m=(((v=a.arrow)==null?void 0:v.x)??0)+l/2,p=(((x=a.arrow)==null?void 0:x.y)??0)+c/2;let y="",g="";return d==="bottom"?(y=o?f:`${m}px`,g=`${-c}px`):d==="top"?(y=o?f:`${m}px`,g=`${s.floating.height+c}px`):d==="right"?(y=`${-c}px`,g=o?f:`${p}px`):d==="left"&&(y=`${s.floating.width+c}px`,g=o?f:`${p}px`),{data:{x:y,y:g}}}});function pC(e){const[t,n="center"]=e.split("-");return[t,n]}var Bv=cC,Wv=uC,Fv=hC,qv=mC,lp="rovingFocusGroup.onEntryFocus",rP={bubbles:!1,cancelable:!0},yd="RovingFocusGroup",[zg,gC,oP]=zv(yd),[lP,Af]=wi(yd,[oP]),[cP,dP]=lP(yd),xC=u.forwardRef((e,t)=>i.jsx(zg.Provider,{scope:e.__scopeRovingFocusGroup,children:i.jsx(zg.Slot,{scope:e.__scopeRovingFocusGroup,children:i.jsx(uP,{...e,ref:t})})}));xC.displayName=yd;var uP=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:r,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:h=!1,...f}=e,m=u.useRef(null),p=ut(t,m),y=Sf(r),[g,b]=La({prop:o,defaultProp:l??null,onChange:c,caller:yd}),[v,x]=u.useState(!1),w=mi(d),_=gC(n),S=u.useRef(!1),[k,j]=u.useState(0);return u.useEffect(()=>{const N=m.current;if(N)return N.addEventListener(lp,w),()=>N.removeEventListener(lp,w)},[w]),i.jsx(cP,{scope:n,orientation:s,dir:y,loop:a,currentTabStopId:g,onItemFocus:u.useCallback(N=>b(N),[b]),onItemShiftTab:u.useCallback(()=>x(!0),[]),onFocusableItemAdd:u.useCallback(()=>j(N=>N+1),[]),onFocusableItemRemove:u.useCallback(()=>j(N=>N-1),[]),children:i.jsx(We.div,{tabIndex:v||k===0?-1:0,"data-orientation":s,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:Ce(e.onMouseDown,()=>{S.current=!0}),onFocus:Ce(e.onFocus,N=>{const O=!S.current;if(N.target===N.currentTarget&&O&&!v){const T=new CustomEvent(lp,rP);if(N.currentTarget.dispatchEvent(T),!T.defaultPrevented){const P=_().filter(C=>C.focusable),L=P.find(C=>C.active),G=P.find(C=>C.id===g),D=[L,G,...P].filter(Boolean).map(C=>C.ref.current);yC(D,h)}}S.current=!1}),onBlur:Ce(e.onBlur,()=>x(!1))})})}),vC="RovingFocusGroupItem",bC=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:r,children:o,...l}=e,c=Bs(),d=r||c,h=dP(vC,n),f=h.currentTabStopId===d,m=gC(n),{onFocusableItemAdd:p,onFocusableItemRemove:y,currentTabStopId:g}=h;return u.useEffect(()=>{if(s)return p(),()=>y()},[s,p,y]),i.jsx(zg.ItemSlot,{scope:n,id:d,focusable:s,active:a,children:i.jsx(We.span,{tabIndex:f?0:-1,"data-orientation":h.orientation,...l,ref:t,onMouseDown:Ce(e.onMouseDown,b=>{s?h.onItemFocus(d):b.preventDefault()}),onFocus:Ce(e.onFocus,()=>h.onItemFocus(d)),onKeyDown:Ce(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){h.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const v=mP(b,h.orientation,h.dir);if(v!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let w=m().filter(_=>_.focusable).map(_=>_.ref.current);if(v==="last")w.reverse();else if(v==="prev"||v==="next"){v==="prev"&&w.reverse();const _=w.indexOf(b.currentTarget);w=h.loop?pP(w,_+1):w.slice(_+1)}setTimeout(()=>yC(w))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:g!=null}):o})})});bC.displayName=vC;var hP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function fP(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mP(e,t,n){const s=fP(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return hP[s]}function yC(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function pP(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var wC=xC,_C=bC,Mg=["Enter"," "],gP=["ArrowDown","PageUp","Home"],jC=["ArrowUp","PageDown","End"],xP=[...gP,...jC],vP={ltr:[...Mg,"ArrowRight"],rtl:[...Mg,"ArrowLeft"]},bP={ltr:["ArrowLeft"],rtl:["ArrowRight"]},wd="Menu",[Mc,yP,wP]=zv(wd),[Mr,NC]=wi(wd,[wP,cl,Af]),Rf=cl(),kC=Af(),[_P,$r]=Mr(wd),[jP,_d]=Mr(wd),SC=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:a,onOpenChange:r,modal:o=!0}=e,l=Rf(t),[c,d]=u.useState(null),h=u.useRef(!1),f=mi(r),m=Sf(a);return u.useEffect(()=>{const p=()=>{h.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>h.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),i.jsx(Bv,{...l,children:i.jsx(_P,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:d,children:i.jsx(jP,{scope:t,onClose:u.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:h,dir:m,modal:o,children:s})})})};SC.displayName=wd;var NP="MenuAnchor",Yv=u.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,a=Rf(n);return i.jsx(Wv,{...a,...s,ref:t})});Yv.displayName=NP;var Xv="MenuPortal",[kP,CC]=Mr(Xv,{forceMount:void 0}),DC=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:a}=e,r=$r(Xv,t);return i.jsx(kP,{scope:t,forceMount:n,children:i.jsx($s,{present:n||r.open,children:i.jsx(md,{asChild:!0,container:a,children:s})})})};DC.displayName=Xv;var As="MenuContent",[SP,Kv]=Mr(As),EC=u.forwardRef((e,t)=>{const n=CC(As,e.__scopeMenu),{forceMount:s=n.forceMount,...a}=e,r=$r(As,e.__scopeMenu),o=_d(As,e.__scopeMenu);return i.jsx(Mc.Provider,{scope:e.__scopeMenu,children:i.jsx($s,{present:s||r.open,children:i.jsx(Mc.Slot,{scope:e.__scopeMenu,children:o.modal?i.jsx(CP,{...a,ref:t}):i.jsx(DP,{...a,ref:t})})})})}),CP=u.forwardRef((e,t)=>{const n=$r(As,e.__scopeMenu),s=u.useRef(null),a=ut(t,s);return u.useEffect(()=>{const r=s.current;if(r)return yv(r)},[]),i.jsx(Zv,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ce(e.onFocusOutside,r=>r.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),DP=u.forwardRef((e,t)=>{const n=$r(As,e.__scopeMenu);return i.jsx(Zv,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),EP=jr("MenuContent.ScrollLock"),Zv=u.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:m,onDismiss:p,disableOutsideScroll:y,...g}=e,b=$r(As,n),v=_d(As,n),x=Rf(n),w=kC(n),_=yP(n),[S,k]=u.useState(null),j=u.useRef(null),N=ut(t,j,b.onContentChange),O=u.useRef(0),T=u.useRef(""),P=u.useRef(0),L=u.useRef(null),G=u.useRef("right"),A=u.useRef(0),D=y?df:u.Fragment,C=y?{as:EP,allowPinchZoom:!0}:void 0,R=M=>{var ae,Ne;const H=T.current+M,z=_().filter(q=>!q.disabled),K=document.activeElement,oe=(ae=z.find(q=>q.ref.current===K))==null?void 0:ae.textValue,re=z.map(q=>q.textValue),ve=HP(re,H,oe),ke=(Ne=z.find(q=>q.textValue===ve))==null?void 0:Ne.ref.current;(function q(B){T.current=B,window.clearTimeout(O.current),B!==""&&(O.current=window.setTimeout(()=>q(""),1e3))})(H),ke&&setTimeout(()=>ke.focus())};u.useEffect(()=>()=>window.clearTimeout(O.current),[]),bv();const E=u.useCallback(M=>{var z,K;return G.current===((z=L.current)==null?void 0:z.side)&&UP(M,(K=L.current)==null?void 0:K.area)},[]);return i.jsx(SP,{scope:n,searchRef:T,onItemEnter:u.useCallback(M=>{E(M)&&M.preventDefault()},[E]),onItemLeave:u.useCallback(M=>{var H;E(M)||((H=j.current)==null||H.focus(),k(null))},[E]),onTriggerLeave:u.useCallback(M=>{E(M)&&M.preventDefault()},[E]),pointerGraceTimerRef:P,onPointerGraceIntentChange:u.useCallback(M=>{L.current=M},[]),children:i.jsx(D,{...C,children:i.jsx(lf,{asChild:!0,trapped:a,onMountAutoFocus:Ce(r,M=>{var H;M.preventDefault(),(H=j.current)==null||H.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:i.jsx(fd,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:m,onDismiss:p,children:i.jsx(wC,{asChild:!0,...w,dir:v.dir,orientation:"vertical",loop:s,currentTabStopId:S,onCurrentTabStopIdChange:k,onEntryFocus:Ce(c,M=>{v.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(Fv,{role:"menu","aria-orientation":"vertical","data-state":WC(b.open),"data-radix-menu-content":"",dir:v.dir,...x,...g,ref:N,style:{outline:"none",...g.style},onKeyDown:Ce(g.onKeyDown,M=>{const z=M.target.closest("[data-radix-menu-content]")===M.currentTarget,K=M.ctrlKey||M.altKey||M.metaKey,oe=M.key.length===1;z&&(M.key==="Tab"&&M.preventDefault(),!K&&oe&&R(M.key));const re=j.current;if(M.target!==re||!xP.includes(M.key))return;M.preventDefault();const ke=_().filter(ae=>!ae.disabled).map(ae=>ae.ref.current);jC.includes(M.key)&&ke.reverse(),IP(ke)}),onBlur:Ce(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(O.current),T.current="")}),onPointerMove:Ce(e.onPointerMove,$c(M=>{const H=M.target,z=A.current!==M.clientX;if(M.currentTarget.contains(H)&&z){const K=M.clientX>A.current?"right":"left";G.current=K,A.current=M.clientX}}))})})})})})})});EC.displayName=As;var AP="MenuGroup",Qv=u.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return i.jsx(We.div,{role:"group",...s,ref:t})});Qv.displayName=AP;var RP="MenuLabel",AC=u.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return i.jsx(We.div,{...s,ref:t})});AC.displayName=RP;var Nh="MenuItem",Yw="menu.itemSelect",Tf=u.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...a}=e,r=u.useRef(null),o=_d(Nh,e.__scopeMenu),l=Kv(Nh,e.__scopeMenu),c=ut(t,r),d=u.useRef(!1),h=()=>{const f=r.current;if(!n&&f){const m=new CustomEvent(Yw,{bubbles:!0,cancelable:!0});f.addEventListener(Yw,p=>s==null?void 0:s(p),{once:!0}),Kk(f,m),m.defaultPrevented?d.current=!1:o.onClose()}};return i.jsx(RC,{...a,ref:c,disabled:n,onClick:Ce(e.onClick,h),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),d.current=!0},onPointerUp:Ce(e.onPointerUp,f=>{var m;d.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:Ce(e.onKeyDown,f=>{const m=l.searchRef.current!=="";n||m&&f.key===" "||Mg.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Tf.displayName=Nh;var RC=u.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:a,...r}=e,o=Kv(Nh,n),l=kC(n),c=u.useRef(null),d=ut(t,c),[h,f]=u.useState(!1),[m,p]=u.useState("");return u.useEffect(()=>{const y=c.current;y&&p((y.textContent??"").trim())},[r.children]),i.jsx(Mc.ItemSlot,{scope:n,disabled:s,textValue:a??m,children:i.jsx(_C,{asChild:!0,...l,focusable:!s,children:i.jsx(We.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...r,ref:d,onPointerMove:Ce(e.onPointerMove,$c(y=>{s?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ce(e.onPointerLeave,$c(y=>o.onItemLeave(y))),onFocus:Ce(e.onFocus,()=>f(!0)),onBlur:Ce(e.onBlur,()=>f(!1))})})})}),TP="MenuCheckboxItem",TC=u.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...a}=e;return i.jsx(LC,{scope:e.__scopeMenu,checked:n,children:i.jsx(Tf,{role:"menuitemcheckbox","aria-checked":kh(n)?"mixed":n,...a,ref:t,"data-state":eb(n),onSelect:Ce(a.onSelect,()=>s==null?void 0:s(kh(n)?!0:!n),{checkForDefaultPrevented:!1})})})});TC.displayName=TP;var OC="MenuRadioGroup",[OP,zP]=Mr(OC,{value:void 0,onValueChange:()=>{}}),zC=u.forwardRef((e,t)=>{const{value:n,onValueChange:s,...a}=e,r=mi(s);return i.jsx(OP,{scope:e.__scopeMenu,value:n,onValueChange:r,children:i.jsx(Qv,{...a,ref:t})})});zC.displayName=OC;var MC="MenuRadioItem",$C=u.forwardRef((e,t)=>{const{value:n,...s}=e,a=zP(MC,e.__scopeMenu),r=n===a.value;return i.jsx(LC,{scope:e.__scopeMenu,checked:r,children:i.jsx(Tf,{role:"menuitemradio","aria-checked":r,...s,ref:t,"data-state":eb(r),onSelect:Ce(s.onSelect,()=>{var o;return(o=a.onValueChange)==null?void 0:o.call(a,n)},{checkForDefaultPrevented:!1})})})});$C.displayName=MC;var Jv="MenuItemIndicator",[LC,MP]=Mr(Jv,{checked:!1}),PC=u.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...a}=e,r=MP(Jv,n);return i.jsx($s,{present:s||kh(r.checked)||r.checked===!0,children:i.jsx(We.span,{...a,ref:t,"data-state":eb(r.checked)})})});PC.displayName=Jv;var $P="MenuSeparator",IC=u.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return i.jsx(We.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});IC.displayName=$P;var LP="MenuArrow",GC=u.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,a=Rf(n);return i.jsx(qv,{...a,...s,ref:t})});GC.displayName=LP;var PP="MenuSub",[gW,HC]=Mr(PP),Hl="MenuSubTrigger",VC=u.forwardRef((e,t)=>{const n=$r(Hl,e.__scopeMenu),s=_d(Hl,e.__scopeMenu),a=HC(Hl,e.__scopeMenu),r=Kv(Hl,e.__scopeMenu),o=u.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=r,d={__scopeMenu:e.__scopeMenu},h=u.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return u.useEffect(()=>h,[h]),u.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),i.jsx(Yv,{asChild:!0,...d,children:i.jsx(RC,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":WC(n.open),...e,ref:of(t,a.onTriggerChange),onClick:f=>{var m;(m=e.onClick)==null||m.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ce(e.onPointerMove,$c(f=>{r.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(r.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),h()},100))})),onPointerLeave:Ce(e.onPointerLeave,$c(f=>{var p,y;h();const m=(p=n.content)==null?void 0:p.getBoundingClientRect();if(m){const g=(y=n.content)==null?void 0:y.dataset.side,b=g==="right",v=b?-5:5,x=m[b?"left":"right"],w=m[b?"right":"left"];r.onPointerGraceIntentChange({area:[{x:f.clientX+v,y:f.clientY},{x,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x,y:m.bottom}],side:g}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>r.onPointerGraceIntentChange(null),300)}else{if(r.onTriggerLeave(f),f.defaultPrevented)return;r.onPointerGraceIntentChange(null)}})),onKeyDown:Ce(e.onKeyDown,f=>{var p;const m=r.searchRef.current!=="";e.disabled||m&&f.key===" "||vP[s.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});VC.displayName=Hl;var UC="MenuSubContent",BC=u.forwardRef((e,t)=>{const n=CC(As,e.__scopeMenu),{forceMount:s=n.forceMount,...a}=e,r=$r(As,e.__scopeMenu),o=_d(As,e.__scopeMenu),l=HC(UC,e.__scopeMenu),c=u.useRef(null),d=ut(t,c);return i.jsx(Mc.Provider,{scope:e.__scopeMenu,children:i.jsx($s,{present:s||r.open,children:i.jsx(Mc.Slot,{scope:e.__scopeMenu,children:i.jsx(Zv,{id:l.contentId,"aria-labelledby":l.triggerId,...a,ref:d,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:Ce(e.onFocusOutside,h=>{h.target!==l.trigger&&r.onOpenChange(!1)}),onEscapeKeyDown:Ce(e.onEscapeKeyDown,h=>{o.onClose(),h.preventDefault()}),onKeyDown:Ce(e.onKeyDown,h=>{var p;const f=h.currentTarget.contains(h.target),m=bP[o.dir].includes(h.key);f&&m&&(r.onOpenChange(!1),(p=l.trigger)==null||p.focus(),h.preventDefault())})})})})})});BC.displayName=UC;function WC(e){return e?"open":"closed"}function kh(e){return e==="indeterminate"}function eb(e){return kh(e)?"indeterminate":e?"checked":"unchecked"}function IP(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function GP(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function HP(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,r=n?e.indexOf(n):-1;let o=GP(e,Math.max(r,0));a.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.toLowerCase().startsWith(a.toLowerCase()));return c!==n?c:void 0}function VP(e,t){const{x:n,y:s}=e;let a=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){const l=t[r],c=t[o],d=l.x,h=l.y,f=c.x,m=c.y;h>s!=m>s&&n<(f-d)*(s-h)/(m-h)+d&&(a=!a)}return a}function UP(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return VP(n,t)}function $c(e){return t=>t.pointerType==="mouse"?e(t):void 0}var BP=SC,WP=Yv,FP=DC,qP=EC,YP=Qv,XP=AC,KP=Tf,ZP=TC,QP=zC,JP=$C,e4=PC,t4=IC,n4=GC,s4=VC,i4=BC,Of="DropdownMenu",[a4]=wi(Of,[NC]),Bn=NC(),[r4,FC]=a4(Of),qC=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:a,defaultOpen:r,onOpenChange:o,modal:l=!0}=e,c=Bn(t),d=u.useRef(null),[h,f]=La({prop:a,defaultProp:r??!1,onChange:o,caller:Of});return i.jsx(r4,{scope:t,triggerId:Bs(),triggerRef:d,contentId:Bs(),open:h,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(m=>!m),[f]),modal:l,children:i.jsx(BP,{...c,open:h,onOpenChange:f,dir:s,modal:l,children:n})})};qC.displayName=Of;var YC="DropdownMenuTrigger",XC=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...a}=e,r=FC(YC,n),o=Bn(n);return i.jsx(WP,{asChild:!0,...o,children:i.jsx(We.button,{type:"button",id:r.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":r.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...a,ref:of(t,r.triggerRef),onPointerDown:Ce(e.onPointerDown,l=>{!s&&l.button===0&&l.ctrlKey===!1&&(r.onOpenToggle(),r.open||l.preventDefault())}),onKeyDown:Ce(e.onKeyDown,l=>{s||(["Enter"," "].includes(l.key)&&r.onOpenToggle(),l.key==="ArrowDown"&&r.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});XC.displayName=YC;var o4="DropdownMenuPortal",KC=e=>{const{__scopeDropdownMenu:t,...n}=e,s=Bn(t);return i.jsx(FP,{...s,...n})};KC.displayName=o4;var ZC="DropdownMenuContent",QC=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=FC(ZC,n),r=Bn(n),o=u.useRef(!1);return i.jsx(qP,{id:a.contentId,"aria-labelledby":a.triggerId,...r,...s,ref:t,onCloseAutoFocus:Ce(e.onCloseAutoFocus,l=>{var c;o.current||(c=a.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:Ce(e.onInteractOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,h=c.button===2||d;(!a.modal||h)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});QC.displayName=ZC;var l4="DropdownMenuGroup",c4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Bn(n);return i.jsx(YP,{...a,...s,ref:t})});c4.displayName=l4;var d4="DropdownMenuLabel",JC=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Bn(n);return i.jsx(XP,{...a,...s,ref:t})});JC.displayName=d4;var u4="DropdownMenuItem",e1=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Bn(n);return i.jsx(KP,{...a,...s,ref:t})});e1.displayName=u4;var h4="DropdownMenuCheckboxItem",t1=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Bn(n);return i.jsx(ZP,{...a,...s,ref:t})});t1.displayName=h4;var f4="DropdownMenuRadioGroup",m4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Bn(n);return i.jsx(QP,{...a,...s,ref:t})});m4.displayName=f4;var p4="DropdownMenuRadioItem",n1=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Bn(n);return i.jsx(JP,{...a,...s,ref:t})});n1.displayName=p4;var g4="DropdownMenuItemIndicator",s1=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Bn(n);return i.jsx(e4,{...a,...s,ref:t})});s1.displayName=g4;var x4="DropdownMenuSeparator",i1=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Bn(n);return i.jsx(t4,{...a,...s,ref:t})});i1.displayName=x4;var v4="DropdownMenuArrow",b4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Bn(n);return i.jsx(n4,{...a,...s,ref:t})});b4.displayName=v4;var y4="DropdownMenuSubTrigger",a1=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Bn(n);return i.jsx(s4,{...a,...s,ref:t})});a1.displayName=y4;var w4="DropdownMenuSubContent",r1=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Bn(n);return i.jsx(i4,{...a,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});r1.displayName=w4;var _4=qC,j4=XC,N4=KC,o1=QC,l1=JC,c1=e1,d1=t1,u1=n1,h1=s1,f1=i1,m1=a1,p1=r1;const zf=_4,Mf=j4,k4=u.forwardRef(({className:e,inset:t,children:n,...s},a)=>i.jsxs(m1,{ref:a,className:we("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...s,children:[n,i.jsx(pd,{className:"ml-auto"})]}));k4.displayName=m1.displayName;const S4=u.forwardRef(({className:e,...t},n)=>i.jsx(p1,{ref:n,className:we("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));S4.displayName=p1.displayName;const jd=u.forwardRef(({className:e,sideOffset:t=4,...n},s)=>i.jsx(N4,{container:vd(),children:i.jsx(o1,{ref:s,sideOffset:t,className:we("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));jd.displayName=o1.displayName;const qo=u.forwardRef(({className:e,inset:t,...n},s)=>i.jsx(c1,{ref:s,className:we("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));qo.displayName=c1.displayName;const C4=u.forwardRef(({className:e,children:t,checked:n,...s},a)=>i.jsxs(d1,{ref:a,className:we("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...s,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(h1,{children:i.jsx(Or,{className:"h-4 w-4"})})}),t]}));C4.displayName=d1.displayName;const D4=u.forwardRef(({className:e,children:t,...n},s)=>i.jsxs(u1,{ref:s,className:we("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(h1,{children:i.jsx(kM,{className:"h-2 w-2 fill-current"})})}),t]}));D4.displayName=u1.displayName;const E4=u.forwardRef(({className:e,inset:t,...n},s)=>i.jsx(l1,{ref:s,className:we("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));E4.displayName=l1.displayName;const A4=u.forwardRef(({className:e,...t},n)=>i.jsx(f1,{ref:n,className:we("-mx-1 my-1 h-px bg-muted",e),...t}));A4.displayName=f1.displayName;const R4={default:"h-9 px-3 py-1 text-sm",control:"h-7 px-2 py-1 text-xs"},yt=u.forwardRef(({className:e,type:t,inputSize:n="default",...s},a)=>i.jsx("input",{type:t,className:we("flex w-full rounded-md border border-input bg-transparent shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-disabled-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 read-only:cursor-default read-only:bg-muted read-only:text-muted-foreground read-only:border-dashed",R4[n],e),ref:a,...s}));yt.displayName="Input";var T4="Label",g1=u.forwardRef((e,t)=>i.jsx(We.label,{...e,ref:t,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));g1.displayName=T4;var x1=g1;const O4=hd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ie=u.forwardRef(({className:e,...t},n)=>i.jsx(x1,{ref:n,className:we(O4(),e),...t}));Ie.displayName=x1.displayName;function Ua({title:e,description:t,backHref:n,backLabel:s,className:a,icon:r,link:o}){const l=i.jsx(U,{asChild:!0,variant:"outline",size:"sm",className:"mt-4 no-underline",children:i.jsx(o,{href:n,children:s})});return r?i.jsx("div",{className:we("flex-1 px-4 py-8 sm:px-6 lg:px-8",a),children:i.jsxs("section",{className:"mx-auto flex max-w-xl flex-col items-center text-center","data-testid":"not-found-state",children:[i.jsx("div",{className:"text-foreground mb-2 [&_svg]:size-8",children:r}),i.jsx("h1",{className:"m-0 text-xl font-semibold tracking-tight",children:e}),i.jsx("div",{className:"text-muted-foreground mt-2 space-y-2 text-sm",children:t}),l]})}):i.jsx("div",{className:we("flex-1 px-4 py-8 sm:px-6 lg:px-8",a),children:i.jsxs("section",{className:"border-border bg-card mx-auto max-w-xl rounded-xl border p-6",children:[i.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:e}),i.jsx("div",{className:"text-muted-foreground mt-2 space-y-2 text-sm",children:t}),l]})})}function _n({title:e,description:t,actions:n,className:s,children:a,...r}){return i.jsxs("header",{"data-slot":"page-header",className:we("flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",s),...r,children:[i.jsxs("div",{className:"min-w-0 space-y-1",children:[i.jsx("h1",{className:"text-foreground text-2xl font-semibold tracking-tight",children:e}),t?i.jsx("p",{className:"text-muted-foreground text-sm",children:t}):null,a]}),n?i.jsx("div",{"data-slot":"page-header-actions",className:"flex shrink-0 items-center gap-2",children:n}):null]})}function wt({as:e="div",className:t,...n}){return i.jsx(e,{className:we("rounded-lg border",t),...n})}function Xw(e,[t,n]){return Math.min(n,Math.max(t,e))}var v1=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),z4="VisuallyHidden",b1=u.forwardRef((e,t)=>i.jsx(We.span,{...e,ref:t,style:{...v1,...e.style}}));b1.displayName=z4;var M4=b1,$4=[" ","Enter","ArrowUp","ArrowDown"],L4=[" ","Enter"],Sr="Select",[$f,Lf,P4]=zv(Sr),[dl]=wi(Sr,[P4,cl]),Pf=cl(),[I4,Ba]=dl(Sr),[G4,H4]=dl(Sr),y1=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:a,onOpenChange:r,value:o,defaultValue:l,onValueChange:c,dir:d,name:h,autoComplete:f,disabled:m,required:p,form:y}=e,g=Pf(t),[b,v]=u.useState(null),[x,w]=u.useState(null),[_,S]=u.useState(!1),k=Sf(d),[j,N]=La({prop:s,defaultProp:a??!1,onChange:r,caller:Sr}),[O,T]=La({prop:o,defaultProp:l,onChange:c,caller:Sr}),P=u.useRef(null),L=b?y||!!b.closest("form"):!0,[G,A]=u.useState(new Set),D=Array.from(G).map(C=>C.props.value).join(";");return i.jsx(Bv,{...g,children:i.jsxs(I4,{required:p,scope:t,trigger:b,onTriggerChange:v,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:_,onValueNodeHasChildrenChange:S,contentId:Bs(),value:O,onValueChange:T,open:j,onOpenChange:N,dir:k,triggerPointerDownPosRef:P,disabled:m,children:[i.jsx($f.Provider,{scope:t,children:i.jsx(G4,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(C=>{A(R=>new Set(R).add(C))},[]),onNativeOptionRemove:u.useCallback(C=>{A(R=>{const E=new Set(R);return E.delete(C),E})},[]),children:n})}),L?i.jsxs(W1,{"aria-hidden":!0,required:p,tabIndex:-1,name:h,autoComplete:f,value:O,onChange:C=>T(C.target.value),disabled:m,form:y,children:[O===void 0?i.jsx("option",{value:""}):null,Array.from(G)]},D):null]})})};y1.displayName=Sr;var w1="SelectTrigger",_1=u.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...a}=e,r=Pf(n),o=Ba(w1,n),l=o.disabled||s,c=ut(t,o.onTriggerChange),d=Lf(n),h=u.useRef("touch"),[f,m,p]=q1(g=>{const b=d().filter(w=>!w.disabled),v=b.find(w=>w.value===o.value),x=Y1(b,g,v);x!==void 0&&o.onValueChange(x.value)}),y=g=>{l||(o.onOpenChange(!0),p()),g&&(o.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return i.jsx(Wv,{asChild:!0,...r,children:i.jsx(We.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":F1(o.value)?"":void 0,...a,ref:c,onClick:Ce(a.onClick,g=>{g.currentTarget.focus(),h.current!=="mouse"&&y(g)}),onPointerDown:Ce(a.onPointerDown,g=>{h.current=g.pointerType;const b=g.target;b.hasPointerCapture(g.pointerId)&&b.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(y(g),g.preventDefault())}),onKeyDown:Ce(a.onKeyDown,g=>{const b=f.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&m(g.key),!(b&&g.key===" ")&&$4.includes(g.key)&&(y(),g.preventDefault())})})})});_1.displayName=w1;var j1="SelectValue",N1=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:a,children:r,placeholder:o="",...l}=e,c=Ba(j1,n),{onValueNodeHasChildrenChange:d}=c,h=r!==void 0,f=ut(t,c.onValueNodeChange);return Tn(()=>{d(h)},[d,h]),i.jsx(We.span,{...l,ref:f,style:{pointerEvents:"none"},children:F1(c.value)?i.jsx(i.Fragment,{children:o}):r})});N1.displayName=j1;var V4="SelectIcon",k1=u.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...a}=e;return i.jsx(We.span,{"aria-hidden":!0,...a,ref:t,children:s||"▼"})});k1.displayName=V4;var U4="SelectPortal",S1=e=>i.jsx(md,{asChild:!0,...e});S1.displayName=U4;var Cr="SelectContent",C1=u.forwardRef((e,t)=>{const n=Ba(Cr,e.__scopeSelect),[s,a]=u.useState();if(Tn(()=>{a(new DocumentFragment)},[]),!n.open){const r=s;return r?Ko.createPortal(i.jsx(D1,{scope:e.__scopeSelect,children:i.jsx($f.Slot,{scope:e.__scopeSelect,children:i.jsx("div",{children:e.children})})}),r):null}return i.jsx(E1,{...e,ref:t})});C1.displayName=Cr;var Is=10,[D1,Wa]=dl(Cr),B4="SelectContentImpl",W4=jr("SelectContent.RemoveScroll"),E1=u.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:r,onPointerDownOutside:o,side:l,sideOffset:c,align:d,alignOffset:h,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:y,hideWhenDetached:g,avoidCollisions:b,...v}=e,x=Ba(Cr,n),[w,_]=u.useState(null),[S,k]=u.useState(null),j=ut(t,ae=>_(ae)),[N,O]=u.useState(null),[T,P]=u.useState(null),L=Lf(n),[G,A]=u.useState(!1),D=u.useRef(!1);u.useEffect(()=>{if(w)return yv(w)},[w]),bv();const C=u.useCallback(ae=>{const[Ne,...q]=L().map(Q=>Q.ref.current),[B]=q.slice(-1),Z=document.activeElement;for(const Q of ae)if(Q===Z||(Q==null||Q.scrollIntoView({block:"nearest"}),Q===Ne&&S&&(S.scrollTop=0),Q===B&&S&&(S.scrollTop=S.scrollHeight),Q==null||Q.focus(),document.activeElement!==Z))return},[L,S]),R=u.useCallback(()=>C([N,w]),[C,N,w]);u.useEffect(()=>{G&&R()},[G,R]);const{onOpenChange:E,triggerPointerDownPosRef:M}=x;u.useEffect(()=>{if(w){let ae={x:0,y:0};const Ne=B=>{var Z,Q;ae={x:Math.abs(Math.round(B.pageX)-(((Z=M.current)==null?void 0:Z.x)??0)),y:Math.abs(Math.round(B.pageY)-(((Q=M.current)==null?void 0:Q.y)??0))}},q=B=>{ae.x<=10&&ae.y<=10?B.preventDefault():w.contains(B.target)||E(!1),document.removeEventListener("pointermove",Ne),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",Ne),document.addEventListener("pointerup",q,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ne),document.removeEventListener("pointerup",q,{capture:!0})}}},[w,E,M]),u.useEffect(()=>{const ae=()=>E(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[E]);const[H,z]=q1(ae=>{const Ne=L().filter(Z=>!Z.disabled),q=Ne.find(Z=>Z.ref.current===document.activeElement),B=Y1(Ne,ae,q);B&&setTimeout(()=>B.ref.current.focus())}),K=u.useCallback((ae,Ne,q)=>{const B=!D.current&&!q;(x.value!==void 0&&x.value===Ne||B)&&(O(ae),B&&(D.current=!0))},[x.value]),oe=u.useCallback(()=>w==null?void 0:w.focus(),[w]),re=u.useCallback((ae,Ne,q)=>{const B=!D.current&&!q;(x.value!==void 0&&x.value===Ne||B)&&P(ae)},[x.value]),ve=s==="popper"?$g:A1,ke=ve===$g?{side:l,sideOffset:c,align:d,alignOffset:h,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:y,hideWhenDetached:g,avoidCollisions:b}:{};return i.jsx(D1,{scope:n,content:w,viewport:S,onViewportChange:k,itemRefCallback:K,selectedItem:N,onItemLeave:oe,itemTextRefCallback:re,focusSelectedItem:R,selectedItemText:T,position:s,isPositioned:G,searchRef:H,children:i.jsx(df,{as:W4,allowPinchZoom:!0,children:i.jsx(lf,{asChild:!0,trapped:x.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:Ce(a,ae=>{var Ne;(Ne=x.trigger)==null||Ne.focus({preventScroll:!0}),ae.preventDefault()}),children:i.jsx(fd,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:i.jsx(ve,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:ae=>ae.preventDefault(),...v,...ke,onPlaced:()=>A(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Ce(v.onKeyDown,ae=>{const Ne=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!Ne&&ae.key.length===1&&z(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let B=L().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(B=B.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const Z=ae.target,Q=B.indexOf(Z);B=B.slice(Q+1)}setTimeout(()=>C(B)),ae.preventDefault()}})})})})})})});E1.displayName=B4;var F4="SelectItemAlignedPosition",A1=u.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...a}=e,r=Ba(Cr,n),o=Wa(Cr,n),[l,c]=u.useState(null),[d,h]=u.useState(null),f=ut(t,j=>h(j)),m=Lf(n),p=u.useRef(!1),y=u.useRef(!0),{viewport:g,selectedItem:b,selectedItemText:v,focusSelectedItem:x}=o,w=u.useCallback(()=>{if(r.trigger&&r.valueNode&&l&&d&&g&&b&&v){const j=r.trigger.getBoundingClientRect(),N=d.getBoundingClientRect(),O=r.valueNode.getBoundingClientRect(),T=v.getBoundingClientRect();if(r.dir!=="rtl"){const Z=T.left-N.left,Q=O.left-Z,ie=j.left-Q,ce=j.width+ie,$=Math.max(ce,N.width),F=window.innerWidth-Is,ee=Xw(Q,[Is,Math.max(Is,F-$)]);l.style.minWidth=ce+"px",l.style.left=ee+"px"}else{const Z=N.right-T.right,Q=window.innerWidth-O.right-Z,ie=window.innerWidth-j.right-Q,ce=j.width+ie,$=Math.max(ce,N.width),F=window.innerWidth-Is,ee=Xw(Q,[Is,Math.max(Is,F-$)]);l.style.minWidth=ce+"px",l.style.right=ee+"px"}const P=m(),L=window.innerHeight-Is*2,G=g.scrollHeight,A=window.getComputedStyle(d),D=parseInt(A.borderTopWidth,10),C=parseInt(A.paddingTop,10),R=parseInt(A.borderBottomWidth,10),E=parseInt(A.paddingBottom,10),M=D+C+G+E+R,H=Math.min(b.offsetHeight*5,M),z=window.getComputedStyle(g),K=parseInt(z.paddingTop,10),oe=parseInt(z.paddingBottom,10),re=j.top+j.height/2-Is,ve=L-re,ke=b.offsetHeight/2,ae=b.offsetTop+ke,Ne=D+C+ae,q=M-Ne;if(Ne<=re){const Z=P.length>0&&b===P[P.length-1].ref.current;l.style.bottom="0px";const Q=d.clientHeight-g.offsetTop-g.offsetHeight,ie=Math.max(ve,ke+(Z?oe:0)+Q+R),ce=Ne+ie;l.style.height=ce+"px"}else{const Z=P.length>0&&b===P[0].ref.current;l.style.top="0px";const ie=Math.max(re,D+g.offsetTop+(Z?K:0)+ke)+q;l.style.height=ie+"px",g.scrollTop=Ne-re+g.offsetTop}l.style.margin=`${Is}px 0`,l.style.minHeight=H+"px",l.style.maxHeight=L+"px",s==null||s(),requestAnimationFrame(()=>p.current=!0)}},[m,r.trigger,r.valueNode,l,d,g,b,v,r.dir,s]);Tn(()=>w(),[w]);const[_,S]=u.useState();Tn(()=>{d&&S(window.getComputedStyle(d).zIndex)},[d]);const k=u.useCallback(j=>{j&&y.current===!0&&(w(),x==null||x(),y.current=!1)},[w,x]);return i.jsx(Y4,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:k,children:i.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:i.jsx(We.div,{...a,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});A1.displayName=F4;var q4="SelectPopperPosition",$g=u.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:a=Is,...r}=e,o=Pf(n);return i.jsx(Fv,{...o,...r,ref:t,align:s,collisionPadding:a,style:{boxSizing:"border-box",...r.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});$g.displayName=q4;var[Y4,tb]=dl(Cr,{}),Lg="SelectViewport",R1=u.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...a}=e,r=Wa(Lg,n),o=tb(Lg,n),l=ut(t,r.onViewportChange),c=u.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),i.jsx($f.Slot,{scope:n,children:i.jsx(We.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Ce(a.onScroll,d=>{const h=d.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&f){const p=Math.abs(c.current-h.scrollTop);if(p>0){const y=window.innerHeight-Is*2,g=parseFloat(f.style.minHeight),b=parseFloat(f.style.height),v=Math.max(g,b);if(v<y){const x=v+p,w=Math.min(y,x),_=x-w;f.style.height=w+"px",f.style.bottom==="0px"&&(h.scrollTop=_>0?_:0,f.style.justifyContent="flex-end")}}}c.current=h.scrollTop})})})]})});R1.displayName=Lg;var T1="SelectGroup",[X4,K4]=dl(T1),O1=u.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=Bs();return i.jsx(X4,{scope:n,id:a,children:i.jsx(We.div,{role:"group","aria-labelledby":a,...s,ref:t})})});O1.displayName=T1;var z1="SelectLabel",M1=u.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=K4(z1,n);return i.jsx(We.div,{id:a.id,...s,ref:t})});M1.displayName=z1;var Sh="SelectItem",[Z4,$1]=dl(Sh),L1=u.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:a=!1,textValue:r,...o}=e,l=Ba(Sh,n),c=Wa(Sh,n),d=l.value===s,[h,f]=u.useState(r??""),[m,p]=u.useState(!1),y=ut(t,x=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,x,s,a)}),g=Bs(),b=u.useRef("touch"),v=()=>{a||(l.onValueChange(s),l.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(Z4,{scope:n,value:s,disabled:a,textId:g,isSelected:d,onItemTextChange:u.useCallback(x=>{f(w=>w||((x==null?void 0:x.textContent)??"").trim())},[]),children:i.jsx($f.ItemSlot,{scope:n,value:s,disabled:a,textValue:h,children:i.jsx(We.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:y,onFocus:Ce(o.onFocus,()=>p(!0)),onBlur:Ce(o.onBlur,()=>p(!1)),onClick:Ce(o.onClick,()=>{b.current!=="mouse"&&v()}),onPointerUp:Ce(o.onPointerUp,()=>{b.current==="mouse"&&v()}),onPointerDown:Ce(o.onPointerDown,x=>{b.current=x.pointerType}),onPointerMove:Ce(o.onPointerMove,x=>{var w;b.current=x.pointerType,a?(w=c.onItemLeave)==null||w.call(c):b.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ce(o.onPointerLeave,x=>{var w;x.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:Ce(o.onKeyDown,x=>{var _;((_=c.searchRef)==null?void 0:_.current)!==""&&x.key===" "||(L4.includes(x.key)&&v(),x.key===" "&&x.preventDefault())})})})})});L1.displayName=Sh;var Vl="SelectItemText",P1=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:a,...r}=e,o=Ba(Vl,n),l=Wa(Vl,n),c=$1(Vl,n),d=H4(Vl,n),[h,f]=u.useState(null),m=ut(t,v=>f(v),c.onItemTextChange,v=>{var x;return(x=l.itemTextRefCallback)==null?void 0:x.call(l,v,c.value,c.disabled)}),p=h==null?void 0:h.textContent,y=u.useMemo(()=>i.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:b}=d;return Tn(()=>(g(y),()=>b(y)),[g,b,y]),i.jsxs(i.Fragment,{children:[i.jsx(We.span,{id:c.textId,...r,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Ko.createPortal(r.children,o.valueNode):null]})});P1.displayName=Vl;var I1="SelectItemIndicator",G1=u.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return $1(I1,n).isSelected?i.jsx(We.span,{"aria-hidden":!0,...s,ref:t}):null});G1.displayName=I1;var Pg="SelectScrollUpButton",H1=u.forwardRef((e,t)=>{const n=Wa(Pg,e.__scopeSelect),s=tb(Pg,e.__scopeSelect),[a,r]=u.useState(!1),o=ut(t,s.onScrollButtonChange);return Tn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;r(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),a?i.jsx(U1,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});H1.displayName=Pg;var Ig="SelectScrollDownButton",V1=u.forwardRef((e,t)=>{const n=Wa(Ig,e.__scopeSelect),s=tb(Ig,e.__scopeSelect),[a,r]=u.useState(!1),o=ut(t,s.onScrollButtonChange);return Tn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,h=Math.ceil(c.scrollTop)<d;r(h)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),a?i.jsx(U1,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});V1.displayName=Ig;var U1=u.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...a}=e,r=Wa("SelectScrollButton",n),o=u.useRef(null),l=Lf(n),c=u.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),Tn(()=>{var h;const d=l().find(f=>f.ref.current===document.activeElement);(h=d==null?void 0:d.ref.current)==null||h.scrollIntoView({block:"nearest"})},[l]),i.jsx(We.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Ce(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:Ce(a.onPointerMove,()=>{var d;(d=r.onItemLeave)==null||d.call(r),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:Ce(a.onPointerLeave,()=>{c()})})}),Q4="SelectSeparator",B1=u.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return i.jsx(We.div,{"aria-hidden":!0,...s,ref:t})});B1.displayName=Q4;var Gg="SelectArrow",J4=u.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=Pf(n),r=Ba(Gg,n),o=Wa(Gg,n);return r.open&&o.position==="popper"?i.jsx(qv,{...a,...s,ref:t}):null});J4.displayName=Gg;var eI="SelectBubbleInput",W1=u.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const a=u.useRef(null),r=ut(s,a),o=HS(t);return u.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&h){const f=new Event("change",{bubbles:!0});h.call(l,t),l.dispatchEvent(f)}},[o,t]),i.jsx(We.select,{...n,style:{...v1,...n.style},ref:r,defaultValue:t})});W1.displayName=eI;function F1(e){return e===""||e===void 0}function q1(e){const t=mi(e),n=u.useRef(""),s=u.useRef(0),a=u.useCallback(o=>{const l=n.current+o;t(l),function c(d){n.current=d,window.clearTimeout(s.current),d!==""&&(s.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),r=u.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,a,r]}function Y1(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,r=n?e.indexOf(n):-1;let o=tI(e,Math.max(r,0));a.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.textValue.toLowerCase().startsWith(a.toLowerCase()));return c!==n?c:void 0}function tI(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var nI=y1,X1=_1,sI=N1,iI=k1,aI=S1,K1=C1,rI=R1,oI=O1,Z1=M1,Q1=L1,lI=P1,cI=G1,J1=H1,eD=V1,tD=B1;function nD(){var e;if(!(typeof document>"u"))return((e=document.querySelector('meta[name="csp-nonce"]'))==null?void 0:e.content)||void 0}function dI(){const e=nD();return e&&(globalThis.__webpack_nonce__=e),e}const uI={default:"h-9 px-3 py-2 text-sm",control:"h-7 px-2 py-1 text-xs"},St=nI,Kw=oI,Ct=sI,_t=u.forwardRef(({className:e,children:t,triggerSize:n="default",...s},a)=>i.jsxs(X1,{ref:a,className:we("flex w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent shadow-sm ring-offset-background data-[placeholder]:text-disabled-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",uI[n],e),...s,children:[t,i.jsx(iI,{asChild:!0,children:i.jsx(RS,{className:"text-muted-foreground size-4","aria-hidden":"true"})})]}));_t.displayName=X1.displayName;const sD=u.forwardRef(({className:e,...t},n)=>i.jsx(J1,{ref:n,className:we("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(yM,{className:"size-4","aria-hidden":"true"})}));sD.displayName=J1.displayName;const iD=u.forwardRef(({className:e,...t},n)=>i.jsx(eD,{ref:n,className:we("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(hf,{className:"size-4","aria-hidden":"true"})}));iD.displayName=eD.displayName;const jt=u.forwardRef(({className:e,children:t,position:n="popper",...s},a)=>i.jsx(aI,{container:vd(),children:i.jsxs(K1,{ref:a,className:we("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...s,children:[i.jsx(sD,{}),i.jsx(rI,{nonce:nD(),className:we("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),i.jsx(iD,{})]})}));jt.displayName=K1.displayName;const Hg=u.forwardRef(({className:e,...t},n)=>i.jsx(Z1,{ref:n,className:we("px-2 py-1.5 text-sm font-semibold",e),...t}));Hg.displayName=Z1.displayName;const Be=u.forwardRef(({className:e,children:t,...n},s)=>i.jsxs(Q1,{ref:s,className:we("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(cI,{children:i.jsx(Or,{className:"size-4","aria-hidden":"true"})})}),i.jsx(lI,{children:t})]}));Be.displayName=Q1.displayName;const hI=u.forwardRef(({className:e,...t},n)=>i.jsx(tD,{ref:n,className:we("-mx-1 my-1 h-px bg-muted",e),...t}));hI.displayName=tD.displayName;function Tt({className:e,...t}){return i.jsx("div",{className:we("animate-pulse rounded-md bg-primary/10",e),...t})}const it=u.forwardRef(({className:e,containerClassName:t,containerRef:n,containerTabIndex:s,containerAriaLabel:a,...r},o)=>i.jsx("div",{ref:n,tabIndex:s,"aria-label":a,className:we("relative w-full overflow-auto",t),children:i.jsx("table",{ref:o,className:we("w-full caption-bottom text-sm",e),...r})}));it.displayName="Table";const ot=u.forwardRef(({className:e,...t},n)=>i.jsx("thead",{ref:n,className:we("[&_tr]:border-b",e),...t}));ot.displayName="TableHeader";const at=u.forwardRef(({className:e,...t},n)=>i.jsx("tbody",{ref:n,className:we("[&_tr:last-child]:border-0",e),...t}));at.displayName="TableBody";const fI=u.forwardRef(({className:e,...t},n)=>i.jsx("tfoot",{ref:n,className:we("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t}));fI.displayName="TableFooter";const ye=u.forwardRef(({className:e,...t},n)=>i.jsx("tr",{ref:n,className:we("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t}));ye.displayName="TableRow";const J=u.forwardRef(({className:e,...t},n)=>i.jsx("th",{ref:n,className:we("text-muted-foreground h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));J.displayName="TableHead";const X=u.forwardRef(({className:e,...t},n)=>i.jsx("td",{ref:n,className:we("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));X.displayName="TableCell";const mI=u.forwardRef(({className:e,...t},n)=>i.jsx("caption",{ref:n,className:we("text-muted-foreground mt-4 text-sm",e),...t}));mI.displayName="TableCaption";var If="Tabs",[pI]=wi(If,[Af]),aD=Af(),[gI,nb]=pI(If),rD=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:r,orientation:o="horizontal",dir:l,activationMode:c="automatic",...d}=e,h=Sf(l),[f,m]=La({prop:s,onChange:a,defaultProp:r??"",caller:If});return i.jsx(gI,{scope:n,baseId:Bs(),value:f,onValueChange:m,orientation:o,dir:h,activationMode:c,children:i.jsx(We.div,{dir:h,"data-orientation":o,...d,ref:t})})});rD.displayName=If;var oD="TabsList",lD=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,r=nb(oD,n),o=aD(n);return i.jsx(wC,{asChild:!0,...o,orientation:r.orientation,dir:r.dir,loop:s,children:i.jsx(We.div,{role:"tablist","aria-orientation":r.orientation,...a,ref:t})})});lD.displayName=oD;var cD="TabsTrigger",dD=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...r}=e,o=nb(cD,n),l=aD(n),c=fD(o.baseId,s),d=mD(o.baseId,s),h=s===o.value;return i.jsx(_C,{asChild:!0,...l,focusable:!a,active:h,children:i.jsx(We.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":d,"data-state":h?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...r,ref:t,onMouseDown:Ce(e.onMouseDown,f=>{!a&&f.button===0&&f.ctrlKey===!1?o.onValueChange(s):f.preventDefault()}),onKeyDown:Ce(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(s)}),onFocus:Ce(e.onFocus,()=>{const f=o.activationMode!=="manual";!h&&!a&&f&&o.onValueChange(s)})})})});dD.displayName=cD;var uD="TabsContent",hD=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:r,...o}=e,l=nb(uD,n),c=fD(l.baseId,s),d=mD(l.baseId,s),h=s===l.value,f=u.useRef(h);return u.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),i.jsx($s,{present:a||h,children:({present:m})=>i.jsx(We.div,{"data-state":h?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&r})})});hD.displayName=uD;function fD(e,t){return`${e}-trigger-${t}`}function mD(e,t){return`${e}-content-${t}`}var xI=rD,pD=lD,gD=dD,xD=hD;const vI=xI,vD=u.forwardRef(({className:e,...t},n)=>i.jsx(pD,{ref:n,className:we("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));vD.displayName=pD.displayName;const Vg=u.forwardRef(({className:e,...t},n)=>i.jsx(gD,{ref:n,className:we("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));Vg.displayName=gD.displayName;const bI=u.forwardRef(({className:e,...t},n)=>i.jsx(xD,{ref:n,className:we("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));bI.displayName=xD.displayName;const Vn=u.forwardRef(({className:e,...t},n)=>i.jsx("textarea",{className:we("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-disabled-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 read-only:cursor-default read-only:bg-muted read-only:text-muted-foreground read-only:border-dashed",e),ref:n,...t}));Vn.displayName="Textarea";var[Gf]=wi("Tooltip",[cl]),Hf=cl(),bD="TooltipProvider",yI=700,Ug="tooltip.open",[wI,sb]=Gf(bD),yD=e=>{const{__scopeTooltip:t,delayDuration:n=yI,skipDelayDuration:s=300,disableHoverableContent:a=!1,children:r}=e,o=u.useRef(!0),l=u.useRef(!1),c=u.useRef(0);return u.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),i.jsx(wI,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:u.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:u.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,s)},[s]),isPointerInTransitRef:l,onPointerInTransitChange:u.useCallback(d=>{l.current=d},[]),disableHoverableContent:a,children:r})};yD.displayName=bD;var Lc="Tooltip",[_I,Nd]=Gf(Lc),wD=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:a,onOpenChange:r,disableHoverableContent:o,delayDuration:l}=e,c=sb(Lc,e.__scopeTooltip),d=Hf(t),[h,f]=u.useState(null),m=Bs(),p=u.useRef(0),y=o??c.disableHoverableContent,g=l??c.delayDuration,b=u.useRef(!1),[v,x]=La({prop:s,defaultProp:a??!1,onChange:j=>{j?(c.onOpen(),document.dispatchEvent(new CustomEvent(Ug))):c.onClose(),r==null||r(j)},caller:Lc}),w=u.useMemo(()=>v?b.current?"delayed-open":"instant-open":"closed",[v]),_=u.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,x(!0)},[x]),S=u.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x(!1)},[x]),k=u.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{b.current=!0,x(!0),p.current=0},g)},[g,x]);return u.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),i.jsx(Bv,{...d,children:i.jsx(_I,{scope:t,contentId:m,open:v,stateAttribute:w,trigger:h,onTriggerChange:f,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?k():_()},[c.isOpenDelayedRef,k,_]),onTriggerLeave:u.useCallback(()=>{y?S():(window.clearTimeout(p.current),p.current=0)},[S,y]),onOpen:_,onClose:S,disableHoverableContent:y,children:n})})};wD.displayName=Lc;var Bg="TooltipTrigger",_D=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=Nd(Bg,n),r=sb(Bg,n),o=Hf(n),l=u.useRef(null),c=ut(t,l,a.onTriggerChange),d=u.useRef(!1),h=u.useRef(!1),f=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),i.jsx(Wv,{asChild:!0,...o,children:i.jsx(We.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:c,onPointerMove:Ce(e.onPointerMove,m=>{m.pointerType!=="touch"&&!h.current&&!r.isPointerInTransitRef.current&&(a.onTriggerEnter(),h.current=!0)}),onPointerLeave:Ce(e.onPointerLeave,()=>{a.onTriggerLeave(),h.current=!1}),onPointerDown:Ce(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Ce(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:Ce(e.onBlur,a.onClose),onClick:Ce(e.onClick,a.onClose)})})});_D.displayName=Bg;var ib="TooltipPortal",[jI,NI]=Gf(ib,{forceMount:void 0}),jD=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:a}=e,r=Nd(ib,t);return i.jsx(jI,{scope:t,forceMount:n,children:i.jsx($s,{present:n||r.open,children:i.jsx(md,{asChild:!0,container:a,children:s})})})};jD.displayName=ib;var Yo="TooltipContent",ND=u.forwardRef((e,t)=>{const n=NI(Yo,e.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...r}=e,o=Nd(Yo,e.__scopeTooltip);return i.jsx($s,{present:s||o.open,children:o.disableHoverableContent?i.jsx(kD,{side:a,...r,ref:t}):i.jsx(kI,{side:a,...r,ref:t})})}),kI=u.forwardRef((e,t)=>{const n=Nd(Yo,e.__scopeTooltip),s=sb(Yo,e.__scopeTooltip),a=u.useRef(null),r=ut(t,a),[o,l]=u.useState(null),{trigger:c,onClose:d}=n,h=a.current,{onPointerInTransitChange:f}=s,m=u.useCallback(()=>{l(null),f(!1)},[f]),p=u.useCallback((y,g)=>{const b=y.currentTarget,v={x:y.clientX,y:y.clientY},x=AI(v,b.getBoundingClientRect()),w=RI(v,x),_=TI(g.getBoundingClientRect()),S=zI([...w,..._]);l(S),f(!0)},[f]);return u.useEffect(()=>()=>m(),[m]),u.useEffect(()=>{if(c&&h){const y=b=>p(b,h),g=b=>p(b,c);return c.addEventListener("pointerleave",y),h.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",y),h.removeEventListener("pointerleave",g)}}},[c,h,p,m]),u.useEffect(()=>{if(o){const y=g=>{const b=g.target,v={x:g.clientX,y:g.clientY},x=(c==null?void 0:c.contains(b))||(h==null?void 0:h.contains(b)),w=!OI(v,o);x?m():w&&(m(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,h,o,d,m]),i.jsx(kD,{...e,ref:r})}),[SI,CI]=Gf(Lc,{isInside:!1}),DI=OO("TooltipContent"),kD=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:r,onPointerDownOutside:o,...l}=e,c=Nd(Yo,n),d=Hf(n),{onClose:h}=c;return u.useEffect(()=>(document.addEventListener(Ug,h),()=>document.removeEventListener(Ug,h)),[h]),u.useEffect(()=>{if(c.trigger){const f=m=>{const p=m.target;p!=null&&p.contains(c.trigger)&&h()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,h]),i.jsx(fd,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:h,children:i.jsxs(Fv,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[i.jsx(DI,{children:s}),i.jsx(SI,{scope:n,isInside:!0,children:i.jsx(M4,{id:c.contentId,role:"tooltip",children:a||s})})]})})});ND.displayName=Yo;var SD="TooltipArrow",EI=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=Hf(n);return CI(SD,n).isInside?null:i.jsx(qv,{...a,...s,ref:t})});EI.displayName=SD;function AI(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),r=Math.abs(t.left-e.x);switch(Math.min(n,s,a,r)){case r:return"left";case a:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function RI(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function TI(e){const{top:t,right:n,bottom:s,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:s},{x:a,y:s}]}function OI(e,t){const{x:n,y:s}=e;let a=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){const l=t[r],c=t[o],d=l.x,h=l.y,f=c.x,m=c.y;h>s!=m>s&&n<(f-d)*(s-h)/(m-h)+d&&(a=!a)}return a}function zI(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),MI(t)}function MI(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const a=e[s];for(;t.length>=2;){const r=t[t.length-1],o=t[t.length-2];if((r.x-o.x)*(a.y-o.y)>=(r.y-o.y)*(a.x-o.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const a=e[s];for(;n.length>=2;){const r=n[n.length-1],o=n[n.length-2];if((r.x-o.x)*(a.y-o.y)>=(r.y-o.y)*(a.x-o.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var $I=yD,LI=wD,PI=_D,II=jD,CD=ND;const ab=$I,kd=LI,Sd=PI,ul=u.forwardRef(({className:e,sideOffset:t=4,...n},s)=>{const a=vd(),r=i.jsx(CD,{ref:s,sideOffset:t,className:we("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n});return a?i.jsx(II,{container:a,children:r}):r});ul.displayName=CD.displayName;const DD=u.createContext(null);function Wg({data:e,router:t,identity:n,notify:s,children:a}){return i.jsx(DD.Provider,{value:{data:e,router:t,identity:n,notify:s},children:a})}function Vf(){const e=u.useContext(DD);if(!e)throw new Error("A shared app page rendered outside AppUiProvider.");return e}const GI={success:()=>{},error:()=>{}},Wn=()=>Vf().data,lt=()=>Vf().router,Uf=()=>Vf().identity,Fa=()=>Vf().notify??GI;function HI(){const{probe:e}=Wn(),{href:t,Link:n}=lt(),s=Uf(),[a,r]=u.useState(null),[o,l]=u.useState(!1);return u.useEffect(()=>{let c=!0;if(!e){l(!0);return}return e.source().then(d=>c&&r(d.label),()=>c&&l(!0)),()=>{c=!1}},[e]),i.jsxs("section",{"data-testid":"app-ui-probe",className:"m-6 flex max-w-xl flex-col gap-2 rounded-lg border border-border bg-card p-6 text-card-foreground",children:[i.jsx("h1",{className:"text-xl font-semibold",children:"Shared app UI"}),i.jsx("p",{"data-testid":"app-ui-probe-source",className:"text-sm text-muted-foreground",children:o?"Data source unavailable":a??"Loading…"}),i.jsxs("p",{"data-testid":"app-ui-probe-identity",className:"text-sm",children:[s.label," · ",s.can("tasks.write")?"can edit tasks":"read only"]}),i.jsx(n,{href:t("/tasks"),className:"rounded-sm text-sm text-primary underline outline-hidden focus-visible:ring-2 focus-visible:ring-ring",children:"Tasks"})]})}const VI="Local only · this machine · not connected to SoftwareDLC",UI="Checking sync state…",BI="Sync state unknown",WI="Projects are the repositories this viewer reads on this machine. Nothing is shared unless you connect to SoftwareDLC.",Dr="Details are in the terminal running sdlc viewer.",FI="How to fix it is in the terminal running sdlc viewer.",Bf="Loading…",Ch="Not available";function qI(e){if(!e.source)return null;if(e.source.kind==="repository")return"Repository · in no folder";const t=e.source.repositories;return`Folder · ${t} ${t===1?"repository":"repositories"}`}function Ul(e){return(typeof e=="string"?new Date(e):e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}const YI={repository_registry:"this repository's registry",folder_registry:"the folder registry",issue_store:"the issue store",task_store:"the task store",workspace_store:"the local graph store"};function ED(e,t){const n=t?` this list was read at ${Ul(t)}.`:"";if(e.reason==="store_locked"){const s=e.store?YI[e.store]:"a local store",a=e.since?` since ${Ul(e.since)}`:"";return`Another sdlc command has held ${s}${a};${n||" nothing was read yet."} ${Dr}`}return e.status===0?`The viewer did not answer. Is sdlc viewer still running?${t?` This list was read at ${Ul(t)}.`:""}`:`The read failed.${t?` This list was read at ${Ul(t)}.`:""} ${Dr}`}const XI=e=>e.status===409,KI={not_a_home:"The repository this one's folder pointer names is not a folder's home.",folder_conflict:"This repository holds both a folder pointer and a folder's membership.",pointer_invalid:"This repository's folder pointer cannot be read, or names this repository as its own home.",membership_invalid:"The folder's records cannot be read.",folder_invalid:"This repository's folder records cannot be read."};function ZI(e){const t=e.repository??"This repository";if(e.reason==="folder_member_unlisted"&&e.folder&&e.home&&e.member_path)return{kind:"unlisted",repository:t,folder:e.folder,home:e.home,member_path:e.member_path};if(e.reason==="member_moved"){const a=e.folder?`the folder ${e.folder}`:"its folder";return{kind:"moved_member",cause:`This repository, ${t}, is not where ${a} records it.`}}if(e.reason==="folder_moved")return{kind:"other",cause:e.folder?`The folder ${e.folder} has moved.`:"The folder has moved.",fix:!0};const n=e.reason?KI[e.reason]:void 0,s=n!==void 0&&e.reason!=="membership_invalid"&&e.reason!=="folder_invalid";return{kind:"other",cause:n??"This repository's folder cannot be read.",fix:s}}const Zw=["tasks","issues","releases"],rb=u.createContext(null);function ss(){const e=u.useContext(rb);if(!e)throw new Error("A shell page rendered outside the app shell.");return e}function QI(){var e;return(e=u.useContext(rb))==null?void 0:e.engine}const JI=10,e3=()=>new Date;function t3({shell:e,now:t=e3,children:n}){var G;const[s,a]=u.useState(null),[r,o]=u.useState(null),[l,c]=u.useState(null),[d,h]=u.useState(null),[f,m]=u.useState(null),[p,y]=u.useState(!0),[g,b]=u.useState(!1),[v,x]=u.useState(void 0),[w,_]=u.useState(!1),[S,k]=u.useState(Zw),j=u.useRef(!1),N=u.useRef(!1),O=u.useRef(null),T=u.useRef(!0),P=u.useCallback(async(A=!1)=>{O.current&&clearTimeout(O.current),O.current=null,b(!0);const[D,C]=await Promise.all([e.organizations.list(),e.projects.list()]);if(!T.current)return;if(b(!1),y(!1),D.ok&&C.ok){if(j.current=!0,N.current=!1,m(null),h(t()),D.data.organizations.length===0){c("not_in_git"),a(null),o(null);return}c(null),a(D.data.organizations[0]),o(C.data.projects);return}const R=D.ok?C.ok?null:C.refusal:D.refusal;if(!R)return;if(XI(R)){N.current=!1,m(null),c(R),a(null),o(null);return}const E=j.current&&!N.current&&!A;N.current=!0;const M=R.retry_after??JI;m({refusal:R,shown:!E,retryInSeconds:E?M:null}),E&&(O.current=setTimeout(()=>void P(!0),M*1e3))},[e,t]);u.useEffect(()=>(T.current=!0,P(),e.about.about().then(A=>{T.current&&(A.ok?x(A.data):A.refusal.status===404?x(null):_(!0))}),Promise.all(Zw.map(async A=>{var D;return[A,await((D=e[A])==null?void 0:D.access())]})).then(A=>{T.current&&k(A.filter(([,D])=>!(D!=null&&D.ok&&!D.data.can_view)).map(([D])=>D))}),()=>{T.current=!1,O.current&&clearTimeout(O.current)}),[e,P]);const L={loading:p,org:s,projects:r,none:l,readAt:d,failure:f,about:v,aboutFailed:w,engine:(v==null?void 0:v.engine)===null?null:(G=v==null?void 0:v.engine)==null?void 0:G.source,domains:S,reading:g,refresh:()=>void P()};return i.jsx(rb.Provider,{value:L,children:n})}const AD=e=>`The ${e} page is not part of this sdlc install`,Lr="The sdlc engine here is too old for this page";function n3(e){return e==="checkout"?"Update the main checkout, then restart sdlc viewer.":"Update sdlc to its latest version, then restart sdlc viewer."}function is(){return n3(QI())}function ji({page:e,header:t}){return i.jsxs(i.Fragment,{children:[t??i.jsx(_n,{title:e}),i.jsx(s3,{page:e})]})}function s3({page:e}){return i.jsxs(me,{variant:"info",role:"status",className:"mt-6","data-testid":"not-installed",children:[i.jsx(pn,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:AD(e)})]})}const i3=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Qw="Opening. If macOS asks whether sdlc viewer may control Terminal, allow it.";function ob(e,t){return`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(t)}`}const Jw=/^iss-\d{1,9}$/;function a3(e,t,n=null){if(e.kind==="open"||e.kind==="card")return null;if(n!==null)return Jw.test(n)?`claude "$(sdlc view --issue ${n} --prompt)"`:null;const s=e.kind==="start"?e.task??t:t;return s&&i3.test(s)?`claude "$(sdlc view --task ${s} --prompt)"`:e.kind==="start"&&Jw.test(e.issue)?`claude "$(sdlc view --issue ${e.issue} --prompt)"`:null}function Wf({org:e,action:t,task_id:n,issue:s=null,open_thread:a,labelled:r=!1}){const{href:o,Link:l}=lt(),{confirm:c,confirm_dialog:d}=al(),h=is(),[f,m]=u.useState(!1),[p,y]=u.useState(!1),[g,b]=u.useState(null),v=u.useId(),x=`${n??""}
|
|
424
|
+
${s??""}
|
|
425
|
+
${(t==null?void 0:t.kind)??""}
|
|
426
|
+
${t&&"thread"in t?t.thread:""}`,[w,_]=u.useState(x),S=u.useRef(x);if(S.current=x,w!==x&&(_(x),m(!1),y(!1),b(null)),u.useEffect(()=>{if(!g)return;const P=()=>b(null);return document.addEventListener("pointerdown",P,!0),document.addEventListener("click",P,!0),()=>{document.removeEventListener("pointerdown",P,!0),document.removeEventListener("click",P,!0)}},[g]),!t)return{button:null,panel:null};const k=a3(t,n,s);if(t.kind==="open"||t.kind==="card"){const P=t.title,L=r?i.jsxs(i.Fragment,{children:[i.jsx(Rc,{className:"mr-2 size-4","aria-hidden":"true"}),"Open thread"]}):i.jsx(Rc,{className:"size-4","aria-hidden":"true"}),G=r?"default":"icon";if(t.kind==="card"||!a)return{button:i.jsx(e_,{text:`Open thread: ${P}`,children:i.jsx("span",{className:"inline-flex",children:i.jsx(U,{asChild:!0,variant:"outline",size:G,children:i.jsx(l,{href:o(ob(e,t.thread)),"aria-label":`Open thread: ${P}`,children:L})})})}),panel:null};const A=async()=>{if(p)return;const C=x,R=()=>S.current===C;b(null),y(!0);const E=await a(t.thread,async M=>{y(!1);const H=await c({title:`Reopen ${P} in Terminal?`,description:`Its session is closed. It opens in a new Terminal window in ${M??"the thread's folder"}, running claude --resume.`,action_label:"Reopen"});return H&&R()&&y(!0),H});R()&&(y(!1),"note"in E&&b(E.note))},D=p?Qw:(g==null?void 0:g.role)==="muted"?RD(g,h):"";return{button:i.jsxs(i.Fragment,{children:[i.jsx(e_,{text:`Open thread: ${P}`,children:i.jsx(U,{type:"button",variant:"outline",size:G,"aria-label":`Open thread: ${P}`,"aria-busy":p||void 0,"aria-disabled":p||void 0,onClick:()=>void A(),children:L})}),i.jsx("span",{role:"status",className:"sr-only",children:D}),d]}),panel:p?i.jsxs(me,{variant:"info",role:"presentation",className:"mt-2",children:[i.jsx(pn,{className:"size-4","aria-hidden":"true"}),i.jsx(pe,{className:"text-current",children:Qw})]}):g?i.jsx(r3,{note:g,outdated_step:h}):null}}if(!k)return{button:null,panel:null};const j=t.kind==="continue"?"Continue":"Start a thread",N=t.kind==="continue"?`Continue ${t.title}`:t.kind==="start"?`Start a thread for ${t.issue}`:j,O=t.kind==="continue"?`Run in a terminal to continue ${t.title}:`:t.kind==="start"?`Run in a terminal to start a thread for ${t.issue}:`:"Run in a terminal in this checkout:",T=t.kind==="start"?Pa:p$;return{button:i.jsxs(U,{type:"button",variant:"outline",size:r?"default":"sm","aria-label":N,"aria-expanded":f,"aria-controls":f?v:void 0,onClick:()=>m(P=>!P),children:[i.jsx(T,{className:"mr-2 size-4","aria-hidden":"true"}),j]}),panel:f?i.jsx(o3,{id:v,lead:O,command:k}):null}}function e_({text:e,children:t}){return i.jsx(ab,{children:i.jsxs(kd,{children:[i.jsx(Sd,{asChild:!0,children:t}),i.jsx(ul,{children:e})]})})}function RD(e,t){return e.outdated?`${e.text} ${t}`:e.text}function r3({note:e,outdated_step:t}){const n=RD(e,t);return e.role==="muted"?i.jsxs(me,{variant:"default",role:"presentation",className:"mt-2",children:[i.jsx(pn,{className:"size-4","aria-hidden":"true"}),i.jsx(pe,{children:n})]}):e.role==="you"?i.jsxs(me,{variant:"warning",className:"mt-2",children:[i.jsx(Nt,{className:"size-4","aria-hidden":"true"}),i.jsx(pe,{className:"text-current",children:n})]}):i.jsxs(me,{variant:"destructive",className:"mt-2",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(pe,{className:"text-current",children:n})]})}function o3({id:e,lead:t,command:n}){return i.jsxs("div",{id:e,className:"mt-2 grid max-w-full gap-1 text-left",children:[i.jsx("span",{className:"text-muted-foreground text-sm",children:t}),i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("pre",{className:"bg-muted min-w-0 flex-1 overflow-x-auto rounded-md border px-2 py-1 text-sm whitespace-pre",children:i.jsx("code",{className:"font-mono",children:n})}),i.jsx(Fg,{text:n,label:"Copy",aria_label:"Copy the command",what:"the command"})]})]})}function Fg({text:e,label:t,aria_label:n,what:s,variant:a="outline",size:r="sm"}){const[o,l]=u.useState("idle");u.useEffect(()=>{if(o!=="copied")return;const d=()=>l("idle");return document.addEventListener("pointerdown",d,!0),document.addEventListener("keydown",d,!0),()=>{document.removeEventListener("pointerdown",d,!0),document.removeEventListener("keydown",d,!0)}},[o]);const c=async()=>{try{await navigator.clipboard.writeText(e),l("copied")}catch{l("failed")}};return i.jsxs("span",{className:"inline-flex flex-wrap items-center gap-2",children:[i.jsxs(U,{type:"button",variant:a,size:r,"aria-label":o==="copied"?void 0:n,onClick:()=>void c(),children:[o==="copied"?i.jsx(Or,{className:"mr-2 size-4","aria-hidden":"true"}):i.jsx(Sv,{className:"mr-2 size-4","aria-hidden":"true"}),o==="copied"?"Copied":t]}),i.jsxs("span",{role:"status","aria-live":"polite",className:"text-muted-foreground text-xs",children:[o==="failed"?`Copy failed: select ${s}`:null,o==="copied"?i.jsxs("span",{className:"sr-only",children:["Copied ",s]}):null]})]})}const t_=["none","read","comment","write","manage","admin"];function cc(e,t){return t_.indexOf(e??"none")>=t_.indexOf(t)}function lb(e){return e==="api_key"?"API key":e==="sdlc_login"?"sdlc login":null}function cp(e,t){const n=lb(e);return e==="sdlc_login"&&t?`${n} on ${TD(t)}`:n}const l3=String.fromCodePoint(8296),c3=String.fromCodePoint(8297);function TD(e){return`${l3}${e}${c3}`}const Pc={blocked:{label:"Blocked",tone:"warning"},waiting_for_user:{label:"Waiting for a member",tone:"warning"},waiting_for_external:{label:"Waiting outside",tone:"warning"},paused:{label:"Paused",tone:"neutral"}},d3={backlog:"neutral",planned:"neutral",in_progress:"info",completed:"success",canceled:"neutral"};function OD(e){return e.name==="Blocked"?"warning":d3[e.category]}const n_=1800;function Ys(e){return new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Rs(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function cb(e){return`${Ts(e)}, ${Rs(e)}`}function Rl(e){return e<90?`${Math.round(e)} s`:e<5400?`${Math.round(e/60)} min`:`${(e/3600).toFixed(1).replace(/\.0$/,"")} h`}function Ts(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function zD(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function u3(e){if(e.open_holds===0)return null;if(e.released_holds===e.open_holds)return{label:`${e.released_holds} ready to resolve`,tone:"neutral"};const t=e.open_holds-e.released_holds;return{label:e.released_holds>0?`${t} open · ${e.released_holds} ready`:`${t} open`,tone:"warning"}}function h3(e){return{"task.created":"Created the task","task.title_changed":"Changed the title","task.description_changed":"Changed the description","task.status_changed":"Changed the status","task.priority_changed":"Changed the priority","task.primary_changed":"Changed the primary","task.custom_fields_changed":"Changed a field","task.archived":"Archived the task","task.restored":"Restored the task","task.reordered":"Moved the task","task.reparented":"Moved the task under another","task.contributor_added":"Added a contributor","task.contributor_removed":"Removed a contributor","task.checklist_item_added":"Added a checklist item","task.checklist_item_edited":"Edited a checklist item","task.checklist_item_toggled":"Checked off a checklist item","task.checklist_item_moved":"Moved a checklist item","task.checklist_item_archived":"Removed a checklist item","task.hold_opened":"Opened a hold","task.hold_released":"Released a hold","task.hold_resolved":"Resolved a hold","task.claimed":"Claimed the task","task.claim_released":"Released a claim","task.claim_completed":"Finished a claim","task.claim_expired":"Ended a lapsed claim","task.relation_added":"Linked a task","task.relation_archived":"Unlinked a task","task.project_linked":"Linked a project","task.project_unlinked":"Unlinked a project"}[e.event_type]??"Changed the task"}const f3="can't see this List",m3="can't see this task",p3="To wait for someone who can't see this task, set their Tasks Permission on the Users page.",g3="To assign someone who can't see this List, set their Tasks Permission on the Users page.";function MD(e,t,n,s=!0){const[a,r]=u.useState(null);return u.useEffect(()=>{if(r(null),!e||!t||!s)return;let o=!0;return e(t,n).then(l=>{o&&l.ok&&r(new Set(l.data))}),()=>{o=!1}},[e,t,n,s]),a}function $D(e,t,n){const s=e.map(a=>{const r=t!==null&&!t.has(a.user_id);return{...a,disabled:r,text:r?`${a.label} · ${n}`:a.label}});return[...s.filter(a=>!a.disabled),...s.filter(a=>a.disabled)]}const ta="not_set";function x3({open:e,commands:t,list_id:n,list_revision:s,default_status_id:a,statuses:r,priorities:o,members:l,assignable:c=null,on_close:d,on_created:h}){var D;const f=Fa(),[m,p]=u.useState(""),[y,g]=u.useState(""),[b,v]=u.useState(a??((D=r[0])==null?void 0:D.id)??""),[x,w]=u.useState(ta),[_,S]=u.useState(ta),[k,j]=u.useState(!1),[N,O]=u.useState(null),[T,P]=u.useState(!1),L=$D(l,c,f3),G=L.some(C=>C.disabled);u.useEffect(()=>{var C;e&&(p(""),g(""),v(a??((C=r[0])==null?void 0:C.id)??""),w(ta),S(ta),j(!1),O(null))},[e,a,r]);const A=async C=>{if(C.preventDefault(),!m.trim()){j(!0);return}P(!0),O(null);try{const R=await t.run("create_task",{list_id:n,expected_list_revision:s,title:m.trim(),description:y.trim()||null,status_id:b||null,priority_id:x===ta?null:x,primary_user_id:_===ta?null:_});if(!R.ok){O(R.refusal.message);return}f.success("Task created."),await h()}finally{P(!1)}};return i.jsx(jn,{open:e,onOpenChange:C=>C?null:d(),children:i.jsx(Nn,{children:i.jsxs("form",{onSubmit:C=>void A(C),noValidate:!0,children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:"New task"}),i.jsx(Dn,{children:"Add a task to this List."})]}),i.jsxs("div",{className:"mt-4 grid gap-4",children:[N&&i.jsxs(me,{variant:"destructive",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(pe,{children:N})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"new-task-title",children:"Title"}),i.jsx(yt,{id:"new-task-title",placeholder:"What needs doing",value:m,required:!0,"aria-invalid":k,"aria-describedby":k?"new-task-title-error":void 0,onChange:C=>{p(C.target.value),j(!1)}}),k&&i.jsx("p",{id:"new-task-title-error",className:"text-destructive text-xs",children:"Give the task a title."})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"new-task-description",children:"Description (optional)"}),i.jsx(Vn,{id:"new-task-description",rows:4,value:y,onChange:C=>g(C.target.value)})]}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"new-task-status",children:"Status"}),i.jsxs(St,{value:b,onValueChange:v,children:[i.jsx(_t,{id:"new-task-status",children:i.jsx(Ct,{})}),i.jsx(jt,{children:r.map(C=>i.jsx(Be,{value:C.id,children:C.name},C.id))})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"new-task-priority",children:"Priority"}),i.jsxs(St,{value:x,onValueChange:w,children:[i.jsx(_t,{id:"new-task-priority",children:i.jsx(Ct,{})}),i.jsxs(jt,{children:[i.jsx(Be,{value:ta,children:"Not set"}),o.map(C=>i.jsx(Be,{value:C.id,children:C.name},C.id))]})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"new-task-primary",children:"Primary"}),i.jsxs(St,{value:_,onValueChange:S,children:[i.jsx(_t,{id:"new-task-primary","aria-describedby":G?"new-task-primary-hint":void 0,children:i.jsx(Ct,{})}),i.jsxs(jt,{children:[i.jsx(Be,{value:ta,children:"Not set"}),L.map(C=>i.jsx(Be,{value:C.user_id,disabled:C.disabled,children:C.text},C.user_id))]})]})]})]}),G&&i.jsx("p",{id:"new-task-primary-hint",className:"text-muted-foreground text-xs",children:g3})]}),i.jsxs(Sn,{className:"mt-6",children:[i.jsx(U,{type:"button",variant:"outline",onClick:d,children:"Cancel"}),i.jsx(U,{type:"submit",disabled:T,children:T?"Creating…":"Create task"})]})]})})})}const v3="Your organization's work, in queue order. Claim a task to show you are working on it.",Bl="any",LD="none",b3=1,y3=250;function db(){const e=Wn().tasks;if(!e)throw new Error("The Tasks page rendered without the tasks seam.");return e}function w3({org:e}){var y,g;const t=db(),{href:n,Link:s}=lt(),[a,r]=u.useState({state:"loading"}),[o,l]=u.useState([]),[c,d]=u.useState(null),h=u.useRef(0),f=u.useCallback(async b=>{const v=h.current+=1;b&&r({state:"loading"});const x=await t.availability({fresh:b});v===h.current&&r(x)},[t.availability]);u.useEffect(()=>{f(!1)},[f]);const m=u.useCallback(()=>void f(!0),[f]);if(u.useEffect(()=>{let b=!0;return t.members().then(v=>{b&&v.ok&&l(v.data)}),()=>{b=!1}},[t.members]),u.useEffect(()=>{if(!t.access)return;let b=!0;return t.access().then(v=>{b&&v.ok&&d(v.data)}),()=>{b=!1}},[t.access]),a.state==="off"&&((y=a.refusal)==null?void 0:y.reason)!=="engine_missing")return i.jsx(Ua,{title:"Page not found",description:"This page does not exist, or you do not have access to it.",backHref:n(`/org/${e}`),backLabel:"Back to the organization",link:s});const p=(c==null?void 0:c.read_only_reason)??v3;return i.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:a.state==="active"?i.jsx(j3,{active:a,org:e,members:o,description:p,read_only_reason:c==null?void 0:c.read_only_reason,reload_configuration:m}):a.state==="off"&&((g=a.refusal)==null?void 0:g.reason)==="engine_missing"?i.jsx(ji,{page:"Tasks"}):i.jsxs(i.Fragment,{children:[i.jsx(_n,{title:"Tasks",description:p}),a.state==="loading"&&i.jsx(PD,{}),(a.state==="error"||a.state==="off")&&i.jsx(ID,{refusal:a.refusal,on_retry:m}),a.state==="available"&&i.jsx(_3,{on_done:m})]})})}function PD(){return i.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading tasks",children:Array.from({length:6},(e,t)=>i.jsx(Tt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function ID({refusal:e,on_retry:t}){const n=is();return(e==null?void 0:e.reason)==="view_outdated"?i.jsxs(me,{variant:"warning",className:"mt-6",children:[i.jsx(Nt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:Lr}),i.jsx(pe,{children:n})]}):i.jsxs(me,{variant:"destructive",className:"mt-6",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Tasks could not be loaded"}),i.jsxs(pe,{children:[i.jsx("p",{children:e!=null&&e.reason?e.message:"Check your connection and try again."}),i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function _3({on_done:e}){const{commands:t}=db(),n=Fa(),[s,a]=u.useState(!1),r=t==null?void 0:t.activate,o=async()=>{if(!r)return;a(!0);const l=await r();if(a(!1),!l.ok){n.error(l.refusal.message);return}n.success("Tasks are on."),e()};return i.jsxs(me,{variant:"info",className:"mt-6",children:[i.jsx(pn,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Tasks are not on for this organization"}),i.jsxs(pe,{children:[i.jsx("p",{children:"Turning them on creates one List with the default workflow and needs two-factor sign-in. Then set members' Tasks Permission on the Users page."}),r?i.jsx(U,{type:"button",size:"sm",className:"mt-2",disabled:s,onClick:()=>void o(),children:"Turn on Tasks"}):null]})]})}const dp=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function j3({active:e,org:t,members:n,description:s,read_only_reason:a,reload_configuration:r}){var tn;const{commands:o,listTasks:l,waitingOnYou:c,hierarchyRevision:d,assignees:h}=db(),{href:f,Link:m}=lt(),{self_id:p}=Uf(),y=Fa(),{list:g,workspace:b}=e,v=g.offers,x=v!==void 0,w=u.useMemo(()=>{var Y;return((Y=b.workflows.find(he=>he.id===g.workflow_id))==null?void 0:Y.statuses)??[]},[b,g]),_=b.priorities,S=!!o&&cc(g.permission,"write"),k=S&&cc(g.permission,"manage"),j=u.useMemo(()=>new Map(n.map(Y=>[Y.user_id,Y])),[n]),N=Y=>{var he;return Y?Y===p?"You":((he=j.get(Y))==null?void 0:he.label)??"A member":""},[O,T]=u.useState("active"),[P,L]=u.useState(!1),[G,A]=u.useState(""),[D,C]=u.useState("");u.useEffect(()=>{const Y=setTimeout(()=>C(G),y3);return()=>clearTimeout(Y)},[G]);const[R,E]=u.useState(null),[M,H]=u.useState(Bl),[z,K]=u.useState(!1),[oe,re]=u.useState(!1),[ve,ke]=u.useState({}),[ae,Ne]=u.useState([]),[q,B]=u.useState(null),[Z,Q]=u.useState([]),[ie,ce]=u.useState(null),[$,F]=u.useState(0),[ee,se]=u.useState(!1),[ge,de]=u.useState(null),[Le,Ee]=u.useState(null),W=is(),[_e,He]=u.useState(!1),Dt=MD(h,g.id,void 0,_e),[en,zt]=u.useState(null),[tt,ft]=u.useState({}),[It,zn]=u.useState(""),{confirm:gn,confirm_dialog:Mn}=al(),xe=u.useRef(null),ne=u.useRef(null),Se=u.useRef(null),Ye=u.useRef(null),[nt,as]=u.useState(void 0),$n=!!(D.trim()||R||M!==Bl||z||oe),rs=u.useRef(0),Zs=u.useRef(0),V=u.useCallback(async(Y,he=!1)=>{if(he&&Zs.current>0)return;const Qe=Y?rs.current:rs.current+=1,gt={state:O,assigned_to_me:P||void 0,cursor:Y,search:D.trim()||void 0,group:R??void 0,owner:M===Bl?void 0:M===LD?"":M,urgent:z||void 0,over_estimate:oe||void 0,...N3(ve,ae)},Vt=qn=>l(g.id,{...gt,cursor:qn});Y||(Zs.current+=1);let Et=await Vt(Y).finally(()=>{Y||(Zs.current-=1)}),Ut=!!Y;if(!Et.ok&&Et.refusal.code==="cursor_stale"&&(Et=await Vt(),Ut=!1),Qe!==rs.current)return;if(!Et.ok){ce(Et.refusal),F(qn=>qn+1);return}const At=Et.data;ce(null),F(0),!(he&&dp(At,Se.current))&&(Se.current=At,B(At),At.facets&&as(At.facets),Q(qn=>Ut?[...qn,...At.tasks]:At.tasks))},[l,g.id,O,P,D,R,M,z,oe,ve,ae]),$e=u.useCallback(async()=>{const Y=await c();if(Ee(Qe=>Y.ok?null:dp(Qe,Y.refusal)?Qe:Y.refusal),!Y.ok&&x)return;const he=Y.ok?Y.data:null;dp(he,Ye.current)||(Ye.current=he,de(he))},[c,x]);u.useEffect(()=>{Se.current=null,B(null)},[O,P]),u.useEffect(()=>{V()},[V]),u.useEffect(()=>{$e()},[$e]);const Xe=u.useCallback(async()=>{await Promise.all([V(),$e()])},[V,$e]),Mt=u.useRef(Xe);Mt.current=Xe;const Ls=v==null?void 0:v.refresh_ms;u.useEffect(()=>{if(!Ls)return;const Y=setInterval(()=>{V(void 0,!0),$e()},Ls);return()=>clearInterval(Y)},[Ls,V,$e]);const Ni=u.useCallback(async(Y,he,Qe)=>{if(!o)return;const gt=await o.run(Y,he);gt.ok?Qe&&y.success(Qe):(y.error(gt.refusal.message),gt.refusal.code==="revision_conflict"&&r()),await Xe()},[o,y,Xe,r]),ki=w.find(Y=>Y.category==="completed"),Xa=async(Y,he,Qe)=>{const gt=he+Qe,Vt=Z[gt];if(!Vt||!q||!o)return;const Et=async(Ut,At)=>{const qn=await o.run(Ut,At);if(!qn.ok)throw qn.refusal;return qn.data};try{let Ut=q.list.order_revision,At=Y.revision;if(Vt.queue_rank===null){const qn=Z.findIndex(Zi=>Zi.queue_rank===null);for(const Zi of Z.slice(qn,gt+1)){const wl=await Et("reorder",{task_id:Zi.id,expected_revision:Zi.revision,expected_order_revision:Ut,placement:"end"});Ut=wl.list.order_revision,Zi.id===Y.id&&(At=wl.task.revision)}}await Et("reorder",{task_id:Y.id,expected_revision:At,expected_order_revision:Ut,placement:Qe<0?"before":"after",anchor_task_id:Vt.id})}catch(Ut){y.error(Ut.message)}await Xe()},Ir=Y=>{ki&&Ni("update_task",{task_id:Y.id,expected_revision:Y.revision,changes:{status_id:ki.id}},`${Y.title} completed.`)},Oe=async Y=>{if(!q||!await gn({title:"Archive this task?",description:"It leaves the queue and becomes read-only. Its claim, holds and history stay, and a manager can restore it.",action_label:"Archive task",destructive:!0}))return;const[Qe,gt]=await Promise.all([l(g.id,{limit:1}),d(b.id)]);if(!Qe.ok||!gt.ok){y.error(Qe.ok?gt.ok?"":gt.refusal.message:Qe.refusal.message);return}await Ni("archive_task",{task_id:Y.id,expected_revision:Y.revision,expected_order_revision:Qe.data.list.order_revision,expected_hierarchy_revision:gt.data},`${Y.title} archived.`)},ht=async Y=>{await Ni("release_hold",{hold_id:Y},"Hold released.")},ln=async(Y,he,Qe,gt)=>{if(!(o!=null&&o.complete)||!await gn({title:`Mark ${he} done?`,description:Qe.reason?`“${Qe.reason}”
|
|
427
|
+
|
|
428
|
+
It leaves the open tasks.`:"It leaves the open tasks.",action_label:"Mark done"}))return;zt(Y);const Et=await o.complete(Qe);if(zt(null),!Et.ok){ft(Ut=>({...Ut,[Y]:Et.refusal.message}));return}ft(({[Y]:Ut,...At})=>At),zn(`${he} marked done.`),await Mt.current(),Ln({next:gt})},[cn,Ln]=u.useState(null);u.useEffect(()=>{var gt;if(!cn)return;Ln(null);const Y=ne.current,he=typeof cn.next=="function"?cn.next():cn.next;(gt=(he?(Y==null?void 0:Y.querySelector(`[data-done-key="${CSS.escape(he)}"]`))??(Y==null?void 0:Y.querySelector(`[data-title-key="${CSS.escape(he)}"] a`)):null)??xe.current)==null||gt.focus()},[cn]);const os=()=>{var Y;A(""),C(""),E(null),H(Bl),K(!1),re(!1),(Y=xe.current)==null||Y.focus()},Ka=new Map(w.map(Y=>[Y.id,Y])),Za=new Map(_.map(Y=>[Y.id,Y])),Fn=new Map(Z.map(Y=>[Y.id,Y.title])),Qa=S&&O==="active",um=Z.some(Y=>Y.local_done),hm=Z.some(Y=>Y.local_action),bl=Qa||um||hm,yl=!x||_.length>0,fm=!P&&!$n,Ja=5+(yl?1:0)+(bl?1:0),mm=ie!==null&&(ie.reason==="store_locked"||ie.reason==="engine_failed")&&$<=b3,Gr=(ge==null?void 0:ge.holds)??[],Hr=q==null?void 0:q.groups,I=k3(Z,Hr,ve,(q==null?void 0:q.matched)===void 0?ae:[]),ue=Hr?Hr.length===0:Z.length===0,fe=(Y,he)=>ke(Qe=>({...Qe,[Y]:!he})),De=Y=>Ne(he=>he.includes(Y)?he.filter(Qe=>Qe!==Y):[...he,Y]),Ve=Gr.map(Y=>Y.id);return i.jsxs("div",{ref:ne,className:"contents",children:[i.jsx(_n,{title:"Tasks",description:s,actions:S?i.jsxs(U,{type:"button",onClick:()=>He(!0),children:[i.jsx(Pa,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]}):null}),x&&(q!=null&&q.open)?i.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:[q.open," open"]}):null,Ls?i.jsx("p",{className:"text-muted-foreground mt-1 text-xs",role:"status",children:ie?`Not reading · trying again every ${Math.round(Ls/1e3)}s`:q?`Live · refreshes every ${Math.round(Ls/1e3)}s`:"Connecting…"}):null,x?i.jsx("p",{className:"sr-only",role:"status",children:It}):null,(x||Gr.length>0)&&i.jsxs(wt,{as:"section","aria-labelledby":"waiting-title",className:"mt-4 p-4","data-testid":"tasks-waiting",children:[i.jsx("h2",{id:"waiting-title",className:"text-lg font-semibold",children:"Waiting on you"}),Gr.length>0?i.jsx("ul",{className:"mt-2 divide-y","aria-labelledby":"waiting-title",children:Gr.map((Y,he)=>{var Et,Ut;const Qe=Pc[Y.hold_type],gt=Y.target.kind==="task"?`Because you claim ${Fn.get(Y.target.task_id)??"the task it waits on"} · `:"",Vt=Y.local_done;return i.jsxs("li",{id:`waiting-${Y.id}`,"data-title-key":Y.id,className:"flex flex-wrap items-center gap-3 py-2",children:[Y.task?i.jsx(m,{className:"text-primary min-w-40 flex-1 hover:underline",href:f(`/org/${t}/tasks/${Y.task.id}`),children:Y.task.title}):i.jsx("span",{className:"min-w-40 flex-1",children:Y.reason}),i.jsx(be,{variant:Qe.tone,children:Y.local_label??Qe.label}),i.jsxs("div",{className:"min-w-48 flex-2",children:[Y.task?i.jsx("div",{className:"text-sm",children:Y.reason}):null,i.jsxs("div",{className:"text-muted-foreground text-xs",children:[gt,"From ",N(Y.opened_by)," · ",Ts(Y.opened_at)]}),(Et=Y.local_threads)!=null&&Et.length?i.jsxs("div",{className:"text-muted-foreground text-xs",children:["Answer it in"," ",i.jsx(m,{className:"text-primary hover:underline",href:f(`/org/${t}/threads`),children:"Threads"}),": ",Y.local_threads.join(" · ")]}):null,tt[Y.id]?i.jsx("div",{className:"text-destructive text-xs",role:"alert",children:tt[Y.id]}):null]}),Vt&&(o!=null&&o.complete)?i.jsx(U,{type:"button",variant:"outline",size:"sm","data-done-key":Y.id,"aria-label":`Mark ${((Ut=Y.task)==null?void 0:Ut.title)??Y.reason} done`,loading:en===Y.id,onClick:()=>{var At;return void ln(Y.id,((At=Y.task)==null?void 0:At.title)??Y.reason,Vt,Ve[he+1]??null)},children:"Done"}):null,x?null:i.jsx(U,{type:"button",variant:"outline",size:"sm",onClick:()=>void ht(Y.id),children:"Release"})]},Y.id)})}):ge?i.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"Nothing in this checkout waits on you."}):null,x&&Le?i.jsx("p",{className:"text-muted-foreground mt-2 text-sm",role:"status",children:Le.reason==="view_outdated"?`Waiting on you is not read here. ${W}`:"Waiting on you could not be read. It is read again with the list."}):null,i.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:x?"This checkout only. Teammates' agents are not listed here.":"Release a hold when you have done your part. Whoever can edit the task then resolves it."})]}),!S&&!a&&i.jsxs(me,{variant:"info",className:"mt-4",children:[i.jsx(gd,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"You can view these tasks"}),i.jsx(pe,{children:"Ask an organization admin for write access to change them."})]}),i.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-4",children:[(v==null?void 0:v.archived)!==!1?i.jsx(vI,{value:O,onValueChange:Y=>T(Y),children:i.jsxs(vD,{"aria-label":"Which tasks",children:[i.jsx(Vg,{value:"active",children:"Active"}),i.jsx(Vg,{value:"archived",children:"Archived"})]})}):null,(v==null?void 0:v.assigned_to_me)!==!1?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(rl,{id:"tasks-mine",checked:P,onCheckedChange:Y=>L(Y===!0)}),i.jsx(Ie,{htmlFor:"tasks-mine",children:"Assigned to me"})]}):null,v!=null&&v.search?i.jsx(yt,{ref:xe,type:"search",className:"w-64","aria-label":"Search tasks",placeholder:"Search title, ID or detail",value:G,onChange:Y=>A(Y.target.value)}):null,nt!=null&&nt.owners?i.jsx(T3,{owners:nt.owners,no_owner:nt.no_owner,value:M,on_change:H}):null]}),(tn=nt==null?void 0:nt.groups)!=null&&tn.length?i.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",role:"group","aria-label":"Status",children:[nt.groups.map(Y=>i.jsxs(U,{type:"button",variant:"outline",size:"sm",className:lc,"aria-pressed":R===Y.id,onClick:()=>E(he=>he===Y.id?null:Y.id),children:[Y.label," ",Y.count]},Y.id)),nt.marks?i.jsxs(i.Fragment,{children:[i.jsxs(U,{type:"button",variant:"outline",size:"sm",className:lc,"aria-pressed":z,onClick:()=>K(Y=>!Y),children:["Urgent ",nt.marks.urgent]}),i.jsxs(U,{type:"button",variant:"outline",size:"sm",className:lc,"aria-pressed":oe,onClick:()=>re(Y=>!Y),children:["Over estimate ",nt.marks.over_estimate]})]}):null]}):null,$n&&(q==null?void 0:q.matched)!==void 0&&q.total!==void 0?i.jsxs("p",{className:"text-muted-foreground mt-2 text-sm",children:[q.matched," of ",q.total," match ·"," ",i.jsx(U,{type:"button",variant:"link",size:"inline-sm",onClick:os,children:"Clear"})]}):null,mm?i.jsx("p",{className:"text-muted-foreground mt-4 text-sm",children:"Tasks are busy. Reading them again…"}):ie?i.jsx(ID,{refusal:ie,on_retry:()=>void V()}):null,!q&&!ie&&i.jsx(PD,{}),q&&ue&&$n?i.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[i.jsx(xf,{className:"text-muted-foreground size-8","aria-hidden":"true"}),i.jsx("h2",{className:"text-lg font-semibold",children:"No tasks match"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing open matches these filters."}),i.jsx(U,{type:"button",variant:"outline",onClick:os,children:"Clear filters"})]}):q&&ue&&O==="active"&&!P&&x?i.jsx("p",{className:"text-muted-foreground mt-6 text-sm",children:"No tasks recorded yet."}):q&&ue&&O==="active"&&!P?i.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[i.jsx(mf,{className:"text-muted-foreground size-8","aria-hidden":"true"}),i.jsx("h2",{className:"text-lg font-semibold",children:"No tasks yet"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Create the first task, or ask an agent to create one with the SDLC MCP tools."}),S&&i.jsxs(U,{type:"button",onClick:()=>He(!0),children:[i.jsx(Pa,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]})]}):q?i.jsxs(i.Fragment,{children:[i.jsx(wt,{className:"mt-4 shrink-0 overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Tasks",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Title"}),i.jsx(J,{children:"Status"}),yl?i.jsx(J,{className:"hidden md:table-cell",children:"Priority"}):null,i.jsx(J,{className:"hidden md:table-cell",children:"Primary"}),i.jsx(J,{className:"hidden md:table-cell",children:"Holds"}),i.jsx(J,{children:"Claimed by"}),bl?i.jsx(J,{className:"text-right",children:"Actions"}):null]})}),i.jsxs(at,{children:[I.map(Y=>{if(Y.kind==="group")return i.jsx(C3,{group:Y.group,open:Y.open,columns:Ja,on_toggle:()=>fe(Y.group.id,Y.open)},`group:${Y.group.id}`);if(Y.kind==="more")return i.jsx(D3,{group:Y.group,whole:ae.includes(Y.group.id),columns:Ja,on_toggle:()=>De(Y.group.id)},`more:${Y.group.id}`);const{row:he,index:Qe}=Y,gt=Ka.get(he.status_id),Vt=u3(he),Et=he.local_done;return i.jsx(A3,{columns:Ja,thread:{org:t,action:he.local_action,task_id:he.no_page?null:he.id,open_thread:o==null?void 0:o.open_thread},children:(Ut,At)=>{var qn,Zi;return i.jsxs(ye,{"data-testid":"tasks-row",className:At?"border-b-0":void 0,children:[i.jsxs(X,{"data-title-key":he.id,children:[he.no_page&&he.local_thread?i.jsxs(m,{className:"text-primary inline-flex items-center gap-1 hover:underline",href:f(ob(t,he.local_thread.key)),"aria-label":`${he.title}: open ${he.local_thread.title} in Threads`,children:[he.title,i.jsx(Rc,{className:"size-3.5 shrink-0","aria-hidden":"true"})]}):he.no_page?i.jsx("span",{children:he.title}):i.jsx(m,{className:"text-primary hover:underline",href:f(`/org/${t}/tasks/${he.id}`),children:he.title}),he.parent_task_id&&Fn.get(he.parent_task_id)?i.jsx("div",{className:"text-muted-foreground text-xs",children:Fn.get(he.parent_task_id)}):null,x?i.jsx(R3,{row:he}):null,tt[he.id]?i.jsx("div",{className:"text-destructive text-xs",role:"alert",children:tt[he.id]}):null]}),i.jsx(X,{children:gt?i.jsx(be,{variant:OD(gt),children:gt.name}):null}),yl?i.jsx(X,{className:"hidden md:table-cell",children:he.priority_id?((qn=Za.get(he.priority_id))==null?void 0:qn.name)??"":i.jsx("span",{className:"text-muted-foreground",children:"Not set"})}):null,i.jsx(X,{className:"hidden md:table-cell",children:he.owner_title?he.owner_title:he.primary_user_id?N(he.primary_user_id):i.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}),i.jsx(X,{className:"hidden md:table-cell",children:Vt?i.jsx(be,{variant:Vt.tone,children:Vt.label}):i.jsx("span",{className:"text-muted-foreground",children:"None"})}),i.jsx(X,{"data-testid":"tasks-claim",children:i.jsx(O3,{row:he,holder:N((Zi=he.claim)==null?void 0:Zi.user_id)})}),bl?i.jsx(X,{className:"text-right whitespace-nowrap",children:i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[Et&&"hold"in Et?i.jsx("a",{className:"text-primary text-sm hover:underline",href:`#waiting-${Et.hold}`,children:"In Waiting on you"}):Et&&(o!=null&&o.complete)?i.jsx(U,{type:"button",variant:"outline",size:"sm","data-done-key":he.id,"aria-label":`Mark ${he.title} done`,loading:en===he.id,onClick:()=>void ln(he.id,he.title,Et,()=>{var wl;return(((wl=Se.current)==null?void 0:wl.tasks)??[]).map(pm=>pm.id).filter(pm=>pm!==he.id)[Qe]??null}),children:"Done"}):null,Ut,Qa&&fm?i.jsxs(i.Fragment,{children:[i.jsx(U,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${he.title} up`,disabled:Qe===0,onClick:()=>void Xa(he,Qe,-1),children:i.jsx(dM,{className:"size-4","aria-hidden":"true"})}),i.jsx(U,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${he.title} down`,disabled:Qe===Z.length-1,onClick:()=>void Xa(he,Qe,1),children:i.jsx(oM,{className:"size-4","aria-hidden":"true"})})]}):null,Qa?i.jsxs(zf,{children:[i.jsx(Mf,{asChild:!0,children:i.jsx(U,{type:"button",variant:"outline",size:"icon","aria-label":`More actions for ${he.title}`,children:i.jsx(Cv,{className:"size-4","aria-hidden":"true"})})}),i.jsxs(jd,{align:"end",children:[ki&&he.status_id!==ki.id?i.jsx(qo,{onSelect:()=>Ir(he),children:"Complete"}):null,k?i.jsx(qo,{className:"text-destructive focus:text-destructive",onSelect:()=>void Oe(he),children:"Archive"}):null]})]}):null]})}):null]})}},he.id)}),ue&&i.jsx(ye,{children:i.jsx(X,{colSpan:Ja,className:"text-muted-foreground h-24 text-center",children:O==="archived"?"No archived tasks.":"No tasks are assigned to you."})})]})]})}),q.next_cursor?i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2 self-start",disabled:ee,onClick:async()=>{se(!0),await V(q.next_cursor??void 0),se(!1)},children:"Load more"}):null]}):null,S&&o&&i.jsx(x3,{open:_e,commands:o,list_id:g.id,list_revision:(q==null?void 0:q.list.revision)??g.revision,default_status_id:g.default_status_id,statuses:w,priorities:_,members:n,assignable:Dt,on_close:()=>He(!1),on_created:async()=>{He(!1),await Xe()}}),Mn]})}function N3(e,t){const n=Object.keys(e).filter(a=>e[a]),s=Object.keys(e).filter(a=>!e[a]);return{...n.length?{opened_groups:n}:{},...s.length?{closed_groups:s}:{},...t.length?{all_groups:t}:{}}}function k3(e,t,n,s){if(!t)return e.map((r,o)=>({kind:"row",row:r,index:o}));const a=[];for(const r of t){const o=n[r.id]??r.open;if(a.push({kind:"group",group:r,open:o}),!o||!r.open)continue;let l=0;e.forEach((c,d)=>{c.local_state===r.id&&(a.push({kind:"row",row:c,index:d}),l+=1)}),(r.hidden>0||s.includes(r.id)&&l>S3)&&a.push({kind:"more",group:r})}return a}const S3=10;function C3({group:e,open:t,columns:n,on_toggle:s}){const a=t?hf:pd;return i.jsx(ye,{"data-testid":"tasks-group",children:i.jsx(X,{colSpan:n,className:"p-1",children:i.jsxs(U,{type:"button",variant:"ghost",size:"sm",className:"w-full justify-start font-semibold","aria-expanded":t,onClick:s,children:[i.jsx(a,{className:"size-4","aria-hidden":"true"}),e.label," ",e.count]})})})}function D3({group:e,whole:t,columns:n,on_toggle:s}){return i.jsx(ye,{"data-testid":"tasks-group-more",children:i.jsx(X,{colSpan:n,children:i.jsx(U,{type:"button",variant:"link",size:"sm",className:"px-0","aria-expanded":t,onClick:s,children:t?"Show fewer":`Show all ${e.count}`})})})}const E3={you:"text-warning",ok:"text-info",waiting:"text-info",blocked:"text-warning",neutral:"text-muted-foreground",muted:"text-muted-foreground"};function A3({thread:e,columns:t,children:n}){const{button:s,panel:a}=Wf(e);return i.jsxs(i.Fragment,{children:[n(s,!!a),a?i.jsx(ye,{"data-testid":"tasks-row-panel",className:"hover:bg-transparent",children:i.jsx(X,{colSpan:t,className:"pt-0",children:i.jsx("div",{className:"max-w-180 pl-4 text-left whitespace-normal",children:a})})}):null]})}function R3({row:e}){var s;const t=e.local_after,n=e.local_detail;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"text-muted-foreground font-mono text-xs",children:[e.id,e.match?` · matched in ${e.match}`:""]}),t||n?i.jsxs("div",{className:"text-muted-foreground text-xs",children:[t,t&&n?" · ":"",n?i.jsx("span",{className:E3[e.local_tone??"muted"],children:n}):null]}):null,(s=e.local_marks)!=null&&s.length?i.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.local_marks.map(a=>i.jsx(be,{variant:a.tone??"neutral",children:a.label},a.label))}):null]})}function T3({owners:e,no_owner:t,value:n,on_change:s}){return i.jsxs(St,{value:n,onValueChange:s,children:[i.jsx(_t,{className:"w-56","aria-label":"Owner",children:i.jsx(Ct,{})}),i.jsxs(jt,{children:[i.jsx(Be,{value:Bl,children:"Any owner"}),e.map(a=>i.jsxs(Be,{value:a.id,children:[a.label," (",a.count,")"]},a.id)),t!==void 0?i.jsxs(Be,{value:LD,children:["No owner (",t,")"]}):null]})]})}function O3({row:e,holder:t}){const n=e.claim;if(!n)return i.jsx("span",{className:"text-muted-foreground",children:"Nobody"});if(n.lapsed){const s=new Date(n.lease_expires_at)<=new Date;return i.jsxs("div",{children:[i.jsxs("div",{className:"text-warning",children:["Lapsed · ",t]}),i.jsx("div",{className:"text-muted-foreground text-xs",children:s?`Ran out at ${Ys(n.lease_expires_at)}`:"Can no longer edit it"})]})}return i.jsxs("div",{className:"max-w-64",children:[i.jsxs("div",{children:[t,n.via?` · ${lb(n.via)}`:""]}),i.jsxs("div",{className:"text-muted-foreground truncate text-xs",title:n.via==="sdlc_login"&&n.via_device?TD(n.via_device):void 0,children:["Until ",Ys(n.lease_expires_at),n.via==="sdlc_login"&&n.via_device?i.jsxs(i.Fragment,{children:[" · ",i.jsx("bdi",{children:n.via_device})]}):null]})]})}const z3={waiting_for_user:{label:"Waiting for",help:"The member who must act. They see this hold under Waiting on you."},blocked:{label:"Blocked by",help:"The task that must finish first."},waiting_for_external:{label:"Waiting for",help:"Who or what outside the organization."},paused:null};function M3({open:e,members:t,tasks:n,holds_my_web_claim:s,on_close:a,on_submit:r}){const[o,l]=u.useState("waiting_for_user"),[c,d]=u.useState(""),[h,f]=u.useState(""),[m,p]=u.useState(!1),[y,g]=u.useState({}),[b,v]=u.useState(null),[x,w]=u.useState(!1);u.useEffect(()=>{e&&(l("waiting_for_user"),d(""),f(""),p(!1),g({}),v(null))},[e]);const _=z3[o],S=async k=>{k.preventDefault();const j={target:_!==null&&!c.trim(),reason:!h.trim()};if(g(j),j.target||j.reason)return;w(!0);const N={hold_type:o,reason:h.trim(),release_claim:m};o==="waiting_for_user"&&(N.target_user_id=c),o==="blocked"&&(N.target_task_id=c),o==="waiting_for_external"&&(N.target_label=c.trim());const O=await r(N);w(!1),v(O)};return i.jsx(jn,{open:e,onOpenChange:k=>k?null:a(),children:i.jsx(Nn,{children:i.jsxs("form",{onSubmit:k=>void S(k),noValidate:!0,children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:"Add hold"}),i.jsx(Dn,{children:"Say what this task is waiting for."})]}),i.jsxs("div",{className:"mt-4 grid gap-4",children:[b&&i.jsxs(me,{variant:"destructive",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(pe,{children:b})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"hold-type",children:"Type"}),i.jsxs(St,{value:o,onValueChange:k=>{l(k),d(""),g({})},children:[i.jsx(_t,{id:"hold-type",children:i.jsx(Ct,{})}),i.jsx(jt,{children:Object.keys(Pc).map(k=>i.jsx(Be,{value:k,children:Pc[k].label},k))})]})]}),_?i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"hold-target",children:_.label}),o==="waiting_for_external"?i.jsx(yt,{id:"hold-target",value:c,"aria-invalid":y.target,onChange:k=>d(k.target.value)}):i.jsxs(St,{value:c,onValueChange:d,children:[i.jsx(_t,{id:"hold-target","aria-invalid":y.target,children:i.jsx(Ct,{placeholder:o==="blocked"?"Choose a task":"Choose a member"})}),i.jsx(jt,{children:o==="blocked"?n.map(k=>i.jsx(Be,{value:k.id,children:k.title},k.id)):t.map(k=>i.jsx(Be,{value:k.user_id,disabled:k.disabled,children:k.text},k.user_id))})]}),i.jsx("p",{className:y.target?"text-destructive text-xs":"text-muted-foreground text-xs",children:y.target?"Choose what it waits for.":_.help}),o!=="blocked"&&o!=="waiting_for_external"&&t.some(k=>k.disabled)&&i.jsx("p",{id:"hold-target-hint",className:"text-muted-foreground text-xs",children:p3})]}):i.jsx("p",{className:"text-muted-foreground text-xs",children:"You resume it yourself."}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"hold-reason",children:"Reason"}),i.jsx(Vn,{id:"hold-reason",rows:3,placeholder:"What the task is waiting for",value:h,"aria-invalid":y.reason,onChange:k=>f(k.target.value)}),y.reason&&i.jsx("p",{className:"text-destructive text-xs",children:"Give a reason."})]}),s&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(rl,{id:"hold-release-claim",checked:m,onCheckedChange:k=>p(k===!0)}),i.jsx(Ie,{htmlFor:"hold-release-claim",children:"Also release my claim"})]})]}),i.jsxs(Sn,{className:"mt-6",children:[i.jsx(U,{type:"button",variant:"outline",onClick:a,children:"Cancel"}),i.jsx(U,{type:"submit",disabled:x,children:x?"Adding…":"Add hold"})]})]})})})}function Cd(){const e=Wn().tasks;if(!e)throw new Error("The Task page rendered without the tasks seam.");return e}function ub(){return i.jsxs("div",{className:"grid gap-3",role:"status","aria-label":"Loading task",children:[i.jsx(Tt,{className:"h-8 w-1/2"}),Array.from({length:7},(e,t)=>i.jsx(Tt,{className:t===6?"h-6 w-2/3":"h-6 w-full"},t))]})}function Dh({back:e,description:t}){const{href:n,Link:s}=lt();return i.jsx(Ua,{title:"Task not found",description:t??"It may have been removed, or you may not have access to it.",backHref:n(e),backLabel:"Back to tasks",link:s})}const Yr="not_set",$3=10*60*1e3,s_=20;function L3(){const{members:e}=Cd(),[t,n]=u.useState([]);u.useEffect(()=>{let r=!0;return e().then(o=>{r&&o.ok&&n(o.data)}),()=>{r=!1}},[e]);const s=u.useMemo(()=>new Map(t.map(r=>[r.user_id,r])),[t]),a=u.useCallback((r,o)=>{var l;return r?r===o?"You":((l=s.get(r))==null?void 0:l.label)??"A member":""},[s]);return{members:t,name:a}}function P3({active:e,task_id:t,back:n}){const s=Cd(),{task:a,activity:r,listTasks:o,hierarchyRevision:l,commands:c}=s,{href:d,Link:h}=lt(),f=Fa(),{self_id:m}=Uf(),{members:p,name:y}=L3(),{workspace:g}=e,{confirm:b,confirm_dialog:v}=al(),[x,w]=u.useState(null),[_,S]=u.useState(!1),[k,j]=u.useState(!1),[N,O]=u.useState(null),[T,P]=u.useState([]),[L,G]=u.useState(s_),[A,D]=u.useState([]),[C,R]=u.useState(!1),[E,M]=u.useState(null),[H,z]=u.useState(null),[K,oe]=u.useState(""),[re,ve]=u.useState(null),ke=u.useCallback(async()=>{if(!a)return;const V=await a(t);V.ok?(w(V.data),j(!1)):V.refusal.status===404||V.refusal.status===400?S(!0):j(!0)},[a,t]),ae=u.useRef(0),Ne=u.useCallback(async()=>{if(!r)return;const V=ae.current+=1;let $e=[],Xe;for(;;){const Mt=await r(t,Xe);if(V!==ae.current||!Mt.ok)return;if($e=[...$e,...Mt.data.events].slice(-1e3),!Mt.data.more||!Mt.data.next_cursor)break;Xe=Mt.data.next_cursor}V===ae.current&&P($e.reverse())},[r,t]);u.useEffect(()=>{ke(),Ne()},[ke,Ne]);const q=x?g.lists.find(V=>V.id===x.task.list_id):void 0,B=u.useMemo(()=>{var V;return((V=g.workflows.find($e=>$e.id===(x==null?void 0:x.task.workflow_id)))==null?void 0:V.statuses)??[]},[g,x==null?void 0:x.task.workflow_id]),Z=MD(s.assignees,x==null?void 0:x.task.list_id,t,x!==null&&cc(x.permission,"write")),Q=$D(p,Z,m3);u.useEffect(()=>{if(!x)return;let V=!0;return o(x.task.list_id,{limit:100}).then($e=>{V&&D($e.ok?$e.data.tasks.filter(Xe=>Xe.id!==x.task.id).map(Xe=>({id:Xe.id,title:Xe.title})):[])}),()=>{V=!1}},[o,x==null?void 0:x.task.list_id,x==null?void 0:x.task.id,x]);const ie=u.useCallback(async()=>{await Promise.all([ke(),Ne()])},[ke,Ne]),ce=u.useCallback((V,$e)=>c?c.run(V,$e):Promise.resolve({ok:!1,refusal:{status:0,message:"This page cannot change tasks."}}),[c]),$=u.useCallback(async(V,$e,Xe)=>{const Mt=await ce(V,$e);return Mt.ok?(Xe&&f.success(Xe),await ie(),Mt.data):(Mt.refusal.code==="revision_conflict"?O({tone:"warning",title:"This task changed while you were editing",body:"We reloaded it. Check the change, then save again."}):Mt.refusal.code==="claim_held"?(await ke(),O({tone:"destructive",title:"Someone else claimed this task first",body:"Their claim is shown below. You can take it over if it lapses."})):f.error(Mt.refusal.message),await ie(),null)},[ce,f,ie,ke]),F=(x==null?void 0:x.claim)??null,ee=F!==null&&F.id===re&&!F.lapsed&&!F.via?F.id:null;if(u.useEffect(()=>{if(!ee)return;const V=window.setInterval(()=>{ce("renew_claim",{claim_id:ee,lease_seconds:n_}).then(()=>ke())},$3);return()=>window.clearInterval(V)},[ee,ce,ke]),_)return i.jsx(Dh,{back:n});if(k&&!x)return i.jsxs(me,{variant:"destructive",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"This task could not be loaded"}),i.jsxs(pe,{children:[i.jsx("p",{children:"Check your connection and try again."}),i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void ke(),children:"Retry"})]})]});if(!x)return i.jsx(ub,{});const{task:se}=x,ge=se.archived_at!==null,de=cc(x.permission,"write")&&!ge,Le=cc(x.permission,"manage"),Ee=B.find(V=>V.id===se.status_id),W=B.find(V=>V.category==="completed"),_e=g.priorities.find(V=>V.id===se.priority_id),He=x.contributors.map(V=>V.user_id),Dt=F!==null&&F.user_id===m,en=F!==null&&!F.lapsed,zt=x.checklist.filter(V=>V.is_complete).length,tt=async()=>{const[V,$e]=await Promise.all([o(se.list_id,{limit:1}),l(g.id)]);return V.ok?$e.ok?{ok:!0,data:{task_id:se.id,expected_revision:se.revision,expected_order_revision:V.data.list.order_revision,expected_hierarchy_revision:$e.data}}:$e:V},ft=(V,$e)=>$("update_task",{task_id:se.id,expected_revision:se.revision,changes:V},$e),It=V=>b(V.via==="sdlc_login"?{title:"Release this claim?",description:`You claimed it via ${cp(V.via,V.via_device)}. Its next renewal will be refused, and it will stop holding the task.`,action_label:"Release claim",destructive:!0}:{title:"Release your agent's claim?",description:"Your agent is still working on this task. Its next renewal will be refused, and it will stop holding the task.",action_label:"Release claim",destructive:!0}),zn=async()=>{if(!W)return;if(en&&(!Dt||F.via)){const $e=F.via==="api_key"?`${Dt?"Your":`${y(F.user_id)}'s`} agent is still working on it.`:F.via==="sdlc_login"?`${Dt?"You are":`${y(F.user_id)} is`} still working on it via ${cp(F.via,F.via_device)}.`:`${y(F.user_id)} is still working on it.`;if(!await b({title:"Complete this task?",description:$e,action_label:"Mark complete"}))return}await ft({status_id:W.id},"Task completed.")!==null&&F&&Dt&&en&&await $("end_claim",{claim_id:F.id,outcome:"completed"})},gn=async(V,$e)=>{const Xe=await tt();if(!Xe.ok){f.error(Xe.refusal.message);return}await $(V,Xe.data,$e)},Mn=async()=>{await b({title:"Archive this task?",description:"It leaves the queue and becomes read-only. Its claim, holds and history stay, and a manager can restore it.",action_label:"Archive task",destructive:!0})&&await gn("archive_task","Task archived.")},xe=async()=>{await gn("restore_task","Task restored.")},ne=async()=>{var Mt;const V=F,$e=await $("claim_task",{task_id:se.id,lease_seconds:n_}),Xe=(Mt=$e==null?void 0:$e.claim)==null?void 0:Mt.id;Xe&&!(V&&V.id===Xe&&V.via)&&ve(Xe)},Se=async()=>{F&&(F.via&&!await It(F)||(await $("end_claim",{claim_id:F.id,outcome:"released"},"Claim released."),ve(null)))},Ye=async()=>{F&&await $("end_claim",{claim_id:F.id,outcome:"expired"},"Claim cleared.")},nt=async V=>{V.hold_type==="paused"&&m&&(V={...V,target_user_id:m});const $e=await ce("open_hold",{task_id:se.id,hold_type:V.hold_type,reason:V.reason,...V.target_user_id?{target_user_id:V.target_user_id}:{},...V.target_task_id?{target_task_id:V.target_task_id}:{},...V.target_label?{target_label:V.target_label}:{}});return $e.ok?(R(!1),f.success("Hold added."),V.release_claim&&F&&Dt&&!F.via&&(await $("end_claim",{claim_id:F.id,outcome:"released"}),ve(null)),await ie(),null):$e.refusal.message},as=V=>$("checklist",{task_id:se.id,expected_revision:se.revision,...V}),$n=async V=>{for(const $e of V.filter(Xe=>!He.includes(Xe)))await $("set_contributor",{task_id:se.id,expected_revision:se.revision,user_id:$e,action:"add"});for(const $e of x.contributors.filter(Xe=>!V.includes(Xe.user_id)))await $("set_contributor",{task_id:se.id,expected_revision:se.revision,user_id:$e.user_id,action:"remove",expected_contributor_revision:$e.revision})},rs=V=>{var Xe;if(V.target.kind==="user")return y(V.target.user_id,m);if(V.target.kind==="external")return V.target.label;if(V.target.hidden||!V.target.task_id)return"A task you cannot see";const $e=V.target.task_id;return i.jsx(h,{className:"text-primary hover:underline",href:d(`${n}/${$e}`),children:((Xe=A.find(Mt=>Mt.id===$e))==null?void 0:Xe.title)??"Another task"})},Zs=V=>V.target.kind==="user"&&V.target.user_id===m&&!V.released_at?i.jsx(U,{type:"button",variant:"outline",size:"sm",onClick:()=>void $("release_hold",{hold_id:V.id},"Hold released."),children:"Release"}):de?i.jsx(U,{type:"button",variant:"outline",size:"sm",onClick:()=>void $("resolve_hold",{hold_id:V.id},"Hold resolved."),children:"Resolve"}):null;return i.jsxs(i.Fragment,{children:[i.jsx(_n,{title:se.title,description:`Created ${Ts(se.created_at)} by ${y(se.created_by,m)}`,actions:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[de&&i.jsxs(i.Fragment,{children:[i.jsxs(U,{type:"button",variant:"outline",onClick:()=>M(se.title),children:[i.jsx(gf,{className:"mr-2 size-4","aria-hidden":"true"}),"Edit title"]}),W&&se.status_id!==W.id&&i.jsxs(U,{type:"button",variant:"outline",onClick:()=>void zn(),children:[i.jsx(Or,{className:"mr-2 size-4","aria-hidden":"true"}),"Mark complete"]})]}),Le&&!ge&&i.jsxs(U,{type:"button",variant:"outline",onClick:()=>void Mn(),children:[i.jsx(Iw,{className:"mr-2 size-4","aria-hidden":"true"}),"Archive"]})]}),children:E!==null?i.jsxs("form",{className:"flex flex-wrap items-center gap-2 pt-1",onSubmit:async V=>{V.preventDefault(),E.trim()&&await ft({title:E.trim()})!==null&&M(null)},children:[i.jsx(Ie,{htmlFor:"task-title",className:"sr-only",children:"Title"}),i.jsx(yt,{id:"task-title",className:"max-w-xl",value:E,onChange:V=>M(V.target.value)}),i.jsx(U,{type:"submit",size:"sm",children:"Save"}),i.jsx(U,{type:"button",size:"sm",variant:"outline",onClick:()=>M(null),children:"Cancel"})]}):null}),N&&i.jsxs(me,{variant:N.tone,className:"mt-4","data-testid":"task-notice",children:[N.tone==="warning"?i.jsx(zr,{className:"size-4","aria-hidden":"true"}):i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:N.title}),i.jsx(pe,{children:N.body})]}),ge?i.jsxs(me,{variant:"info",className:"mt-4",children:[i.jsx(Iw,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"This task is archived"}),i.jsx(pe,{children:Le?i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"It is out of the queue and cannot be claimed. Restore it to work on it again."}),i.jsxs(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void xe(),children:[i.jsx(iM,{className:"mr-2 size-4","aria-hidden":"true"}),"Restore"]})]}):i.jsx("p",{children:"It is out of the queue and cannot be claimed. A manager can restore it."})})]}):de?null:i.jsxs(me,{variant:"info",className:"mt-4",children:[i.jsx(gd,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"You can view this task"}),i.jsx(pe,{children:"Ask an organization admin for write access to change it."})]}),de?i.jsxs("div",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"task-status",children:"Status"}),i.jsxs(St,{value:se.status_id,onValueChange:V=>void ft({status_id:V}),children:[i.jsx(_t,{id:"task-status",children:i.jsx(Ct,{})}),i.jsx(jt,{children:B.map(V=>i.jsx(Be,{value:V.id,children:V.name},V.id))})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"task-priority",children:"Priority"}),i.jsxs(St,{value:se.priority_id??Yr,onValueChange:V=>void ft({priority_id:V===Yr?null:V}),children:[i.jsx(_t,{id:"task-priority",children:i.jsx(Ct,{})}),i.jsxs(jt,{children:[i.jsx(Be,{value:Yr,children:"Not set"}),g.priorities.map(V=>i.jsx(Be,{value:V.id,children:V.name},V.id))]})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"task-primary",children:"Primary"}),i.jsxs(St,{value:se.primary_user_id??Yr,onValueChange:V=>void ft({primary_user_id:V===Yr?null:V}),children:[i.jsx(_t,{id:"task-primary",children:i.jsx(Ct,{})}),i.jsxs(jt,{children:[i.jsx(Be,{value:Yr,children:"Not set"}),Q.map(V=>i.jsx(Be,{value:V.user_id,disabled:V.disabled,children:V.text},V.user_id))]})]})]}),i.jsx(I3,{members:Q,selected:He,on_change:V=>void $n(V)})]}):i.jsxs("dl",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(eu,{label:"Status",value:(Ee==null?void 0:Ee.name)??""}),i.jsx(eu,{label:"Priority",value:(_e==null?void 0:_e.name)??"Not set"}),i.jsx(eu,{label:"Primary",value:se.primary_user_id?y(se.primary_user_id,m):"Not set"}),i.jsx(eu,{label:"Contributors",value:He.map(V=>y(V,m)).join(", ")||"None"})]}),!ge&&i.jsx(G3,{claim:F,mine:Dt,holder:F?y(F.user_id):"",own:F!==null&&F.id===re,can_write:de,on_claim:()=>void ne(),on_release:()=>void Se(),on_clear:()=>void Ye()}),i.jsxs("section",{className:"mt-6","aria-labelledby":"task-description-title",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("h2",{id:"task-description-title",className:"text-lg font-semibold",children:"Description"}),de&&H===null&&i.jsx(U,{type:"button",variant:"ghost",size:"sm",onClick:()=>z(se.description??""),children:"Edit description"})]}),H!==null?i.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async V=>{V.preventDefault(),await ft({description:H})!==null&&z(null)},children:[i.jsx(Ie,{htmlFor:"task-description",className:"sr-only",children:"Description"}),i.jsx(Vn,{id:"task-description",rows:5,value:H,onChange:V=>z(V.target.value)}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(U,{type:"submit",size:"sm",children:"Save"}),i.jsx(U,{type:"button",size:"sm",variant:"outline",onClick:()=>z(null),children:"Cancel"})]})]}):i.jsx("p",{className:"mt-2 text-sm whitespace-pre-wrap",children:se.description||i.jsx("span",{className:"text-muted-foreground",children:"No description."})})]}),i.jsxs("section",{className:"mt-6","aria-labelledby":"task-checklist-title",children:[i.jsxs("h2",{id:"task-checklist-title",className:"text-lg font-semibold",children:["Checklist",x.checklist.length>0?` · ${zt} of ${x.checklist.length} done`:""]}),i.jsx("ul",{className:"mt-2 grid gap-1",children:x.checklist.map(V=>i.jsxs("li",{className:"flex items-center justify-between gap-2 py-1","data-testid":"task-checklist-item",children:[de?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(rl,{id:`check-${V.id}`,checked:V.is_complete,onCheckedChange:$e=>void as({action:"toggle",item_id:V.id,expected_item_revision:V.revision,is_complete:$e===!0})}),i.jsx(Ie,{htmlFor:`check-${V.id}`,className:"font-normal",children:V.label})]}):i.jsxs("span",{className:"text-sm",children:[V.is_complete?"Done: ":"To do: ",V.label]}),de&&i.jsxs(zf,{children:[i.jsx(Mf,{asChild:!0,children:i.jsx(U,{type:"button",variant:"ghost",size:"icon","aria-label":`Item actions for ${V.label}`,children:i.jsx(Cv,{className:"size-4","aria-hidden":"true"})})}),i.jsx(jd,{align:"end",children:i.jsx(qo,{className:"text-destructive focus:text-destructive",onSelect:()=>void as({action:"archive",item_id:V.id,expected_item_revision:V.revision}),children:"Remove"})})]})]},V.id))}),x.checklist.length===0&&!de&&i.jsx("p",{className:"text-muted-foreground text-sm",children:"No checklist items."}),de&&i.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async V=>{V.preventDefault(),K.trim()&&await as({action:"add",label:K.trim()})!==null&&oe("")},children:[i.jsx(Ie,{htmlFor:"task-new-item",children:"Add an item"}),i.jsx(yt,{id:"task-new-item",placeholder:"Add an item and press Enter",value:K,onChange:V=>oe(V.target.value)})]})]}),i.jsxs("section",{className:"mt-6","aria-labelledby":"task-holds-title",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("h2",{id:"task-holds-title",className:"text-lg font-semibold",children:"Holds"}),de&&i.jsxs(U,{type:"button",variant:"outline",size:"sm",onClick:()=>R(!0),children:[i.jsx(PS,{className:"mr-2 size-4","aria-hidden":"true"}),"Add hold"]})]}),i.jsx("div",{className:"mt-2 shrink-0 overflow-x-auto rounded-lg border",children:i.jsxs(it,{containerAriaLabel:"Holds",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Type"}),i.jsx(J,{children:"Reason"}),i.jsx(J,{children:"Waiting on"}),i.jsx(J,{className:"text-right",children:"Actions"})]})}),i.jsxs(at,{children:[x.holds.map(V=>{const $e=Pc[V.hold_type];return i.jsxs(ye,{"data-testid":"task-hold",children:[i.jsx(X,{children:i.jsx(be,{variant:$e.tone,children:$e.label})}),i.jsxs(X,{children:[i.jsx("div",{children:V.reason}),i.jsx("div",{className:"text-muted-foreground text-xs",children:V.released_at?`Released by ${y(V.released_by,m)} · ${Ts(V.released_at)} · Ready to resolve`:`Opened by ${y(V.opened_by,m)} · ${Ts(V.opened_at)} · Open`})]}),i.jsx(X,{children:rs(V)}),i.jsx(X,{className:"text-right",children:Zs(V)})]},V.id)}),x.holds.length===0&&i.jsx(ye,{children:i.jsx(X,{colSpan:4,className:"text-muted-foreground h-16 text-center",children:"Nothing is holding this task."})})]})]})}),i.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"A hold does not change the task's status. The person it waits on releases it; whoever can edit the task resolves it."})]}),i.jsxs("section",{className:"mt-6 pb-8","aria-labelledby":"task-activity-title",children:[i.jsx("h2",{id:"task-activity-title",className:"text-lg font-semibold",children:"Activity"}),i.jsxs("ul",{className:"mt-2 divide-y rounded-lg border",children:[T.slice(0,L).map(V=>i.jsxs("li",{className:"grid grid-cols-[1fr_auto] gap-x-4 px-3 py-2 text-sm sm:grid-cols-[2fr_1fr_10rem]","data-testid":"task-activity",children:[i.jsx("span",{children:h3(V)}),i.jsxs("span",{className:"min-w-0 text-right sm:text-left",children:[i.jsx("span",{children:V.actor_id?y(V.actor_id,m):"The system"}),V.via?i.jsxs("span",{className:"text-muted-foreground block max-w-64 truncate text-xs sm:max-w-none",title:`via ${cp(V.via,V.via_device)}`,children:["via ",lb(V.via),i.jsx(GD,{via:V.via,device:V.via_device})]}):null]}),i.jsx("span",{className:"text-muted-foreground col-span-2 sm:col-span-1 sm:text-right",children:zD(V.created_at)})]},V.id)),T.length===0&&i.jsx("li",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No activity yet."})]}),T.length>L&&i.jsx(U,{type:"button",variant:"ghost",size:"sm",className:"mt-2",onClick:()=>G(V=>V+s_),children:"Load more"})]}),de&&q&&i.jsx(M3,{open:C,members:Q,tasks:A,holds_my_web_claim:Dt&&en&&!(F!=null&&F.via),on_close:()=>R(!1),on_submit:nt}),v]})}function eu({label:e,value:t}){return i.jsxs("div",{className:"grid gap-1",children:[i.jsx("dt",{className:"text-muted-foreground text-xs",children:e}),i.jsx("dd",{className:"text-sm",children:t})]})}function I3({members:e,selected:t,on_change:n}){return i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"task-contributors",children:"Contributors"}),i.jsxs(zf,{children:[i.jsx(Mf,{asChild:!0,children:i.jsxs(U,{id:"task-contributors",type:"button",variant:"outline",className:"justify-between font-normal",children:[t.length===0?i.jsx("span",{className:"text-muted-foreground",children:"Add a contributor"}):i.jsx("span",{className:"truncate",children:e.filter(s=>t.includes(s.user_id)).map(s=>s.label).join(", ")}),i.jsx(RS,{className:"text-muted-foreground size-4","aria-hidden":"true"})]})}),i.jsx(jd,{align:"start",children:e.map(s=>{const a=t.includes(s.user_id);return i.jsxs(qo,{disabled:s.disabled&&!a,onSelect:()=>n(a?t.filter(r=>r!==s.user_id):[...t,s.user_id]),children:[a?i.jsx(Or,{className:"mr-2 size-4","aria-hidden":"true"}):i.jsx("span",{className:"mr-2 size-4"}),s.text]},s.user_id)})})]})]})}function GD({via:e,device:t}){return e!=="sdlc_login"||!t?null:i.jsxs(i.Fragment,{children:[" on ",i.jsx("bdi",{children:t})]})}function G3({claim:e,mine:t,holder:n,own:s,can_write:a,on_claim:r,on_release:o,on_clear:l}){let c=i.jsx(Av,{className:"size-4","aria-hidden":"true"}),d="Nobody is working on this",h=a?"Claim it to show others you are.":"",f=a?i.jsx(U,{type:"button",size:"sm",onClick:r,children:"Claim"}):null;if(e&&e.lapsed){const m=new Date(e.lease_expires_at)<=new Date;c=i.jsx(TS,{className:"size-4","aria-hidden":"true"}),d=m?`${t?"Your":`${n}'s`} claim lapsed at ${Ys(e.lease_expires_at)}`:`${t?"Your":`${n}'s`} claim lapsed`,h=m?"Its time ran out.":`${n} can no longer edit this task.`,a&&(h+=" Take it over to work on it yourself, or clear it so anyone can claim it."),f=a?i.jsxs(i.Fragment,{children:[i.jsx(U,{type:"button",size:"sm",variant:"outline",onClick:l,children:"Clear claim"}),i.jsx(U,{type:"button",size:"sm",onClick:r,children:"Take over"})]}):null}else if(e){const m=Ys(e.lease_expires_at);c=e.via==="api_key"?i.jsx(kv,{className:"size-4","aria-hidden":"true"}):e.via==="sdlc_login"?i.jsx(KM,{className:"size-4","aria-hidden":"true"}):i.jsx(z$,{className:"size-4","aria-hidden":"true"});const p=i.jsxs(i.Fragment,{children:["Claimed via sdlc login",i.jsx(GD,{via:e.via,device:e.via_device}),"."]});t&&e.via==="api_key"?(d=`Your agent is working on this until ${m}`,h="Claimed through one of your API keys. This page does not renew it. Releasing it, or Mark complete, ends the agent's claim after asking."):t&&e.via==="sdlc_login"?(d=`You are working on this until ${m}`,h=i.jsxs(i.Fragment,{children:[p," This page does not renew it. Releasing it, or Mark complete, ends that claim after asking."]})):e.via==="sdlc_login"?(d=`${n} is working on this until ${m}`,h=p):t?(d=`You are working on this until ${m}`,h=s?"Claimed on the web, and renewed while this page is open. Marking the task complete ends your claim.":"Claimed on the web. Marking the task complete ends your claim."):e.via==="api_key"?(d=`${n}'s agent is working on this until ${m}`,h="Claimed through an API key."):(d=`${n} is working on this until ${m}`,h=a?"Claimed on the web. You can take it over if the claim lapses.":"Claimed on the web."),f=t?i.jsx(U,{type:"button",size:"sm",variant:"outline",onClick:o,children:"Release claim"}):null}return i.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3 rounded-lg border p-3","data-testid":"task-claim",children:[c,i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"text-sm font-medium",children:d}),h?i.jsx("div",{className:"text-muted-foreground text-xs break-words",children:h}):null]}),f?i.jsx("div",{className:"flex items-center gap-2",children:f}):null]})}function hb(e){const t=u.useRef(null),n=u.useRef(!1),[s,a]=u.useState(0),r=u.useCallback(o=>{var l;!o&&((l=t.current)!=null&&l.contains(document.activeElement))&&(n.current=!0,a(c=>c+1)),t.current=o},[]);return u.useEffect(()=>{var c;if(!n.current)return;n.current=!1;const o=document.activeElement;if(o&&o!==document.body)return;const l=(c=e.current)==null?void 0:c.querySelector("h1");l&&(l.tabIndex=-1,l.focus())},[s,e]),r}function HD(){const e=u.useRef(null);return u.useCallback(t=>{const n=e.current;if(e.current=t,t||!(n!=null&&n.contains(document.activeElement)))return;const s=(n.closest("main")??document).querySelector("h1");s&&Promise.resolve().then(()=>{const a=document.activeElement;a&&a!==document.body||!s.isConnected||(s.tabIndex=-1,s.focus())})},[])}const H3=10,VD=5,V3=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,UD="Not available",U3={added:"Added",changed:"Changed",removed:"Removed"},B3={thread:"Thread",task:"Task",issue:"Issue",release:"Release",test:"Test"},i_=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;function W3(e,t){const n=t!=null&&t.startsWith("task:")?t.slice(5):null;if(n&&V3.test(n))return{label:n,path:`/org/${e}/tasks/${n}`};const s=t!=null&&t.startsWith("issue:")?t.slice(6):null;if(s&&/^iss-\d{1,9}$/.test(s))return{label:s,path:`/org/${e}/issues/${s}`};const a=t!=null&&t.startsWith("release:")?t.slice(8):null;if(a&&i_.test(a))return{label:a==="candidate"?"Candidate":`Release ${a}`,path:`/releases?release=${a}`};const r=t!=null&&t.startsWith("planned:")?t.slice(8):null;return r&&i_.test(r)?{label:`Planned Release ${r}`,path:`/releases?planned=${r}`}:{label:"Tasks",path:`/org/${e}/tasks`}}const BD=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function F3({org:e,task_id:t,from:n}){var gn,Mn;const s=Cd(),{href:a,Link:r}=lt(),{confirm:o,confirm_dialog:l}=al(),c=W3(e,n),[d,h]=u.useState({state:"loading"}),[f,m]=u.useState([]),[p,y]=u.useState([]),[g,b]=u.useState(null),[v,x]=u.useState(null),[w,_]=u.useState({state:"loading"}),[S,k]=u.useState({state:"loading"}),[j,N]=u.useState(null),[O,T]=u.useState(null),[P,L]=u.useState(!1),G=u.useRef(null),A=is(),D=Wf({org:e,action:d.state==="ok"?d.detail.local_action:void 0,task_id:t,open_thread:(gn=s.commands)==null?void 0:gn.open_thread,labelled:!0}),C=u.useRef(null),R=u.useRef(null),E=u.useRef(null),M=u.useRef(null),H=u.useRef(!1),z=u.useRef(0),K=u.useRef(0),oe=u.useCallback(async()=>{if(!s.taskSections)return;_({state:"loading"});const xe=await s.taskSections(t);_(xe.ok?{state:"ok",data:xe.data}:{state:"failed",refusal:xe.refusal})},[s.taskSections,t]),re=u.useCallback(async()=>{if(!s.taskRelated)return;k({state:"loading"});const xe=await s.taskRelated(t);k(xe.ok?{state:"ok",data:xe.data}:{state:"failed",refusal:xe.refusal})},[s.taskRelated,t]),ve=u.useCallback(async()=>{var nt,as;const xe=K.current+=1;x(null),oe(),re();const[ne,Se]=await Promise.all([s.availability(),s.task?s.task(t):Promise.resolve(null)]);if(xe!==K.current)return;ne.state==="active"&&m(((nt=ne.workspace.workflows.find($n=>$n.id===ne.list.workflow_id))==null?void 0:nt.statuses)??[]);const Ye=ne.state==="off"&&((as=ne.refusal)==null?void 0:as.reason)==="engine_missing"?ne.refusal:null;if(!Se||!Se.ok&&Se.refusal.reason==="engine_missing"||Ye){h({state:"engine_missing",refusal:Ye??(Se&&!Se.ok?Se.refusal:{status:0,message:""})});return}if(Se.ok){z.current=0,b(null),T(null),h({state:"ok",detail:Se.data,at:new Date().toISOString()});return}if(Se.refusal.status===404||Se.refusal.reason==="not_found"){h({state:"missing"});return}if(z.current+=1,z.current===1&&BD(Se.refusal)){x(Se.refusal.retry_after??H3);return}b(Se.refusal),h($n=>$n.state==="loading"?{state:"loading"}:$n)},[s,t,oe,re]);u.useEffect(()=>{ve()},[ve]),u.useEffect(()=>{if(v===null)return;const xe=setTimeout(()=>void ve(),v*1e3);return()=>clearTimeout(xe)},[v,ve]),u.useEffect(()=>{let xe=!0;return s.members().then(ne=>{xe&&ne.ok&&y(ne.data)}),()=>{xe=!1}},[s.members]),u.useEffect(()=>{var ne;if(H.current||d.state!=="ok")return;H.current=!0;const xe=(ne=G.current)==null?void 0:ne.querySelector("h1");xe&&(xe.tabIndex=-1,xe.focus())},[d.state]),u.useEffect(()=>{var xe;j&&((xe=R.current)==null||xe.focus())},[j]),u.useEffect(()=>{if(O===null)return;const xe=setTimeout(()=>{var ne;return(ne=C.current)==null?void 0:ne.focus()},0);return()=>clearTimeout(xe)},[O]);const ke=u.useMemo(()=>new Map(p.map(xe=>[xe.user_id,xe.label])),[p]),ae=xe=>xe?ke.get(xe)??xe:"",Ne=()=>{N(null),ve()},q=u.useRef(null),B=xe=>(q.current=xe,xe==="graph"?oe():re());if(u.useEffect(()=>{var Se;const xe=q.current;if(xe===null||(xe==="graph"?w:S).state==="loading")return;q.current=null;const ne=(xe==="graph"?E:M).current??((Se=G.current)==null?void 0:Se.querySelector("h1"));ne==null||ne.focus()},[w,S]),d.state==="missing")return i.jsx(xa,{children:i.jsx(Dh,{back:`/org/${e}/tasks`,description:`No task ${t} in this checkout. It may have finished and been archived, or never been recorded.`})});const Z=i.jsx(U,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:i.jsxs(r,{href:a(c.path),children:[i.jsx(AS,{className:"size-4","aria-hidden":"true"}),c.label]})});if(d.state==="engine_missing")return i.jsx(xa,{children:i.jsx("div",{ref:G,className:"contents",children:i.jsx(ji,{page:"Task",header:i.jsx(dc,{back:Z,id:null,title:t})})})});const Q=g?i.jsxs(me,{variant:"destructive",className:"mt-4",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Could not read this task"}),i.jsxs(pe,{children:[i.jsxs("p",{children:[g.message,g.since?` Since ${Rs(g.since)}.`:"",d.state==="ok"?` This page was read at ${Rs(d.at)}.`:""," See the sdlc viewer terminal for more."]}),i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:Ne,children:"Retry"})]})]}):null,ie=v!==null?i.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[i.jsx(wn,{"aria-hidden":"true"}),"Could not read this task. Trying again in ",v," seconds."]}):null,ce=i.jsx("div",{role:"status","aria-live":"polite",children:ie});if(d.state==="loading")return i.jsxs(xa,{children:[ce,Q,!g&&v===null?i.jsx(ub,{}):null]});const{detail:$,at:F}=d,{task:ee}=$,se=f.find(xe=>xe.id===ee.status_id),ge=$.local_done&&"task"in $.local_done?$.local_done:null,de=$.local_waits??[],Le=ge?de[0]??null:null,Ee=Le?ae(Le.opened_by):$.owner_title??ae($.thread),W=w.state==="ok"?w.data:null,_e=(W==null?void 0:W.lifecycle)==="finished",He=_e&&(W==null?void 0:W.outcome)==="cancelled",Dt=_e&&(W==null?void 0:W.outcome)==="complete",en=!!ee.created_at,zt=$.acceptance??[],tt=$.local_owner_thread,ft=tt?i.jsx(r,{className:"text-primary hover:underline",href:a(ob(e,tt.key)),children:tt.title}):$.owner_title??(ae($.thread)||"None"),It=async()=>{var Se;if(!ge||!((Se=s.commands)!=null&&Se.complete)||!await o({title:`Mark ${ee.title} done?`,description:Le?`This answers ${Ee}'s ask, “${Le.reason}”, closes that wait, and tells ${Ee} to check and continue.`:`This tells ${Ee||"its thread"} to check and continue.`,action_label:"Mark done"}))return;L(!0);const ne=await s.commands.complete(ge);if(L(!1),!ne.ok){T(ne.refusal.message);return}await ve(),N({title:ee.title,asker:Ee||"Its thread"})},zn=i.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[ge&&!j?i.jsxs(i.Fragment,{children:[i.jsxs(U,{ref:C,type:"button",variant:"outline",disabled:P,"aria-disabled":O!==null?!0:void 0,"aria-describedby":O!==null?"task-done-why":void 0,onClick:()=>{O===null&&It()},children:[i.jsx(Or,{className:"mr-2 size-4","aria-hidden":"true"}),"Done"]}),O!==null?i.jsx("span",{id:"task-done-why",className:"text-muted-foreground text-xs",children:"Read again first"}):null]}):null,D.button,i.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",Rs(F)]}),i.jsxs(U,{type:"button",variant:"ghost",size:"sm",onClick:Ne,children:[i.jsx(zr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return i.jsxs(xa,{children:[i.jsxs("div",{ref:G,className:"contents",children:[i.jsx(dc,{back:Z,id:ee.id,copy:i.jsx(Fg,{text:ee.id,label:"Copy ID",what:"the ID",variant:"ghost"}),badge:se?i.jsx(be,{variant:OD(se),children:se.name}):null,title:ee.title,created:en?`Created ${Ts(ee.created_at)}${Ee||$.owner_title?` by ${$.owner_title??Ee}`:""}`:null,actions:zn}),D.panel?i.jsx("div",{className:"mt-1 max-w-180",children:D.panel}):null,ce,Q,j?i.jsx("div",{ref:R,tabIndex:-1,role:"status","aria-live":"polite",className:"outline-none",children:i.jsxs(me,{variant:"success",className:"mt-4",children:[i.jsx(ff,{className:"size-4","aria-hidden":"true"}),i.jsxs(je,{children:["Marked ",j.title," done"]}),i.jsxs(pe,{children:[j.asker," is told to check and continue."]})]})}):null,O!==null?i.jsxs(me,{variant:"destructive",className:"mt-4",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Done was not recorded"}),i.jsxs(pe,{children:[O," Read again to see the task as it is now."]})]}):null,Le&&!j?i.jsxs(me,{variant:"warning",className:"mt-4",children:[i.jsx(Nt,{className:"size-4","aria-hidden":"true"}),i.jsxs(je,{children:[Ee," asks: ",Le.reason]}),i.jsxs(pe,{children:["Waiting on you since ",cb(Le.opened_at),". Done answers it and tells ",Ee," to check and continue."]})]}):null,$.view_outdated?i.jsxs(me,{variant:"warning",className:"mt-4",children:[i.jsx(Nt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:Lr}),i.jsxs(pe,{children:[A," Until then this page cannot read the claim and holds."]})]}):null,i.jsxs("dl",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(li,{label:"Owner thread",value:ft}),i.jsx(li,{label:"Release",value:$.release??"None"}),i.jsx(li,{label:"Session",value:w.state==="loading"?"Loading…":w.state==="failed"?"Not available":W!=null&&W.session?i.jsxs(i.Fragment,{children:[W.session.provider," ",i.jsx("span",{className:"font-mono break-all",children:W.session.id})]}):"None"}),i.jsx(li,{label:"Now",value:$.local_detail??(se==null?void 0:se.name)??""})]}),i.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Local tasks have no priority or contributors."}),i.jsx(q3,{detail:$,holder:ae((Mn=$.claim)==null?void 0:Mn.user_id),finished_at:_e?(W==null?void 0:W.finished_at)??null:null,read_at:F}),i.jsxs(me,{variant:"info",className:"mt-4",children:[i.jsx(gd,{className:"text-info size-4","aria-hidden":"true"}),ge?i.jsxs(i.Fragment,{children:[i.jsx(je,{children:"Done is the one change this page makes"}),i.jsx(pe,{children:"Everything else about this task changes through its thread."})]}):i.jsxs(i.Fragment,{children:[i.jsx(je,{children:"This page only reads tasks"}),i.jsx(pe,{children:"A task changes through the agent thread working on it."})]})]}),en?W!=null&&W.record?i.jsxs("p",{className:"mt-4 flex flex-wrap items-center gap-2 text-sm",children:[i.jsxs("span",{children:["Record ",i.jsx("code",{className:"font-mono break-all",children:W.record})]}),i.jsx(Fg,{text:W.record,label:"Copy path",what:"the path",variant:"ghost"})]}):null:i.jsx("p",{className:"mt-4 text-sm",children:"No task record yet. This page shows what the threads and plans in this checkout say about it."}),ge?i.jsx(Kt,{id:"task-done-needs",title:"What Done needs",children:zt.length>0?i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"text-muted-foreground text-xs",children:["The task's acceptance; ",Ee||"its thread"," checks these after Done."]}),i.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:zt.map(xe=>i.jsx("li",{children:xe},xe))})]}):i.jsxs("p",{className:"text-sm",children:["Its thread gave no acceptance. Ask ",Ee||"its thread"," what Done needs before marking it."]})}):zt.length>0?i.jsxs(Kt,{id:"task-acceptance",title:"Acceptance",children:[i.jsx("p",{className:"text-muted-foreground text-xs",children:Dt?"All met: the task finished complete":He&&(W!=null&&W.finished_at)?`Cancelled ${Ts(W.finished_at)}`:"Met when the task finishes complete"}),i.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:zt.map(xe=>i.jsx("li",{children:Dt?`Met: ${xe}`:xe},xe))})]}):null,i.jsx(Y3,{detail:$,waits:de,given:ge!==null,threadName:ae,threadsLink:i.jsx(r,{className:"text-primary hover:underline",href:a(`/org/${e}/threads`),children:"Threads"})}),w.state==="loading"?i.jsxs("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading the task's sections",children:[i.jsx(Tt,{className:"h-8 w-full"}),i.jsx(Tt,{className:"h-8 w-full"}),i.jsx(Tt,{className:"h-8 w-2/3"})]}):null,W?i.jsx(Kt,{id:"task-stands",title:"Where it stands",children:i.jsxs("p",{className:"text-sm",children:[(se==null?void 0:se.name)??ee.status_id,$.local_detail?` · ${$.local_detail}`:""]})}):null,W!=null&&W.time?i.jsx(X3,{time:W.time}):null,i.jsx(K3,{sections:w,heading_ref:E,on_retry:()=>void B("graph"),taskLink:xe=>i.jsx(r,{className:"text-primary hover:underline",href:a(`/org/${e}/tasks/${xe}?from=task:${ee.id}`),children:xe})}),W!=null&&W.files?i.jsx(Z3,{files:W.files,finished:_e}):null,W!=null&&W.proof?i.jsx(Q3,{proof:W.proof,finished_at:W.finished_at,who:$.owner_title??null}):null,W&&W.history.length>0?i.jsx(J3,{history:W.history}):null,i.jsx(WD,{related:S,heading_ref:M,on_retry:()=>void B("related"),link:xe=>{const ne=xe.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(xe.id)}`:xe.kind==="task"?`/org/${e}/tasks/${xe.id}?from=task:${ee.id}`:xe.kind==="issue"?`/org/${e}/issues/${encodeURIComponent(xe.id)}?from=task:${ee.id}`:xe.kind==="release"?`/releases?${xe.planned?"planned":"release"}=${encodeURIComponent(xe.id)}`:null;return ne?i.jsx(r,{className:we("text-primary hover:underline",xe.kind!=="thread"&&xe.label===xe.id&&"font-mono"),href:a(ne),children:xe.label}):xe.label}})]}),l]})}function xa({children:e}){return i.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 pb-8 sm:px-6 lg:px-8",children:e})}function dc({back:e,id:t,copy:n,badge:s,title:a,created:r,actions:o}){return i.jsxs("div",{className:"grid gap-1",children:[i.jsx("div",{children:e}),t?i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[i.jsx("code",{className:"font-mono",children:t}),n,s]}):null,i.jsx(_n,{title:a,description:r??void 0,actions:o})]})}function li({label:e,value:t}){return i.jsxs("div",{className:"grid gap-1",children:[i.jsx("dt",{className:"text-muted-foreground text-xs",children:e}),i.jsx("dd",{className:"m-0 text-sm break-words",children:t})]})}function Kt({id:e,title:t,aside:n,heading_ref:s,children:a}){return i.jsxs("section",{className:"mt-6","aria-labelledby":`${e}-title`,children:[i.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[i.jsx("h2",{id:`${e}-title`,ref:s,tabIndex:s?-1:void 0,className:"text-lg font-semibold outline-none",children:t}),n?i.jsx("span",{className:"text-muted-foreground text-sm",children:n}):null]}),i.jsx("div",{className:"mt-2",children:a})]})}function q3({detail:e,holder:t,finished_at:n,read_at:s}){const a=e.claim,[,r]=u.useReducer(h=>h+1,0),o=a&&!e.view_outdated?new Date(a.lease_expires_at).getTime():null;u.useEffect(()=>{if(o===null||!Number.isFinite(o))return;const h=o-Date.now();if(h<=0)return;const f=setTimeout(r,Math.min(h+50,2147483647));return()=>clearTimeout(f)},[o]);let l=i.jsx(Av,{className:"size-4","aria-hidden":"true"}),c="Nobody is working on this",d=null;if(e.view_outdated)c=`Claimed by: ${UD}`;else if(a){const h=new Date(a.lease_expires_at)<=new Date(Math.max(Date.now(),new Date(s).getTime()));l=i.jsx(kv,{className:"size-4","aria-hidden":"true"}),c=`${t} is working on this until ${Rs(a.lease_expires_at)}${h||a.lapsed?" · passed":""}`,d="Claimed in the coordination registry; its thread renews the claim."}else n&&(l=i.jsx(ff,{className:"size-4","aria-hidden":"true"}),d=`Finished ${Ts(n)}. Its claim ended when it finished.`);return i.jsxs(wt,{className:"mt-4 flex flex-wrap items-center gap-3 p-3","data-testid":"task-claim",children:[l,i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"text-sm font-medium",children:c}),d?i.jsx("div",{className:"text-muted-foreground text-xs break-words",children:d}):null]})]})}function Y3({detail:e,waits:t,given:n,threadName:s,threadsLink:a}){if(e.view_outdated)return i.jsx(Kt,{id:"task-holds",title:"Holds",children:i.jsx("p",{className:"text-sm",children:UD})});if(e.holds.length===0)return null;const r=new Map(t.map(o=>[o.id,o]));return i.jsxs(Kt,{id:"task-holds",title:`Holds · ${e.holds.length} open`,children:[i.jsx("p",{className:"text-muted-foreground text-xs",children:"A hold does not change the task's status."}),i.jsx(wt,{className:"mt-2 overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Holds",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Type"}),i.jsx(J,{children:"Reason"}),i.jsx(J,{children:"Waiting on"}),i.jsx(J,{children:"Opened"})]})}),i.jsx(at,{children:e.holds.map(o=>{var h;const l=r.get(o.id),c=Pc[o.hold_type],d=n?"Done above answers it":l!=null&&l.local_done?"In Waiting on you":(h=l==null?void 0:l.local_threads)!=null&&h.length?i.jsxs(i.Fragment,{children:["Answer it in ",a,": ",l.local_threads.join(" · ")]}):null;return i.jsxs(ye,{"data-testid":"task-hold",children:[i.jsx(X,{children:i.jsx(be,{variant:c.tone,children:(l==null?void 0:l.local_label)??c.label})}),i.jsxs(X,{children:[i.jsx("div",{children:o.reason}),i.jsxs("div",{className:"text-muted-foreground text-xs",children:["Opened by ",s(o.opened_by)]})]}),i.jsxs(X,{children:[i.jsx("div",{children:o.target.kind==="user"?"You":o.target.kind==="external"?o.target.label:"Another task"}),d?i.jsx("div",{className:"text-muted-foreground text-xs",children:d}):null]}),i.jsx(X,{children:cb(o.opened_at)})]},o.id)})})]})})]})}function X3({time:e}){return i.jsx(Kt,{id:"task-time",title:"Time",children:i.jsxs("dl",{className:"grid gap-4 sm:grid-cols-3",children:[i.jsx(li,{label:"Estimate",value:e.estimate?`${Rl(e.estimate.low)}–${Rl(e.estimate.high)}`:e.unknown_reason??"None"}),i.jsx(li,{label:"Time taken",value:e.elapsed!==null?`${Rl(e.elapsed)}${e.over_estimate?" · over estimate":""}`:"Not started"}),e.forecast?i.jsx(li,{label:"Reforecast",value:i.jsxs("span",{className:"text-muted-foreground",children:[Rl(e.forecast.low),"–",Rl(e.forecast.high)," left",e.forecast.reason?` · ${e.forecast.reason}`:""]})}):null]})})}function fb({what:e,again:t,refusal:n,on_retry:s}){const a=HD();return i.jsxs(me,{variant:"destructive",ref:a,children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsxs(je,{children:["Could not read ",e]}),i.jsxs(pe,{children:[i.jsx("p",{children:n.message}),i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:s,children:t})]})]})}function K3({sections:e,heading_ref:t,on_retry:n,taskLink:s}){const[a,r]=u.useState(!1);if(e.state==="loading")return null;const o=e.state==="failed"?e.refusal:e.data.graph.ok?null:e.data.graph.refusal;if(o)return i.jsx(Kt,{id:"task-graph",title:"Graph changes",heading_ref:t,children:i.jsx(fb,{what:"graph changes",again:"Read graph changes again",refusal:o,on_retry:n})});const l=e.state==="ok"&&e.data.graph.ok?e.data.graph.data:null;if(!l)return null;if(l.exempt)return i.jsx(Kt,{id:"task-graph",title:"Graph changes",heading_ref:t,children:i.jsxs("p",{className:"text-sm",children:["This task changes no modeled design. Its plan says why: ",l.exempt,"."]})});if(l.changes.length===0)return null;const c=a?l.changes:l.changes.slice(0,VD),d=l.changes.length-c.length;return i.jsxs(Kt,{id:"task-graph",title:"Graph changes",aside:l.document,heading_ref:t,children:[i.jsx(wt,{className:"overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Graph changes",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Change"}),i.jsx(J,{children:"Kind of change"}),i.jsx(J,{children:"Also in"}),i.jsx(J,{children:"In the plan"})]})}),i.jsx(at,{children:c.map(h=>i.jsxs(ye,{children:[i.jsxs(X,{children:[i.jsx("div",{children:h.label}),i.jsx("div",{className:"text-muted-foreground text-xs",children:h.type})]}),i.jsx(X,{children:U3[h.change]}),i.jsx(X,{children:h.also_in.length===0?"No other task":h.also_in.map((f,m)=>i.jsxs(u.Fragment,{children:[m>0?", ":null,s(f.id)]},f.id))}),i.jsx(X,{children:h.planned?"Yes":i.jsx(be,{variant:"warning",children:"No longer planned"})})]},`${h.id}:${h.planned}`))})]})}),d>0?i.jsxs("p",{className:"mt-2 flex flex-wrap items-center gap-2 text-sm",children:[d," more changes in this task's plan slice.",i.jsxs(U,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(!0),children:["Show all ",l.changes.length]})]}):null]})}function Z3({files:e,finished:t}){const[n,s]=u.useState(!1),a=n?e.paths:e.paths.slice(0,VD);return i.jsxs(Kt,{id:"task-files",title:"Files",children:[a.length>0?i.jsx("ul",{className:"grid gap-1 text-sm",children:a.map(r=>i.jsx("li",{children:i.jsx("span",{className:"font-mono break-all",children:r})},r))}):null,e.paths.length>a.length?i.jsxs(U,{type:"button",variant:"ghost",size:"sm",className:"mt-1",onClick:()=>s(!0),children:["Show all ",e.paths.length]}):null,e.landed?i.jsxs("p",{className:"mt-2 text-sm",children:["Landed ",i.jsx("span",{className:"font-mono",children:e.landed.sha.slice(0,10)})," · ",e.landed.files," files",t?"":" · becomes the proof when the task finishes"]}):null]})}function Q3({proof:e,finished_at:t,who:n}){return i.jsxs(Kt,{id:"task-proof",title:"Evidence and proof",children:[e.evidence?i.jsx("p",{className:"text-sm whitespace-pre-wrap",children:e.evidence}):null,e.no_code?i.jsxs("p",{className:"mt-2 text-sm",children:["No code: ",e.no_code]}):e.commit?i.jsxs("p",{className:"mt-2 text-sm",children:["Proof ",i.jsx("span",{className:"font-mono",children:e.commit.slice(0,10)})," ·"," ",e.on_main?"on main":"not yet on main"]}):null,t?i.jsxs("p",{className:"text-muted-foreground mt-2 text-xs",children:["Finished ",Ts(t),n?` by ${n}`:""]}):null]})}function J3({history:e}){return i.jsxs(Kt,{id:"task-history",title:"History",children:[i.jsx("p",{className:"text-muted-foreground text-xs",children:"From the task record, newest first"}),i.jsx(wt,{className:"mt-2 overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"History",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"What"}),i.jsx(J,{children:"Who"}),i.jsx(J,{children:"When"})]})}),i.jsx(at,{children:e.map((t,n)=>i.jsxs(ye,{children:[i.jsx(X,{children:t.what}),i.jsx(X,{children:t.who??"Its thread"}),i.jsx(X,{children:cb(t.at)})]},`${t.at}:${n}`))})]})})]})}function WD({id:e="task-related",related:t,heading_ref:n,on_retry:s,link:a,fixed:r=!1}){return t.state==="ok"&&t.data.length===0?null:i.jsx(Kt,{id:e,title:"Related",heading_ref:n,children:t.state==="loading"?i.jsxs("div",{className:"grid gap-2",role:"status","aria-label":"Loading related work",children:[i.jsx(Tt,{className:"h-8 w-full"}),i.jsx(Tt,{className:"h-8 w-full"}),i.jsx(Tt,{className:"h-8 w-2/3"})]}):t.state==="failed"?i.jsx(fb,{what:"related work",again:"Read related work again",refusal:t.refusal,on_retry:s}):i.jsx(wt,{className:"overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Related",className:r?"table-fixed":void 0,children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{className:r?"w-[14%]":void 0,children:"Kind"}),i.jsx(J,{className:r?"w-[45%]":void 0,children:"Item"}),i.jsx(J,{className:r?"w-[41%]":void 0,children:"How it relates"})]})}),i.jsx(at,{children:t.data.map(o=>i.jsxs(ye,{children:[i.jsx(X,{children:B3[o.kind]}),i.jsx(X,{className:r?"break-words":void 0,children:a(o)}),i.jsx(X,{className:r?"break-words":void 0,children:o.relation})]},`${o.kind}:${o.planned?"planned:":""}${o.id}`))})]})})})}function eG({org:e,task_id:t,from:n}){const s=Cd(),a=`/org/${e}/tasks`;return s.taskSections?i.jsx(F3,{org:e,task_id:t,from:n??null}):i.jsx(tG,{task_id:t,back:a})}function tG({task_id:e,back:t}){const{availability:n}=Cd(),[s,a]=u.useState({state:"loading"});return u.useEffect(()=>{let r=!0;return n().then(o=>{r&&a(o)}),()=>{r=!1}},[n]),s.state==="off"?i.jsx(Dh,{back:t}):i.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:s.state==="active"?i.jsx(P3,{active:s,task_id:e,back:t}):s.state==="error"?i.jsxs(me,{variant:"destructive",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"This task could not be loaded"}),i.jsx(pe,{children:"Check your connection and try again."})]}):s.state==="available"?i.jsx(Dh,{back:t}):i.jsx(ub,{})})}function Qn({children:e}){return i.jsx("p",{role:"alert",className:"text-destructive text-sm",children:e})}const nG=["open","triaged","resolved","closed"],mb=["low","normal","high","urgent"],sG=["fixed","works_as_intended","planned","duplicate","wont_fix","cannot_reproduce"],iG=["title","description","external_reference"],Eh={open:"Open",triaged:"Triaged",escalated:"Escalated",waiting_on_fix:"Waiting on fix",resolved:"Resolved",closed:"Closed"},FD={open:"warning",triaged:"info",escalated:"info",waiting_on_fix:"info",resolved:"success",closed:"neutral"},Ic={low:"Low",normal:"Normal",high:"High",urgent:"Urgent"},pb={fixed:"Fixed",works_as_intended:"Works as intended",planned:"Planned",duplicate:"Duplicate",wont_fix:"Won't fix",cannot_reproduce:"Cannot reproduce"},qD={title:"Title",description:"Description",external_reference:"External reference"},aG=[["year",365*24*3600],["month",30*24*3600],["week",7*24*3600],["day",24*3600],["hour",3600],["minute",60]];function zu(e,t=Date.now()){const n=Math.round((new Date(e).getTime()-t)/1e3),s=new Intl.RelativeTimeFormat("en",{numeric:"auto"});for(const[a,r]of aG)if(Math.abs(n)>=r)return s.format(Math.round(n/r),a);return"just now"}function qg(e,t,n){const s=`/org/${encodeURIComponent(e)}/proj/${encodeURIComponent(t)}/support`;return n?`${s}/${encodeURIComponent(n)}`:s}function gb(e,t){return e?t??"Not available":"A former member"}const rG="the issue integration";function oG(e){return!e.created_by&&e.reporter_kind==="customer"?rG:gb(e.created_by,e.created_by_username)}function lG(e,t){return!e.actor_id&&e.kind==="created"&&t.reporter_kind==="customer"?"The issue integration":gb(e.actor_id,e.actor_username)}const tu="not_set",cG="Do not paste personal data. Leave out names, such as borrower names, and loan numbers; text shaped like an email address, phone number, or social security number is refused.";function dG({create:e,open:t,onOpenChange:n,onCreated:s}){const[a,r]=u.useState(""),[o,l]=u.useState(""),[c,d]=u.useState(!1),[h,f]=u.useState(""),[m,p]=u.useState(tu),[y,g]=u.useState(!1),[b,v]=u.useState(null),x=u.useRef(null),w=()=>{r(""),l(""),d(!1),f(""),p(tu),v(null),x.current=null},_=j=>{var N;return((N=b==null?void 0:b.personal_data)==null?void 0:N.field)===j?b.message:void 0},S=async j=>{if(j.preventDefault(),y)return;g(!0),x.current??(x.current=crypto.randomUUID());const N=await e({request_id:x.current,title:o.trim()||void 0,description:h||void 0,external_reference:a.trim()||void 0,priority:m===tu?null:m});if(g(!1),!N.ok){N.refusal.status!==0&&(x.current=null),v(N.refusal);return}w(),s(N.data.issue,N.data.duplicates)},k=b&&!b.personal_data?b.message:void 0;return i.jsx(jn,{open:t,onOpenChange:j=>{j||w(),n(j)},children:i.jsx(Nn,{className:"sm:max-w-2xl",children:i.jsxs("form",{onSubmit:S,className:"grid gap-4",children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:"New support issue"}),i.jsx(Dn,{children:"Log one help-desk report. Text is shown exactly as entered."})]}),i.jsxs(me,{variant:"warning",children:[i.jsx(Nt,{}),i.jsx(pe,{children:cG})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"maintain-issue-reference",children:"External reference"}),i.jsx(yt,{id:"maintain-issue-reference",value:a,"aria-invalid":!!_("external_reference"),onChange:j=>{r(j.target.value),c||l(j.target.value)}}),_("external_reference")?i.jsx(Qn,{children:_("external_reference")}):i.jsx("p",{className:"text-muted-foreground text-xs",children:"The help-desk ticket number."})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"maintain-issue-title",children:"Title"}),i.jsx(yt,{id:"maintain-issue-title",value:o,"aria-invalid":!!_("title"),onChange:j=>{l(j.target.value),d(!0)}}),_("title")?i.jsx(Qn,{children:_("title")}):i.jsx("p",{className:"text-muted-foreground text-xs",children:"Prefilled from the external reference; edit it if you like."})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"maintain-issue-description",children:"Description"}),i.jsx(Vn,{id:"maintain-issue-description",rows:4,placeholder:"What the end user reported, without personal data",value:h,"aria-invalid":!!_("description"),onChange:j=>f(j.target.value)}),_("description")?i.jsx(Qn,{children:_("description")}):null]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"maintain-issue-priority",children:"Priority"}),i.jsxs(St,{value:m,onValueChange:p,children:[i.jsx(_t,{id:"maintain-issue-priority",children:i.jsx(Ct,{})}),i.jsxs(jt,{children:[i.jsx(Be,{value:tu,children:"Not set"}),mb.map(j=>i.jsx(Be,{value:j,children:Ic[j]},j))]})]})]}),k?i.jsx(Qn,{children:k}):null,i.jsxs(Sn,{children:[i.jsx(U,{type:"button",variant:"outline",onClick:()=>{w(),n(!1)},children:"Cancel"}),i.jsx(U,{type:"submit",loading:y,disabled:!o.trim()&&!a.trim(),children:"Log issue"})]})]})})})}const uG=["supportAccess","assigneeCandidates","create","update","assign","transition","redact"];function YD(){return hG(Wn().issues)}function hG(e){return e&&uG.every(t=>typeof e[t]=="function")?e:null}function XD(e){const[t,n]=u.useState(null);return u.useEffect(()=>{if(!e)return;let s=!1;return e.supportAccess().then(a=>{s||n({contract:e,state:a.ok?{state:"ready",access:a.data}:{state:"error"}})}),()=>{s=!0}},[e]),t&&e&&t.contract===e?t.state:{state:"loading"}}function KD({access:e,header:t,back_href:n,children:s}){const{href:a,Link:r}=lt();return e.state==="loading"?i.jsxs("div",{className:"flex flex-1 items-center justify-center py-24",children:[i.jsx(wn,{className:"size-5"}),i.jsx("span",{className:"sr-only",children:"Loading…"})]}):e.state==="error"||!e.access.enabled?i.jsx(Ua,{title:"Page not found",description:"This page does not exist or you do not have access to it.",backHref:a(n),backLabel:"Back to the project",link:r}):e.access.can_view?i.jsx(i.Fragment,{children:s(e.access)}):i.jsxs(i.Fragment,{children:[t,i.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[i.jsx(i$,{className:"text-muted-foreground size-8","aria-hidden":!0}),i.jsx("h2",{className:"text-lg font-semibold",children:"Support needs a Maintain seat"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:e.access.seat?"You need read permission on this project to see its support issues; ask an organization admin.":"You need a Maintain seat to see this project's support issues; ask an organization admin."})]})]})}function ZD(){const e=lt();return t=>{e.navigate?e.navigate(t):window.location.assign(e.href(t))}}const ds="all",nu=25;function Yg({action:e}){return i.jsx(_n,{title:"Support",description:"Help-desk reports logged against this project.",actions:e})}function fG({org:e,project:t,query:n}){const s=YD(),a=XD(s),r=`/org/${e}/proj/${t}`;return i.jsx("div",{className:"flex w-full flex-1 flex-col gap-6 px-4 py-4 sm:px-6 lg:px-8",children:i.jsx(KD,{access:a,header:i.jsx(Yg,{}),back_href:r,children:o=>s?i.jsx(mG,{contract:s,access:o,org_name:e,proj_name:t,query:n}):null})})}function mG({contract:e,access:t,org_name:n,proj_name:s,query:a}){const{href:r,Link:o}=lt(),l=ZD(),[c,d]=u.useState(()=>new URLSearchParams(a).get("external_reference")??""),[h,f]=u.useState(ds),[m,p]=u.useState(ds),[y,g]=u.useState(ds),[b,v]=u.useState(0),[x,w]=u.useState(null),[_,S]=u.useState(0),[k,j]=u.useState(null),[N,O]=u.useState([]),[T,P]=u.useState(!1),L=c.trim()!==""||h!==ds||m!==ds||y!==ds,G=u.useCallback(async()=>{const E=await e.list({external_reference:c.trim()||void 0,status:h===ds?void 0:h,priority:m===ds?void 0:m,assignee:y===ds?void 0:y,limit:nu,offset:b*nu});if(!E.ok){j(E.refusal.message);return}j(null),w(E.data.issues),S(E.data.total)},[e,c,h,m,y,b]);u.useEffect(()=>{const E=setTimeout(()=>void G(),200);return()=>clearTimeout(E)},[G]),u.useEffect(()=>{e.assigneeCandidates().then(E=>{E.ok&&O(E.data.candidates)})},[e]);const A=t.can_change?i.jsxs(U,{onClick:()=>P(!0),children:[i.jsx(Pa,{className:"mr-2 size-4"}),"New issue"]}):void 0,D=i.jsx(dG,{create:e.create,open:T,onOpenChange:P,onCreated:(E,M)=>{P(!1);const H=qg(n,s,E.id);l(M.length?`${H}?duplicates=${M.length}`:H)}});if(x!==null&&_===0&&!L&&b===0)return i.jsxs(i.Fragment,{children:[i.jsx(Yg,{}),i.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[i.jsx(QM,{className:"text-muted-foreground size-8","aria-hidden":!0}),i.jsx("h2",{className:"text-lg font-semibold",children:"No support issues yet"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Log a help-desk report under its ticket number, so every report is counted once."}),t.can_change?i.jsxs(U,{onClick:()=>P(!0),children:[i.jsx(Pa,{className:"mr-2 size-4"}),"Log the first issue"]}):null]}),D]});const C=_===0?0:b*nu+1,R=Math.min(_,(b+1)*nu);return i.jsxs(i.Fragment,{children:[i.jsx(Yg,{action:A}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs("div",{className:"relative w-full max-w-sm",children:[i.jsx(N$,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2","aria-hidden":!0}),i.jsx(yt,{"aria-label":"Filter by external reference",placeholder:"Filter by external reference",className:"pl-9",value:c,onChange:E=>{d(E.target.value),v(0)}})]}),i.jsx(up,{label:"Status",value:h,onChange:E=>{f(E),v(0)},options:nG.map(E=>({value:E,label:Eh[E]}))}),i.jsx(up,{label:"Priority",value:m,onChange:E=>{p(E),v(0)},options:mb.map(E=>({value:E,label:Ic[E]}))}),i.jsx(up,{label:"Assignee",value:y,onChange:E=>{g(E),v(0)},options:[{value:"unassigned",label:"Unassigned"},{value:"cannot_act",label:"Assignee cannot act"},...N.map(E=>({value:E.user_id,label:E.username??"Not available"}))]})]}),k?i.jsx(Qn,{children:k}):null,i.jsx("div",{className:"rounded-md border",children:i.jsxs(it,{children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Title"}),i.jsx(J,{children:"External reference"}),i.jsx(J,{children:"Status"}),i.jsx(J,{children:"Priority"}),i.jsx(J,{children:"Assignee"}),i.jsx(J,{children:"Updated"})]})}),i.jsx(at,{children:x===null?i.jsx(ye,{children:i.jsx(X,{colSpan:6,className:"h-24 text-center",children:"Loading…"})}):x.length===0?i.jsx(ye,{children:i.jsx(X,{colSpan:6,className:"h-24 text-center",children:"No issues match these filters."})}):x.map(E=>i.jsxs(ye,{children:[i.jsx(X,{className:"max-w-md",children:i.jsx(o,{href:r(qg(n,s,E.id)),className:"font-medium hover:underline",children:E.title})}),i.jsx(X,{className:"font-mono text-xs",children:E.external_reference??""}),i.jsx(X,{children:i.jsx(be,{variant:FD[E.status],children:Eh[E.status]})}),i.jsx(X,{children:E.priority?Ic[E.priority]:""}),i.jsx(X,{children:i.jsx(pG,{issue:E})}),i.jsx(X,{className:"text-muted-foreground",children:zu(E.updated_at)})]},E.id))})]})}),i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("p",{className:"text-muted-foreground text-sm",children:_===0?"No issues.":`Showing ${C}–${R} of ${_} issue${_===1?"":"s"}.`}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(U,{variant:"outline",size:"sm",disabled:b===0,onClick:()=>v(E=>Math.max(0,E-1)),children:"Previous"}),i.jsx(U,{variant:"outline",size:"sm",disabled:R>=_,onClick:()=>v(E=>E+1),children:"Next"})]})]}),D]})}function pG({issue:e}){return e.assignee_id?i.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{children:e.assignee_username??"Not available"}),e.assignee_can_act===!1?i.jsx(be,{variant:"error",children:"Assignee cannot act"}):null]}):i.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}function up({label:e,value:t,onChange:n,options:s}){var r;const a=u.useMemo(()=>t===ds||s.some(o=>o.value===t),[s,t]);return i.jsxs(St,{value:a?t:ds,onValueChange:n,children:[i.jsx(_t,{className:"w-44","aria-label":e,children:i.jsx(Ct,{placeholder:e,children:t===ds?e:(r=s.find(o=>o.value===t))==null?void 0:r.label})}),i.jsxs(jt,{children:[i.jsx(Be,{value:ds,children:"All"}),s.map(o=>i.jsx(Be,{value:o.value,children:o.label},o.value))]})]})}function qi(e,t){u.useEffect(()=>{const n=setInterval(()=>{document.visibilityState==="visible"&&e("tick")},t),s=()=>{document.visibilityState==="visible"&&e("shown")};return document.addEventListener("visibilitychange",s),()=>{clearInterval(n),document.removeEventListener("visibilitychange",s)}},[e,t])}const gG=5e3;function Os(){const e=u.useRef(0),t=u.useRef(null);return u.useEffect(()=>()=>{t.current!==null&&clearTimeout(t.current)},[]),u.useMemo(()=>({owed:()=>e.current>0,busy:()=>e.current>0||t.current!==null,track:async n=>{e.current+=1;try{return await n}finally{e.current-=1,t.current!==null&&clearTimeout(t.current),t.current=setTimeout(()=>{t.current=null},gG)}}}),[])}function Ff(e,t){return n=>{(n==="shown"?e.owed():e.busy())||t()}}const QD=[{key:"local",label:"Local"},{key:"staging",label:"Staging"},{key:"production",label:"Production"}],xG=/^iss-\d{1,9}$/,vG=/^col-\d{1,9}$/,bG=e=>e&&e[0].toUpperCase()+e.slice(1);function JD(e){const t=bG(e.status_word??e.status.replace(/_/g," ")),n=e.group??(e.status==="resolved"?"resolved":"unplaced");return n==="resolved"?{label:t,tone:e.resolution_reason==="fixed"?"success":"neutral"}:n==="unowned"||n==="routed"?{label:t,tone:"warning"}:n==="fixing"?{label:t,tone:"info"}:{label:t,tone:"neutral"}}function uc(e,t=Date.now()){if(!e)return"";const n=Math.max(0,(t-Date.parse(e))/1e3);return Number.isFinite(n)?n<60?"just now":n<3600?`${Math.round(n/60)}m ago`:n<86400?`${Math.round(n/3600)}h ago`:`${Math.round(n/86400)}d ago`:""}const Xg={search:"",owner:null,urgent:!1,seen:[],label:null,collection:null};function Mu(e){const t=new URLSearchParams(e),n=t.getAll("seen").filter(a=>QD.some(r=>r.key===a)),s=t.get("collection");return{search:t.get("search")??"",owner:t.get("owner")||null,urgent:t.get("urgent")==="1",seen:[...new Set(n)],label:t.get("label")||null,collection:s&&vG.test(s)?s:null}}function xb(e){const t=new URLSearchParams;e.search&&t.set("search",e.search),e.owner&&t.set("owner",e.owner),e.urgent&&t.set("urgent","1");for(const n of e.seen)t.append("seen",n);return e.label&&t.set("label",e.label),e.collection&&t.set("collection",e.collection),t.toString()}const eE=new Set(["resolved"]),hp=10,yG=new Set(["unplaced","unowned","routed","fixing","resolved"]),wG=["open","fold","all"];function tE(e){const t=new URLSearchParams(e),n=s=>[...new Set(t.getAll(s).filter(a=>yG.has(a)))];return{open:n("open"),fold:n("fold"),all:n("all")}}const _G=(e,t)=>eE.has(t)?!e.open.includes(t):e.fold.includes(t);function jG(e,t,n){const s=e.open.filter(o=>o!==t),a=e.fold.filter(o=>o!==t),r=eE.has(t);return n&&!r&&a.push(t),!n&&r&&s.push(t),{...e,open:s,fold:a}}const NG=(e,t,n)=>({...e,all:n?[...e.all.filter(s=>s!==t),t]:e.all.filter(s=>s!==t)});function io(e,t){const n=new URLSearchParams(xb(e));for(const s of wG)for(const a of t[s])n.append(s,a);return n.toString()}function kG(e){return{search:e.search.trim()||void 0,owner:e.owner??void 0,urgent:e.urgent||void 0,seen:e.seen.length?e.seen:void 0,label:e.label?[e.label]:void 0,collection:e.collection??void 0}}const a_=e=>!!(e.search.trim()||e.owner||e.urgent||e.seen.length||e.label||e.collection),SG={agent:"Filed by an agent",user:"Filed by you",tool:"Filed by a tool"},CG={graph:"Placed on the graph by its anchors",files:"Placed by its files",unplaced:"Triaged, not placed yet"},DG={handoff:"Handed to its owner",backlog:"Sent to the unowned backlog",batch:"Routed to a batch"};function EG(e,t=""){const n=(e??t).trim();if(!n)return"";const s=n.indexOf(": "),a=(s===-1?n:n.slice(0,s)).trim(),r=s===-1?"":n.slice(s+2).trim(),o=l=>r?`${l} ${r}`:l;switch(a){case"filed":return SG[r]??o("Filed by");case"labelled":return o("Labelled");case"unlabelled":return r?`Label removed: ${r}`:"Label removed";case"anchored":return r?`Anchored to ${r}`:"Anchored";case"triaged":return CG[r]??(r?`Triaged: ${r}`:"Triaged");case"routed":return DG[r]??(r?`Routed: ${r}`:"Routed");case"route closed":return r==="backlog"?"Taken off the unowned backlog":r?`Route closed: ${r}`:"Route closed";case"released":return r?`Released by its owner (task ${r})`:"Released by its owner";case"resolved":return r==="duplicate"?"Resolved as a duplicate":r?`Resolved · ${r.replace(/_/g," ")}`:"Resolved";case"reopened":return r?`Reopened: ${r}`:"Reopened";case"fix landed":return r?`Fix landed in ${r.slice(0,10)}`:"Fix landed";case"merged":return r?`Merged ${r} into this issue`:"Merged a duplicate into this issue";default:return n}}const AG=e=>e.replace(/`+/g,"").replace(/\s+/g," ").trim(),r_={report:{title:"Triage places what you report",body:"Report an issue here and triage places it and suggests an owner. Route and resolve issues with the issue command or through the thread working on them."},read_only:{title:"This page only reads issues",body:"File, route and resolve issues with the issue command or through the thread working on them."}},o_={title:"This page only reads issues",body:"Route and resolve issues with the issue command or through the thread working on them."},RG=e=>e?"Issues you report here, or file with the issue command, appear here.":"Issues filed in this repository with the issue command appear here.";function nE(e){const t=new Set;for(const n of e.split(",")){const s=n.trim().toLowerCase().replace(/[\s_]+/g,"-");s&&t.add(s)}return[...t]}const TG=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,l_=40,Kg=10,c_=40,OG=200,fp="not_set",sE=[{value:"not_set",label:"Not set"},{value:"local",label:"Local"},{value:"staging",label:"Staging"},{value:"production",label:"Production"}],In={title:"Report an issue",description:"Triage places it and suggests an owner; you'll see where it went.",needs_what:"Say what is wrong to report it.",refused:"The issue was not reported",kept:"Your draft is kept: report it again.",maybe_filed:"The report may have been filed",timeout:"The issue command did not answer within 1 minute, so the report may have been filed. Look for it in the list before you report it again.",failed:"The issue command failed, so the report may have been filed. Look for it in the list before you report it again; the sdlc viewer terminal says what failed.",kept_only:"Your draft is kept.",too_long:"The report is too long to send; shorten What happens or What should happen.",no_answer:"The viewer did not answer.",reporting:"Reporting…"},bo={what:"",actual:"",expected:"",env:"not_set",shows:"",collection:"",ref:"",labels:""},Zg=e=>`sdlc.issue-report-draft:${e}`;function zG(e){try{const t=JSON.parse(window.sessionStorage.getItem(Zg(e))??"null");if(!t||typeof t!="object")return bo;const n={...bo};for(const s of Object.keys(bo))typeof t[s]=="string"&&(n[s]=t[s]);return sE.some(s=>s.value===n.env)||(n.env="not_set"),n}catch{return bo}}function mp(e,t){try{t?window.sessionStorage.setItem(Zg(e),JSON.stringify(t)):window.sessionStorage.removeItem(Zg(e))}catch{}}function MG(e){const t=nE(e);if(t.length>Kg)return`At most ${Kg} labels; this has ${t.length}.`;const n=t.find(s=>!TG.test(s)||s.length>l_);return n?`'${n}' is not a label: use a-z, 0-9 and single hyphens, at most ${l_} characters.`:null}function $G(e){return e.status===504||e.code==="timeout"?In.timeout:e.status===500?In.failed:e.status===413?In.too_long:[400,422].includes(e.status)&&e.message?e.message:In.no_answer}function pp(e){return e===In.timeout||e===In.failed}function LG(e){const t={what:e.what.trim()};e.actual.trim()&&(t.actual=e.actual),e.expected.trim()&&(t.expected=e.expected),e.env!=="not_set"&&(t.env=e.env),e.shows.trim()&&(t.shows=e.shows.trim()),e.collection&&(t.collection=e.collection,e.ref.trim()&&(t.ref=e.ref.trim()));const n=nE(e.labels);return n.length&&(t.labels=n.join(",")),t}function PG({project:e,report:t,reportCollections:n,open:s,onOpenChange:a,onFiled:r,onMaybeFiled:o}){const[l,c]=u.useState(bo),[d,h]=u.useState(null),[f,m]=u.useState(!1),[p,y]=u.useState(null),[g,b]=u.useState(null),v=u.useRef(null),x=u.useRef(null),w=u.useRef(null),_=u.useRef(!1),S=u.useId(),k=A=>`${S}-report-${A}`;u.useEffect(()=>{if(!s||(c(zG(e)),y(null),b(null),h(null),!n))return;let A=!0;return n().then(D=>{A&&h(D.ok?D.data.collections:[])}),()=>{A=!1}},[s,e,n]);const j=A=>c(D=>{const C={...D,...A};return mp(e,C),C}),N=u.useMemo(()=>{const A=d??[];return l.collection&&!A.some(D=>D.collection===l.collection)?[...A,{collection:l.collection,title:l.collection}]:A},[d,l.collection]),O=N.length>0,T=A=>{f||(A&&mp(e,null),a(!1))},P=async A=>{var R,E;if(A.preventDefault(),_.current)return;if(!l.what.trim()){(R=v.current)==null||R.focus();return}const D=MG(l.labels);if(b(D),D){(E=x.current)==null||E.focus();return}_.current=!0,m(!0),y(null);const C=await t(LG(l));if(_.current=!1,m(!1),!C.ok){const M=$G(C.refusal);y(M),pp(M)&&(o==null||o());return}mp(e,null),c(bo),a(!1),r(C.data)};u.useEffect(()=>{var A,D,C;p&&((D=(A=w.current)==null?void 0:A.scrollIntoView)==null||D.call(A,{block:"nearest"}),(C=v.current)==null||C.focus())},[p]);const L=!l.what.trim(),G=[k("what-help"),p?k("refused"):null].filter(Boolean).join(" ");return i.jsx(jn,{open:s,onOpenChange:A=>A?a(!0):T(!1),children:i.jsx(Nn,{className:"max-h-[90vh] overflow-y-auto sm:max-w-2xl",onOpenAutoFocus:A=>{var D;A.preventDefault(),(D=v.current)==null||D.focus()},children:i.jsxs("form",{onSubmit:P,className:"grid gap-4",noValidate:!0,children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:In.title}),i.jsx(Dn,{children:In.description})]}),p?i.jsxs(me,{ref:w,variant:"destructive",id:k("refused"),children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:pp(p)?In.maybe_filed:In.refused}),i.jsxs(pe,{children:[/[.!?]$/.test(p)?p:`${p}.`," ",pp(p)?In.kept_only:In.kept]})]}):null,i.jsxs("fieldset",{disabled:f,className:"grid min-w-0 gap-4",children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsxs(Ie,{htmlFor:k("what"),children:["What is wrong ",i.jsx("span",{"aria-hidden":"true",children:"*"})]}),i.jsx(yt,{id:k("what"),ref:v,"aria-required":"true",maxLength:OG,placeholder:"One line: what you saw",value:l.what,"aria-describedby":G,onChange:A=>j({what:A.target.value})}),i.jsx("p",{id:k("what-help"),className:"text-muted-foreground text-xs",children:"It becomes the issue's title."})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:k("actual"),children:"What happens"}),i.jsx(Vn,{id:k("actual"),rows:3,placeholder:"What you see, step by step",value:l.actual,onChange:A=>j({actual:A.target.value})})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:k("expected"),children:"What should happen"}),i.jsx(Vn,{id:k("expected"),rows:3,placeholder:"What you expected instead",value:l.expected,onChange:A=>j({expected:A.target.value})})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:k("env"),children:"Where you saw it"}),i.jsxs(St,{value:l.env,disabled:f,onValueChange:A=>j({env:A}),children:[i.jsx(_t,{id:k("env"),children:i.jsx(Ct,{})}),i.jsx(jt,{children:sE.map(A=>i.jsx(Be,{value:A.value,children:A.label},A.value))})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:k("shows"),children:"Shows in"}),i.jsx(yt,{id:k("shows"),placeholder:"packages/app/page.tsx or Report button",value:l.shows,"aria-describedby":k("shows-help"),onChange:A=>j({shows:A.target.value})}),i.jsx("p",{id:k("shows-help"),className:"text-muted-foreground text-xs",children:"A file path in this repository, or the words you saw on the screen."})]}),O?i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:k("collection"),children:"Collection"}),i.jsxs(St,{value:l.collection||fp,disabled:f,onValueChange:A=>j({collection:A===fp?"":A}),children:[i.jsx(_t,{id:k("collection"),children:i.jsx(Ct,{})}),i.jsxs(jt,{children:[i.jsx(Be,{value:fp,children:"Not set"}),N.map(A=>i.jsx(Be,{value:A.collection,children:A.title===A.collection?A.collection:`${A.title} (${A.collection})`},A.collection))]})]})]}):null,O&&l.collection?i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:k("ref"),children:"Place in the collection"}),i.jsx(yt,{id:k("ref"),maxLength:c_,placeholder:"Like item 5",value:l.ref,"aria-describedby":k("ref-help"),onChange:A=>j({ref:A.target.value})}),i.jsxs("p",{id:k("ref-help"),className:"text-muted-foreground text-xs",children:["At most ",c_," characters."]})]}):null,i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:k("labels"),children:"Labels"}),i.jsx(yt,{id:k("labels"),ref:x,placeholder:"viewer, report form",value:l.labels,"aria-invalid":g?!0:void 0,"aria-describedby":k(g?"labels-error":"labels-help"),onChange:A=>{j({labels:A.target.value}),g&&b(null)}}),g?i.jsx("div",{id:k("labels-error"),children:i.jsx(Qn,{children:g})}):i.jsxs("p",{id:k("labels-help"),className:"text-muted-foreground text-xs",children:["Up to ",Kg," words to find it by, separated by commas."]})]})]}),i.jsx("p",{id:k("needs-what"),className:"sr-only",children:In.needs_what}),i.jsx("div",{role:"status","aria-live":"polite",className:"sr-only",children:f?In.reporting:""}),i.jsxs(Sn,{children:[i.jsx(U,{type:"button",variant:"outline",disabled:f,onClick:()=>T(!0),children:"Cancel"}),i.jsx(U,{type:"submit",loading:f,"aria-disabled":L?!0:void 0,"aria-describedby":k("needs-what"),children:f?In.reporting:"Report"})]})]})})})}function IG(e,t){const n=new URLSearchParams(e).get("reported");return n&&(n===`Seen before: added to ${t}`||n.startsWith(`Filed ${t} · `)&&n.length<=200&&!/[\n\r]/.test(n))?n:null}const GG=10,iE=1e4,HG=250,Xr="__all",VG="none",UG=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function aE(){const e=Wn().issues;if(!e)throw new Error("The Issues page rendered without the issues seam.");return e}const BG=e=>({read_at:e,scope:"project",folder:null,groups:[],facets:{owners:[],labels:[],urgent:0,seen:{local:0,staging:0,production:0}},listed:0,collections:[]});function WG({org:e,project:t,query:n,onQuery:s}){var Le,Ee;const a=aE(),r=(Le=a.commands)==null?void 0:Le.open_thread,o=u.useMemo(()=>r?{org:e,open_thread:r}:void 0,[e,r]),{href:l,Link:c}=lt(),d=ZD(),[h,f]=u.useState(!1),m=u.useMemo(()=>Mu(n),[n]),p=u.useMemo(()=>tE(n),[n]),y=xb(m),g=a_(m),b=io(m,p),[v,x]=u.useState({state:"loading"}),[w,_]=u.useState(null),[S,k]=u.useState(null),j=u.useRef(0),N=u.useRef(0),O=u.useRef(null),T=u.useRef(null),P=is(),L=u.useRef(!1),[G,A]=u.useState(m.search),D=u.useCallback(W=>s(io({...m,...W},p)),[m,p,s]),C=u.useCallback(W=>s(io(m,W)),[m,s]),R=Os(),E=u.useCallback(async()=>{const W=N.current+=1;k(null);const _e=await R.track(a.list(kG(Mu(y))));if(W!==N.current)return;if(_e.ok){j.current=0,_(null),x({state:"ok",list:_e.data,local:_e.data.local??BG(new Date().toISOString()),key:y});return}const He=_e.refusal.reason;if(He==="engine_missing")return x({state:"engine_missing",refusal:_e.refusal});if(He==="view_outdated")return x({state:"view_outdated"});if(j.current+=1,j.current===1&&UG(_e.refusal)){k(_e.refusal.retry_after??GG);return}_(_e.refusal)},[a.list,y,R]);u.useEffect(()=>{E()},[E]);const M=u.useMemo(()=>Ff(R,()=>void E()),[E,R]);qi(M,iE),u.useEffect(()=>{if(S===null)return;const W=setTimeout(()=>{document.visibilityState==="visible"&&E()},S*1e3);return()=>clearTimeout(W)},[S,E]),u.useEffect(()=>{document.activeElement!==O.current&&A(m.search)},[m.search]),u.useEffect(()=>{if(G===m.search)return;const W=setTimeout(()=>D({search:G}),HG);return()=>clearTimeout(W)},[G,m.search,D]),u.useEffect(()=>{const W=_e=>{if(_e.key!=="/"||_e.metaKey||_e.ctrlKey||_e.altKey)return;const He=_e.target;He&&(He.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(He.tagName))||O.current&&(_e.preventDefault(),O.current.focus())};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[]);const H=()=>{var W;A(""),s(io(Xg,p)),(W=O.current)==null||W.focus()},z=()=>{j.current=0,E()},K=()=>{L.current=!0,z()};u.useEffect(()=>{var _e;if(!L.current||v.state==="loading"||S!==null)return;L.current=!1;const W=(_e=T.current)==null?void 0:_e.querySelector("h1");W&&(W.tabIndex=-1,W.focus())},[v,w,S]);const oe=hb(T),re=W=>`/proj/${encodeURIComponent(t)}/issues${W?`?${W}`:""}`,ve=W=>`/proj/${encodeURIComponent(t)}/issues/${encodeURIComponent(W)}?from=issues${b?`&${b}`:""}`,ke=i.jsx("div",{role:"status","aria-live":"polite",children:S!==null?i.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[i.jsx(wn,{"aria-hidden":"true"}),"Issues are busy. Reading them again…"]}):null}),ae=w?i.jsxs(me,{ref:oe,variant:"destructive",className:"mt-4",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Issues could not be loaded"}),i.jsxs(pe,{children:[i.jsxs("p",{children:[w.message,w.since?` Since ${Rs(w.since)}.`:"",v.state==="ok"?` The list below was read at ${Rs(v.local.read_at)}.`:"",w.message.includes(Dr)?"":` ${Dr}`]}),i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:K,children:"Retry"})]})]}):null,Ne=!!a.report,q=Ne?r_.report:r_.read_only,B=i.jsx(_n,{title:"Issues",description:"This repository's local issues: what agents and you reported, where triage placed each, and what fixes it.",actions:v.state==="ok"?i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",Rs(v.local.read_at)]}),i.jsxs(U,{type:"button",variant:"ghost",size:"sm",onClick:z,children:[i.jsx(zr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]}),Ne?i.jsxs(U,{type:"button",size:"sm",onClick:()=>f(!0),children:[i.jsx(Pa,{className:"mr-2 size-4","aria-hidden":"true"}),"Report an issue"]}):null]}):null}),Z=a.report?i.jsx(PG,{project:t,report:a.report,reportCollections:a.reportCollections,open:h,onOpenChange:f,onMaybeFiled:z,onFiled:W=>{z(),d(`/proj/${encodeURIComponent(t)}/issues/${encodeURIComponent(W.issue)}?${new URLSearchParams({from:"issues",reported:W.note}).toString()}`)}}):null;if(v.state==="engine_missing")return i.jsx(su,{ref:T,children:i.jsx(ji,{page:"Issues"})});if(v.state==="view_outdated")return i.jsxs(su,{ref:T,children:[B,i.jsxs(me,{variant:"warning",className:"mt-6",children:[i.jsx(Nt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:Lr}),i.jsx(pe,{children:P})]})]});if(v.state==="loading")return i.jsxs(su,{ref:T,children:[B,ke,ae,!w&&S===null?i.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading issues",children:Array.from({length:6},(W,_e)=>i.jsx(Tt,{className:_e===5?"h-10 w-2/3":"h-10 w-full"},_e))}):null]});const{list:Q,local:ie}=v,ce=!w&&S===null&&(v.key!==y||G!==m.search),$=a_(Mu(v.key)),F=ie.scope==="folder",ee=ie.listed===0&&!g,se=Math.max(0,ie.listed-ie.facets.owners.reduce((W,_e)=>W+_e.count,0)),ge=m.collection?((Ee=ie.collections.find(W=>W.collection===m.collection))==null?void 0:Ee.title)??m.collection:null,de=new Map;for(const W of Q.issues){const _e=W.group??"unplaced";de.set(_e,[...de.get(_e)??[],W])}return i.jsxs(su,{ref:T,children:[B,F&&ie.folder?i.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:["Issues of the folder ",ie.folder,", from its issue store."]}):null,Z,i.jsxs(me,{variant:"info",className:"mt-4",children:[Ne?i.jsx(pn,{className:"size-4","aria-hidden":"true"}):i.jsx(gd,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:q.title}),i.jsx(pe,{children:q.body})]}),ke,ae,ee?i.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[i.jsx(qM,{className:"text-muted-foreground size-8","aria-hidden":"true"}),i.jsx("h2",{className:"text-lg font-semibold",children:"No issues yet"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:RG(Ne)})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[i.jsx(yt,{ref:O,type:"search",className:"w-64","aria-label":"Search issues",placeholder:"Search issues",value:G,onChange:W=>A(W.target.value)}),i.jsxs(St,{value:m.owner??Xr,onValueChange:W=>D({owner:W===Xr?null:W}),children:[i.jsx(_t,{className:"w-56","aria-label":"Owner",children:i.jsx(Ct,{})}),i.jsxs(jt,{children:[i.jsx(Be,{value:Xr,children:"All owners"}),i.jsxs(Be,{value:VG,children:["Unowned (",se,")"]}),ie.facets.owners.map(W=>i.jsxs(Be,{value:W.key,children:[W.title," (",W.count,")"]},W.key))]})]}),i.jsxs(St,{value:m.label??Xr,onValueChange:W=>D({label:W===Xr?null:W}),children:[i.jsx(_t,{className:"w-48","aria-label":"Label",children:i.jsx(Ct,{})}),i.jsxs(jt,{children:[i.jsx(Be,{value:Xr,children:"All labels"}),ie.facets.labels.map(W=>i.jsxs(Be,{value:W.label,children:[W.label," (",W.count,")"]},W.label))]})]})]}),i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-2",children:[i.jsx("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":"Marks",children:i.jsx(d_,{pressed:m.urgent,count:ie.facets.urgent,onClick:()=>D({urgent:!m.urgent}),children:"Urgent"})}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":"Seen on",children:[i.jsx("span",{className:"text-muted-foreground text-xs",children:"Seen on"}),QD.map(W=>{const _e=m.seen.includes(W.key);return i.jsx(d_,{pressed:_e,count:ie.facets.seen[W.key],onClick:()=>D({seen:_e?m.seen.filter(He=>He!==W.key):[...m.seen,W.key]}),children:W.label},W.key)}),ge!==null?i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsxs("span",{"data-testid":"issues-collection-chip",className:we(vf({variant:"outline",size:"sm"}),I$),children:["Collection ",ge]}),i.jsx(U,{type:"button",variant:"ghost",size:"sm-icon","aria-label":"Remove the collection filter",onClick:()=>{var W;D({collection:null}),(W=O.current)==null||W.focus()},children:i.jsx(xd,{className:"size-4","aria-hidden":"true"})})]}):null]})]}),i.jsx("div",{role:"status","aria-live":"polite",children:ce?i.jsxs("p",{className:"text-muted-foreground mt-3 flex items-center gap-2 text-sm",children:[i.jsx(wn,{"aria-hidden":"true"}),"Searching…"]}):g&&Q.total>0?i.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:[Q.total," of ",ie.listed," issues ·"," ",i.jsx(U,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:H,children:"Clear"})]}):null}),i.jsx("div",{"data-testid":"issues-results","aria-busy":ce||void 0,className:"shrink-0 transition-opacity aria-busy:opacity-50",children:$&&Q.total===0?i.jsxs("p",{className:"mt-6 flex items-center gap-2 text-sm",children:[i.jsx(xf,{className:"text-muted-foreground size-4","aria-hidden":"true"}),"No issues match."," ",i.jsx(U,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:H,children:"Clear"})]}):i.jsxs(i.Fragment,{children:[!$&&ie.groups.length>0&&ie.groups.every(W=>W.key==="resolved")?i.jsx("p",{className:"text-muted-foreground mt-6 text-sm","data-testid":"issues-none-open",children:"No open issues."}):null,ie.groups.map(W=>i.jsx(qG,{id:`issues-${W.key}`,title:`${W.label} · ${W.count}`,issues:de.get(W.key)??[],folder:F,threads:o,fold:$?void 0:{folded:_G(p,W.key),whole:p.all.includes(W.key),onFold:_e=>C(jG(p,W.key,_e)),onWhole:_e=>C(NG(p,W.key,_e))},link:_e=>i.jsx(c,{className:"text-primary hover:underline",href:l(ve(_e.id)),children:_e.title})},W.key))]})}),!g&&ie.collections.length>0?i.jsxs("section",{className:"mt-8","aria-labelledby":"issues-collections-title",children:[i.jsxs("h2",{id:"issues-collections-title",className:"text-lg font-semibold",children:["Collections · ",ie.collections.length]}),i.jsx(wt,{className:"mt-2 shrink-0 overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Collections",className:"table-fixed",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{className:"w-1/2",children:"Collection"}),i.jsx(J,{className:"w-1/4",children:"Resolved"}),i.jsx(J,{className:"w-1/4",children:"Updated"})]})}),i.jsx(at,{children:ie.collections.map(W=>i.jsxs(ye,{children:[i.jsxs(X,{children:[i.jsx(c,{className:"text-primary hover:underline",href:l(re(io({...Xg,collection:W.collection},p))),children:W.title}),i.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:W.collection})]}),i.jsxs(X,{children:[W.resolved," of ",W.total," resolved"]}),i.jsx(X,{className:"text-muted-foreground",children:uc(W.updated_at)})]},W.collection))})]})})]}):null]})]})}const su=u.forwardRef(function({children:t},n){return i.jsx("div",{ref:n,className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 pb-8 sm:px-6 lg:px-8",children:t})}),FG={plain:{title:"w-[36%]",issue:"w-[10%]",project:"",status:"w-[16%]",urgent:"w-[8%]",owner:"w-[18%]",updated:"w-[12%]"},folder:{title:"w-[30%]",issue:"w-[10%]",project:"w-[12%]",status:"w-[16%]",urgent:"w-[8%]",owner:"w-[14%]",updated:"w-[12%]"},actions:{title:"w-[30%]",issue:"w-[9%]",project:"",status:"w-[14%]",urgent:"w-[7%]",owner:"w-[16%]",updated:"w-[10%]"},folderActions:{title:"w-[26%]",issue:"w-[8%]",project:"w-[11%]",status:"w-[13%]",urgent:"w-[7%]",owner:"w-[12%]",updated:"w-[9%]"}};function d_({pressed:e,count:t,onClick:n,children:s}){const[a,r]=u.useState(!1);return i.jsxs(U,{type:"button",variant:"outline",size:"sm",className:lc,"aria-pressed":e,disabled:t===0&&!e&&!a,onFocus:()=>r(!0),onBlur:()=>r(!1),onClick:n,children:[s," ",t]})}function qG({id:e,title:t,issues:n,folder:s,link:a,threads:r,fold:o}){const l=FG[r?s?"folderActions":"actions":s?"folder":"plain"],c=6+(s?1:0)+(r?1:0),d=`${e}-panel`,h=!(o!=null&&o.folded),f=o!==void 0&&!o.whole&&n.length>hp,m=f?n.slice(0,hp):n,p=h?hf:pd,[y,g]=u.useState(!1),b=o!==void 0&&(f||o.whole&&n.length>hp||y);return i.jsxs("section",{className:"mt-6","aria-labelledby":`${e}-title`,"data-testid":"issues-group",children:[i.jsx("h2",{id:`${e}-title`,className:"text-lg font-semibold",children:o?i.jsxs(U,{type:"button",variant:"ghost",size:"sm",className:"-ml-2 text-lg font-semibold","aria-expanded":h,"aria-controls":h?d:void 0,onClick:()=>o.onFold(h),children:[i.jsx(p,{className:"size-4","aria-hidden":"true"}),t]}):t}),h?i.jsxs("div",{id:d,children:[i.jsx(YG,{title:t,issues:m,folder:s,link:a,threads:r,widths:l,columns:c}),o&&b?i.jsx(U,{type:"button",variant:"link",size:"sm",className:"mt-1 px-0","aria-expanded":o.whole,"aria-describedby":`${e}-title`,onFocus:()=>g(!0),onBlur:()=>g(!1),onClick:()=>o.onWhole(!o.whole),children:o.whole?"Show fewer":`Show all ${n.length}`}):null]}):null]})}function YG({title:e,issues:t,folder:n,link:s,threads:a,widths:r,columns:o}){return i.jsx(i.Fragment,{children:i.jsx(wt,{className:"mt-2 shrink-0 overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:e,className:we("table-fixed",a&&"min-w-5xl"),children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{className:r.title,children:"Title"}),i.jsx(J,{className:r.issue,children:"Issue"}),n?i.jsx(J,{className:r.project,children:"Project"}):null,i.jsx(J,{className:r.status,children:"Status"}),i.jsx(J,{className:r.urgent,children:"Urgent"}),i.jsx(J,{className:r.owner,children:"Owner"}),i.jsx(J,{className:r.updated,children:"Updated"}),a?i.jsx(J,{className:"w-[14%] text-right",children:"Actions"}):null]})}),i.jsx(at,{children:t.map(l=>i.jsx(XG,{issue:l,folder:n,link:s,threads:a,columns:o},l.id))})]})})})}function XG({issue:e,folder:t,link:n,threads:s,columns:a}){var d;const{button:r,panel:o}=Wf({org:(s==null?void 0:s.org)??"",action:s?e.local_action:void 0,task_id:null,issue:e.id,open_thread:s==null?void 0:s.open_thread}),l=JD(e),c=[e.reported_by_you?"you reported":"",e.standing??""].filter(Boolean).join(" · ");return i.jsxs(i.Fragment,{children:[i.jsxs(ye,{"data-testid":"issues-row",className:o?"border-b-0":void 0,children:[i.jsxs(X,{className:"break-words",children:[n(e),c?i.jsx("div",{"data-testid":"issues-row-standing",className:"text-muted-foreground mt-0.5 text-xs",children:c}):null,(d=e.labels)!=null&&d.length?i.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.labels.map(h=>i.jsx(be,{variant:"neutral",size:"dense",children:h},h))}):null]}),i.jsx(X,{className:"font-mono text-xs",children:e.id}),t?i.jsx(X,{className:"break-words",children:e.project_id??"Folder"}):null,i.jsx(X,{children:i.jsx(be,{variant:l.tone,children:l.label})}),i.jsx(X,{children:e.urgent&&e.status!=="resolved"&&e.group!=="resolved"?i.jsx(be,{variant:"warning",children:"Urgent"}):null}),i.jsx(X,{className:"break-words",children:e.owner_title?e.owner_title:i.jsx("span",{className:"text-muted-foreground",children:"Unowned"})}),i.jsx(X,{className:"text-muted-foreground",children:uc(e.updated_at)}),s?i.jsx(X,{className:"text-right whitespace-nowrap",children:r}):null]}),o?i.jsx(ye,{"data-testid":"issues-row-panel",className:"hover:bg-transparent",children:i.jsx(X,{colSpan:a,className:"pt-0",children:i.jsx("div",{className:"max-w-180 pl-4 text-left whitespace-normal",children:o})})}):null]})}function KG(e){var t;return(t=Wn().issues)!=null&&t.issueSections?i.jsx(WG,{...e}):i.jsx(fG,{org:e.org,project:e.project,query:e.query})}function ZG({update:e,issue:t,open:n,onOpenChange:s,onDone:a,onReload:r}){const[o,l]=u.useState(t.title),[c,d]=u.useState(t.description),[h,f]=u.useState(t.external_reference??""),[m,p]=u.useState(t),[y,g]=u.useState(null),[b,v]=u.useState(!1);u.useEffect(()=>{n&&(l(t.title),d(t.description),f(t.external_reference??""),p(t),g(null))},[n]);const x=S=>{var k;return((k=y==null?void 0:y.personal_data)==null?void 0:k.field)===S?y.message:void 0},w=async S=>{S.preventDefault(),v(!0);const k=await e(m.id,m.revision,{title:o,description:c,external_reference:h.trim()||null});if(v(!1),!k.ok){g(k.refusal);return}a(k.data.issue)},_=async()=>{const S=await r();S&&(p(S),g(null))};return i.jsx(jn,{open:n,onOpenChange:s,children:i.jsx(Nn,{className:"sm:max-w-2xl",children:i.jsxs("form",{onSubmit:w,className:"grid gap-4",children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:"Edit issue"}),i.jsx(Dn,{children:"Text is shown exactly as entered."})]}),y!=null&&y.conflict?i.jsxs(me,{variant:"destructive",children:[i.jsx(rt,{}),i.jsx(pe,{children:"Someone else saved this issue after you opened it, so nothing was saved. Your text is kept below; reload the latest issue, then save to apply it."})]}):null,i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"maintain-edit-title",children:"Title"}),i.jsx(yt,{id:"maintain-edit-title",value:o,"aria-invalid":!!x("title"),onChange:S=>l(S.target.value)}),x("title")?i.jsx(Qn,{children:x("title")}):null]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"maintain-edit-description",children:"Description"}),i.jsx(Vn,{id:"maintain-edit-description",rows:4,value:c,"aria-invalid":!!x("description"),onChange:S=>d(S.target.value)}),x("description")?i.jsx(Qn,{children:x("description")}):null]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"maintain-edit-reference",children:"External reference"}),i.jsx(yt,{id:"maintain-edit-reference",value:h,"aria-invalid":!!x("external_reference"),onChange:S=>f(S.target.value)}),x("external_reference")?i.jsx(Qn,{children:x("external_reference")}):null]}),y&&!y.conflict&&!y.personal_data?i.jsx(Qn,{children:y.message}):null,i.jsxs(Sn,{children:[i.jsx(U,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),y!=null&&y.conflict?i.jsxs(U,{type:"button",variant:"outline",onClick:_,children:[i.jsx(zr,{className:"mr-2 size-4"}),"Reload latest"]}):null,i.jsx(U,{type:"submit",loading:b,disabled:!!(y!=null&&y.conflict),children:"Save"})]})]})})})}function u_(e){return e.map(t=>qD[t].toLowerCase()).join(", ")}function QG(e){switch(e.kind){case"created":return"Logged the issue";case"updated":return`Edited the ${u_(e.fields)}`;case"redacted":return`Redacted the ${u_(e.fields)}`;case"priority_set":return e.priority?`Set priority to ${Ic[e.priority]}`:"Cleared the priority";case"assigned":return`Assigned to ${e.assignee_id?e.assignee_username??"someone whose name is not available":"a former member"}`;case"unassigned":return"Unassigned the issue";case"transitioned":{if(e.from_status==="resolved"&&e.to_status==="open")return"Reopened the issue";const t=e.to_status?Eh[e.to_status]:"";return e.resolution_reason?`Moved to ${t}: ${pb[e.resolution_reason]}`:`Moved to ${t}`}}}function h_(e,t){return t==="external_reference"?e.external_reference??"":e[t]}function JG({redact:e,issue:t,open:n,onOpenChange:s,onDone:a,onReload:r}){const[o,l]=u.useState("description"),[c,d]=u.useState(""),[h,f]=u.useState(!1),[m,p]=u.useState(null),[y,g]=u.useState(t);u.useEffect(()=>{n&&(g(t),d(h_(t,o)),p(null))},[n]);const b=async v=>{v.preventDefault(),f(!0);const x=await e(y.id,y.revision,o,c);if(f(!1),!x.ok){if(x.refusal.conflict){const w=await r();w&&g(w),p("Someone else saved this issue after you opened it. The latest issue is loaded and your replacement is kept; redact again to apply it.");return}p(x.refusal.message);return}a(x.data.issue)};return i.jsx(jn,{open:n,onOpenChange:s,children:i.jsx(Nn,{className:"sm:max-w-2xl",children:i.jsxs("form",{onSubmit:b,className:"grid gap-4",children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:"Redact text"}),i.jsx(Dn,{children:"Replace text that holds personal data, such as a name."})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"maintain-redact-field",children:"Field"}),i.jsxs(St,{value:o,onValueChange:v=>{const x=v;l(x),d(h_(y,x))},children:[i.jsx(_t,{id:"maintain-redact-field",children:i.jsx(Ct,{})}),i.jsx(jt,{children:iG.map(v=>i.jsx(Be,{value:v,children:qD[v]},v))})]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"maintain-redact-replacement",children:"Replacement text"}),i.jsx(Vn,{id:"maintain-redact-replacement",rows:4,value:c,onChange:v=>d(v.target.value)})]}),i.jsxs(me,{variant:"warning",children:[i.jsx(Nt,{}),i.jsx(pe,{children:"This cannot be undone: the original text is removed for good. History records only that this field was redacted."})]}),m?i.jsx(Qn,{children:m}):null,i.jsxs(Sn,{children:[i.jsx(U,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),i.jsx(U,{type:"submit",variant:"destructive",loading:h,children:"Redact"})]})]})})})}function eH({transition:e,issue:t,open:n,onOpenChange:s,onDone:a}){const[r,o]=u.useState("fixed"),[l,c]=u.useState(!1),[d,h]=u.useState(null),f=async m=>{m.preventDefault(),c(!0);const p=await e(t.id,t.revision,"resolved",r);if(c(!1),!p.ok){if(p.refusal.conflict){a(null);return}h(p.refusal.message);return}h(null),a(p.data.issue)};return i.jsx(jn,{open:n,onOpenChange:s,children:i.jsx(Nn,{children:i.jsxs("form",{onSubmit:f,className:"grid gap-4",children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:"Resolve issue"}),i.jsx(Dn,{children:"Choose how this report ended."})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"maintain-resolution-reason",children:"Resolution reason *"}),i.jsxs(St,{value:r,onValueChange:m=>o(m),children:[i.jsx(_t,{id:"maintain-resolution-reason",children:i.jsx(Ct,{})}),i.jsx(jt,{children:sG.map(m=>i.jsx(Be,{value:m,children:pb[m]},m))})]}),i.jsx("p",{className:"text-muted-foreground text-xs",children:"Reopening the issue clears its reason."})]}),d?i.jsx(Qn,{children:d}):null,i.jsxs(Sn,{children:[i.jsx(U,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),i.jsx(U,{type:"submit",loading:l,children:"Resolve"})]})]})})})}const Kr="not_set";function tH({org:e,project:t,issue_id:n,query:s}){const a=YD(),r=XD(a),o=qg(e,t);return i.jsx("div",{className:"flex w-full flex-1 flex-col gap-6 px-4 py-4 sm:px-6 lg:px-8",children:i.jsx(KD,{access:r,header:i.jsx(_n,{title:"Support"}),back_href:o,children:l=>a?i.jsx(nH,{contract:a,issue_id:n,access:l,list_href:o,duplicates:Number(new URLSearchParams(s).get("duplicates")??0)}):null})})}function nH({contract:e,issue_id:t,access:n,list_href:s,duplicates:a}){const{href:r,Link:o}=lt(),l=Fa(),[c,d]=u.useState(null),[h,f]=u.useState([]),[m,p]=u.useState(!1),[y,g]=u.useState([]),[b,v]=u.useState(null),x=u.useCallback(async()=>{const j=await e.issue(t);return j.ok?(d(j.data.issue),f(j.data.events),j.data.issue):(j.refusal.status===404?p(!0):l.error(j.refusal.message),null)},[e,t,l]);u.useEffect(()=>{let j=!1;return e.issue(t).then(N=>{if(!j){if(!N.ok){N.refusal.status===404?p(!0):l.error(N.refusal.message);return}d(N.data.issue),f(N.data.events)}}),()=>{j=!0}},[e,t]),u.useEffect(()=>{n.can_change&&e.assigneeCandidates().then(j=>{j.ok&&g(j.data.candidates)})},[e,n.can_change]);const w=async j=>{const N=await j;if(!N.ok){l.error(N.refusal.message),N.refusal.conflict&&await x();return}await x()};if(m)return i.jsx(Ua,{title:"Support issue not found",description:"This issue does not exist in this project.",backHref:r(s),backLabel:"Back to Support",link:o});if(!c)return i.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading…"});const _=c.status==="closed",S=n.can_change,k=j=>w(e.transition(c.id,c.revision,j));return i.jsxs(i.Fragment,{children:[i.jsx(_n,{title:c.title,actions:S?i.jsxs(i.Fragment,{children:[_?null:i.jsxs(U,{variant:"outline",onClick:()=>v("edit"),children:[i.jsx(gf,{className:"mr-2 size-4"}),"Edit"]}),i.jsxs(U,{variant:"outline",onClick:()=>v("redact"),children:[i.jsx(TM,{className:"mr-2 size-4"}),"Redact"]}),c.status==="open"?i.jsx(U,{variant:"outline",disabled:!c.priority,"aria-description":c.priority?void 0:"Set a priority first.",onClick:()=>void k("triaged"),children:"Triage"}):null,c.status==="open"||c.status==="triaged"?i.jsxs(U,{onClick:()=>v("resolve"),children:[i.jsx(ff,{className:"mr-2 size-4"}),"Resolve"]}):null,c.status==="resolved"?i.jsxs(i.Fragment,{children:[i.jsxs(U,{variant:"outline",onClick:()=>void k("open"),children:[i.jsx(b$,{className:"mr-2 size-4"}),"Reopen"]}),i.jsx(U,{onClick:()=>void k("closed"),children:"Close"})]}):null]}):void 0,children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(be,{variant:FD[c.status],children:Eh[c.status]}),i.jsxs("span",{className:"text-muted-foreground text-xs",children:["Logged by ",oG(c)," ",zu(c.created_at)]})]})}),i.jsxs("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-6",children:[a>0&&c.external_reference?i.jsxs(me,{variant:"info",children:[i.jsx(pn,{}),i.jsxs(pe,{className:"flex flex-row flex-wrap items-center justify-between gap-2",children:[i.jsxs("span",{children:[c.external_reference," is already logged on"," ",a===1?"another issue":`${a} other issues`," in this project."]}),i.jsx(U,{asChild:!0,variant:"outline",size:"sm",children:i.jsx(o,{href:r(`${s}?external_reference=${encodeURIComponent(c.external_reference)}`),children:"Show both"})})]})]}):null,i.jsxs("section",{className:"flex flex-col gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:"Description"}),c.description?i.jsx("p",{className:"text-sm break-words whitespace-pre-wrap",children:c.description}):i.jsx("p",{className:"text-muted-foreground text-sm",children:"No description."})]}),i.jsxs("section",{className:"flex flex-col gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:"History"}),i.jsx("div",{className:"rounded-md border",children:i.jsxs(it,{children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"When"}),i.jsx(J,{children:"Who"}),i.jsx(J,{children:"What"})]})}),i.jsx(at,{children:h.map(j=>i.jsxs(ye,{children:[i.jsx(X,{className:"text-muted-foreground",children:zu(j.created_at)}),i.jsx(X,{children:lG(j,c)}),i.jsx(X,{children:QG(j)})]},j.id))})]})})]})]}),i.jsxs("aside",{className:"flex w-full shrink-0 flex-col gap-5 lg:w-72",children:[i.jsx(Tl,{label:"External reference",children:c.external_reference?i.jsx("span",{className:"font-mono text-sm",children:c.external_reference}):i.jsx("span",{className:"text-muted-foreground text-sm",children:"None"})}),c.resolution_reason?i.jsx(Tl,{label:"Resolution",children:i.jsx("span",{className:"text-sm",children:pb[c.resolution_reason]})}):null,i.jsx(Tl,{label:"Priority",id:"maintain-issue-priority",children:i.jsxs(St,{value:c.priority??Kr,disabled:!S||_,onValueChange:j=>void w(e.update(c.id,c.revision,{priority:j===Kr?null:j})),children:[i.jsx(_t,{id:"maintain-issue-priority",children:i.jsx(Ct,{})}),i.jsxs(jt,{children:[i.jsx(Be,{value:Kr,children:"Not set"}),mb.map(j=>i.jsx(Be,{value:j,children:Ic[j]},j))]})]})}),i.jsxs(Tl,{label:"Assignee",id:"maintain-issue-assignee",children:[i.jsxs(St,{value:c.assignee_id??Kr,disabled:!S||_,onValueChange:j=>void w(e.assign(c.id,c.revision,j===Kr?null:j)),children:[i.jsx(_t,{id:"maintain-issue-assignee",children:i.jsx(Ct,{})}),i.jsxs(jt,{children:[i.jsx(Be,{value:Kr,children:"Not set"}),c.assignee_id&&!y.some(j=>j.user_id===c.assignee_id)?i.jsx(Be,{value:c.assignee_id,children:gb(c.assignee_id,c.assignee_username)}):null,y.map(j=>i.jsx(Be,{value:j.user_id,children:j.username??"Not available"},j.user_id))]})]}),c.assignee_can_act===!1?i.jsx(be,{variant:"error",className:"self-start",children:"Assignee cannot act"}):null]}),i.jsx(Tl,{label:"Updated",children:i.jsx("span",{className:"text-sm",children:zu(c.updated_at)})})]})]}),i.jsx(ZG,{update:e.update,issue:c,open:b==="edit",onOpenChange:j=>v(j?"edit":null),onReload:x,onDone:()=>{v(null),x()}}),i.jsx(JG,{redact:e.redact,issue:c,open:b==="redact",onOpenChange:j=>v(j?"redact":null),onReload:x,onDone:()=>{v(null),l.success("The text was redacted."),x()}}),i.jsx(eH,{transition:e.transition,issue:c,open:b==="resolve",onOpenChange:j=>v(j?"resolve":null),onDone:j=>{v(null),j||l.error("Someone else changed this issue; it is reloaded."),x()}})]})}function Tl({label:e,id:t,children:n}){return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[t?i.jsx("label",{htmlFor:t,className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:e}):i.jsx("span",{className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:e}),n]})}const sH=10,iH=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,f_=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/;function aH(e,t,n,s=""){const a=n!=null&&n.startsWith("task:")?n.slice(5):null;if(a&&iH.test(a))return{label:a,path:`/org/${e}/tasks/${a}`};const r=`/proj/${encodeURIComponent(t)}/releases`,o=n!=null&&n.startsWith("release:")?n.slice(8):null;if(o&&f_.test(o))return{label:o==="candidate"?"Candidate":o,path:`${r}?release=${encodeURIComponent(o)}`};const l=n!=null&&n.startsWith("planned:")?n.slice(8):null;if(l&&f_.test(l))return{label:l,path:`${r}?planned=${encodeURIComponent(l)}`};const c=io(Mu(s),tE(s));return{label:"Issues",path:`/proj/${encodeURIComponent(t)}/issues${c?`?${c}`:""}`}}const rH=["Fixed in","Being fixed in","The release planned to fix it"];function oH(e){const t=e.filter(n=>n.kind==="release");for(const n of rH){const s=t.find(a=>a.relation===n);if(s)return s}return t[0]??null}function lH(e,t){const n=e.filter(s=>s.kind==="thread"&&(s.label===t||s.id===t));return n.find(s=>s.owns)??n[0]??null}function cH(e,t){const n=e.toLowerCase();return n==="file"&&t.trim()?{kind:"file",path:t}:n==="commit"&&/^[0-9a-f]{7,40}$/i.test(t)?{kind:"commit",sha:t}:null}function dH({org:e,project:t,issue_id:n,from:s,query:a=""}){var gn,Mn,xe;const r=aE(),{href:o,Link:l}=lt(),c=aH(e,t,s,a),d=IG(a,n),h=`/proj/${encodeURIComponent(t)}/issues`,f=ne=>`${h}/${encodeURIComponent(ne)}`,m=ne=>`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(ne)}`,p=ne=>`/proj/${encodeURIComponent(t)}/releases?${ne.planned?"planned":"release"}=${encodeURIComponent(ne.id)}`,[y,g]=u.useState({state:"loading"}),[b,v]=u.useState(null),[x,w]=u.useState(null),[_,S]=u.useState({state:"loading"}),[k,j]=u.useState({state:"loading"}),[N,O]=u.useState(null),T=u.useRef(0),P=u.useCallback(async ne=>{if(!r.openAnchor)return;const Se=ne.kind==="file"?ne.path:ne.sha,Ye=T.current+=1;O({value:Se,state:"opening",words:`Opening ${Se}…`});const nt=await r.openAnchor(ne);Ye===T.current&&O(nt.ok?{value:Se,state:"opened",words:`Opened ${Se} in ${nt.data.with}`}:{value:Se,state:"failed",words:`Could not open ${Se}: ${nt.refusal.message}`})},[r]);u.useEffect(()=>{T.current+=1,O(null)},[n]);const L=u.useRef(null),G=is(),A=u.useRef(null),D=u.useRef(!1),C=u.useRef(0),R=u.useRef(0),E=u.useRef(!1),M=Os(),H=u.useRef(0),z=u.useRef(0),K=u.useCallback(async(ne=!1)=>{if(!r.issueSections)return;const Se=H.current+=1;ne||S({state:"loading"});const Ye=await M.track(r.issueSections(n));Se===H.current&&S(nt=>Ye.ok?{state:"ok",data:Ye.data}:ne&&nt.state==="ok"?nt:{state:"failed",refusal:Ye.refusal})},[r.issueSections,n,M]),oe=u.useCallback(async(ne=!1)=>{if(!r.issueRelated)return;const Se=z.current+=1;ne||j({state:"loading"});const Ye=await M.track(r.issueRelated(n));Se===z.current&&j(nt=>Ye.ok?{state:"ok",data:Ye.data}:ne&&nt.state==="ok"?nt:{state:"failed",refusal:Ye.refusal})},[r.issueRelated,n,M]),re=u.useCallback(async(ne=!1)=>{const Se=R.current+=1;if(w(null),!xG.test(n)){g({state:"missing"});return}K(ne),oe(ne);const Ye=await M.track(r.issue(n));if(Se!==R.current)return;if(Ye.ok){C.current=0,v(null),g({state:"ok",issue:Ye.data.issue,events:Ye.data.events,at:new Date().toISOString()});return}const nt=Ye.refusal.reason;if(Ye.refusal.status===404||nt==="not_found")return g({state:"missing"});if(nt==="engine_missing")return g({state:"engine_missing",refusal:Ye.refusal});if(nt==="view_outdated")return g({state:"view_outdated"});if(C.current+=1,C.current===1&&BD(Ye.refusal)){E.current=ne,w(Ye.refusal.retry_after??sH);return}v(Ye.refusal)},[r.issue,n,K,oe,M]);u.useEffect(()=>{re()},[re]);const ve=u.useMemo(()=>Ff(M,()=>void re(!0)),[re,M]);qi(ve,iE),u.useEffect(()=>{if(x===null)return;const ne=setTimeout(()=>{document.visibilityState==="visible"&&re(E.current)},x*1e3);return()=>clearTimeout(ne)},[x,re]),u.useEffect(()=>{var Se;if(D.current||y.state!=="ok")return;D.current=!0;const ne=(Se=L.current)==null?void 0:Se.querySelector("h1");ne&&(ne.tabIndex=-1,ne.focus())},[y.state]);const ke=u.useRef(null);u.useEffect(()=>{var Ye;const ne=ke.current;if(ne===null||(ne==="sections"?_:k).state==="loading")return;ke.current=null;const Se=(ne==="related"?A.current:null)??((Ye=L.current)==null?void 0:Ye.querySelector("h1"));Se==null||Se.focus()},[_,k]);const ae=ne=>{ke.current=ne,ne==="sections"?K():oe()},Ne=()=>{C.current=0,re()},q=hb(L),B=u.useRef(!1),Z=()=>{B.current=!0,Ne()};u.useEffect(()=>{var Se;if(!B.current||y.state==="loading"||x!==null)return;B.current=!1;const ne=(Se=L.current)==null?void 0:Se.querySelector("h1");ne&&(ne.tabIndex=-1,ne.focus())},[y,b,x]);const Q=Wf({org:e,labelled:!0,action:(gn=r.commands)!=null&&gn.open_thread&&y.state==="ok"?y.issue.local_action:void 0,task_id:null,issue:n,open_thread:(Mn=r.commands)==null?void 0:Mn.open_thread});if(y.state==="missing")return i.jsx(xa,{children:i.jsx(Ua,{icon:i.jsx(xf,{"aria-hidden":"true"}),title:"Issue not found",description:`No issue ${n} in this repository's issue store.`,backHref:o(s==="issues"?c.path:h),backLabel:"Back to issues",link:l})});const ie=i.jsx(U,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:i.jsxs(l,{href:o(c.path),children:[i.jsx(AS,{className:"size-4","aria-hidden":"true"}),c.label]})});if(y.state==="engine_missing"||y.state==="view_outdated")return i.jsx(xa,{children:y.state==="engine_missing"?i.jsx(ji,{page:"Issue",header:i.jsx(dc,{back:ie,id:null,title:n})}):i.jsxs(i.Fragment,{children:[i.jsx(dc,{back:ie,id:null,title:n}),i.jsxs(me,{variant:"warning",className:"mt-4",children:[i.jsx(Nt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:Lr}),i.jsx(pe,{children:G})]})]})});const ce=b?i.jsxs(me,{ref:q,variant:"destructive",className:"mt-4",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"This issue could not be loaded"}),i.jsxs(pe,{children:[i.jsxs("p",{children:[b.message,b.since?` Since ${Rs(b.since)}.`:"",y.state==="ok"?` This page was read at ${Rs(y.at)}.`:"",b.message.includes(Dr)?"":` ${Dr}`]}),i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:Z,children:"Retry"})]})]}):null,$=i.jsx("div",{role:"status","aria-live":"polite",children:x!==null?i.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[i.jsx(wn,{"aria-hidden":"true"}),"This issue is busy. Reading it again…"]}):null});if(y.state==="loading")return i.jsxs(xa,{children:[i.jsx("div",{children:ie}),$,ce,!b&&x===null?i.jsxs("div",{className:"mt-4 grid gap-3",role:"status","aria-label":"Loading issue",children:[i.jsx(Tt,{className:"h-6 w-40"}),i.jsx(Tt,{className:"h-9 w-2/3"}),i.jsx(Tt,{className:"h-24 w-full"})]}):null]});const{issue:F,events:ee,at:se}=y,ge=JD(F),de=_.state==="ok"?_.data:null,Le=(de==null?void 0:de.reporter)??F.created_by_username??null,Ee=k.state==="ok"?oH(k.data):null,W=F.status==="resolved"||F.group==="resolved",_e=!!(de!=null&&de.duplicate_of),He=(de==null?void 0:de.routing.owner)??F.owner_title??null,Dt=He&&k.state==="ok"?lH(k.data,He):null,en=_.state==="loading"?"Loading…":Dt?i.jsx(l,{className:"text-primary hover:underline",href:o(m(Dt.id)),children:He}):He??i.jsx("span",{className:"text-muted-foreground",children:"Unowned"}),zt=ne=>`${h}?${xb({...Xg,collection:ne})}`,tt=de==null?void 0:de.report,ft=!!(tt&&(tt.actual||tt.expected||tt.steps.length||tt.where)),It=[...ee].reverse(),zn=i.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[Q.button,i.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",Rs(se)]}),i.jsxs(U,{type:"button",variant:"ghost",size:"sm",onClick:Ne,children:[i.jsx(zr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return i.jsx(xa,{children:i.jsxs("div",{ref:L,className:"contents",children:[i.jsx(dc,{back:ie,id:F.id,badge:i.jsxs(i.Fragment,{children:[i.jsx(be,{variant:ge.tone,children:ge.label}),F.urgent&&!W?i.jsx(be,{variant:"warning",children:"Urgent"}):null]}),title:F.title,created:`Reported${Le?` by ${Le}`:""} · ${uc(F.created_at)}`,actions:zn}),de!=null&&de.duplicate_of?i.jsxs("p",{className:"mt-1 text-sm",children:["Duplicate of"," ",i.jsx(l,{className:"text-primary font-mono hover:underline",href:o(f(de.duplicate_of)),children:de.duplicate_of})]}):null,Q.panel?i.jsx("div",{className:"mt-1 max-w-180",children:Q.panel}):null,i.jsx("div",{role:"status","aria-live":"polite",children:d?i.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:d}):null}),$,ce,_.state==="loading"?i.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",role:"status",children:[i.jsx(wn,{"aria-hidden":"true"}),"Loading the issue's sections"]}):null,i.jsxs("dl",{className:"mt-4 mb-0 flex flex-wrap gap-x-12 gap-y-4","data-testid":"issue-facts",children:[i.jsx(li,{label:"Owner",value:en}),_e?null:i.jsx(li,{label:"Release",value:k.state==="loading"?"Loading…":Ee?i.jsx(l,{className:we("text-primary hover:underline",Ee.label===Ee.id&&"font-mono"),href:o(p(Ee)),children:Ee.label}):i.jsx("span",{className:"text-muted-foreground",children:"No release yet"})}),i.jsx(li,{label:"Reported",value:[Le,F.created_at?Ts(F.created_at):null].filter(Boolean).join(" · ")})]}),i.jsxs(me,{variant:"info",className:"mt-4",children:[i.jsx(gd,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:o_.title}),i.jsx(pe,{children:o_.body})]}),_.state==="failed"?i.jsx("div",{className:"mt-6",children:i.jsx(fb,{what:"this issue's sections",again:"Read the issue again",refusal:_.refusal,on_retry:()=>ae("sections")})}):null,de&&ft&&tt?i.jsxs(Kt,{id:"issue-report",title:"What happens",children:[tt.actual?i.jsx("p",{className:"text-sm whitespace-pre-wrap",children:tt.actual}):null,tt.expected?i.jsxs("div",{className:"mt-3",children:[i.jsx("h3",{className:"text-sm font-semibold",children:"Expected"}),i.jsx("p",{className:"text-sm whitespace-pre-wrap",children:tt.expected})]}):null,tt.steps.length?i.jsxs("div",{className:"mt-3",children:[i.jsx("h3",{className:"text-sm font-semibold",children:"Steps"}),i.jsx("ol",{className:"list-decimal pl-5 text-sm",children:tt.steps.map((ne,Se)=>i.jsx("li",{children:ne},Se))})]}):null,(xe=tt.where)!=null&&xe.env?i.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:["Seen on ",tt.where.env,tt.where.sha?i.jsxs(i.Fragment,{children:[" ","at ",i.jsx("span",{className:"font-mono",children:tt.where.sha})]}):null]}):null]}):null,de&&(de.placement.placed||de.placement.unplaced_why)?i.jsx(Kt,{id:"issue-placement",title:"Placement",children:de.placement.placed?i.jsxs("p",{className:"text-sm",children:["Placed in ",de.placement.placed]}):i.jsxs(me,{variant:"warning",children:[i.jsx(Nt,{className:"size-4","aria-hidden":"true"}),i.jsxs(je,{children:["Not placed yet: ",de.placement.unplaced_why]})]})}):null,de&&(de.routing.route||de.routing.owner||de.routing.none)?i.jsxs(Kt,{id:"issue-routing",title:"Routing",children:[de.routing.route?i.jsx("p",{className:"text-sm",children:de.routing.route}):null,de.routing.owner?i.jsxs("p",{className:"text-sm",children:["Owner: ",de.routing.owner]}):i.jsx("p",{className:"text-muted-foreground text-sm",children:"Owner: none yet"})]}):null,de&&(de.labels.length>0||de.collections.length>0)?i.jsxs(Kt,{id:"issue-labels",title:"Labels and collections",children:[de.labels.length?i.jsx("div",{className:"flex flex-wrap gap-1",children:de.labels.map(ne=>i.jsx(be,{variant:"neutral",size:"dense",children:ne},ne))}):null,de.collections.length?i.jsx("ul",{className:"mt-2 grid gap-1 text-sm",children:de.collections.map(ne=>i.jsxs("li",{children:[i.jsx(l,{className:"text-primary hover:underline",href:o(zt(ne.collection)),children:ne.title}),ne.ref?i.jsxs("span",{className:"text-muted-foreground",children:[" · ",ne.ref]}):null,i.jsxs("span",{className:"text-muted-foreground",children:[" ","· ",ne.resolved," of ",ne.total," resolved"]})]},ne.collection))}):null]}):null,de&&de.anchors.length>0?i.jsxs(Kt,{id:"issue-anchors",title:"Anchors",children:[i.jsx(gp,{label:"Anchors",heads:["Kind","Value","By"],rows:de.anchors.map(ne=>{const Se=r.openAnchor?cH(ne.kind,ne.value):null;return[ne.kind,Se?i.jsx(U,{type:"button",variant:"link",size:"control",className:"h-auto min-h-7 justify-start px-0 text-left font-mono text-xs font-normal break-all whitespace-normal","aria-label":Se.kind==="file"?`Open ${ne.value}`:`Show commit ${ne.value}`,onClick:()=>void P(Se),children:ne.value}):i.jsx("span",{className:"font-mono text-xs break-all",children:ne.value}),ne.by??""]})}),r.openAnchor?i.jsx("p",{role:"status","aria-live":"polite","data-testid":"issue-anchor-status",className:we("mt-2 text-sm empty:hidden",(N==null?void 0:N.state)==="failed"?"text-destructive":(N==null?void 0:N.state)==="opened"?"text-success":"text-muted-foreground"),children:(N==null?void 0:N.words)??""}):null]}):null,de&&de.seen.length>0?i.jsx(Kt,{id:"issue-seen",title:"Seen",aside:`${de.seen.length} of ${Math.max(F.occurrences??0,de.seen.length)} sightings`,children:i.jsx(gp,{label:"Seen",heads:["When","Where","Who","Note"],rows:de.seen.map(ne=>[uc(ne.at),i.jsxs(i.Fragment,{children:[ne.sha?i.jsx("div",{className:"font-mono text-xs",children:ne.sha}):null,ne.env?i.jsx("div",{className:"text-muted-foreground text-xs",children:ne.env}):null]}),ne.who??"",ne.note??""])})}):null,It.length>0?i.jsx(Kt,{id:"issue-history",title:"History",aside:"From the issue store, newest first",children:i.jsx(gp,{label:"History",heads:["When","Who","What"],rows:It.map(ne=>[uc(ne.created_at),ne.actor_username??"",EG(ne.note,ne.kind)])})}):null,i.jsx(WD,{id:"issue-related",related:k,heading_ref:A,on_retry:()=>ae("related"),fixed:!0,link:ne=>{const Se=ne.kind==="thread"?m(ne.id):ne.kind==="task"?`/org/${e}/tasks/${encodeURIComponent(ne.id)}?from=issue:${F.id}`:ne.kind==="issue"?f(ne.id):ne.kind==="release"?p(ne):null;if(ne.kind==="task"&&Se){const Ye=AG(ne.label);return i.jsxs("div",{className:"min-w-0",children:[i.jsx(l,{className:"text-primary font-mono text-xs hover:underline",href:o(Se),children:ne.id}),Ye&&Ye!==ne.id?i.jsx("div",{className:"text-muted-foreground line-clamp-1 text-xs",title:Ye,"data-testid":"related-task-title",children:Ye}):null]})}return Se?i.jsx(l,{className:we("text-primary hover:underline",ne.kind!=="thread"&&ne.label===ne.id&&"font-mono"),href:o(Se),children:ne.label}):ne.label}})]})})}function gp({label:e,heads:t,rows:n}){return i.jsx(wt,{className:"overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:e,children:[i.jsx(ot,{children:i.jsx(ye,{children:t.map(s=>i.jsx(J,{children:s},s))})}),i.jsx(at,{children:n.map((s,a)=>i.jsx(ye,{children:s.map((r,o)=>i.jsx(X,{className:"break-words",children:r},o))},a))})]})})}function uH({org:e,project:t,issue_id:n,from:s,query:a}){var r;return(r=Wn().issues)!=null&&r.issueSections?i.jsx(dH,{org:e,project:t,issue_id:n,from:s,query:a}):i.jsx(tH,{org:e,project:t,issue_id:n,query:a})}const gi={label:"Stalled",tone:"error"},hH="A stalled turn passes on at the next queue command.",fH=e=>e.charAt(0).toUpperCase()+e.slice(1);function mH(e){return e==="starts now"?"Now":e==="rides the same deploy"?"With the same deploy":fH(e.replace(/^starts /,""))}const pH=e=>e.replace(/ after its turn came$/," after its turn"),rE={integration:"Integration",deploy:"Deploy",publish:"Publish",accept:"Accept",custom:"Custom"},gH={self_service:"Self-service",managed:"Managed",manager_only:"Manager only"},xH={self_service:"Self-service: each entry takes its own turn",managed:"Managed: a manager batches entries that allow it",manager_only:"Manager only: the manager runs every turn"},vH={in_batch:{label:"In the batch",tone:"info"},done:{label:"Done",tone:"success"},failed:{label:"Failed",tone:"error"},released:{label:"Released",tone:"neutral"},left:{label:"Left",tone:"neutral"},gone:{label:"Ended",tone:"neutral"},skipped:{label:"Skipped",tone:"neutral"},lapsed:{label:"Lapsed",tone:"warning"}};function bH(e){return vH[e??"in_batch"]}function yH(e,t=!1){if(t)return gi;const n=e.turn==="next",s=n?"Next":"Waiting",a=e.batching==="managed"||e.batching==="released"?` · ${e.batching}`:"";return{label:`${s}${a}`,tone:n?"info":"neutral"}}const oE=(e,t)=>`Holds ${e.toLowerCase()}${t?`: ${t}`:""}`;function wH(e,t,n,s=!0,a=!1){return a?gi:e.fixing_since!==void 0?{label:`Fixing forward since ${Zn(e.fixing_since)}`,tone:"warning"}:e.ref===t?{label:"Landing",tone:"info"}:s&&e.hold?{label:oE(n),tone:"info"}:{label:"Running",tone:"info"}}function Zn(e){return new Date(e*1e3).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Zr(e){const t=Math.round(e/60);if(t<60)return`${t} min`;const n=Math.floor(t/60),s=t%60;return s?`${n} h ${s} min`:`${n} h`}function _H(e){var n;const t=e.binding;return(t==null?void 0:t.kind)==="repository_branch"?`${t.repository} · ${t.branch}`:(t==null?void 0:t.kind)==="label"?t.label:((n=e.layer)==null?void 0:n.kind)==="release"&&e.layer.promotes_to?`Promotes to ${e.layer.promotes_to}`:null}function jH(e,t){switch(e.kind){case"any_thread":return"Any thread in this checkout";case"task_writers":return"Anyone who can edit the entry's task";case"any_joiner":return"Anyone who may join";case"managers":return"Whoever may manage";case"admins":return"Workspace admins";case"none":return"Nobody";case"listed":{const n=e.users.map(t),s=e.teams.length;return s&&n.push(s===1?"1 team":`${s} teams`),n.length?n.join(", "):"Nobody"}}}function NH(e,t){var l,c;const{policy:n,management:s}=e,a=(l=e.layer)==null?void 0:l.kind,r=d=>jH(d,t),o=[["Mode",xH[s.mode]],["Who can join",r(s.joiners)]];return a==="implement"&&o.push(["Managers",r(s.managers)],["Manager lease",Zr(s.manager_lease_seconds)],["Batches",n.batch.enabled?`Up to ${n.batch.max_members} entries`:"Off"]),((c=e.layer)==null?void 0:c.kind)==="release"&&(e.layer.promotes_to&&o.push(["Promotes to",e.layer.promotes_to]),o.push(["Carries waiting entries",n.ride?"Yes: a done turn carries entries already contained in it":"No"],["Freeze",n.freeze.enabled?`Up to ${Zr(n.freeze.max_seconds)}, ${Zr(n.freeze.default_seconds)} by default`+(e.layer.freezers?` · ${r(e.layer.freezers)}`:""):"Off"],["Fix forward",n.fix_forward?"Yes: a failed turn keeps its turn until fixed":"No"],["Stalled turns",s.stall_takers.kind==="none"?"Nobody takes one":`${r(s.stall_takers)} may take one after ${Zr(n.stall_seconds)}`])),o.push(["Reorder",r(s.reorderers)]),n.max_turns>1&&o.push(["Turns at once",`Up to ${n.max_turns} independent turns`]),o.push(["Turn lease",Zr(n.lease_seconds)],["Time to start",`${Zr(n.start_grace_seconds)} after the turn comes`]),n.entry_limit!==null&&o.push(["Waiting entries",`Up to ${n.entry_limit}`]),n.footprint!=="off"&&o.push(["Footprint",n.footprint==="required"?"Required":"Optional"]),o}const Ah="heavy",lE="Heavy checks",kH="Every worktree, admitted by memory",SH="Typechecks, builds, test suites and dev servers from every worktree of this repository wait here for memory.",CH="A smaller turn may pass one that does not fit, so the order can change; a passing turn reused on identical code never waits.",DH="Heavy checks are admitted by this machine's memory; there are no settings here.",cE="Where your organization's agents take turns at a shared branch, environment or proposal. One turn runs at a time in each queue.",dE="A task you cannot see",EH="A former member",AH="A member";function uE(){const e=Wn().queues;if(!e)throw new Error("The Queues page rendered without the queues seam.");return e}function RH({org:e,open:t,path:n}){var f,m;const s=uE(),{href:a,Link:r}=lt(),o=s.availability,[l,c]=u.useState({state:"loading"}),d=u.useCallback(async p=>{o&&(p&&c({state:"loading"}),c(await o({fresh:p})))},[o]);u.useEffect(()=>{d(!1)},[d]);const h=!o||l.state==="active";return l.state==="off"&&((f=l.refusal)==null?void 0:f.reason)!=="engine_missing"?i.jsx(Ua,{title:"Page not found",description:"This page does not exist, or you do not have access to it.",backHref:a(`/org/${e}`),backLabel:"Back to the organization",link:r}):i.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:h?i.jsx(OH,{org:e,open:t??null,path:n??`/org/${e}/tasks/queues`}):l.state==="off"&&((m=l.refusal)==null?void 0:m.reason)==="engine_missing"?i.jsx(ji,{page:"Queues"}):i.jsxs(i.Fragment,{children:[i.jsx(_n,{title:"Queues",description:s.description??cE}),l.state==="loading"&&i.jsx(hE,{}),(l.state==="error"||l.state==="off")&&i.jsx($u,{refusal:l.refusal,on_retry:()=>void d(!0)}),l.state==="available"&&i.jsxs(me,{variant:"info",className:"mt-6",children:[i.jsx(pn,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Tasks are not on for this organization"}),i.jsxs(pe,{children:["Queues hold turns for tasks, so they show once Tasks are on."," ",i.jsx(r,{className:"text-primary hover:underline",href:a(`/org/${e}/tasks`),children:"Go to Tasks"})]})]})]})})}function hE(){return i.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading queues",children:Array.from({length:3},(e,t)=>i.jsx(Tt,{className:t===2?"h-10 w-2/3":"h-10 w-full"},t))})}function $u({refusal:e,on_retry:t}){const n=is();return(e==null?void 0:e.reason)==="store_locked"?i.jsxs(me,{variant:"info",className:"mt-6",children:[i.jsx(pn,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"The local stores are busy"}),i.jsxs(pe,{children:[i.jsx("p",{children:e.message}),i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]}):(e==null?void 0:e.reason)==="view_outdated"?i.jsxs(me,{variant:"warning",className:"mt-6",children:[i.jsx(Nt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:Lr}),i.jsx(pe,{children:n})]}):i.jsxs(me,{variant:"destructive",className:"mt-6",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Queues could not be loaded"}),i.jsxs(pe,{children:[i.jsx("p",{children:"The read did not answer. Try again in a moment."}),i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}const xp=e=>e.status===404||e.reason==="not_found"||e.code==="not_found";function TH(e,t,n,s){return t?e===null?`Not reading · trying again every ${n}s`:`Not reading since ${Zn(e)} · trying again every ${n}s`:e===null?"Connecting…":`Live · read ${Zn(e)} · refreshes every ${n}s${s?` · ${s}`:""}`}function OH({org:e,open:t,path:n}){var $;const{listQueues:s,queue:a,members:r,refresh_ms:o,settings_note:l,description:c,read_scope:d,subject_label:h="Task",thread_subjects:f=!1,timing:m}=uE(),{self_id:p}=Uf(),y=!!m&&t===Ah,[g,b]=u.useState(null),[v,x]=u.useState(null),[w,_]=u.useState(null),[S,k]=u.useState(null),[j,N]=u.useState({state:"pending",members:[]});u.useEffect(()=>{let F=!0;return r().then(ee=>{F&&N(se=>ee.ok?{state:"answered",members:ee.data}:{state:"failed",members:se.members})}),()=>{F=!1}},[r]);const O=u.useMemo(()=>new Map(j.members.map(F=>[F.user_id,F])),[j.members]),T=j.state==="answered"?EH:AH,P=u.useCallback((F,ee)=>{var se;return(ee==null?void 0:ee.title)??(f?(ee==null?void 0:ee.id)??F:F===p?"You":((se=O.get(F))==null?void 0:se.label)??T)},[O,T,p,f]),L=u.useRef({list:{last:null,fresh:!1},detail:{last:null,fresh:!1}}),[G,A]=u.useState(null),[D,C]=u.useState(!1),R=u.useCallback((F,ee)=>{L.current[F]={last:ee,fresh:!0};const{list:se,detail:ge}=L.current;C(se.last==="failed"||ge.last==="failed"),se.fresh&&ge.fresh&&se.last==="ok"&&ge.last==="ok"&&A(Date.now()/1e3)},[]),E=t??(($=g==null?void 0:g.queues[0])==null?void 0:$.id)??null,M=u.useRef(E);u.useEffect(()=>{M.current=E},[E]);const H=u.useRef(0),z=u.useCallback(async()=>{var se;const F=H.current+=1;L.current.list.fresh=!1;const ee=await s();if(F===H.current)if(ee.ok){if(b(ee.data),x(null),!t){const ge=((se=ee.data.queues[0])==null?void 0:se.id)??null;ge===null?L.current.detail={last:"ok",fresh:!0}:ge!==M.current&&(L.current.detail.fresh=!1)}R("list","ok")}else x(ee.refusal),R("list","failed")},[s,t,R]),K=u.useRef(0),oe=u.useCallback(async()=>{const F=K.current+=1;if(!E)return;if(y){L.current.detail.fresh=!1;return}L.current.detail.fresh=!1;const ee=await a(E);F===K.current&&(ee.ok?(_(ee.data),k(null),R("detail","ok")):(k(ee.refusal),xp(ee.refusal)&&_(null),R("detail",xp(ee.refusal)?"ok":"failed")))},[y,E,a,R]),[re,ve]=u.useState({state:"pending",data:null}),ke=u.useRef(0),ae=u.useCallback(async()=>{if(!m)return;const F=ke.current+=1,ee=await m();F===ke.current&&(ve(ee.ok?{state:"answered",data:ee.data}:{state:"failed",data:null}),y&&R("detail",ee.ok?"ok":"failed"))},[m,y,R]);u.useEffect(()=>{z()},[z]),u.useEffect(()=>{_(null),k(null),oe()},[oe]),u.useEffect(()=>{ae()},[ae]);const Ne=u.useCallback(()=>{z(),oe(),ae()},[z,oe,ae]),q=u.useMemo(()=>{var F;return new Map((((F=re.data)==null?void 0:F.queues)??[]).map(ee=>[ee.key,ee]))},[re.data]),B=q.get(Ah),Z=!g&&(v==null?void 0:v.reason)==="engine_missing",Q=u.useCallback(()=>{Z||Ne()},[Z,Ne]);if(qi(Q,o),Z)return i.jsx(ji,{page:"Queues"});const ie=Math.round(o/1e3),ce=S!==null&&xp(S);return i.jsxs(i.Fragment,{children:[i.jsxs(_n,{title:"Queues",description:c??cE,children:[i.jsx("p",{className:"text-muted-foreground text-xs",children:TH(G,D,ie,d)}),i.jsx("span",{className:"sr-only",role:"status",children:D?"Not reading":G===null?"Connecting":"Live"})]}),!g&&!v&&i.jsx(hE,{}),!g&&v&&i.jsx($u,{refusal:v,on_retry:Ne}),g&&g.queues.length===0?i.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[i.jsx(Ev,{className:"text-muted-foreground size-8","aria-hidden":"true"}),i.jsx("h2",{className:"text-lg font-semibold",children:"No queues yet"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Queues are created through the sdlc CLI, the MCP tools or the API. Once one exists, its turns and waiting work show here."})]}):g?i.jsxs(i.Fragment,{children:[i.jsx(LH,{path:n,queues:g.queues,open_id:E,name:P,held:f,timing_of:q,heavy:B}),y?B?i.jsx(GH,{org:e,timing:B}):re.data?i.jsxs(me,{variant:"info",className:"mt-6",children:[i.jsx(pn,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Heavy checks are not available"}),i.jsx(pe,{children:"This checkout reads no heavy queue. Pick another queue above."})]}):re.state==="failed"?i.jsx($u,{on_retry:()=>void ae()}):i.jsx(Tt,{className:"mt-6 h-40 w-full shrink-0",role:"status","aria-label":"Loading the queue"}):ce?i.jsxs(me,{variant:"info",className:"mt-6",children:[i.jsx(pn,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"This queue is no longer available"}),i.jsx(pe,{children:"It was archived, or you can no longer read its Workspace. Pick another queue above."})]}):w&&w.queue.id===E?i.jsx(HH,{org:e,detail:w,name:P,settings_note:l,subject_label:h,thread_subjects:f,timing:q.get(w.queue.id)}):S?i.jsx($u,{refusal:S,on_retry:()=>void oe()}):i.jsx(Tt,{className:"mt-6 h-40 w-full shrink-0",role:"status","aria-label":"Loading the queue"})]}):null]})}function Rh({org:e,subject:t,link:n}){const{href:s,Link:a}=lt();return!t||t.hidden?i.jsx("span",{className:"text-muted-foreground",children:dE}):t.kind==="task"&&n?i.jsx(a,{className:"text-primary hover:underline",href:s(`/org/${e}/tasks/${t.id}`),children:t.title??t.id}):t.kind==="thread"&&!n&&t.id&&!t.id.startsWith("exec-")?i.jsx(a,{className:"text-primary hover:underline",href:s(`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(t.id)}`),children:t.title??t.id}):i.jsx("span",{children:t.title??t.id})}function zH(e,t,n){const s=e.freeze?`frozen until ${Zn(e.freeze.lease_until)}`:null;if(e.batch)return{primary:`Batch of ${e.batch.size} · ${t(e.batch.holder,e.batch.holder_subject)}`,secondary:[`Opened ${Zn(e.batch.opened_at)}`,s].filter(Boolean).join(" · "),warn:!1};if(e.turn){const a=e.turn.subject,r=a.hidden?dE:a.title??a.id,o=(e.running_count??1)>1?`${e.running_count} turns · `:"",l=e.turn.landing?" landing":"",c=n&&!!e.turn.hold,d=[c?oE(e.name,e.turn.note):null,e.turn.fixing_since!==void 0?"Fixing forward":null,s].filter(Boolean);return c&&e.turn.fixing_since===void 0&&!s?{primary:`${o}${r}${l}`,secondary:Ra(d.join(" · ")),warn:!1}:{primary:`${o}${r}${l}`,secondary:d.length?Ra(d.join(" · ")):null,warn:d.length>0}}return{primary:"Nothing running",secondary:s?Ra(s):null,warn:!!s}}const Ra=e=>e.charAt(0).toUpperCase()+e.slice(1),fE=e=>(e==null?void 0:e.rows.filter(t=>t.turn===gi.label).length)??0;function MH({timing:e}){return e!=null&&e.clears?i.jsx("div",{className:"text-muted-foreground text-xs",children:Ra(e.clears)}):null}function $H({timing:e}){const t=fE(e);return t?i.jsx(be,{variant:gi.tone,children:`${t} stalled`}):null}function LH({path:e,queues:t,open_id:n,name:s,held:a,timing_of:r,heavy:o}){const{href:l,Link:c}=lt();return i.jsx(wt,{className:"mt-4 shrink-0 overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Queues",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Queue"}),i.jsx(J,{className:"hidden md:table-cell",children:"Step"}),i.jsx(J,{children:"Running turn"}),i.jsx(J,{className:"hidden text-right md:table-cell",children:"Waiting"})]})}),i.jsxs(at,{children:[t.map(d=>{var g;const h=d.id===n,f=_H(d),m=zH(d,s,a),p=d.waiting-(((g=d.batch)==null?void 0:g.remaining)??0),y=r.get(d.id);return i.jsxs(ye,{"data-testid":"queues-row",className:we(h&&"bg-accent"),children:[i.jsxs(X,{children:[i.jsx(c,{className:"text-primary hover:underline",href:l(`${e}?queue=${encodeURIComponent(d.id)}`),"aria-current":h?"page":void 0,children:d.name}),f?i.jsx("div",{className:"text-muted-foreground text-xs",children:f}):null,i.jsxs("div",{className:"text-muted-foreground text-xs md:hidden",children:[p," waiting"]})]}),i.jsx(X,{className:"hidden md:table-cell",children:i.jsx(be,{variant:"neutral",children:rE[d.policy.step]})}),i.jsxs(X,{children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:we(!d.batch&&!d.turn&&"text-muted-foreground"),children:m.primary}),i.jsx($H,{timing:y})]}),m.secondary?i.jsx("div",{className:we("text-xs",m.warn?"text-warning":"text-muted-foreground"),children:m.secondary}):null,i.jsx(MH,{timing:y})]}),i.jsx(X,{className:"hidden text-right md:table-cell",children:p})]},d.id)}),o?i.jsx(PH,{path:e,timing:o,current:n===Ah}):null]})]})})}const Qg=e=>e.turn==="Running";function PH({path:e,timing:t,current:n}){const{href:s,Link:a}=lt(),r=t.rows.filter(Qg).length,o=t.rows.length-r,l=t.error?"Not available":r?[`${r} running`,t.memory].filter(Boolean).join(" · "):"Nothing running";return i.jsxs(ye,{"data-testid":"queues-row",className:we(n&&"bg-accent"),children:[i.jsxs(X,{children:[i.jsx(a,{className:"text-primary hover:underline",href:s(`${e}?queue=${Ah}`),"aria-current":n?"page":void 0,children:lE}),i.jsx("div",{className:"text-muted-foreground text-xs",children:kH}),t.error?null:i.jsxs("div",{className:"text-muted-foreground text-xs md:hidden",children:[o," waiting"]})]}),i.jsx(X,{className:"hidden md:table-cell",children:i.jsx(be,{variant:"neutral",children:"Checks"})}),i.jsxs(X,{children:[i.jsx("div",{className:we(!r&&"text-muted-foreground"),children:l}),!r&&!t.error&&t.memory?i.jsx("div",{className:"text-muted-foreground text-xs",children:Ra(t.memory)}):null]}),i.jsx(X,{className:"hidden text-right md:table-cell",children:t.error?"—":o})]})}function IH(e){if(!e)return()=>{};const t=new Map(e.rows.filter(s=>s.execution).map(s=>[s.execution,s])),n=new Map;for(const s of e.rows)s.key&&n.set(s.key,n.has(s.key)?null:s);return s=>t.get(s.ref)??n.get(s.subject.id)??void 0}const Jg="No estimate yet";function mE(e){return e?e.turn===gi.label?e.elapsed:[e.elapsed,e.estimate].filter(Boolean).join(" · "):Jg}function pE(e){return e?e.turn===gi.label?pH(e.elapsed):e.estimate?mH(e.estimate):Jg:Jg}function yo({id:e,title:t,side:n,children:s}){return i.jsxs("section",{"aria-labelledby":e,className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("h3",{id:e,className:"text-sm font-semibold",children:t}),n?i.jsx("span",{className:"text-muted-foreground text-xs",children:n}):null]}),s]})}function m_({org:e,entries:t,landing:n,queue_name:s,subject_label:a,held:r,label:o,time_of:l}){return i.jsx("div",{className:"overflow-x-auto rounded-lg border",children:i.jsxs(it,{containerAriaLabel:o,children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:a}),i.jsx(J,{children:"State"}),l?i.jsx(J,{children:"Time"}):null]})}),i.jsx(at,{children:t.map(c=>{const d=l==null?void 0:l(c),h=wH(c,n,s,r,(d==null?void 0:d.turn)===gi.label);return i.jsxs(ye,{"data-testid":"queues-running",children:[i.jsxs(X,{children:[i.jsx(Rh,{org:e,subject:c.subject,link:!r}),r&&c.hold&&c.note&&!c.subject.hidden?i.jsx("div",{className:"text-muted-foreground text-xs",children:c.note}):null]}),i.jsx(X,{children:i.jsx(be,{variant:h.tone,children:h.label})}),l?i.jsx(X,{className:"text-muted-foreground text-xs",title:d==null?void 0:d.basis,children:mE(d)}):null]},c.ref)})})]})})}function p_({org:e,row:t}){return t.key?i.jsx(Rh,{org:e,subject:{kind:"thread",id:t.key,title:t.title},link:!1}):i.jsx("span",{children:t.title})}function g_({command:e}){return e?i.jsx("span",{className:"block max-w-xs truncate font-mono text-xs",title:e,children:e}):null}function GH({org:e,timing:t}){const n=t.rows.filter(Qg),s=t.rows.filter(a=>!Qg(a));return i.jsxs(wt,{as:"section","aria-labelledby":"queue-title",className:"mt-6 flex shrink-0 flex-col gap-4 p-4","data-testid":"queues-detail",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("h2",{id:"queue-title",className:"text-lg font-semibold",children:lE}),i.jsx("p",{className:"text-muted-foreground text-sm",children:SH}),t.memory&&!t.error?i.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:Ra(t.memory)}):null,i.jsx("p",{className:"text-muted-foreground text-xs",children:CH})]}),t.error?i.jsxs(me,{variant:"destructive",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Heavy checks could not be read"}),i.jsx(pe,{children:Ra(t.error)})]}):t.rows.length===0?i.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running, and nothing waits in this queue."}):i.jsxs(i.Fragment,{children:[i.jsx(yo,{id:"queue-running",title:n.length>1?"Running turns":"Running turn",children:n.length===0?i.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running."}):i.jsx("div",{className:"overflow-x-auto rounded-lg border",children:i.jsxs(it,{containerAriaLabel:"Running turns",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Thread"}),i.jsx(J,{className:"hidden md:table-cell",children:"Command"}),i.jsx(J,{className:"hidden text-right md:table-cell",children:"Memory"}),i.jsx(J,{children:"Time"})]})}),i.jsx(at,{children:n.map(a=>i.jsxs(ye,{"data-testid":"queues-running",children:[i.jsxs(X,{children:[i.jsx(p_,{org:e,row:a}),i.jsx("div",{className:"text-muted-foreground text-xs break-all md:hidden",children:[a.command,a.memory].filter(Boolean).join(" · ")})]}),i.jsx(X,{className:"hidden md:table-cell",children:i.jsx(g_,{command:a.command})}),i.jsx(X,{className:"hidden text-right tabular-nums md:table-cell",children:a.memory}),i.jsx(X,{className:"text-muted-foreground text-xs",title:a.basis,children:mE(a)})]},a.position))})]})})}),i.jsx(yo,{id:"queue-waiting",title:"Waiting",children:s.length===0?i.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing waits."}):i.jsx("div",{className:"overflow-x-auto rounded-lg border",children:i.jsxs(it,{containerAriaLabel:"Waiting entries",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Position"}),i.jsx(J,{children:"Thread"}),i.jsx(J,{className:"hidden md:table-cell",children:"Command"}),i.jsx(J,{className:"hidden text-right md:table-cell",children:"Memory"}),i.jsx(J,{children:"Turn"}),i.jsx(J,{children:"Starts"}),i.jsx(J,{className:"hidden md:table-cell",children:"Note"})]})}),i.jsx(at,{children:s.map(a=>{const r=a.turn===gi.label?gi:{label:a.turn,tone:a.turn==="Next"?"info":"neutral"};return i.jsxs(ye,{"data-testid":"queues-waiting",children:[i.jsx(X,{children:a.position}),i.jsxs(X,{children:[i.jsx(p_,{org:e,row:a}),i.jsx("div",{className:"text-muted-foreground text-xs break-all md:hidden",children:[a.command,a.memory].filter(Boolean).join(" · ")})]}),i.jsx(X,{className:"hidden md:table-cell",children:i.jsx(g_,{command:a.command})}),i.jsx(X,{className:"hidden text-right tabular-nums md:table-cell",children:a.memory}),i.jsx(X,{children:i.jsx(be,{variant:r.tone,children:r.label})}),i.jsx(X,{className:"text-muted-foreground text-xs",title:a.basis,children:pE(a)}),i.jsx(X,{className:"hidden md:table-cell",children:a.reason?Ra(a.reason):""})]},a.position)})})]})})})]}),i.jsx("p",{className:"text-muted-foreground text-xs",children:DH})]})}function HH({org:e,detail:t,name:n,settings_note:s,subject_label:a,thread_subjects:r,timing:o}){var j;const{queue:l,state:c}=t,d=o?IH(o):void 0,h=fE(o)>0,f=N=>n(N),m=new Map(c.entries.map(N=>[N.ref,N.subject])),p=c.entries.filter(N=>N.turn==="running"),y=c.entries.filter(N=>N.turn!=="running"&&N.batching!=="in_batch"),g=c.batch,b=Math.max(1,p.filter(N=>N.batching!=="in_batch").length),v=g&&l.policy.independent_turns?p.filter(N=>N.batching!=="in_batch"&&N.ref!==g.holder):[],x=c.manager,w=c.freeze,_=((j=l.layer)==null?void 0:j.kind)==="release"?l.layer.stall_hold:void 0,S=_?{who:n(_.by),why:_.reason,until:_.until}:x!=null&&x.hold?{who:n(x.holder,x.holder_subject),why:x.hold.why,until:x.hold.until}:null,k=!g&&p.length===0&&y.length===0;return i.jsxs(wt,{as:"section","aria-labelledby":"queue-title",className:"mt-6 flex shrink-0 flex-col gap-4 p-4","data-testid":"queues-detail",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("h2",{id:"queue-title",className:"text-lg font-semibold",children:l.name}),i.jsx(be,{variant:"neutral",children:rE[l.policy.step]}),i.jsx(be,{variant:"neutral",children:gH[l.management.mode]})]}),l.purpose?i.jsx("p",{className:"text-muted-foreground text-sm",children:l.purpose}):null,o!=null&&o.basis?i.jsx("p",{className:"text-muted-foreground text-xs",children:o.basis}):null,h?i.jsx("p",{className:"text-muted-foreground text-xs",children:hH}):null,o!=null&&o.suite?i.jsx("p",{className:"text-muted-foreground text-xs",children:o.suite}):null]}),x?i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm","data-testid":"queues-manager",children:[i.jsx($$,{className:"text-muted-foreground size-4","aria-hidden":"true"}),i.jsx("span",{className:"text-muted-foreground",children:"Manager"}),i.jsx("span",{className:"font-medium",children:n(x.holder,x.holder_subject)}),i.jsxs("span",{className:"text-muted-foreground text-xs",children:["Lease until ",Zn(x.lease_until),x.serving_until!==void 0?" · serving now":""]})]}):null,w?i.jsxs(me,{variant:"warning",children:[i.jsx(D$,{className:"size-4","aria-hidden":"true"}),i.jsxs(je,{children:["Frozen until ",Zn(w.lease_until)]}),i.jsxs(pe,{children:[n(w.holder,w.holder_subject)," froze this queue at ",Zn(w.since),w.label?`: ${w.label}`:"",". Only ",n(w.holder,w.holder_subject),"'s entries start until it thaws."]})]}):null,S?i.jsxs(me,{variant:"info",children:[i.jsx(PS,{className:"size-4","aria-hidden":"true"}),i.jsxs(je,{children:["Stall hold until ",Zn(S.until)]}),i.jsxs(pe,{children:[S.who,S.why?`: ${S.why}`:"",". The first entry is not treated as stalled while it lasts."]})]}):null,k?i.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running, and nothing waits in this queue."}):i.jsxs(i.Fragment,{children:[g?i.jsxs(yo,{id:"queue-running",title:"Running turn",side:`Batch opened by ${n(g.holder,g.holder_subject)} at ${Zn(g.opened_at)}`,children:[i.jsx("div",{className:"overflow-x-auto rounded-lg border",children:i.jsxs(it,{containerAriaLabel:"Batch members",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Landing order"}),i.jsx(J,{children:a}),i.jsx(J,{children:"Outcome"})]})}),i.jsx(at,{children:g.members.map((N,O)=>{const T=bH(N.outcome);return i.jsxs(ye,{"data-testid":"queues-member",children:[i.jsx(X,{children:O+1}),i.jsx(X,{children:i.jsx(Rh,{org:e,subject:N.subject??m.get(N.ref)??(r?{kind:"thread",id:N.ref}:void 0),link:!r})}),i.jsx(X,{children:i.jsx(be,{variant:T.tone,children:T.label})})]},N.ref)})})]})}),v.length>0?i.jsxs(i.Fragment,{children:[i.jsx("h4",{className:"text-muted-foreground text-xs font-medium",children:"Also running"}),i.jsx(m_,{org:e,entries:v,landing:c.landing,queue_name:l.name,subject_label:a,held:r,label:"Turns running beside the batch",time_of:d})]}):null]}):i.jsx(yo,{id:"queue-running",title:p.length>1?"Running turns":"Running turn",children:p.length===0?i.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running."}):i.jsx(m_,{org:e,entries:p,landing:c.landing,queue_name:l.name,subject_label:a,held:r,label:"Running turns",time_of:d})}),i.jsx(yo,{id:"queue-waiting",title:"Waiting",children:y.length===0?i.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing waits."}):i.jsx("div",{className:"overflow-x-auto rounded-lg border",children:i.jsxs(it,{containerAriaLabel:"Waiting entries",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Position"}),i.jsx(J,{children:a}),i.jsx(J,{className:"hidden md:table-cell",children:"Joined"}),i.jsx(J,{children:"Turn"}),d?i.jsx(J,{children:"Starts"}):null,i.jsx(J,{className:"hidden md:table-cell",children:"Note"})]})}),i.jsx(at,{children:y.map((N,O)=>{const T=d==null?void 0:d(N),P=yH(N,(T==null?void 0:T.turn)===gi.label),L=N.subject.hidden?"":N.note??"";return i.jsxs(ye,{"data-testid":"queues-waiting",children:[i.jsx(X,{children:g?b+O+1:N.position}),i.jsx(X,{children:i.jsx(Rh,{org:e,subject:N.subject,link:!r})}),i.jsx(X,{className:"hidden md:table-cell",children:Zn(N.joined_at)}),i.jsx(X,{children:i.jsx(be,{variant:P.tone,children:P.label})}),d?i.jsx(X,{className:"text-muted-foreground text-xs",title:T==null?void 0:T.basis,children:pE(T)}):null,i.jsx(X,{className:"hidden md:table-cell",children:L})]},N.ref)})})]})})})]}),i.jsx(yo,{id:"queue-settings",title:"Settings",children:i.jsx("div",{className:"overflow-x-auto rounded-lg border",children:i.jsx(it,{containerAriaLabel:"Queue settings",children:i.jsx(at,{children:NH(l,f).map(([N,O])=>i.jsxs(ye,{children:[i.jsx(J,{scope:"row",className:"h-auto w-48 py-2 font-normal",children:N}),i.jsx(X,{children:O})]},N))})})})}),i.jsx("p",{className:"text-muted-foreground text-xs",children:s})]})}const ii="__no_parent__";function gE(e,t){const n=new Set([t]);for(let s=!0;s;){s=!1;for(const a of e)a.parent&&n.has(a.parent)&&!n.has(a.key)&&(n.add(a.key),s=!0)}return n}const Gc=(e,t)=>(e.label||e.key).localeCompare(t.label||t.key);function Jn({id:e,label:t,help:n,error:s,children:a}){const r=[n?`${e}-help`:null,s?`${e}-error`:null].filter(Boolean).join(" ")||void 0;return i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:e,children:t}),a(r),n?i.jsx("p",{id:`${e}-help`,className:"text-muted-foreground text-xs",children:n}):null,s?i.jsx("p",{id:`${e}-error`,className:"text-destructive text-sm",children:s}):null]})}function ex({label:e,children:t}){return i.jsxs("div",{className:"grid gap-1",children:[i.jsx("span",{className:"text-sm leading-none font-medium",children:e}),i.jsx("span",{className:"text-muted-foreground text-sm break-words",children:t})]})}function x_({id:e,label:t,help:n,checked:s,on_change:a}){return i.jsxs("div",{className:"grid gap-1",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(rl,{id:e,className:"mt-0.5",checked:s,"aria-describedby":n?`${e}-help`:void 0,onCheckedChange:r=>a(r===!0)}),i.jsx(Ie,{htmlFor:e,className:"font-normal",children:t})]}),n?i.jsx("p",{id:`${e}-help`,className:"text-muted-foreground pl-6 text-xs",children:n}):null]})}function xE({id:e,legend:t,help:n,error:s,options:a,checked:r,on_change:o,empty:l,notes:c,scroll:d}){const h=[c!=null&&c.length?`${e}-notes`:null,n?`${e}-help`:null,s?`${e}-error`:null].filter(Boolean).join(" ")||void 0;return i.jsxs("fieldset",{className:"m-0 grid min-w-0 gap-2 border-0 p-0","aria-describedby":h,"aria-invalid":s?!0:void 0,children:[i.jsx("legend",{className:"mb-2 text-sm leading-none font-medium",children:t}),c!=null&&c.length?i.jsxs("div",{id:`${e}-notes`,className:"text-warning flex items-start gap-2 text-xs",children:[i.jsx(Nt,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),i.jsx("div",{className:"grid gap-0.5",children:c.map(f=>i.jsx("p",{children:f},f))})]}):null,a.length===0&&l?i.jsx("p",{className:"text-muted-foreground text-sm",children:l}):null,i.jsx("div",{className:d?"grid max-h-[200px] grid-cols-1 gap-2 overflow-y-auto rounded-md border p-3 sm:grid-cols-2":"grid grid-cols-1 gap-2 sm:grid-cols-2",tabIndex:d?0:void 0,role:d?"group":void 0,"aria-label":d?`${t} list`:void 0,children:a.map((f,m)=>i.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[i.jsx(rl,{id:`${e}-${m}`,className:"mt-0.5",checked:r.has(f.value),onCheckedChange:p=>{const y=new Set(r);p===!0?y.add(f.value):y.delete(f.value),o(y)}}),i.jsx(Ie,{htmlFor:`${e}-${m}`,className:"min-w-0 font-normal break-words",children:f.label})]},f.value))}),n?i.jsx("p",{id:`${e}-help`,className:"text-muted-foreground text-xs",children:n}):null,s?i.jsx("p",{id:`${e}-error`,className:"text-destructive text-sm",children:s}):null]})}function Hc({context:e,action:t,title:n="Two-factor sign-in needed",changing:s="Changing the org"}){const a=e.two_factor==="enroll";return i.jsxs(me,{variant:"destructive",role:"alert",children:[i.jsx(S$,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:n}),i.jsxs(pe,{children:[i.jsx("p",{children:a?`Turn on two-factor sign-in in Account Settings, then come back here and ${t}.`:`${s} needs a two-factor sign-in. Sign in again with your authenticator in Account Settings, then come back here and ${t}.`}),i.jsx(U,{asChild:!0,variant:"outline",size:"sm",className:"mt-2 h-auto min-h-8 py-1.5 whitespace-normal text-left",children:i.jsx("a",{href:e.settings_href,target:"_blank",rel:"noreferrer",children:"Open Account Settings in a new tab"})})]})]})}const qa=e=>e.two_factor==="ok";function hl({refusal:e,context:t,subject:n,action:s,changing:a,authority_title:r}){if((e==null?void 0:e.kind)==="two_factor")return i.jsx(Hc,{context:t,action:s,changing:a,title:`Could not save ${n}`});const o=qa(t)?null:i.jsx(Hc,{context:t,action:s,changing:a});if(!e)return o;const l=e.kind==="changed"?"The org changed since you opened this":e.kind==="authority"?r??`Could not save ${n}`:null;return i.jsxs(i.Fragment,{children:[o,i.jsxs(me,{variant:"destructive",role:"alert",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),l?i.jsx(je,{children:l}):null,i.jsx(pe,{children:e.message})]})]})}function vE({id:e,value:t,on_change:n,none:s,options:a,described_by:r}){return i.jsxs(St,{value:t,onValueChange:n,children:[i.jsx(_t,{id:e,"aria-describedby":r,children:i.jsx(Ct,{placeholder:"Choose a team"})}),i.jsxs(jt,{children:[s?i.jsx(Be,{value:ii,children:s}):null,a.map(o=>i.jsx(Be,{value:o.key,children:o.label||o.key},o.key))]})]})}function fl(e){const[t,n]=u.useState(!1),[s,a]=u.useState(null);return{saving:t,refusal:s,set_refusal:a,run:async o=>{n(!0),a(null);try{const l=await o();l?a(l):e()}finally{n(!1)}}}}function ml({saving:e,blocked:t,described_by:n,children:s}){return i.jsx(U,{type:"submit",disabled:e,"aria-disabled":t||void 0,"aria-describedby":t?n:void 0,children:s})}const bE=(e,t)=>t==="hosted"?`Lowercase letters, digits, _ and -, starting with a letter. It names the ${e} in posts, and cannot change later.`:`Lowercase letters, digits, _ and -, starting with a letter. It names the ${e} in posts and in sdlc org, and cannot change later.`;function VH({open:e,chart:t,team:n,save:s,on_close:a,context:r=pl,scope:o="full",parents:l}){var E;const c=r.host==="hosted",[d,h]=u.useState(""),[f,m]=u.useState(""),[p,y]=u.useState(""),[g,b]=u.useState(ii),[v,x]=u.useState({}),{saving:w,refusal:_,set_refusal:S,run:k}=fl(a),j=((E=t.teams.find(M=>M.parent===null))==null?void 0:E.key)??null;u.useEffect(()=>{e&&(h(""),m((n==null?void 0:n.label)??""),y((n==null?void 0:n.description)??""),b((n==null?void 0:n.parent)??(c&&j&&(!l||l.includes(j))?j:ii)),x({}),S(null))},[e,n,S,c,j,l]);const N=M=>{const H=t.teams.find(z=>z.key===M);return H?H.label||H.key:M??""},O=n?gE(t.teams,n.key):new Set,T=[...t.teams].filter(M=>!O.has(M.key)&&(!l||l.includes(M.key))).sort((M,H)=>M.key===j?-1:H.key===j?1:Gc(M,H)),P=n?n.label||n.key:"",L=o==="description",G=!qa(r),A=n?L?"save the description":"save the team":"add the team",D=M=>{if(M.preventDefault(),G)return;if(!n){const K=c?f.trim():d.trim();if(!K){x(c?{label:"Give the team a name."}:{key:"Give the team a key."});return}if(c&&g===ii){x({parent:"Choose the parent team."});return}const oe=c?K:f.trim()||K;k(()=>s({action:"add",kind:"team",key:K,...f.trim()?{label:f.trim()}:{},...p.trim()?{description:p.trim()}:{},...g!==ii?{parent:g}:{}},`Team ${oe} added.`));return}if(!L&&!f.trim()){x({label:c?"Give the team a name.":"Give the team a label."});return}const H=g===ii?null:g,z={...!L&&f.trim()!==n.label.trim()?{label:f.trim()}:{},...p.trim()!==(n.description??"").trim()?{description:p.trim()}:{},...!c&&H!==n.parent?{parent:H}:{}};if(Object.keys(z).length===0){a();return}k(()=>s({action:"edit",kind:"team",key:n.key,...z},L?`Saved the description of ${P}.`:`Team ${f.trim()} saved.`))},C=n?L?`Edit the description of ${P}`:`Edit team ${P}`:"Add team";let R;return L?R="Say what the team works on. Only the description is yours to change here.":c?R=n?"Rename the team or say what it works on.":"Add a team to the organization.":n?R=i.jsxs(i.Fragment,{children:["Its key, ",i.jsx("span",{className:"font-mono",children:n.key}),", names it in posts and in sdlc org and does not change."]}):R="Add a team to this repository's local org.",i.jsx(jn,{open:e,onOpenChange:M=>M||w?null:a(),children:i.jsx(Nn,{children:i.jsxs("form",{onSubmit:D,noValidate:!0,children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:C}),i.jsx(Dn,{children:R})]}),i.jsxs("div",{className:"mt-4 grid gap-4",children:[i.jsx(hl,{refusal:_,context:r,subject:L?"the description":"the team",action:A}),!n&&!c?i.jsx(Jn,{id:"org-team-key",label:"Key",help:bE("team",r.host),error:v.key,children:M=>i.jsx(yt,{id:"org-team-key",className:"font-mono",value:d,autoComplete:"off","aria-invalid":v.key?!0:void 0,"aria-describedby":M,onChange:H=>{h(H.target.value),x({})}})}):null,L&&n?i.jsx(ex,{label:"Name",children:n.parent?`${P} · under ${N(n.parent)}`:P}):i.jsx(Jn,{id:"org-team-label",label:c?"Name":n?"Label":"Label (optional)",help:c?n?void 0:"Its key is made from the name.":n?void 0:"Shown on the chart; the key when left empty.",error:v.label,children:M=>i.jsx(yt,{id:"org-team-label",value:f,"aria-invalid":v.label?!0:void 0,"aria-describedby":M,onChange:H=>{m(H.target.value),x({})}})}),i.jsx(Jn,{id:"org-team-description",label:L?"Description":"Description (optional)",children:()=>i.jsx(Vn,{id:"org-team-description",rows:3,placeholder:"What the team does",value:p,onChange:M=>y(M.target.value)})}),L?null:c&&n?i.jsx(ex,{label:"Parent team",children:n.parent?N(n.parent):"None: the organization itself"}):i.jsx(Jn,{id:"org-team-parent",label:"Parent team",help:"Where the team sits; its posts report up through the team above.",error:v.parent,children:M=>i.jsx(vE,{id:"org-team-parent",value:g,on_change:H=>{b(H),x({})},none:c?void 0:"No parent (a root team)",options:T,described_by:M})})]}),i.jsxs(Sn,{className:"mt-6",children:[i.jsx(U,{type:"button",variant:"outline",disabled:w,onClick:a,children:"Cancel"}),i.jsx(ml,{saving:w,blocked:G,children:n?w?"Saving…":"Save":w?"Adding…":"Add team"})]})]})})})}const UH=(e,t)=>e.length===t.size&&e.every(n=>t.has(n));function BH({open:e,chart:t,job:n,save:s,on_close:a,context:r=pl}){const[o,l]=u.useState(""),[c,d]=u.useState(""),[h,f]=u.useState(""),[m,p]=u.useState(ii),[y,g]=u.useState(new Set),[b,v]=u.useState(!1),[x,w]=u.useState(!0),[_,S]=u.useState({}),{saving:k,refusal:j,set_refusal:N,run:O}=fl(a);u.useEffect(()=>{e&&(l(""),d((n==null?void 0:n.label)??""),f((n==null?void 0:n.description)??""),p((n==null?void 0:n.parent)??ii),g(new Set((n==null?void 0:n.fills)??[])),v((n==null?void 0:n.requires_person)??!1),w((n==null?void 0:n.escalable)??!0),S({}),N(null))},[e,n,N]);const T=n?gE(t.job_functions,n.key):new Set,P=[...t.job_functions].filter(C=>!T.has(C.key)).sort(Gc),L=[...t.slots].sort(Gc).map(C=>({value:C.key,label:C.label||C.key})),G=!qa(r),A=n?"save the job function":"add the job function",D=C=>{if(C.preventDefault(),G)return;if(!n){if(!o.trim()){S({key:"Give the job function a key."});return}O(()=>s({action:"add",kind:"job_function",key:o.trim(),...c.trim()?{label:c.trim()}:{},...h.trim()?{description:h.trim()}:{},...m!==ii?{parent:m}:{},fills:[...y],requires_person:b,escalable:x},`Job function ${c.trim()||o.trim()} added.`));return}if(!c.trim()){S({label:"Give the job function a label."});return}const R=m===ii?null:m,E={...c.trim()!==n.label.trim()?{label:c.trim()}:{},...h.trim()!==(n.description??"").trim()?{description:h.trim()}:{},...R!==n.parent?{parent:R}:{},...UH(n.fills,y)?{}:{fills:[...y]},...b!==n.requires_person?{requires_person:b}:{},...x!==n.escalable?{escalable:x}:{}};if(Object.keys(E).length===0){a();return}O(()=>s({action:"edit",kind:"job_function",key:n.key,...E},`Job function ${c.trim()} saved.`))};return i.jsx(jn,{open:e,onOpenChange:C=>C||k?null:a(),children:i.jsx(Nn,{children:i.jsxs("form",{onSubmit:D,noValidate:!0,children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:n?`Edit job function ${n.label||n.key}`:"Add job function"}),i.jsxs(Dn,{children:["Its job description: what it does, the slots it fills and who may hold its posts.",n?i.jsxs(i.Fragment,{children:[" ","Its key, ",i.jsx("span",{className:"font-mono",children:n.key}),", does not change."]}):null]})]}),i.jsxs("div",{className:"mt-4 grid gap-4",children:[i.jsx(hl,{refusal:j,context:r,subject:"the job function",action:A}),n?null:i.jsx(Jn,{id:"org-function-key",label:"Key",help:bE("job function",r.host),error:_.key,children:C=>i.jsx(yt,{id:"org-function-key",className:"font-mono",value:o,autoComplete:"off","aria-invalid":_.key?!0:void 0,"aria-describedby":C,onChange:R=>{l(R.target.value),S({})}})}),i.jsx(Jn,{id:"org-function-label",label:n?"Label":"Label (optional)",error:_.label,children:C=>i.jsx(yt,{id:"org-function-label",value:c,"aria-invalid":_.label?!0:void 0,"aria-describedby":C,onChange:R=>{d(R.target.value),S({})}})}),i.jsx(Jn,{id:"org-function-description",label:"Job description (optional)",children:()=>i.jsx(Vn,{id:"org-function-description",rows:3,placeholder:"What this job function does",value:h,onChange:C=>f(C.target.value)})}),i.jsx(Jn,{id:"org-function-parent",label:"Parent function",help:"Its posts report to the post of the parent function.",children:C=>i.jsx(vE,{id:"org-function-parent",value:m,on_change:p,none:"No parent (a root function)",options:P,described_by:C})}),i.jsx(xE,{id:"org-function-fills",legend:"Slots it fills",options:L,checked:y,on_change:g,empty:r.host==="hosted"?"This organization has no slots yet.":"This org has no slots yet; add them with sdlc org add slot."}),i.jsx(x_,{id:"org-function-requires-person",label:"Requires a person",help:"Only a person may hold its posts.",checked:b,on_change:v}),i.jsx(x_,{id:"org-function-escalable",label:"Escalable",help:"When no holder can decide, the decision goes up the reporting line. Off, it waits for a holder of this function.",checked:x,on_change:w})]}),i.jsxs(Sn,{className:"mt-6",children:[i.jsx(U,{type:"button",variant:"outline",disabled:k,onClick:a,children:"Cancel"}),i.jsx(ml,{saving:k,blocked:G,children:n?k?"Saving…":"Save":k?"Adding…":"Add job function"})]})]})})})}const WH=/^[a-z][a-z0-9_-]{0,63}$/;function FH(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[^a-z]+/,"").slice(0,64).replace(/-+$/,"")}function qH({open:e,chart:t,slot:n,save:s,on_close:a,context:r=pl}){const[o,l]=u.useState(""),[c,d]=u.useState(""),[h,f]=u.useState(!1),[m,p]=u.useState(""),[y,g]=u.useState({}),{saving:b,refusal:v,set_refusal:x,run:w}=fl(a);u.useEffect(()=>{e&&(l((n==null?void 0:n.label)??""),d((n==null?void 0:n.key)??""),f(!1),p((n==null?void 0:n.description)??""),g({}),x(null))},[e,n,x]);const _=!qa(r),S=n?"save the slot":"add the slot",k=j=>{if(j.preventDefault(),_)return;const N=o.trim();if(n){if(!N){g({label:"Give the slot a label."});return}const T={...N!==(n.label??"").trim()?{label:N}:{},...m.trim()!==(n.description??"").trim()?{description:m.trim()}:{}};if(Object.keys(T).length===0){a();return}w(()=>s({action:"edit",kind:"slot",key:n.key,...T},`Saved slot ${N}.`));return}const O={...N?{}:{label:"Give the slot a label."},...WH.test(c)?t.slots.some(T=>T.key===c)?{key:`Slot ${c} already exists.`}:{}:{key:"Use lowercase letters, digits, _ and -, starting with a letter, at most 64 characters."}};g(O),!(O.label||O.key)&&w(()=>s({action:"add",kind:"slot",key:c,label:N,...m.trim()?{description:m.trim()}:{}},`Added slot ${N}.`))};return i.jsx(jn,{open:e,onOpenChange:j=>j||b?null:a(),children:i.jsx(Nn,{children:i.jsxs("form",{onSubmit:k,noValidate:!0,children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:n?`Edit ${n.label||n.key}`:"Add slot"}),i.jsx(Dn,{children:"A slot is a workflow role a project fills from its team's posts. Job functions name the slots they fill."})]}),i.jsxs("div",{className:"mt-4 grid gap-4",children:[i.jsx(hl,{refusal:v,context:r,subject:"the slot",action:S}),i.jsx(Jn,{id:"org-slot-label",label:"Label",help:"How the slot is named on the chart and in project settings.",error:y.label,children:j=>i.jsx(yt,{id:"org-slot-label",value:o,"aria-invalid":y.label?!0:void 0,"aria-describedby":j,onChange:N=>{l(N.target.value),!n&&!h&&d(FH(N.target.value)),g({})}})}),n?i.jsx(ex,{label:"Key",children:i.jsx("span",{className:"font-mono",children:n.key})}):i.jsx(Jn,{id:"org-slot-key",label:"Key",help:"Lowercase letters, digits, _ and -, starting with a letter, at most 64 characters. It can't be changed after you save.",error:y.key,children:j=>i.jsx(yt,{id:"org-slot-key",className:"font-mono",value:c,autoComplete:"off","aria-invalid":y.key?!0:void 0,"aria-describedby":j,onChange:N=>{d(N.target.value),f(!0),g({})}})}),i.jsx(Jn,{id:"org-slot-description",label:"Description (optional)",children:()=>i.jsx(Vn,{id:"org-slot-description",rows:3,placeholder:"What this role does",value:m,onChange:j=>p(j.target.value)})})]}),i.jsxs(Sn,{className:"mt-6",children:[i.jsx(U,{type:"button",variant:"outline",disabled:b,onClick:a,children:"Cancel"}),i.jsx(ml,{saving:b,blocked:_,children:n?b?"Saving…":"Save":b?"Adding…":"Add slot"})]})]})})})}function YH({open:e,chart:t,binding:n,names:s,save:a,confirm:r,on_close:o,context:l=pl,hosted:c}){var G;const[d,h]=u.useState(new Set),[f,m]=u.useState(""),[p,y]=u.useState({}),{saving:g,refusal:b,set_refusal:v,run:x}=fl(o),w=(n==null?void 0:n.slot)??null;if(u.useEffect(()=>{!e||!n||(h(new Set(c&&n.source!=="override"?[]:n.posts.map(A=>A.post))),m(n.source==="override"?n.reason??"":""),y({}),v(null))},[e,w,v]),!n)return null;const _=s.slot(n.slot),S=(G=t.project)!=null&&G.team?t.teams.find(A=>{var D;return A.key===((D=t.project)==null?void 0:D.team)}):void 0,k=S?S.label||S.key:"the owning team",j=new Set(t.job_functions.filter(A=>A.fills.includes(n.slot)).map(A=>A.key)),N=[...t.posts].map(A=>A.post).sort(s.byPost).map(A=>{const D=j.has(A.split("/")[1]??"")?`${s.post(A)} (fills ${_})`:s.post(A),C=c==null?void 0:c.holders(A);return{value:A,label:c?C?`${D}: ${C}`:`${D} (no holder)`:D}}),O=c?[...d].sort(s.byPost).flatMap(A=>[...j.has(A.split("/")[1]??"")?[]:[`${s.post(A)} is not in the job description of ${_}.`],...c.chain.has(A.split("/")[0]??"")?[]:[`${s.post(A)} is outside ${c.owner} and the teams above it.`]]):[],T=!qa(l),P=A=>{A.preventDefault();const D={...d.size===0?{posts:"Choose at least one post."}:{},...f.trim()?{}:{reason:"Give the reason for the override."}};y(D),!(D.posts||D.reason||T)&&x(()=>a({action:"bind",slot:n.slot,posts:[...d],reason:f.trim()},`Override of ${_} saved.`))},L=async()=>{await r({title:`Clear the override of ${_}?`,description:c?`${_} goes back to its team's posts: ${c.baseline}. The override and its reason stay in the audit trail.`:"It goes back to the posts its job descriptions name, and its reason is not kept.",action_label:c?"Clear override":"Clear",destructive:!0})&&x(()=>a({action:"unbind",slot:n.slot},`Override of ${_} cleared.`))};return i.jsx(jn,{open:e,onOpenChange:A=>A||g?null:o(),children:i.jsx(Nn,{children:i.jsxs("form",{onSubmit:P,noValidate:!0,children:[i.jsxs(kn,{children:[i.jsxs(Cn,{children:["Override ",_]}),i.jsxs(Dn,{children:["Bind ",_," in this project to the posts you choose instead of its"," ",c?"team’s":"job descriptions’"," posts. The override is reported with its reason, who set it and when."]})]}),i.jsxs("div",{className:"mt-4 grid gap-4",children:[b||T?i.jsx("div",{id:"org-override-refusal",className:"grid gap-4",children:i.jsx(hl,{refusal:b,context:l,subject:"the override",action:c?"save":"save the override",changing:c?"Changing this project’s slots":void 0,authority_title:c?"Your changes were not saved":void 0})}):null,i.jsx(xE,{id:"org-override-posts",legend:"Posts",help:c?`(fills ${_}) marks the posts whose job function fills ${_}.`:"A post outside its job description is marked on the chart.",notes:O,scroll:!!c,error:p.posts,options:N,checked:d,on_change:A=>{h(A),y(D=>({...D,posts:void 0}))}}),i.jsx(Jn,{id:"org-override-reason",label:"Reason",error:p.reason,children:A=>i.jsx(Vn,{id:"org-override-reason",rows:2,placeholder:"Why this slot needs other posts",value:f,"aria-invalid":p.reason?!0:void 0,"aria-describedby":A,onChange:D=>{m(D.target.value),y(C=>({...C,reason:void 0}))}})}),c?null:i.jsxs("p",{className:"text-muted-foreground text-xs",children:["Made as ",i.jsx("span",{className:"font-mono",children:"person:user"}),", who must hold the lead post of ",k," or of a team above it."]})]}),i.jsxs(Sn,{className:"mt-6",children:[n.source==="override"?i.jsx(U,{type:"button",variant:"ghost",className:"sm:mr-auto",disabled:g,onClick:()=>void L(),children:"Clear override"}):null,i.jsx(U,{type:"button",variant:"outline",disabled:g,onClick:o,children:"Cancel"}),i.jsx(ml,{saving:g,blocked:T,described_by:"org-override-refusal",children:g?"Saving…":"Save override"})]})]})})})}function XH(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function KH({open:e,chart:t,names:n,save:s,on_close:a,context:r}){var A;const o=t.authority,l=u.useMemo(()=>o?new Set(o.post_pairs):null,[o]),c=D=>!l||l.has(D),d=((A=t.teams.find(D=>D.parent===null))==null?void 0:A.key)??null,h=[...t.teams].filter(D=>!l||[...l].some(C=>C.startsWith(`${D.key}/`))).sort((D,C)=>D.key===d?-1:C.key===d?1:Gc(D,C)),[f,m]=u.useState(""),[p,y]=u.useState(""),[g,b]=u.useState({}),{saving:v,refusal:x,set_refusal:w,run:_}=fl(a);u.useEffect(()=>{var D;e&&(m(((D=h[0])==null?void 0:D.key)??""),y(""),b({}),w(null))},[e,w]);const S=new Set(t.posts.filter(D=>D.post.startsWith(`${f}/`)).map(D=>D.post.split("/")[1])),k=[],j=D=>{for(const C of[...t.job_functions].filter(R=>R.parent===D).sort(Gc))k.push(C),j(C.key)};j(null);const N=k.filter(D=>c(`${f}/${D.key}`)&&!S.has(D.key)),O=f!==""&&N.length===0,T=!qa(r)||O,P=D=>{if(D.preventDefault(),T)return;const C={...f?{}:{team:"Choose a team."},...p?{}:{job:"Choose a job function."}};b(C),!(C.team||C.job)&&_(()=>s({action:"add",kind:"post",key:`${f}/${p}`},`Added post ${n.job(p)} · ${n.team(f)}.`))},L=O?"Every job function already has a post in this team.":"A team has one post per job function; functions already staffed in this team are left out.",G=(o==null?void 0:o.ask)??[];return i.jsx(jn,{open:e,onOpenChange:D=>D||v?null:a(),children:i.jsx(Nn,{children:i.jsxs("form",{onSubmit:P,noValidate:!0,children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:"Add post"}),i.jsx(Dn,{children:"A post is a job function staffed in a team. People in this post report to the post above it."})]}),i.jsxs("div",{className:"mt-4 grid gap-4",children:[i.jsx(hl,{refusal:x,context:r,subject:"the post",action:"add the post"}),i.jsx(Jn,{id:"org-post-team",label:"Team",help:"The team the post is in.",error:g.team,children:D=>i.jsxs(St,{value:f,onValueChange:C=>{m(C),y(""),b({})},children:[i.jsx(_t,{id:"org-post-team","aria-describedby":D,"aria-invalid":g.team?!0:void 0,children:i.jsx(Ct,{placeholder:"Choose a team"})}),i.jsx(jt,{children:h.map(C=>i.jsx(Be,{value:C.key,children:C.label||C.key},C.key))})]})}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Jn,{id:"org-post-function",label:"Job function",help:L,error:g.job,children:D=>i.jsxs(St,{value:p,disabled:O,onValueChange:C=>{y(C),b({})},children:[i.jsx(_t,{id:"org-post-function","aria-describedby":D,"aria-invalid":g.job?!0:void 0,children:i.jsx(Ct,{placeholder:O?"Every job function has a post here":"Choose a job function"})}),i.jsx(jt,{children:N.map(C=>i.jsx(Be,{value:C.key,children:C.label||C.key},C.key))})]})}),o&&!o.administer?i.jsxs("p",{className:"text-muted-foreground text-xs",children:["Only the job functions directly below a post you hold are listed.",G.length?` For others, ask ${XH(G)}.`:""]}):null]})]}),i.jsxs(Sn,{className:"mt-6",children:[i.jsx(U,{type:"button",variant:"outline",disabled:v,onClick:a,children:"Cancel"}),i.jsx(ml,{saving:v,blocked:T,described_by:O?"org-post-function-help":void 0,children:v?"Adding…":"Add post"})]})]})})})}function ZH({open:e,chart:t,post:n,names:s,members:a,save:r,on_close:o,context:l}){const[c,d]=u.useState({state:"loading"}),[h,f]=u.useState(""),[m,p]=u.useState(null),[y,g]=u.useState(-1),{saving:b,refusal:v,set_refusal:x,run:w}=fl(o),_=u.useRef(0),S=u.useCallback(async()=>{const z=_.current+=1;d({state:"loading"});const K=await a();z===_.current&&d(K.ok?{state:"read",members:K.data}:{state:"failed"})},[a]);u.useEffect(()=>{e&&(f(""),p(null),g(-1),x(null),S())},[e,S,x]);const k=t.posts.find(z=>z.post===n);if(!n||!k)return null;const j=s.post(n),N=new Set(k.holders.map(z=>z.id)),T=t.posts.some(z=>z.reports_to===n)&&k.holders.length>0?k.holders[0]:null,P=h.trim().toLowerCase(),L=c.state==="read"?c.members.filter(z=>!N.has(z.id)).filter(z=>!P||[z.label,z.detail,z.email].some(K=>K==null?void 0:K.toLowerCase().includes(P))):[],G=c.state==="read"&&c.members.every(z=>N.has(z.id)),A=c.state==="read"&&!G&&L.length>0,D=A&&y>=0&&y<L.length?L[y]:null,C=z=>`org-holder-option-${z.id}`,R=!qa(l)||!m||T!==null,E=z=>{if(!A)return;const K=L.length-1,oe=re=>{var ve,ke;z.preventDefault(),g(re),(ke=(ve=document.getElementById(C(L[re])))==null?void 0:ve.scrollIntoView)==null||ke.call(ve,{block:"nearest"})};z.key==="ArrowDown"?oe(Math.min(D?y+1:0,K)):z.key==="ArrowUp"?oe(D?Math.max(y-1,0):K):z.key==="Home"&&D?oe(0):z.key==="End"&&D?oe(K):z.key==="Enter"&&D&&(m==null?void 0:m.id)!==D.id&&(z.preventDefault(),p(D))},M=T?void 0:m?"Only members of the organization can hold its posts. Members who already hold it are left out.":"Choose a member to add.",H=z=>{z.preventDefault(),!(R||!m)&&w(()=>r({action:"hold",post:n,member:m.id},`Added ${m.label} to ${j}.`))};return i.jsx(jn,{open:e,onOpenChange:z=>z||b?null:o(),children:i.jsx(Nn,{children:i.jsxs("form",{onSubmit:H,noValidate:!0,children:[i.jsxs(kn,{children:[i.jsxs(Cn,{children:["Add holder to ",j]}),i.jsx(Dn,{children:"The member holds this post and reports as it does."})]}),i.jsxs("div",{className:"mt-4 grid gap-4",children:[i.jsx(hl,{refusal:v,context:l,subject:"the holder",action:"add the holder"}),T?i.jsxs(me,{variant:"info",id:"org-holder-one",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsxs(pe,{children:["This post takes one holder. Remove ",s.member(T)," first, then add the new holder."]})]}):null,i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"org-holder-member",children:"Member"}),i.jsx(yt,{id:"org-holder-member",role:"combobox","aria-expanded":A,"aria-controls":A?"org-holder-members":void 0,"aria-activedescendant":D?C(D):void 0,"aria-autocomplete":"list","aria-describedby":M?"org-holder-member-help":void 0,placeholder:"Search members by name, username or email",autoComplete:"off",value:h,disabled:T!==null,onChange:z=>{f(z.target.value),g(-1)},onKeyDown:E}),i.jsx("div",{className:"max-h-56 overflow-y-auto rounded-md border",children:c.state==="loading"?i.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 px-3 py-2 text-sm",role:"status",children:[i.jsx(wn,{className:"size-4","aria-hidden":"true"}),"Loading members…"]}):c.state==="failed"?i.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-3 py-2",children:[i.jsx("p",{className:"text-destructive text-sm",children:"Could not read the members."}),i.jsx(U,{type:"button",variant:"outline",size:"sm",onClick:()=>void S(),children:"Retry"})]}):G?i.jsx("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"Every member already holds this post."}):L.length===0?i.jsxs("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:["No member matches “",h.trim(),"”."]}):i.jsx("ul",{id:"org-holder-members",role:"listbox","aria-label":"Members",className:"m-0 list-none p-1",children:L.map((z,K)=>{const oe=(m==null?void 0:m.id)===z.id,re=(D==null?void 0:D.id)===z.id;return i.jsxs("li",{id:C(z),role:"option","aria-selected":oe,className:`cursor-pointer rounded-sm px-2 py-1.5 ${oe?"bg-accent text-accent-foreground":re?"bg-muted":"hover:bg-muted"} ${re?"ring-ring ring-2 ring-inset":""}`,onClick:()=>{T||(g(K),p(z))},children:[i.jsxs("div",{className:"text-sm font-medium break-words",children:[z.label,z.detail&&L.filter(ve=>ve.label===z.label).length>1?` (${z.detail})`:""]}),z.email?i.jsx("div",{className:"text-muted-foreground text-xs break-all",children:z.email}):null]},z.id)})})}),M?i.jsx("p",{id:"org-holder-member-help",className:"text-muted-foreground text-xs",children:M}):null]})]}),i.jsxs(Sn,{className:"mt-6",children:[i.jsx(U,{type:"button",variant:"outline",disabled:b,onClick:o,children:"Cancel"}),i.jsx(ml,{saving:b,blocked:R,described_by:T?"org-holder-one":M?"org-holder-member-help":void 0,children:b?"Adding…":"Add holder"})]})]})})})}function yE(e){const[t,n]=u.useState(null),s=u.useRef(t);u.useEffect(()=>{s.current=t},[t]);const a=u.useCallback(c=>{var d;(d=s.current)==null||d.resolve(c),n(null)},[]),r=u.useCallback(c=>new Promise(d=>{var h;(h=s.current)==null||h.resolve(!1),n({...c,resolve:d})}),[]);u.useEffect(()=>()=>{var c;return(c=s.current)==null?void 0:c.resolve(!1)},[]);const o=!qa(e),l=i.jsx(bf,{open:t!==null,onOpenChange:c=>c?null:a(!1),children:i.jsxs(yf,{children:[i.jsxs(wf,{children:[i.jsx(jf,{children:t==null?void 0:t.title}),i.jsx(Nf,{className:"whitespace-pre-line",children:t==null?void 0:t.description})]}),t&&o?i.jsx(Hc,{context:e,action:t.action}):null,i.jsxs(_f,{children:[i.jsx(Rv,{children:(t==null?void 0:t.cancel_label)??"Cancel"}),i.jsx(GS,{variant:t!=null&&t.destructive?"destructive":"default","aria-disabled":o||void 0,onClick:c=>{if(o){c.preventDefault();return}a(!0)},children:t==null?void 0:t.action_label})]})]})});return{confirm:r,confirm_dialog:l}}function To({label:e,on_edit:t,on_remove:n,items:s}){const a=s??[...t?[{label:"Edit",on_select:t}]:[],...n?[{label:"Remove",on_select:n,destructive:!0}]:[]];return i.jsxs(zf,{children:[i.jsx(Mf,{asChild:!0,children:i.jsx(U,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`More actions for ${e}`,children:i.jsx(Cv,{className:"size-3.5","aria-hidden":"true"})})}),i.jsx(jd,{align:"end",children:a.map(r=>i.jsx(qo,{className:r.destructive?"text-destructive focus:text-destructive":void 0,onSelect:r.on_select,children:r.label},r.label))})]})}function QH({label:e,message:t,bound:n,on_dismiss:s}){return i.jsxs(me,{variant:"destructive",role:"alert",className:"mb-3",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsxs(je,{children:[e," was not removed"]}),i.jsxs(pe,{children:[i.jsx("p",{children:t}),n!=null&&n.projects.length?i.jsx("ul",{role:"list",className:"bg-card text-foreground m-0 mt-2 grid list-none gap-3 rounded-md border p-3",children:n.projects.map(a=>i.jsxs("li",{className:"grid gap-0.5",children:[i.jsxs("a",{className:"text-primary text-sm underline underline-offset-2",href:a.href,children:["Settings of ",a.name]}),i.jsxs("span",{className:"text-muted-foreground text-xs",children:["Override set by ",a.set_by??"a former member"]})]},a.href))}):null,n&&n.more>0?i.jsxs("p",{className:"mt-2",children:["And ",n.more," more ",n.more===1?"project":"projects",". Clear these and try again to see the rest. An org owner can open any project you cannot."]}):null,i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:s,children:"Dismiss"})]})]})}const pl={host:"local",two_factor:"ok",settings_href:""},Th={open:{label:"Open",tone:"info"},accepted:{label:"Accepted",tone:"success"},rejected:{label:"Rejected",tone:"error"},withdrawn:{label:"Withdrawn",tone:"neutral"}},JH={added:{label:"Added",tone:"success"},changed:{label:"Changed",tone:"warning"},removed:{label:"Removed",tone:"error"}},eV={team:["team","teams"],job_function:["job function","job functions"],slot:["slot","slots"],post:["post","posts"],fill:["fill","fills"]},tV=["team","job_function","slot","post","fill"];function vb(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function nV(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function v_(e){return e.charAt(0).toLowerCase()+e.slice(1)}function va(e){const t=s=>vb(tV.filter(a=>e[a][s]>0).map(a=>{const r=e[a][s];return`${r} ${eV[a][r===1?0:1]}`}));return[["Adds","adds",t("added")],["Changes","changes",t("changed")],["Removes","removes",t("removed")]].filter(([,,s])=>s).map(([s,a,r],o)=>`${o===0?s:a} ${r}`).join("; ")||"No changes"}function xi(e){return new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function sV(e){const t=e.requested_at?`Proposed by ${e.requested_by} on ${xi(e.requested_at)}`:`Proposed by ${e.requested_by}`;return e.status==="open"||!e.decided_at?t:`${t} · ${Th[e.status].label} by ${e.decided_by??"a former member"} on ${xi(e.decided_at)}`}function iV({source:e}){return i.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1","data-testid":"org-proposal-source",children:[i.jsx("span",{className:"shrink-0",children:"From package"}),e.href?i.jsx("a",{className:"min-h-6 min-w-0 break-words leading-6 text-primary underline underline-offset-2",href:e.href,children:e.label}):i.jsx("span",{className:"min-w-0 break-words text-foreground",children:e.label}),e.withdrawn&&e.readable!==!1?i.jsx(be,{className:"shrink-0",variant:"warning",children:"Version withdrawn"}):null]})}const aV={team:"team",job_function:"job function",slot:"slot"};function wE(e,t){return e==="own"?"this org's package":e==="softwaredlc"?"SoftwareDLC's package":t?`another organization's package (${t})`:"another organization's package"}function rV(e){return e&&`${e[0].toUpperCase()}${e.slice(1)}`}function Vc({children:e}){return i.jsx("span",{className:"font-mono",children:e})}function hc({title:e,heading:t="strong",children:n}){return i.jsxs("div",{className:"grid gap-1",children:[i.jsx("h3",{className:t==="muted"?"text-muted-foreground text-sm font-medium":"text-sm font-semibold",children:e}),i.jsx("div",{className:"grid gap-1 text-sm break-words",children:n})]})}function oV(e){const t=aV[e.kind],n=i.jsx(Vc,{children:e.key??e.label}),s=e.org_key?i.jsx(Vc,{children:e.org_key}):e.org_label,a=i.jsxs(i.Fragment,{children:[` If it is the same ${t}, give it the key `,s," in the package and publish again."]});return e.reason==="key"?i.jsxs(i.Fragment,{children:[n,` will be added as a new ${t}; its key is close to the org's `,s,` (${e.org_label}).`,a]}):i.jsxs(i.Fragment,{children:[n,` will be added as a new ${t}; the org's `,s,` has the same name ${e.label}.`,a]})}function _E({matches:e}){return i.jsxs(i.Fragment,{children:[e.matches.map(t=>i.jsx("p",{"data-testid":"org-package-match",children:oV(t)},`${t.kind}:${t.key??t.label}:${t.org_key??t.org_label}`)),e.truncated?i.jsx("p",{children:"More may match; check the chart."}):null]})}function b_(e){return e?i.jsxs(i.Fragment,{children:["under ",i.jsx(Vc,{children:e})]}):"at the top level"}function tx(e){return e.field==="name"?i.jsxs(i.Fragment,{children:[i.jsx(Vc,{children:e.key}),` keeps its name ${e.org??""}; the package names it ${e.package??""}. Propose a rename on the chart, or change the package.`]}):i.jsxs(i.Fragment,{children:[i.jsx(Vc,{children:e.key})," stays ",b_(e.org),"; the package has it ",b_(e.package),". Change the package to propose this: team moves are not available in a proposal."]})}const ar=e=>`${e.kind}:${e.key}:${e.field}:${e.org??""}:${e.package??""}`;function jE({items:e}){return i.jsx(i.Fragment,{children:e.map(t=>i.jsx("p",{"data-testid":"org-package-not-proposed",children:tx(t)},ar(t)))})}function lV({placements:e}){return i.jsx(i.Fragment,{children:e.map(t=>i.jsx("p",{"data-testid":"org-package-placement",children:t.under?`${t.name} will be added under ${t.under.name}.`:`${t.name} will be added at the top level.`},t.key??t.name))})}function bb(e){return e==="key"?"by API key":"in the app"}function cV(e,t){const[n,s]=u.useState(e?{state:"loading"}:{state:"off"});return u.useEffect(()=>{if(!e||!t){e||s({state:"off"});return}let a=!0;return e.list().then(r=>{a&&(r.ok?s({state:"read",proposals:r.data}):r.refusal.status===404||r.refusal.reason==="not_found"?s({state:"off"}):s({state:"failed",message:r.refusal.message}))},()=>{a&&s({state:"failed",message:"Try again in a moment."})}),()=>{a=!1}},[e,t]),n}function y_({proposal:e,on_open:t}){const n=Th[e.status];return i.jsxs("li",{className:"border-b px-4 py-2.5 last:border-b-0","data-testid":"org-proposal",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(U,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-left whitespace-normal",onClick:t,children:e.title}),i.jsx(be,{variant:n.tone,children:n.label})]}),i.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:[e.status==="open"?`Proposed by ${e.requested_by} on ${xi(e.requested_at)}`:`${n.label} by ${e.decided_by??"a former member"} on ${xi(e.decided_at??e.requested_at)}`,e.via==="key"?" by API key":null,e.source?` · From ${e.source.label}`:null,` · ${va(e.counts)}`]})]})}const dV="Changes members propose to the org's teams, job functions, posts and slots. Nothing changes until someone who may make the change accepts it.";function uV({listed:e,on_propose:t,on_propose_package:n,on_open:s}){const[a,r]=u.useState(!1);if(e.state==="off"||e.state==="loading")return null;const o=e.state==="read"?e.proposals:[],l=o.filter(d=>d.status==="open"),c=o.filter(d=>d.status!=="open");return i.jsxs("section",{"aria-labelledby":"org-chart-proposals",className:"mt-6 min-w-0",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-x-4 gap-y-2",children:[i.jsxs("div",{className:"min-w-0 flex-1 basis-64",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("h2",{id:"org-chart-proposals",className:"text-lg font-semibold",children:"Proposals"}),l.length?i.jsx(be,{variant:"info",children:`${l.length} open`}):null]}),i.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:dV})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsxs(U,{type:"button",variant:"outline",size:"sm",onClick:t,children:[i.jsx(Ag,{className:"size-4","aria-hidden":"true"}),"Propose a change"]}),n?i.jsxs(U,{type:"button",variant:"outline",size:"sm",onClick:n,children:[i.jsx(pf,{className:"size-4","aria-hidden":"true"}),"Propose from a package…"]}):null]})]}),i.jsxs("div",{className:"mt-3 grid gap-2",children:[e.state==="failed"?i.jsxs("p",{className:"text-destructive text-sm",role:"alert",children:["Could not read the proposals. ",e.message]}):null,e.state==="read"&&o.length===0?i.jsxs(wt,{className:"flex flex-col items-center gap-2 p-6 text-center",children:[i.jsx(Ag,{className:"text-muted-foreground size-5","aria-hidden":"true"}),i.jsx("p",{className:"text-sm font-medium",children:"No proposals yet"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Propose a change to the org's structure for someone with the authority to accept."})]}):null,l.length?i.jsx(wt,{className:"overflow-hidden",children:i.jsx("ul",{role:"list",className:"m-0 list-none p-0","aria-label":"Open proposals",children:l.map(d=>i.jsx(y_,{proposal:d,on_open:()=>s(d)},d.id))})}):null,c.length?i.jsxs("div",{children:[i.jsxs(U,{type:"button",variant:"ghost",size:"sm","aria-expanded":a,"aria-controls":"org-chart-proposals-decided",onClick:()=>r(d=>!d),children:[a?i.jsx(hf,{className:"size-4","aria-hidden":"true"}):i.jsx(pd,{className:"size-4","aria-hidden":"true"}),`Decided (${c.length})`]}),a?i.jsx(wt,{className:"mt-2 overflow-hidden",children:i.jsx("ul",{id:"org-chart-proposals-decided",role:"list",className:"m-0 list-none p-0","aria-label":"Decided proposals",children:c.map(d=>i.jsx(y_,{proposal:d,on_open:()=>s(d)},d.id))})}):null]}):null]})]})}const hV="Nothing you change here is saved to the organization. Submit the proposal for review, or discard it. A proposal can add teams but not rename, move or remove them, and it never changes who holds a post.";function fV({draft:e,on_submit:t,on_discard:n}){var c;const s=((c=e.moved)==null?void 0:c.state)==="conflict"?e.moved.names:null,a=!!e.moved,r=e.total===0?"No changes yet":`${e.total} ${e.total===1?"change":"changes"}`,o=e.total===0||!!s,l=a?Nt:Ag;return i.jsxs(me,{variant:a?"warning":"info",role:"status",className:"mt-6",children:[i.jsx(l,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:a?"The org changed while you drafted":"You are drafting a proposal"}),i.jsxs(pe,{children:[i.jsx("p",{id:"org-draft-why",children:s?`The org changed what your draft changes: ${vb(s)}. Discard the draft and start again from the org as it is now.`:a?"We moved your draft onto the org as it is now and kept your changes. Check the chart, then submit again.":hV}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[i.jsx(U,{type:"button",size:"sm","aria-disabled":o||void 0,"aria-describedby":o?s?"org-draft-why":"org-draft-count":void 0,onClick:()=>o?void 0:t(),children:"Submit proposal"}),i.jsx(U,{type:"button",variant:"outline",size:"sm",onClick:n,children:"Discard draft"}),i.jsx("span",{id:"org-draft-count",className:"text-muted-foreground text-xs",children:r})]})]})]})}const NE={proposal_empty:"The proposal changes nothing in the org."};function mV(e,t){const n=`${e.coordinate} ${e.version}`;if(t.code==="proposal_duplicate"&&t.duplicate){const{duplicate:s}=t;return`${s.requested_by} already proposed this version: '${s.title}', opened ${bb(s.via)}.`}return t.code==="package_version_withdrawn"?t.newest_version?`${n} was withdrawn. Choose ${t.newest_version}, its newest usable version.`:`${n} was withdrawn. It has no usable version now.`:t.code==="not_found"||t.reason==="not_found"?"This package or version can no longer be read.":NE[t.code??""]??t.message}function pV({open:e,draft:t,submit:n,on_close:s,on_done:a,on_open_proposal:r}){const[o,l]=u.useState(""),[c,d]=u.useState(""),[h,f]=u.useState(null),[m,p]=u.useState(null),[y,g]=u.useState(null),b=t.package,[v,x]=u.useState(!1),w=u.useRef(!1);u.useEffect(()=>{e&&(f(null),p(null),g(null))},[e]);const _=async S=>{if(S.preventDefault(),w.current)return;const k=o.trim();if(!k||k.length>200){f("Give the proposal a title of at most 200 characters.");return}f(null),p(null),g(null),x(!0),w.current=!0;try{const j=await n({title:k,...c.trim()?{note:c.trim()}:{}});if(!j.ok){p(b?mV(b,j.refusal):NE[j.refusal.code??""]??j.refusal.message),b&&j.refusal.code==="proposal_duplicate"&&g(j.refusal.duplicate??null);return}j.data.state==="proposed"&&(l(""),d("")),a(j.data,k)}finally{w.current=!1,x(!1)}};return i.jsx(jn,{open:e,onOpenChange:S=>S?null:s(),children:i.jsx(Nn,{className:"sm:max-w-lg",children:i.jsxs("form",{onSubmit:S=>void _(S),className:"grid gap-4",noValidate:!0,children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:"Submit proposal"}),i.jsx(Dn,{children:"Someone who may make these changes reviews it. Nothing in the organization changes until it is accepted."})]}),m?i.jsxs(me,{variant:"destructive",role:"alert",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Could not submit the proposal"}),i.jsxs(pe,{children:[i.jsx("p",{children:m}),y&&r?i.jsx("div",{className:"mt-2",children:i.jsx(U,{type:"button",variant:"outline",size:"sm",onClick:()=>r(y),children:"Open proposal"})}):null]})]}):null,i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"org-proposal-title",children:"Title"}),i.jsx(yt,{id:"org-proposal-title",value:o,maxLength:200,"aria-invalid":h?!0:void 0,"aria-describedby":h?"org-proposal-title-error":void 0,onChange:S=>l(S.target.value)}),h?i.jsx("p",{id:"org-proposal-title-error",className:"text-destructive text-sm",children:h}):null]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"org-proposal-note",children:"Note (optional)"}),i.jsx(Vn,{id:"org-proposal-note",value:c,rows:3,maxLength:4e3,placeholder:"Why the org should make this change","aria-describedby":"org-proposal-note-help",onChange:S=>d(S.target.value)}),i.jsx("p",{id:"org-proposal-note-help",className:"text-muted-foreground text-xs",children:"At most 4000 characters."})]}),i.jsx("p",{className:"text-muted-foreground text-xs break-words",children:b?`From ${b.coordinate} ${b.version} · ${va(t.counts)}`:va(t.counts)}),i.jsxs(Sn,{children:[i.jsx(U,{type:"button",variant:"outline",onClick:s,children:"Cancel"}),i.jsxs(U,{type:"submit","aria-disabled":v||void 0,children:[v?i.jsx(wn,{className:"size-4","aria-hidden":"true"}):null,v?"Submitting…":"Submit proposal"]})]})]})})})}const gV=[{kind:"team",title:"Teams"},{kind:"job_function",title:"Job functions"},{kind:"slot",title:"Slots"},{kind:"post",title:"Posts"},{kind:"fill",title:"Fills"}];function xV({entry:e,decided:t}){const n=!t&&e.state==="settled",s=JH[e.change];return i.jsxs("li",{className:"grid gap-1 border-b py-2","data-testid":"org-proposal-entry",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n&&e.change==="added"?null:i.jsx(be,{variant:s.tone,children:s.label}),i.jsx("span",{className:"text-sm font-medium",children:e.name}),n?i.jsx(be,{variant:"neutral",children:"Already in the org"}):null,!t&&e.state==="conflict"?i.jsx(be,{variant:"error",children:"Changed in the org since"}):null]}),[...e.where,...e.fields,...!t&&e.now?[e.now]:[]].map(a=>i.jsx("p",{className:"text-muted-foreground text-xs break-words",children:a},a))]})}function w_(e,t){if(t.code==="proposal_conflict"&&e){const n=e.entries.filter(s=>s.state==="conflict").map(s=>s.name);if(n.length){const s=`The org changed what this proposal changes: ${vb(n)}.`,a=e.proposal.source&&!e.proposal.source.withdrawn?e.proposal.source:void 0;if(a)return e.proposal.mine?`${s} Withdraw it, then propose it again.`:e.may_reject?`${s} Reject it, then propose ${a.label} again.`:`${s} You can ask ${e.proposal.requested_by} to withdraw it and propose ${a.label} again.`;if(e.proposal.mine)return`${s} Withdraw it and propose again from the org as it is now.`;const r=`ask ${e.proposal.requested_by} to withdraw it and propose again.`;return e.may_reject?`${s} Reject it, or ${r}`:`${s} You can ${r}`}}return t.code==="revision_conflict"?"Someone else changed the org. We read it again; check the proposal and accept again.":t.message}function vV({source:e,via:t}){const n=Fa(),s=e.content_hash,a=async()=>{if(s)try{await navigator.clipboard.writeText(s),n.success("Copied the content hash.")}catch{n.error("Could not copy the content hash. Select it in the tooltip instead.")}},r=e.readable!==!1&&e.owner,o=r&&e.published_at?` on ${xi(e.published_at)}`:"",l=[r?rV(wE(e.owner,e.organization_name)):null,r&&e.published_by_name?`published by ${e.published_by_name}${o}`:o?`published${o}`:null,t?`proposed ${bb(t)}`:null].filter(Boolean),c=s?s.replace(/^sha256:/,"").slice(0,7):"";return i.jsxs("p",{className:"text-muted-foreground text-xs break-words","data-testid":"org-proposal-provenance",children:[s?i.jsxs(i.Fragment,{children:[i.jsxs(kd,{children:[i.jsx(Sd,{asChild:!0,children:i.jsx("span",{className:"font-mono",tabIndex:0,children:c})}),i.jsx(ul,{className:"break-all font-mono",children:s})]}),i.jsx(U,{type:"button",variant:"ghost",size:"xs-icon",className:"mx-0.5 align-middle","aria-label":"Copy content hash",onClick:()=>void a(),children:i.jsx(Sv,{className:"size-3.5","aria-hidden":"true"})})," · "]}):null,l.join(" · ")]})}function bV(e){var a,r;const t=((a=e.proposal.source)==null?void 0:a.newest_version)??null,n="There is no usable version now.";if(e.may_reject&&!e.proposal.mine)return t?`Reject it, then propose ${t} if the org still wants it.`:`Reject it. ${n}`;if(e.proposal.mine)return t?`Withdraw it, then propose ${t}.`:`Withdraw it. ${n}`;const s=(r=e.ask)!=null&&r.length?nV(e.ask):"an org admin";return t?`Ask ${s} to reject it.`:`Ask ${s} to reject it. ${n}`}function yV(e){var r,o;const t=(r=e.source)==null?void 0:r.withdrawn_at;if(!((o=e.source)!=null&&o.withdrawn)||!t)return null;const n=`Version withdrawn ${xi(t)}`;if(!e.decided_at)return`${n}.`;const s=Date.parse(t)<Date.parse(e.decided_at)?"before":"after",a=e.status==="accepted"?"this proposal was accepted":e.status==="rejected"?"it was rejected":"it was withdrawn";return`${n}, ${s} ${a}.`}function wV({since:e}){const{previewed:t,opened:n}=e;if(t.revision===n.revision)return null;const s=new Set(t.not_proposed.map(ar)),a=new Set(n.not_proposed.map(ar)),r=n.not_proposed.filter(d=>!s.has(ar(d))),o=t.not_proposed.filter(d=>!a.has(ar(d))),c=va(t.counts)===va(n.counts)&&r.length===0&&o.length===0;return i.jsxs(me,{variant:"info",role:"status","data-testid":"org-proposal-since-preview",children:[i.jsx(pn,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"The org changed since the preview"}),i.jsxs(pe,{children:[i.jsxs("p",{children:[`This proposal opened at revision ${n.revision}; you previewed it at revision ${t.revision}, so its change was worked out again.`,c?" The counts are the same as previewed.":` Previewed: ${v_(va(t.counts))}. Opened: ${v_(va(n.counts))}.`]}),r.map(d=>i.jsxs("p",{children:["Now not part of this proposal: ",tx(d)]},`now-not:${ar(d)}`)),o.map(d=>i.jsxs("p",{children:["Now part of this proposal: ",tx(d)]},`now:${ar(d)}`))]})]})}function _V({proposal:e,contract:t,context:n,check_two_factor:s,on_close:a,on_decided:r,since:o=null,on_preview_version:l}){const[c,d]=u.useState(null),[h,f]=u.useState(null),[m,p]=u.useState(null),[y,g]=u.useState(!1),[b,v]=u.useState(null),[x,w]=u.useState("ok"),[_,S]=u.useState(null),[k,j]=u.useState(""),N=(e==null?void 0:e.id)??null,O=u.useRef(N);O.current=N;const T=u.useCallback(async()=>{if(!N)return;const B=await t.read(N);O.current===N&&(B.ok?(d(B.data),f(null)):f(B.refusal.message))},[t,N]);u.useEffect(()=>{if(d(null),f(null),p(null),g(!1),j(""),!N)return;T(),s().then(w);const B=()=>void s().then(Z=>O.current===N&&w(Z));return window.addEventListener("focus",B),()=>window.removeEventListener("focus",B)},[N,T,s]);const P=(c==null?void 0:c.proposal)??e,L=(P==null?void 0:P.title)??"",G=(P==null?void 0:P.status)==="open",A=(c==null?void 0:c.entries.some(B=>B.state==="conflict"))??!1,D=!!c&&(c.may_accept||c.may_reject),C=x==="ok",R={...n,two_factor:x},E=async B=>{if(N){v(B),p(null);try{const Z=B==="accept"?await t.accept(N):B==="reject"?await t.reject(N,k.trim()||void 0):await t.withdraw(N);if(Z.ok){S(null),r(B==="accept"?`Accepted ${L}.`:B==="reject"?`Rejected ${L}.`:`Withdrew ${L}.`);return}if(S(null),Z.refusal.code==="mfa_challenge_required"||Z.refusal.code==="mfa_enrollment_required"){w(Z.refusal.code==="mfa_enrollment_required"?"enroll":"challenge");return}B==="accept"&&g(!0);const Q=await t.read(N);if(O.current!==N)return;const ie=Q.ok?Q.data:c;Q.ok&&d(Q.data),p({title:`${L} was not ${B==="accept"?"accepted":B==="reject"?"rejected":"withdrawn"}`,message:w_(ie,Z.refusal)})}finally{v(null)}}},M=c&&A&&!m?w_(c,{code:"proposal_conflict",message:""}):null,H=(c==null?void 0:c.proposal.source)??null,z=!!H&&H.readable!==!1,K=G&&!!c&&z&&!!(H!=null&&H.withdrawn),oe=(H==null?void 0:H.newest_version)??null,re=G&&c&&c.may_reject&&!c.may_accept&&!A&&!K?c.accept_refusal??null:null,ve=!C||A||!!re||K||b!==null,ke=[C?null:"org-proposal-two-factor",A?"org-proposal-refusal":null,re?"org-proposal-accept-refusal":null,K?"org-proposal-withdrawn":null].filter(Boolean).join(" "),ae=!G&&c&&z?yV(c.proposal):null,Ne=H?(c==null?void 0:c.not_proposed)??[]:[],q=G&&H?(c==null?void 0:c.possible_matches)??null:null;return i.jsxs(i.Fragment,{children:[i.jsx(jn,{open:e!==null,onOpenChange:B=>B?null:a(),children:i.jsxs(Nn,{className:"flex max-h-[90vh] flex-col overflow-hidden sm:max-w-2xl",children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:L}),i.jsx(Dn,{asChild:!0,children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[P?i.jsx(be,{variant:Th[P.status].tone,children:Th[P.status].label}):null,i.jsx("span",{children:P?sV(P):null}),c!=null&&c.proposal.source?i.jsx(iV,{source:c.proposal.source}):null]})}),H?i.jsx(vV,{source:H,via:c==null?void 0:c.proposal.via}):null,H&&!z?i.jsx("p",{className:"text-muted-foreground text-xs",children:"You can't read this package, so its version's state isn't shown."}):null,ae?i.jsx("p",{className:"text-muted-foreground text-xs",children:ae}):null]}),i.jsxs("div",{className:"-mx-1 grid min-h-0 flex-1 gap-4 overflow-y-auto px-1","data-testid":"org-proposal-body",children:[o?i.jsx(wV,{since:o}):null,K&&c?i.jsxs(me,{id:"org-proposal-withdrawn",variant:"warning",role:"status",children:[i.jsx(Nt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"This proposal can't be accepted"}),i.jsxs(pe,{children:[i.jsxs("p",{children:[H!=null&&H.withdrawn_at?`Version withdrawn ${xi(H.withdrawn_at)}, after this proposal opened; it can't be accepted.`:"Its version was withdrawn after this proposal opened; it can't be accepted."," ",bV(c)]}),oe&&(H!=null&&H.package_id)&&l?i.jsx("div",{className:"mt-2",children:i.jsxs(U,{type:"button",variant:"outline",size:"sm",onClick:()=>l({package_id:H.package_id,version:oe}),children:[i.jsx(pf,{className:"size-4","aria-hidden":"true"}),`Preview ${oe}`]})}):null]})]}):null,P!=null&&P.note?i.jsx("p",{className:"text-sm whitespace-pre-line",children:P.note}):null,P!=null&&P.decision_note?i.jsxs("div",{className:"grid gap-1",children:[i.jsx("span",{className:"text-sm font-medium",children:"Decision note"}),i.jsx("p",{className:"text-muted-foreground text-sm whitespace-pre-line",children:P.decision_note})]}):null,h?i.jsxs(me,{variant:"destructive",role:"alert",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Could not read the proposal"}),i.jsx(pe,{children:i.jsx("p",{children:h})})]}):null,!c&&!h?i.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Reading the proposal…"}):null,c?gV.map(B=>{const Z=c.entries.filter(Q=>Q.kind===B.kind);return Z.length?i.jsxs("div",{className:"grid",children:[i.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:B.title}),i.jsx("ul",{role:"list",className:"m-0 list-none p-0",children:Z.map(Q=>i.jsx(xV,{entry:Q,decided:!G},`${Q.kind}:${Q.name}`))})]},B.kind):null}):null,q&&q.matches.length?i.jsx(hc,{title:"Possible matches",heading:"muted",children:i.jsx(_E,{matches:q})}):null,Ne.length?i.jsx(hc,{title:"Not part of this proposal",heading:"muted",children:i.jsx(jE,{items:Ne})}):null,G&&c&&!D&&c.decide_refusal?i.jsxs(me,{variant:"info",role:"status",children:[i.jsx(pn,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"You can't accept or reject this proposal"}),i.jsx(pe,{children:i.jsx("p",{children:c.decide_refusal})})]}):null,re?i.jsxs(me,{id:"org-proposal-accept-refusal",variant:"info",role:"status",children:[i.jsx(pn,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"You can't accept this proposal"}),i.jsx(pe,{children:i.jsx("p",{children:re})})]}):null,G&&D&&!C?i.jsx("div",{id:"org-proposal-two-factor",children:i.jsx(Hc,{context:R,action:"decide the proposal",changing:"Accepting or rejecting a proposal"})}):null,m||M?i.jsxs(me,{id:"org-proposal-refusal",variant:"destructive",role:"alert",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:(m==null?void 0:m.title)??(y?`${L} was not accepted`:`${L} can't be accepted`)}),i.jsx(pe,{children:i.jsx("p",{children:(m==null?void 0:m.message)??M})})]}):null]}),i.jsxs(Sn,{children:[i.jsx(U,{type:"button",variant:"outline",onClick:a,children:"Close"}),G&&(c!=null&&c.may_withdraw)?i.jsx(U,{type:"button",variant:"outline",onClick:()=>S("withdraw"),children:"Withdraw proposal"}):null,G&&(c!=null&&c.may_reject)?i.jsx(U,{type:"button",variant:"outline",onClick:()=>S("reject"),children:"Reject"}):null,G&&c&&(c.may_accept||c.may_reject&&(A||re||K))?i.jsxs(U,{type:"button","aria-disabled":ve||void 0,"aria-describedby":ke||void 0,onClick:()=>ve?void 0:void E("accept"),children:[b==="accept"?i.jsx(wn,{className:"size-4","aria-hidden":"true"}):null,b==="accept"?"Accepting…":"Accept"]}):null]})]})}),i.jsx(bf,{open:_!==null,onOpenChange:B=>B?null:S(null),children:i.jsxs(yf,{children:[i.jsxs(wf,{children:[i.jsx(jf,{children:_==="reject"?`Reject ${L}?`:`Withdraw ${L}?`}),i.jsx(Nf,{children:_==="reject"?`${(P==null?void 0:P.requested_by)??"The requester"} sees your note on the proposal.`:"Nobody can accept it after this."})]}),_==="reject"&&!C?i.jsx("div",{id:"org-proposal-reject-two-factor",children:i.jsx(Hc,{context:R,action:"reject the proposal",changing:"Accepting or rejecting a proposal"})}):null,_==="reject"?i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"org-proposal-reject-note",children:"Note (optional)"}),i.jsx(Vn,{id:"org-proposal-reject-note",value:k,rows:2,maxLength:4e3,placeholder:"Why you are rejecting it",onChange:B=>j(B.target.value)})]}):null,i.jsxs(_f,{children:[i.jsx(Rv,{children:"Cancel"}),_==="reject"?i.jsx(U,{type:"button",variant:"destructive","aria-disabled":!C||b!==null||void 0,"aria-describedby":C?void 0:"org-proposal-reject-two-factor",onClick:()=>!C||b?void 0:void E("reject"),children:b==="reject"?"Rejecting…":"Reject proposal"}):i.jsx(U,{type:"button","aria-disabled":b!==null||void 0,onClick:()=>b?void 0:void E("withdraw"),children:b==="withdraw"?"Withdrawing…":"Withdraw"})]})]})})]})}const __="Packages you can't read aren't listed. A read grant to a team reaches its own members, not its sub-teams; ask an org admin or the package's publisher for read access.",jV=100,NV=20;function kV(e){if(!e.truncated)return null;const t=e.packages.length>=jV,n=e.packages.some(s=>s.versions.length>=NV);return t&&n?"Showing the first 100 packages and each package's 20 newest versions":n?"Showing each package's 20 newest versions":"Showing the first 100 packages"}function SV(e){return[e.status==="deprecated"?`${e.version} · Deprecated`:e.version,e.published_at?xi(e.published_at):null,e.published_by_name??null].filter(Boolean).join(" · ")}function CV(e,t){return e.code==="package_version_withdrawn"?e.newest_version?`${t} was withdrawn. Choose ${e.newest_version}, its newest usable version.`:`${t} was withdrawn. It has no usable version now.`:e.code==="not_found"||e.reason==="not_found"?"This package or version can no longer be read.":e.message}function DV({open:e,contract:t,packages_href:n,initial:s,preview:a,on_close:r,on_previewed:o}){const[l,c]=u.useState({state:"loading"}),[d,h]=u.useState(""),[f,m]=u.useState(""),[p,y]=u.useState(!1),[g,b]=u.useState(null),v=u.useRef(0),x=u.useCallback(async()=>{var R;const L=v.current+=1;c({state:"loading"}),b(null),y(!1);const G=t.packageChoices?await t.packageChoices():{ok:!1,refusal:{message:"This organization offers no package choices."}};if(L!==v.current)return;if(!G.ok){c({state:"failed",message:G.refusal.message});return}const A=G.data;c({state:"read",choices:A});const D=s&&A.packages.find(E=>E.package_id===s.package_id)||A.packages[0];h((D==null?void 0:D.package_id)??"");const C=s&&D&&D.package_id===s.package_id?D.versions.find(E=>E.version===s.version):void 0;m((C==null?void 0:C.version)??((R=D==null?void 0:D.versions[0])==null?void 0:R.version)??"")},[t,s]);u.useEffect(()=>{if(!e){v.current+=1,y(!1);return}x()},[e,x]);const w=l.state==="read"?l.choices:null,_=(w==null?void 0:w.packages.find(L=>L.package_id===d))??null,S=(w==null?void 0:w.packages.filter(L=>L.owner==="own"))??[],k=(w==null?void 0:w.packages.filter(L=>L.owner==="softwaredlc"))??[],j=w?kV(w):null,N=!!w&&w.packages.length===0,O=L=>{var G,A;h(L),b(null),m(((A=(G=w==null?void 0:w.packages.find(D=>D.package_id===L))==null?void 0:G.versions[0])==null?void 0:A.version)??"")},T=async L=>{if(L.preventDefault(),p||!_||!f)return;const G=v.current;y(!0),b(null);try{const A=await a({package_id:_.package_id,version:f});if(G!==v.current)return;if(!A.ok){b(CV(A.refusal,`${_.coordinate} ${f}`));return}o(A.data)}finally{G===v.current&&y(!1)}},P=l.state==="failed"?l.message:g;return i.jsx(jn,{open:e,onOpenChange:L=>L?null:r(),children:i.jsx(Nn,{className:"sm:max-w-lg",children:i.jsxs("form",{className:"grid gap-4",onSubmit:L=>void T(L),noValidate:!0,children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:"Propose from a package"}),i.jsx(Dn,{children:"Choose a published version of an org structure package. You see what it adds and changes in the org before you submit."})]}),P?i.jsxs(me,{variant:"destructive",role:"alert",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:l.state==="failed"?"Could not read the packages":"Could not preview this version"}),i.jsxs(pe,{children:[i.jsx("p",{children:P}),l.state==="failed"?i.jsx("div",{className:"mt-2",children:i.jsx(U,{type:"button",variant:"outline",size:"sm",onClick:()=>void x(),children:"Retry"})}):null]})]}):null,l.state==="loading"?i.jsxs("div",{className:"grid gap-4",role:"status","aria-label":"Reading the packages",children:[i.jsx(Tt,{className:"h-9 w-full"}),i.jsx(Tt,{className:"h-9 w-full"})]}):null,N?i.jsxs("div",{className:"grid justify-items-center gap-2 py-4 text-center",children:[i.jsx(pf,{className:"text-muted-foreground size-5","aria-hidden":"true"}),i.jsx("p",{className:"text-sm font-medium",children:"No org structure packages to propose from"}),i.jsx("p",{className:"text-muted-foreground text-xs",children:__}),i.jsx("a",{className:"text-primary text-sm underline underline-offset-2",href:n,children:"Go to Packages"})]}):null,w&&_?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"org-package-choice",children:"Package"}),i.jsxs(St,{value:d,onValueChange:O,children:[i.jsx(_t,{id:"org-package-choice","aria-describedby":"org-package-coordinate",children:i.jsx(Ct,{})}),i.jsxs(jt,{children:[S.length?i.jsxs(Kw,{children:[i.jsx(Hg,{children:"This org"}),S.map(L=>i.jsx(Be,{value:L.package_id,children:L.name},L.package_id))]}):null,k.length?i.jsxs(Kw,{children:[i.jsx(Hg,{children:"SoftwareDLC"}),k.map(L=>i.jsx(Be,{value:L.package_id,children:L.name},L.package_id))]}):null]})]}),i.jsxs("p",{id:"org-package-coordinate",className:"text-muted-foreground text-xs break-words",children:[i.jsx("span",{className:"font-mono",children:_.coordinate}),_.organization_name?` · ${_.organization_name}`:null]})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"org-package-version",children:"Version"}),i.jsxs(St,{value:f,onValueChange:L=>{m(L),b(null)},children:[i.jsx(_t,{id:"org-package-version",children:i.jsx(Ct,{})}),i.jsx(jt,{children:_.versions.map(L=>i.jsx(Be,{value:L.version,children:SV(L)},L.version))})]})]})]}):null,w&&!N?i.jsxs("div",{className:"grid gap-1",children:[j?i.jsx("p",{className:"text-muted-foreground text-xs",children:j}):null,i.jsx("p",{className:"text-muted-foreground text-xs",children:__})]}):null,i.jsx(Sn,{children:w&&_?i.jsxs(i.Fragment,{children:[i.jsx(U,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),i.jsxs(U,{type:"submit","aria-disabled":p||void 0,children:[p?i.jsx(wn,{className:"size-4","aria-hidden":"true"}):null,p?"Loading…":"Preview proposal"]})]}):i.jsx(U,{type:"button",variant:"outline",onClick:r,children:"Close"})})]})})})}function EV({draft:e,org:t,duplicate_day:n,on_submit:s,on_choose:a,on_discard:r,on_open_proposal:o}){const l=e.package,c=`${l.coordinate} ${l.version}`,d=l.open_duplicate,h=!d&&e.total===0,f=i.jsxs(i.Fragment,{children:[i.jsx(U,{type:"button",variant:"outline",size:"sm",onClick:a,children:"Choose another version"}),i.jsx(U,{type:"button",variant:"outline",size:"sm",onClick:r,children:"Discard preview"})]});if(d)return i.jsxs(me,{variant:"warning",role:"status",className:"mt-6","data-testid":"org-package-banner",children:[i.jsx(Nt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:`Already proposed: '${d.title}' by ${d.requested_by}`}),i.jsxs(pe,{children:[i.jsx("p",{children:`${d.requested_by} proposed this version ${bb(d.via)}${n?` on ${xi(n)}`:""}. Review that proposal instead of proposing it again.`}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[i.jsx(U,{type:"button",size:"sm",onClick:()=>o(d),children:"Open proposal"}),f]})]})]});const m=[`From ${wE(l.owner,l.organization_name)}`,l.published_by_name?`, published by ${l.published_by_name}`:"",l.published_at?` on ${xi(l.published_at)}`:"",`, laid over ${t} as it was at revision ${l.revision}.`].join("");return i.jsxs(me,{variant:"info",role:"status",className:"mt-6","data-testid":"org-package-banner",children:[i.jsx(pf,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{className:"break-words",children:h?`This version adds and changes nothing in ${t}`:i.jsxs(i.Fragment,{children:["You are proposing ",l.href?i.jsx("a",{className:"text-primary underline underline-offset-2",href:l.href,children:c}):c]})}),i.jsxs(pe,{children:[i.jsx("p",{children:h?"Choose another version, or discard this preview.":`${m} A package proposal adds and changes; it never removes. Nothing is saved to the organization until someone accepts it.`}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[h?null:i.jsx(U,{type:"button",size:"sm",onClick:s,children:"Submit proposal"}),f,h?null:i.jsx("span",{className:"text-muted-foreground text-xs",children:va(e.counts)})]})]})]})}function AV({draft:e}){const t=e.package,n=e.total>0,s=n?t.placements:[],a=n?t.possible_matches:{matches:[],truncated:!1};return!s.length&&!a.matches.length&&!t.not_proposed.length?null:i.jsxs("section",{"aria-labelledby":"org-package-before",className:"mt-6 min-w-0",children:[i.jsx("h2",{id:"org-package-before",className:"text-lg font-semibold",children:"Before you submit"}),i.jsxs(wt,{className:"mt-3 grid gap-4 p-4",children:[s.length?i.jsx(hc,{title:"Where new teams go",children:i.jsx(lV,{placements:s})}):null,a.matches.length?i.jsx(hc,{title:"Possible matches",children:i.jsx(_E,{matches:a})}):null,t.not_proposed.length?i.jsx(hc,{title:"Not part of this proposal",children:i.jsx(jE,{items:t.not_proposed})}):null]})]})}function RV(e){return!!(e!=null&&e.package)}const j_={title:"Discard your draft?",description:"Your changes to the draft are lost. Nothing in the organization changed.",action_label:"Discard draft",destructive:!0,action:"discard the draft"},N_=e=>({title:"Leave this package preview?",description:`Leaving drops this preview of ${e}. Nothing was proposed and nothing in the organization changed.`,action_label:"Leave preview",cancel_label:"Stay",destructive:!1,action:"leave the preview"}),TV={local:"Who holds each post and who reports to whom in this repository's local org, worked out from its teams, job functions and posts.",hosted:"Who holds each post and who reports to whom in this organization, worked out from its teams, job functions and posts."},OV="Covered: someone holds a post that fills the slot. Vacant: posts fill it but nobody holds them. Uncovered: no job function fills it.",zV=4,yb=e=>({paddingLeft:16+24*Math.min(e,zV)}),Oh={covered:{label:"Covered",tone:"success"},vacant:{label:"Vacant",tone:"warning"},uncovered:{label:"Uncovered",tone:"error"}};function MV(){const e=Wn().org;if(!e)throw new Error("The Org chart page rendered without the org seam.");return e}function $V({host:e="local",org:t=""}={}){var ie;const n=MV(),[s,a]=u.useState({state:"loading"}),[r,o]=u.useState(null),l=u.useRef(0),c=u.useRef(null),d=u.useCallback(ce=>{const $=async F=>{const ee=l.current+=1;c.current&&clearTimeout(c.current);const se=await n.chart();if(ee!==l.current)return;if(se.ok){o({chart:se.data,at:new Date().toISOString()}),a({state:"read"});return}const{refusal:ge}=se;if(ge.reason==="no_local_org"){o(null),a({state:"none",seedable:ge.seedable!==!1});return}if(e==="hosted"&&(ge.reason==="not_found"||ge.status===404)){o(null),a({state:"missing"});return}if(ge.retry&&ge.reason==="store_locked"&&F>0){const de=ge.retry_after??10;a({state:"busy",retry_after:de}),c.current=setTimeout(()=>void $(F-1),de*1e3);return}a({state:"failed",refusal:ge})};return $(ce)},[n,e]);u.useEffect(()=>(d(1),()=>{l.current+=1,c.current&&clearTimeout(c.current)}),[d]);const h=()=>void d(1),f=s.state==="none"||s.state==="missing"?null:r,{href:m}=lt(),p=Fa(),y=m("/settings/account"),g=n.proposals,b=cV(g,(f==null?void 0:f.at)??null),v=!!g&&b.state!=="off",[x,w]=u.useState(null),[_,S]=u.useState(!1),[k,j]=u.useState(null),{confirm:N,confirm_dialog:O}=yE(pl),T=RV(x)?x:null,[P,L]=u.useState(null),[G,A]=u.useState(null),D=g!=null&&g.packageChoices&&g.draft.beginFromPackage?g:null,C=u.useMemo(()=>x&&!x.package&&g?{draft:x,change:g.draft.change,on_draft:w}:null,[x,g]),R=FV(n,h,(x==null?void 0:x.chart)??(f==null?void 0:f.chart)??IV,e,y,C),E=T?null:R,M=n.twoFactor,H=u.useCallback(async()=>M?M():"ok",[M]),z=!!x&&(x.total>0||!!x.package),K=T?`${T.package.coordinate} ${T.package.version}`:null,oe=u.useMemo(()=>K?N_(K):j_,[K]),re=u.useRef(null),ve=u.useRef(()=>{});ve.current=()=>{g==null||g.draft.discard(),w(null)},u.useEffect(()=>{var de;if(!z)return;let ce=!0;const $=((de=re.current)==null?void 0:de.closest("[data-dock-pane]"))??null,F=Le=>{Le.preventDefault()},ee=()=>{ce=!1,window.removeEventListener("beforeunload",F),document.removeEventListener("click",se,!0),$==null||$.removeEventListener(k_,ge)},se=Le=>{var en,zt,tt;if(!ce||Le.defaultPrevented||Le.button!==0||Le.metaKey||Le.ctrlKey||Le.shiftKey||Le.altKey)return;const Ee=Le.target;if($&&(((en=Ee==null?void 0:Ee.closest)==null?void 0:en.call(Ee,"[data-dock-pane]"))??document.querySelector("[data-dock-active]"))!==$)return;const W=(zt=Ee==null?void 0:Ee.closest)==null?void 0:zt.call(Ee,"a[href]"),_e=W?null:(tt=Ee==null?void 0:Ee.closest)==null?void 0:tt.call(Ee,LV);let He=null;if(W&&W.target!=="_blank"&&!W.hasAttribute("download")){const ft=new URL(W.href,window.location.href),It=$?new URL($.getAttribute("data-dock-address")??"",window.location.href):window.location,zn=ft.pathname===It.pathname&&ft.search===It.search;ft.origin===window.location.origin&&!zn&&(He=$?()=>W.click():()=>window.location.assign(ft.href))}else _e&&_e.getAttribute("aria-current")!=="page"&&_e.getAttribute("aria-disabled")!=="true"&&!_e.hasAttribute("disabled")&&(He=()=>_e.click());if(!He)return;Le.preventDefault(),Le.stopPropagation();const Dt=He;N(oe).then(ft=>{ft&&(ee(),ve.current(),Dt())})},ge=Le=>{var W;const Ee=(W=Le.detail)==null?void 0:W.close;!ce||typeof Ee!="function"||(Le.preventDefault(),N(oe).then(_e=>{_e&&(ee(),ve.current(),Ee())}))};return window.addEventListener("beforeunload",F),document.addEventListener("click",se,!0),$==null||$.addEventListener(k_,ge),ee},[z,N,oe]);const ke=async()=>{if(!g)return;const ce=await g.draft.begin();ce.ok?w(ce.data):p.error(ce.refusal.message)},ae=async()=>x?x.package?N(N_(`${x.package.coordinate} ${x.package.version}`)):x.total>0?N(j_):!0:!0,Ne=async()=>{await ae()&&(g==null||g.draft.discard(),w(null))},q=async()=>{x&&!x.package&&!await ae()||(x&&!x.package&&(g==null||g.draft.discard(),w(null)),L({initial:null}))},B=async ce=>{if(!(D!=null&&D.draft.beginFromPackage)||!await ae())return;const $=await D.draft.beginFromPackage(ce);if(!$.ok){$.refusal.code!=="preview_replaced"&&p.error($.refusal.message);return}j(null),A(null),w($.data)},Z=ce=>{const $=b.state==="read"?b.proposals.find(F=>F.id===ce.proposal_id):void 0;g==null||g.draft.discard(),S(!1),w(null),A(null),j($??{id:ce.proposal_id,title:ce.title,status:"open",requested_by:ce.requested_by,requested_at:"",mine:!1,counts:(x==null?void 0:x.counts)??PV})},Q=T!=null&&T.package.open_duplicate&&b.state==="read"?((ie=b.proposals.find(ce=>ce.id===T.package.open_duplicate.proposal_id))==null?void 0:ie.requested_at)??null:null;return s.state==="missing"?i.jsx(XV,{org:t}):i.jsx(ab,{children:i.jsxs("div",{ref:re,className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:[i.jsx(_n,{title:"Org chart",description:TV[e]}),s.state==="busy"&&!f?i.jsxs("p",{className:"text-muted-foreground mt-4 text-sm",role:"status",children:["Another sdlc command holds the repository store; reading again in ",s.retry_after," s."]}):null,(s.state==="loading"||s.state==="busy")&&!f?i.jsx(qV,{quiet:s.state==="busy"}):null,s.state==="none"?i.jsx(YV,{edit:(E==null?void 0:E.actions)??null,seedable:s.seedable}):null,s.state==="failed"?i.jsx(ZV,{host:e,kept_at:(f==null?void 0:f.at)??null,on_retry:h}):null,f&&T?i.jsxs(i.Fragment,{children:[i.jsx(EV,{draft:T,org:f.chart.org,duplicate_day:Q,on_submit:()=>S(!0),on_choose:()=>L({initial:{package_id:T.package.package_id,version:T.package.version}}),on_discard:()=>void Ne(),on_open_proposal:Z}),i.jsx(AV,{draft:T})]}):f&&x?i.jsx(fV,{draft:x,on_submit:()=>S(!0),on_discard:()=>void Ne()}):f&&v?i.jsx(uV,{listed:b,on_propose:()=>void ke(),...D?{on_propose_package:()=>void q()}:{},on_open:j}):null,f?i.jsx(QV,{chart:(x==null?void 0:x.chart)??f.chart,host:e,edit:(E==null?void 0:E.actions)??null,...T?{marks:T.marks}:{}}):null,(E==null?void 0:E.dialogs)??null,D!=null&&D.draft.beginFromPackage?i.jsx(DV,{open:P!==null,contract:D,packages_href:m(`/org/${encodeURIComponent(t)}/packages`),initial:(P==null?void 0:P.initial)??null,preview:D.draft.beginFromPackage,on_close:()=>{var ce,$;($=(ce=D.draft).dropPending)==null||$.call(ce),L(null)},on_previewed:ce=>{L(null),w(ce)}}):null,g&&x?i.jsx(pV,{open:_,draft:x,submit:g.draft.submit,on_close:()=>S(!1),on_open_proposal:Z,on_done:(ce,$)=>{if(S(!1),ce.state==="moved"){w(ce.draft);return}w(null),p.success(`Proposed ${$}.`),h(),ce.proposal&&(A(ce.previewed&&ce.opened?{previewed:ce.previewed,opened:ce.opened}:null),j(ce.proposal))}}):null,g&&v?i.jsx(_V,{proposal:k,contract:g,context:{host:e,two_factor:"ok",settings_href:y},check_two_factor:H,since:G,...D?{on_preview_version:ce=>void B(ce)}:{},on_close:()=>{j(null),A(null)},on_decided:ce=>{p.success(ce),j(null),A(null),h()}}):null,O]})})}const LV='[data-sidebar="menu-button"]:not([aria-expanded]), [data-sidebar="menu-sub-button"]',k_="sdlc-dock-pane-close",Ol={added:0,changed:0,removed:0},PV={team:Ol,job_function:Ol,slot:Ol,post:Ol,fill:Ol},IV={org:"",workflow:!1,teams:[],job_functions:[],slots:[],posts:[],members:[],slot_resolution:[],project:{team:null,roots:[]}};function GV(e){var o;const t=e.authority;if(!t)return{functions:!0,team_add:!0,team:()=>"full",post_add:!1,post:()=>!1,override:!0,slots:!1};const n=((o=e.teams.find(l=>l.parent===null))==null?void 0:o.key)??null,s=new Set(t.teams),a=new Set(t.team_descriptions),r=new Set(t.posts);return{functions:t.administer,team_add:s.size>0,team:l=>l===n?t.administer?"root":a.has(l)?"description":null:s.has(l)?"full":a.has(l)?"description":null,post_add:t.post_pairs.length>0,post:l=>r.has(l),override:!1,slots:t.administer}}function HV(e){const t=e.authority;return t?t.administer||t.teams.length>0||t.team_descriptions.length>0||t.posts.length>0||t.post_pairs.length>0:!0}const VV={functions:!0,team_add:!0,team:()=>"description",post_add:!0,post:()=>!0,override:!1,slots:!0};function qf({mark:e}){return e?e==="added"?i.jsx(be,{variant:"success",children:"Added"}):i.jsx(be,{variant:"warning",children:"Changed"}):null}const UV={local:"It leaves this repository's local org. If a post, a team or function under it, a holder, an override or the project still needs it, nothing is removed and you are told what needs it.",hosted:"It leaves the organization. If a post, a team or job function under it, or a holder still needs it, nothing is removed and you are told what needs it."},BV={mfa_challenge_required:"challenge",mfa_enrollment_required:"enroll"};function WV(e,t,n){var c;const s=t==="hosted"&&!!n.authority,a=((c=n.authority)==null?void 0:c.two_factor)??!0,[r,o]=u.useState("ok"),l=u.useCallback(async()=>{s&&o(e.twoFactor?await e.twoFactor():a?"ok":"challenge")},[e,s,a]);return u.useEffect(()=>{if(!s){o("ok");return}a?o("ok"):l();const d=()=>void l();return window.addEventListener("focus",d),()=>window.removeEventListener("focus",d)},[s,a,l]),{state:r,set_state:o,check:l}}function FV(e,t,n,s,a,r=null){const o=Fa(),l=kE(n),c=WV(e,s,n),d=r?{host:s,two_factor:"ok",settings_href:a}:s==="hosted"?{host:s,two_factor:c.state,settings_href:a}:pl,{confirm:h,confirm_dialog:f}=yE(d),[m,p]=u.useState(null),[y,g]=u.useState({}),b=R=>g(E=>{if(!E[R])return E;const{[R]:M,...H}=E;return H}),v=e.members,x=u.useCallback(async()=>{if(!v)return{ok:!1};const R=await v();return R.ok?{ok:!0,data:R.data}:{ok:!1}},[v]),w=r?async R=>{const E=await r.change(R);return E.ok?(r.on_draft(E.data),{ok:!0,data:{}}):E}:e.change;if(!w||!r&&s==="hosted"&&(!n.authority||!HV(n)))return null;const _=r?VV:GV(n),S=R=>{const E=R.code?BV[R.code]:void 0;return E?(c.set_state(E),{kind:"two_factor",message:R.message}):R.code==="revision_conflict"?(t(),{kind:"changed",message:R.message}):R.code==="outside_authority"?(t(),{kind:"authority",message:R.message}):{message:R.message}},k=R=>R.action==="hold"||R.action==="release"?"posts":"kind"in R?R.kind==="team"?"teams":R.kind==="post"?"posts":R.kind==="slot"?"slots":"functions":null,j=(R,E)=>{if(r)return;const M=R==null?void 0:R.warning;M?o.error(M):o.success(E),t()},N=async(R,E)=>{const M=await w(R);if(!M.ok)return S(M.refusal);const H=k(R);return H&&b(H),j(M.data,E),null},O=R=>{c.check(),p(R)},T=async(R,E,M,H)=>{const z=await w(M);if(!z.ok){const K=S(z.refusal),oe=z.refusal.bound,re=oe?oe.projects.length+oe.more:0,ve=oe?`${oe.kind==="slot"?"Slot":"Post"} ${E} is still needed by the ${re===1?"override of 1 project that binds":`overrides of ${re} projects that bind`} it. Clear ${re===1?"it":"them"} on each project's Settings first.`:K.message;g(ke=>({...ke,[R]:{label:E,message:ve,...oe?{bound:oe}:{}}}));return}b(R),j(z.data,H)},P=async(R,E,M)=>{const H=R==="team"?"team":"job function";c.check(),(r||await h({title:`Remove ${H} ${M}?`,description:UV[s],action_label:"Remove",destructive:!0,action:`remove the ${H}`}))&&await T(R==="team"?"teams":"functions",M,{action:"remove",kind:R,key:E},`${R==="team"?"Team":"Job function"} ${M} removed.`)},L=async R=>{const E=R.label||R.key;c.check(),(r||await h({title:`Remove slot ${E}?`,description:"Projects stop showing it. This can't be undone.",action_label:"Remove slot",destructive:!0,action:"remove the slot"}))&&await T("slots",E,{action:"remove",kind:"slot",key:R.key},`Removed slot ${E}.`)},G=async R=>{const E=l.post(R);c.check(),(r||await h({title:`Remove post ${E}?`,description:"The post leaves the organization's chart. A post with holders is refused; remove its holders first.",action_label:"Remove",destructive:!0,action:"remove the post"}))&&await T("posts",E,{action:"remove",kind:"post",key:R},`Removed post ${E}.`)},A=async(R,E)=>{const M=l.post(R),H=l.member(E),z=n.posts.find(ke=>ke.post===R),oe=((z==null?void 0:z.holders.length)??0)<=1?z!=null&&z.escalates_to?` The post becomes vacant. Until someone holds it, its reports and the slots it fills go to ${l.manager(z.escalates_to)}.`:" The post becomes vacant.":"";if(c.check(),!await h({title:`Remove ${H} from ${M}?`,description:`They stop holding this post and no longer report through it.${oe}`,action_label:"Remove",action:"remove the holder"}))return;const ve=await w({action:"release",post:R,member:E.id});if(!ve.ok){o.error(S(ve.refusal).message),t();return}b("posts"),j(ve.data,`Removed ${H} from ${M}.`)},D=()=>p(null),C=(m==null?void 0:m.kind)==="override"&&n.project&&n.project.team!==null?n.project.slots.find(R=>R.slot===m.slot)??null:null;return{actions:{can:_,host:s,drafting:!!r,...r?{marks:r.draft.marks}:{},team:(R,E="full")=>O({kind:"team",team:R,scope:E}),job:R=>O({kind:"function",job:R}),override:R=>O({kind:"override",slot:R}),slot:R=>O({kind:"slot",slot:R}),slot_remove:R=>void L(R),remove:(R,E,M)=>void P(R,E,M),post_add:()=>O({kind:"post"}),post_remove:R=>void G(R),holder_add:R=>O({kind:"holder",post:R}),holder_remove:(R,E)=>void A(R,E),refused:R=>{const E=y[R];return E?i.jsx(QH,{label:E.label,message:E.message,bound:E.bound,on_dismiss:()=>b(R)}):null}},dialogs:i.jsxs(i.Fragment,{children:[i.jsx(VH,{open:(m==null?void 0:m.kind)==="team",chart:n,team:(m==null?void 0:m.kind)==="team"?m.team:null,scope:(m==null?void 0:m.kind)==="team"?m.scope:"full",parents:!r&&n.authority?n.authority.teams:void 0,save:N,on_close:D,context:d}),i.jsx(BH,{open:(m==null?void 0:m.kind)==="function",chart:n,job:(m==null?void 0:m.kind)==="function"?m.job:null,save:N,on_close:D,context:d}),i.jsx(YH,{open:C!==null,chart:n,binding:C,names:l,save:N,confirm:R=>h({...R,action:"clear the override"}),on_close:D}),i.jsx(qH,{open:(m==null?void 0:m.kind)==="slot",chart:n,slot:(m==null?void 0:m.kind)==="slot"?m.slot:null,save:N,on_close:D,context:d}),i.jsx(KH,{open:(m==null?void 0:m.kind)==="post",chart:n,names:l,save:N,on_close:D,context:d}),i.jsx(ZH,{open:(m==null?void 0:m.kind)==="holder",chart:n,post:(m==null?void 0:m.kind)==="holder"?m.post:null,names:l,members:x,save:N,on_close:D,context:d}),f]})}}function qV({quiet:e=!1}){return i.jsx("div",{className:"mt-6 grid gap-2",...e?{"aria-hidden":!0}:{role:"status","aria-label":"Loading the org chart"},children:Array.from({length:4},(t,n)=>i.jsx(Tt,{className:n===3?"h-10 w-2/3":"h-10 w-full"},n))})}function Oo({children:e}){return i.jsx("pre",{className:"bg-muted text-foreground m-0 overflow-x-auto rounded-md border px-3 py-2 font-mono text-sm",children:i.jsx("code",{children:e})})}function YV({edit:e,seedable:t}){const n=t?e?"Plan one from this checkout's workflow roles with sdlc org seed, or start one with a team. This page shows it as soon as it exists.":"Plan one from this checkout's workflow roles, or start one with a team. This page shows it as soon as it exists.":"Start one with a team. This page shows it as soon as it exists.";return i.jsxs(me,{variant:"info",className:"mt-6",children:[i.jsx(pn,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"This repository has no local org yet"}),i.jsxs(pe,{children:[i.jsx("p",{children:n}),t||!e?i.jsxs("div",{className:"mt-2 grid w-full gap-2",children:[t?i.jsx(Oo,{children:"sdlc org seed"}):null,e?null:i.jsx(Oo,{children:"sdlc org add team <key>"})]}):null,e?i.jsxs(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>e.team(null),children:[i.jsx(Pa,{className:"size-4","aria-hidden":"true"}),"Add team"]}):null]})]})}function XV({org:e}){const{href:t,Link:n}=lt();return i.jsx(Ua,{title:"Page not found",description:e?`There is no organization ${e}, or you are not one of its members.`:"This organization does not exist, or you are not one of its members.",backHref:t("/org"),backLabel:"Back to Organizations",link:n})}function KV(e){return new Date(e).toDateString()===new Date().toDateString()?`today at ${Ys(e)}`:`on ${Ts(e)} at ${Ys(e)}`}function ZV({host:e,kept_at:t,on_retry:n}){const s=t?`The chart read ${KV(t)} is kept below. `:"";return i.jsxs(me,{variant:"destructive",className:"mt-6",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:e==="hosted"?"Could not read the org chart":"Could not read the local org"}),i.jsxs(pe,{children:[i.jsxs("p",{children:[s,e==="hosted"?s?"Try again in a moment.":"Try again in a moment. If it keeps failing, ask an organization owner.":"Details are in the terminal running sdlc viewer."]}),i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function kE(e){return u.useMemo(()=>{const t=new Map(e.teams.map(b=>[b.key,b.label||b.key])),n=new Map(e.job_functions.map(b=>[b.key,b.label||b.key])),s=new Map(e.slots.map(b=>[b.key,b.label||b.key])),a=new Map(e.posts.map(b=>[b.post,b.holders])),r=b=>b.label||b.id,o=new Map;for(const b of[...e.members,...e.posts.flatMap(v=>v.holders)]){const v=r(b);o.set(v,(o.get(v)??new Set).add(`${b.kind}:${b.id}`))}const l=b=>{var v;return(((v=o.get(r(b)))==null?void 0:v.size)??0)>1},c=b=>{const v=l(b)?b.detail??b.id:null;return v&&v!==r(b)?v:null},d=b=>{const v=c(b);return v&&v!==r(b)?`${r(b)} (${v})`:r(b)},h=b=>{const[v="",x=""]=b.split("/");return{team:t.get(v)??v,job:n.get(x)??x}},f=b=>{const{team:v,job:x}=h(b);return`${x} · ${v}`},m=b=>{if(b==="top")return"Top of the org";if(typeof b!="string")return`A vacant ${n.get(b.vacant)??b.vacant}`;const v=(a.get(b)??[]).map(d);return v.length?`${f(b)} (${v.join(", ")})`:f(b)},p=new Map(e.teams.map(b=>[b.key,b.parent])),y=b=>{let v=0;for(let x=p.get(b);x&&v<e.teams.length;x=p.get(x))v+=1;return v};return{parts:h,post:f,member:d,memberLabel:r,memberDetail:c,manager:m,byPost:(b,v)=>{const[x="",w=""]=[b.split("/")[0],v.split("/")[0]],[_,S]=[h(b),h(v)];return y(x)-y(w)||_.team.localeCompare(S.team)||_.job.localeCompare(S.job)},slot:b=>s.get(b)??b,job:b=>n.get(b)??b,team:b=>t.get(b)??b}},[e])}function rr({id:e,title:t,description:n,actions:s,children:a,anchor:r}){const o=u.useRef(null);return u.useEffect(()=>{var l,c;!r||typeof window>"u"||window.location.hash!==`#${r}`||((l=o.current)==null||l.scrollIntoView({block:"start"}),(c=o.current)==null||c.focus({preventScroll:!0}))},[r]),i.jsxs("section",{id:r,"aria-labelledby":e,className:"mt-8 min-w-0",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-x-4 gap-y-2",children:[i.jsxs("div",{className:"min-w-0 flex-1 basis-64",children:[i.jsx("h2",{id:e,ref:o,tabIndex:r?-1:void 0,className:"text-lg font-semibold",children:t}),i.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:n})]}),s?i.jsx("div",{className:"flex shrink-0 gap-2",children:s}):null]}),i.jsx("div",{className:"mt-3",children:a})]})}function Wl({children:e,on_click:t}){return i.jsxs(U,{type:"button",variant:"outline",size:"sm",onClick:t,children:[i.jsx(Pa,{className:"size-4","aria-hidden":"true"}),e]})}const S_={local:"A member's primary manager comes from the post highest in the function tree; the others are dotted lines.",hosted:"Members who hold a post. A member's primary manager comes from the post highest in the function tree; the others are dotted lines."};function QV({chart:e,host:t,edit:n,marks:s}){const a=kE(e),r=s??(n==null?void 0:n.marks),o=e.members.some(l=>l.kind==="agent");return i.jsxs(i.Fragment,{children:[i.jsxs(rr,{id:"org-chart-lines",title:"Reporting lines",description:"Each post reports to the post of its parent job function in the same team, or else in the nearest team above it that has one.",actions:n!=null&&n.can.post_add?i.jsx(Wl,{on_click:n.post_add,children:"Add post"}):void 0,children:[n==null?void 0:n.refused("posts"),i.jsx(t6,{chart:e,names:a,agents:o,host:t,edit:n,marks:r})]}),i.jsx(rr,{id:"org-chart-members",title:"Members",description:o?`${S_[t]} Each agent answers to the nearest person in its reporting chain.`:S_[t],children:i.jsx(r6,{chart:e,names:a,host:t,agents:o})}),n||s?i.jsxs(rr,{id:"org-chart-teams",title:"Teams",description:"Each team under its parent. A post is one of its job functions staffed in it.",actions:n!=null&&n.can.team_add?i.jsx(Wl,{on_click:()=>n.team(null),children:"Add team"}):void 0,children:[n==null?void 0:n.refused("teams"),i.jsx(JV,{chart:e,host:t,edit:n,marks:r})]}):null,i.jsxs("div",{className:"grid items-start gap-x-6 xl:grid-cols-2",children:[i.jsxs(rr,{id:"org-chart-functions",title:"Function tree",description:"Each job function under its parent, with the slots it fills.",actions:n!=null&&n.can.functions?i.jsx(Wl,{on_click:()=>n.job(null),children:"Add job function"}):void 0,children:[n!=null&&n.can.functions?n.refused("functions"):null,i.jsx(o6,{chart:e,names:a,edit:n!=null&&n.can.functions?n:null,marks:r})]}),i.jsxs(rr,{id:"org-chart-slots",anchor:"slots",title:"Slots",description:OV,actions:n!=null&&n.can.slots&&e.slot_resolution.length>0?i.jsx(Wl,{on_click:()=>n.slot(null),children:"Add slot"}):void 0,children:[n!=null&&n.can.slots?n.refused("slots"):null,e.workflow===!1?i.jsx("p",{className:"text-muted-foreground mb-3 text-xs",children:"This checkout has no workflow file, so no slot is marked as a gate."}):null,i.jsx(c6,{chart:e,names:a,host:t,edit:n!=null&&n.can.slots?n:null,marks:r})]})]}),e.project?i.jsx(u6,{project:e.project,chart:e,names:a,edit:n!=null&&n.can.override?n:null}):null]})}function JV({chart:e,host:t,edit:n,marks:s}){var h;const a=wb([...e.teams].sort((f,m)=>(f.label||f.key).localeCompare(m.label||m.key)),f=>f.key,f=>f.parent);if(a.length===0)return i.jsx("p",{className:"text-muted-foreground text-sm",children:"No teams yet."});const r=((h=e.project)==null?void 0:h.team)??null,o=t==="hosted",l=(f,m)=>{if(!n)return null;const p=n.can.team(f.key);return p==="full"?i.jsx(To,{label:m,on_edit:()=>n.team(f),on_remove:()=>n.remove("team",f.key,m)}):p==="root"?i.jsx(To,{label:m,on_edit:()=>n.team(f,"description")}):p==="description"&&n.drafting?i.jsx(To,{label:m,items:[{label:"Edit description",on_select:()=>n.team(f,"description")}]}):p==="description"?i.jsx(U,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`Edit the description of ${m}`,onClick:()=>n.team(f,"description"),children:i.jsx(gf,{className:"size-3.5","aria-hidden":"true"})}):null},c=(f,m)=>i.jsx("ul",{role:"list",className:m===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:f.map(({item:p,children:y})=>{const g=p.label||p.key;return i.jsxs("li",{children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-b py-2 pr-4",style:yb(m),"data-testid":"org-chart-team",children:[i.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:"text-sm font-medium",children:g}),i.jsx(qf,{mark:s==null?void 0:s.teams[p.key]})]}),i.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[o?null:i.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:p.key}),r===p.key?i.jsx(be,{variant:"neutral",children:"Owns this project"}):null,l(p,g)]})]}),y.length>0?c(y,m+1):null]},p.key)})}),d=o&&e.teams.length===1;return i.jsxs(i.Fragment,{children:[i.jsx(wt,{className:"overflow-hidden",children:c(a,0)}),d?i.jsxs("p",{className:"text-muted-foreground mt-2 text-sm",children:["No teams below ",e.teams[0].label||e.teams[0].key," yet."]}):null]})}function wb(e,t,n){const s=new Set(e.map(t)),a=new Map(e.map(o=>[t(o),{item:o,children:[]}])),r=[];for(const o of e){const l=n(o),c=a.get(t(o));l&&s.has(l)&&l!==t(o)?a.get(l).children.push(c):r.push(c)}return r}const e6={local:"No posts yet.",hosted:"No posts yet. An org admin can add them."};function t6({chart:e,names:t,agents:n,host:s,edit:a,marks:r}){const o=wb([...e.posts].sort((d,h)=>t.byPost(d.post,h.post)),d=>d.post,d=>typeof d.reports_to=="string"&&d.reports_to!=="top"?d.reports_to:null);if(o.length===0){const d=s==="hosted"&&(a==null?void 0:a.can.functions)&&!a.can.post_add;return i.jsx("p",{className:"text-muted-foreground text-sm",children:a!=null&&a.can.post_add?"No posts yet. Add a post to staff a job function in a team.":d?"No posts yet. Add a job function under Function tree first, then add a post to staff it in a team.":e6[s]})}const l=new Map(e.members.map(d=>[`${d.kind}:${d.id}`,d])),c=(d,h)=>i.jsx("ul",{role:"list",className:h===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:d.map(({item:f,children:m})=>{const{team:p}=t.parts(f.post),y=typeof f.reports_to=="object"?f.reports_to:null,g=!!(a!=null&&a.can.post(f.post));return i.jsxs("li",{children:[i.jsxs("div",{className:"border-b py-2 pr-4",style:yb(h),"data-testid":"org-chart-post",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(fM,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),i.jsx("span",{className:"text-sm font-medium",children:t.parts(f.post).job}),i.jsx("span",{className:"text-muted-foreground text-xs",children:y?`${p} · Reports to a vacant ${t.job(y.vacant)}`:p}),i.jsx(qf,{mark:r==null?void 0:r.posts[f.post]}),g&&a?i.jsx("span",{className:"ml-auto",children:i.jsx(To,{label:t.post(f.post),items:[...a.drafting?[]:[{label:"Add holder",on_select:()=>a.holder_add(f.post)}],{label:"Remove post",on_select:()=>a.post_remove(f.post),destructive:!0}]})}):null]}),i.jsx("div",{className:"mt-1 grid min-w-0 gap-1 pl-6",children:f.holders.length===0?i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(be,{variant:Oh.vacant.tone,children:Oh.vacant.label}),i.jsx("span",{className:"text-muted-foreground text-xs",children:f.escalates_to?`No one holds this post. Its work goes to ${t.manager(f.escalates_to)}.`:"No one holds this post."})]}):f.holders.map(b=>i.jsx(i6,{holder:b,post:f.post,member:l.get(`${b.kind}:${b.id}`),names:t,agents:n,host:s,on_remove:g&&a&&!a.drafting?()=>a.holder_remove(f.post,b):void 0},`${b.kind}:${b.id}`))})]}),m.length>0?c(m,h+1):null]},f.post)})});return i.jsx(wt,{className:"overflow-hidden",children:c(o,0)})}function n6(e){return new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function s6(e){if(!e.held_since)return null;const t=n6(e.held_since);return e.added_by?e.added_by==="former_member"?`Added on ${t} by a former member`:`Added by ${e.added_by.name} on ${t}`:`Added on ${t}`}function i6({holder:e,post:t,member:n,names:s,agents:a,host:r,on_remove:o}){const l=e.kind==="person"?Av:kv,c=n==null?void 0:n.posts.find(y=>y.post===t),d=n==null?void 0:n.posts.find(y=>y.primary),h=s.memberDetail(e);let f=null;c!=null&&c.dotted&&d?f=`Dotted line: primary manager is ${s.manager(d.reports_to)}`:e.kind==="agent"&&n&&"accountable_person"in n&&(f=n.accountable_person?`Accountable person ${s.member(n.accountable_person)}`:"No accountable person");const m=r==="hosted"?s6(e):null,p=s.memberLabel(e);return i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[i.jsx(l,{className:"text-muted-foreground size-3.5 shrink-0","aria-hidden":"true"}),i.jsx("span",{className:"text-sm font-medium break-all",children:p}),o?i.jsxs(kd,{children:[i.jsx(Sd,{asChild:!0,children:i.jsx(U,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`Remove ${s.member(e)} from ${s.post(t)}`,onClick:o,children:i.jsx(xd,{className:"size-3.5","aria-hidden":"true"})})}),i.jsxs(ul,{children:["Remove ",p]})]}):null,h?i.jsx("span",{className:"text-muted-foreground text-xs break-all",children:h}):null,a?i.jsx("span",{className:"text-muted-foreground text-xs",children:e.kind==="person"?"Person":"Agent"}):null]}),f?i.jsx("div",{className:"pl-5.5 text-xs",children:f}):null,m?i.jsx("div",{className:"text-muted-foreground pl-5.5 text-xs",children:m}):null]})}const a6=["sdlc org hold <team>/<function> --person <id>","sdlc org hold <team>/<function> --agent <id>"];function r6({chart:e,names:t,host:n,agents:s}){if(e.members.length===0)return n==="hosted"?i.jsx("p",{className:"text-muted-foreground text-sm",children:"No one holds a post yet."}):i.jsxs("div",{className:"grid max-w-2xl gap-2",children:[i.jsx("p",{className:"text-muted-foreground text-sm",children:"No one holds a post yet. Give a post to a person or an agent:"}),a6.map(r=>i.jsx(Oo,{children:r},r))]});const a=[...e.members].sort((r,o)=>r.kind===o.kind?t.memberLabel(r).localeCompare(t.memberLabel(o))||r.id.localeCompare(o.id):r.kind==="person"?-1:1);return i.jsx(wt,{className:"overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Members",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Member"}),i.jsx(J,{children:"Posts"}),i.jsx(J,{children:"Primary manager"}),i.jsx(J,{children:"Dotted lines"}),s?i.jsx(J,{children:"Accountable person"}):null]})}),i.jsx(at,{children:a.map(r=>{const o=r.posts.find(d=>d.primary),l=r.posts.filter(d=>d.dotted),c=t.memberDetail(r);return i.jsxs(ye,{"data-testid":"org-chart-member",children:[i.jsxs(X,{children:[i.jsx("div",{className:"font-medium",children:t.memberLabel(r)}),c?i.jsx("div",{className:"text-muted-foreground text-xs",children:c}):null,s?i.jsx("div",{className:"text-muted-foreground text-xs",children:r.kind==="person"?"Person":"Agent"}):null]}),i.jsx(X,{children:r.posts.map(d=>t.post(d.post)).join(", ")}),i.jsx(X,{children:o?t.manager(o.reports_to):"None"}),i.jsx(X,{children:l.length?l.map(d=>t.manager(d.reports_to)).join(", "):"None"}),s?i.jsx(X,{children:r.kind==="person"?"Not an agent":r.accountable_person?t.member(r.accountable_person):"None"}):null]},`${r.kind}:${r.id}`)})})]})})}function o6({chart:e,names:t,edit:n,marks:s}){const a=wb([...e.job_functions].sort((o,l)=>(o.label||o.key).localeCompare(l.label||l.key)),o=>o.key,o=>o.parent);if(a.length===0)return i.jsx("p",{className:"text-muted-foreground text-sm",children:(n==null?void 0:n.host)==="hosted"?"No job functions yet. Add one to start the chart.":"No job functions yet."});const r=(o,l)=>i.jsx("ul",{role:"list",className:l===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:o.map(({item:c,children:d})=>i.jsxs("li",{children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-b py-2 pr-4",style:yb(l),"data-testid":"org-chart-function",children:[i.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:"text-sm font-medium",children:c.label||c.key}),i.jsx(qf,{mark:s==null?void 0:s.job_functions[c.key]})]}),i.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:"text-muted-foreground text-xs",children:c.fills.length?`Fills ${c.fills.map(t.slot).join(", ")}`:"No slot"}),c.requires_person?i.jsx(be,{variant:"neutral",children:"Requires a person"}):null,n?i.jsx(To,{label:c.label||c.key,on_edit:()=>n.job(c),on_remove:()=>n.remove("job_function",c.key,c.label||c.key)}):null]})]}),d.length>0?r(d,l+1):null]},c.key))});return i.jsx(wt,{className:"overflow-hidden",children:r(a,0)})}function l6(e,t){return e.status==="uncovered"?"No job function fills this slot":e.status==="vacant"?`${e.posts.map(t.post).join(", ")} has no holder`:e.posts.map(n=>`${t.post(n.post)}: ${n.holders.map(t.member).join(", ")}`).join("; ")}const zh={covered:0,vacant:1,uncovered:2};function SE(e){return new Map(e.slots.filter(t=>t.gate).map(t=>{var n;return[t.key,(n=t.gates)!=null&&n.length?`Gate: ${t.gates.join(", ")}`:"Gate slot"]}))}function c6({chart:e,names:t,host:n,edit:s,marks:a}){var l;const r=SE(e),o=new Map(e.slots.map(c=>[c.key,c]));if(n==="hosted"&&e.slot_resolution.length===0){const c=((l=e.authority)==null?void 0:l.ask)??[];return i.jsxs(wt,{className:"grid justify-items-center gap-2 p-6 text-center",children:[i.jsx("span",{className:"text-sm font-medium",children:"No slots yet"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Add the workflow roles your projects fill, such as Implementer or Approver."}),s?i.jsx(Wl,{on_click:()=>s.slot(null),children:"Add slot"}):i.jsxs("p",{className:"text-muted-foreground text-sm",children:["Only an org owner or admin adds slots."," ",c.length?`Ask ${c.slice(0,3).join(", ")} to make this change.`:"Ask an org owner to make this change."]})]})}return i.jsx(wt,{className:"overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Slots",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Slot"}),i.jsx(J,{children:"Status"}),i.jsx(J,{children:"Resolves to"}),s?i.jsx(J,{className:"text-right",children:i.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),i.jsxs(at,{children:[[...e.slot_resolution].sort((c,d)=>zh[c.status]-zh[d.status]||t.slot(c.slot).localeCompare(t.slot(d.slot))).map(c=>{var h,f;const d=Oh[c.status];return i.jsxs(ye,{"data-testid":"org-chart-slot",children:[i.jsxs(X,{children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:"font-medium",children:t.slot(c.slot)}),i.jsx(qf,{mark:a==null?void 0:a.slots[c.slot]})]}),n==="hosted"?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:c.slot}),(h=o.get(c.slot))!=null&&h.description?i.jsx("div",{className:"text-muted-foreground text-xs break-words",children:(f=o.get(c.slot))==null?void 0:f.description}):null]}):null,r.has(c.slot)?i.jsx("div",{className:"text-muted-foreground text-xs",children:r.get(c.slot)}):null]}),i.jsx(X,{children:i.jsx(be,{variant:d.tone,children:d.label})}),i.jsxs(X,{children:[l6(c,t),c.status==="covered"&&c.needs_person?i.jsx("div",{className:"text-muted-foreground text-xs",children:"Needs a person"}):null]}),s&&o.has(c.slot)?i.jsx(X,{className:"text-right",children:i.jsx(To,{label:t.slot(c.slot),on_edit:()=>s.slot(o.get(c.slot)),on_remove:()=>s.slot_remove(o.get(c.slot))})}):null]},c.slot)}),e.slot_resolution.length===0?i.jsx(ye,{children:i.jsx(X,{colSpan:3,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})})}const d6="Who fills each workflow slot for this repository's project: the posts of the owning team's job functions, else of the nearest team above, unless an override names other posts.",vp=["sdlc org own <team>","sdlc org bind <slot> <team>/<function>... --reason <text>","sdlc org unbind <slot>"];function u6({project:e,chart:t,names:n,edit:s}){if(e.team===null){const o=e.roots.map(n.team);return i.jsx(rr,{id:"org-chart-project",title:"This project",description:o.length?`This org has several root teams (${o.join(", ")}), so no team owns this repository's project yet and its slots are not bound. Name the owning team:`:"This org has no team yet, so no team owns this repository's project. Start one:",children:i.jsx("div",{className:"max-w-2xl",children:i.jsx(Oo,{children:o.length?vp[0]:"sdlc org add team <key>"})})})}const a=SE(t),r=[...e.slots].sort((o,l)=>zh[o.status]-zh[l.status]||n.slot(o.slot).localeCompare(n.slot(l.slot)));return i.jsxs(rr,{id:"org-chart-project",title:"This project",description:d6,children:[i.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[i.jsx("span",{className:"text-muted-foreground text-xs",children:"Owning team"}),i.jsx("span",{className:"text-sm font-medium",children:n.team(e.team)})]}),i.jsx(wt,{className:"mt-3 overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Slots in this project",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Slot"}),i.jsx(J,{children:"Status"}),i.jsx(J,{children:"Bound to"}),i.jsx(J,{children:"Source"}),s?i.jsx(J,{className:"text-right",children:i.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),i.jsxs(at,{children:[r.map(o=>{const l=Oh[o.status];return i.jsxs(ye,{"data-testid":"org-chart-project-slot",children:[i.jsxs(X,{children:[i.jsx("div",{className:"font-medium",children:n.slot(o.slot)}),a.has(o.slot)?i.jsx("div",{className:"text-muted-foreground text-xs",children:a.get(o.slot)}):null]}),i.jsx(X,{children:i.jsx(be,{variant:l.tone,children:l.label})}),i.jsx(X,{children:i.jsx(h6,{binding:o,names:n})}),i.jsx(X,{children:i.jsx(f6,{binding:o})}),s?i.jsx(X,{className:"text-right",children:i.jsx(U,{type:"button",variant:"ghost",size:"control-icon","aria-label":o.source==="override"?`Edit the override of ${n.slot(o.slot)}`:`Override ${n.slot(o.slot)}`,onClick:()=>s.override(o.slot),children:i.jsx(gf,{className:"size-3.5","aria-hidden":"true"})})}):null]},o.slot)}),r.length===0?i.jsx(ye,{children:i.jsx(X,{colSpan:s?5:4,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})}),s?i.jsxs("div",{className:"mt-3 grid max-w-2xl gap-2",children:[i.jsxs("p",{className:"text-muted-foreground text-sm",children:["Overrides made here are made as ",i.jsx("span",{className:"font-mono",children:"person:user"}),", as sdlc org makes them without --as: that person must hold the lead post of the owning team or of a team above it."]}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"Change the owning team with sdlc org:"}),i.jsx(Oo,{children:vp[0]})]}):i.jsxs("div",{className:"mt-3 grid max-w-2xl gap-2",children:[i.jsx("p",{className:"text-muted-foreground text-sm",children:"Change the owning team or a slot's binding with sdlc org; a lead post of the owning team or a team above it may:"}),vp.map(o=>i.jsx(Oo,{children:o},o))]})]})}function h6({binding:e,names:t}){const n=[];e.status==="covered"&&e.needs_person&&n.push("Needs a person");for(const a of e.posts)a.off_description&&n.push(`${t.post(a.post)} does not fill ${t.slot(e.slot)} in its job description`);e.stale_posts&&n.push(e.stale_posts===1?"One post this override names is no longer in the org":`${e.stale_posts} posts this override names are no longer in the org`);let s;return e.posts.length===0?s=e.source==="override"?"The override names no post the org still has":"No job function fills this slot":e.status==="vacant"?s=`${e.posts.map(a=>t.post(a.post)).join(", ")} has no holder`:s=e.posts.map(a=>a.holders.length?`${t.post(a.post)}: ${a.holders.map(t.member).join(", ")}`:`${t.post(a.post)}: no holder`).join("; "),i.jsxs(i.Fragment,{children:[s,n.map(a=>i.jsx("div",{className:"text-muted-foreground text-xs",children:a},a))]})}function f6({binding:e}){var s;if(e.source==="baseline")return i.jsx(i.Fragment,{children:"From job descriptions"});const t=(s=e.set_by)==null?void 0:s.split(":").slice(1).join(":"),n=[e.reason,[t,e.set_at?Ts(e.set_at):null].filter(Boolean).join(", ")].filter(Boolean).join(" · ");return i.jsxs(i.Fragment,{children:["Override",n?i.jsx("div",{className:"text-muted-foreground text-xs",children:n}):null]})}const m6={breaking:"Breaking",new:"New",improved:"Improved",other:"Other changes"},p6=["breaking","new","improved","other"],g6={http_operation:"API",rpc_operation:"API",graphql_operation:"API",async_operation:"Event",page:"Page",ui_frame:"Screen",ui_component_definition:"Component",table:"Data",function:"Function"};function CE(e){return g6[e]??e.replace(/_/g," ")}function x6(e){return e.bump==="major"?"breaking":e.change==="added"?"new":e.change==="changed"?"improved":"other"}function Uc(e){const t=new Map;let n=0,s=0;for(const r of e){if(r.modeling_only){s+=1;continue}if(!r.bump){n+=1;continue}const o=x6(r);t.set(o,[...t.get(o)??[],r])}return{sections:p6.filter(r=>t.has(r)).map(r=>({key:r,label:m6[r],lines:t.get(r)})),breaking:t.has("breaking"),unlisted_count:n,modeling_only_count:s}}function v6(e,t){const n=[`## ${e}`];t.sections.length===0&&n.push("","No change affects the version.");for(const s of t.sections){n.push("",`### ${s.label}`,"");for(const a of s.lines){const r=a.why?`: ${a.why}`:"";n.push(`- ${a.label} (${CE(a.node_type)})${r}`)}}return`${n.join(`
|
|
429
|
+
`)}
|
|
430
|
+
`}const ei="candidate";function _b(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}const b6="Versioned records of this project's release branch, with notes from its graph changes.";function DE({description:e=b6,actions:t}){return i.jsx(_n,{title:"Releases",description:e,actions:t})}function EE(e){var r;if(!e)return"";const t=(r=e.previous_release)==null?void 0:r.version,n=Number(e.version.split("-rc.")[1]??0),s=e.commits_since??n,a=`${e.commits_since===null?"At least ":""}${s} commit${s===1?"":"s"}`;return t?`${a} since ${t}`:`${a} before the first Release`}function Lu({active:e,onClick:t,version:n,badges:s,caption:a,item_ref:r}){return i.jsxs("button",{ref:r,type:"button","aria-current":e?"true":void 0,onClick:t,className:we("focus-visible:ring-ring flex flex-col gap-0.5 rounded-md px-3 py-2 text-left outline-none focus-visible:ring-2",e?"bg-muted":"hover:bg-muted/60"),children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",children:[i.jsx("span",{className:"truncate",children:n}),s]}),i.jsx("span",{className:"text-muted-foreground text-xs",children:a})]})}function Ds({children:e}){return i.jsx("section",{className:"border-border flex flex-col gap-4 rounded-xl border p-4",children:e})}function es({title:e,error:t,onRetry:n}){const s=HD();return i.jsxs(me,{variant:"destructive",ref:s,children:[i.jsx(Nt,{}),e?i.jsx(je,{children:e}):null,i.jsxs(pe,{className:"flex flex-col items-start gap-2",children:[t,n?i.jsx(U,{variant:"outline",size:"sm",onClick:n,children:"Try again"}):null]})]})}function y6({title:e,text:t}){return i.jsx(Ds,{children:i.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[i.jsx(ff,{className:"text-muted-foreground size-8","aria-hidden":!0}),i.jsx("h2",{className:"text-lg font-semibold",tabIndex:-1,children:e}),i.jsx("p",{className:"text-muted-foreground max-w-md text-sm",children:t})]})})}function w6(e,t){const n=t??"The release branch";return{title:e?`Nothing new since ${e}`:"Nothing to release yet",text:e?`${n}'s head is the commit ${e} was written at. Commits to ${n} make the next candidate.`:`${n} has no commits yet.`}}function Mh({changes:e}){const t=u.useMemo(()=>Uc(e),[e]),[n,s]=u.useState(!1),a=t.unlisted_count+t.modeling_only_count;return i.jsxs("div",{className:"flex flex-col gap-4",children:[t.sections.map(r=>{const o=i.jsx("ul",{className:"flex flex-col gap-2",children:r.lines.map(l=>i.jsx(C_,{line:l},`${l.node_id}:${l.change}`))});return r.key==="breaking"?i.jsxs(me,{variant:"destructive",className:"border-destructive/40",children:[i.jsx(Nt,{}),i.jsx(je,{children:i.jsx("h3",{className:"text-destructive text-sm font-semibold",children:r.label})}),i.jsx(pe,{className:"text-foreground",children:o})]},r.key):i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("h3",{className:"text-sm font-semibold",children:r.label}),o]},r.key)}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("h3",{className:"text-sm font-semibold",children:"Fixed"}),i.jsx("p",{className:"text-muted-foreground text-xs",children:"Fixes that changed no part of the graph are not recorded yet; they arrive with landing notes."})]}),t.sections.length===0?i.jsx("p",{className:"text-muted-foreground text-sm",children:"No change affects the version."}):null,a>0?i.jsxs("p",{className:"text-muted-foreground text-sm",children:[a," more change",a===1?"":"s"," do",a===1?"es":""," not affect the version."]}):null,e.length>0?i.jsx(U,{variant:"link",size:"sm",className:"self-start px-0","aria-expanded":n,onClick:()=>s(r=>!r),children:n?"Hide all changes":"Show all changes"}):null,n?i.jsx("ul",{className:"flex flex-col gap-2",children:e.map(r=>i.jsx(C_,{line:r,detail:!0},`all:${r.node_id}:${r.change}:${r.modeling_only}`))}):null]})}function C_({line:e,detail:t=!1}){const n=t?e.modeling_only?"modeling only: shipped before, left out of the version":e.why??`${e.change}; does not affect the version`:e.why;return i.jsxs("li",{className:"flex flex-col gap-0.5",children:[i.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[e.label,i.jsx(be,{variant:"outline",children:CE(e.node_type)})]}),n?i.jsx("span",{className:"text-muted-foreground text-xs",children:n}):null]})}const _6={ok:"success",alert:"error",you:"warning",neutral:"neutral"},j6={ok:"bg-success",alert:"bg-destructive",you:"bg-warning",neutral:"bg-muted-foreground"},N6={ok:"text-success",alert:"text-destructive",you:"text-warning",neutral:""},iu="None in this release",AE="Not computed yet",mr=({chip:e})=>i.jsx(be,{variant:_6[e.tone],children:e.label});function RE({parts:e,className:t}){return i.jsx("div",{"aria-hidden":!0,className:`bg-muted flex gap-0.5 overflow-hidden rounded-full ${t??"h-1.5 w-40"}`,children:e.map((n,s)=>i.jsx("span",{className:n.tone==="primary"?"bg-primary":j6[n.tone],style:e.length===1?{width:`${Math.round(n.share*100)}%`}:{flexGrow:n.share}},s))})}function Yf({title:e,count:t,children:n,heading_ref:s}){const a=`this-release-${e.toLowerCase().replace(/\s+/g,"-")}`;return i.jsxs("section",{className:"flex flex-col gap-2","aria-labelledby":a,children:[i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("h2",{id:a,ref:s,tabIndex:-1,className:"text-lg font-semibold outline-none",children:e}),t!==void 0?i.jsx("span",{className:"text-muted-foreground text-xs",children:t}):null]}),n]})}const ha=({title:e,id:t})=>i.jsx("h3",{id:t,tabIndex:t?-1:void 0,className:"mt-2 text-sm font-semibold outline-none",children:e}),wo=({children:e})=>i.jsx("p",{className:"text-muted-foreground text-sm",children:e}),pr=({children:e})=>i.jsx("p",{className:"text-muted-foreground text-xs",children:e});function Xf({items:e,shown:t,what:n,children:s}){const[a,r]=u.useState(!1),o=t>0?t:e.length,l=e.length>o;return i.jsxs(i.Fragment,{children:[s(a||!l?e:e.slice(0,o)),l?i.jsx(U,{variant:"link",size:"sm",className:"self-start px-0","aria-expanded":a,"aria-label":a?`Show fewer ${n}`:`Show all ${e.length} ${n}`,onClick:()=>r(c=>!c),children:a?"Show fewer":`Show all ${e.length}`}):null]})}function D_({counted:e,what:t}){return i.jsx(Xf,{items:e.rows,shown:e.shown,what:t,children:n=>i.jsx("ul",{className:"flex flex-col gap-2",children:n.map((s,a)=>i.jsxs("li",{className:"flex flex-wrap items-center gap-3 text-sm",children:[i.jsx("code",{className:"w-48 truncate font-mono text-xs",title:s.name,children:s.name}),i.jsx("span",{className:"w-24 text-right tabular-nums",children:s.text}),i.jsx(RE,{parts:[{tone:"primary",share:s.share}]})]},`${s.name}:${a}`))})})}function k6({view:e,heading_ref:t}){const n=e.readiness;return i.jsxs(Yf,{title:"Readiness",heading_ref:t,children:[e.alert?i.jsxs(me,{variant:e.alert.tone==="alert"?"destructive":"default",role:e.alert.tone==="alert"?"alert":"status",children:[i.jsx(Nt,{}),i.jsx(je,{children:e.alert.title}),e.alert.text?i.jsx(pe,{children:e.alert.text}):null]}):null,n.computed?i.jsxs(i.Fragment,{children:[n.contract?i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[n.accepted_note?i.jsx(mr,{chip:n.accepted_note}):null,i.jsx(S6,{line:n.contract,verdict:n.verdict.label})]}):i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[i.jsx(mr,{chip:n.verdict}),n.accepted_note?i.jsx(mr,{chip:n.accepted_note}):null,i.jsx("span",{children:n.detail})]}),n.gaps.map((s,a)=>i.jsx("p",{className:"text-sm",children:s},`${s}:${a}`)),n.errors.map((s,a)=>i.jsx("p",{className:"text-sm",children:s},`${s}:${a}`)),n.note?i.jsx(pr,{children:n.note}):null]}):i.jsx("p",{className:"text-sm",children:n.text})]})}function S6({line:e,verdict:t}){const n=`Environment verification says ${t}`;return e.startsWith(n)?i.jsxs("span",{children:["Environment verification says ",i.jsx("span",{className:"font-medium",children:t}),e.slice(n.length)]}):i.jsx("span",{children:e})}function C6({figures:e}){return e.length===0?null:i.jsx("dl",{className:"flex flex-wrap gap-6",children:e.map(t=>i.jsxs("div",{className:"flex min-w-28 flex-col-reverse",children:[i.jsx("dt",{className:"text-muted-foreground text-xs",children:t.label}),i.jsx("dd",{className:"text-2xl font-semibold tabular-nums",children:t.value})]},t.label))})}function D6(e){const t=e.action;return!t||!e.test?null:t.kind==="accept"?e.env?{name:e.name,key:e.test,decision:{kind:"accept",test:e.test,env:e.env}}:null:{name:e.name,key:e.test,decision:{kind:"revoke",acceptance:t.acceptance}}}function E6({view:e,version:t,onDecide:n}){const s=e.obligations,a=e.landings;return i.jsxs(Yf,{title:"Test completeness",children:[i.jsx(ha,{title:"Obligations"}),s?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-sm",children:s.summary}),s.segments.length>0?i.jsxs(i.Fragment,{children:[i.jsx(RE,{className:"h-2 w-full max-w-xl",parts:s.segments.map(r=>({tone:r.tone,share:r.count}))}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.segments.map(r=>i.jsx(mr,{chip:{label:r.label,tone:r.tone}},r.label))})]}):null,s.open.length>0?i.jsxs(i.Fragment,{children:[i.jsx(ha,{title:"Tests not yet satisfied",id:TE}),i.jsx(Xf,{items:s.open,shown:s.shown,what:"tests not yet satisfied",children:r=>i.jsx("ul",{className:"flex flex-col",children:r.map((o,l)=>{const c=n?D6(o):null;return i.jsxs("li",{className:"flex flex-col gap-0.5 border-b py-1.5",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[i.jsx(mr,{chip:o.chip}),i.jsx("span",{children:o.name}),o.kind?i.jsx("span",{className:"text-muted-foreground text-xs",children:o.kind}):null,c&&o.action&&n?i.jsx(U,{variant:"outline",size:"sm",className:"ml-auto","data-decision-row":c.key,"aria-label":`${o.action.label}: ${o.name}`,onClick:()=>n(c),children:o.action.label}):null]}),o.locator?i.jsx("code",{className:"font-mono text-xs",children:o.locator}):null,o.why?i.jsx(pr,{children:o.why}):null,o.accepted?i.jsxs("p",{className:"text-muted-foreground text-xs",children:["Accepted by ",i.jsx("strong",{className:"text-foreground font-semibold",children:o.accepted.by})," for the next release",t?i.jsxs(i.Fragment,{children:[" ","(",i.jsx("code",{className:"font-mono",children:t}),")"]}):null,": ",o.accepted.reason]}):null]},`${o.test??o.name}:${l}`)})})})]}):null]}):i.jsx(pr,{children:AE}),i.jsx(ha,{title:"Landings"}),i.jsx("p",{className:`text-sm ${a.chips.length===0&&!a.headline?"text-muted-foreground":""}`,children:a.summary}),a.chips.length>0?i.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.chips.map(r=>i.jsx(mr,{chip:r},r.label))}):null,a.headline?i.jsx("p",{className:`text-sm ${N6[a.headline.tone]}`,children:a.headline.text}):null,a.orphans?i.jsx(pr,{children:a.orphans}):null]})}function A6({view:e}){const t=e.impact;return i.jsxs(Yf,{title:"Impact",children:[i.jsx(ha,{title:"Files by area"}),t.areas.rows.length===0?i.jsx(wo,{children:iu}):i.jsx(D_,{counted:t.areas,what:"areas"}),i.jsx(ha,{title:"In the graph"}),t.graph?i.jsxs(i.Fragment,{children:[t.graph.features.length>0?i.jsx(Xf,{items:t.graph.features,shown:t.graph.shown,what:"features",children:n=>i.jsx("ul",{className:"list-disc pl-5 text-sm",children:n.map((s,a)=>i.jsx("li",{children:s},`${s}:${a}`))})}):null,i.jsx("p",{className:"text-sm",children:t.graph.counts}),t.graph.coverage?i.jsx(pr,{children:t.graph.coverage}):null]}):i.jsx(pr,{children:AE}),i.jsx(ha,{title:"Migrations"}),t.migrations?i.jsx(D_,{counted:t.migrations,what:"days"}):i.jsx(wo,{children:iu}),i.jsx(ha,{title:"Drop or truncate"}),t.drops.length===0?i.jsx(wo,{children:iu}):i.jsx("ul",{className:"flex flex-col gap-1",children:t.drops.map(n=>i.jsxs("li",{className:"flex items-center gap-1.5",children:[i.jsx(Nt,{className:"text-warning size-4 shrink-0","aria-hidden":!0}),i.jsx("code",{className:"font-mono text-xs break-all",children:n})]},n))}),i.jsx(ha,{title:"Feature flags added"}),t.flags.length===0?i.jsx(wo,{children:iu}):i.jsx("ul",{className:"flex flex-col gap-1",children:t.flags.map(n=>i.jsx("li",{children:i.jsx("code",{className:"font-mono text-xs",children:n})},n))})]})}function R6({view:e}){const t=e.threads.rows;return i.jsxs(Yf,{title:"Threads",count:t.length,children:[t.length===0?i.jsx(wo,{children:"None in this release"}):i.jsx(Xf,{items:t,shown:e.threads.shown,what:"threads",children:n=>i.jsx("div",{className:"overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Threads in this release",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{scope:"col",children:"Thread"}),i.jsx(J,{scope:"col",className:"text-right",children:"Landings"}),i.jsx(J,{scope:"col",children:"Staging evidence"}),i.jsx(J,{scope:"col",children:"Local checks"})]})}),i.jsx(at,{children:n.map(s=>i.jsxs(ye,{children:[i.jsx(X,{className:"max-w-md truncate",title:s.thread,children:s.thread}),i.jsx(X,{className:"text-right tabular-nums",children:s.landings}),i.jsx(X,{children:i.jsx(mr,{chip:s.staging})}),i.jsx(X,{children:s.local})]},s.thread))})]})})}),i.jsx(pr,{children:"Thread names come from their objectives; plans open in the VS Code Release tab."})]})}const E_=500;function T6(e){return e.trim()?[...e.trim()].length>E_?`A reason is at most ${E_} characters.`:null:"A reason is required."}const A_={accept:"Why it may ship failing, e.g. the issue that tracks it",revoke:"Why it may no longer ship failing"};function O6({target:e,version:t,decide:n,onDecided:s,onClose:a}){const[r,o]=u.useState(""),[l,c]=u.useState(null),[d,h]=u.useState(null),[f,m]=u.useState(!1),p=u.useRef(null),y=u.useRef(!1),g=u.useRef(null);e&&(g.current=e),u.useEffect(()=>{e&&(o(""),c(null),h(null),m(!1),y.current=!1)},[e]);const b=e??g.current,v=(b==null?void 0:b.decision.kind)==="accept",x=(b==null?void 0:b.name)??"",w=()=>{f||a()},_=async k=>{var T,P;if(k.preventDefault(),!e||f)return;const j=T6(r);if(c(j),j){h(null),(T=p.current)==null||T.focus();return}h(null),m(!0);const N=await n({...e.decision,reason:r.trim()});if(N.ok){await s(!0),y.current=!0,m(!1),a();return}const O=N.refusal;O.status===400?c(O.message):O.status===503?h({variant:"info",title:"The local stores are busy",text:"Try again in a moment."}):O.status===504?(h({variant:"warning",title:"No answer in time",text:"It may have been recorded. The section is reading again; check the row before trying again."}),s(!1)):h({variant:"destructive",title:v?"Not accepted":"Not revoked",text:O.message}),m(!1),(P=p.current)==null||P.focus()},S=v?`“${x}” may ship failing in the next release${t?` (${t})`:""}. Recorded as yours and listed under Known issues.`:`“${x}” reads failed again and holds the release back.`;return i.jsx(jn,{open:e!==null,onOpenChange:k=>{k||w()},children:i.jsx(Nn,{onEscapeKeyDown:k=>{f&&k.preventDefault()},onInteractOutside:k=>{f&&k.preventDefault()},onCloseAutoFocus:k=>{var O;if(!g.current)return;k.preventDefault();const j=g.current.key;(O=[...document.querySelectorAll("[data-decision-row]")].find(T=>T.dataset.decisionRow===j)??document.getElementById(TE)??document.getElementById(M6)??document.getElementById(OE))==null||O.focus()},children:i.jsxs("form",{onSubmit:_,className:"grid gap-4",noValidate:!0,children:[i.jsxs(kn,{children:[i.jsx(Cn,{children:v?"Accept for release":"Revoke acceptance"}),i.jsx(Dn,{children:S})]}),d?i.jsxs(me,{variant:d.variant,children:[d.variant==="info"?i.jsx(pn,{"aria-hidden":!0}):i.jsx(Nt,{"aria-hidden":!0}),i.jsx(je,{children:d.title}),i.jsx(pe,{children:d.text})]}):null,i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ie,{htmlFor:"this-release-decision-reason",children:"Reason *"}),i.jsx(yt,{id:"this-release-decision-reason",ref:p,value:r,readOnly:f,placeholder:v?A_.accept:A_.revoke,"aria-invalid":l?!0:void 0,"aria-describedby":l?"this-release-decision-problem":void 0,onChange:k=>o(k.target.value)}),l?i.jsx("div",{id:"this-release-decision-problem",children:i.jsx(Qn,{children:l})}):null]}),i.jsxs(Sn,{children:[i.jsx(U,{type:"button",variant:"outline",size:"sm","aria-disabled":f||void 0,onClick:w,children:"Cancel"}),i.jsx(U,{type:"submit",size:"sm",loading:f,children:f?v?"Accepting…":"Revoking…":v?"Accept for release":"Revoke acceptance"})]})]})})})}function z6({read:e,version:t,onRetry:n,notAvailable:s,decide:a,onDecided:r}){const[o,l]=u.useState(null),c=i.jsx($6,{read:e,version:t,onRetry:n,notAvailable:s,onDecide:a&&r?l:void 0});return!a||!r?c:i.jsxs(i.Fragment,{children:[c,i.jsx(O6,{target:o,version:t,decide:a,onDecided:r,onClose:()=>l(null)})]})}const TE="this-release-tests-not-yet-satisfied",M6="this-release-readiness",OE="this-release-message";function $6({read:e,version:t,onRetry:n,notAvailable:s,onDecide:a}){const r=u.useRef(null),o=u.useRef(null),l=u.useRef(!1);if(u.useEffect(()=>{var h;!l.current||e.state==="reading"||(l.current=!1,(h=r.current??o.current)==null||h.focus())},[e]),e.state==="reading")return i.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[i.jsx(wn,{"aria-hidden":!0})," Reading what this release ships…"]});const c=h=>i.jsx("div",{ref:o,id:OE,tabIndex:-1,className:"outline-none",children:h});if(e.state==="failed")return c(i.jsx(es,{title:"This release could not be read",error:e.error,onRetry:()=>{l.current=!0,n()}}));if(e.state==="unread")return c(i.jsx(es,{title:"This release could not be read",error:`What this release ships could not be read: ${e.text}.`,onRetry:e.retry?()=>{l.current=!0,n()}:void 0}));if(e.state==="outdated")return c(s);if(e.state==="unassembled")return c(i.jsxs(me,{variant:"destructive",children:[i.jsx(Nt,{}),i.jsx(je,{children:"This release could not be worked out"}),i.jsx(pe,{children:"The local records did not assemble into a release view."})]}));const d=e.view;return d.state==="empty"?c(i.jsx(wo,{children:d.empty})):d.state!=="ready"?null:i.jsxs(i.Fragment,{children:[i.jsx(k6,{view:d,heading_ref:r}),i.jsx(C6,{figures:d.figures}),i.jsx(E6,{view:d,version:t,onDecide:a}),i.jsx(A6,{view:d}),i.jsx(R6,{view:d})]})}const zE="Releases of this checkout: the roadmap of open Planned Releases, the next candidate, and each production release with its notes.",Kf=u.createContext(0);function Bc(e,t){const n=u.useRef(e),s=u.useRef(t);u.useEffect(()=>{s.current=t}),u.useEffect(()=>{n.current!==e&&(n.current=e,s.current())},[e])}const R_=e=>(e==null?void 0:e.status)===404||(e==null?void 0:e.reason)==="not_found",T_=5,nx="Not available",sx="planned:";function jb(){const e=is();return i.jsx("p",{className:"text-muted-foreground text-sm",children:`${nx}. ${e}`})}const Ws=e=>`${sx}${e}`,L6=e=>e!=null&&e.startsWith(sx)?e.slice(sx.length):null,Nb=e=>e?e.slice(0,7):"";function P6(e){return e?{title:`Nothing new since ${e}`,text:"Production runs what staging runs. Landings promoted to staging make the next candidate."}:{title:"Nothing to release yet",text:"Staging has run nothing production lacks."}}function I6(){return i.jsxs(me,{variant:"info",children:[i.jsx(pn,{}),i.jsx(je,{children:"Releases come from production"}),i.jsx(pe,{className:"text-info",children:"A Release is written when production runs a release candidate, once its commit is merged into origin/main."})]})}function G6(e){if(e.state==="unreadable")return{badges:i.jsx(be,{variant:"error",children:"Could not be read"}),caption:""};if(e.state==="withdrawn")return{badges:i.jsx(be,{variant:"warning",children:"Withdrawn"}),caption:e.replaced_by?`Replaced by ${e.replaced_by}`:"Withdrawn"};const t=i.jsxs(i.Fragment,{children:[i.jsx(be,{variant:"neutral",children:e.app_changed===!1?"App unchanged":e.previous_release_id?e.bump??"patch":"First"}),e.breaking?i.jsx(be,{variant:"error",children:"Breaking"}):null]}),n=e.written_at?_b(e.written_at):"",s=e.tracks&&e.tracks.length>0?` · ${e.tracks.join(", ")}`:"";return{badges:t,caption:`${n}${s}`}}function gr({query:e,select:t,onSelect:n,children:s,inline:a=!1}){return i.jsx("a",{href:`?${e}`,className:a?"text-primary underline":"text-primary hover:underline",onClick:r=>{r.preventDefault(),n(t)},children:s})}function Zf({pairs:e}){const t=e.filter(([,n])=>n!=null&&n!=="");return t.length===0?null:i.jsx("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-6 gap-y-1 text-sm",children:t.map(([n,s])=>i.jsxs(u.Fragment,{children:[i.jsx("dt",{className:"text-muted-foreground",children:n}),i.jsx("dd",{className:"min-w-0",children:s})]},n))})}const fi=({children:e})=>i.jsx("code",{className:"font-mono text-xs",children:e});function ME(e,t){if(e.judged_commit&&t&&e.judged_commit!==t)return`Judged ${Nb(e.judged_commit)}, not this commit`;const n=e.verdict==="ready"?"Ready":e.verdict==="untested"?"Nothing tested yet":"Not ready",s=e.accepted>0?` · ${e.accepted} failed, accepted`:"";return`${n} · ${e.satisfied} of ${e.total} satisfied${s}`}function Qf({title:e,count:t,heading_ref:n}){return i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("h2",{ref:n,tabIndex:-1,className:"text-lg font-semibold outline-none",children:e}),t!==void 0?i.jsx("span",{className:"text-muted-foreground text-xs",children:t}):null]})}const H6={ready:"success",verifying:"info",fixing:"warning",abandoned:"warning",ready_older:"neutral",none:"neutral",unknown:"neutral"};function V6({batch:e}){if(e.state==="loading")return i.jsxs(me,{children:[i.jsx(Tc,{}),i.jsxs(pe,{className:"flex flex-row items-center gap-2",role:"status",children:[i.jsx(wn,{"aria-hidden":!0})," Reading the release batch…"]})]});const t=e.state==="ready"?e.value:{state:"unknown",chip:"Batch unknown",text:`The release batch could not be read: ${e.error}`,help:null};return i.jsxs(me,{children:[i.jsx(Tc,{}),i.jsxs(je,{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{children:t.text}),i.jsx(be,{variant:H6[t.state],children:t.chip})]}),t.help?i.jsx(pe,{children:t.help}):null]})}const O_="The release batch could not be read. The sdlc viewer log says why.",U6="What this release ships could not be read: git could not compare staging with production.",au=e=>{var t;return e.read_failed===!0||((t=e.this_release)==null?void 0:t.state)==="loading"};function B6(e,t,n){return`/org/${e}/issues/${encodeURIComponent(t)}?from=${encodeURIComponent(n)}`}function $E({issues:e,error:t}){return t?i.jsx(es,{title:"Known issues could not be read",error:t}):!e||e.length===0?null:i.jsxs("section",{className:"flex flex-col gap-2",children:[i.jsx(Qf,{title:"Known issues",count:e.length}),i.jsx("ul",{className:"flex flex-col gap-2",children:e.map(n=>i.jsxs("li",{className:"flex flex-col gap-0.5 text-sm",children:[i.jsxs("span",{children:[n.id,": ",n.title]}),n.accepted_by?i.jsxs("span",{className:"text-muted-foreground text-xs",children:["accepted by ",n.accepted_by]}):null,n.file?i.jsx(fi,{children:n.file}):null]},n.key))})]})}function LE({tracks:e,error:t}){return t?i.jsx(es,{title:"Tracks could not be read",error:t}):!e||e.length===0||e.length===1&&e[0].key==="app"?null:i.jsxs("section",{className:"flex flex-col gap-3",children:[i.jsx(Qf,{title:"Tracks",count:e.length}),e.map(n=>n.key==="app"||n.released_by==="release_batch"?i.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[n.label,n.version?i.jsx(fi,{children:n.version}):null,n.bump?i.jsx(be,{variant:"neutral",children:n.bump}):null]}),i.jsx("span",{className:"text-muted-foreground text-xs",children:"Released with the release batch"})]},n.key):i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[n.label,i.jsxs("span",{className:"text-muted-foreground text-xs",children:[n.packages.length," package",n.packages.length===1?"":"s"]})]}),i.jsx("ul",{className:"flex flex-col gap-1",children:n.packages.map(s=>i.jsxs("li",{className:"flex flex-col gap-0.5",children:[i.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(fi,{children:s.name}),i.jsxs(fi,{children:[s.from??"—"," → ",s.to??"—"]})]}),s.changes.map((a,r)=>i.jsxs("span",{className:"text-muted-foreground text-xs",children:[a.feature,": ",a.entry]},r))]},s.name))}),n.published&&!n.published.recorded?i.jsxs("span",{className:"text-muted-foreground text-xs",children:[n.released_by??"Publish",": Not available. This Release does not say whether or when it moved latest."]}):null]},n.key))]})}function PE({delivery:e,candidate:t,onSelect:n}){if(!e||e.planned.length===0&&e.outside===0)return null;const s=a=>a.length===0?"—":a.map(r=>r.went?`${r.label} (${r.went})`:r.label).join(", ");return i.jsxs("section",{className:"flex flex-col gap-2",children:[i.jsx(Qf,{title:"Planned Releases",count:e.planned.length}),i.jsx("p",{className:"text-muted-foreground text-xs",children:t?"What this candidate would deliver":"What this Release delivered"}),e.planned.length>0?i.jsx("div",{className:"overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Planned Releases",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Planned Release"}),i.jsx(J,{children:"Delivered"}),i.jsx(J,{children:"Not delivered"})]})}),i.jsx(at,{children:e.planned.map(a=>i.jsxs(ye,{children:[i.jsx(X,{children:i.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.open&&t?i.jsx(gr,{query:`planned=${encodeURIComponent(a.id)}`,select:Ws(a.id),onSelect:n,children:a.name}):i.jsx("span",{children:a.name}),i.jsx(fi,{children:a.id})]})}),i.jsx(X,{children:s(a.delivered)}),i.jsx(X,{children:s(a.not_delivered)})]},a.id))})]})}):null,e.outside>0?i.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.outside," landing",e.outside===1?"":"s"," served no Planned Release."]}):null]})}const W6={thread:"Thread",task:"Task",issue:"Issue",test:"Test"};function IE({rows:e,org:t,from:n,untasked:s}){const{href:a,Link:r}=lt(),[o,l]=u.useState(!1),c=o?e:e.slice(0,T_),d=h=>h.kind==="task"?i.jsx(r,{className:"text-primary font-mono text-xs hover:underline",href:a(`/org/${t}/tasks/${encodeURIComponent(h.id)}?from=${encodeURIComponent(n)}`),children:h.id}):h.kind==="issue"?i.jsx(r,{className:"text-primary font-mono text-xs hover:underline",href:a(B6(t,h.id,n)),children:h.id}):h.kind==="thread"?i.jsx(r,{className:"text-primary hover:underline",href:a(`${t?`/org/${t}`:""}/threads#thread-${encodeURIComponent(h.id)}`),children:h.label}):h.kind==="test"&&h.url?i.jsx("a",{className:"text-primary hover:underline",href:h.url,target:"_blank",rel:"noreferrer",children:h.label}):i.jsx("span",{children:h.label});return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Related",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Kind"}),i.jsx(J,{children:"Item"}),i.jsx(J,{children:"How it relates"})]})}),i.jsx(at,{children:c.map(h=>i.jsxs(ye,{children:[i.jsx(X,{children:W6[h.kind]}),i.jsx(X,{children:i.jsxs("div",{className:"flex flex-col gap-0.5",children:[d(h),h.state&&h.kind!=="thread"?i.jsx("span",{className:"text-muted-foreground text-xs",children:h.state}):null]})}),i.jsx(X,{children:h.relation})]},`${h.kind}:${h.id}`))})]})}),e.length>T_?i.jsx(U,{variant:"link",size:"sm",className:"self-start px-0","aria-expanded":o,onClick:()=>l(h=>!h),children:o?"Show fewer":`Show all ${e.length}`}):null,s?i.jsxs("p",{className:"text-muted-foreground text-xs",children:[s," landing",s===1?"":"s"," not tied to a task"]}):null]})}const GE=e=>(e==null?void 0:e.status)===409&&e.reason==="view_outdated";function HE(e){const t=kb(),[n,s]=u.useState(t!=null&&t.related?{state:"loading"}:null),a=u.useRef(0),r=Os(),o=u.useCallback(async(l=!1,c=!1)=>{if(!(t!=null&&t.related)||c&&r.busy())return;const d=++a.current;c||s({state:"loading"});const h=await r.track(t.related(e,l?{fresh:!0}:void 0));d===a.current&&s(f=>h.ok?{state:"ready",value:h.data}:c&&(f==null?void 0:f.state)==="ready"?f:{state:"error",error:h.refusal.message,refusal:h.refusal})},[t,e,r]);return u.useEffect(()=>{o()},[o]),Bc(u.useContext(Kf),()=>void o(!1,!0)),{related:n,read:o}}function VE({related:e,org:t,from:n,onRetry:s}){const a=u.useRef(null),r=u.useRef(!1);if(u.useEffect(()=>{var l;r.current&&(e==null?void 0:e.state)!=="loading"&&(r.current=!1,(l=a.current)==null||l.focus())},[e]),!e)return null;const o=e.state==="ready"?e.value.rows.length:void 0;return i.jsxs("section",{className:"flex flex-col gap-2","aria-labelledby":"release-related",children:[i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("h2",{id:"release-related",ref:a,tabIndex:-1,className:"text-lg font-semibold outline-none",children:"Related"}),o!==void 0?i.jsx("span",{className:"text-muted-foreground text-xs",children:o}):null]}),e.state==="loading"?i.jsxs("div",{className:"grid gap-2",role:"status","aria-label":"Loading related work",children:[i.jsx(Tt,{className:"h-8 w-full"}),i.jsx(Tt,{className:"h-8 w-full"}),i.jsx(Tt,{className:"h-8 w-2/3"})]}):e.state==="error"?GE(e.refusal)?i.jsx(jb,{}):i.jsx(es,{title:"Related work could not be read",error:e.error,onRetry:()=>{r.current=!0,s()}}):e.value.rows.length===0?i.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing related yet."}):i.jsx(IE,{rows:e.value.rows,org:t,from:n,untasked:e.value.untasked})]})}function F6(e){if(!e||e.of===0)return null;if(e.tasks===0)return i.jsx("span",{className:"text-muted-foreground",children:"none"});const t=Object.entries(e.outcomes);return i.jsxs("span",{children:[e.tasks," of ",e.of," tasks",t.map(([n,s])=>i.jsxs("span",{className:n==="failed"?"text-destructive":void 0,children:[" · ",s," ",n]},n))]})}function UE({planned:e,onSelect:t}){return e?e.open?i.jsx(gr,{query:`planned=${encodeURIComponent(e.id)}`,select:Ws(e.id),onSelect:t,children:e.name}):i.jsxs("span",{children:[e.name," ",i.jsx(fi,{children:e.id})]}):null}function q6({candidate:e,org:t,onSelect:n,notes:s,onChanged:a}){var w;const r=kb(),{related:o,read:l}=HE("candidate"),[c,d]=u.useState(r!=null&&r.candidateBatch?{state:"loading"}:null),h=u.useRef(0),f=Os(),[m,p]=u.useState(!1),y=u.useCallback(async(_,S=!1,k=null)=>{if(!(r!=null&&r.candidateBatch)||_&&!k&&f.busy())return;const j=++h.current;_||d({state:"loading"});const N=await f.track(r.candidateBatch(S?{fresh:!0}:void 0));if(j===h.current){if(k==="recorded"&&(!N.ok||au(N.data))){p(!0),d({state:"error",error:N.ok?O_:N.refusal.message});return}N.ok&&!au(N.data)&&p(!1),N.ok?au(N.data)?d(O=>_&&(O==null?void 0:O.state)==="ready"&&!au(O.value)?O:{state:"ready",value:N.data}):d({state:"ready",value:N.data}):d(O=>_&&(O==null?void 0:O.state)==="ready"?O:{state:"error",error:N.refusal.message})}},[r,f]),g=c===null||c.state!=="ready"?c:c.value.batch===null?null:{state:"ready",value:c.value.batch},b=c===null?null:c.state==="loading"?{state:"reading"}:c.state==="error"?{state:"failed",error:m?`The decision was recorded, but the section could not read it again (${c.error})`:c.error}:c.value.read_failed?{state:"failed",error:O_}:!("this_release"in c.value)||c.value.this_release===void 0?{state:"outdated"}:c.value.this_release===null?c.value.unread?{state:"unread",text:c.value.unread.text,retry:c.value.unread.retry}:{state:"unassembled"}:c.value.this_release.state==="loading"?{state:"failed",error:U6}:{state:"answered",view:c.value.this_release};u.useEffect(()=>(y(!1),()=>{h.current+=1}),[y]),Bc(u.useContext(Kf),()=>void y(!0));const v=e.readiness??((o==null?void 0:o.state)==="ready"?o.value.readiness:null)??null,x=(b==null?void 0:b.state)==="answered"&&b.view.state==="ready";return i.jsxs(i.Fragment,{children:[i.jsx(Zf,{pairs:[["Environment",e.environment??"staging"],["Commit",i.jsx(fi,{children:Nb(e.head_commit_id)},"commit")],["Notes",((w=e.notes)==null?void 0:w.page)??null],["Readiness",v&&!x?ME(v,e.head_commit_id):null],["Planned",e.planned_release?i.jsx(UE,{planned:e.planned_release,onSelect:n}):null]]}),g?i.jsx(V6,{batch:g}):null,b?i.jsx(z6,{read:b,version:e.version,onRetry:()=>y(!1,!0),notAvailable:i.jsx(jb,{}),decide:r==null?void 0:r.decideAcceptance,onDecided:async _=>{a==null||a(),await y(!0,!0,_?"recorded":"unknown")}}):null,s,i.jsx($E,{issues:e.known_issues,error:e.known_issues_error}),i.jsx(LE,{tracks:e.tracks,error:e.tracks_error}),i.jsx(PE,{delivery:e.planned_delivery,candidate:!0,onSelect:n}),i.jsx(VE,{related:o,org:t,from:"release:candidate",onRetry:()=>l(!0)})]})}function Y6({release:e,onSelect:t}){const n=e.label??e.version,s=!e.previous_release_id;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:n}),e.state==="withdrawn"?i.jsx(be,{variant:"warning",children:"Withdrawn"}):i.jsx(be,{variant:"neutral",children:e.app_changed===!1?"App unchanged":s?"First":e.bump}),e.breaking?i.jsx(be,{variant:"error",children:"Breaking"}):null]}),e.state==="withdrawn"&&e.replaced_by?i.jsxs("p",{className:"text-sm",children:["Replaced by"," ",i.jsx(gr,{query:`release=${encodeURIComponent(e.replaced_by)}`,select:e.replaced_by,onSelect:t,inline:!0,children:e.replaced_by})]}):null]})}function X6({release:e,org:t,onSelect:n,notes:s}){const a=e.label??e.version,{related:r,read:o}=HE(a),l=(r==null?void 0:r.state)==="ready"?F6(r.value.previews):null;return i.jsxs(i.Fragment,{children:[i.jsx(Zf,{pairs:[["Environment",e.environment??"production"],["Commit",e.commit?i.jsx(fi,{children:Nb(e.commit)},"commit"):null],["Readiness",e.readiness?`${ME(e.readiness)} on staging`:null],["Previews",l],["Planned",e.planned_release?i.jsx(UE,{planned:e.planned_release,onSelect:n}):null]]}),s,i.jsx($E,{issues:e.known_issues,error:e.known_issues_error}),i.jsx(LE,{tracks:e.tracks,error:e.tracks_error}),i.jsx(PE,{delivery:e.planned_delivery,candidate:!1,onSelect:n}),i.jsx(VE,{related:r,org:t,from:`release:${a}`,onRetry:()=>o(!0)})]})}function K6({id:e,summary:t,org:n,onNotFound:s,forecast:a}){const r=kb(),[o,l]=u.useState({state:"loading"}),c=u.useRef(0),d=Os(),h=u.useCallback(async(y=!1,g=!1)=>{if(g&&d.busy())return;const b=++c.current;if(!(r!=null&&r.plannedRelease)){l({state:"error",error:nx,refusal:{status:409,message:nx,reason:"view_outdated"}});return}g||l({state:"loading"});const v=await d.track(r.plannedRelease(e,y?{fresh:!0}:void 0));b===c.current&&l(x=>v.ok?{state:"ready",value:v.data}:g&&x.state==="ready"&&!R_(v.refusal)?x:{state:"error",error:v.refusal.message,refusal:v.refusal})},[r,e,d]);u.useEffect(()=>{h()},[h]),Bc(u.useContext(Kf),()=>void h(!1,!0));const f=o.state==="error"&&R_(o.refusal);if(u.useEffect(()=>{f&&s()},[f,s]),o.state==="loading")return i.jsxs(Ds,{children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:(t==null?void 0:t.name)??e}),i.jsx(be,{variant:"neutral",children:"Planned"})]}),i.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Loading the Planned Release…"})]});if(o.state==="error")return i.jsxs(Ds,{children:[i.jsx("h2",{className:"text-lg font-semibold",children:(t==null?void 0:t.name)??e}),GE(o.refusal)?i.jsx(jb,{}):f?null:i.jsx(es,{error:o.error,onRetry:()=>void h(!0)})]});const m=o.value,p=m.order===null?null:m.order===1?`Next of ${m.open} open`:`${m.order} of ${m.open} open`;return i.jsxs(Ds,{children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:m.name}),i.jsx(be,{variant:"neutral",children:"Planned"})]}),m.goal?i.jsx("p",{className:"text-muted-foreground text-sm",children:m.goal}):null]}),i.jsx(Zf,{pairs:[["Planned Release",i.jsx(fi,{children:m.id},"id")],["Date",m.date],["Order",p],["Members",String(m.members.length)]]}),a,i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("p",{className:"text-muted-foreground text-xs",children:"A Planned Release changes through release_plan.py:"}),i.jsxs("pre",{className:"bg-muted rounded-md px-3 py-2 font-mono text-xs",children:["sdlc view --planned ",m.id]})]}),i.jsxs("section",{className:"flex flex-col gap-2",children:[i.jsx(Qf,{title:"Members",count:m.members.length}),m.members.length>0?i.jsx("div",{className:"overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Members",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Member"}),i.jsx(J,{children:"Level"}),i.jsx(J,{children:"Tasks"}),i.jsx(J,{children:"State"})]})}),i.jsx(at,{children:m.members.map(y=>{const g=y.tasks.filter(v=>v.state==="done").length,b=y.tasks.filter(v=>v.state!=="done").map(v=>v.id);return i.jsxs(ye,{children:[i.jsx(X,{children:y.label}),i.jsx(X,{children:y.level?i.jsx(be,{variant:"neutral",children:Z6(y.level)}):null}),i.jsx(X,{children:i.jsxs("div",{className:"flex flex-col gap-0.5",children:[y.tasks.length>0?i.jsxs("span",{children:[g," of ",y.tasks.length," done"]}):null,b.length>0?i.jsxs("span",{className:"text-muted-foreground text-xs",children:["Open: ",i.jsx(fi,{children:b.join(", ")})]}):null,y.untracked>0?i.jsxs("span",{className:"text-muted-foreground text-xs",children:[y.untracked," slice",y.untracked===1?" has":"s have"," no task yet"]}):null]})}),i.jsx(X,{children:y.state})]},y.item)})})]})}):null]}),i.jsxs("section",{className:"flex flex-col gap-2","aria-labelledby":"planned-related",children:[i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("h2",{id:"planned-related",className:"text-lg font-semibold",children:"Related"}),i.jsx("span",{className:"text-muted-foreground text-xs",children:m.related.length})]}),m.related.length===0?i.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing related yet."}):i.jsx(IE,{rows:m.related,org:n,from:`planned:${m.id}`})]})]})}const Z6=e=>e.charAt(0).toUpperCase()+e.slice(1);function kb(){return Wn().releases}const Pu=5,Sb=300,ru="candidate-notes-heading",Js="candidate-note-field",Pn={hint:"One line. Enter saves, Escape cancels.",empty:"Type the note line, or use Clear edit to go back to the generated text.",same:"The line is unchanged: change it, or Cancel.",long:`A note line is one line of at most ${Sb} characters.`,saved:"The edit was saved.",cleared:"The edit was cleared.",nothing:"There was no edit to clear.",busy:{title:"The local stores are busy",text:"Try again in a moment."},left:"The line is no longer in the candidate",blocked:"The line can no longer be edited here",changed:"The edit changed since Clear edit was opened",clear_gone:"The edit is no longer there",unclearable:"The edit can no longer be cleared here",refresh:"They are read again each time the view refreshes."},BE=e=>[...e].length;function Q6(e,t){var s;const n=e.trim();return n?/[\r\n\0]/.test(n)||BE(n)>Sb?Pn.long:n===(((s=t.edit)==null?void 0:s.value)??"").trim()?Pn.same:null:Pn.empty}function z_(e,t,n){return e===503?{variant:"info",...Pn.busy}:e===504?{variant:"warning",title:"No answer in time",text:`It may still have been ${n?"cleared":"saved"}: check the line.`,late:!0}:{variant:"destructive",title:n?"The edit was not cleared":"The edit was not saved",text:t}}function WE({notice:e,id:t}){return i.jsxs(me,{variant:e.variant,id:t,children:[e.variant==="info"?i.jsx(pn,{"aria-hidden":!0}):e.late?i.jsx(TS,{"aria-hidden":!0}):i.jsx(Nt,{"aria-hidden":!0}),i.jsx("p",{"data-slot":"alert-title",className:"col-start-2 font-medium",children:e.title}),i.jsx(pe,{children:e.text})]})}function J6({gone:e,onDismiss:t,alert_ref:n}){return i.jsx("div",{ref:n,tabIndex:-1,className:"outline-none",children:i.jsxs(me,{variant:"warning",children:[i.jsx(Nt,{"aria-hidden":!0}),i.jsx("p",{"data-slot":"alert-title",className:"col-start-2 font-medium",children:e.title}),i.jsxs(pe,{className:"flex flex-col items-start gap-2",children:[i.jsx("span",{children:e.text}),i.jsx(U,{variant:"outline",size:"sm",onClick:t,children:"Dismiss"})]})]})})}function eU({line:e,draft:t,saving:n,problem:s,notice:a,onDraft:r,onSave:o,onCancel:l,field_ref:c}){const d=e.edit,h=[a?`${Js}-notice`:null,s?`${Js}-problem`:null,`${Js}-hint`,`${Js}-count`].filter(Boolean).join(" ");return i.jsxs("form",{className:"flex flex-col gap-2 py-2",noValidate:!0,onSubmit:f=>{f.preventDefault(),n||o()},children:[a?i.jsx(WE,{notice:a,id:`${Js}-notice`}):null,i.jsx(Ie,{htmlFor:Js,children:"Note line"}),i.jsx(yt,{id:Js,ref:c,value:t,readOnly:n,placeholder:(d==null?void 0:d.placeholder)??void 0,"aria-invalid":s?!0:void 0,"aria-describedby":h,onChange:f=>r(f.target.value),onKeyDown:f=>{f.key==="Escape"&&!n&&(f.preventDefault(),l())}}),s?i.jsx("div",{id:`${Js}-problem`,children:i.jsx(Qn,{children:s})}):null,i.jsxs("p",{className:"text-muted-foreground flex flex-wrap gap-x-3 text-xs",children:[i.jsx("span",{id:`${Js}-hint`,children:Pn.hint}),i.jsx("span",{id:`${Js}-count`,children:`${BE(t)} of ${Sb}`})]}),d!=null&&d.generated?i.jsxs("p",{className:"text-muted-foreground text-xs",children:["generated: ",d.generated]}):null,i.jsxs("div",{className:"flex gap-2",children:[i.jsx(U,{type:"submit",size:"sm",loading:n,children:n?"Saving…":"Save"}),i.jsx(U,{type:"button",variant:"outline",size:"sm","aria-disabled":n||void 0,onClick:()=>!n&&l(),children:"Cancel"})]})]})}function M_({count:e,shown:t,onShow:n}){return t||e<=Pu?null:i.jsxs(U,{variant:"link",size:"inline-sm",className:"self-start",onClick:n,children:["Show all ",e]})}function tU({notes:e,edit:t,reread:n,onBusy:s}){const[a,r]=u.useState(null),[o,l]=u.useState(null),[c,d]=u.useState(null),[h,f]=u.useState(!1),[m,p]=u.useState(null),[y,g]=u.useState(!1),[b,v]=u.useState(null),[x,w]=u.useState(null),[_,S]=u.useState(null),[k,j]=u.useState(""),[N,O]=u.useState(new Set),T=u.useRef(null),P=u.useRef(null),L=u.useRef(null),G=u.useRef(null),A=u.useRef(!1),D=u.useRef(null),C=u.useRef(null),R=u.useRef(null),E=u.useRef(null),M=h||y,H=!!t&&!e.alert,z=u.useMemo(()=>new Map(e.sections.flatMap($=>$.lines.map(F=>[F.key,F]))),[e]),K=u.useMemo(()=>{var F;const $=new Map;for(const ee of e.sections)for(const se of ee.lines)(F=se.edit)!=null&&F.clear&&$.set(se.key,se.text);for(const ee of e.unapplied)for(const se of ee.lines)se.clear&&$.set(se.key,se.text);return $},[e]),oe=u.useId(),re=u.useMemo(()=>new Map([...z.keys()].map(($,F)=>[$,`${oe}-blocked-${F}`])),[z,oe]);u.useEffect(()=>{var ge,de;if(!a||h)return;const $=z.get(a.key),F=a.draft.trim(),ee=F?`What was typed: ${F}`:"Nothing was typed.",se=$&&!H?`${((ge=e.alert)==null?void 0:ge.title)??"Edits cannot be made now"}.`:((de=$==null?void 0:$.edit)==null?void 0:de.blocked)??null;!($!=null&&$.edit)||se?(r(null),w(se?{title:Pn.blocked,text:`${se} ${ee}`,typed:!!F}:{title:Pn.left,text:ee,typed:!!F}),C.current="gone"):a.start!==e.edit_start&&(r(null),C.current={key:a.key,then:"edit"})},[z,e,a,h,H]),u.useEffect(()=>{if(!m||y)return;const $=K.get(m.key);if(!($===m.text&&H)){if(p(null),E.current===m.key&&$===void 0&&H){E.current=null,j(Pn.cleared),R.current={key:m.key,then:"edit"};return}E.current=null,w(F=>{var ee;return F!=null&&F.typed?F:{title:H?$===void 0?Pn.clear_gone:Pn.changed:Pn.unclearable,text:H?`Nothing was cleared: “${m.text}”`:`${((ee=e.alert)==null?void 0:ee.title)??"Edits cannot be made now"}. Nothing was cleared: “${m.text}”`}}),R.current="gone"}},[K,m,y,H,e]);const ve=u.useRef(e);u.useEffect(()=>{e!==ve.current&&S(null),ve.current=e},[e]);const ke=u.useCallback($=>{if($==="gone"||$==="unread"){const ge=($==="gone"?P:L).current;return ge==null||ge.focus(),!!ge}if($==="field")return T.current?(T.current.focus(),T.current.select(),!0):!1;if(T.current)return!1;const F=D.current,ee=ge=>Array.from((F==null?void 0:F.querySelectorAll(`[${ge}]`))??[]).find(de=>de.getAttribute(ge)===$.key)??null,se=($.then==="clear"?ee("data-note-clear"):null)??ee("data-note-edit")??(F==null?void 0:F.querySelector('[data-note-edit]:not([aria-disabled="true"]),[data-note-clear]'))??document.getElementById(ru);return se==null||se.focus(),!0},[]);u.useEffect(()=>{const $=C.current;$&&ke($)&&(C.current=null)});const ae=$=>{M||!$.edit||$.edit.blocked||(r({key:$.key,draft:$.edit.value,start:e.edit_start}),l(null),d(null),j(""),C.current="field")},Ne=()=>{a&&(C.current={key:a.key,then:"edit"},r(null),l(null),d(null))},q=async()=>{var de,Le;if(!a||!t)return;const $=z.get(a.key);if(!$)return;const F=Q6(a.draft,$);if(l(F),F){d(null),(de=T.current)==null||de.focus();return}d(null),f(!0),s(!0);const ee=a.key,se=await t({key:ee,text:a.draft.trim()});if(se.ok){const Ee=await n();s(!1),f(!1),r(null),S(Ee===null?null:{write:"saved",error:Ee}),j(Pn.saved),C.current=Ee===null?{key:ee,then:"edit"}:"unread";return}s(!1),f(!1);const ge=se.refusal;ge.status===400?l(ge.message):(d(z_(ge.status,ge.message,!1)),ge.status===504&&n()),(Le=T.current)==null||Le.focus()},B=$=>{M||(E.current=null,v(null),j(""),p($))},Z=async()=>{if(!m||!t||y)return;v(null),g(!0),s(!0);const $=m.key,F=await t({key:$,clear:!0});if(F.ok){const ee=await n();s(!1),g(!1);const se=F.data.edit.cleared!==!1||E.current===$;E.current=null;const ge=se&&ee!==null;S(ge?{write:"cleared",error:ee}:null),j(se?Pn.cleared:Pn.nothing),R.current=ge?"unread":{key:$,then:"edit"},p(null);return}s(!1),g(!1),v(z_(F.refusal.status,F.refusal.message,!0)),E.current=F.refusal.status===504?$:null,F.refusal.status===504&&n(),A.current=!0};u.useEffect(()=>{var $;!A.current||y||(A.current=!1,($=G.current)==null||$.focus())});const Q=()=>{y||!m||(R.current={key:m.key,then:"clear"},p(null))},ie=$=>{var ge,de,Le;if((a==null?void 0:a.key)===$.key&&$.edit)return i.jsx("li",{className:"border-b last:border-b-0",children:i.jsx(eU,{line:$,draft:a.draft,saving:h,problem:o,notice:c,onDraft:Ee=>{r({...a,draft:Ee}),o&&l(null)},onSave:()=>void q(),onCancel:Ne,field_ref:T})},$.key);const F=((ge=$.edit)==null?void 0:ge.blocked)??null,ee=re.get($.key),se=M||!!a;return i.jsxs("li",{className:"flex flex-col gap-0.5 border-b py-2 text-sm last:border-b-0",children:[i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsxs("span",{className:"min-w-0 flex-1 break-words",children:[$.no_note?i.jsx("span",{className:"text-muted-foreground mr-2 text-xs",children:"no note"}):null,$.text]}),H&&$.edit?i.jsx(U,{variant:"link",size:"inline-sm","data-note-edit":$.key,"aria-label":`Edit: ${$.text}`,"aria-disabled":F||se?!0:void 0,"aria-describedby":F?ee:void 0,onClick:()=>!se&&ae($),children:"Edit"}):null]}),$.source?i.jsx("span",{className:"text-muted-foreground text-xs",children:$.source}):null,($.issues??[]).map((Ee,W)=>i.jsx("span",{className:"text-muted-foreground text-xs",children:Ee},`issue:${W}`)),($.served??[]).map((Ee,W)=>i.jsx("span",{className:"text-muted-foreground text-xs",children:Ee},`served:${W}`)),$.edited?i.jsxs("span",{className:"text-muted-foreground flex flex-wrap items-center gap-x-2 text-xs",children:[i.jsx("span",{children:$.edited.text}),H&&((de=$.edit)!=null&&de.clear)?i.jsx(U,{variant:"link",size:"inline-sm",className:"text-xs","data-note-clear":$.key,"aria-label":`Clear edit: ${$.text}`,"aria-disabled":se||void 0,onClick:()=>!se&&B({key:$.key,text:$.text,ask:`“${$.text}” goes back to its generated text, and the edit's text is lost.`}),children:"Clear edit"}):null]}):null,(Le=$.edited)!=null&&Le.changed?i.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-xs",children:[i.jsx(be,{variant:"warning",children:"source changed"}),i.jsx("span",{className:"text-warning",children:"since this edit: check that it still says what the line does"})]}):null,F?i.jsx("span",{id:ee,className:"text-muted-foreground text-xs",children:F}):null]},$.key)},ce=$=>{const F=N.has(`u:${$.key}`),ee=M||!!a;return i.jsxs("section",{className:"text-muted-foreground flex flex-col gap-1",children:[i.jsxs("h4",{className:"text-foreground text-sm font-medium",children:[$.title," ",i.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:$.count})]}),i.jsx("p",{className:"text-xs",children:$.summary}),$.start?i.jsxs("p",{className:"text-xs",children:[$.start.label," ",i.jsx("code",{className:"font-mono",children:$.start.sha})]}):null,i.jsx("ul",{className:"flex flex-col",children:(F?$.lines:$.lines.slice(0,Pu)).map(se=>i.jsxs("li",{className:"flex flex-col gap-0.5 border-b py-2 text-sm last:border-b-0",children:[i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("span",{className:"text-foreground min-w-0 flex-1 break-words",children:se.text}),H&&se.clear?i.jsx(U,{variant:"link",size:"inline-sm","data-note-clear":se.key,"aria-label":`Clear edit: ${se.text}`,"aria-disabled":ee||void 0,onClick:()=>!ee&&B({key:se.key,text:se.text,ask:$.key==="range"?`“${se.text}”: its text is lost, and no Release can apply it afterwards.`:`“${se.text}”: its text is lost.`}),children:"Clear edit"}):null]}),i.jsxs("span",{className:"text-xs",children:[se.who,se.range?` · made for the range from ${se.range} · ${se.key}`:` · ${se.key}`]})]},se.key))}),i.jsx(M_,{count:$.lines.length,shown:F,onShow:()=>O(se=>new Set(se).add(`u:${$.key}`))})]},$.key)};return i.jsxs("section",{ref:D,className:"flex flex-col gap-3","aria-labelledby":ru,children:[i.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[i.jsx("h2",{id:ru,tabIndex:-1,className:"text-lg font-semibold outline-none",children:"Notes"}),e.page?i.jsx("span",{className:"text-muted-foreground text-xs",children:e.page}):null,i.jsx("span",{role:"status","aria-live":"polite",className:"text-success text-xs",children:k})]}),e.alert?i.jsxs(me,{variant:"destructive",children:[i.jsx(Nt,{"aria-hidden":!0}),i.jsx("p",{"data-slot":"alert-title",className:"col-start-2 font-medium",children:e.alert.title}),i.jsx(pe,{children:e.alert.text})]}):null,x?i.jsx(J6,{gone:x,alert_ref:P,onDismiss:()=>{var $;w(null),($=document.getElementById(ru))==null||$.focus()}}):null,_?i.jsx("div",{ref:L,tabIndex:-1,className:"outline-none",children:i.jsxs(me,{variant:"warning",children:[i.jsx(Nt,{"aria-hidden":!0}),i.jsx("p",{"data-slot":"alert-title",className:"col-start-2 font-medium",children:`The edit was ${_.write}, but the notes could not be read again (${_.error})`}),i.jsx(pe,{children:Pn.refresh})]})}):null,e.none?i.jsx("p",{className:"text-muted-foreground text-sm",children:e.none}):null,e.sections.map($=>{const F=N.has($.key)||$.lines.slice(Pu).some(ee=>ee.key===(a==null?void 0:a.key));return i.jsxs("section",{className:"flex flex-col gap-1",children:[i.jsxs("h3",{className:"text-base font-semibold",children:[$.title," ",$.count?i.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:$.count}):null]}),$.summary?i.jsx("p",{className:"text-muted-foreground text-xs",children:$.summary}):null,i.jsx("ul",{className:"flex flex-col",children:(F?$.lines:$.lines.slice(0,Pu)).map(ie)}),i.jsx(M_,{count:$.lines.length,shown:F,onShow:()=>O(ee=>new Set(ee).add($.key))})]},$.key)}),e.unapplied.map(ce),i.jsx(bf,{open:m!==null,onOpenChange:$=>{$||Q()},children:i.jsxs(yf,{onEscapeKeyDown:$=>{y&&$.preventDefault()},onCloseAutoFocus:$=>{$.preventDefault();const F=R.current;R.current=null,F&&!ke(F)&&(C.current=F)},children:[i.jsxs(wf,{children:[i.jsx(jf,{children:"Clear this edit?"}),i.jsx(Nf,{children:m==null?void 0:m.ask})]}),b?i.jsx(WE,{notice:b}):null,i.jsxs(_f,{children:[i.jsx(U,{type:"button",variant:"outline",size:"sm","data-slot":"alert-dialog-cancel","aria-disabled":y||void 0,onClick:Q,children:"Cancel"}),i.jsx(U,{ref:G,type:"button",variant:"destructive",size:"sm",loading:y,onClick:()=>void Z(),children:y?"Clearing…":"Clear"})]})]})})]})}const Hs={noRelease:"No open Planned Release. Create one: release_plan.py create --name <version>",noTask:"no open task of yours",noNext:"none",pending:"reading the roadmap",failedLead:"The roadmap could not be read",noEngineLead:"this engine has no roadmap read"},$_=3,nU=["in_progress","not_started","planned","blocked"],Cb="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),Qt=e=>e.charAt(0).toUpperCase()+e.slice(1);function bp(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(String(e??""));return t?`${Number(t[3])} ${Cb[Number(t[2])-1]}`:String(e??"")}function FE(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${Cb[t.getMonth()]} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function sU(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${Cb[t.getMonth()]}`}function Ri(e){return e?e.from===e.to&&e.or_later?`${bp(e.from)} or later`:`${bp(e.from)} to ${bp(e.to)}${e.or_later?", or later":""}`:""}function iU(e){if(!e||!e.members)return"";const t=[`${e.sized??0} of ${e.members} members sized (${e.estimated??0} estimated, ${e.predicted??0} predicted)`];return e.not_sized&&t.push(`${e.not_sized} not sized`),t.join(" · ")}function qE(e){var f;const t=e??{},n=t.source??{},a=[t.no_date==="no date: no rate"&&n.rate_why?n.rate_why:"",/members estimated$/.test(t.no_date??"")?"":iU(t)].filter(Boolean).join(" · "),r=t.projected?Ri(t.projected):t.no_date??"",o=(f=t.projected)==null?void 0:f.raw,l=!!(o&&t.projected&&(o.from!==t.projected.from||o.to!==t.projected.to)),c=t.projected?n.rate_basis==="release"?"at this release's own rate":n.rate_basis==="machine"?`at the machine's rate${n.rate_why?`: ${n.rate_why}`:""}`:"":"",d=t.track_record,h=[a,c,l&&o&&t.projected?`corrected for past estimates: raw ${Ri({...o,or_later:t.projected.or_later})}`:"",d?`past forecasts at this coverage: ${d.inside} of ${d.of} inside their range`:""].filter(Boolean);return{lead:r?Qt(r):"",caption:h}}function aU(e){const t=e.kinds??[];return[t.includes("range")?"Not promised":"",e.goal??(t.includes("major")?"No goal yet":"")].filter(Boolean).join(" · ")}function rU(e){var c,d,h,f;const t=((c=e.counts)==null?void 0:c.members)??0,n=`${((d=e.counts)==null?void 0:d.done)??0} of ${t} member${t===1?"":"s"} done`,s=(e.blocked??[]).length,a=(e.needs_user??[]).length,r=!s&&!a?["none blocked · none waiting on you"]:[s?`${s} blocked`:"",a?`${a} waiting on you`:""],o=((h=e.tasks)==null?void 0:h.untracked_slices)??0;o&&r.push(`${o} slice${o===1?"":"s"} not tasks yet`);const l=((f=e.not_a_member)==null?void 0:f.count)??0;return l&&r.push(`${l} not a member yet`),{lead:n,rest:r.filter(Boolean).join(" · ")}}const YE=e=>String(e??"").replace(/_/g," ");function oU(e){const t=e??{},n=t.kinds??[],s=n.includes("slipped"),a=!s&&t.was&&t.now?Ri(t.was)===Ri(t.now)?`, range still ${Ri(t.now)}`:`, range was ${Ri(t.was)}, now ${Ri(t.now)}`:"",r=[s&&t.was?`was ${Ri(t.was)}`:"",n.includes("scope changed")?`scope changed${a}`:""].filter(Boolean),o=(t.what??[]).slice(-3).map(l=>{const c=l.by&&(l.by.title||l.by.thread||l.by.person);return`${[l.kind,l.label||l.item].filter(Boolean).join(" ")}${c?` by ${c}`:""}${l.why?`: ${l.why}`:""}`});return{head:r.length?Qt(r.join(" · ")):"",what:o}}const zo="roadmap",L_={reading:!1,value:null,refusal:null};function lU(e){const[t,n]=u.useState({all:L_,mine:L_}),s=u.useRef({all:0,mine:0}),a=Os(),r=Os(),o=u.useCallback(async(l,c=!1,d=!1)=>{if(!(e!=null&&e.roadmap))return;const h=l==="mine"?r:a;if(d&&h.busy())return;const f=++s.current[l];d||n(p=>({...p,[l]:{...p[l],reading:!0}}));const m=await h.track(e.roadmap({...c?{fresh:!0}:{},...l==="mine"?{mine:!0}:{}}));f===s.current[l]&&n(p=>({...p,[l]:m.ok?{reading:!1,value:m.data,refusal:null}:d?{...p[l],reading:!1}:{reading:!1,value:p[l].value,refusal:m.refusal}}))},[e,a,r]);return{reads:t,read:o,available:!!(e!=null&&e.roadmap)}}function cU(e,t){return`${e} open${t.length?` · ${t.join(", ")} moved since you looked`:""}`}function fc({children:e}){return i.jsx("pre",{className:"bg-muted text-foreground rounded-md px-3 py-2 font-mono text-xs break-all whitespace-pre-wrap",children:e})}const XE=({level:e})=>e?i.jsx(be,{variant:"neutral",children:Qt(e)}):null;function KE({state:e}){const t=Qt(YE(e));return nU.includes(String(e))?i.jsx("span",{className:"font-medium",children:t}):i.jsx("span",{children:t})}function dU({reads:e,scope:t,onScope:n,onRead:s,org:a,onSelect:r}){var p,y;const o=e[t],l=o.value,c=is(),d=u.useRef(null),h=u.useRef(!1);u.useEffect(()=>{!o.reading&&!o.value&&!o.refusal&&s(t)},[t,o.reading,o.value,o.refusal,s]),u.useEffect(()=>{var g;h.current&&!o.reading&&(h.current=!1,(g=d.current)==null||g.focus())},[o.reading]);const f=()=>{h.current=!0,s(t,!0)},m=l?[l.as_of?`as of ${FE(l.as_of)}`:"",`${((p=l.source)==null?void 0:p.machine)||"this machine"}'s records`,((y=l.decider)==null?void 0:y.words)??""].filter(Boolean).join(" · "):"";return i.jsxs(Ds,{children:[i.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[i.jsx("h2",{ref:d,tabIndex:-1,className:"text-lg font-semibold outline-none",children:"Roadmap"}),m?i.jsx("p",{className:"text-muted-foreground text-xs",children:m}):null]}),i.jsx("div",{role:"group","aria-label":"Roadmap scope",className:"flex gap-2",children:["all","mine"].map(g=>i.jsx(U,{variant:"outline",size:"sm","aria-pressed":t===g,onClick:()=>n(g),children:g==="all"?"All":"Mine"},g))})]}),i.jsx("div",{"aria-live":"polite",children:o.reading?i.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[i.jsx(wn,{"aria-hidden":!0,className:"size-4"})," ",Qt(Hs.pending),"…"]}):null}),o.refusal&&!o.reading?o.refusal.reason==="no_roadmap"?i.jsx(es,{title:Hs.failedLead,error:`${Qt(Hs.noEngineLead)}. ${c}`}):o.refusal.reason==="refused"?i.jsx(es,{title:Hs.failedLead,error:o.refusal.message}):i.jsx(es,{title:Hs.failedLead,error:o.refusal.message,onRetry:f}):null,l?t==="mine"?i.jsx(xU,{mine:l.mine,org:a,onSelect:r}):i.jsx(hU,{read:l,org:a,onSelect:r}):null]})}function uU(e){if(!e||typeof e.seconds_per_day!="number")return"No rate";const t=sU(e.as_of);return`${Math.round(e.seconds_per_day/3600)} task hours a day over the ${e.days} days${t?` to ${t}`:""}`}function hU({read:e,org:t,onSelect:n}){var a,r;const s=e.releases??[];if(!s.length){const[o,l]=Hs.noRelease.split(" Create one: ");return i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("p",{className:"text-sm",children:o}),i.jsx("p",{className:"text-muted-foreground text-xs",children:"Create one in the terminal:"}),i.jsx(fc,{children:l})]})}return i.jsxs(i.Fragment,{children:[i.jsx(Zf,{pairs:[["Forecast from",Qt(`${((a=e.source)==null?void 0:a.machine)||"this machine"}'s task records and rate`)],["Rate",uU(e.rate)],["Not counted",Qt(((r=e.source)==null?void 0:r.not_counted)||"other machines' work")]]}),s.map(o=>i.jsx(fU,{row:o,org:t,onSelect:n},o.id))]})}function fU({row:e,org:t,onSelect:n}){var f,m,p;const s=qE(e.forecast),a=rU(e),r=aU(e),o=`roadmap-${e.id}`,l=e.moved?oU(e.told):null,c=(((f=e.counts)==null?void 0:f.members)??0)===0,d=((m=e.not_a_member)==null?void 0:m.count)??0,h=[r,c&&d?`${d} not a member yet`:""].filter(Boolean).join(" · ");return i.jsxs("section",{"aria-labelledby":o,className:"flex flex-col gap-2 border-t pt-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("h3",{id:o,className:"text-base font-semibold",children:i.jsx(gr,{query:`planned=${encodeURIComponent(e.id)}`,select:Ws(e.id),onSelect:n,children:e.name})}),e.kinds.map(y=>i.jsx(be,{variant:"neutral",children:y},y))]}),s.lead||s.caption.length?i.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.lead?i.jsx("p",{className:"text-sm",children:s.lead}):null,s.caption.length?i.jsx("p",{className:"text-muted-foreground text-xs",children:Qt(s.caption.join(" · "))}):null]}):null,h?i.jsx("p",{className:"text-muted-foreground text-sm",children:h}):null,l?i.jsxs(me,{variant:"info",children:[i.jsx(UM,{"aria-hidden":!0}),i.jsx(je,{children:"Moved since you looked"}),i.jsxs(pe,{className:"text-info flex flex-col gap-0.5",children:[l.head?i.jsx("span",{children:l.head}):null,l.what.map((y,g)=>i.jsx("span",{className:"text-xs",children:y},g))]})]}):null,c?null:i.jsxs("p",{className:"text-sm",children:[a.lead,a.rest?i.jsxs("span",{className:"text-muted-foreground",children:[" · ",a.rest]}):null]}),(p=e.stale_unchecked)!=null&&p.words?i.jsx("p",{className:"text-muted-foreground text-xs",children:Qt(e.stale_unchecked.words)}):null,e.for_you&&e.kinds.includes("major")?i.jsx(mU,{row:e}):null,i.jsx(gU,{row:e,org:t})]})}function mU({row:e}){const t=e.for_you;return!t||!t.proposals.length&&!t.committed_nobody_on.length&&!t.widens_most&&!t.set_goal?null:i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("h4",{className:"text-sm font-semibold",children:"For you"}),t.proposals.map(s=>{const a=[s.proposed_by_title||s.proposed_by?`by ${s.proposed_by_title||s.proposed_by}`:"",s.reason??""].filter(Boolean).join(": ");return i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("p",{className:"text-sm",children:["Proposed: ",s.label||s.item]}),i.jsxs("p",{className:"text-muted-foreground text-xs",children:[a?`${Qt(a).replace(/\.$/,"")}. `:"","Accept or reject in the terminal:"]}),i.jsx(fc,{children:s.accept}),i.jsx(fc,{children:s.reject})]},s.item)}),t.committed_nobody_on.map(s=>i.jsxs("p",{className:"text-sm",children:["Nobody on this machine is on ",s.label||s.item,s.level?` (${s.level})`:""]},s.item)),t.widens_most?i.jsxs("p",{className:"text-sm",children:["Widens the range most: ",t.widens_most.label||t.widens_most.item,t.widens_most.high_seconds?i.jsxs("span",{className:"text-muted-foreground",children:[" · +",Math.round(t.widens_most.high_seconds/3600)," h of work at the late end"]}):null]}):null,t.set_goal?i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("p",{className:"text-sm",children:"Set its goal:"}),i.jsx(fc,{children:t.set_goal})]}):null]})}function ZE({next:e,org:t}){const{href:n,Link:s}=lt(),a=e.tasks[0],r=e.label||e.item;return a?i.jsx(s,{className:"text-primary hover:underline",href:n(`/org/${t}/tasks/${encodeURIComponent(a.id)}?from=roadmap`),children:r}):i.jsx("span",{children:r})}function pU(e,t){return e.threads.length?e.threads.map(n=>n.title||n.thread).join(", "):t.kinds.includes("range")?(t.tagged_threads??[]).map(n=>`${n.title}: ${n.words}`).join(", "):e.nobody?Qt(e.nobody):""}function gU({row:e,org:t}){const[n,s]=u.useState(!1),a=e.next??[];if(!a.length){const l=e.kinds.includes("range")?e.tagged_threads??[]:[];return l.length?i.jsx("p",{className:"text-muted-foreground text-sm",children:l.map(c=>`${c.title}: ${c.words}`).join(", ")}):null}const r=n?a:a.slice(0,$_),o=new Map((e.stale_estimates??[]).map(l=>[l.item,l]));return i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("h4",{className:"text-sm font-semibold",children:"Next"}),i.jsx("div",{className:"overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:`Next in ${e.name}`,children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Member"}),i.jsx(J,{children:"Level"}),i.jsx(J,{children:"State"}),i.jsx(J,{children:"Who is on it"})]})}),i.jsx(at,{children:r.map(l=>{const c=o.get(l.item);return i.jsxs(ye,{children:[i.jsx(X,{children:i.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.jsx(ZE,{next:l,org:t}),c?i.jsxs("span",{className:"text-muted-foreground text-xs",children:[Qt(c.words),c.estimate_as_of?` (estimated ${FE(c.estimate_as_of)})`:""]}):null]})}),i.jsx(X,{children:i.jsx(XE,{level:l.level})}),i.jsx(X,{children:i.jsx(KE,{state:l.state})}),i.jsx(X,{children:pU(l,e)})]},l.item)})})]})}),a.length>$_&&!n?i.jsxs(U,{variant:"outline",size:"sm",className:"self-start",onClick:()=>s(!0),children:["Show all ",a.length]}):null,r.some(l=>o.has(l.item))?i.jsx("p",{className:"text-muted-foreground text-xs",children:"Re-forecast it in the terminal: task-record reforecast"}):null]})}function xU({mine:e,org:t,onSelect:n}){const{href:s,Link:a}=lt();if(!e)return null;const r=e.tasks.filter(o=>o.propose);return i.jsxs(i.Fragment,{children:[i.jsxs("section",{"aria-labelledby":"roadmap-your-work",className:"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("h3",{id:"roadmap-your-work",className:"text-base font-semibold",children:"Your work"}),i.jsx("span",{className:"text-muted-foreground text-xs",children:e.title})]}),e.tasks.length===0?i.jsx("p",{className:"text-muted-foreground text-sm",children:Qt(Hs.noTask)}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Your work",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Task"}),i.jsx(J,{children:"Release"}),i.jsx(J,{children:"Member"})]})}),i.jsx(at,{children:e.tasks.map(o=>{var l,c;return i.jsxs(ye,{children:[i.jsx(X,{children:i.jsxs("div",{className:"flex flex-col gap-0.5",children:[i.jsx(a,{className:"text-primary font-mono text-xs hover:underline",href:s(`/org/${t}/tasks/${encodeURIComponent(o.id)}?from=roadmap`),children:o.id}),i.jsx("span",{className:"text-muted-foreground text-xs",children:[o.title||o.thread,Qt(YE(o.state))].filter(Boolean).join(" · ")})]})}),i.jsx(X,{children:(l=o.members)!=null&&l.length?o.members.map(d=>i.jsx("div",{children:i.jsx(gr,{query:`planned=${encodeURIComponent(d.planned_release)}`,select:Ws(d.planned_release),onSelect:n,children:d.name})},d.planned_release)):o.release?i.jsx(gr,{query:`planned=${encodeURIComponent(o.release.planned_release)}`,select:Ws(o.release.planned_release),onSelect:n,children:o.release.name}):i.jsx("span",{className:"text-muted-foreground",children:o.words?Qt(o.words):"—"})}),i.jsx(X,{children:(c=o.members)!=null&&c.length?o.members.map(d=>i.jsx(XE,{level:d.level},d.planned_release)):o.not_a_member?i.jsx("span",{className:"text-muted-foreground",children:"Not a member yet"}):null})]},o.id)})})]})}),r.map(o=>{var l;return i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("p",{className:"text-muted-foreground text-xs",children:["Propose ",o.id,"'s plan to ",((l=o.release)==null?void 0:l.name)??"its release"," in the terminal:"]}),i.jsx(fc,{children:o.propose??""})]},o.id)})]}),i.jsxs("section",{"aria-labelledby":"roadmap-your-next",className:"flex flex-col gap-2",children:[i.jsx("h3",{id:"roadmap-your-next",className:"text-base font-semibold",children:"Your next members"}),e.next.length===0?i.jsx("p",{className:"text-muted-foreground text-sm",children:Qt(Hs.noNext)}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Your next members",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Release"}),i.jsx(J,{children:"Member"}),i.jsx(J,{children:"State"})]})}),i.jsx(at,{children:e.next.map(o=>i.jsxs(ye,{children:[i.jsx(X,{children:i.jsx(gr,{query:`planned=${encodeURIComponent(o.release)}`,select:Ws(o.release),onSelect:n,children:o.name})}),i.jsx(X,{children:i.jsx(ZE,{next:o,org:t})}),i.jsx(X,{children:i.jsx(KE,{state:o.state})})]},`${o.release}:${o.item}`))})]})})]})]})}function vU({state:e,id:t}){var r;const n=is();if(!e)return null;const s=(r=e.value)==null?void 0:r.releases.find(o=>o.id===t);if(!s){if(e.reading)return i.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[i.jsx(wn,{"aria-hidden":!0,className:"size-4"})," ",Qt(Hs.pending),"…"]});if(e.refusal){const o=e.refusal.reason==="no_roadmap"?`${Qt(Hs.noEngineLead)}. ${n}`:e.refusal.message;return i.jsx("p",{className:"text-muted-foreground text-xs",children:`${Hs.failedLead}: ${o}`})}return null}const a=qE(s.forecast);return i.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.lead?i.jsx("p",{className:"text-sm",children:a.lead}):null,a.caption.length?i.jsx("p",{className:"text-muted-foreground text-xs",children:Qt(a.caption.join(" · "))}):null]})}function Db(){const e=Wn().releases;if(!e)throw new Error("The Releases page rendered without a Releases contract.");return e}function bU({initial:e,environments:t,branch_options:n,chooseBranch:s,renderWrite:a,selection:r,org:o,onReadAgain:l,onNotFound:c,notice:d,focusOnMount:h,tick:f=0}){var Zs,V,$e,Xe,Mt,Ls,Ni,ki,Xa,Ir;const m=Db(),p=e.local??null,y=!!p,[g,b]=u.useState(e);u.useEffect(()=>{e.local&&b(e)},[e]);const[v,x]=u.useState(null),w=r?r.selected:v,_=r?r.onSelect:x,S=!!(p||g.release_branch),[k,j]=u.useState(p||e.release_branch?{state:"loading"}:{state:"ready",value:null}),[N,O]=u.useState({}),[T,P]=u.useState(null),[L,G]=u.useState(!1),[A,D]=u.useState(null),[C,R]=u.useState(null),E=u.useRef(null),M=p?{fresh:!0}:void 0,H=u.useRef(0),z=Os(),K=u.useCallback(async(Oe,ht=!1,ln=!1)=>{if(ht&&!ln&&z.busy())return"A read is still running.";const cn=++H.current,Ln=await z.track(m.candidate(Oe)),os=Ln.ok?null:Ln.refusal.message;return cn!==H.current||j(Ka=>Ln.ok?{state:"ready",value:Ln.data.candidate}:ht&&Ka.state==="ready"?Ka:{state:"error",error:Ln.refusal.message,refusal:Ln.refusal}),os},[m,z]),oe=u.useRef(!1),re=u.useCallback(async()=>{j({state:"loading"}),await K(M)},[K,y]),ve=u.useCallback(async()=>{const Oe=await m.list();Oe.ok&&b(Oe.data)},[m]),ke=((Zs=g.release_branch)==null?void 0:Zs.id)??null;u.useEffect(()=>{if(!(!y&&!ke))return K(),()=>{H.current+=1}},[ke,K,y]);const ae=u.useRef(new Set),Ne=u.useCallback((Oe,ht)=>O(ln=>({...ln,[Oe]:ht.ok?{state:"ready",value:ht.data.release}:{state:"error",error:ht.refusal.message,refusal:ht.refusal}})),[]),q=async Oe=>{O(ht=>({...ht,[Oe]:{state:"loading"}})),ae.current.add(Oe),Ne(Oe,await m.release(Oe,M))},B=k.state!=="ready"||k.value!==null,Z=L6(w),Q=lU(p?m:void 0),ie=Q.available&&w===zo,[ce,$]=u.useState("all"),F=g.release_branch||p?B?ei:null:((V=g.releases[0])==null?void 0:V.version)??null,ee=Z!==null||ie?null:w===ei?B?ei:null:w??F,[se,ge]=u.useState([]),de=u.useRef(0),Le=u.useRef(0),Ee=Os(),W=u.useCallback(()=>{if(!y||!m.roadmapMoved)return;const Oe=Le.current,ht=de.current;Ee.track(m.roadmapMoved()).then(ln=>{Oe===Le.current&&ln.ok&&ht===de.current&&ge(ln.data.moved.map(cn=>cn.name))})},[m,y,Ee]);u.useEffect(()=>(W(),()=>{Le.current+=1}),[W]),Bc(f,()=>{Ee.busy()||W()});const _e=Q.reads.all,He=Q.read;u.useEffect(()=>{Z===null||!Q.available||!_e.value&&!_e.reading&&!_e.refusal&&He("all")},[Z,Q.available,_e,He]);const[Dt,en]=u.useState(0),zt=u.useRef(0),tt=Oe=>{Oe===zo&&en(ht=>ht+1),_(Oe)};u.useEffect(()=>{if(Dt!==zt.current){if(!ie){zt.current=Dt;return}ce!=="all"||_e.reading||!_e.value||!m.roadmapSeen||(zt.current=Dt,m.roadmapSeen(_e.value.as_of).then(Oe=>{Oe.ok&&(de.current+=1,ge([]))}))}},[Dt,ie,ce,_e,m]);const ft=new Map(((($e=_e.value)==null?void 0:$e.releases)??[]).map(Oe=>[Oe.id,[Oe.kinds.includes("range")?"range":"",Oe.forecast.projected?Ri(Oe.forecast.projected):"no date"].filter(Boolean).join(" · ")])),It=ee===null||ee===ei||g.releases.some(Oe=>Oe.version===ee);u.useEffect(()=>{!p||!c||ee!==null&&ee!==ei&&!It&&c({kind:"release",id:ee})},[p,c,ee,It]),u.useEffect(()=>{!ee||ee===ei||ae.current.has(ee)||p&&!It||(ae.current.add(ee),m.release(ee).then(Oe=>Ne(ee,Oe)))},[ee,m,Ne,It]);const zn=Os();Bc(f,()=>{if(p){if(oe.current||K(void 0,!0),ee&&ee!==ei&&It&&!zn.busy()){const Oe=ee;zn.track(m.release(Oe)).then(ht=>{ht.ok&&Ne(Oe,ht)})}ie?He(ce,!1,!0):Z!==null&&_e.value&&He("all",!1,!0)}});const gn=u.useRef(w),Mn=u.useRef(!1),xe=u.useRef(!!h),ne=u.useRef(null);u.useEffect(()=>{var ht,ln;if(!p)return;if(xe.current){const cn=(ht=ne.current)==null?void 0:ht.querySelector('[aria-current="true"]');if(cn){xe.current=!1,gn.current=w,cn.focus();return}}if(gn.current!==w&&(gn.current=w,Mn.current=!0),!Mn.current)return;const Oe=(ln=E.current)==null?void 0:ln.querySelector("h2");Oe&&(Mn.current=!1,Oe.tabIndex=-1,Oe.focus())});const Se=async Oe=>{if(!s)return;P(null);const ht=await s(Oe);if(!ht.ok){P(ht.error);return}x(null),j({state:"loading"}),await ve()},Ye=async()=>{if(!g.next_before)return;R(null);const Oe=await m.list({before:g.next_before});if(!Oe.ok){R(Oe.refusal.message);return}b(ht=>({...Oe.data,releases:[...ht.releases,...Oe.data.releases]}))},nt=g.release_branch?i.jsx(yU,{value:g.release_branch.id,label:g.release_branch.name,options:n??[],can_write:g.can_write,onChange:Se}):null,as=p?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-muted-foreground text-xs",children:["Read at ",Rs(p.read_at)]}),l?i.jsxs(U,{variant:"ghost",size:"sm",onClick:l,children:[i.jsx(zr,{className:"mr-1 size-4","aria-hidden":!0}),"Read again"]}):null]}):nt,$n=p?P6(((Xe=g.releases[0])==null?void 0:Xe.label)??((Mt=g.releases[0])==null?void 0:Mt.version)??null):w6(((Ls=g.releases[0])==null?void 0:Ls.version)??null,((Ni=g.release_branch)==null?void 0:Ni.name)??null),rs={org:o??""};return i.jsxs(Kf.Provider,{value:f,children:[i.jsx(DE,{description:p?zE:void 0,actions:as}),d,p?i.jsx(I6,{}):null,T?i.jsx(es,{error:T}):null,p?null:t,!p&&!g.release_branch?i.jsx(wU,{can_write:g.can_write,options:n??[],onChoose:Se}):null,g.release_branch||g.releases.length>0||p?i.jsxs("div",{ref:ne,className:"flex flex-col gap-6 md:flex-row md:items-start",children:[i.jsx(_U,{list:g,candidate:S?k:null,shown:ie?zo:Z!==null?Ws(Z):ee,onSelect:tt,roadmap:Q.available?cU(((ki=g.planned)==null?void 0:ki.length)??0,se):null,planned_ranges:ft,can_load_older:!!g.next_before,older_error:C,onLoadOlder:Ye}),i.jsx("div",{className:"min-w-0 flex-1",ref:E,children:ie?i.jsx(dU,{reads:Q.reads,scope:ce,onScope:$,onRead:He,org:rs.org,onSelect:_}):Z!==null?i.jsx(K6,{id:Z,summary:((Xa=g.planned)==null?void 0:Xa.find(Oe=>Oe.id===Z))??null,org:rs.org,onNotFound:()=>c==null?void 0:c({kind:"planned",id:Z}),forecast:Q.available?i.jsx(vU,{state:_e,id:Z}):null}):ee===ei?i.jsx(NU,{candidate:k,branch_name:((Ir=g.release_branch)==null?void 0:Ir.name)??null,can_write:g.can_write&&!!a,local:!!p,org:rs.org,onSelect:_,onRetry:re,onWrite:()=>G(!0),onChanged:()=>void K(M,!0,!0),onReread:()=>K(M,!0,!0),onNotesBusy:Oe=>{oe.current=Oe}}):ee?i.jsx(kU,{detail:N[ee]??{state:"loading"},summary:g.releases.find(Oe=>Oe.version===ee)??null,local:!!p,org:rs.org,onSelect:_,onRetry:()=>q(ee)}):(g.release_branch||p)&&k.state==="ready"?i.jsx(y6,{title:$n.title,text:$n.text}):null})]}):null,a&&k.state==="ready"&&k.value?a({candidate:k.value,open:L,notice:A,onOpenChange:Oe=>{Oe||D(null),G(Oe)},onStale:async Oe=>{D(Oe),await K()},onWritten:async Oe=>{G(!1),D(null),await ve(),x(Oe),await re()}}):null]})}function yU({value:e,label:t,options:n,can_write:s,onChange:a}){const r=n.some(o=>o.id===e);return i.jsxs("div",{className:"grid w-56 gap-2",children:[i.jsx(Ie,{htmlFor:"release-branch",children:"Release branch"}),i.jsxs(St,{value:e,onValueChange:a,disabled:!s,children:[i.jsx(_t,{id:"release-branch",children:i.jsx(Ct,{})}),i.jsxs(jt,{children:[r?null:i.jsx(Be,{value:e,children:t??"Unnamed branch"}),n.map(o=>i.jsx(Be,{value:o.id,children:o.label},o.id))]})]}),s?null:i.jsx(QE,{})]})}function QE(){return i.jsx("p",{className:"text-muted-foreground text-xs",children:"You have read access; ask a member with write access to change it or write a Release."})}function wU({can_write:e,options:t,onChoose:n}){return i.jsxs("section",{className:"flex flex-col items-center gap-3 py-16 text-center",children:[i.jsx(Tc,{className:"text-muted-foreground size-8","aria-hidden":!0}),i.jsx("h2",{className:"text-lg font-semibold",children:"Choose a release branch"}),i.jsx("p",{className:"text-muted-foreground max-w-md text-sm",children:"A Release records the graph change between two commits of one branch. Choose the branch you release from; you can change it later."}),i.jsxs("div",{className:"grid w-64 gap-2 text-left",children:[i.jsx(Ie,{htmlFor:"release-branch-first",children:"Release branch"}),i.jsxs(St,{onValueChange:n,disabled:!e,children:[i.jsx(_t,{id:"release-branch-first",children:i.jsx(Ct,{placeholder:"Choose a branch"})}),i.jsx(jt,{children:t.map(s=>i.jsx(Be,{value:s.id,children:s.label},s.id))})]})]}),e?null:i.jsx(QE,{})]})}function JE({children:e}){return i.jsx("p",{className:"text-muted-foreground px-3 pt-3 text-xs font-medium tracking-wide uppercase",children:e})}function _U({list:e,candidate:t,shown:n,onSelect:s,roadmap:a,planned_ranges:r,can_load_older:o,older_error:l,onLoadOlder:c}){var f,m;const d=!!e.local,h=(t==null?void 0:t.state)==="ready"&&t.value?Uc(t.value.changes):null;return i.jsxs("nav",{"aria-label":"Releases",className:"flex w-full flex-col gap-1 md:sticky md:top-0 md:max-h-[calc(100vh-3.5rem)] md:w-72 md:shrink-0 md:overflow-y-auto",children:[d&&a?i.jsx(Lu,{active:n===zo,onClick:()=>s(zo),version:"Roadmap",badges:null,caption:a}):null,t&&(t.state!=="ready"||t.value)?i.jsx(Lu,{active:n===ei,onClick:()=>s(ei),version:t.state==="ready"&&t.value?t.value.version:"Next release",badges:i.jsxs(i.Fragment,{children:[i.jsx(be,{variant:"info",children:"Candidate"}),h!=null&&h.breaking?i.jsx(be,{variant:"error",children:"Breaking"}):t.state==="ready"&&((f=t.value)==null?void 0:f.app_changed)===!1?i.jsx(be,{variant:"neutral",children:"App unchanged"}):t.state==="ready"&&((m=t.value)!=null&&m.classification)?i.jsx(be,{variant:"neutral",children:t.value.classification.bump}):null]}),caption:t.state==="loading"?"Classifying…":t.state==="error"?"Could not be read":EE(t.value)}):null,d?i.jsx(jU,{list:e,shown:n,onSelect:s,ranges:r}):null,d&&e.releases.length>0?i.jsx(JE,{children:"Released"}):null,e.releases.map(p=>{const y=d?G6(p):null;return i.jsx(Lu,{active:n===p.version,onClick:()=>s(p.version),version:p.label??p.version,badges:(y==null?void 0:y.badges)??i.jsxs(i.Fragment,{children:[i.jsx(be,{variant:"neutral",children:p.previous_release_id?p.bump??"patch":"First"}),p.breaking?i.jsx(be,{variant:"error",children:"Breaking"}):null]}),caption:(y==null?void 0:y.caption)??_b(p.written_at)},p.version)}),o?i.jsx(U,{variant:"link",size:"sm",className:"self-start",onClick:c,children:"Show older Releases"}):null,l?i.jsx("p",{className:"text-destructive text-xs",role:"alert",children:l}):null]})}function jU({list:e,shown:t,onSelect:n,ranges:s}){return!e.planned_error&&!(e.planned&&e.planned.length>0)?null:i.jsxs(i.Fragment,{children:[i.jsx(JE,{children:"Planned"}),e.planned_error?i.jsx(es,{title:"Planned Releases could not be read",error:e.planned_error}):null,(e.planned??[]).map((a,r)=>i.jsx(Lu,{active:t===Ws(a.id),onClick:()=>n(Ws(a.id)),version:a.name,badges:i.jsx(be,{variant:"neutral",children:"Planned"}),caption:`${a.members===0?"no members":`${a.members} member${a.members===1?"":"s"}`}${r===0?" · next":""}${s!=null&&s.get(a.id)?` · ${s.get(a.id)}`:""}`},a.id))]})}function NU({candidate:e,branch_name:t,can_write:n,local:s,org:a,onSelect:r,onRetry:o,onWrite:l,onChanged:c,onReread:d,onNotesBusy:h}){var v;const f=Db(),m=is();if(e.state==="loading")return i.jsx(Ds,{children:i.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Classifying the changes since the last Release…"})});if(e.state==="error")return i.jsx(Ds,{children:i.jsx(es,{error:e.error,onRetry:o})});const p=e.value;if(!p)return null;const y=Uc(p.changes),g=!p.previous_release,b=t??"the release branch";return i.jsxs(Ds,{children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:p.version}),i.jsx(be,{variant:"info",children:"Candidate"}),y.breaking?i.jsx(be,{variant:"error",children:"Breaking"}):p.app_changed===!1?i.jsx(be,{variant:"neutral",children:"App unchanged"}):p.classification?i.jsx(be,{variant:"neutral",children:p.classification.bump}):null]}),i.jsxs("p",{className:"text-muted-foreground text-sm",children:[s?"What staging runs over production: ":`What the next Release holds at ${b}'s head: `,EE(p),". It is computed when you open it and never stored.",y.breaking&&p.next_version.startsWith("0.")?" Before 1.0.0 a major change raises the minor number.":""]}),g?i.jsxs("p",{className:"text-muted-foreground text-xs",children:["The first Release, ",p.next_version,", records the starting point and lists no changes."]}):i.jsx("p",{className:"text-muted-foreground text-xs",children:"Only graph changes are judged, so code that changed without a graph change is not counted."}),(v=p.classification)!=null&&v.marks_approximate?i.jsx("p",{className:"text-muted-foreground text-xs",children:"Modeling-only marks could not all be read, so these notes may leave out a change made after a mark."}):null,p.commits_since===null?i.jsx("p",{className:"text-muted-foreground text-xs",children:"Not every commit since the last Release could be walked, so the count and the rc number are at least what is shown."}):null]}),n?i.jsxs(U,{onClick:l,children:[i.jsx(Tc,{className:"mr-2 size-4"}),"Write Release ",p.next_version]}):null]}),s?i.jsx(q6,{candidate:p,org:a,onSelect:r,onChanged:c,notes:g?null:p.notes?i.jsx(tU,{notes:p.notes,edit:f.editNote,reread:d,onBusy:h}):i.jsxs(i.Fragment,{children:[i.jsx(Mh,{changes:p.changes}),p.notes_unavailable==="view_outdated"?i.jsx("p",{className:"text-muted-foreground text-xs",children:`Editing these notes needs a newer engine: ${m}`}):null]})}):g?null:i.jsx(Mh,{changes:p.changes})]})}function kU({detail:e,summary:t,local:n,org:s,onSelect:a,onRetry:r}){const[o,l]=u.useState(!1);if((t==null?void 0:t.state)==="unreadable")return i.jsxs(Ds,{children:[i.jsx("h2",{className:"text-lg font-semibold",children:t.label??t.version}),i.jsx(es,{title:"This Release could not be read",error:t.error??"Its record cannot be read."})]});if(e.state==="loading")return i.jsx(Ds,{children:i.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Loading the Release…"})});if(e.state==="error")return i.jsx(Ds,{children:i.jsx(es,{error:e.error,onRetry:r})});const c=e.value,d=!c.previous_release_id,h=c.bump&&c.computed_bump&&c.bump!==c.computed_bump,f=c.label??c.version,m=async()=>{await navigator.clipboard.writeText(v6(f,Uc(c.changes))),l(!0)};return i.jsxs(Ds,{children:[i.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[n?i.jsx(Y6,{release:c,onSelect:a}):i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:c.version}),i.jsx(be,{variant:"neutral",children:d?"First":c.bump}),Uc(c.changes).breaking?i.jsx(be,{variant:"error",children:"Breaking"}):null]}),i.jsxs("p",{className:"text-muted-foreground text-sm",children:["Written ",_b(c.written_at),c.written_by_name?` by ${c.written_by_name}`:"",". A Release is permanent; a correction is a new Release."]}),n&&c.batch?i.jsxs("p",{className:"text-muted-foreground text-xs",children:["Released when production ran release batch ",i.jsx("code",{className:"font-mono",children:c.batch}),".",c.app_changed===!1?` The app's version stays ${c.app_version??c.version}.`:""]}):null,h?i.jsxs("p",{className:"text-sm",children:["Computed ",c.computed_bump,", declared ",c.bump,c.declared_by_name?` by ${c.declared_by_name}`:"",c.declared_reason?`: “${c.declared_reason}”`:"."]}):null,c.version_line?i.jsx("p",{className:"text-sm",children:c.version_line}):null,c.marks_approximate?i.jsx("p",{className:"text-muted-foreground text-xs",children:"Modeling-only marks could not all be read when it was written, so its notes may leave out a change made after a mark."}):null,d?i.jsx("p",{className:"text-muted-foreground text-xs",children:"The first Release records the starting point and lists no changes."}):c.source_judged?null:i.jsx("p",{className:"text-muted-foreground text-xs",children:"Only graph changes were judged, so code that changed without a graph change is not counted."})]}),d?null:i.jsxs(U,{variant:"outline",onClick:m,children:[i.jsx(Sv,{className:"mr-2 size-4"}),o?"Copied":"Copy notes"]})]}),n?i.jsx(X6,{release:c,org:s,onSelect:a,notes:d?null:i.jsx(Mh,{changes:c.changes})}):d?null:i.jsx(Mh,{changes:c.changes})]})}const SU=5,CU=1e4,DU=e=>e.retry===!0||e.reason==="store_locked"||e.status===503;function EU({org:e,query:t,onSelect:n,home:s}){var E;const a=Db(),{href:r,Link:o}=lt(),[l,c]=u.useState({state:"loading"}),[d,h]=u.useState(null),[f,m]=u.useState(null),[p,y]=u.useState(null),g=u.useRef(0),b=u.useRef(0),v=u.useRef(null),x=u.useRef(!1),w=u.useRef(!1),_=hb(v),S=Os(),k=u.useCallback(async(M,H=!1)=>{const z=b.current+=1;m(null);const K=await S.track(a.list(M?{fresh:!0}:void 0));if(z===b.current){if(K.ok){g.current=0,h(null);const oe=document.visibilityState==="visible"?1:0;c(re=>re.state==="ok"?H?{state:"ok",list:K.data,gen:re.gen,tick:re.tick+oe}:{state:"ok",list:K.data,gen:re.gen+1,tick:re.tick}:{state:"ok",list:K.data,gen:0,tick:0});return}if(K.refusal.reason==="engine_missing"){c({state:"engine_missing",refusal:K.refusal});return}if(g.current+=1,g.current===1&&DU(K.refusal)){w.current=H,m(K.refusal.retry_after??SU);return}h(K.refusal)}},[a,S]);u.useEffect(()=>{k(!1)},[k]);const j=u.useMemo(()=>Ff(S,()=>void k(!1,!0)),[k,S]);qi(j,CU),u.useEffect(()=>{if(f===null)return;const M=setTimeout(()=>{document.visibilityState==="visible"&&k(!1,w.current)},f*1e3);return()=>clearTimeout(M)},[f,k]),u.useEffect(()=>{var H;if(!x.current||l.state==="loading"||d||f!==null)return;x.current=!1;const M=(H=v.current)==null?void 0:H.querySelector("h1");M&&(M.tabIndex=-1,M.focus())});const N=()=>{x.current=!0,g.current=0,h(null),k(!0)},O=l.state==="ok"?l.list:null,T=t.roadmap?zo:t.planned!==null?t.planned===""?(E=O==null?void 0:O.planned)!=null&&E[0]?Ws(O.planned[0].id):null:Ws(t.planned):t.release,P=`${t.release??""}|${t.planned??""}|${t.roadmap?"roadmap":""}`,L=u.useRef(P);u.useEffect(()=>{L.current!==P&&(L.current=P,y(null))},[P]);const G=u.useRef(!1),A=u.useCallback(M=>{G.current=!0,y(M)},[]),D=!p&&l.state==="ok"&&G.current;if(u.useEffect(()=>{D&&(G.current=!1)},[D]),p)return i.jsx(Ua,{title:p.kind==="release"?`No Release ${p.id}`:`No open Planned Release ${p.id}`,description:"This project has no Release, candidate or open Planned Release by that name.",backHref:r(s),backLabel:"All Releases",link:o});const C=f!==null?i.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[i.jsx(wn,{"aria-hidden":!0})," The release records are busy; reading again in ",f," s…"]}):null,R=d?i.jsxs(me,{ref:_,variant:"destructive",children:[i.jsx(Nt,{}),i.jsx(je,{children:"Releases could not be read"}),i.jsxs(pe,{className:"flex flex-col items-start gap-2",children:[i.jsxs("span",{children:[d.message,O?" The last Releases read stays below.":""]}),i.jsx(U,{variant:"outline",size:"sm",onClick:N,children:"Try again"})]})]}):null;return i.jsx("div",{ref:v,className:"flex w-full flex-1 flex-col gap-6 px-4 py-4 sm:px-6 lg:px-8",children:l.state==="ok"?i.jsx(bU,{initial:l.list,tick:l.tick,org:e,selection:{selected:T,onSelect:n},onReadAgain:N,onNotFound:A,notice:C||R?i.jsxs(i.Fragment,{children:[C,R]}):null,focusOnMount:D},l.gen):l.state==="engine_missing"?i.jsx(ji,{page:"Releases"}):i.jsxs(i.Fragment,{children:[i.jsx(DE,{description:zE}),R??C??i.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[i.jsx(wn,{"aria-hidden":!0})," Loading Releases…"]})]})})}const AU=1e4;function eA(e){const[t,n]=u.useState(()=>e?{status:"pending"}:{status:"none"}),s=u.useRef(0),a=u.useRef(!1),r=u.useCallback(async()=>{if(!e||a.current){n({status:"none"});return}const o=++s.current;let l;try{l=await e()}catch{o===s.current&&n({status:"failed"});return}if(o!==s.current)return;if(l.ok){n({status:"ok",summary:l.data});return}const{status:c,reason:d,retry:h}=l.refusal;c===404||d==="engine_missing"?(a.current=!0,n({status:"none"})):n(f=>d==="store_locked"&&f.status==="ok"?f:{status:"failed"})},[e]);return u.useEffect(()=>{a.current=!1,r()},[r]),qi(u.useCallback(()=>void r(),[r]),AU),t}const RU={threads:"Threads",tasks:"Tasks",queues:"Queues",blockers:"Blockers",worktrees:"Worktrees",workspaces:"Workspaces",chart:"Org chart"},TU={tasks:"Tasks",issues:"Issues",releases:"Releases"};function mc(e,t){return e.kind==="home"?"Home":e.kind==="org"?RU[e.page]:e.kind==="project"?e.page?TU[e.page]:t??e.project:"Not found"}const OU="(max-width: 767px)";function zU(){const e=typeof window<"u"&&window.matchMedia?window.matchMedia(OU):null,[t,n]=u.useState((e==null?void 0:e.matches)??!1);return u.useEffect(()=>{if(!e)return;const s=()=>n(e.matches);return e.addEventListener("change",s),()=>e.removeEventListener("change",s)},[e]),t}function ou({className:e=""}){return i.jsx("span",{"aria-hidden":"true",className:`block animate-pulse rounded-md bg-sidebar-accent ${e}`})}function P_({label:e,children:t}){return i.jsxs("span",{role:"status",className:"flex flex-col gap-1",children:[i.jsx("span",{className:"sr-only",children:e}),t]})}function tA(e){return`${e} open ${e===1?"issue":"issues"}`}const nA="ml-auto shrink-0 text-2xs font-medium tabular-nums text-muted-foreground";function MU(e,t){const n=new Map;if(e.status!=="ok")return{rows:n};const s=e.summary.projects;if(t){const a=s.reduce((r,o)=>r+o.open,0);return{header:a>0?a:void 0,rows:n}}for(const a of s)a.open>0&&n.set(a.project,a.open);return{rows:n}}function I_({item:e,collapsed:t}){const{Link:n}=lt(),s=e.icon,a=e.title??(t?e.label:void 0),r=i.jsx("span",{className:"block",children:i.jsxs(n,{href:e.href,className:"flex h-8 items-center gap-2 overflow-hidden rounded-md px-2 text-sm text-sidebar-foreground no-underline outline-hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 focus-visible:ring-sidebar-ring "+(e.current?"bg-sidebar-accent font-medium text-sidebar-accent-foreground":""),"aria-current":e.current?"page":void 0,"aria-label":t?e.label:void 0,children:[i.jsx(s,{className:"size-4 shrink-0","aria-hidden":"true"}),!t&&i.jsx("span",{className:"truncate",children:e.label}),!t&&e.open!==void 0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"sr-only",children:` · ${tA(e.open)}`}),i.jsx("span",{"aria-hidden":"true",className:nA,children:e.open})]})]})});return i.jsx("li",{children:a?i.jsxs(kd,{children:[i.jsx(Sd,{asChild:!0,children:r}),i.jsx(ul,{side:"right",children:a})]}):r})}const G_="m-0 flex list-none flex-col gap-1 p-0";function H_({label:e,collapsed:t,children:n}){return i.jsxs("div",{className:"flex flex-col gap-1 p-2",role:"group","aria-label":e,children:[!t&&i.jsx("p",{className:"m-0 px-2 text-xs font-medium text-sidebar-foreground/70",children:e}),n]})}function V_({page:e,collapsed:t,sheet:n=!1}){var E,M;const{href:s}=lt(),{worktrees:a,blockers:r,issues:o}=Wn(),l=ss(),{org:c,projects:d,loading:h,none:f,about:m,aboutFailed:p,domains:y,engine:g}=l,b=eA(o==null?void 0:o.summary),v=MU(b,((E=c==null?void 0:c.source)==null?void 0:E.kind)==="folder"),x=g===null,w=c?`/org/${c.slug}`:"",_=d==null?void 0:d.find(H=>H.current),S=((M=c==null?void 0:c.source)==null?void 0:M.kind)==="folder"&&_!==void 0,k=H=>S&&_?`${H} · ${_.name}`:H,j=k("Workspaces"),N=k("Tasks"),O=k("Queues"),T=H=>S?H:void 0,P=[{label:"Home",href:s(w||"/"),icon:$S,current:e.kind==="home"},...x?[]:[{label:"Threads",href:s(`${w}/threads`),icon:Rc,current:e.kind==="org"&&e.page==="threads"}],...y.includes("tasks")&&!x?[{label:N,title:T(N),href:s(`${w}/tasks`),icon:mf,current:e.kind==="org"&&e.page==="tasks"}]:[],...x?[]:[{label:O,title:T(O),href:s(`${w}/queues`),icon:Ev,current:e.kind==="org"&&e.page==="queues"}],...r&&!x?[{label:"Blockers",href:s(`${w}/blockers`),icon:MS,current:e.kind==="org"&&e.page==="blockers"}]:[],...a&&!x?[{label:"Worktrees",href:s(`${w}/worktrees`),icon:Dv,current:e.kind==="org"&&e.page==="worktrees"}]:[],{label:j,title:T(j),href:s(`${w}/workspaces`),icon:zS,current:e.kind==="org"&&e.page==="workspaces"},{label:"Org chart",href:s(`${w}/chart`),icon:LS,current:e.kind==="org"&&e.page==="chart"}],L=h?null:f?"No organization":(c==null?void 0:c.name)??"Organization",G=c?qI(c):null,A=m==null?void 0:m.version,D=A?t?A:`sdlc ${A}`:p?Ch:Bf,C=p||(m==null?void 0:m.sync.state)==="unknown"?BI:m===void 0?UI:VI;let R;return h?R=i.jsx("div",{className:"px-2 py-1",children:i.jsxs(P_,{label:"Loading projects",children:[i.jsx(ou,{className:"h-4 w-32"}),i.jsx(ou,{className:"h-4 w-24"})]})}):d?R=i.jsx("ul",{className:G_,children:d.map(H=>i.jsx(I_,{collapsed:t,item:{label:H.name,title:H.name,href:s(`/proj/${encodeURIComponent(H.id)}`),icon:OS,current:e.kind==="project"&&e.project===H.id,open:v.rows.get(H.id)}},H.id))}):R=i.jsx("p",{className:"m-0 px-2 text-sm text-sidebar-foreground/70",children:f?"No projects":Ch}),i.jsxs("div",{className:"flex h-full flex-col bg-sidebar text-sidebar-foreground",children:[i.jsxs("div",{className:`flex items-center gap-2 p-2 ${n?"pr-11":""}`,role:"group","aria-label":"Current organization",children:[i.jsx("div",{className:"flex aspect-square size-8 shrink-0 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground",children:i.jsx(pM,{className:"size-4","aria-hidden":"true"})}),!t&&i.jsx("div",{className:"grid min-w-0 flex-1 text-left text-sm leading-tight",children:L===null?i.jsxs(P_,{label:"Loading organization",children:[i.jsx(ou,{className:"h-4 w-28"}),i.jsx(ou,{className:"h-3 w-24"})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"truncate font-semibold",title:L,children:L}),G&&i.jsxs("span",{className:"truncate text-xs text-sidebar-foreground/70",children:[G,v.header!==void 0&&i.jsx("span",{className:"sr-only",children:` · ${tA(v.header)} in the folder`})]})]})}),!t&&L!==null&&v.header!==void 0&&i.jsx("span",{"aria-hidden":"true",className:`${nA} px-2`,children:v.header})]}),i.jsxs("nav",{"aria-label":"App",className:"min-h-0 flex-1 overflow-y-auto",children:[i.jsx(H_,{label:"Organization",collapsed:t,children:i.jsx("ul",{className:G_,children:P.map(H=>i.jsx(I_,{item:H,collapsed:t},H.label))})}),!t&&i.jsx(H_,{label:"Projects",collapsed:t,children:R})]}),m!==null&&i.jsxs("div",{className:"flex flex-col gap-1 border-t border-sidebar-border p-2 text-xs text-sidebar-foreground/70",children:[i.jsx("p",{className:"m-0 truncate px-2",title:A?`sdlc ${A}`:void 0,children:D}),!t&&i.jsxs("p",{className:"m-0 flex items-start gap-2 px-2",children:[i.jsx(HM,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),i.jsx("span",{children:C})]})]})]})}const $U="outline-hidden rounded-sm focus-visible:ring-2 focus-visible:ring-ring";function LU({page:e}){var c;const{href:t,Link:n}=lt(),{org:s,projects:a,loading:r,none:o}=ss(),l=[];if(r)l.push({label:Bf});else if(o)l.push({label:"No organization"});else{const d=(s==null?void 0:s.name)??"Organization";if(l.push({label:d,href:e.kind==="home"?void 0:t(s?`/org/${s.slug}`:"/")}),e.kind==="project"){const h=((c=a==null?void 0:a.find(f=>f.id===e.project))==null?void 0:c.name)??e.project;l.push({label:h,href:e.page?t(`/proj/${encodeURIComponent(e.project)}`):void 0})}if(e.kind==="org"&&e.item!==void 0)l.push({label:mc(e),href:s?t(`/org/${s.slug}/${e.page}`):void 0}),l.push({label:e.item});else if(e.kind==="project"&&e.page&&e.item!==void 0){const h=`/proj/${encodeURIComponent(e.project)}/${e.page}${e.list_query?`?${e.list_query}`:""}`;l.push({label:mc(e),href:t(h)}),l.push({label:e.item})}else e.kind!=="home"&&!(e.kind==="project"&&!e.page)&&l.push({label:mc(e)})}return i.jsx("nav",{"aria-label":"Breadcrumb",className:"min-w-0",children:i.jsx("ol",{className:"m-0 flex min-w-0 list-none items-center gap-1.5 p-0 text-sm text-muted-foreground",children:l.map((d,h)=>i.jsxs("li",{className:"flex min-w-0 items-center gap-1.5",children:[h>0&&i.jsx(pd,{className:"size-3.5 shrink-0","aria-hidden":"true"}),d.href?i.jsx(n,{href:d.href,className:`truncate text-muted-foreground no-underline hover:text-foreground ${$U}`,children:d.label}):i.jsx("span",{className:"truncate font-normal text-foreground","aria-current":h===l.length-1?"page":void 0,children:d.label})]},`${h}-${d.label}`))})})}function PU({action:e}){const t=e.icon;return i.jsxs(kd,{children:[i.jsx(Sd,{asChild:!0,children:i.jsx(U,{type:"button",variant:"ghost",size:"control-icon","aria-label":e.label,disabled:e.disabled,onClick:e.onSelect,children:i.jsx(t,{className:"size-4","aria-hidden":"true"})})}),i.jsx(ul,{side:"bottom",children:e.label})]})}function sA({page:e,headerActions:t,children:n}){var x;const s=zU(),[a,r]=u.useState(!0),[o,l]=u.useState(!1),c=u.useRef(null),d=u.useRef(null),{org:h,projects:f,loading:m,none:p}=ss(),y=e.kind==="project"?(x=f==null?void 0:f.find(w=>w.id===e.project))==null?void 0:x.name:void 0;u.useEffect(()=>{const w=m?Bf:p?"No organization":(h==null?void 0:h.name)??"Organization",_=(e.kind==="org"||e.kind==="project")&&e.item!==void 0?`${e.item} · `:"";document.title=`${_}${mc(e,y)} · ${w} · sdlc viewer`},[e,y,h,m,p]);const g=()=>{var w;l(!1),(w=c.current)==null||w.focus()};u.useEffect(()=>{s||l(!1)},[s]);const b=s&&o;u.useEffect(()=>{var S;const w=d.current;if(!b||!w)return;(S=w.querySelector("a, button"))==null||S.focus();const _=k=>{var P;if(k.key==="Escape"){l(!1),(P=c.current)==null||P.focus();return}if(k.key!=="Tab")return;const j=[...w.querySelectorAll("a[href], button:not([disabled])")];if(j.length===0)return;const N=j[0],O=j[j.length-1],T=w.contains(document.activeElement);k.shiftKey&&(document.activeElement===N||!T)?(k.preventDefault(),O.focus()):!k.shiftKey&&(document.activeElement===O||!T)&&(k.preventDefault(),N.focus())};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[b]);const v=!s&&!a;return i.jsx(ab,{children:i.jsxs("div",{className:"flex h-svh min-h-0 overflow-hidden bg-background text-foreground",children:[!s&&i.jsx("aside",{"aria-label":"Sidebar",className:`shrink-0 border-r border-sidebar-border transition-[width] ${v?"w-12":"w-64"}`,children:i.jsx(V_,{page:e,collapsed:v})}),b&&i.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[i.jsxs("aside",{ref:d,role:"dialog","aria-modal":"true","aria-label":"Sidebar",className:"relative w-72 max-w-[85vw] border-r border-sidebar-border",children:[i.jsx(V_,{page:e,collapsed:!1,sheet:!0}),i.jsx("button",{type:"button","aria-label":"Close the sidebar",className:"absolute top-3 right-3 inline-flex size-7 items-center justify-center rounded-md border-0 bg-transparent text-sidebar-foreground/70 outline-hidden hover:text-sidebar-foreground focus-visible:ring-2 focus-visible:ring-ring",onClick:g,children:i.jsx(xd,{className:"size-4","aria-hidden":"true"})})]}),i.jsx("button",{type:"button",tabIndex:-1,"aria-hidden":"true",className:"flex-1 border-0 bg-black/80 outline-hidden",onClick:g})]}),i.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:[i.jsxs("header",{className:`flex shrink-0 items-center gap-2 border-b border-border px-4 transition-[height] ${v?"h-12":"h-16"}`,children:[i.jsx("button",{ref:c,type:"button",className:"-ml-1 inline-flex size-7 items-center justify-center rounded-md border-0 bg-transparent text-foreground outline-hidden hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Toggle Sidebar","aria-expanded":s?o:a,onClick:()=>s?l(w=>!w):r(w=>!w),children:i.jsx(u$,{className:"size-4","aria-hidden":"true"})}),i.jsx("span",{"aria-hidden":"true",className:"mr-2 h-4 w-px bg-border"}),i.jsx(LU,{page:e}),t&&t.length>0&&i.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:t.map(w=>i.jsx(PU,{action:w},w.label))})]}),i.jsx("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden overflow-y-auto",children:n})]})]})})}const Eb="m-0 text-2xl font-semibold tracking-tight",Ab="outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",Rb=`rounded-sm font-medium text-primary no-underline hover:underline ${Ab}`;function pc({children:e}){return i.jsx("pre",{className:"m-0 overflow-x-auto rounded-md border border-border bg-muted px-3 py-2 font-mono text-sm text-foreground",children:i.jsx("code",{children:e})})}function IU({why:e}){return e.kind==="not_in_git"?i.jsxs("div",{className:"flex max-w-2xl flex-col gap-2",children:[i.jsx("p",{className:"m-0 text-sm",children:"This directory is not a Git repository. Start sdlc viewer inside one:"}),i.jsx(pc,{children:"sdlc viewer"})]}):e.kind==="unlisted"?i.jsxs("div",{className:"flex max-w-2xl flex-col gap-2",children:[i.jsx("p",{className:"m-0 text-sm",children:`This repository, ${e.repository}, points to the folder ${e.folder}, but that folder no longer lists it.`}),i.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:"To rejoin, leave the folder here:"}),i.jsx(pc,{children:"sdlc-agents folder leave"}),i.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:`then add it back from the folder's home repository, ${e.home}:`}),i.jsx(pc,{children:`sdlc-agents folder add ${e.member_path} --name ${e.repository}`}),i.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:"To work in this repository alone, leaving is enough."})]}):i.jsxs("div",{className:"flex max-w-2xl flex-col gap-2",children:[i.jsx("p",{className:"m-0 text-sm",children:e.cause}),e.kind==="moved_member"&&i.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:"Move this repository back to where the folder records it."}),i.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:e.kind==="other"&&!e.fix?Dr:FI})]})}const U_=`inline-flex h-9 items-center justify-center whitespace-nowrap rounded-md border border-input bg-background px-3 font-[inherit] text-sm font-medium text-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 ${Ab}`;function GU(){return i.jsxs("div",{role:"status",className:"flex flex-col gap-2",children:[i.jsx("span",{className:"sr-only",children:"Loading projects"}),[0,1,2].map(e=>i.jsx("span",{"aria-hidden":"true",className:"block h-9 animate-pulse rounded-md bg-muted"},e))]})}function gl(){const{href:e,Link:t}=lt(),{loading:n,projects:s,none:a,failure:r,readAt:o,refresh:l,reading:c}=ss(),[d,h]=u.useState(""),f=i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("h1",{className:Eb,children:"Projects"}),!a&&i.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:WI})]});if(a)return i.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[f,i.jsx(IU,{why:a==="not_in_git"?{kind:"not_in_git"}:ZI(a)})]});const m=r!=null&&r.shown?r:null,p=(s??[]).filter(y=>y.name.toLowerCase().includes(d.trim().toLowerCase()));return i.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[f,m&&i.jsxs("div",{role:"alert",className:"flex flex-col gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-4",children:[i.jsx("p",{className:"m-0 text-sm font-medium text-destructive",children:"The projects could not be refreshed"}),i.jsx("p",{className:"m-0 text-sm",children:ED(m.refusal,o)}),i.jsx("div",{children:i.jsx("button",{type:"button",className:U_,onClick:l,disabled:c,children:"Retry"})})]}),(s||n)&&i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"search","aria-label":"Filter projects",placeholder:"Filter projects",value:d,onChange:y=>h(y.target.value),className:`h-9 w-full max-w-sm rounded-md border border-input bg-transparent px-3 font-[inherit] text-sm text-foreground placeholder:text-muted-foreground ${Ab}`}),!m&&i.jsx("button",{type:"button",className:`${U_} ml-auto`,onClick:l,disabled:c||n,children:"Refresh"})]}),r&&!r.shown&&o&&i.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:`Showing the list read at ${Ul(o)}; reading again in ${r.retryInSeconds??10} seconds.`})]}),n?i.jsx(GU,{}):s&&i.jsx("div",{className:"overflow-x-auto rounded-md border border-border",children:i.jsxs("table",{className:"w-full border-collapse text-sm",children:[i.jsx("thead",{className:"border-b border-border text-left text-muted-foreground",children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",className:"h-10 px-3 font-medium",children:"Name"}),i.jsx("th",{scope:"col",className:"h-10 px-3 font-medium",children:"Location"}),i.jsx("th",{scope:"col",className:"h-10 px-3",children:i.jsx("span",{className:"sr-only",children:"Where this viewer runs"})})]})}),i.jsxs("tbody",{children:[p.map(y=>i.jsxs("tr",{className:"border-b border-border last:border-0",children:[i.jsx("td",{className:"px-3 py-2",children:i.jsx(t,{href:e(`/proj/${encodeURIComponent(y.id)}`),className:Rb,children:y.name})}),i.jsx("td",{className:"px-3 py-2 font-mono text-muted-foreground",children:y.location??Ch}),i.jsx("td",{className:"px-3 py-2 text-right",children:y.current&&i.jsx("span",{className:"inline-flex items-center rounded-md border border-border px-2 py-0.5 text-xs font-medium",children:"This repository"})})]},y.id)),p.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:3,className:"px-3 py-6 text-center text-muted-foreground",children:"No projects found."})})]})]})})]})}function iA({title:e,children:t,more:n}){const{href:s,Link:a}=lt();return i.jsx("div",{className:"p-6",children:i.jsxs("div",{className:"flex max-w-xl flex-col gap-2 rounded-xl border border-border bg-card p-6 text-card-foreground",children:[i.jsx("h1",{className:Eb,children:e}),i.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:t}),n&&i.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:n}),i.jsx("div",{children:i.jsx(a,{href:s("/"),className:`text-sm ${Rb}`,children:"Back to the organization's Home"})})]})})}const HU={tasks:"Tasks",issues:"Issues",releases:"Releases"},VU="This release of the viewer has no page that browses the graph. Read it in a terminal:";function Wc({project:e}){const{href:t,Link:n}=lt(),{org:s,projects:a,loading:r,domains:o}=ss(),l=a==null?void 0:a.find(c=>c.id===e);return r?i.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:Bf}):a?l?i.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("h1",{className:Eb,children:l.name}),i.jsx("p",{className:"m-0 font-mono text-sm text-muted-foreground",children:l.location??Ch})]}),l.current?o.length>0?i.jsx("ul",{className:"m-0 flex list-none flex-col gap-1 p-0 text-sm",children:o.map(c=>i.jsx("li",{children:i.jsx(n,{href:t(c==="tasks"?`${s?`/org/${s.slug}`:""}/tasks`:`/proj/${encodeURIComponent(l.id)}/${c}`),className:Rb,children:HU[c]})},c))}):null:i.jsx("p",{className:"m-0 max-w-2xl text-sm text-muted-foreground",children:`This viewer reads ${l.name}'s tasks, issues and Releases only from its own checkout: open it with sdlc viewer there.`}),i.jsxs("section",{"aria-labelledby":"project-graph",className:"flex max-w-2xl flex-col gap-2",children:[i.jsx("h2",{id:"project-graph",className:"m-0 text-lg font-semibold",children:"Graph"}),i.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:VU}),i.jsx(pc,{children:"sdlc workspace find <words>"}),i.jsx(pc,{children:"sdlc workspace show <id>"})]})]}):i.jsx(iA,{title:"Project not found",children:`There is no project '${e}' in this organization.`}):i.jsx(gl,{})}const Dd=e=>e instanceof Error?e.message:String(e);async function Xi(e){await e.text().catch(()=>{})}async function aA(e=!1){try{const t=await fetch(e?"api/threads?archived=1":"api/threads",{cache:"no-store"});return t.status===404?(await Xi(t),{none:!0}):t.ok?{data:await t.json()}:{error:await t.text()||`HTTP ${t.status}`}}catch(t){return{error:Dd(t)}}}async function UU(){var e;try{const t=await fetch("api/release-links?threads",{cache:"no-store"});if(!t.ok)return await Xi(t),null;const n=await t.json(),s=(e=n==null?void 0:n.panel)==null?void 0:e.threads;if(!s||typeof s!="object"||Array.isArray(s))return null;const a={};for(const[r,o]of Object.entries(s)){const l=(Array.isArray(o)?o:[]).filter(c=>!!c&&typeof c.planned_release=="string"&&typeof c.name=="string"&&typeof c.level=="string");l.length&&(a[r]=l)}return a}catch{return null}}async function BU(){try{return(await fetch("api/pin",{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}async function WU(){try{const e=await fetch("api/sessions",{cache:"no-store"});if(!e.ok)return await Xi(e),null;const t=await e.json();return!t||typeof t.idle_over!="number"||!Array.isArray(t.sessions)?null:{idle_over:t.idle_over,memory_mb:Number(t.memory_mb)||0,sessions:t.sessions}}catch{return null}}async function FU(){try{const e=await fetch("api/sessions-release",{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:"{}"});if(!e.ok)return{error:await e.text()||`HTTP ${e.status}`};const t=await e.json();return{done:{released:t.released??[],kept:t.kept??[]}}}catch(e){return{error:Dd(e)}}}async function rA(e,t){try{const n=await fetch("api/threads/open",{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,reopen:t})}),s=await n.text();let a={};try{a=JSON.parse(s)??{}}catch{}return n.ok?{done:a}:{refused:{reason:typeof a.reason=="string"?a.reason:"failed",error:typeof a.error=="string"?a.error:s||`HTTP ${n.status}`,...typeof a.where=="string"&&a.where?{where:a.where}:{}}}}catch(n){return{refused:{reason:"failed",error:Dd(n)}}}}async function qU(){try{return(await fetch("api/threads/archive",{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}async function YU(e){const t=await e.text();try{const n=JSON.parse(t);if(typeof(n==null?void 0:n.error)=="string"&&n.error)return n.error}catch{}return t||`HTTP ${e.status}`}async function XU(e){try{const t=await fetch(`api/threads/archive?key=${encodeURIComponent(e)}`,{cache:"no-store"});if(!t.ok)return await Xi(t),null;const n=await t.json();return typeof(n==null?void 0:n.detail)=="string"&&n.detail?{detail:n.detail,failed:n.failed===!0}:null}catch{return null}}async function KU(e,t){try{const n=await fetch("api/threads/archive",{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,on:t})});return n.ok?(await Xi(n),null):await YU(n)}catch(n){return Dd(n)}}async function ZU(e,t){try{const n=await fetch("api/pin",{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,on:t})});return n.ok?(await Xi(n),null):await n.text()||`HTTP ${n.status}`}catch(n){return Dd(n)}}const QU={probe:{source:async()=>{const e=await aA();if("error"in e)throw new Error(e.error);return{label:"Local workspace"}}}},Iu={href:e=>e.replace(/^\/+/,"")||"./",Link:({href:e,className:t,children:n,...s})=>i.jsx("a",{href:e,className:t,...s,children:n})},JU={label:"Local viewer",can:()=>!1};function eB(){return u.useEffect(()=>{document.title="Shared app UI · SDLC Workspace Viewer"},[]),i.jsx("div",{className:"app-ui dark",children:i.jsx(Wg,{data:QU,router:Iu,identity:JU,children:i.jsx(HI,{})})})}const B_="Who waits on whom among the threads here, the threads that hold up the most first. Waits in a queue and waits on you are counted apart.",Gu=15,tB="New waits that would close a loop are refused. One thread hands its part over or asks the user.",nB="Threads in line for a queue are on Queues; threads that wait on you are marked Needs you on Threads.";function sB(){const e=Wn().blockers;if(!e)throw new Error("The Blockers page rendered without the blockers seam.");return e}const xr=(e,t,n)=>`${e} ${e===1?t:n}`;function ix(e){const t=Math.max(0,Math.round(e*60));if(t<60)return`${t}m`;if(t<24*60){const n=t%60;return n?`${Math.floor(t/60)}h ${n}m`:`${Math.floor(t/60)}h`}return`${Math.floor(t/(24*60))}d`}function iB(e,t){return t?e===null?`Not reading · trying again every ${Gu}s`:`Not reading since ${Zn(e/1e3)} · trying again every ${Gu}s`:e===null?"Connecting…":`Live · read ${Zn(e/1e3)} · refreshes every ${Gu}s`}function aB(e){var n;if(e.carried_by)return`taken over by ${e.carried_by.title}`;if(e.finished)return"finished";const t=[];return(n=e.queued)!=null&&n.length&&t.push(`in the ${e.queued.join(" and ")} queue`),e.asks_user&&t.push("asks you"),e.phase&&t.push(e.phase),e.quiet&&e.heard_hours!==null?t.push(`quiet ${ix(e.heard_hours)}`):e.heard_hours!==null&&t.push(`heard ${ix(e.heard_hours)} ago`),t.join(" · ")}function rB(e){const t=new Map(e.threads.map(r=>[r.thread,r.title])),n=r=>t.get(r)??r,s=e.holds.length?[...new Set(e.holds.map(r=>`${n(r.waiter)} waits on ${n(r.on)}`))]:e.threads.map((r,o)=>`${r.title} waits on ${e.threads[(o+1)%e.threads.length].title}`),a=s.pop()??"";return`Wait loop: ${s.length?`${s.join(", ")}, and ${a}`:a}`}function oB(e,t){const n=xr(e.blocked_threads,"thread waits","threads wait"),s=`in ${xr(t,"wait loop","wait loops")}`;return e.blockers?`${n} on ${xr(e.blockers,"blocker","blockers")}${t?` and ${s}`:""}`:`${n} ${s}`}const lB=e=>e.replace(/\s*\(status release\)$/,"");function cB({org:e}){const t=sB(),n=is(),[s,a]=u.useState(null),[r,o]=u.useState(null),l=Os(),c=u.useRef(0),d=u.useCallback(async p=>{const y=c.current+=1,g=await l.track(t.report(p?{fresh:!0}:void 0));y===c.current&&(g.ok?(a(g.data),o(null)):o(g.refusal))},[t,l]);u.useEffect(()=>{d(!1)},[d]);const h=u.useMemo(()=>Ff(l,()=>void d(!1)),[d,l]);if(qi(h,Gu*1e3),(r==null?void 0:r.reason)==="engine_missing")return i.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:i.jsx(ji,{page:"Blockers"})});if((r==null?void 0:r.reason)==="view_outdated")return i.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:[i.jsx(_n,{title:"Blockers",description:B_}),i.jsxs(me,{variant:"warning",className:"mt-6",children:[i.jsx(Nt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:Lr}),i.jsx(pe,{children:n})]})]});const f=(s==null?void 0:s.read_at)??null,m=r??(s!=null&&s.stale?{status:200,message:s.stale.message,reason:s.stale.reason}:null);return i.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:[i.jsx(_n,{title:"Blockers",description:B_}),i.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:iB(f,m!==null)}),!s&&!r?i.jsx(dB,{}):null,m?i.jsx(uB,{refusal:m,on_retry:()=>void d(!0)}):null,s?i.jsx(hB,{org:e,report:s,stale:m!==null}):null]})}function dB(){return i.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading blockers",children:Array.from({length:3},(e,t)=>i.jsx(Tt,{className:t===2?"h-10 w-2/3":"h-10 w-full"},t))})}function uB({refusal:e,on_retry:t}){const n=i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"});return e.reason==="store_locked"?i.jsxs(me,{variant:"info",className:"mt-4",children:[i.jsx(pn,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"The local stores are busy"}),i.jsxs(pe,{children:[i.jsx("p",{children:e.message}),n]})]}):i.jsxs(me,{variant:"destructive",className:"mt-4",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Blockers could not be read"}),i.jsxs(pe,{children:[i.jsx("p",{children:e.message||"The read did not answer. Try again in a moment."}),n]})]})}function Jf(e){const{href:t,Link:n}=lt(),s=e?`/org/${encodeURIComponent(e)}`:"";return{href:a=>t(`${s}${a}`),name:(a,r="text-primary hover:underline")=>a.thread.startsWith("exec-")?i.jsx("span",{children:a.title}):i.jsx(n,{className:r,href:t(`${s}/threads#thread-${encodeURIComponent(a.thread)}`),children:a.title}),Link:n}}function hB({org:e,report:t,stale:n}){const{href:s,Link:a}=Jf(e),{summary:r}=t,o=n?` · last read ${Zn(t.read_at/1e3)}`:"",l=Object.entries(t.queue_waits).filter(([,d])=>d>0),c=r.blocked_threads>0||t.loops.length>0;return i.jsxs(i.Fragment,{children:[i.jsx("div",{role:"status","aria-live":"polite",children:c?i.jsx("p",{className:"text-muted-foreground mt-4 text-sm",children:`${oB(r,t.loops.length)}${o}`}):i.jsxs("div",{className:"mt-2 flex flex-col gap-1",children:[i.jsx("p",{className:"text-sm font-medium",children:"Nothing is blocked"}),i.jsxs("p",{className:"text-muted-foreground text-xs",children:[nB,o]})]})}),t.loops.map(d=>i.jsx(fB,{org:e,loop:d},d.threads.map(h=>h.thread).join("|"))),t.blockers.length?i.jsxs("section",{className:"mt-4 flex flex-col gap-3","aria-labelledby":"biggest-blockers",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("h2",{id:"biggest-blockers",className:"text-lg font-semibold",children:"Biggest blockers"}),i.jsx(be,{variant:"neutral",children:t.blockers.length})]}),t.blockers.map(d=>i.jsx(pB,{org:e,card:d},d.thread))]}):null,t.user_waits>0||l.length?i.jsxs("div",{className:"mt-6 flex flex-col gap-2 text-sm",children:[t.user_waits>0?i.jsxs("p",{className:"flex flex-wrap items-baseline gap-x-2",children:[i.jsx("span",{className:"text-warning",children:`Waiting on you: ${xr(t.user_waits,"thread","threads")}`}),i.jsx(a,{className:"text-primary hover:underline",href:s("/threads"),children:"Open Threads"})]}):null,l.map(([d,h])=>i.jsxs("p",{className:"flex flex-wrap items-baseline gap-x-2",children:[i.jsx("span",{className:"text-muted-foreground",children:d==="main"?`In line to land: ${xr(h,"thread","threads")} in the main queue`:`In line for ${d}: ${xr(h,"thread","threads")} in the ${d} queue`}),i.jsx(a,{className:"text-primary hover:underline",href:s(`/queues?queue=${encodeURIComponent(d)}`),children:`Open the ${d} queue`})]},d))]}):null]})}function fB({org:e,loop:t}){const{href:n,Link:s}=Jf(e),a=mB(t.waiters);return i.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[i.jsxs(me,{variant:"destructive",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:rB(t)}),i.jsxs(pe,{children:[i.jsx("p",{children:tB}),i.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:t.threads.map(r=>r.thread.startsWith("exec-")?null:i.jsx(U,{asChild:!0,variant:"outline",size:"sm",className:"h-auto min-h-8 whitespace-normal text-left no-underline",children:i.jsx(s,{href:n(`/threads#thread-${encodeURIComponent(r.thread)}`),children:`Open ${r.title}`})},r.thread))})]})]}),a?i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx("p",{className:"text-muted-foreground text-xs",children:`Behind the loop: ${xr(a,"thread","threads")}`}),i.jsx(Tb,{org:e,waiters:t.waiters})]}):null]})}const mB=e=>new Set(function t(n){return n.flatMap(s=>[s.thread,...t(s.waiters??[])])}(e)).size;function pB({org:e,card:t}){const{name:n}=Jf(e),s=aB(t.state);return i.jsxs(wt,{className:"flex flex-col gap-1 p-4","data-testid":"blockers-card",children:[i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[i.jsx("h3",{className:"min-w-0 text-sm font-semibold break-words",children:n(t)}),i.jsx(be,{variant:"neutral",children:`blocks ${t.weight}`})]}),s?i.jsx("p",{className:"text-muted-foreground text-xs",children:s}):null,i.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:`Clears when ${lB(t.clears)}`}),i.jsx("div",{className:"mt-1",children:i.jsx(Tb,{org:e,waiters:t.waiters})})]})}function Tb({org:e,waiters:t,via:n}){const{name:s}=Jf(e);return i.jsx("ul",{className:"border-border m-0 flex list-none flex-col gap-3 border-l p-0 pl-4",children:t.map(a=>{var r;return i.jsxs("li",{className:"flex min-w-0 flex-col gap-1",children:[i.jsx("span",{className:"text-sm break-words",children:s(a)}),i.jsx("span",{className:"text-muted-foreground text-xs break-words whitespace-pre-line",children:`waits ${ix(a.age_hours)} · ${[n?`via ${n}`:"",a.reason.trim()].filter(Boolean).join(" · ")||"no reason given"}`}),(r=a.waiters)!=null&&r.length?i.jsx(Tb,{org:e,waiters:a.waiters,via:a.title}):null]},`${a.hold}-${a.thread}`)})})}const gB="This repository's local planning workspaces: which workspace each forked from, what this checkout's workspace may change, and the integrations and Handoffs between them. This page only reads them; sdlc workspace and sdlc integrate change them.",xB=3e4,vB="Reading the workspaces. On a plan workspace this can take a few minutes.",bB="The read failed. Details are in the terminal running sdlc viewer.",yB={active:{label:"Active",tone:"success"},closed:{label:"Closed",tone:"neutral"},clean:{label:"Clean",tone:"success"},dirty:{label:"Uncommitted changes",tone:"warning"},unreadable:{label:"Unreadable",tone:"error"},queued:{label:"Queued",tone:"info"},integrated:{label:"Integrated",tone:"success"},reconciled:{label:"Reconciled",tone:"success"},stale_head:{label:"Retrying",tone:"warning"},current:{label:"Current",tone:"neutral"},blocked_conflict:{label:"Blocked: conflict",tone:"warning"},blocked_validation:{label:"Blocked: validation error",tone:"warning"},ready:{label:"Ready",tone:"success"},applied:{label:"Applied",tone:"success"},stale_base:{label:"Stale base",tone:"warning"},applied_recovery_required:{label:"Needs recovery",tone:"warning"},unavailable:{label:"Unavailable",tone:"warning"},needs_attention:{label:"Needs attention",tone:"warning"}},wB=e=>yB[e]??{label:e,tone:"neutral"},ba=e=>e.slice(0,8),oA={human:"Human",ai:"AI"},ax=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function _B(){const e=Wn().workspaces;if(!e)throw new Error("The Workspaces page rendered without the workspaces seam.");return e}function jB(e){const t=_B(),[n,s]=u.useState(null),[a,r]=u.useState(null),[o,l]=u.useState(!1),c=u.useRef(null),d=u.useRef(!1),h=u.useRef(null),f=u.useCallback(()=>{if(h.current)return h.current;const b=(async()=>{const v=await t.overview();v.ok?(s(v.data),r(null),l(!1)):(r(v.refusal),l(!0))})().finally(()=>{h.current=null});return h.current=b,b},[t]);u.useEffect(()=>{f()},[f]),qi(()=>void f(),xB),u.useEffect(()=>{var b;d.current&&(n||a)&&(d.current=!1,(b=c.current)==null||b.focus())},[n,a]);const m=()=>{d.current=!0,f()},p=n===null&&a===null,y=n===null&&a!==null,g=n?NB(n,o):null;return i.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:[i.jsx(_n,{title:"Workspaces",description:gB,actions:i.jsxs(i.Fragment,{children:[g?i.jsx("p",{className:"text-muted-foreground text-xs",children:g}):null,i.jsxs(U,{type:"button",variant:"outline",size:"sm","aria-disabled":p||void 0,"aria-describedby":p?"workspaces-reading":void 0,className:"gap-2",onClick:p?void 0:()=>void f(),children:[i.jsx(zr,{className:"size-4","aria-hidden":"true"}),"Read again"]}),p?i.jsx("span",{id:"workspaces-reading",className:"sr-only",children:"Reading…"}):null,i.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n?lA(n,o):""})]})}),i.jsxs("div",{ref:c,tabIndex:-1,className:"outline-none",children:[p?i.jsx(kB,{}):null,y&&a?i.jsx(SB,{refusal:a,on_retry:m}):null,n?i.jsx(CB,{overview:n}):null]})]})}function lA(e,t){var n,s;return t||((n=e.stale)==null?void 0:n.reason)==="failed"?"a newer read failed":((s=e.stale)==null?void 0:s.reason)==="running"?"a newer read is still running":""}function NB(e,t){const n=`Read at ${Ys(new Date(e.read_at).toISOString())}`,s=lA(e,t);return s?`${n} · ${s}`:n}function kB(){return i.jsxs("div",{className:"mt-6",children:[i.jsx("div",{className:"grid gap-2",role:"status","aria-label":"Loading workspaces",children:Array.from({length:6},(e,t)=>i.jsx(Tt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))}),i.jsx("p",{className:"text-muted-foreground mt-3 text-sm","aria-live":"polite",children:vB})]})}function SB({refusal:e,on_retry:t}){const n=e.reason==="store_locked"?ED(e,null):bB;return i.jsxs(me,{variant:"destructive",className:"mt-6",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Could not read workspaces"}),i.jsxs(pe,{children:[i.jsx("p",{children:n}),i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function CB({overview:e}){const{counts:t}=e,n=[ax(t.workspaces,"workspace"),`${t.active} active`,`${t.queued} queued`,`${t.blocked} blocked`].join(" · ");return i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-muted-foreground mt-2 text-sm",role:"status","aria-live":"polite",children:n}),i.jsxs("div",{className:"mt-4 grid gap-4 lg:grid-cols-[1.4fr_1fr]",children:[i.jsx(lu,{id:"workspaces-lineage",title:"Lineage",caption:"Each workspace under the one it forked from",children:i.jsx(DB,{rows:e.workspaces})}),i.jsx(lu,{id:"workspaces-authority",title:"Authority and resolver",caption:"What this checkout's workspace may change",children:i.jsx(EB,{authority:e.authority})})]}),i.jsx(lu,{id:"workspaces-activity",className:"mt-4",title:"Integration activity",caption:"Newest first",children:e.activity.length===0?i.jsx(W_,{children:"No integration or reconciliation attempts yet."}):i.jsx(RB,{rows:e.activity})}),i.jsx(lu,{id:"workspaces-handoffs",className:"mt-4",title:"Handoffs",children:e.handoffs.length===0?i.jsx(W_,{children:"No Handoffs prepared yet."}):i.jsx(TB,{rows:e.handoffs})})]})}function lu({id:e,title:t,caption:n,className:s,children:a}){return i.jsxs("section",{"aria-labelledby":e,className:we("min-w-0",s),children:[i.jsxs("div",{className:"mb-2 flex flex-wrap items-baseline gap-x-2",children:[i.jsx("h2",{id:e,className:"text-lg font-semibold",children:t}),n?i.jsx("span",{className:"text-muted-foreground text-sm",children:n}):null]}),a]})}const W_=({children:e})=>i.jsx("p",{className:"text-muted-foreground text-sm",children:e}),$h=({children:e,tone:t})=>i.jsx("div",{className:we("text-xs",t==="error"?"text-destructive":"text-muted-foreground"),children:e});function Fc({status:e}){const t=wB(e);return i.jsx(be,{variant:t.tone,children:t.label})}function em({label:e,children:t}){return i.jsx(wt,{role:"group","aria-label":e,tabIndex:0,className:"overflow-x-auto outline-hidden focus-visible:ring-2 focus-visible:ring-ring",children:t})}function DB({rows:e}){return i.jsx(em,{label:"Workspaces",children:i.jsxs(it,{containerClassName:"overflow-visible",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Workspace"}),i.jsx(J,{children:"Actor"}),i.jsx(J,{children:"Forked from"}),i.jsx(J,{children:"Status"}),i.jsx(J,{children:"Projection"})]})}),i.jsx(at,{children:e.map(t=>i.jsxs(ye,{"data-testid":"workspaces-row",children:[i.jsxs(X,{children:[i.jsx("div",{className:"font-mono font-medium",children:t.short_id}),i.jsx($h,{children:t.current?`${t.path} · This checkout`:t.path}),t.projection==="unreadable"&&t.projection_error&&i.jsx($h,{children:t.projection_error})]}),i.jsx(X,{children:oA[t.actor]}),i.jsx(X,{children:t.source_id?i.jsx("span",{className:"font-mono",children:ba(t.source_id)}):i.jsx("span",{className:"text-muted-foreground",children:"No source"})}),i.jsx(X,{children:i.jsx(Fc,{status:t.status})}),i.jsx(X,{children:i.jsx(Fc,{status:t.projection})})]},t.id))})]})})}function EB({authority:e}){const t=e.resolver,n=[["Workspace",i.jsx("span",{className:"font-mono",children:ba(e.workspace_id)},"id")],["Actor",oA[e.actor]],["Own head","Writes it"]];return e.source_head==="handoff_only"&&n.push(["Source head","Only through a Handoff"]),n.push(["Git refs","Read only"]),n.push(["Remotes",e.remotes>0?`${e.remotes} named ${e.remotes===1?"remote":"remotes"}`:i.jsx("span",{className:"text-muted-foreground",children:"None"},"none")]),n.push(["Push to remotes",e.push==="human_only"?"Only a person":"Not allowed"]),n.push(["Resolver",t.state==="not_configured"?i.jsx("span",{className:"text-muted-foreground",children:"Not configured"},"resolver"):i.jsx(Fc,{status:t.state==="ready"?"ready":"needs_attention"},"resolver")]),t.state==="needs_attention"&&t.issue&&n.push(["Resolver issue",t.issue]),i.jsx(em,{label:"Authority and resolver",children:i.jsx(it,{containerClassName:"overflow-visible",children:i.jsx(at,{children:n.map(([s,a])=>i.jsxs(ye,{children:[i.jsx(J,{scope:"row",className:"text-muted-foreground font-normal",children:s}),i.jsx(X,{children:a})]},s))})})})}function AB(e){const t=[e.merge_attempts?ax(e.merge_attempts,"merge attempt"):null,e.resolver_attempts?ax(e.resolver_attempts,"resolver attempt"):null].filter(Boolean);if(t.length)return t.join(" · ");const n=e.kind==="reconciliation"?"No resolver attempts":"No merge attempts yet";return i.jsx("span",{className:"text-muted-foreground",children:n})}function RB({rows:e}){return i.jsx(em,{label:"Integration activity",children:i.jsxs(it,{containerClassName:"overflow-visible",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"Change"}),i.jsx(J,{children:"Status"}),i.jsx(J,{children:"Attempts"}),i.jsx(J,{children:"Updated"})]})}),i.jsx(at,{children:e.map((t,n)=>i.jsxs(ye,{children:[i.jsxs(X,{children:[i.jsx("div",{className:"font-medium",children:t.kind==="integration"?`Integrate ${ba(t.child_id)} into ${ba(t.other_id)}`:`Reconcile ${ba(t.child_id)} from ${ba(t.other_id)}`}),i.jsx($h,{children:t.kind==="integration"?"Integration":"Source reconciliation"})]}),i.jsx(X,{children:i.jsx(Fc,{status:t.status})}),i.jsx(X,{children:AB(t)}),i.jsx(X,{children:zD(t.updated_at)})]},`${t.kind}-${t.child_id}-${t.other_id}-${t.updated_at}-${n}`))})]})})}function TB({rows:e}){return i.jsx(em,{label:"Handoffs",children:i.jsxs(it,{containerClassName:"overflow-visible",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{children:"From"}),i.jsx(J,{children:"To"}),i.jsx(J,{children:"Status"}),i.jsx(J,{children:"Pinned"})]})}),i.jsx(at,{children:e.map(t=>i.jsxs(ye,{children:[i.jsxs(X,{children:[i.jsx("div",{className:"font-mono font-medium",children:ba(t.child_id)}),t.error?i.jsx($h,{children:t.error}):null]}),i.jsx(X,{className:"font-mono",children:ba(t.source_id)}),i.jsx(X,{children:i.jsx(Fc,{status:t.status})}),i.jsx(X,{children:`${t.child_commit} onto ${t.source_commit}`})]},t.id))})]})})}const F_="This machine's worktrees of this repository.",OB="Merge sends one whose thread is at rest to the main queue.",zB=3e4,MB=3e3,$B=6e5,yp=[{id:"all",label:"All",empty:"worktree"},{id:"needs",label:"Needs landing",empty:"worktree needing landing"},{id:"orphan",label:"No thread to land it",empty:"worktree with no thread to land it"},{id:"queued",label:"In a queue",empty:"queued worktree"},{id:"landed",label:"Landed",empty:"landed worktree"},{id:"decide",label:"Yours to decide",empty:"worktree yours to decide"}],zl={not_landed:{label:"Not landed",tone:"neutral"},main:{label:"On main",tone:"success"},production:{label:"In production",tone:"success"},queued:{label:"Main queue",tone:"info"},needs_you:{label:"Needs you",tone:"warning"}},LB="no thread to land it",Ob="its thread waits on you",cA="its thread is done",dA="its thread is retired",zb=e=>e.archivable&&e.cleanup==="user",PB=e=>e.queue!==null||e.merge.offered===!1&&e.merge.why==="already in a promotion queue",IB=e=>!e.merge.offered&&(e.merge.why===cA||e.merge.why.startsWith(dA)),Mb=e=>!e.merge.offered&&e.merge.why===LB||IB(e),wp=(e,t)=>t==="all"?!0:t==="decide"?zb(e):(e.landed!==null?"landed":PB(e)?"queued":Mb(e)?"orphan":"needs")===t,GB=e=>e.landed!==null?e.threads.some(t=>t.phase!=="done"):e.threads.length>0&&!Mb(e);function Hu(e){return e>=1e9?`${(e/1e9).toFixed(1)} GB`:e>=1e6?`${Math.round(e/1e6)} MB`:`${Math.max(1,Math.round(e/1e3))} KB`}function uA(e){const t=e%100,n=t>=11&&t<=13?"th":{1:"st",2:"nd",3:"rd"}[e%10]??"th";return`${e}${n}`}function HB(e){if(e===null)return"No commits";if(e<1)return"Today";const t=Math.floor(e);return t===1?"1 day ago":`${t} days ago`}const _p=e=>Ys(new Date(e*1e3).toISOString()),Fl=e=>e.charAt(0).toUpperCase()+e.slice(1);function VB(e,t){var a;const n=t.phase?Fl(t.phase):"No phase",s=e.merge;if(!s.offered&&s.why.startsWith(dA)){const r=(a=/; (.+) continues it$/.exec(s.why))==null?void 0:a[1];return r?`Retired · continued by ${r}`:"Retired"}return t.phase==="done"||!s.offered&&s.why===cA?e.landed===null?"Done · without landing this":"Done":s.offered?`${n} · at rest`:s.why.startsWith("its thread is at work")?`${n} · at work`:s.why===Ob?`${n} · waits on you`:s.why.startsWith("its session is not running")?`${n} · session not running`:n}function UB(){const e=Wn().worktrees;if(!e)throw new Error("The Worktrees page rendered without the worktrees seam.");return e}function BB({org:e}){var M,H;const t=UB(),[n,s]=u.useState(null),[a,r]=u.useState(null),[o,l]=u.useState(null),[c,d]=u.useState(!1),[h,f]=u.useState("all"),[m,p]=u.useState(""),[y,g]=u.useState({}),b=u.useRef({}),{confirm:v,confirm_dialog:x}=al(),w=u.useRef(!1),_=u.useCallback(async()=>{if(w.current)return;w.current=!0;const z=await t.list();w.current=!1,z.ok?(s(z.data),r(null)):r(z.refusal)},[t]),S=u.useCallback(async()=>{const z=await t.sizes();d(!z.ok),z.ok&&l(z.data)},[t]);u.useEffect(()=>{_(),S()},[_,S]);const k=(n==null?void 0:n.rows.some(z=>{var K,oe;return((K=z.write)==null?void 0:K.state)==="waiting"||((oe=z.write)==null?void 0:oe.state)==="running"}))??!1;qi(()=>void _(),k?MB:zB),qi(()=>void S(),$B);const j=(n==null?void 0:n.rows)??[],N=z=>o==null?void 0:o.sizes[z.path],O=j.filter(zb),T=o?O.reduce((z,K)=>z+(N(K)??0),0):null,P=j.length===0?F_:`${F_} ${OB}${O.length?` ${O.length} ${O.length===1?"is":"are"} yours to decide${T!==null?`: removing them frees about ${Hu(T)}`:""}.`:""}`,L=m.trim().toLowerCase(),G=z=>!L||[z.name,z.path,z.branch??"",...z.threads.map(K=>K.title??K.thread)].some(K=>K.toLowerCase().includes(L)),A=j.filter(z=>wp(z,h)&&G(z)).sort((z,K)=>{if(h==="decide")return(N(K)??0)-(N(z)??0);const oe=re=>GB(re)?re.merge.offered?0:1:2;return oe(z)-oe(K)||(z.idle_days??1/0)-(K.idle_days??1/0)}),D=async(z,K)=>{const oe=await(z==="merge"?t.merge(K.path):t.remove(K.path));oe.ok?g(({[K.path]:re,...ve})=>ve):g(re=>({...re,[K.path]:oe.refusal.message})),await _()},C=async z=>{if(!z.merge.offered)return;const K=z.threads.find(Ne=>Ne.thread===(z.merge.offered&&z.merge.thread)),oe=(K==null?void 0:K.title)??z.merge.thread,re=K!=null&&K.holds.length?`has ${K.holds.length} open hold(s) (${K.holds.join(", ")})`:"has no open holds",ve=z.merge.lands.by==="manager"?`on its turn the queue's merge manager, ${z.merge.lands.manager}, lands it on main`:"on its turn that thread lands it on main",ke=z.merge.caveat?`
|
|
431
|
+
|
|
432
|
+
Its session could not be read: ${z.merge.caveat}. A turn it does not start passes on.`:"";await v({title:`Send ${z.name} to the main queue`,description:`This joins the main promotion queue for its thread, ${oe}, which ${re} and is told of the join. The queue checks the branch first, and ${ve}. Nothing reaches main before then.${ke}`,action_label:"Join the main queue"})&&await D("merge",z)},R=async z=>{const K=N(z);await v({title:`Remove ${z.name}?`,description:`This deletes the folder ${z.path}${K!==void 0?` and frees about ${Hu(K)}`:""}.${z.branch?` Its branch ${z.branch} stays, so its work can be checked out again,`:""} and its task records are saved first; a landed plan workspace in it is closed. It stays with you because ${z.cleanup_why[0]??"the Local systems manager leaves it to you"}. The worktree is checked again just before, and nothing is deleted if that check finds work in it.`,action_label:"Remove worktree",destructive:!0})&&(K!==void 0&&(b.current[z.path]=K),await D("remove",z))},E=async z=>{await t.dismiss(z),await _()};return(a==null?void 0:a.reason)==="engine_missing"?i.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:i.jsx(ji,{page:"Worktrees"})}):i.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:[i.jsx(_n,{title:"Worktrees",description:P}),!n&&!a&&i.jsx(WB,{}),a?i.jsx(FB,{refusal:a,read_at:n==null?void 0:n.read_at,on_retry:()=>void _()}):null,n!=null&&n.stale?i.jsxs(me,{variant:"destructive",className:"mt-4",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Could not read worktrees"}),i.jsxs(pe,{children:[i.jsxs("p",{children:[n.stale.message," This list was read at ",Ys(new Date(n.read_at).toISOString()),"."]}),i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void _(),children:"Retry"})]})]}):null,n==null?void 0:n.removals.map(z=>i.jsxs(me,{variant:"success",className:"mt-4",role:"status",children:[i.jsx(je,{children:b.current[z.path]!==void 0?`Removed ${z.name} and freed ${Hu(b.current[z.path])}`:`Removed ${z.name}`}),i.jsxs(pe,{children:[i.jsx("p",{children:z.branch?`Its branch ${z.branch} stays, and its records were saved.`:"Its records were saved."}),i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void E({removal:z.path}),children:"Dismiss"})]})]},z.path)),n&&j.length===0?i.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[i.jsx(Dv,{className:"text-muted-foreground size-8","aria-hidden":"true"}),i.jsx("h2",{className:"text-lg font-semibold",children:"Only the main checkout"}),i.jsx("p",{className:"text-muted-foreground text-sm",children:"No other worktrees. Agents make theirs in .sdlc-worktrees beside the main checkout."})]}):n?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[i.jsx(yt,{type:"search",className:"w-64","aria-label":"Search worktrees",placeholder:"Search worktrees",value:m,onChange:z=>p(z.target.value)}),i.jsxs("p",{className:"text-muted-foreground ml-auto text-xs",children:["Read at ",Ys(new Date(n.read_at).toISOString())," · rereads every 30 s"]})]}),i.jsx("div",{className:"mt-3 flex flex-wrap gap-2",role:"group","aria-label":"Worktree state",children:yp.map(z=>i.jsxs(U,{type:"button",variant:"outline",size:"sm",className:lc,"aria-pressed":h===z.id,onClick:()=>f(z.id),children:[z.label," ",j.filter(K=>wp(K,z.id)).length]},z.id))}),A.length===0?i.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[i.jsx(xf,{className:"text-muted-foreground size-8","aria-hidden":"true"}),i.jsx("h2",{className:"text-lg font-semibold",children:"No worktrees match"}),L?i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(M=yp.find(z=>z.id===h))==null?void 0:M.empty," matches “",m,"”. Clear the search to see all"," ",j.filter(z=>wp(z,h)).length,"."]}),i.jsx(U,{type:"button",variant:"outline",onClick:()=>p(""),children:"Clear search"})]}):i.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(H=yp.find(z=>z.id===h))==null?void 0:H.empty," right now."]})]}):i.jsx(wt,{className:"mt-4 shrink-0 overflow-x-auto",children:i.jsxs(it,{containerAriaLabel:"Worktrees",className:"table-fixed",children:[i.jsx(ot,{children:i.jsxs(ye,{children:[i.jsx(J,{className:"w-[24%]",children:"Worktree"}),i.jsx(J,{className:"w-[24%]",children:"Threads"}),i.jsx(J,{className:"w-[12%]",children:"Landed"}),i.jsx(J,{className:"w-[18%]",children:"Cleanup"}),i.jsx(J,{className:"hidden w-[10%] md:table-cell",children:"Last commit"}),i.jsx(J,{className:"w-[12%] text-right",children:"Actions"})]})}),i.jsx(at,{children:A.map(z=>i.jsx(qB,{org:e,row:z,size:N(z),sizes:o!==null?"read":c?"failed":"measuring",can_write:n.can_write,sent:y[z.path],on_merge:()=>void C(z),on_remove:()=>void R(z),on_dismiss:K=>void E(K),on_clear_sent:()=>g(({[z.path]:K,...oe})=>oe)},z.path))})]})})]}):null,x]})}function WB(){return i.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading worktrees",children:Array.from({length:6},(e,t)=>i.jsx(Tt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function FB({refusal:e,read_at:t,on_retry:n}){const s=is();return e.reason==="view_outdated"?i.jsxs(me,{variant:"warning",className:"mt-6",children:[i.jsx(Nt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:Lr}),i.jsx(pe,{children:s})]}):i.jsxs(me,{variant:"destructive",className:"mt-6",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"Could not read worktrees"}),i.jsxs(pe,{children:[i.jsxs("p",{children:[e.message,t?` This list was read at ${Ys(new Date(t).toISOString())}.`:""]}),i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function cu({children:e,muted:t=!0}){return i.jsx("div",{className:we("truncate text-xs",t&&"text-muted-foreground"),title:e,children:e})}function qB({org:e,row:t,size:n,sizes:s,can_write:a,sent:r,on_merge:o,on_remove:l,on_dismiss:c,on_clear_sent:d}){const{href:h,Link:f}=lt(),m=e?`/org/${encodeURIComponent(e)}`:"",p=h(`${m}/threads`),y=h(`${m}/tasks`),g=zl[t.landed??"not_landed"],b=zb(t),v=t.write,x=(v==null?void 0:v.state)==="waiting"||(v==null?void 0:v.state)==="running",w=t.threads.find(P=>"thread"in t.merge&&P.thread===t.merge.thread)??t.threads[0],_=t.merge,S=!_.offered&&_.why===Ob,k=a&&t.landed===null&&!t.queue&&!S&&!Mb(t),j=n!==void 0?Hu(n):s==="measuring"?"Measuring size…":s==="failed"?"Size could not be read":null,N=b?{label:"Yours to decide",muted:!1,second:[j,t.cleanup_why[0]]}:t.archivable?{label:"The manager removes it",muted:!1,second:[j]}:{label:"Stays",muted:!0,second:[j,t.why[0]??null]},O=N.second.filter(Boolean).join(" · "),T=t.path.slice(0,t.path.length-t.name.length-1)||".";return i.jsxs(i.Fragment,{children:[i.jsxs(ye,{"data-testid":"worktrees-row",children:[i.jsxs(X,{children:[i.jsx("div",{className:"truncate font-medium",title:t.name,children:t.name}),i.jsx(cu,{children:t.branch??"Detached"}),T!==".sdlc-worktrees"?i.jsx(cu,{children:`in ${T}`}):null]}),i.jsx(X,{children:w?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"truncate",title:w.title??w.thread,children:w.title??w.thread}),i.jsx(cu,{children:`${VB(t,w)}${t.threads.length>1?` · ${t.threads.length-1} more`:""}`})]}):i.jsx("span",{className:"text-muted-foreground",children:"No thread"})}),i.jsx(X,{children:i.jsx(be,{variant:g.tone,children:g.label})}),i.jsxs(X,{children:[i.jsx("div",{className:we("truncate",N.muted&&"text-muted-foreground"),children:N.label}),O?i.jsx("div",{className:"hidden md:block",children:i.jsx(cu,{children:O})}):null]}),i.jsx(X,{className:"hidden md:table-cell",children:HB(t.idle_days)}),i.jsx(X,{className:"text-right",children:i.jsxs("div",{className:"flex justify-end gap-2",children:[x?i.jsx(U,{type:"button",variant:"outline",size:"sm",loading:!0,disabled:!0,children:(v==null?void 0:v.kind)==="merge"?v.state==="waiting"?"Waiting to join…":"Joining main…":(v==null?void 0:v.state)==="waiting"?"Waiting to remove…":"Removing…"}):t.queue?i.jsx(be,{variant:zl.queued.tone,children:`${zl.queued.label} · ${uA(t.queue.position)}`}):S?i.jsx(f,{href:y,"aria-label":`${t.name}: its thread waits on you, in Waiting on you`,children:i.jsx(be,{variant:zl.needs_you.tone,children:zl.needs_you.label})}):k?i.jsx(U,{type:"button",variant:"outline",size:"sm",title:_.offered?void 0:_.why,"aria-disabled":!_.offered||void 0,className:we(!_.offered&&"cursor-not-allowed opacity-50"),"aria-label":`Send ${t.name} to the main queue`,"aria-describedby":_.offered?void 0:`why-${t.name}`,onClick:_.offered?o:void 0,children:"Merge"}):null,b&&a&&!x?i.jsx(U,{type:"button",variant:"outline",size:"sm","aria-label":`Remove ${t.name}`,onClick:l,children:"Remove"}):null]})})]}),i.jsx(YB,{row:t,threads:p,tasks:y,merge_shown:k,sent:r,on_dismiss:c,on_clear_sent:d})]})}function YB({row:e,threads:t,tasks:n,merge_shown:s,sent:a,on_dismiss:r,on_clear_sent:o}){var y,g,b,v;const{Link:l}=lt(),c=(x="Open in Threads")=>i.jsx(l,{className:"text-primary text-sm hover:underline",href:t,children:x}),d=x=>i.jsx(U,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:x,children:"Dismiss"}),h=e.write,f=e.threads.find(x=>x.thread===("thread"in e.merge?e.merge.thread:void 0))??e.threads[0],m=(f==null?void 0:f.title)??"Its thread";let p=null;if(a)p=i.jsxs(me,{variant:"destructive",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:"It was not sent"}),i.jsxs(pe,{children:[i.jsx("p",{children:a}),d(o)]})]});else if((h==null?void 0:h.state)==="waiting")p=i.jsxs("p",{className:"text-muted-foreground text-sm",role:"status",children:["Another worktree's write runs first; ",e.name," ",h.kind==="merge"?"joins":"is removed"," next."]});else if((h==null?void 0:h.state)==="running")p=i.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:h.kind==="merge"?`Joining the main queue for ${e.name}. The queue checks its branch first; this can take a few minutes.`:`Removing ${e.name}. It is checked again first.`});else if((h==null?void 0:h.state)==="joined"){const x=((y=h.lands)==null?void 0:y.by)==="manager"?`the merge manager, ${h.lands.manager}, lands it`:"it lands it on its turn";p=i.jsxs(me,{variant:h.told?"success":"warning",role:"status",children:[i.jsx(je,{children:`${e.name} joined the main queue, ${uA(h.position)}`}),i.jsxs(pe,{children:[i.jsx("p",{children:h.told?`${m} was left a notice, and ${x}.`:"Its thread could not be told, so it does not know its turn is coming. Tell it from Threads; the join itself is unchanged."}),((g=e.queue)==null?void 0:g.position)===1&&e.queue.turn==="next"&&e.queue.passes_at?i.jsx("p",{children:`It is first in the main queue. Its thread was left a notice but not woken: continue it in its session, or the turn passes on at ${_p(e.queue.passes_at)}.`}):null,i.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>r({write:e.path})),!h.told||((b=e.queue)==null?void 0:b.position)===1?i.jsx("span",{className:"mt-2",children:c()}):null]})]})]})}else if(h&&(h.state==="refused"||h.state==="failed")){const x=h.kind==="merge"?`The main queue refused ${e.name}`:`${e.name} was not removed`;p=i.jsxs(me,{variant:"destructive",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:h.kind==="merge"&&h.state==="failed"?`${e.name} did not join`:x}),i.jsxs(pe,{children:[i.jsx("p",{children:`${Fl(h.message)}${h.kind==="merge"?" Nothing was queued.":" Nothing was deleted."}`}),i.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>r({write:e.path})),h.kind==="merge"?i.jsx("span",{className:"mt-2",children:c()}):null]})]})]})}else if(e.last_turn){const x=e.last_turn;p=i.jsxs(me,{variant:"warning",children:[i.jsx(rt,{className:"size-4","aria-hidden":"true"}),i.jsx(je,{children:`${e.name}'s turn ${x.outcome==="failed"?"failed":"passed on"} at ${_p(x.left_at)}`}),i.jsxs(pe,{children:[i.jsx("p",{children:`${Fl(x.reason)}. Continue the thread in its session; Merge sends it again once it is at rest.`}),i.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>r({turn:{execution:x.execution,left_at:x.left_at}})),i.jsx("span",{className:"mt-2",children:c()})]})]})]})}else((v=e.queue)==null?void 0:v.position)===1&&e.queue.turn==="next"&&e.queue.passes_at?p=i.jsxs("p",{className:"text-sm",role:"status",children:[`Its turn now: ${e.name} is first in the main queue. Continue its thread in its session, or the turn passes on at ${_p(e.queue.passes_at)}. `,c()]}):!e.merge.offered&&e.merge.why===Ob?p=i.jsxs("p",{className:"text-sm",id:`why-${e.name}`,children:["Its thread waits on you. Merge comes back once you answer it. ",i.jsx(l,{className:"text-primary hover:underline",href:n,children:"In Waiting on you"})]}):!e.merge.offered&&e.merge.successor&&!e.queue&&e.landed===null?p=i.jsx("p",{className:"text-sm",children:c("Open its successor in Threads")}):s&&!e.merge.offered?p=i.jsxs("p",{className:"text-sm",id:`why-${e.name}`,children:[`${Fl(e.merge.why)}. `,e.merge.thread&&!e.merge.why.startsWith("its thread is at work")?c():null]}):e.merge.offered&&e.merge.caveat&&(p=i.jsx("p",{className:"text-muted-foreground text-sm",children:`${Fl(e.merge.caveat)}.`}));return p?i.jsx(ye,{className:"hover:bg-transparent",children:i.jsx(X,{colSpan:6,className:"pt-0",children:p})}):null}const XB=["reason","since","store","repository","folder","home","member_path"];function tm(e,t){const n={status:e,message:typeof(t==null?void 0:t.error)=="string"?t.error:"The read failed; see the sdlc viewer terminal."};(t==null?void 0:t.retry)===!0&&(n.retry=!0),typeof(t==null?void 0:t.retry_after)=="number"&&(n.retry_after=t.retry_after),typeof(t==null?void 0:t.seedable)=="boolean"&&(n.seedable=t.seedable);for(const s of XB){const a=t==null?void 0:t[s];typeof a=="string"&&(n[s]=a)}return n}function Ki({base:e="",fetcher:t=fetch}){return async(n,s={})=>{const a=new URLSearchParams;for(const[c,d]of Object.entries(s))if(Array.isArray(d))for(const h of d)a.append(c,h);else d!==void 0&&d!==!1&&d!==""&&a.set(c,String(d));const r=a.size>0?`?${a.toString()}`:"";let o;try{o=await t(`${e}api/app/${n}${r}`,{cache:"no-store"})}catch{return{ok:!1,refusal:{status:0,message:"The viewer did not answer. Is sdlc viewer still running?"}}}const l=await o.json().catch(()=>null);return o.ok?{ok:!0,data:l}:{ok:!1,refusal:tm(o.status,l)}}}function hA(e={}){const t=Ki(e);return()=>t("issues/summary")}function KB(e={}){const t=Ki(e),n=nm(e),s=JB(e),a=o=>async()=>{const l=await t("access");return l.ok?{ok:!0,data:l.data[o]}:l},r=encodeURIComponent;return{tasks:{access:a("tasks"),configuration:()=>t("tasks/configuration"),listTasks:o=>t(`tasks/lists/${r(o)}/tasks`),task:o=>t(`tasks/tasks/${r(o)}`)},issues:{access:a("issues"),list:(o={})=>t("issues",o),issue:o=>t(`issues/${r(o)}`),issueSections:o=>t(`issues/${r(o)}/sections`),issueRelated:o=>t(`issues/${r(o)}/related`),summary:hA(e),openAnchor:o=>n("open-anchor",o),report:o=>n("issue-report",o),reportCollections:()=>s("issue-collections")},releases:{access:a("releases"),list:()=>t("releases"),release:o=>t(`releases/${r(o)}`),candidate:()=>t("releases/candidate")},organizations:{access:a("organizations"),list:()=>t("orgs")},projects:{access:a("projects"),list:()=>t("projects")},about:{about:()=>t("about")}}}function ZB(e={}){const t=Ki(e),{base:n="",fetcher:s=fetch}=e;return{timing:async()=>{let r;try{r=await s(`${n}api/queues`,{cache:"no-store"})}catch{return ya("The viewer did not answer. Is sdlc viewer still running?")}const o=await r.json().catch(()=>null);return r.ok?(o==null?void 0:o.state)!=="ready"?ya(typeof(o==null?void 0:o.error)=="string"&&o.error?o.error:"The work queues could not be read."):{ok:!0,data:QB(o)}:{ok:!1,refusal:tm(r.status,o)}},listQueues:()=>t("queues"),queue:r=>t(`queues/${encodeURIComponent(r)}`),members:async()=>({ok:!0,data:[]}),refresh_ms:15e3,settings_note:"Local queue settings are the engine's built-in policies. Turns change through promote.",thread_subjects:!0,description:"Where this checkout's threads take turns: landing on main, deploying to staging, publishing and accepting the graph.",read_scope:"this checkout only",subject_label:"Thread"}}const ya=e=>({ok:!1,refusal:{status:0,message:e}}),xn=e=>typeof e=="string"&&e?e:void 0;function QB(e){const t=Array.isArray(e==null?void 0:e.cards)?e.cards:[];return{caption:xn(e==null?void 0:e.caption)??"",queues:t.map(n=>{var h,f,m;const s=Array.isArray(n.captions)?n.captions.filter(p=>typeof p=="string"):[],a=Array.isArray(n.notes)?n.notes:[],r=n.key==="heavy",o=xn((h=a.find(p=>p.kind==="memory"))==null?void 0:h.text),l=xn((f=a.find(p=>p.kind==="suite"))==null?void 0:f.text),c=l?`${l.charAt(0).toUpperCase()}${l.slice(1)}`:s.find(p=>p.startsWith("The last deploy's staging suite still runs")),d=(Array.isArray(n.rows)?n.rows:[]).map(p=>{var w;const y=Array.isArray(p.parts)?p.parts:[],g=_=>{var S;return xn((S=y.find(k=>k.kind===_))==null?void 0:S.text)},b=(xn(p.detail)??"").split(" · "),v=xn(p.estimate)??(y.length||!xn(p.estimateTitle)?void 0:b.at(-1)),x=r&&!y.length&&b.length>=4&&/^\d+(\.\d+)? GB$/.test(b[2]);return{position:typeof p.position=="number"?p.position:0,execution:xn(p.execution),key:xn(p.key),title:xn(p.title)??"",turn:xn(p.turn)??"Waiting",elapsed:g("elapsed")??b[0]??"",estimate:v??(x?b.at(-1):void 0),basis:xn(p.estimateTitle),command:xn((w=y.find(_=>_.kind==="command"))==null?void 0:w.title)??g("command")??(x?b[1]:void 0),memory:g("memory")??(x?b[2]:void 0),reason:g("reason")}});return{key:xn(n.key)??"",name:xn(n.name)??"",clears:xn(n.clears),basis:r?void 0:s[1],memory:r?(o==null?void 0:o.replace(/^memory: /,""))??((m=s[0])==null?void 0:m.split(" · ").at(-1)):void 0,suite:c,error:xn(n.error)??(r&&n.summary==="Not available"?"no answer":void 0),rows:d}})}}function JB({base:e="",fetcher:t=fetch}){return async n=>{let s;try{s=await t(`${e}api/${n}`,{cache:"no-store"})}catch{return ya("The viewer did not answer. Is sdlc viewer still running?")}const a=await s.json().catch(()=>null);return s.ok?{ok:!0,data:a}:{ok:!1,refusal:tm(s.status,a)}}}async function e5({base:e="",fetcher:t=fetch}={}){try{return(await t(`${e}api/issue-report`,{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}function nm({base:e="",fetcher:t=fetch}){return async(n,s)=>{let a;try{a=await t(`${e}api/${n}`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})}catch{return ya("The viewer did not answer. Is sdlc viewer still running?")}const r=await a.json().catch(()=>null);return a.ok?{ok:!0,data:r}:{ok:!1,refusal:tm(a.status,r)}}}function t5(e={}){const t=Ki(e),n=nm(e);return{chart:()=>t("org"),change:s=>n("org-change",s)}}function n5(e={}){const t=Ki(e),n=l=>`tasks/tasks/${encodeURIComponent(l)}`,{base:s="",fetcher:a=fetch}=e;return{access:async()=>{const l=await t("access");return l.ok?{ok:!0,data:l.data.tasks}:l},availability:async()=>{const l=await t("tasks/configuration");if(!l.ok)return l.refusal.reason==="engine_missing"?{state:"off",refusal:l.refusal}:{state:"error",refusal:l.refusal};const c=l.data;if(c.state!=="active")return{state:"available"};const d=c.workspaces.find(f=>f.is_default)??c.workspaces[0],h=d==null?void 0:d.lists[0];return!d||!h?{state:"error"}:{state:"active",configuration:c,workspace:d,list:h}},listTasks:(l,c={})=>{var d,h,f;return c.state==="archived"?Promise.resolve(ya("This checkout keeps no archived tasks.")):c.assigned_to_me?Promise.resolve(ya("Assigned to you is a status group here.")):t(`tasks/lists/${encodeURIComponent(l)}/tasks`,{search:c.search,owner:c.owner===""?"none":c.owner,group:c.group,urgent:c.urgent?"true":void 0,over_estimate:c.over_estimate?"true":void 0,opened:(d=c.opened_groups)!=null&&d.length?c.opened_groups.join(","):void 0,closed:(h=c.closed_groups)!=null&&h.length?c.closed_groups.join(","):void 0,all:(f=c.all_groups)!=null&&f.length?c.all_groups.join(","):void 0})},members:()=>t("tasks/members"),waitingOnYou:()=>t("tasks/waiting-on-you"),task:l=>t(n(l)),taskSections:l=>t(`${n(l)}/sections`),taskRelated:l=>t(`${n(l)}/related`),hierarchyRevision:async()=>({ok:!0,data:0}),commands:{run:async()=>ya("The local viewer changes tasks only with Done."),complete:async l=>{const c="task"in l?{task:l.task}:{hold:l.hold};let d;try{d=await a(`${s}api/task-done`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})}catch{return ya("The viewer did not answer. Is sdlc viewer still running?")}if(d.ok)return await Xi(d),{ok:!0,data:null};const h=await d.text().catch(()=>"");return{ok:!1,refusal:{status:d.status,message:h||`It was not recorded (HTTP ${d.status}).`}}}}}}function s5(e={}){const t=Ki(e),n=nm(e),s=encodeURIComponent,a=r=>r!=null&&r.fresh?{fresh:1}:{};return{access:async()=>{const r=await t("access");return r.ok?{ok:!0,data:r.data.releases}:r},list:(r={})=>t("releases",a(r)),release:(r,o)=>t(`releases/${s(r)}`,a(o)),candidate:r=>t("releases/candidate",a(r)),candidateBatch:r=>t("releases/candidate/batch",a(r)),related:(r,o)=>t(`releases/${s(r)}/related`,a(o)),plannedRelease:(r,o)=>t(`releases/planned/${s(r)}`,a(o)),roadmap:r=>t("releases/roadmap",{...a(r),...r!=null&&r.mine?{mine:1}:{}}),roadmapMoved:r=>t("releases/roadmap/moved",a(r)),roadmapSeen:r=>n("roadmap/seen",{at:r}),decideAcceptance:r=>n("releases/acceptance",r),editNote:r=>n("releases/note-edit",r)}}function i5(e={}){const t=Ki(e),n=nm(e);return{list:()=>t("worktrees"),sizes:()=>t("worktree-sizes"),merge:s=>n("worktree-merge",{path:s}),remove:s=>n("worktree-remove",{path:s}),dismiss:s=>n("worktree-dismiss",s)}}function a5(e={}){const t=Ki(e);return{report:n=>t("blockers",n!=null&&n.fresh?{fresh:1}:{})}}function r5(e={}){const t=Ki(e);return{overview:()=>t("workspaces")}}class fA{}class Ta extends fA{constructor(t,n,s){super(),this.viewId=t,this.groupId=n,this.panelId=s}}class gc extends fA{constructor(t,n){super(),this.viewId=t,this.paneId=n}}class vi{constructor(){}static getInstance(){return vi.INSTANCE}hasData(t){return t&&t===this.proto}clearData(t){this.hasData(t)&&(this.proto=void 0,this.data=void 0)}getData(t){if(this.hasData(t))return this.data}setData(t,n){n&&(this.data=t,this.proto=n)}}vi.INSTANCE=new vi;function En(){const e=vi.getInstance();if(e.hasData(Ta.prototype))return e.getData(Ta.prototype)[0]}function Ml(){const e=vi.getInstance();if(e.hasData(gc.prototype))return e.getData(gc.prototype)[0]}var vr;(function(e){e.any=(...t)=>n=>{const s=t.map(a=>a(n));return{dispose:()=>{s.forEach(a=>{a.dispose()})}}}})(vr||(vr={}));class $b{constructor(){this._defaultPrevented=!1}get defaultPrevented(){return this._defaultPrevented}preventDefault(){this._defaultPrevented=!0}}class mA{constructor(){this._isAccepted=!1}get isAccepted(){return this._isAccepted}accept(){this._isAccepted=!0}}class o5{constructor(){this.events=new Map}get size(){return this.events.size}add(t,n){this.events.set(t,n)}delete(t){this.events.delete(t)}clear(){this.events.clear()}}class Lh{static create(){var t;return new Lh((t=new Error().stack)!==null&&t!==void 0?t:"")}constructor(t){this.value=t}print(){console.warn("dockview: stacktrace",this.value)}}class l5{constructor(t,n){this.callback=t,this.stacktrace=n}}class te{static setLeakageMonitorEnabled(t){t!==te.ENABLE_TRACKING&&te.MEMORY_LEAK_WATCHER.clear(),te.ENABLE_TRACKING=t}get value(){return this._last}constructor(t){this.options=t,this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=t=>{var n;!((n=this.options)===null||n===void 0)&&n.replay&&this._last!==void 0&&t(this._last);const s=new l5(t,te.ENABLE_TRACKING?Lh.create():void 0);return this._listeners.push(s),{dispose:()=>{const a=this._listeners.indexOf(s);a>-1&&this._listeners.splice(a,1)}}},te.ENABLE_TRACKING&&te.MEMORY_LEAK_WATCHER.add(this._event,Lh.create())),this._event}fire(t){var n;!((n=this.options)===null||n===void 0)&&n.replay&&(this._last=t);for(const s of this._listeners)s.callback(t)}dispose(){this._disposed||(this._disposed=!0,this._listeners.length>0&&(te.ENABLE_TRACKING&&queueMicrotask(()=>{var t;for(const n of this._listeners)console.warn("dockview: stacktrace",(t=n.stacktrace)===null||t===void 0?void 0:t.print())}),this._listeners=[]),te.ENABLE_TRACKING&&this._event&&te.MEMORY_LEAK_WATCHER.delete(this._event))}}te.ENABLE_TRACKING=!1;te.MEMORY_LEAK_WATCHER=new o5;function Fe(e,t,n,s){return e.addEventListener(t,n,s),{dispose:()=>{e.removeEventListener(t,n,s)}}}class q_{constructor(){this._onFired=new te,this._currentFireCount=0,this._queued=!1,this.onEvent=t=>{const n=this._currentFireCount;return this._onFired.event(()=>{this._currentFireCount>n&&t()})}}fire(){this._currentFireCount++,!this._queued&&(this._queued=!0,queueMicrotask(()=>{this._queued=!1,this._onFired.fire()}))}dispose(){this._onFired.dispose()}}var Zt;(function(e){e.NONE={dispose:()=>{}};function t(n){return{dispose:()=>{n()}}}e.from=t})(Zt||(Zt={}));class Ge{get isDisposed(){return this._isDisposed}constructor(...t){this._isDisposed=!1,this._disposables=t}addDisposables(...t){t.forEach(n=>this._disposables.push(n))}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposables.forEach(t=>t.dispose()),this._disposables=[])}}class On{constructor(){this._disposable=Zt.NONE}set value(t){this._disposable&&this._disposable.dispose(),this._disposable=t}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=Zt.NONE)}}class c5 extends Ge{constructor(t){super(),this._onDidChange=new te,this.onDidChange=this._onDidChange.event,this._value=null,this.addDisposables(this._onDidChange,sm(t,n=>{const s=n.target.scrollWidth>n.target.clientWidth,a=n.target.scrollHeight>n.target.clientHeight;this._value={hasScrollX:s,hasScrollY:a},this._onDidChange.fire(this._value)}))}}function sm(e,t){const n=new ResizeObserver(s=>{requestAnimationFrame(()=>{const a=s[0];t(a)})});return n.observe(e),{dispose:()=>{n.unobserve(e),n.disconnect()}}}const qc=(e,...t)=>{for(const n of t)e.classList.contains(n)&&e.classList.remove(n)},im=(e,...t)=>{for(const n of t)e.classList.contains(n)||e.classList.add(n)},Pe=(e,t,n)=>{const s=e.classList.contains(t);n&&!s&&e.classList.add(t),!n&&s&&e.classList.remove(t)};function rx(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function pA(e){return new d5(e)}class d5 extends Ge{constructor(t){super(),this._onDidFocus=new te,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new te,this.onDidBlur=this._onDidBlur.event,this.addDisposables(this._onDidFocus,this._onDidBlur);let n=rx(document.activeElement,t),s=!1;const a=()=>{s=!1,n||(n=!0,this._onDidFocus.fire())},r=()=>{n&&(s=!0,window.setTimeout(()=>{s&&(s=!1,n=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{rx(document.activeElement,t)!==n&&(n?r():a())},this.addDisposables(Fe(t,"focus",a,!0)),this.addDisposables(Fe(t,"blur",r,!0))}refreshState(){this._refreshStateHandler()}}const gA="dv-quasiPreventDefault";function u5(e){e[gA]=!0}function Y_(e){return e[gA]}function h5(e,t){const n=Array.from(t);for(const s of n){if(s.href){const r=e.createElement("link");r.href=s.href,r.type=s.type,r.rel="stylesheet",e.head.appendChild(r)}let a=[];try{s.cssRules&&(a=Array.from(s.cssRules).map(r=>r.cssText))}catch{}for(const r of a){const o=e.createElement("style");o.appendChild(e.createTextNode(r)),e.head.appendChild(o)}}}function ox(e){const{left:t,top:n,width:s,height:a}=e.getBoundingClientRect();return{left:t+window.scrollX,top:n+window.scrollY,width:s,height:a}}function f5(e){let t=e;for(;t!=null&&t.parentNode;){if(t.parentNode===document)return!0;t.parentNode instanceof DocumentFragment?t=t.parentNode.host:t=t.parentNode}return!1}function m5(e,t){e.setAttribute("data-testid",t)}function p5(e){const t=[];function n(s){if(s.nodeType===Node.ELEMENT_NODE){e.includes(s.tagName)&&t.push(s),s.shadowRoot&&n(s.shadowRoot);for(const a of s.children)n(a)}}return n(document.documentElement),t}function Ph(e=document){const t=p5(["IFRAME","WEBVIEW"]),n=new WeakMap;for(const s of t)n.set(s,s.style.pointerEvents),s.style.pointerEvents="none";return{release:()=>{var s;for(const a of t)a.style.pointerEvents=(s=n.get(a))!==null&&s!==void 0?s:"auto";t.splice(0,t.length)}}}function g5(e){function t(a){const r=[];for(let o=0;o<a.classList.length;o++)r.push(a.classList.item(o));return r}let n,s=e;for(;s!==null&&(n=t(s).find(a=>a.startsWith("dockview-theme-")),typeof n!="string");)s=s.parentElement;return n}class am{constructor(t){this.element=t,this._classNames=[]}setClassNames(t){for(const n of this._classNames)Pe(this.element,n,!1);this._classNames=t.split(" ").filter(n=>n.trim().length>0);for(const n of this._classNames)Pe(this.element,n,!0)}}const xA=100;function x5(e,t){const n=ox(e),s=ox(t);return!(n.left<s.left||n.left+n.width>s.left+s.width)}function v5(e){const t=new te;let n=e.screenX,s=e.screenY,a;const r=()=>{if(e.closed)return;const o=e.screenX,l=e.screenY;(o!==n||l!==s)&&(clearTimeout(a),a=setTimeout(()=>{t.fire()},xA),n=o,s=l),requestAnimationFrame(r)};return r(),t}function b5(e,t){let n;return new Ge(Fe(e,"resize",()=>{clearTimeout(n),n=setTimeout(()=>{t()},xA)}))}function y5(e,t,n={buffer:10}){const s=n.buffer,a=e.getBoundingClientRect(),r=t.getBoundingClientRect();let o=0,l=0;const c=a.left-r.left,d=a.top-r.top,h=a.bottom-r.bottom,f=a.right-r.right;c<s?o=s-c:f>s&&(o=-s-f),d<s?l=s-d:h>s&&(l=-h-s),(o!==0||l!==0)&&(e.style.transform=`translate(${o}px, ${l}px)`)}function w5(e){let t=e;for(;t&&(t.style.zIndex==="auto"||t.style.zIndex==="");)t=t.parentElement;return t}function Pi(e){if(e.length===0)throw new Error("Invalid tail call");return[e.slice(0,e.length-1),e[e.length-1]]}function vA(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function jp(e,t){const n=e.indexOf(t);n>-1&&(e.splice(n,1),e.unshift(t))}function du(e,t){const n=e.indexOf(t);n>-1&&(e.splice(n,1),e.push(t))}function _5(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(t(s))return n}return-1}function Np(e,t){const n=e.findIndex(s=>s===t);return n>-1?(e.splice(n,1),!0):!1}const Rt=(e,t,n)=>t>n?t:Math.min(n,Math.max(e,t)),Lb=()=>{let e=1;return{next:()=>(e++).toString()}},Ps=(e,t)=>{const n=[];if(typeof t!="number"&&(t=e,e=0),e<=t)for(let s=e;s<t;s++)n.push(s);else for(let s=e;s>t;s--)n.push(s);return n};class j5{set size(t){this._size=t}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return typeof this._cachedVisibleSize>"u"}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(t){this.container.style.pointerEvents=t?"":"none"}constructor(t,n,s,a){this.container=t,this.view=n,this.disposable=a,this._cachedVisibleSize=void 0,typeof s=="number"?(this._size=s,this._cachedVisibleSize=void 0,t.classList.add("visible")):(this._size=0,this._cachedVisibleSize=s.cachedVisibleSize)}setVisible(t,n){var s;t!==this.visible&&(t?(this.size=Rt((s=this._cachedVisibleSize)!==null&&s!==void 0?s:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof n=="number"?n:this.size,this.size=0),this.container.classList.toggle("visible",t),this.view.setVisible&&this.view.setVisible(t))}dispose(){return this.disposable.dispose(),this.view}}var Me;(function(e){e.HORIZONTAL="HORIZONTAL",e.VERTICAL="VERTICAL"})(Me||(Me={}));var ys;(function(e){e[e.MAXIMUM=0]="MAXIMUM",e[e.MINIMUM=1]="MINIMUM",e[e.DISABLED=2]="DISABLED",e[e.ENABLED=3]="ENABLED"})(ys||(ys={}));var sn;(function(e){e.Low="low",e.High="high",e.Normal="normal"})(sn||(sn={}));var Es;(function(e){e.Distribute={type:"distribute"};function t(s){return{type:"split",index:s}}e.Split=t;function n(s){return{type:"invisible",cachedVisibleSize:s}}e.Invisible=n})(Es||(Es={}));class Yc{get contentSize(){return this._contentSize}get size(){return this._size}set size(t){this._size=t}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(t){this._orthogonalSize=t}get length(){return this.viewItems.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(t){this._orientation=t;const n=this.size;this.size=this.orthogonalSize,this.orthogonalSize=n,qc(this.element,"dv-horizontal","dv-vertical"),this.element.classList.add(this.orientation==Me.HORIZONTAL?"dv-horizontal":"dv-vertical")}get minimumSize(){return this.viewItems.reduce((t,n)=>t+n.minimumSize,0)}get maximumSize(){return this.length===0?Number.POSITIVE_INFINITY:this.viewItems.reduce((t,n)=>t+n.maximumSize,0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(t){this._startSnappingEnabled!==t&&(this._startSnappingEnabled=t,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(t){this._endSnappingEnabled!==t&&(this._endSnappingEnabled=t,this.updateSashEnablement())}get disabled(){return this._disabled}set disabled(t){this._disabled=t,Pe(this.element,"dv-splitview-disabled",t)}get margin(){return this._margin}set margin(t){this._margin=t,Pe(this.element,"dv-splitview-has-margin",t!==0)}constructor(t,n){var s,a;this.container=t,this.viewItems=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this._contentSize=0,this._proportions=void 0,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this._disabled=!1,this._margin=0,this._onDidSashEnd=new te,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new te,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new te,this.onDidRemoveView=this._onDidRemoveView.event,this.resize=(r,o,l=this.viewItems.map(y=>y.size),c,d,h=Number.NEGATIVE_INFINITY,f=Number.POSITIVE_INFINITY,m,p)=>{if(r<0||r>this.viewItems.length)return 0;const y=Ps(r,-1),g=Ps(r+1,this.viewItems.length);if(d)for(const D of d)jp(y,D),jp(g,D);if(c)for(const D of c)du(y,D),du(g,D);const b=y.map(D=>this.viewItems[D]),v=y.map(D=>l[D]),x=g.map(D=>this.viewItems[D]),w=g.map(D=>l[D]),_=y.reduce((D,C)=>D+this.viewItems[C].minimumSize-l[C],0),S=y.reduce((D,C)=>D+this.viewItems[C].maximumSize-l[C],0),k=g.length===0?Number.POSITIVE_INFINITY:g.reduce((D,C)=>D+l[C]-this.viewItems[C].minimumSize,0),j=g.length===0?Number.NEGATIVE_INFINITY:g.reduce((D,C)=>D+l[C]-this.viewItems[C].maximumSize,0),N=Math.max(_,j),O=Math.min(k,S);let T=!1;if(m){const D=this.viewItems[m.index],C=o>=m.limitDelta;T=C!==D.visible,D.setVisible(C,m.size)}if(!T&&p){const D=this.viewItems[p.index],C=o<p.limitDelta;T=C!==D.visible,D.setVisible(C,p.size)}if(T)return this.resize(r,o,l,c,d,h,f);const P=Rt(o,N,O);let L=0,G=P;for(let D=0;D<b.length;D++){const C=b[D],R=Rt(v[D]+G,C.minimumSize,C.maximumSize),E=R-v[D];L+=E,G-=E,C.size=R}let A=L;for(let D=0;D<x.length;D++){const C=x[D],R=Rt(w[D]-A,C.minimumSize,C.maximumSize),E=R-w[D];A+=E,C.size=R}return o},this._orientation=(s=n.orientation)!==null&&s!==void 0?s:Me.VERTICAL,this.element=this.createContainer(),this.margin=(a=n.margin)!==null&&a!==void 0?a:0,this.proportionalLayout=n.proportionalLayout===void 0?!0:!!n.proportionalLayout,this.viewContainer=this.createViewContainer(),this.sashContainer=this.createSashContainer(),this.element.appendChild(this.sashContainer),this.element.appendChild(this.viewContainer),this.container.appendChild(this.element),this.style(n.styles),n.descriptor&&(this._size=n.descriptor.size,n.descriptor.views.forEach((r,o)=>{const l=r.visible===void 0||r.visible?r.size:{type:"invisible",cachedVisibleSize:r.size},c=r.view;this.addView(c,l,o,!0)}),this._contentSize=this.viewItems.reduce((r,o)=>r+o.size,0),this.saveProportions())}style(t){(t==null?void 0:t.separatorBorder)==="transparent"?(qc(this.element,"dv-separator-border"),this.element.style.removeProperty("--dv-separator-border")):(im(this.element,"dv-separator-border"),t!=null&&t.separatorBorder&&this.element.style.setProperty("--dv-separator-border",t.separatorBorder))}isViewVisible(t){if(t<0||t>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[t].visible}setViewVisible(t,n){if(t<0||t>=this.viewItems.length)throw new Error("Index out of bounds");const s=this.viewItems[t];s.setVisible(n,s.size),this.distributeEmptySpace(t),this.layoutViews(),this.saveProportions()}getViewSize(t){return t<0||t>=this.viewItems.length?-1:this.viewItems[t].size}resizeView(t,n){if(t<0||t>=this.viewItems.length)return;const s=Ps(this.viewItems.length).filter(l=>l!==t),a=[...s.filter(l=>this.viewItems[l].priority===sn.Low),t],r=s.filter(l=>this.viewItems[l].priority===sn.High),o=this.viewItems[t];n=Math.round(n),n=Rt(n,o.minimumSize,Math.min(o.maximumSize,this._size)),o.size=n,this.relayout(a,r)}getViews(){return this.viewItems.map(t=>t.view)}onDidChange(t,n){const s=this.viewItems.indexOf(t);if(s<0||s>=this.viewItems.length)return;n=typeof n=="number"?n:t.size,n=Rt(n,t.minimumSize,t.maximumSize),t.size=n;const a=Ps(this.viewItems.length).filter(l=>l!==s),r=[...a.filter(l=>this.viewItems[l].priority===sn.Low),s],o=a.filter(l=>this.viewItems[l].priority===sn.High);this.relayout([...r,s],o)}addView(t,n={type:"distribute"},s=this.viewItems.length,a){const r=document.createElement("div");r.className="dv-view",r.appendChild(t.element);let o;typeof n=="number"?o=n:n.type==="split"?o=this.getViewSize(n.index)/2:n.type==="invisible"?o={cachedVisibleSize:n.cachedVisibleSize}:o=t.minimumSize;const l=t.onDidChange(d=>this.onDidChange(c,d.size)),c=new j5(r,t,o,{dispose:()=>{l.dispose(),this.viewContainer.removeChild(r)}});if(s===this.viewItems.length?this.viewContainer.appendChild(r):this.viewContainer.insertBefore(r,this.viewContainer.children.item(s)),this.viewItems.splice(s,0,c),this.viewItems.length>1){const d=document.createElement("div");d.className="dv-sash";const h=m=>{for(const D of this.viewItems)D.enabled=!1;const p=Ph(),y=this._orientation===Me.HORIZONTAL?m.clientX:m.clientY,g=_5(this.sashes,D=>D.container===d),b=this.viewItems.map(D=>D.size);let v,x;const w=Ps(g,-1),_=Ps(g+1,this.viewItems.length),S=w.reduce((D,C)=>D+(this.viewItems[C].minimumSize-b[C]),0),k=w.reduce((D,C)=>D+(this.viewItems[C].viewMaximumSize-b[C]),0),j=_.length===0?Number.POSITIVE_INFINITY:_.reduce((D,C)=>D+(b[C]-this.viewItems[C].minimumSize),0),N=_.length===0?Number.NEGATIVE_INFINITY:_.reduce((D,C)=>D+(b[C]-this.viewItems[C].viewMaximumSize),0),O=Math.max(S,N),T=Math.min(j,k),P=this.findFirstSnapIndex(w),L=this.findFirstSnapIndex(_);if(typeof P=="number"){const D=this.viewItems[P],C=Math.floor(D.viewMinimumSize/2);v={index:P,limitDelta:D.visible?O-C:O+C,size:D.size}}if(typeof L=="number"){const D=this.viewItems[L],C=Math.floor(D.viewMinimumSize/2);x={index:L,limitDelta:D.visible?T+C:T-C,size:D.size}}const G=D=>{const R=(this._orientation===Me.HORIZONTAL?D.clientX:D.clientY)-y;this.resize(g,R,b,void 0,void 0,O,T,v,x),this.distributeEmptySpace(),this.layoutViews()},A=()=>{for(const D of this.viewItems)D.enabled=!0;p.release(),this.saveProportions(),document.removeEventListener("pointermove",G),document.removeEventListener("pointerup",A),document.removeEventListener("pointercancel",A),this._onDidSashEnd.fire(void 0)};document.addEventListener("pointermove",G),document.addEventListener("pointerup",A),document.addEventListener("pointercancel",A)};d.addEventListener("pointerdown",h);const f={container:d,disposable:()=>{d.removeEventListener("pointerdown",h),this.sashContainer.removeChild(d)}};this.sashContainer.appendChild(d),this.sashes.push(f)}a||this.relayout([s]),!a&&typeof n!="number"&&n.type==="distribute"&&this.distributeViewSizes(),this._onDidAddView.fire(t)}distributeViewSizes(){const t=[];let n=0;for(const l of this.viewItems)l.maximumSize-l.minimumSize>0&&(t.push(l),n+=l.size);const s=Math.floor(n/t.length);for(const l of t)l.size=Rt(s,l.minimumSize,l.maximumSize);const a=Ps(this.viewItems.length),r=a.filter(l=>this.viewItems[l].priority===sn.Low),o=a.filter(l=>this.viewItems[l].priority===sn.High);this.relayout(r,o)}removeView(t,n,s=!1){const a=this.viewItems.splice(t,1)[0];if(a.dispose(),this.viewItems.length>=1){const r=Math.max(t-1,0);this.sashes.splice(r,1)[0].disposable()}return s||this.relayout(),n&&n.type==="distribute"&&this.distributeViewSizes(),this._onDidRemoveView.fire(a.view),a.view}getViewCachedVisibleSize(t){if(t<0||t>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[t].cachedVisibleSize}moveView(t,n){const s=this.getViewCachedVisibleSize(t),a=typeof s>"u"?this.getViewSize(t):Es.Invisible(s),r=this.removeView(t,void 0,!0);this.addView(r,a,n)}layout(t,n){const s=Math.max(this.size,this._contentSize);if(this.size=t,this.orthogonalSize=n,this.proportions){let a=0;for(let r=0;r<this.viewItems.length;r++){const o=this.viewItems[r],l=this.proportions[r];typeof l=="number"?a+=l:t-=o.size}for(let r=0;r<this.viewItems.length;r++){const o=this.viewItems[r],l=this.proportions[r];typeof l=="number"&&a>0&&(o.size=Rt(Math.round(l*t/a),o.minimumSize,o.maximumSize))}}else{const a=Ps(this.viewItems.length),r=a.filter(l=>this.viewItems[l].priority===sn.Low),o=a.filter(l=>this.viewItems[l].priority===sn.High);this.resize(this.viewItems.length-1,t-s,void 0,r,o)}this.distributeEmptySpace(),this.layoutViews()}relayout(t,n){const s=this.viewItems.reduce((a,r)=>a+r.size,0);this.resize(this.viewItems.length-1,this._size-s,void 0,t,n),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(t){const n=this.viewItems.reduce((l,c)=>l+c.size,0);let s=this.size-n;const a=Ps(this.viewItems.length-1,-1),r=a.filter(l=>this.viewItems[l].priority===sn.Low),o=a.filter(l=>this.viewItems[l].priority===sn.High);for(const l of o)jp(a,l);for(const l of r)du(a,l);typeof t=="number"&&du(a,t);for(let l=0;s!==0&&l<a.length;l++){const c=this.viewItems[a[l]],d=Rt(c.size+s,c.minimumSize,c.maximumSize),h=d-c.size;s-=h,c.size=d}}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this._proportions=this.viewItems.map(t=>t.visible?t.size/this._contentSize:void 0))}layoutViews(){if(this._contentSize=this.viewItems.reduce((c,d)=>c+d.size,0),this.updateSashEnablement(),this.viewItems.length===0)return;const t=this.viewItems.filter(c=>c.visible),n=Math.max(0,t.length-1),s=this.margin*n/Math.max(1,t.length);let a=0;const r=[],o=4,l=this.viewItems.reduce((c,d,h)=>{const f=d.visible?1:0;return h===0?c.push(f):c.push(c[h-1]+f),c},[]);this.viewItems.forEach((c,d)=>{a+=this.viewItems[d].size,r.push(a);const h=c.visible?c.size-s:0,f=Math.max(0,l[d]-1),m=d===0||f===0?0:r[d-1]+f/n*s;if(d<this.viewItems.length-1){const p=c.visible?m+h-o/2+this.margin/2:m;this._orientation===Me.HORIZONTAL&&(this.sashes[d].container.style.left=`${p}px`,this.sashes[d].container.style.top="0px"),this._orientation===Me.VERTICAL&&(this.sashes[d].container.style.left="0px",this.sashes[d].container.style.top=`${p}px`)}this._orientation===Me.HORIZONTAL&&(c.container.style.width=`${h}px`,c.container.style.left=`${m}px`,c.container.style.top="",c.container.style.height=""),this._orientation===Me.VERTICAL&&(c.container.style.height=`${h}px`,c.container.style.top=`${m}px`,c.container.style.width="",c.container.style.left=""),c.view.layout(c.size-s,this._orthogonalSize)})}findFirstSnapIndex(t){for(const n of t){const s=this.viewItems[n];if(s.visible&&s.snap)return n}for(const n of t){const s=this.viewItems[n];if(s.visible&&s.maximumSize-s.minimumSize>0)return;if(!s.visible&&s.snap)return n}}updateSashEnablement(){let t=!1;const n=this.viewItems.map(c=>t=c.size-c.minimumSize>0||t);t=!1;const s=this.viewItems.map(c=>t=c.maximumSize-c.size>0||t),a=[...this.viewItems].reverse();t=!1;const r=a.map(c=>t=c.size-c.minimumSize>0||t).reverse();t=!1;const o=a.map(c=>t=c.maximumSize-c.size>0||t).reverse();let l=0;for(let c=0;c<this.sashes.length;c++){const d=this.sashes[c],h=this.viewItems[c];l+=h.size;const f=!(n[c]&&o[c+1]),m=!(s[c]&&r[c+1]);if(f&&m){const p=Ps(c,-1),y=Ps(c+1,this.viewItems.length),g=this.findFirstSnapIndex(p),b=this.findFirstSnapIndex(y),v=typeof g=="number"&&!this.viewItems[g].visible,x=typeof b=="number"&&!this.viewItems[b].visible;v&&r[c]&&(l>0||this.startSnappingEnabled)?this.updateSash(d,ys.MINIMUM):x&&n[c]&&(l<this._contentSize||this.endSnappingEnabled)?this.updateSash(d,ys.MAXIMUM):this.updateSash(d,ys.DISABLED)}else f&&!m?this.updateSash(d,ys.MINIMUM):!f&&m?this.updateSash(d,ys.MAXIMUM):this.updateSash(d,ys.ENABLED)}}updateSash(t,n){Pe(t.container,"dv-disabled",n===ys.DISABLED),Pe(t.container,"dv-enabled",n===ys.ENABLED),Pe(t.container,"dv-maximum",n===ys.MAXIMUM),Pe(t.container,"dv-minimum",n===ys.MINIMUM)}createViewContainer(){const t=document.createElement("div");return t.className="dv-view-container",t}createSashContainer(){const t=document.createElement("div");return t.className="dv-sash-container",t}createContainer(){const t=document.createElement("div"),n=this._orientation===Me.HORIZONTAL?"dv-horizontal":"dv-vertical";return t.className=`dv-split-view-container ${n}`,t}dispose(){this._onDidSashEnd.dispose(),this._onDidAddView.dispose(),this._onDidRemoveView.dispose();for(let t=0;t<this.element.children.length;t++)if(this.element.children.item(t)===this.element){this.element.removeChild(this.element);break}for(const t of this.viewItems)t.dispose();this.element.remove()}}const lx=Object.keys({orientation:void 0,descriptor:void 0,proportionalLayout:void 0,styles:void 0,margin:void 0,disableAutoResizing:void 0,className:void 0});class X_ extends Ge{get onDidAddView(){return this.splitview.onDidAddView}get onDidRemoveView(){return this.splitview.onDidRemoveView}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get orientation(){return this.splitview.orientation}get size(){return this.splitview.size}get orthogonalSize(){return this.splitview.orthogonalSize}constructor(t,n){var s;super(),this.paneItems=[],this.skipAnimation=!1,this._onDidChange=new te,this.onDidChange=this._onDidChange.event,this._orientation=(s=n.orientation)!==null&&s!==void 0?s:Me.VERTICAL,this.element=document.createElement("div"),this.element.className="dv-pane-container",t.appendChild(this.element),this.splitview=new Yc(this.element,{orientation:this._orientation,proportionalLayout:!1,descriptor:n.descriptor}),this.getPanes().forEach(a=>{const r=new Ge(a.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),o={pane:a,disposable:{dispose:()=>{r.dispose()}}};this.paneItems.push(o),a.orthogonalSize=this.splitview.orthogonalSize}),this.addDisposables(this._onDidChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire(void 0)}),this.splitview.onDidAddView(()=>{this._onDidChange.fire()}),this.splitview.onDidRemoveView(()=>{this._onDidChange.fire()}))}setViewVisible(t,n){this.splitview.setViewVisible(t,n)}addPane(t,n,s=this.splitview.length,a=!1){const r=t.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}),o={pane:t,disposable:{dispose:()=>{r.dispose()}}};this.paneItems.splice(s,0,o),t.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(t,n,s,a)}getViewSize(t){return this.splitview.getViewSize(t)}getPanes(){return this.splitview.getViews()}removePane(t,n={skipDispose:!1}){const s=this.paneItems.splice(t,1)[0];return this.splitview.removeView(t),n.skipDispose||(s.disposable.dispose(),s.pane.dispose()),s}moveView(t,n){if(t===n)return;const s=this.removePane(t,{skipDispose:!0});this.skipAnimation=!0;try{this.addPane(s.pane,s.pane.size,n,!1)}finally{this.skipAnimation=!1}}layout(t,n){this.splitview.layout(t,n)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),im(this.element,"dv-animated"),this.animationTimer=setTimeout(()=>{this.animationTimer=void 0,qc(this.element,"dv-animated")},200))}dispose(){super.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach(t=>{t.disposable.dispose(),t.pane.dispose()}),this.paneItems=[],this.splitview.dispose(),this.element.remove()}}class dn{get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===Me.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===Me.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===Me.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===Me.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===Me.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===Me.HORIZONTAL?this.size:this.orthogonalSize}constructor(t,n,s,a=0){this.view=t,this.orientation=n,this._onDidChange=new te,this.onDidChange=this._onDidChange.event,this._orthogonalSize=s,this._size=a,this._disposable=this.view.onDidChange(r=>{r?this._onDidChange.fire({size:this.orientation===Me.VERTICAL?r.width:r.height,orthogonalSize:this.orientation===Me.VERTICAL?r.height:r.width}):this._onDidChange.fire({})})}setVisible(t){this.view.setVisible&&this.view.setVisible(t)}layout(t,n){this._size=t,this._orthogonalSize=n,this.view.layout(this.width,this.height)}dispose(){this._onDidChange.dispose(),this._disposable.dispose()}}class Bt extends Ge{get width(){return this.orientation===Me.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===Me.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((t,n)=>this.splitview.isViewVisible(n)?t.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((t,n)=>this.splitview.isViewVisible(n)?t.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===Me.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===Me.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===Me.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===Me.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(this.children.length===0)return sn.Normal;const t=this.children.map(n=>typeof n.priority>"u"?sn.Normal:n.priority);return t.some(n=>n===sn.High)?sn.High:t.some(n=>n===sn.Low)?sn.Low:sn.Normal}get disabled(){return this.splitview.disabled}set disabled(t){this.splitview.disabled=t}get margin(){return this.splitview.margin}set margin(t){this.splitview.margin=t,this.children.forEach(n=>{n instanceof Bt&&(n.margin=t)})}constructor(t,n,s,a,r,o,l,c){if(super(),this.orientation=t,this.proportionalLayout=n,this.styles=s,this._childrenDisposable=Zt.NONE,this.children=[],this._onDidChange=new te,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new te,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._orthogonalSize=r,this._size=a,this.element=document.createElement("div"),this.element.className="dv-branch-node",!c)this.splitview=new Yc(this.element,{orientation:this.orientation,proportionalLayout:n,styles:s,margin:l}),this.splitview.layout(this.size,this.orthogonalSize);else{const d={views:c.map(h=>({view:h.node,size:h.node.size,visible:h.node instanceof dn&&h.visible!==void 0?h.visible:!0})),size:this.orthogonalSize};this.children=c.map(h=>h.node),this.splitview=new Yc(this.element,{orientation:this.orientation,descriptor:d,proportionalLayout:n,styles:s,margin:l})}this.disabled=o,this.addDisposables(this._onDidChange,this._onDidVisibilityChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire({})})),this.setupChildrenEvents()}setVisible(t){}isChildVisible(t){if(t<0||t>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(t)}setChildVisible(t,n){if(t<0||t>=this.children.length)throw new Error("Invalid index");if(this.splitview.isViewVisible(t)===n)return;const s=this.splitview.contentSize===0;this.splitview.setViewVisible(t,n);const a=this.splitview.contentSize===0;(n&&s||!n&&a)&&this._onDidVisibilityChange.fire({visible:n})}moveChild(t,n){if(t===n)return;if(t<0||t>=this.children.length)throw new Error("Invalid from index");t<n&&n--,this.splitview.moveView(t,n);const s=this._removeChild(t);this._addChild(s,n)}getChildSize(t){if(t<0||t>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(t)}resizeChild(t,n){if(t<0||t>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(t,n)}layout(t,n){this._size=n,this._orthogonalSize=t,this.splitview.layout(n,t)}addChild(t,n,s,a){if(s<0||s>this.children.length)throw new Error("Invalid index");this.splitview.addView(t,n,s,a),this._addChild(t,s)}getChildCachedVisibleSize(t){if(t<0||t>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(t)}removeChild(t,n){if(t<0||t>=this.children.length)throw new Error("Invalid index");return this.splitview.removeView(t,n),this._removeChild(t)}_addChild(t,n){this.children.splice(n,0,t),this.setupChildrenEvents()}_removeChild(t){const[n]=this.children.splice(t,1);return this.setupChildrenEvents(),n}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=new Ge(vr.any(...this.children.map(t=>t.onDidChange))(t=>{this._onDidChange.fire({size:t.orthogonalSize})}),...this.children.map((t,n)=>t instanceof Bt?t.onDidVisibilityChange(({visible:s})=>{this.setChildVisible(n,s)}):Zt.NONE))}dispose(){this._childrenDisposable.dispose(),this.splitview.dispose(),this.children.forEach(t=>t.dispose()),super.dispose()}}function cx(e,t){if(e instanceof dn)return e;if(e instanceof Bt)return cx(e.children[t?e.children.length-1:0],t);throw new Error("invalid node")}function bA(e,t,n){if(e instanceof Bt){const s=new Bt(e.orientation,e.proportionalLayout,e.styles,t,n,e.disabled,e.margin);for(let a=e.children.length-1;a>=0;a--){const r=e.children[a];s.addChild(bA(r,r.size,r.orthogonalSize),r.size,0,!0)}return s}else return new dn(e.view,e.orientation,n)}function dx(e,t,n){if(e instanceof Bt){const s=new Bt(ai(e.orientation),e.proportionalLayout,e.styles,t,n,e.disabled,e.margin);let a=0;for(let r=e.children.length-1;r>=0;r--){const o=e.children[r],l=o instanceof Bt?o.orthogonalSize:o.size;let c=e.size===0?0:Math.round(t*l/e.size);a+=c,r===0&&(c+=t-a),s.addChild(dx(o,n,c),c,0,!0)}return s}else return new dn(e.view,ai(e.orientation),n)}function N5(e){const t=e.parentElement;if(!t)throw new Error("Invalid grid element");let n=t.firstElementChild,s=0;for(;n!==e&&n!==t.lastElementChild&&n;)n=n.nextElementSibling,s++;return s}function Ht(e){const t=e.parentElement;if(!t)throw new Error("Invalid grid element");if(/\bdv-grid-view\b/.test(t.className))return[];const n=N5(t),s=t.parentElement.parentElement.parentElement;return[...Ht(s),n]}function ti(e,t,n){const s=S5(e,t),a=k5(n);if(s===a){const[r,o]=Pi(t);let l=o;return(n==="right"||n==="bottom")&&(l+=1),[...r,l]}else{const r=n==="right"||n==="bottom"?1:0;return[...t,r]}}function k5(e){return e==="top"||e==="bottom"?Me.VERTICAL:Me.HORIZONTAL}function S5(e,t){return t.length%2===0?ai(e):e}const ai=e=>e===Me.HORIZONTAL?Me.VERTICAL:Me.HORIZONTAL;function C5(e){return!!e.children}const ux=(e,t)=>{const n=t===Me.VERTICAL?e.box.width:e.box.height;return C5(e)?{type:"branch",data:e.children.map(s=>ux(s,ai(t))),size:n}:typeof e.cachedVisibleSize=="number"?{type:"leaf",data:e.view.toJSON(),size:e.cachedVisibleSize,visible:!1}:{type:"leaf",data:e.view.toJSON(),size:n}};class D5{get length(){return this._root?this._root.children.length:0}get orientation(){return this.root.orientation}set orientation(t){if(this.root.orientation===t)return;const{size:n,orthogonalSize:s}=this.root;this.root=dx(this.root,s,n),this.root.layout(n,s)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get locked(){return this._locked}set locked(t){this._locked=t;const n=[this.root];for(;n.length>0;){const s=n.pop();s instanceof Bt&&(s.disabled=t,n.push(...s.children))}}get margin(){return this._margin}set margin(t){this._margin=t,this.root.margin=t}maximizedView(){var t;return(t=this._maximizedNode)===null||t===void 0?void 0:t.leaf.view}hasMaximizedView(){return this._maximizedNode!==void 0}maximizeView(t){var n;const s=Ht(t.element),[a,r]=this.getNode(s);if(!(r instanceof dn)||((n=this._maximizedNode)===null||n===void 0?void 0:n.leaf)===r)return;this.hasMaximizedView()&&this.exitMaximizedView(),ux(this.getView(),this.orientation);const o=[];function l(c,d){for(let h=0;h<c.children.length;h++){const f=c.children[h];f instanceof dn?f!==d&&(c.isChildVisible(h)?c.setChildVisible(h,!1):o.push(f)):l(f,d)}}l(this.root,r),this._maximizedNode={leaf:r,hiddenOnMaximize:o},this._onDidMaximizedNodeChange.fire({view:r.view,isMaximized:!0})}exitMaximizedView(){if(!this._maximizedNode)return;const t=this._maximizedNode.hiddenOnMaximize;function n(a){for(let r=a.children.length-1;r>=0;r--){const o=a.children[r];o instanceof dn?t.includes(o)||a.setChildVisible(r,!0):n(o)}}n(this.root);const s=this._maximizedNode.leaf;this._maximizedNode=void 0,this._onDidMaximizedNodeChange.fire({view:s.view,isMaximized:!1})}serialize(){const t=this.maximizedView();let n;t&&(n=Ht(t.element)),this.hasMaximizedView()&&this.exitMaximizedView();const a={root:ux(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation};return n&&(a.maximizedNode={location:n}),t&&this.maximizeView(t),a}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this._onDidMaximizedNodeChange.dispose(),this._onDidViewVisibilityChange.dispose(),this.root.dispose(),this._maximizedNode=void 0,this.element.remove()}clear(){const t=this.root.orientation;this.root=new Bt(t,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize,this.locked,this.margin)}deserialize(t,n){const s=t.orientation,a=s===Me.VERTICAL?t.height:t.width;if(this._deserialize(t.root,s,n,a),this.layout(t.width,t.height),t.maximizedNode){const r=t.maximizedNode.location,[o,l]=this.getNode(r);if(!(l instanceof dn))return;this.maximizeView(l.view)}}_deserialize(t,n,s,a){this.root=this._deserializeNode(t,n,s,a)}_deserializeNode(t,n,s,a){var r;let o;if(t.type==="branch"){const c=t.data.map(d=>({node:this._deserializeNode(d,ai(n),s,t.size),visible:d.visible}));o=new Bt(n,this.proportionalLayout,this.styles,t.size,a,this.locked,this.margin,c)}else{const l=s.fromJSON(t);typeof t.visible=="boolean"&&((r=l.setVisible)===null||r===void 0||r.call(l,t.visible)),o=new dn(l,n,a,t.size)}return o}get root(){return this._root}set root(t){const n=this._root;n&&(n.dispose(),this._maximizedNode=void 0,this.element.removeChild(n.element)),this._root=t,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(s=>{this._onDidChange.fire(s)})}normalize(){if(!this._root||this._root.children.length!==1)return;const t=this.root,n=t.children[0];if(n instanceof dn)return;t.element.remove();const s=t.removeChild(0);t.dispose(),s.dispose(),this._root=bA(n,n.size,n.orthogonalSize),this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(a=>{this._onDidChange.fire(a)})}insertOrthogonalSplitviewAtRoot(){if(!this._root)return;const t=this.root;if(t.element.remove(),this._root=new Bt(ai(t.orientation),this.proportionalLayout,this.styles,this.root.orthogonalSize,this.root.size,this.locked,this.margin),t.children.length!==0)if(t.children.length===1){const n=t.children[0];t.removeChild(0).dispose(),t.dispose(),this._root.addChild(dx(n,n.orthogonalSize,n.size),Es.Distribute,0)}else this._root.addChild(t,Es.Distribute,0);this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(n=>{this._onDidChange.fire(n)})}next(t){return this.progmaticSelect(t)}previous(t){return this.progmaticSelect(t,!0)}getView(t){const n=t?this.getNode(t)[1]:this.root;return this._getViews(n,this.orientation)}_getViews(t,n,s){const a={height:t.height,width:t.width};if(t instanceof dn)return{box:a,view:t.view,cachedVisibleSize:s};const r=[];for(let o=0;o<t.children.length;o++){const l=t.children[o],c=t.getChildCachedVisibleSize(o);r.push(this._getViews(l,ai(n),c))}return{box:a,children:r}}progmaticSelect(t,n=!1){const[s,a]=this.getNode(t);if(!(a instanceof dn))throw new Error("invalid location");for(let r=s.length-1;r>-1;r--){const o=s[r],l=t[r]||0;if(n?l-1>-1:l+1<o.children.length)return cx(o.children[n?l-1:l+1],n)}return cx(this.root,n)}constructor(t,n,s,a,r){this.proportionalLayout=t,this.styles=n,this._locked=!1,this._margin=0,this._maximizedNode=void 0,this.disposable=new On,this._onDidChange=new te,this.onDidChange=this._onDidChange.event,this._onDidViewVisibilityChange=new te,this.onDidViewVisibilityChange=this._onDidViewVisibilityChange.event,this._onDidMaximizedNodeChange=new te,this.onDidMaximizedNodeChange=this._onDidMaximizedNodeChange.event,this.element=document.createElement("div"),this.element.className="dv-grid-view",this._locked=a??!1,this._margin=r??0,this.root=new Bt(s,t,n,0,0,this.locked,this.margin)}isViewVisible(t){const[n,s]=Pi(t),[,a]=this.getNode(n);if(!(a instanceof Bt))throw new Error("Invalid from location");return a.isChildVisible(s)}setViewVisible(t,n){this.hasMaximizedView()&&this.exitMaximizedView();const[s,a]=Pi(t),[,r]=this.getNode(s);if(!(r instanceof Bt))throw new Error("Invalid from location");this._onDidViewVisibilityChange.fire(),r.setChildVisible(a,n)}moveView(t,n,s){this.hasMaximizedView()&&this.exitMaximizedView();const[,a]=this.getNode(t);if(!(a instanceof Bt))throw new Error("Invalid location");a.moveChild(n,s)}addView(t,n,s){this.hasMaximizedView()&&this.exitMaximizedView();const[a,r]=Pi(s),[o,l]=this.getNode(a);if(l instanceof Bt){const c=new dn(t,ai(l.orientation),l.orthogonalSize);l.addChild(c,n,r)}else{const[c,...d]=[...o].reverse(),[h,...f]=[...a].reverse();let m=0;const p=c.getChildCachedVisibleSize(h);typeof p=="number"&&(m=Es.Invisible(p)),c.removeChild(h).dispose();const g=new Bt(l.orientation,this.proportionalLayout,this.styles,l.size,l.orthogonalSize,this.locked,this.margin);c.addChild(g,l.size,h);const b=new dn(l.view,c.orientation,l.size);g.addChild(b,m,0),typeof n!="number"&&n.type==="split"&&(n={type:"split",index:0});const v=new dn(t,c.orientation,l.size);g.addChild(v,n,r)}}remove(t,n){const s=Ht(t.element);return this.removeView(s,n)}removeView(t,n){this.hasMaximizedView()&&this.exitMaximizedView();const[s,a]=Pi(t),[r,o]=this.getNode(s);if(!(o instanceof Bt))throw new Error("Invalid location");const l=o.children[a];if(!(l instanceof dn))throw new Error("Invalid location");if(o.removeChild(a,n),l.dispose(),o.children.length!==1)return l.view;const c=o.children[0];if(r.length===0)return c instanceof dn||(o.removeChild(0,n),this.root=c),l.view;const[d,...h]=[...r].reverse(),[f,...m]=[...s].reverse(),p=o.isChildVisible(0);o.removeChild(0,n);const y=d.children.map((g,b)=>d.getChildSize(b));if(d.removeChild(f,n).dispose(),c instanceof Bt){y.splice(f,1,...c.children.map(g=>g.size));for(let g=0;g<c.children.length;g++){const b=c.children[g];d.addChild(b,b.size,f+g)}for(;c.children.length>0;)c.removeChild(0)}else{const g=new dn(c.view,ai(c.orientation),c.size),b=p?c.orthogonalSize:Es.Invisible(c.orthogonalSize);d.addChild(g,b,f)}c.dispose();for(let g=0;g<y.length;g++)d.resizeChild(g,y[g]);return l.view}layout(t,n){const[s,a]=this.root.orientation===Me.HORIZONTAL?[n,t]:[t,n];this.root.layout(s,a)}getNode(t,n=this.root,s=[]){if(t.length===0)return[s,n];if(!(n instanceof Bt))throw new Error("Invalid location");const[a,...r]=t;if(a<0||a>=n.children.length)throw new Error("Invalid location");const o=n.children[a];return s.push(n),this.getNode(r,o,s)}}const hx=Object.keys({disableAutoResizing:void 0,proportionalLayout:void 0,orientation:void 0,hideBorders:void 0,className:void 0});class Pb extends Ge{get element(){return this._element}get disableResizing(){return this._disableResizing}set disableResizing(t){this._disableResizing=t}constructor(t,n=!1){super(),this._disableResizing=n,this._element=t,this.addDisposables(sm(this._element,s=>{if(this.isDisposed||this.disableResizing||!this._element.offsetParent||!f5(this._element))return;const{width:a,height:r}=s.contentRect;this.layout(a,r)}))}}const E5=Lb();function Ih(e){switch(e){case"left":return"left";case"right":return"right";case"above":return"top";case"below":return"bottom";case"within":default:return"center"}}class yA extends Pb{get id(){return this._id}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map(t=>t.value)}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}get locked(){return this.gridview.locked}set locked(t){this.gridview.locked=t}constructor(t,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._id=E5.next(),this._groups=new Map,this._onDidRemove=new te,this.onDidRemove=this._onDidRemove.event,this._onDidAdd=new te,this.onDidAdd=this._onDidAdd.event,this._onDidMaximizedChange=new te,this.onDidMaximizedChange=this._onDidMaximizedChange.event,this._onDidActiveChange=new te,this.onDidActiveChange=this._onDidActiveChange.event,this._bufferOnDidLayoutChange=new q_,this.onDidLayoutChange=this._bufferOnDidLayoutChange.onEvent,this._onDidViewVisibilityChangeMicroTaskQueue=new q_,this.onDidViewVisibilityChangeMicroTaskQueue=this._onDidViewVisibilityChangeMicroTaskQueue.onEvent,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new am(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),t.appendChild(this.element),this.gridview=new D5(!!n.proportionalLayout,n.styles,n.orientation,n.locked,n.margin),this.gridview.locked=!!n.locked,this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidMaximizedNodeChange(a=>{this._onDidMaximizedChange.fire({panel:a.view,isMaximized:a.isMaximized})}),this.gridview.onDidViewVisibilityChange(()=>this._onDidViewVisibilityChangeMicroTaskQueue.fire()),this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.layout(this.width,this.height,!0)}),Zt.from(()=>{var a;(a=this.element.parentElement)===null||a===void 0||a.removeChild(this.element)}),this.gridview.onDidChange(()=>{this._bufferOnDidLayoutChange.fire()}),vr.any(this.onDidAdd,this.onDidRemove,this.onDidActiveChange)(()=>{this._bufferOnDidLayoutChange.fire()}),this._onDidMaximizedChange,this._onDidViewVisibilityChangeMicroTaskQueue,this._bufferOnDidLayoutChange)}setVisible(t,n){this.gridview.setViewVisible(Ht(t.element),n),this._bufferOnDidLayoutChange.fire()}isVisible(t){return this.gridview.isViewVisible(Ht(t.element))}updateOptions(t){var n,s,a,r;t.proportionalLayout,t.orientation&&(this.gridview.orientation=t.orientation),"disableResizing"in t&&(this.disableResizing=(n=t.disableAutoResizing)!==null&&n!==void 0?n:!1),"locked"in t&&(this.locked=(s=t.locked)!==null&&s!==void 0?s:!1),"margin"in t&&(this.gridview.margin=(a=t.margin)!==null&&a!==void 0?a:0),"className"in t&&this._classNames.setClassNames((r=t.className)!==null&&r!==void 0?r:"")}maximizeGroup(t){this.gridview.maximizeView(t),this.doSetGroupActive(t)}isMaximizedGroup(t){return this.gridview.maximizedView()===t}exitMaximizedGroup(){this.gridview.exitMaximizedView()}hasMaximizedGroup(){return this.gridview.hasMaximizedView()}doAddGroup(t,n=[0],s){this.gridview.addView(t,s??Es.Distribute,n),this._onDidAdd.fire(t)}doRemoveGroup(t,n){if(!this._groups.has(t.id))throw new Error("invalid operation");const s=this._groups.get(t.id),a=this.gridview.remove(t,Es.Distribute);if(s&&!(n!=null&&n.skipDispose)&&(s.disposable.dispose(),s.value.dispose(),this._groups.delete(t.id),this._onDidRemove.fire(t)),!(n!=null&&n.skipActive)&&this._activeGroup===t){const r=Array.from(this._groups.values());this.doSetGroupActive(r.length>0?r[0].value:void 0)}return a}getPanel(t){var n;return(n=this._groups.get(t))===null||n===void 0?void 0:n.value}doSetGroupActive(t){this._activeGroup!==t&&(this._activeGroup&&this._activeGroup.setActive(!1),t&&t.setActive(!0),this._activeGroup=t,this._onDidActiveChange.fire(t))}removeGroup(t){this.doRemoveGroup(t)}moveToNext(t){var n;if(t||(t={}),!t.group){if(!this.activeGroup)return;t.group=this.activeGroup}const s=Ht(t.group.element),a=(n=this.gridview.next(s))===null||n===void 0?void 0:n.view;this.doSetGroupActive(a)}moveToPrevious(t){var n;if(t||(t={}),!t.group){if(!this.activeGroup)return;t.group=this.activeGroup}const s=Ht(t.group.element),a=(n=this.gridview.previous(s))===null||n===void 0?void 0:n.view;this.doSetGroupActive(a)}layout(t,n,s){(s||t!==this.width||n!==this.height)&&(this.gridview.element.style.height=`${n}px`,this.gridview.element.style.width=`${t}px`,this.gridview.layout(t,n))}dispose(){this._onDidActiveChange.dispose(),this._onDidAdd.dispose(),this._onDidRemove.dispose();for(const t of this.groups)t.dispose();this.gridview.dispose(),super.dispose()}}class wA{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get length(){return this.component.length}get orientation(){return this.component.orientation}get panels(){return this.component.panels}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}constructor(t){this.component=t}removePanel(t,n){this.component.removePanel(t,n)}focus(){this.component.focus()}getPanel(t){return this.component.getPanel(t)}layout(t,n){return this.component.layout(t,n)}addPanel(t){return this.component.addPanel(t)}movePanel(t,n){this.component.movePanel(t,n)}fromJSON(t){this.component.fromJSON(t)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(t){this.component.updateOptions(t)}dispose(){this.component.dispose()}}class Xc{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get panels(){return this.component.panels}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){return this.component.onDidDrop}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}constructor(t){this.component=t}removePanel(t){this.component.removePanel(t)}getPanel(t){return this.component.getPanel(t)}movePanel(t,n){this.component.movePanel(t,n)}focus(){this.component.focus()}layout(t,n){this.component.layout(t,n)}addPanel(t){return this.component.addPanel(t)}fromJSON(t){this.component.fromJSON(t)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(t){this.component.updateOptions(t)}dispose(){this.component.dispose()}}class _A{get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddPanel(){return this.component.onDidAddGroup}get onDidRemovePanel(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActiveGroupChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(t){this.component.updateOptions({orientation:t})}constructor(t){this.component=t}focus(){this.component.focus()}layout(t,n,s=!1){this.component.layout(t,n,s)}addPanel(t){return this.component.addPanel(t)}removePanel(t,n){this.component.removePanel(t,n)}movePanel(t,n){this.component.movePanel(t,n)}getPanel(t){return this.component.getPanel(t)}fromJSON(t){return this.component.fromJSON(t)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(t){this.component.updateOptions(t)}dispose(){this.component.dispose()}}class Gh{get id(){return this.component.id}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get totalPanels(){return this.component.totalPanels}get onDidActiveGroupChange(){return this.component.onDidActiveGroupChange}get onDidAddGroup(){return this.component.onDidAddGroup}get onDidRemoveGroup(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActivePanelChange}get onDidAddPanel(){return this.component.onDidAddPanel}get onDidRemovePanel(){return this.component.onDidRemovePanel}get onDidMovePanel(){return this.component.onDidMovePanel}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidDrop(){return this.component.onDidDrop}get onWillDrop(){return this.component.onWillDrop}get onWillShowOverlay(){return this.component.onWillShowOverlay}get onWillDragGroup(){return this.component.onWillDragGroup}get onWillDragPanel(){return this.component.onWillDragPanel}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}get onDidPopoutGroupSizeChange(){return this.component.onDidPopoutGroupSizeChange}get onDidPopoutGroupPositionChange(){return this.component.onDidPopoutGroupPositionChange}get onDidOpenPopoutWindowFail(){return this.component.onDidOpenPopoutWindowFail}get panels(){return this.component.panels}get groups(){return this.component.groups}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}constructor(t){this.component=t}focus(){this.component.focus()}getPanel(t){return this.component.getGroupPanel(t)}layout(t,n,s=!1){this.component.layout(t,n,s)}addPanel(t){return this.component.addPanel(t)}removePanel(t){this.component.removePanel(t)}addGroup(t){return this.component.addGroup(t)}closeAllGroups(){return this.component.closeAllGroups()}removeGroup(t){this.component.removeGroup(t)}getGroup(t){return this.component.getPanel(t)}addFloatingGroup(t,n){return this.component.addFloatingGroup(t,n)}fromJSON(t){this.component.fromJSON(t)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}moveToNext(t){this.component.moveToNext(t)}moveToPrevious(t){this.component.moveToPrevious(t)}maximizeGroup(t){this.component.maximizeGroup(t.group)}hasMaximizedGroup(){return this.component.hasMaximizedGroup()}exitMaximizedGroup(){this.component.exitMaximizedGroup()}get onDidMaximizedGroupChange(){return this.component.onDidMaximizedGroupChange}addPopoutGroup(t,n){return this.component.addPopoutGroup(t,n)}updateOptions(t){this.component.updateOptions(t)}dispose(){this.component.dispose()}}class Ib extends Ge{constructor(t,n){super(),this.el=t,this.disabled=n,this.dataDisposable=new On,this.pointerEventsDisposable=new On,this._onDragStart=new te,this.onDragStart=this._onDragStart.event,this.addDisposables(this._onDragStart,this.dataDisposable,this.pointerEventsDisposable),this.configure()}setDisabled(t){this.disabled=t}isCancelled(t){return!1}configure(){this.addDisposables(this._onDragStart,Fe(this.el,"dragstart",t=>{if(t.defaultPrevented||this.isCancelled(t)||this.disabled){t.preventDefault();return}const n=Ph();this.pointerEventsDisposable.value={dispose:()=>{n.release()}},this.el.classList.add("dv-dragged"),setTimeout(()=>this.el.classList.remove("dv-dragged"),0),this.dataDisposable.value=this.getData(t),this._onDragStart.fire(t),t.dataTransfer&&(t.dataTransfer.effectAllowed="move",t.dataTransfer.items.length>0||t.dataTransfer.setData("text/plain",""))}),Fe(this.el,"dragend",()=>{this.pointerEventsDisposable.dispose(),setTimeout(()=>{this.dataDisposable.dispose()},0)}))}}class jA extends Ge{constructor(t,n){super(),this.element=t,this.callbacks=n,this.target=null,this.registerListeners()}onDragEnter(t){this.target=t.target,this.callbacks.onDragEnter(t)}onDragOver(t){t.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(t)}onDragLeave(t){this.target===t.target&&(this.target=null,this.callbacks.onDragLeave(t))}onDragEnd(t){this.target=null,this.callbacks.onDragEnd(t)}onDrop(t){this.callbacks.onDrop(t)}registerListeners(){this.addDisposables(Fe(this.element,"dragenter",t=>{this.onDragEnter(t)},!0)),this.addDisposables(Fe(this.element,"dragover",t=>{this.onDragOver(t)},!0)),this.addDisposables(Fe(this.element,"dragleave",t=>{this.onDragLeave(t)})),this.addDisposables(Fe(this.element,"dragend",t=>{this.onDragEnd(t)})),this.addDisposables(Fe(this.element,"drop",t=>{this.onDrop(t)}))}}function A5(e,t){const{top:n,left:s,width:a,height:r}=t,o=`${Math.round(n)}px`,l=`${Math.round(s)}px`,c=`${Math.round(a)}px`,d=`${Math.round(r)}px`;e.style.top=o,e.style.left=l,e.style.width=c,e.style.height=d,e.style.visibility="visible",(!e.style.transform||e.style.transform==="")&&(e.style.transform="translate3d(0, 0, 0)")}function R5(e,t){const{top:n,left:s,width:a,height:r}=t;e.style.top=n,e.style.left=s,e.style.width=a,e.style.height=r,e.style.visibility="visible",(!e.style.transform||e.style.transform==="")&&(e.style.transform="translate3d(0, 0, 0)")}function T5(e,t){const{top:n,left:s,width:a,height:r}=t,o=`${Math.round(n)}px`,l=`${Math.round(s)}px`,c=`${Math.round(a)}px`,d=`${Math.round(r)}px`;return e.style.top!==o||e.style.left!==l||e.style.width!==c||e.style.height!==d}class O5 extends $b{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}constructor(t){super(),this.options=t}}function K_(e){switch(e){case"above":return"top";case"below":return"bottom";case"left":return"left";case"right":return"right";case"within":return"center";default:throw new Error(`invalid direction '${e}'`)}}function NA(e){switch(e){case"top":return"above";case"bottom":return"below";case"left":return"left";case"right":return"right";case"center":return"within";default:throw new Error(`invalid position '${e}'`)}}const z5={value:20,type:"percentage"},M5={value:50,type:"percentage"},$5=100,L5=100;class Vs extends Ge{get disabled(){return this._disabled}set disabled(t){this._disabled=t}get state(){return this._state}constructor(t,n){super(),this.element=t,this.options=n,this._onDrop=new te,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new te,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(this.options.acceptedTargetZones),this.dnd=new jA(this.element,{onDragEnter:()=>{var s,a,r;(r=(a=(s=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(s))===null||r===void 0||r.getElements()},onDragOver:s=>{var a,r,o,l,c,d,h;Vs.ACTUAL_TARGET=this;const f=(r=(a=this.options).getOverrideTarget)===null||r===void 0?void 0:r.call(a);if(this._acceptedTargetZonesSet.size===0){if(f)return;this.removeDropTarget();return}const m=(c=(l=(o=this.options).getOverlayOutline)===null||l===void 0?void 0:l.call(o))!==null&&c!==void 0?c:this.element,p=m.offsetWidth,y=m.offsetHeight;if(p===0||y===0)return;const g=s.currentTarget.getBoundingClientRect(),b=((d=s.clientX)!==null&&d!==void 0?d:0)-g.left,v=((h=s.clientY)!==null&&h!==void 0?h:0)-g.top,x=this.calculateQuadrant(this._acceptedTargetZonesSet,b,v,p,y);if(this.isAlreadyUsed(s)||x===null){this.removeDropTarget();return}if(!this.options.canDisplayOverlay(s,x)){if(f)return;this.removeDropTarget();return}const w=new O5({nativeEvent:s,position:x});if(this._onWillShowOverlay.fire(w),w.defaultPrevented){this.removeDropTarget();return}this.markAsUsed(s),f||this.targetElement||(this.targetElement=document.createElement("div"),this.targetElement.className="dv-drop-target-dropzone",this.overlayElement=document.createElement("div"),this.overlayElement.className="dv-drop-target-selection",this._state="center",this.targetElement.appendChild(this.overlayElement),m.classList.add("dv-drop-target"),m.append(this.targetElement)),this.toggleClasses(x,p,y),this._state=x},onDragLeave:()=>{var s,a;!((a=(s=this.options).getOverrideTarget)===null||a===void 0)&&a.call(s)||this.removeDropTarget()},onDragEnd:s=>{var a,r;const o=(r=(a=this.options).getOverrideTarget)===null||r===void 0?void 0:r.call(a);o&&Vs.ACTUAL_TARGET===this&&this._state&&(s.stopPropagation(),this._onDrop.fire({position:this._state,nativeEvent:s})),this.removeDropTarget(),o==null||o.clear()},onDrop:s=>{var a,r,o;s.preventDefault();const l=this._state;this.removeDropTarget(),(o=(r=(a=this.options).getOverrideTarget)===null||r===void 0?void 0:r.call(a))===null||o===void 0||o.clear(),l&&(s.stopPropagation(),this._onDrop.fire({position:l,nativeEvent:s}))}}),this.addDisposables(this._onDrop,this._onWillShowOverlay,this.dnd)}setTargetZones(t){this._acceptedTargetZonesSet=new Set(t)}setOverlayModel(t){this.options.overlayModel=t}dispose(){this.removeDropTarget(),super.dispose()}markAsUsed(t){t[Vs.USED_EVENT_ID]=!0}isAlreadyUsed(t){const n=t[Vs.USED_EVENT_ID];return typeof n=="boolean"&&n}toggleClasses(t,n,s){var a,r,o,l,c,d,h;const f=(r=(a=this.options).getOverrideTarget)===null||r===void 0?void 0:r.call(a);if(!f&&!this.overlayElement)return;const m=n<$5,p=s<L5,y=t==="left",g=t==="right",b=t==="top",v=t==="bottom",x=!m&&g,w=!m&&y,_=!p&&b,S=!p&&v;let k=1;const j=(l=(o=this.options.overlayModel)===null||o===void 0?void 0:o.size)!==null&&l!==void 0?l:M5;if(j.type==="percentage"?k=Rt(j.value,0,100)/100:((x||w)&&(k=Rt(0,j.value,n)/n),(_||S)&&(k=Rt(0,j.value,s)/s)),f){const O=(h=(d=(c=this.options).getOverlayOutline)===null||d===void 0?void 0:d.call(c))!==null&&h!==void 0?h:this.element,T=O.getBoundingClientRect(),P=f.getElements(void 0,O),L=P.root,G=P.overlay,A=L.getBoundingClientRect(),D=T.top-A.top,C=T.left-A.left,R={top:D,left:C,width:n,height:s};if(x?(R.left=C+n*(1-k),R.width=n*k):w?R.width=n*k:_?R.height=s*k:S&&(R.top=D+s*(1-k),R.height=s*k),m&&y&&(R.width=4),m&&g&&(R.left=C+n-4,R.width=4),!T5(G,R))return;A5(G,R),G.className=`dv-drop-target-anchor${this.options.className?` ${this.options.className}`:""}`,Pe(G,"dv-drop-target-left",y),Pe(G,"dv-drop-target-right",g),Pe(G,"dv-drop-target-top",b),Pe(G,"dv-drop-target-bottom",v),Pe(G,"dv-drop-target-center",t==="center"),P.changed&&(Pe(G,"dv-drop-target-anchor-container-changed",!0),setTimeout(()=>{Pe(G,"dv-drop-target-anchor-container-changed",!1)},10));return}if(!this.overlayElement)return;const N={top:"0px",left:"0px",width:"100%",height:"100%"};x?(N.left=`${100*(1-k)}%`,N.width=`${100*k}%`):w?N.width=`${100*k}%`:_?N.height=`${100*k}%`:S&&(N.top=`${100*(1-k)}%`,N.height=`${100*k}%`),R5(this.overlayElement,N),Pe(this.overlayElement,"dv-drop-target-small-vertical",p),Pe(this.overlayElement,"dv-drop-target-small-horizontal",m),Pe(this.overlayElement,"dv-drop-target-left",y),Pe(this.overlayElement,"dv-drop-target-right",g),Pe(this.overlayElement,"dv-drop-target-top",b),Pe(this.overlayElement,"dv-drop-target-bottom",v),Pe(this.overlayElement,"dv-drop-target-center",t==="center")}calculateQuadrant(t,n,s,a,r){var o,l;const c=(l=(o=this.options.overlayModel)===null||o===void 0?void 0:o.activationSize)!==null&&l!==void 0?l:z5;return c.type==="percentage"?P5(t,n,s,a,r,c.value):I5(t,n,s,a,r,c.value)}removeDropTarget(){var t;this.targetElement&&(this._state=void 0,(t=this.targetElement.parentElement)===null||t===void 0||t.classList.remove("dv-drop-target"),this.targetElement.remove(),this.targetElement=void 0,this.overlayElement=void 0)}}Vs.USED_EVENT_ID="__dockview_droptarget_event_is_used__";function P5(e,t,n,s,a,r){const o=100*t/s,l=100*n/a;return e.has("left")&&o<r?"left":e.has("right")&&o>100-r?"right":e.has("top")&&l<r?"top":e.has("bottom")&&l>100-r?"bottom":e.has("center")?"center":null}function I5(e,t,n,s,a,r){return e.has("left")&&t<r?"left":e.has("right")&&t>s-r?"right":e.has("top")&&n<r?"top":e.has("bottom")&&n>a-r?"bottom":e.has("center")?"center":null}const fx=Object.keys({disableAutoResizing:void 0,disableDnd:void 0,className:void 0});class G5 extends mA{constructor(t,n,s,a){super(),this.nativeEvent=t,this.position=n,this.getData=s,this.panel=a}}class kA extends $b{constructor(){super()}}class SA extends Ge{get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}constructor(t,n){super(),this.id=t,this.component=n,this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._parameters={},this.panelUpdatesDisposable=new On,this._onDidDimensionChange=new te,this.onDidDimensionsChange=this._onDidDimensionChange.event,this._onDidChangeFocus=new te,this.onDidFocusChange=this._onDidChangeFocus.event,this._onWillFocus=new te,this.onWillFocus=this._onWillFocus.event,this._onDidVisibilityChange=new te,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onWillVisibilityChange=new te,this.onWillVisibilityChange=this._onWillVisibilityChange.event,this._onDidActiveChange=new te,this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new te,this.onActiveChange=this._onActiveChange.event,this._onDidParametersChange=new te,this.onDidParametersChange=this._onDidParametersChange.event,this.addDisposables(this.onDidFocusChange(s=>{this._isFocused=s.isFocused}),this.onDidActiveChange(s=>{this._isActive=s.isActive}),this.onDidVisibilityChange(s=>{this._isVisible=s.isVisible}),this.onDidDimensionsChange(s=>{this._width=s.width,this._height=s.height}),this.panelUpdatesDisposable,this._onDidDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onWillFocus,this._onActiveChange,this._onWillFocus,this._onWillVisibilityChange,this._onDidParametersChange)}getParameters(){return this._parameters}initialize(t){this.panelUpdatesDisposable.value=this._onDidParametersChange.event(n=>{this._parameters=n,t.update({params:n})})}setVisible(t){this._onWillVisibilityChange.fire({isVisible:t})}setActive(){this._onActiveChange.fire()}updateParameters(t){this._onDidParametersChange.fire(t)}}class CA extends SA{constructor(t,n){super(t,n),this._onDidConstraintsChangeInternal=new te,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new te({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new te,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange)}setConstraints(t){this._onDidConstraintsChangeInternal.fire(t)}setSize(t){this._onDidSizeChange.fire(t)}}class H5 extends CA{set pane(t){this._pane=t}constructor(t,n){super(t,n),this._onDidExpansionChange=new te({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new te({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new te({}),this.onMouseLeave=this._onMouseLeave.event,this.addDisposables(this._onDidExpansionChange,this._onMouseEnter,this._onMouseLeave)}setExpanded(t){var n;(n=this._pane)===null||n===void 0||n.setExpanded(t)}get isExpanded(){var t;return!!(!((t=this._pane)===null||t===void 0)&&t.isExpanded())}}class Gb extends Ge{get element(){return this._element}get width(){return this._width}get height(){return this._height}get params(){var t;return(t=this._params)===null||t===void 0?void 0:t.params}constructor(t,n,s){super(),this.id=t,this.component=n,this.api=s,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const a=pA(this._element);this.addDisposables(this.api,a.onDidFocus(()=>{this.api._onDidChangeFocus.fire({isFocused:!0})}),a.onDidBlur(()=>{this.api._onDidChangeFocus.fire({isFocused:!1})}),a)}focus(){const t=new kA;this.api._onWillFocus.fire(t),!t.defaultPrevented&&this._element.focus()}layout(t,n){this._width=t,this._height=n,this.api._onDidDimensionChange.fire({width:t,height:n}),this.part&&this._params&&this.part.update(this._params.params)}init(t){this._params=t,this.part=this.getComponent()}update(t){var n,s;this._params=Object.assign(Object.assign({},this._params),{params:Object.assign(Object.assign({},(n=this._params)===null||n===void 0?void 0:n.params),t.params)});for(const a of Object.keys(t.params))t.params[a]===void 0&&delete this._params.params[a];(s=this.part)===null||s===void 0||s.update({params:this._params.params})}toJSON(){var t,n;const s=(n=(t=this._params)===null||t===void 0?void 0:t.params)!==null&&n!==void 0?n:{};return{id:this.id,component:this.component,params:Object.keys(s).length>0?s:void 0}}dispose(){var t;this.api.dispose(),(t=this.part)===null||t===void 0||t.dispose(),super.dispose()}}class V5 extends Gb{set orientation(t){this._orientation=t}get orientation(){return this._orientation}get minimumSize(){const t=this.headerSize,s=this.isExpanded()?this._minimumBodySize:0;return t+s}get maximumSize(){const t=this.headerSize,s=this.isExpanded()?this._maximumBodySize:0;return t+s}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(t){this._orthogonalSize=t}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(t){this._minimumBodySize=typeof t=="number"?t:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(t){this._maximumBodySize=typeof t=="number"?t:Number.POSITIVE_INFINITY}get headerVisible(){return this._headerVisible}set headerVisible(t){this._headerVisible=t,this.header.style.display=t?"":"none"}constructor(t){super(t.id,t.component,new H5(t.id,t.component)),this._onDidChangeExpansionState=new te({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new te,this.onDidChange=this._onDidChange.event,this._orthogonalSize=0,this._size=0,this._isExpanded=!1,this.api.pane=this,this.api.initialize(this),this.headerSize=t.headerSize,this.headerComponent=t.headerComponent,this._minimumBodySize=t.minimumBodySize,this._maximumBodySize=t.maximumBodySize,this._isExpanded=t.isExpanded,this._headerVisible=t.isHeaderVisible,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=t.orientation,this.element.classList.add("dv-pane"),this.addDisposables(this.api.onWillVisibilityChange(n=>{const{isVisible:s}=n,{accessor:a}=this._params;a.setVisible(this,s)}),this.api.onDidSizeChange(n=>{this._onDidChange.fire({size:n.size})}),Fe(this.element,"mouseenter",n=>{this.api._onMouseEnter.fire(n)}),Fe(this.element,"mouseleave",n=>{this.api._onMouseLeave.fire(n)})),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState(n=>{this.api._onDidExpansionChange.fire({isExpanded:n})}),this.api.onDidFocusChange(n=>{this.header&&(n.isFocused?im(this.header,"focused"):qc(this.header,"focused"))})),this.renderOnce()}setVisible(t){this.api._onDidVisibilityChange.fire({isVisible:t})}setActive(t){this.api._onDidActiveChange.fire({isActive:t})}isExpanded(){return this._isExpanded}setExpanded(t){this._isExpanded!==t&&(this._isExpanded=t,t?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):this.animationTimer=setTimeout(()=>{var n;(n=this.body)===null||n===void 0||n.remove()},200),this._onDidChange.fire(t?{size:this.width}:{}),this._onDidChangeExpansionState.fire(t))}layout(t,n){this._size=t,this._orthogonalSize=n;const[s,a]=this.orientation===Me.HORIZONTAL?[t,n]:[n,t];super.layout(s,a)}init(t){var n,s;super.init(t),typeof t.minimumBodySize=="number"&&(this.minimumBodySize=t.minimumBodySize),typeof t.maximumBodySize=="number"&&(this.maximumBodySize=t.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(Object.assign(Object.assign({},t),{api:this.api})),this.headerPart.init(Object.assign(Object.assign({},t),{api:this.api})),(n=this.body)===null||n===void 0||n.append(this.bodyPart.element),(s=this.header)===null||s===void 0||s.append(this.headerPart.element),typeof t.isExpanded=="boolean"&&this.setExpanded(t.isExpanded)}toJSON(){const t=this._params;return Object.assign(Object.assign({},super.toJSON()),{headerComponent:this.headerComponent,title:t.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="dv-pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="dv-pane-body",this.element.appendChild(this.body)}getComponent(){return{update:t=>{var n,s;(n=this.bodyPart)===null||n===void 0||n.update({params:t}),(s=this.headerPart)===null||s===void 0||s.update({params:t})},dispose:()=>{var t,n;(t=this.bodyPart)===null||t===void 0||t.dispose(),(n=this.headerPart)===null||n===void 0||n.dispose()}}}}class U5 extends V5{constructor(t){super({id:t.id,component:t.component,headerComponent:t.headerComponent,orientation:t.orientation,isExpanded:t.isExpanded,isHeaderVisible:!0,headerSize:t.headerSize,minimumBodySize:t.minimumBodySize,maximumBodySize:t.maximumBodySize}),this._onDidDrop=new te,this.onDidDrop=this._onDidDrop.event,this._onUnhandledDragOverEvent=new te,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.accessor=t.accessor,this.addDisposables(this._onDidDrop,this._onUnhandledDragOverEvent),t.disableDnd||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const t=this.id,n=this.accessor.id;this.header.draggable=!0,this.handler=new class extends Ib{getData(){return vi.getInstance().setData([new gc(n,t)],gc.prototype),{dispose:()=>{vi.getInstance().clearData(gc.prototype)}}}}(this.header),this.target=new Vs(this.element,{acceptedTargetZones:["top","bottom"],overlayModel:{activationSize:{type:"percentage",value:50}},canDisplayOverlay:(s,a)=>{const r=Ml();if(r&&r.paneId!==this.id&&r.viewId===this.accessor.id)return!0;const o=new G5(s,a,Ml,this);return this._onUnhandledDragOverEvent.fire(o),o.isAccepted}}),this.addDisposables(this._onDidDrop,this.handler,this.target,this.target.onDrop(s=>{this.onDrop(s)}))}onDrop(t){const n=Ml();if(!n||n.viewId!==this.accessor.id){this._onDidDrop.fire(Object.assign(Object.assign({},t),{panel:this,api:new Xc(this.accessor),getData:Ml}));return}const s=this._params.containerApi,a=n.paneId,r=s.getPanel(a);if(!r){this._onDidDrop.fire(Object.assign(Object.assign({},t),{panel:this,getData:Ml,api:new Xc(this.accessor)}));return}const o=s.panels,l=o.indexOf(r);let c=s.panels.indexOf(this);(t.position==="left"||t.position==="top")&&(c=Math.max(0,c-1)),(t.position==="right"||t.position==="bottom")&&(l>c&&c++,c=Math.min(o.length-1,c)),s.movePanel(l,c)}}class B5 extends Ge{get element(){return this._element}constructor(t,n){super(),this.accessor=t,this.group=n,this.disposable=new On,this._onDidFocus=new te,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new te,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-content-container",this._element.tabIndex=-1,this.addDisposables(this._onDidFocus,this._onDidBlur);const s=n.dropTargetContainer;this.dropTarget=new Vs(this.element,{getOverlayOutline:()=>{var a;return((a=t.options.theme)===null||a===void 0?void 0:a.dndPanelOverlay)==="group"?this.element.parentElement:null},className:"dv-drop-target-content",acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:(a,r)=>{if(this.group.locked==="no-drop-target"||this.group.locked&&r==="center")return!1;const o=En();return!o&&a.shiftKey&&this.group.location.type!=="floating"?!1:o&&o.viewId===this.accessor.id?!0:this.group.canDisplayOverlay(a,r,"content")},getOverrideTarget:s?()=>s.model:void 0}),this.addDisposables(this.dropTarget)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}renderPanel(t,n={asActive:!0}){const s=n.asActive||this.panel&&this.group.isPanelActive(this.panel);this.panel&&this.panel.view.content.element.parentElement===this._element&&this._element.removeChild(this.panel.view.content.element),this.panel=t;let a;switch(t.api.renderer){case"onlyWhenVisible":this.group.renderContainer.detatch(t),this.panel&&s&&this._element.appendChild(this.panel.view.content.element),a=this._element;break;case"always":t.view.content.element.parentElement===this._element&&this._element.removeChild(t.view.content.element),a=this.group.renderContainer.attach({panel:t,referenceContainer:this});break;default:throw new Error(`dockview: invalid renderer type '${t.api.renderer}'`)}if(s){const r=pA(a),o=new Ge;o.addDisposables(r,r.onDidFocus(()=>this._onDidFocus.fire()),r.onDidBlur(()=>this._onDidBlur.fire())),this.disposable.value=o}}openPanel(t){this.panel!==t&&this.renderPanel(t)}layout(t,n){}closePanel(){var t;this.panel&&this.panel.api.renderer==="onlyWhenVisible"&&((t=this.panel.view.content.element.parentElement)===null||t===void 0||t.removeChild(this.panel.view.content.element)),this.panel=void 0}dispose(){this.disposable.dispose(),super.dispose()}}function DA(e,t,n){var s,a;im(t,"dv-dragged"),t.style.top="-9999px",document.body.appendChild(t),e.setDragImage(t,(s=n==null?void 0:n.x)!==null&&s!==void 0?s:0,(a=n==null?void 0:n.y)!==null&&a!==void 0?a:0),setTimeout(()=>{qc(t,"dv-dragged"),t.remove()},0)}class W5 extends Ib{constructor(t,n,s,a,r){super(t,r),this.accessor=n,this.group=s,this.panel=a,this.panelTransfer=vi.getInstance()}getData(t){return this.panelTransfer.setData([new Ta(this.accessor.id,this.group.id,this.panel.id)],Ta.prototype),{dispose:()=>{this.panelTransfer.clearData(Ta.prototype)}}}}class F5 extends Ge{get element(){return this._element}constructor(t,n,s){super(),this.panel=t,this.accessor=n,this.group=s,this.content=void 0,this._onPointDown=new te,this.onPointerDown=this._onPointDown.event,this._onDropped=new te,this.onDrop=this._onDropped.event,this._onDragStart=new te,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-tab",this._element.tabIndex=0,this._element.draggable=!this.accessor.options.disableDnd,Pe(this.element,"dv-inactive-tab",!0),this.dragHandler=new W5(this._element,this.accessor,this.group,this.panel,!!this.accessor.options.disableDnd),this.dropTarget=new Vs(this._element,{acceptedTargetZones:["left","right"],overlayModel:{activationSize:{value:50,type:"percentage"}},canDisplayOverlay:(a,r)=>{if(this.group.locked)return!1;const o=En();return o&&this.accessor.id===o.viewId?!0:this.group.model.canDisplayOverlay(a,r,"tab")},getOverrideTarget:()=>{var a;return(a=s.model.dropTargetContainer)===null||a===void 0?void 0:a.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this._onPointDown,this._onDropped,this._onDragStart,this.dragHandler.onDragStart(a=>{if(a.dataTransfer){const r=getComputedStyle(this.element),o=this.element.cloneNode(!0);Array.from(r).forEach(l=>o.style.setProperty(l,r.getPropertyValue(l),r.getPropertyPriority(l))),o.style.position="absolute",DA(a.dataTransfer,o,{y:-10,x:30})}this._onDragStart.fire(a)}),this.dragHandler,Fe(this._element,"pointerdown",a=>{this._onPointDown.fire(a)}),this.dropTarget.onDrop(a=>{this._onDropped.fire(a)}),this.dropTarget)}setActive(t){Pe(this.element,"dv-active-tab",t),Pe(this.element,"dv-inactive-tab",!t)}setContent(t){this.content&&this._element.removeChild(this.content.element),this.content=t,this._element.appendChild(this.content.element)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,this.dragHandler.setDisabled(!!this.accessor.options.disableDnd)}dispose(){super.dispose()}}class rm{get kind(){return this.options.kind}get nativeEvent(){return this.event.nativeEvent}get position(){return this.event.position}get defaultPrevented(){return this.event.defaultPrevented}get panel(){return this.options.panel}get api(){return this.options.api}get group(){return this.options.group}preventDefault(){this.event.preventDefault()}getData(){return this.options.getData()}constructor(t,n){this.event=t,this.options=n}}class q5 extends Ib{constructor(t,n,s,a){super(t,a),this.accessor=n,this.group=s,this.panelTransfer=vi.getInstance(),this.addDisposables(Fe(t,"pointerdown",r=>{r.shiftKey&&u5(r)},!0))}isCancelled(t){return this.group.api.location.type==="floating"&&!t.shiftKey}getData(t){const n=t.dataTransfer;this.panelTransfer.setData([new Ta(this.accessor.id,this.group.id,null)],Ta.prototype);const s=window.getComputedStyle(this.el),a=s.getPropertyValue("--dv-activegroup-visiblepanel-tab-background-color"),r=s.getPropertyValue("--dv-activegroup-visiblepanel-tab-color");if(n){const o=document.createElement("div");o.style.backgroundColor=a,o.style.color=r,o.style.padding="2px 8px",o.style.height="24px",o.style.fontSize="11px",o.style.lineHeight="20px",o.style.borderRadius="12px",o.style.position="absolute",o.style.pointerEvents="none",o.style.top="-9999px",o.textContent=`Multiple Panels (${this.group.size})`,DA(n,o,{y:-10,x:30})}return{dispose:()=>{this.panelTransfer.clearData(Ta.prototype)}}}}class Y5 extends Ge{get element(){return this._element}constructor(t,n){super(),this.accessor=t,this.group=n,this._onDrop=new te,this.onDrop=this._onDrop.event,this._onDragStart=new te,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-void-container",this._element.draggable=!this.accessor.options.disableDnd,Pe(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.addDisposables(this._onDrop,this._onDragStart,Fe(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this.group)})),this.handler=new q5(this._element,t,n,!!this.accessor.options.disableDnd),this.dropTarget=new Vs(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:(s,a)=>{const r=En();return r&&this.accessor.id===r.viewId?!0:n.model.canDisplayOverlay(s,a,"header_space")},getOverrideTarget:()=>{var s;return(s=n.model.dropTargetContainer)===null||s===void 0?void 0:s.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this.handler,this.handler.onDragStart(s=>{this._onDragStart.fire(s)}),this.dropTarget.onDrop(s=>{this._onDrop.fire(s)}),this.dropTarget)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,Pe(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.handler.setDisabled(!!this.accessor.options.disableDnd)}}class om extends Ge{get element(){return this._element}constructor(t){super(),this.scrollableElement=t,this._scrollLeft=0,this._element=document.createElement("div"),this._element.className="dv-scrollable",this._horizontalScrollbar=document.createElement("div"),this._horizontalScrollbar.className="dv-scrollbar-horizontal",this.element.appendChild(t),this.element.appendChild(this._horizontalScrollbar),this.addDisposables(Fe(this.element,"wheel",n=>{this._scrollLeft+=n.deltaY*om.MouseWheelSpeed,this.calculateScrollbarStyles()}),Fe(this._horizontalScrollbar,"pointerdown",n=>{n.preventDefault(),Pe(this.element,"dv-scrollable-scrolling",!0);const s=n.clientX,a=this._scrollLeft,r=l=>{const c=l.clientX-s,{clientWidth:d}=this.element,{scrollWidth:h}=this.scrollableElement,f=d/h;this._scrollLeft=a+c/f,this.calculateScrollbarStyles()},o=()=>{Pe(this.element,"dv-scrollable-scrolling",!1),document.removeEventListener("pointermove",r),document.removeEventListener("pointerup",o),document.removeEventListener("pointercancel",o)};document.addEventListener("pointermove",r),document.addEventListener("pointerup",o),document.addEventListener("pointercancel",o)}),Fe(this.element,"scroll",()=>{this.calculateScrollbarStyles()}),Fe(this.scrollableElement,"scroll",()=>{this._scrollLeft=this.scrollableElement.scrollLeft,this.calculateScrollbarStyles()}),sm(this.element,()=>{Pe(this.element,"dv-scrollable-resizing",!0),this._animationTimer&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(()=>{clearTimeout(this._animationTimer),Pe(this.element,"dv-scrollable-resizing",!1)},500),this.calculateScrollbarStyles()}))}calculateScrollbarStyles(){const{clientWidth:t}=this.element,{scrollWidth:n}=this.scrollableElement;if(n>t){const a=t*(t/n);this._horizontalScrollbar.style.width=`${a}px`,this._scrollLeft=Rt(this._scrollLeft,0,this.scrollableElement.scrollWidth-t),this.scrollableElement.scrollLeft=this._scrollLeft;const r=this._scrollLeft/(n-t);this._horizontalScrollbar.style.left=`${(t-a)*r}px`}else this._horizontalScrollbar.style.width="0px",this._horizontalScrollbar.style.left="0px",this._scrollLeft=0}}om.MouseWheelSpeed=1;class X5 extends Ge{get showTabsOverflowControl(){return this._showTabsOverflowControl}set showTabsOverflowControl(t){if(this._showTabsOverflowControl!=t&&(this._showTabsOverflowControl=t,t)){const n=new c5(this._tabsList);this._observerDisposable.value=new Ge(n,n.onDidChange(s=>{const a=s.hasScrollX||s.hasScrollY;this.toggleDropdown({reset:!a})}),Fe(this._tabsList,"scroll",()=>{this.toggleDropdown({reset:!1})}))}}get element(){return this._element}get panels(){return this._tabs.map(t=>t.value.panel.id)}get size(){return this._tabs.length}get tabs(){return this._tabs.map(t=>t.value)}constructor(t,n,s){if(super(),this.group=t,this.accessor=n,this._observerDisposable=new On,this._tabs=[],this.selectedIndex=-1,this._showTabsOverflowControl=!1,this._onTabDragStart=new te,this.onTabDragStart=this._onTabDragStart.event,this._onDrop=new te,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new te,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onOverflowTabsChange=new te,this.onOverflowTabsChange=this._onOverflowTabsChange.event,this._tabsList=document.createElement("div"),this._tabsList.className="dv-tabs-container dv-horizontal",this.showTabsOverflowControl=s.showTabsOverflowControl,n.options.scrollbars==="native")this._element=this._tabsList;else{const a=new om(this._tabsList);this._element=a.element,this.addDisposables(a)}this.addDisposables(this._onOverflowTabsChange,this._observerDisposable,this._onWillShowOverlay,this._onDrop,this._onTabDragStart,Fe(this.element,"pointerdown",a=>{if(a.defaultPrevented)return;a.button===0&&this.accessor.doSetGroupActive(this.group)}),Zt.from(()=>{for(const{value:a,disposable:r}of this._tabs)r.dispose(),a.dispose();this._tabs=[]}))}indexOf(t){return this._tabs.findIndex(n=>n.value.panel.id===t)}isActive(t){return this.selectedIndex>-1&&this._tabs[this.selectedIndex].value===t}setActivePanel(t){let n=0;for(const s of this._tabs){const a=t.id===s.value.panel.id;if(s.value.setActive(a),a){const r=s.value.element,o=r.parentElement;(n<o.scrollLeft||n+r.clientWidth>o.scrollLeft+o.clientWidth)&&(o.scrollLeft=n)}n+=s.value.element.clientWidth}}openPanel(t,n=this._tabs.length){if(this._tabs.find(o=>o.value.panel.id===t.id))return;const s=new F5(t,this.accessor,this.group);s.setContent(t.view.tab);const a=new Ge(s.onDragStart(o=>{this._onTabDragStart.fire({nativeEvent:o,panel:t})}),s.onPointerDown(o=>{if(o.defaultPrevented)return;const l=!this.accessor.options.disableFloatingGroups,c=this.group.api.location.type==="floating"&&this.size===1;if(l&&!c&&o.shiftKey){o.preventDefault();const d=this.accessor.getGroupPanel(s.panel.id),{top:h,left:f}=s.element.getBoundingClientRect(),{top:m,left:p}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(d,{x:f-p,y:h-m,inDragMode:!0});return}switch(o.button){case 0:this.group.activePanel!==t&&this.group.model.openPanel(t);break}}),s.onDrop(o=>{this._onDrop.fire({event:o.nativeEvent,index:this._tabs.findIndex(l=>l.value===s)})}),s.onWillShowOverlay(o=>{this._onWillShowOverlay.fire(new rm(o,{kind:"tab",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:En}))})),r={value:s,disposable:a};this.addTab(r,n)}delete(t){const n=this.indexOf(t),s=this._tabs.splice(n,1)[0],{value:a,disposable:r}=s;r.dispose(),a.dispose(),a.element.remove()}addTab(t,n=this._tabs.length){if(n<0||n>this._tabs.length)throw new Error("invalid location");this._tabsList.insertBefore(t.value.element,this._tabsList.children[n]),this._tabs=[...this._tabs.slice(0,n),t,...this._tabs.slice(n)],this.selectedIndex<0&&(this.selectedIndex=n)}toggleDropdown(t){const n=t.reset?[]:this._tabs.filter(s=>!x5(s.value.element,this._tabsList)).map(s=>s.value.panel.id);this._onOverflowTabsChange.fire({tabs:n,reset:t.reset})}updateDragAndDropState(){for(const t of this._tabs)t.value.updateDragAndDropState()}}const Hb=e=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttributeNS(null,"height",e.height),t.setAttributeNS(null,"width",e.width),t.setAttributeNS(null,"viewBox",e.viewbox),t.setAttributeNS(null,"aria-hidden","false"),t.setAttributeNS(null,"focusable","false"),t.classList.add("dv-svg");const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttributeNS(null,"d",e.path),t.appendChild(n),t},K5=()=>Hb({width:"11",height:"11",viewbox:"0 0 28 28",path:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"}),Z5=()=>Hb({width:"11",height:"11",viewbox:"0 0 24 15",path:"M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z"}),EA=()=>Hb({width:"11",height:"11",viewbox:"0 0 15 25",path:"M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z"});function Q5(){const e=document.createElement("div");e.className="dv-tabs-overflow-dropdown-default";const t=document.createElement("span");t.textContent="";const n=EA();return e.appendChild(n),e.appendChild(t),{element:e,update:s=>{t.textContent=`${s.tabs}`}}}class J5 extends Ge{get onTabDragStart(){return this.tabs.onTabDragStart}get panels(){return this.tabs.panels}get size(){return this.tabs.size}get hidden(){return this._hidden}set hidden(t){this._hidden=t,this.element.style.display=t?"none":""}get element(){return this._element}constructor(t,n){super(),this.accessor=t,this.group=n,this._hidden=!1,this.dropdownPart=null,this._overflowTabs=[],this._dropdownDisposable=new On,this._onDrop=new te,this.onDrop=this._onDrop.event,this._onGroupDragStart=new te,this.onGroupDragStart=this._onGroupDragStart.event,this._onWillShowOverlay=new te,this.onWillShowOverlay=this._onWillShowOverlay.event,this._element=document.createElement("div"),this._element.className="dv-tabs-and-actions-container",Pe(this._element,"dv-full-width-single-tab",this.accessor.options.singleTabMode==="fullwidth"),this.rightActionsContainer=document.createElement("div"),this.rightActionsContainer.className="dv-right-actions-container",this.leftActionsContainer=document.createElement("div"),this.leftActionsContainer.className="dv-left-actions-container",this.preActionsContainer=document.createElement("div"),this.preActionsContainer.className="dv-pre-actions-container",this.tabs=new X5(n,t,{showTabsOverflowControl:!t.options.disableTabsOverflowList}),this.voidContainer=new Y5(this.accessor,this.group),this._element.appendChild(this.preActionsContainer),this._element.appendChild(this.tabs.element),this._element.appendChild(this.leftActionsContainer),this._element.appendChild(this.voidContainer.element),this._element.appendChild(this.rightActionsContainer),this.addDisposables(this.tabs.onDrop(s=>this._onDrop.fire(s)),this.tabs.onWillShowOverlay(s=>this._onWillShowOverlay.fire(s)),t.onDidOptionsChange(()=>{this.tabs.showTabsOverflowControl=!t.options.disableTabsOverflowList}),this.tabs.onOverflowTabsChange(s=>{this.toggleDropdown(s)}),this.tabs,this._onWillShowOverlay,this._onDrop,this._onGroupDragStart,this.voidContainer,this.voidContainer.onDragStart(s=>{this._onGroupDragStart.fire({nativeEvent:s,group:this.group})}),this.voidContainer.onDrop(s=>{this._onDrop.fire({event:s.nativeEvent,index:this.tabs.size})}),this.voidContainer.onWillShowOverlay(s=>{this._onWillShowOverlay.fire(new rm(s,{kind:"header_space",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:En}))}),Fe(this.voidContainer.element,"pointerdown",s=>{if(s.defaultPrevented)return;if(!this.accessor.options.disableFloatingGroups&&s.shiftKey&&this.group.api.location.type!=="floating"){s.preventDefault();const{top:r,left:o}=this.element.getBoundingClientRect(),{top:l,left:c}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(this.group,{x:o-c+20,y:r-l+20,inDragMode:!0})}}))}show(){this.hidden||(this.element.style.display="")}hide(){this._element.style.display="none"}setRightActionsElement(t){this.rightActions!==t&&(this.rightActions&&(this.rightActions.remove(),this.rightActions=void 0),t&&(this.rightActionsContainer.appendChild(t),this.rightActions=t))}setLeftActionsElement(t){this.leftActions!==t&&(this.leftActions&&(this.leftActions.remove(),this.leftActions=void 0),t&&(this.leftActionsContainer.appendChild(t),this.leftActions=t))}setPrefixActionsElement(t){this.preActions!==t&&(this.preActions&&(this.preActions.remove(),this.preActions=void 0),t&&(this.preActionsContainer.appendChild(t),this.preActions=t))}isActive(t){return this.tabs.isActive(t)}indexOf(t){return this.tabs.indexOf(t)}setActive(t){}delete(t){this.tabs.delete(t),this.updateClassnames()}setActivePanel(t){this.tabs.setActivePanel(t)}openPanel(t,n=this.tabs.size){this.tabs.openPanel(t,n),this.updateClassnames()}closePanel(t){this.delete(t.id)}updateClassnames(){Pe(this._element,"dv-single-tab",this.size===1)}toggleDropdown(t){const n=t.reset?[]:t.tabs;if(this._overflowTabs=n,this._overflowTabs.length>0&&this.dropdownPart){this.dropdownPart.update({tabs:n.length});return}if(this._overflowTabs.length===0){this._dropdownDisposable.dispose();return}const s=document.createElement("div");s.className="dv-tabs-overflow-dropdown-root";const a=Q5();a.update({tabs:n.length}),this.dropdownPart=a,s.appendChild(a.element),this.rightActionsContainer.prepend(s),this._dropdownDisposable.value=new Ge(Zt.from(()=>{var r,o;s.remove(),(o=(r=this.dropdownPart)===null||r===void 0?void 0:r.dispose)===null||o===void 0||o.call(r),this.dropdownPart=null}),Fe(s,"pointerdown",r=>{r.preventDefault()},{capture:!0}),Fe(s,"click",r=>{const o=document.createElement("div");o.style.overflow="auto",o.className="dv-tabs-overflow-container";for(const c of this.tabs.tabs.filter(d=>this._overflowTabs.includes(d.panel.id))){const d=this.group.panels.find(p=>p===c.panel),f=d.view.createTabRenderer("headerOverflow").element,m=document.createElement("div");Pe(m,"dv-tab",!0),Pe(m,"dv-active-tab",d.api.isActive),Pe(m,"dv-inactive-tab",!d.api.isActive),m.addEventListener("click",p=>{this.accessor.popupService.close(),!p.defaultPrevented&&(c.element.scrollIntoView(),c.panel.api.setActive())}),m.appendChild(f),o.appendChild(m)}const l=w5(s);this.accessor.popupService.openPopover(o,{x:r.clientX,y:r.clientY,zIndex:l!=null&&l.style.zIndex?`calc(${l.style.zIndex} * 2)`:void 0})}))}updateDragAndDropState(){this.tabs.updateDragAndDropState(),this.voidContainer.updateDragAndDropState()}}class AA extends mA{constructor(t,n,s,a,r){super(),this.nativeEvent=t,this.target=n,this.position=s,this.getData=a,this.group=r}}const mx=Object.keys({disableAutoResizing:void 0,hideBorders:void 0,singleTabMode:void 0,disableFloatingGroups:void 0,floatingGroupBounds:void 0,popoutUrl:void 0,defaultRenderer:void 0,debug:void 0,rootOverlayModel:void 0,locked:void 0,disableDnd:void 0,className:void 0,noPanelsOverlay:void 0,dndEdges:void 0,theme:void 0,disableTabsOverflowList:void 0,scrollbars:void 0});function e8(e){return!!e.referencePanel}function t8(e){return!!e.referenceGroup}function n8(e){return!!e.referencePanel}function s8(e){return!!e.referenceGroup}class Vb extends $b{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get panel(){return this.options.panel}get group(){return this.options.group}get api(){return this.options.api}constructor(t){super(),this.options=t}getData(){return this.options.getData()}}class RA extends Vb{get kind(){return this._kind}constructor(t){super(t),this._kind=t.kind}}class i8 extends Ge{get element(){throw new Error("dockview: not supported")}get activePanel(){return this._activePanel}get locked(){return this._locked}set locked(t){this._locked=t,Pe(this.container,"dv-locked-groupview",t==="no-drop-target"||t)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return this._panels.length===0}get hasWatermark(){return!!(this.watermark&&this.container.contains(this.watermark.element))}get header(){return this.tabsContainer}get isContentFocused(){return document.activeElement?rx(document.activeElement,this.contentContainer.element):!1}get location(){return this._location}set location(t){switch(this._location=t,Pe(this.container,"dv-groupview-floating",!1),Pe(this.container,"dv-groupview-popout",!1),t.type){case"grid":this.contentContainer.dropTarget.setTargetZones(["top","bottom","left","right","center"]);break;case"floating":this.contentContainer.dropTarget.setTargetZones(["center"]),this.contentContainer.dropTarget.setTargetZones(t?["center"]:["top","bottom","left","right","center"]),Pe(this.container,"dv-groupview-floating",!0);break;case"popout":this.contentContainer.dropTarget.setTargetZones(["center"]),Pe(this.container,"dv-groupview-popout",!0);break}this.groupPanel.api._onDidLocationChange.fire({location:this.location})}constructor(t,n,s,a,r){var o;super(),this.container=t,this.accessor=n,this.id=s,this.options=a,this.groupPanel=r,this._isGroupActive=!1,this._locked=!1,this._location={type:"grid"},this.mostRecentlyUsed=[],this._overwriteRenderContainer=null,this._overwriteDropTargetContainer=null,this._onDidChange=new te,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._panelDisposables=new Map,this._onMove=new te,this.onMove=this._onMove.event,this._onDidDrop=new te,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new te,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new te,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onTabDragStart=new te,this.onTabDragStart=this._onTabDragStart.event,this._onGroupDragStart=new te,this.onGroupDragStart=this._onGroupDragStart.event,this._onDidAddPanel=new te,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPanelTitleChange=new te,this.onDidPanelTitleChange=this._onDidPanelTitleChange.event,this._onDidPanelParametersChange=new te,this.onDidPanelParametersChange=this._onDidPanelParametersChange.event,this._onDidRemovePanel=new te,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidActivePanelChange=new te,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onUnhandledDragOverEvent=new te,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,Pe(this.container,"dv-groupview",!0),this._api=new Gh(this.accessor),this.tabsContainer=new J5(this.accessor,this.groupPanel),this.contentContainer=new B5(this.accessor,this),t.append(this.tabsContainer.element,this.contentContainer.element),this.header.hidden=!!a.hideHeader,this.locked=(o=a.locked)!==null&&o!==void 0?o:!1,this.addDisposables(this._onTabDragStart,this._onGroupDragStart,this._onWillShowOverlay,this.tabsContainer.onTabDragStart(l=>{this._onTabDragStart.fire(l)}),this.tabsContainer.onGroupDragStart(l=>{this._onGroupDragStart.fire(l)}),this.tabsContainer.onDrop(l=>{this.handleDropEvent("header",l.event,"center",l.index)}),this.contentContainer.onDidFocus(()=>{this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.onDidBlur(()=>{}),this.contentContainer.dropTarget.onDrop(l=>{this.handleDropEvent("content",l.nativeEvent,l.position)}),this.tabsContainer.onWillShowOverlay(l=>{this._onWillShowOverlay.fire(l)}),this.contentContainer.dropTarget.onWillShowOverlay(l=>{this._onWillShowOverlay.fire(new rm(l,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:En}))}),this._onMove,this._onDidChange,this._onDidDrop,this._onWillDrop,this._onDidAddPanel,this._onDidRemovePanel,this._onDidActivePanelChange,this._onUnhandledDragOverEvent,this._onDidPanelTitleChange,this._onDidPanelParametersChange)}focusContent(){this.contentContainer.element.focus()}set renderContainer(t){this.panels.forEach(n=>{this.renderContainer.detatch(n)}),this._overwriteRenderContainer=t,this.panels.forEach(n=>{this.rerender(n)})}get renderContainer(){var t;return(t=this._overwriteRenderContainer)!==null&&t!==void 0?t:this.accessor.overlayRenderContainer}set dropTargetContainer(t){this._overwriteDropTargetContainer=t}get dropTargetContainer(){var t;return(t=this._overwriteDropTargetContainer)!==null&&t!==void 0?t:this.accessor.rootDropTargetContainer}initialize(){this.options.panels&&this.options.panels.forEach(t=>{this.doAddPanel(t)}),this.options.activePanel&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0),this.updateContainer(),this.accessor.options.createRightHeaderActionComponent&&(this._rightHeaderActions=this.accessor.options.createRightHeaderActionComponent(this.groupPanel),this.addDisposables(this._rightHeaderActions),this._rightHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element)),this.accessor.options.createLeftHeaderActionComponent&&(this._leftHeaderActions=this.accessor.options.createLeftHeaderActionComponent(this.groupPanel),this.addDisposables(this._leftHeaderActions),this._leftHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element)),this.accessor.options.createPrefixHeaderActionComponent&&(this._prefixHeaderActions=this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel),this.addDisposables(this._prefixHeaderActions),this._prefixHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element))}rerender(t){this.contentContainer.renderPanel(t,{asActive:!1})}indexOf(t){return this.tabsContainer.indexOf(t.id)}toJSON(){var t;const n={views:this.tabsContainer.panels,activeView:(t=this._activePanel)===null||t===void 0?void 0:t.id,id:this.id};return this.locked!==!1&&(n.locked=this.locked),this.header.hidden&&(n.hideHeader=!0),n}moveToNext(t){t||(t={}),t.panel||(t.panel=this.activePanel);const n=t.panel?this.panels.indexOf(t.panel):-1;let s;if(n<this.panels.length-1)s=n+1;else if(!t.suppressRoll)s=0;else return;this.openPanel(this.panels[s])}moveToPrevious(t){if(t||(t={}),t.panel||(t.panel=this.activePanel),!t.panel)return;const n=this.panels.indexOf(t.panel);let s;if(n>0)s=n-1;else if(!t.suppressRoll)s=this.panels.length-1;else return;this.openPanel(this.panels[s])}containsPanel(t){return this.panels.includes(t)}init(t){}update(t){}focus(){var t;(t=this._activePanel)===null||t===void 0||t.focus()}openPanel(t,n={}){(typeof n.index!="number"||n.index>this.panels.length)&&(n.index=this.panels.length);const s=!!n.skipSetActive;if(t.updateParentGroup(this.groupPanel,{skipSetActive:n.skipSetActive}),this.doAddPanel(t,n.index,{skipSetActive:s}),this._activePanel===t){this.contentContainer.renderPanel(t,{asActive:!0});return}s||this.doSetActivePanel(t),n.skipSetGroupActive||this.accessor.doSetGroupActive(this.groupPanel),n.skipSetActive||this.updateContainer()}removePanel(t,n={skipSetActive:!1}){const s=typeof t=="string"?t:t.id,a=this._panels.find(r=>r.id===s);if(!a)throw new Error("invalid operation");return this._removePanel(a,n)}closeAllPanels(){if(this.panels.length>0){const t=[...this.panels];for(const n of t)this.doClose(n)}else this.accessor.removeGroup(this.groupPanel)}closePanel(t){this.doClose(t)}doClose(t){const n=this.panels.length===1&&this.accessor.groups.length===1;this.accessor.removePanel(t,n&&this.accessor.options.noPanelsOverlay==="emptyGroup"?{removeEmptyGroup:!1}:void 0)}isPanelActive(t){return this._activePanel===t}updateActions(t){this.tabsContainer.setRightActionsElement(t)}setActive(t,n=!1){!n&&this.isActive===t||(this._isGroupActive=t,Pe(this.container,"dv-active-group",t),Pe(this.container,"dv-inactive-group",!t),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0&&this.doSetActivePanel(this.panels[0]),this.updateContainer())}layout(t,n){var s;this._width=t,this._height=n,this.contentContainer.layout(this._width,this._height),!((s=this._activePanel)===null||s===void 0)&&s.layout&&this._activePanel.layout(this._width,this._height)}_removePanel(t,n){const s=this._activePanel===t;if(this.doRemovePanel(t),s&&this.panels.length>0){const a=this.mostRecentlyUsed[0];this.openPanel(a,{skipSetActive:n.skipSetActive,skipSetGroupActive:n.skipSetActiveGroup})}return this._activePanel&&this.panels.length===0&&this.doSetActivePanel(void 0),n.skipSetActive||this.updateContainer(),t}doRemovePanel(t){const n=this.panels.indexOf(t);if(this._activePanel===t&&this.contentContainer.closePanel(),this.tabsContainer.delete(t.id),this._panels.splice(n,1),this.mostRecentlyUsed.includes(t)){const a=this.mostRecentlyUsed.indexOf(t);this.mostRecentlyUsed.splice(a,1)}const s=this._panelDisposables.get(t.id);s&&(s.dispose(),this._panelDisposables.delete(t.id)),this._onDidRemovePanel.fire({panel:t})}doAddPanel(t,n=this.panels.length,s={skipSetActive:!1}){const r=this._panels.indexOf(t)>-1;this.tabsContainer.show(),this.contentContainer.show(),this.tabsContainer.openPanel(t,n),s.skipSetActive||this.contentContainer.openPanel(t),!r&&(this.updateMru(t),this.panels.splice(n,0,t),this._panelDisposables.set(t.id,new Ge(t.api.onDidTitleChange(o=>this._onDidPanelTitleChange.fire(o)),t.api.onDidParametersChange(o=>this._onDidPanelParametersChange.fire(o)))),this._onDidAddPanel.fire({panel:t}))}doSetActivePanel(t){this._activePanel!==t&&(this._activePanel=t,t&&(this.tabsContainer.setActivePanel(t),t.layout(this._width,this._height),this.updateMru(t),this._onDidActivePanelChange.fire({panel:t})))}updateMru(t){this.mostRecentlyUsed.includes(t)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(t),1),this.mostRecentlyUsed=[t,...this.mostRecentlyUsed]}updateContainer(){var t,n;if(this.panels.forEach(s=>s.runEvents()),this.isEmpty&&!this.watermark){const s=this.accessor.createWatermarkComponent();s.init({containerApi:this._api,group:this.groupPanel}),this.watermark=s,Fe(this.watermark.element,"pointerdown",()=>{this.isActive||this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.element.appendChild(this.watermark.element)}!this.isEmpty&&this.watermark&&(this.watermark.element.remove(),(n=(t=this.watermark).dispose)===null||n===void 0||n.call(t),this.watermark=void 0)}canDisplayOverlay(t,n,s){const a=new AA(t,s,n,En,this.accessor.getPanel(this.id));return this._onUnhandledDragOverEvent.fire(a),a.isAccepted}handleDropEvent(t,n,s,a){if(this.locked==="no-drop-target")return;function r(){switch(t){case"header":return typeof a=="number"?"tab":"header_space";case"content":return"content"}}const o=typeof a=="number"?this.panels[a]:void 0,l=new RA({nativeEvent:n,position:s,panel:o,getData:()=>En(),kind:r(),group:this.groupPanel,api:this._api});if(this._onWillDrop.fire(l),l.defaultPrevented)return;const c=En();if(c&&c.viewId===this.accessor.id){if(t==="content"&&c.groupId===this.id&&(s==="center"||c.panelId===null)||t==="header"&&c.groupId===this.id&&c.panelId===null)return;if(c.panelId===null){const{groupId:p}=c;this._onMove.fire({target:s,groupId:p,index:a});return}if(this.tabsContainer.indexOf(c.panelId)!==-1&&this.tabsContainer.size===1)return;const{groupId:h,panelId:f}=c;if(this.id===h&&!s&&this.tabsContainer.indexOf(f)===a)return;this._onMove.fire({target:s,groupId:c.groupId,itemId:c.panelId,index:a})}else this._onDidDrop.fire(new Vb({nativeEvent:n,position:s,panel:o,getData:()=>En(),group:this.groupPanel,api:this._api}))}updateDragAndDropState(){this.tabsContainer.updateDragAndDropState()}dispose(){var t,n,s;super.dispose(),(t=this.watermark)===null||t===void 0||t.element.remove(),(s=(n=this.watermark)===null||n===void 0?void 0:n.dispose)===null||s===void 0||s.call(n),this.watermark=void 0;for(const a of this.panels)a.dispose();this.tabsContainer.dispose(),this.contentContainer.dispose()}}class Ub extends SA{constructor(t,n,s){super(t,n),this._onDidConstraintsChangeInternal=new te,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new te,this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new te,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange),s&&this.initialize(s)}setConstraints(t){this._onDidConstraintsChangeInternal.fire(t)}setSize(t){this._onDidSizeChange.fire(t)}}class TA extends Gb{get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){return this.__minimumWidth()}get minimumHeight(){return this.__minimumHeight()}get maximumHeight(){return this.__maximumHeight()}get maximumWidth(){return this.__maximumWidth()}__minimumWidth(){const t=typeof this._minimumWidth=="function"?this._minimumWidth():this._minimumWidth;return t!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=t,this.updateConstraints()),t}__maximumWidth(){const t=typeof this._maximumWidth=="function"?this._maximumWidth():this._maximumWidth;return t!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=t,this.updateConstraints()),t}__minimumHeight(){const t=typeof this._minimumHeight=="function"?this._minimumHeight():this._minimumHeight;return t!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=t,this.updateConstraints()),t}__maximumHeight(){const t=typeof this._maximumHeight=="function"?this._maximumHeight():this._maximumHeight;return t!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=t,this.updateConstraints()),t}get isActive(){return this.api.isActive}get isVisible(){return this.api.isVisible}constructor(t,n,s,a){super(t,n,a??new Ub(t,n)),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new te,this.onDidChange=this._onDidChange.event,typeof(s==null?void 0:s.minimumWidth)=="number"&&(this._minimumWidth=s.minimumWidth),typeof(s==null?void 0:s.maximumWidth)=="number"&&(this._maximumWidth=s.maximumWidth),typeof(s==null?void 0:s.minimumHeight)=="number"&&(this._minimumHeight=s.minimumHeight),typeof(s==null?void 0:s.maximumHeight)=="number"&&(this._maximumHeight=s.maximumHeight),this.api.initialize(this),this.addDisposables(this.api.onWillVisibilityChange(r=>{const{isVisible:o}=r,{accessor:l}=this._params;l.setVisible(this,o)}),this.api.onActiveChange(()=>{const{accessor:r}=this._params;r.doSetGroupActive(this)}),this.api.onDidConstraintsChangeInternal(r=>{(typeof r.minimumWidth=="number"||typeof r.minimumWidth=="function")&&(this._minimumWidth=r.minimumWidth),(typeof r.minimumHeight=="number"||typeof r.minimumHeight=="function")&&(this._minimumHeight=r.minimumHeight),(typeof r.maximumWidth=="number"||typeof r.maximumWidth=="function")&&(this._maximumWidth=r.maximumWidth),(typeof r.maximumHeight=="number"||typeof r.maximumHeight=="function")&&(this._maximumHeight=r.maximumHeight)}),this.api.onDidSizeChange(r=>{this._onDidChange.fire({height:r.height,width:r.width})}),this._onDidChange)}setVisible(t){this.api._onDidVisibilityChange.fire({isVisible:t})}setActive(t){this.api._onDidActiveChange.fire({isActive:t})}init(t){t.maximumHeight&&(this._maximumHeight=t.maximumHeight),t.minimumHeight&&(this._minimumHeight=t.minimumHeight),t.maximumWidth&&(this._maximumWidth=t.maximumWidth),t.minimumWidth&&(this._minimumWidth=t.minimumWidth),this._priority=t.priority,this._snap=!!t.snap,super.init(t),typeof t.isVisible=="boolean"&&this.setVisible(t.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const t=super.toJSON(),n=a=>a===Number.MAX_SAFE_INTEGER?void 0:a,s=a=>a<=0?void 0:a;return Object.assign(Object.assign({},t),{minimumHeight:s(this.minimumHeight),maximumHeight:n(this.maximumHeight),minimumWidth:s(this.minimumWidth),maximumWidth:n(this.maximumWidth),snap:this.snap,priority:this.priority})}}const $l="dockview: DockviewGroupPanelApiImpl not initialized";class a8 extends Ub{get location(){if(!this._group)throw new Error($l);return this._group.model.location}constructor(t,n){super(t,"__dockviewgroup__"),this.accessor=n,this._onDidLocationChange=new te,this.onDidLocationChange=this._onDidLocationChange.event,this._onDidActivePanelChange=new te,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this.addDisposables(this._onDidLocationChange,this._onDidActivePanelChange)}close(){if(this._group)return this.accessor.removeGroup(this._group)}getWindow(){return this.location.type==="popout"?this.location.getWindow():window}moveTo(t){var n,s,a,r;if(!this._group)throw new Error($l);const o=(n=t.group)!==null&&n!==void 0?n:this.accessor.addGroup({direction:NA((s=t.position)!==null&&s!==void 0?s:"right"),skipSetActive:(a=t.skipSetActive)!==null&&a!==void 0?a:!1});this.accessor.moveGroupOrPanel({from:{groupId:this._group.id},to:{group:o,position:t.group&&(r=t.position)!==null&&r!==void 0?r:"center",index:t.index},skipSetActive:t.skipSetActive})}maximize(){if(!this._group)throw new Error($l);this.location.type==="grid"&&this.accessor.maximizeGroup(this._group)}isMaximized(){if(!this._group)throw new Error($l);return this.accessor.isMaximizedGroup(this._group)}exitMaximized(){if(!this._group)throw new Error($l);this.isMaximized()&&this.accessor.exitMaximizedGroup()}initialize(t){this._group=t}}const r8=100,o8=100;class Z_ extends TA{get minimumWidth(){var t;const n=(t=this.activePanel)===null||t===void 0?void 0:t.minimumWidth;return typeof n=="number"?n:super.__minimumWidth()}get minimumHeight(){var t;const n=(t=this.activePanel)===null||t===void 0?void 0:t.minimumHeight;return typeof n=="number"?n:super.__minimumHeight()}get maximumWidth(){var t;const n=(t=this.activePanel)===null||t===void 0?void 0:t.maximumWidth;return typeof n=="number"?n:super.__maximumWidth()}get maximumHeight(){var t;const n=(t=this.activePanel)===null||t===void 0?void 0:t.maximumHeight;return typeof n=="number"?n:super.__maximumHeight()}get panels(){return this._model.panels}get activePanel(){return this._model.activePanel}get size(){return this._model.size}get model(){return this._model}get locked(){return this._model.locked}set locked(t){this._model.locked=t}get header(){return this._model.header}constructor(t,n,s){var a,r,o,l,c,d;super(n,"groupview_default",{minimumHeight:(r=(a=s.constraints)===null||a===void 0?void 0:a.minimumHeight)!==null&&r!==void 0?r:o8,minimumWidth:(l=(o=s.constraints)===null||o===void 0?void 0:o.maximumHeight)!==null&&l!==void 0?l:r8,maximumHeight:(c=s.constraints)===null||c===void 0?void 0:c.maximumHeight,maximumWidth:(d=s.constraints)===null||d===void 0?void 0:d.maximumWidth},new a8(n,t)),this.api.initialize(this),this._model=new i8(this.element,t,n,s,this),this.addDisposables(this.model.onDidActivePanelChange(h=>{this.api._onDidActivePanelChange.fire(h)}))}focus(){this.api.isActive||this.api.setActive(),super.focus()}initialize(){this._model.initialize()}setActive(t){super.setActive(t),this.model.setActive(t)}layout(t,n){super.layout(t,n),this.model.layout(t,n)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}}const l8={className:"dockview-theme-abyss"};class c8 extends Ub{get location(){return this.group.api.location}get title(){return this.panel.title}get isGroupActive(){return this.group.isActive}get renderer(){return this.panel.renderer}set group(t){const n=this._group;this._group!==t&&(this._group=t,this._onDidGroupChange.fire({}),this.setupGroupEventListeners(n),this._onDidLocationChange.fire({location:this.group.api.location}))}get group(){return this._group}get tabComponent(){return this._tabComponent}constructor(t,n,s,a,r){super(t.id,a),this.panel=t,this.accessor=s,this._onDidTitleChange=new te,this.onDidTitleChange=this._onDidTitleChange.event,this._onDidActiveGroupChange=new te,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._onDidGroupChange=new te,this.onDidGroupChange=this._onDidGroupChange.event,this._onDidRendererChange=new te,this.onDidRendererChange=this._onDidRendererChange.event,this._onDidLocationChange=new te,this.onDidLocationChange=this._onDidLocationChange.event,this.groupEventsDisposable=new On,this._tabComponent=r,this.initialize(t),this._group=n,this.setupGroupEventListeners(),this.addDisposables(this.groupEventsDisposable,this._onDidRendererChange,this._onDidTitleChange,this._onDidGroupChange,this._onDidActiveGroupChange,this._onDidLocationChange)}getWindow(){return this.group.api.getWindow()}moveTo(t){var n,s;this.accessor.moveGroupOrPanel({from:{groupId:this._group.id,panelId:this.panel.id},to:{group:(n=t.group)!==null&&n!==void 0?n:this._group,position:t.group&&(s=t.position)!==null&&s!==void 0?s:"center",index:t.index},skipSetActive:t.skipSetActive})}setTitle(t){this.panel.setTitle(t)}setRenderer(t){this.panel.setRenderer(t)}close(){this.group.model.closePanel(this.panel)}maximize(){this.group.api.maximize()}isMaximized(){return this.group.api.isMaximized()}exitMaximized(){this.group.api.exitMaximized()}setupGroupEventListeners(t){var n;let s=(n=t==null?void 0:t.isActive)!==null&&n!==void 0?n:!1;this.groupEventsDisposable.value=new Ge(this.group.api.onDidVisibilityChange(a=>{const r=!a.isVisible&&this.isVisible,o=a.isVisible&&!this.isVisible,l=this.group.model.isPanelActive(this.panel);(r||o&&l)&&this._onDidVisibilityChange.fire(a)}),this.group.api.onDidLocationChange(a=>{this.group===this.panel.group&&this._onDidLocationChange.fire(a)}),this.group.api.onDidActiveChange(()=>{this.group===this.panel.group&&s!==this.isGroupActive&&(s=this.isGroupActive,this._onDidActiveGroupChange.fire({isActive:this.isGroupActive}))}))}}class ao extends Ge{get params(){return this._params}get title(){return this._title}get group(){return this._group}get renderer(){var t;return(t=this._renderer)!==null&&t!==void 0?t:this.accessor.renderer}get minimumWidth(){return this._minimumWidth}get minimumHeight(){return this._minimumHeight}get maximumWidth(){return this._maximumWidth}get maximumHeight(){return this._maximumHeight}constructor(t,n,s,a,r,o,l,c){super(),this.id=t,this.accessor=a,this.containerApi=r,this.view=l,this._renderer=c.renderer,this._group=o,this._minimumWidth=c.minimumWidth,this._minimumHeight=c.minimumHeight,this._maximumWidth=c.maximumWidth,this._maximumHeight=c.maximumHeight,this.api=new c8(this,this._group,a,n,s),this.addDisposables(this.api.onActiveChange(()=>{a.setActivePanel(this)}),this.api.onDidSizeChange(d=>{this.group.api.setSize(d)}),this.api.onDidRendererChange(()=>{this.group.model.rerender(this)}))}init(t){this._params=t.params,this.view.init(Object.assign(Object.assign({},t),{api:this.api,containerApi:this.containerApi})),this.setTitle(t.title)}focus(){const t=new kA;this.api._onWillFocus.fire(t),!t.defaultPrevented&&(this.api.isActive||this.api.setActive())}toJSON(){return{id:this.id,contentComponent:this.view.contentComponent,tabComponent:this.view.tabComponent,params:Object.keys(this._params||{}).length>0?this._params:void 0,title:this.title,renderer:this._renderer,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,minimumWidth:this._minimumWidth,maximumWidth:this._maximumWidth}}setTitle(t){t!==this.title&&(this._title=t,this.api._onDidTitleChange.fire({title:t}))}setRenderer(t){t!==this.renderer&&(this._renderer=t,this.api._onDidRendererChange.fire({renderer:t}))}update(t){var n;this._params=Object.assign(Object.assign({},(n=this._params)!==null&&n!==void 0?n:{}),t.params);for(const s of Object.keys(t.params))t.params[s]===void 0&&delete this._params[s];this.view.update({params:this._params})}updateParentGroup(t,n){this._group=t,this.api.group=this._group;const s=this._group.model.isPanelActive(this),a=this.group.api.isActive&&s;n!=null&&n.skipSetActive||this.api.isActive!==a&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&s}),this.api.isVisible!==s&&this.api._onDidVisibilityChange.fire({isVisible:s})}runEvents(){const t=this._group.model.isPanelActive(this),n=this.group.api.isActive&&t;this.api.isActive!==n&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&t}),this.api.isVisible!==t&&this.api._onDidVisibilityChange.fire({isVisible:t})}layout(t,n){this.api._onDidDimensionChange.fire({width:t,height:n}),this.view.layout(t,n)}dispose(){this.api.dispose(),this.view.dispose()}}class Q_ extends Ge{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-default-tab",this._content=document.createElement("div"),this._content.className="dv-default-tab-content",this.action=document.createElement("div"),this.action.className="dv-default-tab-action",this.action.appendChild(K5()),this._element.appendChild(this._content),this._element.appendChild(this.action),this.render()}init(t){this._title=t.title,this.addDisposables(t.api.onDidTitleChange(n=>{this._title=n.title,this.render()}),Fe(this.action,"pointerdown",n=>{n.preventDefault()}),Fe(this.action,"click",n=>{n.defaultPrevented||(n.preventDefault(),t.api.close())})),this.render()}render(){var t;this._content.textContent!==this._title&&(this._content.textContent=(t=this._title)!==null&&t!==void 0?t:"")}}class OA{get content(){return this._content}get tab(){return this._tab}constructor(t,n,s,a){this.accessor=t,this.id=n,this.contentComponent=s,this.tabComponent=a,this._content=this.createContentComponent(this.id,s),this._tab=this.createTabComponent(this.id,a)}createTabRenderer(t){var n;const s=this.createTabComponent(this.id,this.tabComponent);return this._params&&s.init(Object.assign(Object.assign({},this._params),{tabLocation:t})),this._updateEvent&&((n=s.update)===null||n===void 0||n.call(s,this._updateEvent)),s}init(t){this._params=t,this.content.init(t),this.tab.init(Object.assign(Object.assign({},t),{tabLocation:"header"}))}layout(t,n){var s,a;(a=(s=this.content).layout)===null||a===void 0||a.call(s,t,n)}update(t){var n,s,a,r;this._updateEvent=t,(s=(n=this.content).update)===null||s===void 0||s.call(n,t),(r=(a=this.tab).update)===null||r===void 0||r.call(a,t)}dispose(){var t,n,s,a;(n=(t=this.content).dispose)===null||n===void 0||n.call(t),(a=(s=this.tab).dispose)===null||a===void 0||a.call(s)}createContentComponent(t,n){return this.accessor.options.createComponent({id:t,name:n})}createTabComponent(t,n){const s=n??this.accessor.options.defaultTabComponent;if(s){if(this.accessor.options.createTabComponent){const a=this.accessor.options.createTabComponent({id:t,name:s});return a||new Q_}console.warn(`dockview: tabComponent '${n}' was not found. falling back to the default tab.`)}return new Q_}}class d8{constructor(t){this.accessor=t}fromJSON(t,n){var s,a;const r=t.id,o=t.params,l=t.title,c=t.view,d=c?c.content.id:(s=t.contentComponent)!==null&&s!==void 0?s:"unknown",h=c?(a=c.tab)===null||a===void 0?void 0:a.id:t.tabComponent,f=new OA(this.accessor,r,d,h),m=new ao(r,d,h,this.accessor,new Gh(this.accessor),n,f,{renderer:t.renderer,minimumWidth:t.minimumWidth,minimumHeight:t.minimumHeight,maximumWidth:t.maximumWidth,maximumHeight:t.maximumHeight});return m.init({title:l??r,params:o??{}}),m}}class u8 extends Ge{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-watermark"}init(t){}}class h8{constructor(){this._orderedList=[]}push(t){this._orderedList=[...this._orderedList.filter(n=>n!==t),t],this.update()}destroy(t){this._orderedList=this._orderedList.filter(n=>n!==t),this.update()}update(){for(let t=0;t<this._orderedList.length;t++)this._orderedList[t].setAttribute("aria-level",`${t}`),this._orderedList[t].style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${t*2})`}}const uu=new h8;class wa extends Ge{set minimumInViewportWidth(t){this.options.minimumInViewportWidth=t}set minimumInViewportHeight(t){this.options.minimumInViewportHeight=t}get element(){return this._element}get isVisible(){return this._isVisible}constructor(t){super(),this.options=t,this._element=document.createElement("div"),this._onDidChange=new te,this.onDidChange=this._onDidChange.event,this._onDidChangeEnd=new te,this.onDidChangeEnd=this._onDidChangeEnd.event,this.addDisposables(this._onDidChange,this._onDidChangeEnd),this._element.className="dv-resize-container",this._isVisible=!0,this.setupResize("top"),this.setupResize("bottom"),this.setupResize("left"),this.setupResize("right"),this.setupResize("topleft"),this.setupResize("topright"),this.setupResize("bottomleft"),this.setupResize("bottomright"),this._element.appendChild(this.options.content),this.options.container.appendChild(this._element),this.setBounds(Object.assign(Object.assign(Object.assign(Object.assign({height:this.options.height,width:this.options.width},"top"in this.options&&{top:this.options.top}),"bottom"in this.options&&{bottom:this.options.bottom}),"left"in this.options&&{left:this.options.left}),"right"in this.options&&{right:this.options.right})),uu.push(this._element)}setVisible(t){t!==this.isVisible&&(this._isVisible=t,Pe(this.element,"dv-hidden",!this.isVisible))}bringToFront(){uu.push(this._element)}setBounds(t={}){typeof t.height=="number"&&(this._element.style.height=`${t.height}px`),typeof t.width=="number"&&(this._element.style.width=`${t.width}px`),"top"in t&&typeof t.top=="number"&&(this._element.style.top=`${t.top}px`,this._element.style.bottom="auto",this.verticalAlignment="top"),"bottom"in t&&typeof t.bottom=="number"&&(this._element.style.bottom=`${t.bottom}px`,this._element.style.top="auto",this.verticalAlignment="bottom"),"left"in t&&typeof t.left=="number"&&(this._element.style.left=`${t.left}px`,this._element.style.right="auto",this.horiziontalAlignment="left"),"right"in t&&typeof t.right=="number"&&(this._element.style.right=`${t.right}px`,this._element.style.left="auto",this.horiziontalAlignment="right");const n=this.options.container.getBoundingClientRect(),s=this._element.getBoundingClientRect(),a=Math.max(0,this.getMinimumWidth(s.width)),r=Math.max(0,this.getMinimumHeight(s.height));if(this.verticalAlignment==="top"){const o=Rt(s.top-n.top,-r,Math.max(0,n.height-s.height+r));this._element.style.top=`${o}px`,this._element.style.bottom="auto"}if(this.verticalAlignment==="bottom"){const o=Rt(n.bottom-s.bottom,-r,Math.max(0,n.height-s.height+r));this._element.style.bottom=`${o}px`,this._element.style.top="auto"}if(this.horiziontalAlignment==="left"){const o=Rt(s.left-n.left,-a,Math.max(0,n.width-s.width+a));this._element.style.left=`${o}px`,this._element.style.right="auto"}if(this.horiziontalAlignment==="right"){const o=Rt(n.right-s.right,-a,Math.max(0,n.width-s.width+a));this._element.style.right=`${o}px`,this._element.style.left="auto"}this._onDidChange.fire()}toJSON(){const t=this.options.container.getBoundingClientRect(),n=this._element.getBoundingClientRect(),s={};return this.verticalAlignment==="top"?s.top=parseFloat(this._element.style.top):this.verticalAlignment==="bottom"?s.bottom=parseFloat(this._element.style.bottom):s.top=n.top-t.top,this.horiziontalAlignment==="left"?s.left=parseFloat(this._element.style.left):this.horiziontalAlignment==="right"?s.right=parseFloat(this._element.style.right):s.left=n.left-t.left,s.width=n.width,s.height=n.height,s}setupDrag(t,n={inDragMode:!1}){const s=new On,a=()=>{let r=null;const o=Ph();s.value=new Ge({dispose:()=>{o.release()}},Fe(window,"pointermove",l=>{const c=this.options.container.getBoundingClientRect(),d=l.clientX-c.left,h=l.clientY-c.top;Pe(this._element,"dv-resize-container-dragging",!0);const f=this._element.getBoundingClientRect();r===null&&(r={x:l.clientX-f.left,y:l.clientY-f.top});const m=Math.max(0,this.getMinimumWidth(f.width)),p=Math.max(0,this.getMinimumHeight(f.height)),y=Rt(h-r.y,-p,Math.max(0,c.height-f.height+p)),g=Rt(r.y-h+c.height-f.height,-p,Math.max(0,c.height-f.height+p)),b=Rt(d-r.x,-m,Math.max(0,c.width-f.width+m)),v=Rt(r.x-d+c.width-f.width,-m,Math.max(0,c.width-f.width+m)),x={};y<=g?x.top=y:x.bottom=g,b<=v?x.left=b:x.right=v,this.setBounds(x)}),Fe(window,"pointerup",()=>{Pe(this._element,"dv-resize-container-dragging",!1),s.dispose(),this._onDidChangeEnd.fire()}))};this.addDisposables(s,Fe(t,"pointerdown",r=>{if(r.defaultPrevented){r.preventDefault();return}Y_(r)||a()}),Fe(this.options.content,"pointerdown",r=>{r.defaultPrevented||Y_(r)||r.shiftKey&&a()}),Fe(this.options.content,"pointerdown",()=>{uu.push(this._element)},!0)),n.inDragMode&&a()}setupResize(t){const n=document.createElement("div");n.className=`dv-resize-handle-${t}`,this._element.appendChild(n);const s=new On;this.addDisposables(s,Fe(n,"pointerdown",a=>{a.preventDefault();let r=null;const o=Ph();s.value=new Ge(Fe(window,"pointermove",l=>{const c=this.options.container.getBoundingClientRect(),d=this._element.getBoundingClientRect(),h=l.clientY-c.top,f=l.clientX-c.left;r===null&&(r={originalY:h,originalHeight:d.height,originalX:f,originalWidth:d.width});let m,p,y,g,b,v;const x=()=>{m=Rt(h,-Number.MAX_VALUE,r.originalY+r.originalHeight>c.height?this.getMinimumHeight(c.height):Math.max(0,r.originalY+r.originalHeight-wa.MINIMUM_HEIGHT)),y=r.originalY+r.originalHeight-m,p=c.height-m-y},w=()=>{m=r.originalY-r.originalHeight,y=Rt(h-m,m<0&&typeof this.options.minimumInViewportHeight=="number"?-m+this.options.minimumInViewportHeight:wa.MINIMUM_HEIGHT,Number.MAX_VALUE),p=c.height-m-y},_=()=>{g=Rt(f,-Number.MAX_VALUE,r.originalX+r.originalWidth>c.width?this.getMinimumWidth(c.width):Math.max(0,r.originalX+r.originalWidth-wa.MINIMUM_WIDTH)),v=r.originalX+r.originalWidth-g,b=c.width-g-v},S=()=>{g=r.originalX-r.originalWidth,v=Rt(f-g,g<0&&typeof this.options.minimumInViewportWidth=="number"?-g+this.options.minimumInViewportWidth:wa.MINIMUM_WIDTH,Number.MAX_VALUE),b=c.width-g-v};switch(t){case"top":x();break;case"bottom":w();break;case"left":_();break;case"right":S();break;case"topleft":x(),_();break;case"topright":x(),S();break;case"bottomleft":w(),_();break;case"bottomright":w(),S();break}const k={};m<=p?k.top=m:k.bottom=p,g<=b?k.left=g:k.right=b,k.height=y,k.width=v,this.setBounds(k)}),{dispose:()=>{o.release()}},Fe(window,"pointerup",()=>{s.dispose(),this._onDidChangeEnd.fire()}))}))}getMinimumWidth(t){return typeof this.options.minimumInViewportWidth=="number"?t-this.options.minimumInViewportWidth:0}getMinimumHeight(t){return typeof this.options.minimumInViewportHeight=="number"?t-this.options.minimumInViewportHeight:0}dispose(){uu.destroy(this._element),this._element.remove(),super.dispose()}}wa.MINIMUM_HEIGHT=20;wa.MINIMUM_WIDTH=20;class f8 extends Ge{constructor(t,n){super(),this.group=t,this.overlay=n,this.addDisposables(n)}position(t){this.overlay.setBounds(t)}}const hu=100,na={left:100,top:100,width:300,height:300},m8=100;class p8{constructor(){this.cache=new Map,this.currentFrameId=0,this.rafId=null}getPosition(t){const n=this.cache.get(t);if(n&&n.frameId===this.currentFrameId)return n.rect;this.scheduleFrameUpdate();const s=ox(t);return this.cache.set(t,{rect:s,frameId:this.currentFrameId}),s}invalidate(){this.currentFrameId++}scheduleFrameUpdate(){this.rafId||(this.rafId=requestAnimationFrame(()=>{this.currentFrameId++,this.rafId=null}))}}function g8(){const e=document.createElement("div");return e.tabIndex=-1,e}class J_ extends Ge{constructor(t,n){super(),this.element=t,this.accessor=n,this.map={},this._disposed=!1,this.positionCache=new p8,this.pendingUpdates=new Set,this.addDisposables(Zt.from(()=>{for(const s of Object.values(this.map))s.disposable.dispose(),s.destroy.dispose();this._disposed=!0}))}updateAllPositions(){if(!this._disposed){this.positionCache.invalidate();for(const t of Object.values(this.map))t.panel.api.isVisible&&t.resize&&t.resize()}}detatch(t){if(this.map[t.api.id]){const{disposable:n,destroy:s}=this.map[t.api.id];return n.dispose(),s.dispose(),delete this.map[t.api.id],!0}return!1}attach(t){const{panel:n,referenceContainer:s}=t;if(!this.map[n.api.id]){const h=g8();h.className="dv-render-overlay",this.map[n.api.id]={panel:n,disposable:Zt.NONE,destroy:Zt.NONE,element:h}}const a=this.map[n.api.id].element;n.view.content.element.parentElement!==a&&a.appendChild(n.view.content.element),a.parentElement!==this.element&&this.element.appendChild(a);const r=()=>{const h=n.api.id;this.pendingUpdates.has(h)||(this.pendingUpdates.add(h),requestAnimationFrame(()=>{if(this.pendingUpdates.delete(h),this.isDisposed||!this.map[h])return;const f=this.positionCache.getPosition(s.element),m=this.positionCache.getPosition(this.element),p=f.left-m.left,y=f.top-m.top,g=f.width,b=f.height;a.style.left=`${p}px`,a.style.top=`${y}px`,a.style.width=`${g}px`,a.style.height=`${b}px`,Pe(a,"dv-render-overlay-float",n.group.api.location.type==="floating")}))},o=()=>{n.api.isVisible&&(this.positionCache.invalidate(),r()),a.style.display=n.api.isVisible?"":"none"},l=new On,c=()=>{n.api.location.type==="floating"?queueMicrotask(()=>{const h=this.accessor.floatingGroups.find(y=>y.group===n.api.group);if(!h)return;const f=h.overlay.element,m=()=>{const y=Number(f.getAttribute("aria-level"));a.style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${y*2+1})`},p=new MutationObserver(()=>{m()});l.value=Zt.from(()=>p.disconnect()),p.observe(f,{attributeFilter:["aria-level"],attributes:!0}),m()}):a.style.zIndex=""},d=new Ge(l,new jA(a,{onDragEnd:h=>{s.dropTarget.dnd.onDragEnd(h)},onDragEnter:h=>{s.dropTarget.dnd.onDragEnter(h)},onDragLeave:h=>{s.dropTarget.dnd.onDragLeave(h)},onDrop:h=>{s.dropTarget.dnd.onDrop(h)},onDragOver:h=>{s.dropTarget.dnd.onDragOver(h)}}),n.api.onDidVisibilityChange(()=>{o()}),n.api.onDidDimensionsChange(()=>{n.api.isVisible&&r()}),n.api.onDidLocationChange(()=>{c()}));return this.map[n.api.id].destroy=Zt.from(()=>{var h;n.view.content.element.parentElement===a&&a.removeChild(n.view.content.element),(h=a.parentElement)===null||h===void 0||h.removeChild(a)}),c(),queueMicrotask(()=>{this.isDisposed||o()}),this.map[n.api.id].disposable.dispose(),this.map[n.api.id].disposable=d,this.map[n.api.id].resize=r,a}}var x8=function(e,t,n,s){function a(r){return r instanceof n?r:new n(function(o){o(r)})}return new(n||(n=Promise))(function(r,o){function l(h){try{d(s.next(h))}catch(f){o(f)}}function c(h){try{d(s.throw(h))}catch(f){o(f)}}function d(h){h.done?r(h.value):a(h.value).then(l,c)}d((s=s.apply(e,t||[])).next())})};class v8 extends Ge{get window(){var t,n;return(n=(t=this._window)===null||t===void 0?void 0:t.value)!==null&&n!==void 0?n:null}constructor(t,n,s){super(),this.target=t,this.className=n,this.options=s,this._onWillClose=new te,this.onWillClose=this._onWillClose.event,this._onDidClose=new te,this.onDidClose=this._onDidClose.event,this._window=null,this.addDisposables(this._onWillClose,this._onDidClose,{dispose:()=>{this.close()}})}dimensions(){if(!this._window)return null;const t=this._window.value.screenX,n=this._window.value.screenY,s=this._window.value.innerWidth,a=this._window.value.innerHeight;return{top:n,left:t,width:s,height:a}}close(){var t,n;this._window&&(this._onWillClose.fire(),(n=(t=this.options).onWillClose)===null||n===void 0||n.call(t,{id:this.target,window:this._window.value}),this._window.disposable.dispose(),this._window=null,this._onDidClose.fire())}open(){var t,n;return x8(this,void 0,void 0,function*(){if(this._window)throw new Error("instance of popout window is already open");const s=`${this.options.url}`,a=Object.entries({top:this.options.top,left:this.options.left,width:this.options.width,height:this.options.height}).map(([c,d])=>`${c}=${d}`).join(","),r=window.open(s,this.target,a);if(!r)return null;const o=new Ge;this._window={value:r,disposable:o},o.addDisposables(Zt.from(()=>{r.close()}),Fe(window,"beforeunload",()=>{this.close()}));const l=this.createPopoutWindowContainer();return this.className&&l.classList.add(this.className),(n=(t=this.options).onDidOpen)===null||n===void 0||n.call(t,{id:this.target,window:r}),new Promise((c,d)=>{r.addEventListener("unload",h=>{}),r.addEventListener("load",()=>{try{const h=r.document;h.title=document.title,h.body.appendChild(l),h5(h,window.document.styleSheets),Fe(r,"beforeunload",()=>{this.close()}),c(l)}catch(h){d(h)}})})})}createPopoutWindowContainer(){const t=document.createElement("div");return t.classList.add("dv-popout-window"),t.id="dv-popout-window",t.style.position="absolute",t.style.width="100%",t.style.height="100%",t.style.top="0px",t.style.left="0px",t}}class b8 extends Ge{constructor(t){super(),this.accessor=t,this.init()}init(){const t=new Set,n=new Set;this.addDisposables(this.accessor.onDidAddPanel(s=>{if(t.has(s.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${s.api.id} but panel already exists`);t.add(s.api.id)}),this.accessor.onDidRemovePanel(s=>{if(t.has(s.api.id))t.delete(s.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${s.api.id} but panel does not exists`)}),this.accessor.onDidAddGroup(s=>{if(n.has(s.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${s.api.id} but group already exists`);n.add(s.api.id)}),this.accessor.onDidRemoveGroup(s=>{if(n.has(s.api.id))n.delete(s.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${s.api.id} but group does not exists`)}))}}class y8 extends Ge{constructor(t){super(),this.root=t,this._active=null,this._activeDisposable=new On,this._element=document.createElement("div"),this._element.className="dv-popover-anchor",this._element.style.position="relative",this.root.prepend(this._element),this.addDisposables(Zt.from(()=>{this.close()}),this._activeDisposable)}openPopover(t,n){var s;this.close();const a=document.createElement("div");a.style.position="absolute",a.style.zIndex=(s=n.zIndex)!==null&&s!==void 0?s:"var(--dv-overlay-z-index)",a.appendChild(t);const r=this._element.getBoundingClientRect(),o=r.left,l=r.top;a.style.top=`${n.y-l}px`,a.style.left=`${n.x-o}px`,this._element.appendChild(a),this._active=a,this._activeDisposable.value=new Ge(Fe(window,"pointerdown",c=>{var d;const h=c.target;if(!(h instanceof HTMLElement))return;let f=h;for(;f&&f!==a;)f=(d=f==null?void 0:f.parentElement)!==null&&d!==void 0?d:null;f||this.close()})),requestAnimationFrame(()=>{y5(a,this.root)})}close(){this._active&&(this._active.remove(),this._activeDisposable.dispose(),this._active=null)}}class ej extends Ge{get disabled(){return this._disabled}set disabled(t){var n;this.disabled!==t&&(this._disabled=t,t&&((n=this.model)===null||n===void 0||n.clear()))}get model(){if(!this.disabled)return{clear:()=>{var t;this._model&&((t=this._model.root.parentElement)===null||t===void 0||t.removeChild(this._model.root)),this._model=void 0},exists:()=>!!this._model,getElements:(t,n)=>{const s=this._outline!==n;if(this._outline=n,this._model)return this._model.changed=s,this._model;const a=this.createContainer(),r=this.createAnchor();if(this._model={root:a,overlay:r,changed:s},a.appendChild(r),this.element.appendChild(a),(t==null?void 0:t.target)instanceof HTMLElement){const o=t.target.getBoundingClientRect(),l=this.element.getBoundingClientRect();r.style.left=`${o.left-l.left}px`,r.style.top=`${o.top-l.top}px`}return this._model}}}constructor(t,n){super(),this.element=t,this._disabled=!1,this._disabled=n.disabled,this.addDisposables(Zt.from(()=>{var s;(s=this.model)===null||s===void 0||s.clear()}))}createContainer(){const t=document.createElement("div");return t.className="dv-drop-target-container",t}createAnchor(){const t=document.createElement("div");return t.className="dv-drop-target-anchor",t.style.visibility="hidden",t}}const tj={activationSize:{type:"pixels",value:10},size:{type:"pixels",value:20}};function fu(e){const t=e.from.activePanel;[...e.from.panels].map(s=>{const a=e.from.model.removePanel(s);return e.from.model.renderContainer.detatch(s),a}).forEach(s=>{e.to.model.openPanel(s,{skipSetActive:t!==s,skipSetGroupActive:!0})})}class w8 extends yA{get orientation(){return this.gridview.orientation}get totalPanels(){return this.panels.length}get panels(){return this.groups.flatMap(t=>t.panels)}get options(){return this._options}get activePanel(){const t=this.activeGroup;if(t)return t.activePanel}get renderer(){var t;return(t=this.options.defaultRenderer)!==null&&t!==void 0?t:"onlyWhenVisible"}get api(){return this._api}get floatingGroups(){return this._floatingGroups}get popoutRestorationPromise(){return this._popoutRestorationPromise}constructor(t,n){var s,a,r;super(t,{proportionalLayout:!0,orientation:Me.HORIZONTAL,styles:n.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:n.disableAutoResizing,locked:n.locked,margin:(a=(s=n.theme)===null||s===void 0?void 0:s.gap)!==null&&a!==void 0?a:0,className:n.className}),this.nextGroupId=Lb(),this._deserializer=new d8(this),this._watermark=null,this._onWillDragPanel=new te,this.onWillDragPanel=this._onWillDragPanel.event,this._onWillDragGroup=new te,this.onWillDragGroup=this._onWillDragGroup.event,this._onDidDrop=new te,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new te,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new te,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onUnhandledDragOverEvent=new te,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this._onDidRemovePanel=new te,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidAddPanel=new te,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPopoutGroupSizeChange=new te,this.onDidPopoutGroupSizeChange=this._onDidPopoutGroupSizeChange.event,this._onDidPopoutGroupPositionChange=new te,this.onDidPopoutGroupPositionChange=this._onDidPopoutGroupPositionChange.event,this._onDidOpenPopoutWindowFail=new te,this.onDidOpenPopoutWindowFail=this._onDidOpenPopoutWindowFail.event,this._onDidLayoutFromJSON=new te,this.onDidLayoutFromJSON=this._onDidLayoutFromJSON.event,this._onDidActivePanelChange=new te({replay:!0}),this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidMovePanel=new te,this.onDidMovePanel=this._onDidMovePanel.event,this._onDidMaximizedGroupChange=new te,this.onDidMaximizedGroupChange=this._onDidMaximizedGroupChange.event,this._floatingGroups=[],this._popoutGroups=[],this._popoutRestorationPromise=Promise.resolve(),this._onDidRemoveGroup=new te,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new te,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidOptionsChange=new te,this.onDidOptionsChange=this._onDidOptionsChange.event,this._onDidActiveGroupChange=new te,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._moving=!1,this._options=n,this.popupService=new y8(this.element),this._themeClassnames=new am(this.element),this._api=new Gh(this),this.rootDropTargetContainer=new ej(this.element,{disabled:!0}),this.overlayRenderContainer=new J_(this.gridview.element,this),this._rootDropTarget=new Vs(this.element,{className:"dv-drop-target-edge",canDisplayOverlay:(o,l)=>{const c=En();if(c)return c.viewId!==this.id?!1:l==="center"?this.gridview.length===0:!0;if(l==="center"&&this.gridview.length!==0)return!1;const d=new AA(o,"edge",l,En);return this._onUnhandledDragOverEvent.fire(d),d.isAccepted},acceptedTargetZones:["top","bottom","left","right","center"],overlayModel:(r=n.rootOverlayModel)!==null&&r!==void 0?r:tj,getOverrideTarget:()=>{var o;return(o=this.rootDropTargetContainer)===null||o===void 0?void 0:o.model}}),this.updateDropTargetModel(n),Pe(this.gridview.element,"dv-dockview",!0),Pe(this.element,"dv-debug",!!n.debug),this.updateTheme(),this.updateWatermark(),n.debug&&this.addDisposables(new b8(this)),this.addDisposables(this.rootDropTargetContainer,this.overlayRenderContainer,this._onWillDragPanel,this._onWillDragGroup,this._onWillShowOverlay,this._onDidActivePanelChange,this._onDidAddPanel,this._onDidRemovePanel,this._onDidLayoutFromJSON,this._onDidDrop,this._onWillDrop,this._onDidMovePanel,this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this._onUnhandledDragOverEvent,this._onDidMaximizedGroupChange,this._onDidOptionsChange,this._onDidPopoutGroupSizeChange,this._onDidPopoutGroupPositionChange,this._onDidOpenPopoutWindowFail,this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.updateWatermark()}),this.onDidAdd(o=>{this._moving||this._onDidAddGroup.fire(o)}),this.onDidRemove(o=>{this._moving||this._onDidRemoveGroup.fire(o)}),this.onDidActiveChange(o=>{this._moving||this._onDidActiveGroupChange.fire(o)}),this.onDidMaximizedChange(o=>{this._onDidMaximizedGroupChange.fire({group:o.panel,isMaximized:o.isMaximized})}),vr.any(this.onDidAdd,this.onDidRemove)(()=>{this.updateWatermark()}),vr.any(this.onDidAddPanel,this.onDidRemovePanel,this.onDidAddGroup,this.onDidRemove,this.onDidMovePanel,this.onDidActivePanelChange,this.onDidPopoutGroupPositionChange,this.onDidPopoutGroupSizeChange)(()=>{this._bufferOnDidLayoutChange.fire()}),Zt.from(()=>{for(const o of[...this._floatingGroups])o.dispose();for(const o of[...this._popoutGroups])o.disposable.dispose()}),this._rootDropTarget,this._rootDropTarget.onWillShowOverlay(o=>{this.gridview.length>0&&o.position==="center"||this._onWillShowOverlay.fire(new rm(o,{kind:"edge",panel:void 0,api:this._api,group:void 0,getData:En}))}),this._rootDropTarget.onDrop(o=>{var l;const c=new RA({nativeEvent:o.nativeEvent,position:o.position,panel:void 0,api:this._api,group:void 0,getData:En,kind:"edge"});if(this._onWillDrop.fire(c),c.defaultPrevented)return;const d=En();d?this.moveGroupOrPanel({from:{groupId:d.groupId,panelId:(l=d.panelId)!==null&&l!==void 0?l:void 0},to:{group:this.orthogonalize(o.position),position:"center"}}):this._onDidDrop.fire(new Vb({nativeEvent:o.nativeEvent,position:o.position,panel:void 0,api:this._api,group:void 0,getData:En}))}),this._rootDropTarget)}setVisible(t,n){switch(t.api.location.type){case"grid":super.setVisible(t,n);break;case"floating":{const s=this.floatingGroups.find(a=>a.group===t);s&&(s.overlay.setVisible(n),t.api._onDidVisibilityChange.fire({isVisible:n}));break}case"popout":console.warn("dockview: You cannot hide a group that is in a popout window");break}}addPopoutGroup(t,n){var s,a,r,o,l;if(t instanceof ao&&t.group.size===1)return this.addPopoutGroup(t.group,n);const c=g5(this.gridview.element),d=this.element;function h(){return n!=null&&n.position?n.position:t instanceof Z_?t.element.getBoundingClientRect():t.group?t.group.element.getBoundingClientRect():d.getBoundingClientRect()}const f=h(),m=(a=(s=n==null?void 0:n.overridePopoutGroup)===null||s===void 0?void 0:s.id)!==null&&a!==void 0?a:this.getNextGroupId(),p=new v8(`${this.id}-${m}`,c??"",{url:(l=(r=n==null?void 0:n.popoutUrl)!==null&&r!==void 0?r:(o=this.options)===null||o===void 0?void 0:o.popoutUrl)!==null&&l!==void 0?l:"/popout.html",left:window.screenX+f.left,top:window.screenY+f.top,width:f.width,height:f.height,onDidOpen:n==null?void 0:n.onDidOpen,onWillClose:n==null?void 0:n.onWillClose}),y=new Ge(p,p.onDidClose(()=>{y.dispose()}));return p.open().then(g=>{var b;if(p.isDisposed)return!1;const v=n!=null&&n.referenceGroup?n.referenceGroup:t instanceof ao?t.group:t,x=t.api.location.type,w=v.element.parentElement!==null;let _;if(w?n!=null&&n.overridePopoutGroup?_=n.overridePopoutGroup:(_=this.createGroup({id:m}),g&&this._onDidAddGroup.fire(_)):_=v,g===null)return console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website"),y.dispose(),this._onDidOpenPopoutWindowFail.fire(),this.movingLock(()=>fu({from:_,to:v})),v.api.isVisible||v.api.setVisible(!0),!1;const S=document.createElement("div");S.className="dv-overlay-render-container";const k=new J_(S,this);_.model.renderContainer=k,_.layout(p.window.innerWidth,p.window.innerHeight);let j;if(!(n!=null&&n.overridePopoutGroup)&&w)if(t instanceof ao)this.movingLock(()=>{const A=v.model.removePanel(t);_.model.openPanel(A)});else switch(this.movingLock(()=>fu({from:v,to:_})),x){case"grid":v.api.setVisible(!1);break;case"floating":case"popout":j=(b=this._floatingGroups.find(A=>A.group.api.id===t.api.id))===null||b===void 0?void 0:b.overlay.toJSON(),this.removeGroup(v);break}g.classList.add("dv-dockview"),g.style.overflow="hidden",g.appendChild(S),g.appendChild(_.element);const N=document.createElement("div"),O=new ej(N,{disabled:this.rootDropTargetContainer.disabled});g.appendChild(N),_.model.dropTargetContainer=O,_.model.location={type:"popout",getWindow:()=>p.window,popoutUrl:n==null?void 0:n.popoutUrl},w&&t.api.location.type==="grid"&&t.api.setVisible(!1),this.doSetGroupAndPanelActive(_),y.addDisposables(_.api.onDidActiveChange(A=>{var D;A.isActive&&((D=p.window)===null||D===void 0||D.focus())}),_.api.onWillFocus(()=>{var A;(A=p.window)===null||A===void 0||A.focus()}));let T;const P=w&&v&&this.getPanel(v.id),L={window:p,popoutGroup:_,referenceGroup:P?v.id:void 0,disposable:{dispose:()=>(y.dispose(),T)}},G=v5(p.window);return y.addDisposables(G,b5(p.window,()=>{this._onDidPopoutGroupSizeChange.fire({width:p.window.innerWidth,height:p.window.innerHeight,group:_})}),G.event(()=>{this._onDidPopoutGroupPositionChange.fire({screenX:p.window.screenX,screenY:p.window.screenX,group:_})}),Fe(p.window,"resize",()=>{_.layout(p.window.innerWidth,p.window.innerHeight)}),k,Zt.from(()=>{if(!this.isDisposed){if(w&&this.getPanel(v.id))this.movingLock(()=>fu({from:_,to:v})),v.api.isVisible||v.api.setVisible(!0),this.getPanel(_.id)&&this.doRemoveGroup(_,{skipPopoutAssociated:!0});else if(this.getPanel(_.id)){if(_.model.renderContainer=this.overlayRenderContainer,_.model.dropTargetContainer=this.rootDropTargetContainer,T=_,!this._popoutGroups.find(D=>D.popoutGroup===_))return;j?this.addFloatingGroup(_,{height:j.height,width:j.width,position:j}):(this.doRemoveGroup(_,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),_.model.location={type:"grid"},this.movingLock(()=>{this.doAddGroup(_,[0])})),this.doSetGroupAndPanelActive(_)}}})),this._popoutGroups.push(L),this.updateWatermark(),!0}).catch(g=>(console.error("dockview: failed to create popout.",g),!1))}addFloatingGroup(t,n){var s,a,r,o,l;let c;if(t instanceof ao)c=this.createGroup(),this._onDidAddGroup.fire(c),this.movingLock(()=>this.removePanel(t,{removeEmptyGroup:!0,skipDispose:!0,skipSetActiveGroup:!0})),this.movingLock(()=>c.model.openPanel(t,{skipSetGroupActive:!0}));else{c=t;const g=(s=this._popoutGroups.find(x=>x.popoutGroup===c))===null||s===void 0?void 0:s.referenceGroup,b=g?this.getPanel(g):void 0;typeof(n==null?void 0:n.skipRemoveGroup)=="boolean"&&n.skipRemoveGroup||(b?(this.movingLock(()=>fu({from:t,to:b})),this.doRemoveGroup(t,{skipPopoutReturn:!0,skipPopoutAssociated:!0}),this.doRemoveGroup(b,{skipDispose:!0}),c=b):this.doRemoveGroup(t,{skipDispose:!0,skipPopoutReturn:!0,skipPopoutAssociated:!1}))}function d(){if(n!=null&&n.position){const g={};return"left"in n.position?g.left=Math.max(n.position.left,0):"right"in n.position?g.right=Math.max(n.position.right,0):g.left=na.left,"top"in n.position?g.top=Math.max(n.position.top,0):"bottom"in n.position?g.bottom=Math.max(n.position.bottom,0):g.top=na.top,typeof n.width=="number"?g.width=Math.max(n.width,0):g.width=na.width,typeof n.height=="number"?g.height=Math.max(n.height,0):g.height=na.height,g}return{left:typeof(n==null?void 0:n.x)=="number"?Math.max(n.x,0):na.left,top:typeof(n==null?void 0:n.y)=="number"?Math.max(n.y,0):na.top,width:typeof(n==null?void 0:n.width)=="number"?Math.max(n.width,0):na.width,height:typeof(n==null?void 0:n.height)=="number"?Math.max(n.height,0):na.height}}const h=d(),f=new wa(Object.assign(Object.assign({container:this.gridview.element,content:c.element},h),{minimumInViewportWidth:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(r=(a=this.options.floatingGroupBounds)===null||a===void 0?void 0:a.minimumWidthWithinViewport)!==null&&r!==void 0?r:hu,minimumInViewportHeight:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(l=(o=this.options.floatingGroupBounds)===null||o===void 0?void 0:o.minimumHeightWithinViewport)!==null&&l!==void 0?l:hu})),m=c.element.querySelector(".dv-void-container");if(!m)throw new Error("failed to find drag handle");f.setupDrag(m,{inDragMode:typeof(n==null?void 0:n.inDragMode)=="boolean"?n.inDragMode:!1});const p=new f8(c,f),y=new Ge(c.api.onDidActiveChange(g=>{g.isActive&&f.bringToFront()}),sm(c.element,g=>{const{width:b,height:v}=g.contentRect;c.layout(b,v)}));p.addDisposables(f.onDidChange(()=>{c.layout(c.width,c.height)}),f.onDidChangeEnd(()=>{this._bufferOnDidLayoutChange.fire()}),c.onDidChange(g=>{f.setBounds({height:g==null?void 0:g.height,width:g==null?void 0:g.width})}),{dispose:()=>{y.dispose(),Np(this._floatingGroups,p),c.model.location={type:"grid"},this.updateWatermark()}}),this._floatingGroups.push(p),c.model.location={type:"floating"},n!=null&&n.skipActiveGroup||this.doSetGroupAndPanelActive(c),this.updateWatermark()}orthogonalize(t,n){switch(this.gridview.normalize(),t){case"top":case"bottom":this.gridview.orientation===Me.HORIZONTAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break;case"left":case"right":this.gridview.orientation===Me.VERTICAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break}switch(t){case"top":case"left":case"center":return this.createGroupAtLocation([0],void 0,n);case"bottom":case"right":return this.createGroupAtLocation([this.gridview.length],void 0,n);default:throw new Error(`unsupported position ${t}`)}}updateOptions(t){var n,s;if(super.updateOptions(t),"floatingGroupBounds"in t)for(const o of this._floatingGroups){switch(t.floatingGroupBounds){case"boundedWithinViewport":o.overlay.minimumInViewportHeight=void 0,o.overlay.minimumInViewportWidth=void 0;break;case void 0:o.overlay.minimumInViewportHeight=hu,o.overlay.minimumInViewportWidth=hu;break;default:o.overlay.minimumInViewportHeight=(n=t.floatingGroupBounds)===null||n===void 0?void 0:n.minimumHeightWithinViewport,o.overlay.minimumInViewportWidth=(s=t.floatingGroupBounds)===null||s===void 0?void 0:s.minimumWidthWithinViewport}o.overlay.setBounds()}this.updateDropTargetModel(t);const a=this.options.disableDnd;this._options=Object.assign(Object.assign({},this.options),t);const r=this.options.disableDnd;a!==r&&this.updateDragAndDropState(),"theme"in t&&this.updateTheme(),this.layout(this.gridview.width,this.gridview.height,!0)}layout(t,n,s){if(super.layout(t,n,s),this._floatingGroups)for(const a of this._floatingGroups)a.overlay.setBounds()}updateDragAndDropState(){for(const t of this.groups)t.model.updateDragAndDropState()}focus(){var t;(t=this.activeGroup)===null||t===void 0||t.focus()}getGroupPanel(t){return this.panels.find(n=>n.id===t)}setActivePanel(t){t.group.model.openPanel(t),this.doSetGroupAndPanelActive(t.group)}moveToNext(t={}){var n;if(!t.group){if(!this.activeGroup)return;t.group=this.activeGroup}if(t.includePanel&&t.group&&t.group.activePanel!==t.group.panels[t.group.panels.length-1]){t.group.model.moveToNext({suppressRoll:!0});return}const s=Ht(t.group.element),a=(n=this.gridview.next(s))===null||n===void 0?void 0:n.view;this.doSetGroupAndPanelActive(a)}moveToPrevious(t={}){var n;if(!t.group){if(!this.activeGroup)return;t.group=this.activeGroup}if(t.includePanel&&t.group&&t.group.activePanel!==t.group.panels[0]){t.group.model.moveToPrevious({suppressRoll:!0});return}const s=Ht(t.group.element),a=(n=this.gridview.previous(s))===null||n===void 0?void 0:n.view;a&&this.doSetGroupAndPanelActive(a)}toJSON(){var t;const n=this.gridview.serialize(),s=this.panels.reduce((l,c)=>(l[c.id]=c.toJSON(),l),{}),a=this._floatingGroups.map(l=>({data:l.group.toJSON(),position:l.overlay.toJSON()})),r=this._popoutGroups.map(l=>({data:l.popoutGroup.toJSON(),gridReferenceGroup:l.referenceGroup,position:l.window.dimensions(),url:l.popoutGroup.api.location.type==="popout"?l.popoutGroup.api.location.popoutUrl:void 0})),o={grid:n,panels:s,activeGroup:(t=this.activeGroup)===null||t===void 0?void 0:t.id};return a.length>0&&(o.floatingGroups=a),r.length>0&&(o.popoutGroups=r),o}fromJSON(t){var n,s;if(this.clear(),typeof t!="object"||t===null)throw new Error("serialized layout must be a non-null object");const{grid:a,panels:r,activeGroup:o}=t;if(a.root.type!=="branch"||!Array.isArray(a.root.data))throw new Error("root must be of type branch");try{const l=this.width,c=this.height,d=p=>{const{id:y,locked:g,hideHeader:b,views:v,activeView:x}=p;if(typeof y!="string")throw new Error("group id must be of type string");const w=this.createGroup({id:y,locked:!!g,hideHeader:!!b});this._onDidAddGroup.fire(w);const _=[];for(const S of v){const k=this._deserializer.fromJSON(r[S],w);_.push(k)}for(let S=0;S<v.length;S++){const k=_[S],j=typeof x=="string"&&x===k.id;w.model.openPanel(k,{skipSetActive:!j,skipSetGroupActive:!0})}return!w.activePanel&&w.panels.length>0&&w.model.openPanel(w.panels[w.panels.length-1],{skipSetGroupActive:!0}),w};this.gridview.deserialize(a,{fromJSON:p=>d(p.data)}),this.layout(l,c,!0);const h=(n=t.floatingGroups)!==null&&n!==void 0?n:[];for(const p of h){const{data:y,position:g}=p,b=d(y);this.addFloatingGroup(b,{position:g,width:g.width,height:g.height,skipRemoveGroup:!0,inDragMode:!1})}const f=(s=t.popoutGroups)!==null&&s!==void 0?s:[],m=[];f.forEach((p,y)=>{const{data:g,position:b,gridReferenceGroup:v,url:x}=p,w=d(g),_=new Promise(S=>{setTimeout(()=>{this.addPopoutGroup(w,{position:b??void 0,overridePopoutGroup:v?w:void 0,referenceGroup:v?this.getPanel(v):void 0,popoutUrl:x}),S()},y*m8)});m.push(_)}),this._popoutRestorationPromise=Promise.all(m).then(()=>{});for(const p of this._floatingGroups)p.overlay.setBounds();if(typeof o=="string"){const p=this.getPanel(o);p&&this.doSetGroupAndPanelActive(p)}}catch(l){console.error("dockview: failed to deserialize layout. Reverting changes",l);for(const c of this.groups)for(const d of c.panels)this.removePanel(d,{removeEmptyGroup:!1,skipDispose:!1});for(const c of this.groups)c.dispose(),this._groups.delete(c.id),this._onDidRemoveGroup.fire(c);for(const c of[...this._floatingGroups])c.dispose();throw this.clear(),l}this.updateWatermark(),requestAnimationFrame(()=>{this.overlayRenderContainer.updateAllPositions()}),this._onDidLayoutFromJSON.fire()}clear(){const t=Array.from(this._groups.values()).map(s=>s.value),n=!!this.activeGroup;for(const s of t)this.removeGroup(s,{skipActive:!0});n&&this.doSetGroupAndPanelActive(void 0),this.gridview.clear()}closeAllGroups(){for(const t of this._groups.entries()){const[n,s]=t;s.value.model.closeAllPanels()}}addPanel(t){var n,s;if(this.panels.find(c=>c.id===t.id))throw new Error(`panel with id ${t.id} already exists`);let a;if(t.position&&t.floating)throw new Error("you can only provide one of: position, floating as arguments to .addPanel(...)");const r={width:t.initialWidth,height:t.initialHeight};let o;if(t.position)if(e8(t.position)){const c=typeof t.position.referencePanel=="string"?this.getGroupPanel(t.position.referencePanel):t.position.referencePanel;if(o=t.position.index,!c)throw new Error(`referencePanel '${t.position.referencePanel}' does not exist`);a=this.findGroup(c)}else if(t8(t.position)){if(a=typeof t.position.referenceGroup=="string"?(n=this._groups.get(t.position.referenceGroup))===null||n===void 0?void 0:n.value:t.position.referenceGroup,o=t.position.index,!a)throw new Error(`referenceGroup '${t.position.referenceGroup}' does not exist`)}else{const c=this.orthogonalize(K_(t.position.direction)),d=this.createPanel(t,c);return c.model.openPanel(d,{skipSetActive:t.inactive,skipSetGroupActive:t.inactive,index:o}),t.inactive||this.doSetGroupAndPanelActive(c),c.api.setSize({height:r==null?void 0:r.height,width:r==null?void 0:r.width}),d}else a=this.activeGroup;let l;if(a){const c=Ih(((s=t.position)===null||s===void 0?void 0:s.direction)||"within");if(t.floating){const d=this.createGroup();this._onDidAddGroup.fire(d);const h=typeof t.floating=="object"&&t.floating!==null?t.floating:{};this.addFloatingGroup(d,Object.assign(Object.assign({},h),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),l=this.createPanel(t,d),d.model.openPanel(l,{skipSetActive:t.inactive,skipSetGroupActive:t.inactive,index:o})}else if(a.api.location.type==="floating"||c==="center")l=this.createPanel(t,a),a.model.openPanel(l,{skipSetActive:t.inactive,skipSetGroupActive:t.inactive,index:o}),a.api.setSize({width:r==null?void 0:r.width,height:r==null?void 0:r.height}),t.inactive||this.doSetGroupAndPanelActive(a);else{const d=Ht(a.element),h=ti(this.gridview.orientation,d,c),f=this.createGroupAtLocation(h,this.orientationAtLocation(h)===Me.VERTICAL?r==null?void 0:r.height:r==null?void 0:r.width);l=this.createPanel(t,f),f.model.openPanel(l,{skipSetActive:t.inactive,skipSetGroupActive:t.inactive,index:o}),t.inactive||this.doSetGroupAndPanelActive(f)}}else if(t.floating){const c=this.createGroup();this._onDidAddGroup.fire(c);const d=typeof t.floating=="object"&&t.floating!==null?t.floating:{};this.addFloatingGroup(c,Object.assign(Object.assign({},d),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),l=this.createPanel(t,c),c.model.openPanel(l,{skipSetActive:t.inactive,skipSetGroupActive:t.inactive,index:o})}else{const c=this.createGroupAtLocation([0],this.gridview.orientation===Me.VERTICAL?r==null?void 0:r.height:r==null?void 0:r.width);l=this.createPanel(t,c),c.model.openPanel(l,{skipSetActive:t.inactive,skipSetGroupActive:t.inactive,index:o}),t.inactive||this.doSetGroupAndPanelActive(c)}return l}removePanel(t,n={removeEmptyGroup:!0}){const s=t.group;if(!s)throw new Error(`cannot remove panel ${t.id}. it's missing a group.`);s.model.removePanel(t,{skipSetActiveGroup:n.skipSetActiveGroup}),n.skipDispose||(t.group.model.renderContainer.detatch(t),t.dispose()),s.size===0&&n.removeEmptyGroup&&this.removeGroup(s,{skipActive:n.skipSetActiveGroup})}createWatermarkComponent(){return this.options.createWatermarkComponent?this.options.createWatermarkComponent():new u8}updateWatermark(){var t,n;if(this.groups.filter(s=>s.api.location.type==="grid"&&s.api.isVisible).length===0){if(!this._watermark){this._watermark=this.createWatermarkComponent(),this._watermark.init({containerApi:new Gh(this)});const s=document.createElement("div");s.className="dv-watermark-container",m5(s,"watermark-component"),s.appendChild(this._watermark.element),this.gridview.element.appendChild(s)}}else this._watermark&&(this._watermark.element.parentElement.remove(),(n=(t=this._watermark).dispose)===null||n===void 0||n.call(t),this._watermark=null)}addGroup(t){var n;if(t){let s;if(n8(t)){const d=typeof t.referencePanel=="string"?this.panels.find(h=>h.id===t.referencePanel):t.referencePanel;if(!d)throw new Error(`reference panel ${t.referencePanel} does not exist`);if(s=this.findGroup(d),!s)throw new Error(`reference group for reference panel ${t.referencePanel} does not exist`)}else if(s8(t)){if(s=typeof t.referenceGroup=="string"?(n=this._groups.get(t.referenceGroup))===null||n===void 0?void 0:n.value:t.referenceGroup,!s)throw new Error(`reference group ${t.referenceGroup} does not exist`)}else{const d=this.orthogonalize(K_(t.direction),t);return t.skipSetActive||this.doSetGroupAndPanelActive(d),d}const a=Ih(t.direction||"within"),r=Ht(s.element),o=ti(this.gridview.orientation,r,a),l=this.createGroup(t),c=this.getLocationOrientation(o)===Me.VERTICAL?t.initialHeight:t.initialWidth;return this.doAddGroup(l,o,c),t.skipSetActive||this.doSetGroupAndPanelActive(l),l}else{const s=this.createGroup(t);return this.doAddGroup(s),this.doSetGroupAndPanelActive(s),s}}getLocationOrientation(t){return t.length%2==0&&this.gridview.orientation===Me.HORIZONTAL?Me.HORIZONTAL:Me.VERTICAL}removeGroup(t,n){this.doRemoveGroup(t,n)}doRemoveGroup(t,n){var s;const a=[...t.panels];if(!(n!=null&&n.skipDispose))for(const l of a)this.removePanel(l,{removeEmptyGroup:!1,skipDispose:(s=n==null?void 0:n.skipDispose)!==null&&s!==void 0?s:!1});const r=this.activePanel;if(t.api.location.type==="floating"){const l=this._floatingGroups.find(c=>c.group===t);if(l){if(n!=null&&n.skipDispose||(l.group.dispose(),this._groups.delete(t.id),this._onDidRemoveGroup.fire(t)),Np(this._floatingGroups,l),l.dispose(),!(n!=null&&n.skipActive)&&this._activeGroup===t){const c=Array.from(this._groups.values());this.doSetGroupAndPanelActive(c.length>0?c[0].value:void 0)}return l.group}throw new Error("failed to find floating group")}if(t.api.location.type==="popout"){const l=this._popoutGroups.find(c=>c.popoutGroup===t);if(l){if(!(n!=null&&n.skipDispose)){if(!(n!=null&&n.skipPopoutAssociated)){const d=l.referenceGroup?this.getPanel(l.referenceGroup):void 0;d&&d.panels.length===0&&this.removeGroup(d)}l.popoutGroup.dispose(),this._groups.delete(t.id),this._onDidRemoveGroup.fire(t)}Np(this._popoutGroups,l);const c=l.disposable.dispose();if(!(n!=null&&n.skipPopoutReturn)&&c&&(this.doAddGroup(c,[0]),this.doSetGroupAndPanelActive(c)),!(n!=null&&n.skipActive)&&this._activeGroup===t){const d=Array.from(this._groups.values());this.doSetGroupAndPanelActive(d.length>0?d[0].value:void 0)}return this.updateWatermark(),l.popoutGroup}throw new Error("failed to find popout group")}const o=super.doRemoveGroup(t,n);return n!=null&&n.skipActive||this.activePanel!==r&&this._onDidActivePanelChange.fire(this.activePanel),o}movingLock(t){const n=this._moving;try{return this._moving=!0,t()}finally{this._moving=n}}moveGroupOrPanel(t){var n;const s=t.to.group,a=t.from.groupId,r=t.from.panelId,o=t.to.position,l=t.to.index,c=a?(n=this._groups.get(a))===null||n===void 0?void 0:n.value:void 0;if(!c)throw new Error(`Failed to find group id ${a}`);if(r===void 0){this.moveGroup({from:{group:c},to:{group:s,position:o},skipSetActive:t.skipSetActive});return}if(!o||o==="center"){const d=this.movingLock(()=>c.model.removePanel(r,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!d)throw new Error(`No panel with id ${r}`);c.model.size===0&&this.doRemoveGroup(c,{skipActive:!0});const h=s.model.size===0;this.movingLock(()=>{var f;return s.model.openPanel(d,{index:l,skipSetActive:((f=t.skipSetActive)!==null&&f!==void 0?f:!1)&&!h,skipSetGroupActive:!0})}),t.skipSetActive||this.doSetGroupAndPanelActive(s),this._onDidMovePanel.fire({panel:d,from:c})}else{const d=Ht(s.element),h=ti(this.gridview.orientation,d,o);if(c.size<2){const[f,m]=Pi(h);if(c.api.location.type==="grid"){const b=Ht(c.element),[v,x]=Pi(b);if(vA(v,f)){this.gridview.moveView(v,x,m),this._onDidMovePanel.fire({panel:this.getGroupPanel(r),from:c});return}}if(c.api.location.type==="popout"){const b=this._popoutGroups.find(w=>w.popoutGroup===c),v=this.movingLock(()=>b.popoutGroup.model.removePanel(b.popoutGroup.panels[0],{skipSetActive:!0,skipSetActiveGroup:!0}));this.doRemoveGroup(c,{skipActive:!0});const x=this.createGroupAtLocation(h);this.movingLock(()=>x.model.openPanel(v)),this.doSetGroupAndPanelActive(x),this._onDidMovePanel.fire({panel:this.getGroupPanel(r),from:c});return}const p=this.movingLock(()=>this.doRemoveGroup(c,{skipActive:!0,skipDispose:!0})),y=Ht(s.element),g=ti(this.gridview.orientation,y,o);this.movingLock(()=>this.doAddGroup(p,g)),this.doSetGroupAndPanelActive(p),this._onDidMovePanel.fire({panel:this.getGroupPanel(r),from:c})}else{const f=this.movingLock(()=>c.model.removePanel(r,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!f)throw new Error(`No panel with id ${r}`);const m=ti(this.gridview.orientation,d,o),p=this.createGroupAtLocation(m);this.movingLock(()=>p.model.openPanel(f,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(p),this._onDidMovePanel.fire({panel:f,from:c})}}}moveGroup(t){const n=t.from.group,s=t.to.group,a=t.to.position;if(a==="center"){const r=n.activePanel,o=this.movingLock(()=>[...n.panels].map(l=>n.model.removePanel(l.id,{skipSetActive:!0})));(n==null?void 0:n.model.size)===0&&this.doRemoveGroup(n,{skipActive:!0}),this.movingLock(()=>{for(const l of o)s.model.openPanel(l,{skipSetActive:l!==r,skipSetGroupActive:!0})}),t.skipSetActive!==!0?this.doSetGroupAndPanelActive(s):this.activePanel||this.doSetGroupAndPanelActive(s)}else{switch(n.api.location.type){case"grid":this.gridview.removeView(Ht(n.element));break;case"floating":{const r=this._floatingGroups.find(o=>o.group===n);if(!r)throw new Error("failed to find floating group");r.dispose();break}case"popout":{const r=this._popoutGroups.find(l=>l.popoutGroup===n);if(!r)throw new Error("failed to find popout group");const o=this._popoutGroups.indexOf(r);if(o>=0&&this._popoutGroups.splice(o,1),r.referenceGroup){const l=this.getPanel(r.referenceGroup);l&&!l.api.isVisible&&this.doRemoveGroup(l,{skipActive:!0})}r.window.dispose(),s.api.location.type==="grid"?(n.model.renderContainer=this.overlayRenderContainer,n.model.dropTargetContainer=this.rootDropTargetContainer,n.model.location={type:"grid"}):s.api.location.type==="floating"&&(n.model.renderContainer=this.overlayRenderContainer,n.model.dropTargetContainer=this.rootDropTargetContainer,n.model.location={type:"floating"});break}}if(s.api.location.type==="grid"){const r=Ht(s.element),o=ti(this.gridview.orientation,r,a);let l;switch(this.gridview.orientation){case Me.VERTICAL:l=r.length%2==0?n.api.width:n.api.height;break;case Me.HORIZONTAL:l=r.length%2==0?n.api.height:n.api.width;break}this.gridview.addView(n,l,o)}else if(s.api.location.type==="floating"){const r=this._floatingGroups.find(o=>o.group===s);if(r){const o=r.overlay.toJSON();let l,c;"left"in o?l=o.left+50:"right"in o?l=Math.max(0,o.right-o.width-50):l=50,"top"in o?c=o.top+50:"bottom"in o?c=Math.max(0,o.bottom-o.height-50):c=50,this.addFloatingGroup(n,{height:o.height,width:o.width,position:{left:l,top:c}})}}}if(n.panels.forEach(r=>{this._onDidMovePanel.fire({panel:r,from:n})}),t.skipSetActive===!1){const r=s??n;this.doSetGroupAndPanelActive(r)}}doSetGroupActive(t){super.doSetGroupActive(t);const n=this.activePanel;!this._moving&&n!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(n)}doSetGroupAndPanelActive(t){super.doSetGroupActive(t);const n=this.activePanel;t&&this.hasMaximizedGroup()&&!this.isMaximizedGroup(t)&&this.exitMaximizedGroup(),!this._moving&&n!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(n)}getNextGroupId(){let t=this.nextGroupId.next();for(;this._groups.has(t);)t=this.nextGroupId.next();return t}createGroup(t){t||(t={});let n=t==null?void 0:t.id;if(n&&this._groups.has(t.id)&&(console.warn(`dockview: Duplicate group id ${t==null?void 0:t.id}. reassigning group id to avoid errors`),n=void 0),!n)for(n=this.nextGroupId.next();this._groups.has(n);)n=this.nextGroupId.next();const s=new Z_(this,n,t);if(s.init({params:{},accessor:this}),!this._groups.has(s.id)){const a=new Ge(s.model.onTabDragStart(r=>{this._onWillDragPanel.fire(r)}),s.model.onGroupDragStart(r=>{this._onWillDragGroup.fire(r)}),s.model.onMove(r=>{const{groupId:o,itemId:l,target:c,index:d}=r;this.moveGroupOrPanel({from:{groupId:o,panelId:l},to:{group:s,position:c,index:d}})}),s.model.onDidDrop(r=>{this._onDidDrop.fire(r)}),s.model.onWillDrop(r=>{this._onWillDrop.fire(r)}),s.model.onWillShowOverlay(r=>{if(this.options.disableDnd){r.preventDefault();return}this._onWillShowOverlay.fire(r)}),s.model.onUnhandledDragOverEvent(r=>{this._onUnhandledDragOverEvent.fire(r)}),s.model.onDidAddPanel(r=>{this._moving||this._onDidAddPanel.fire(r.panel)}),s.model.onDidRemovePanel(r=>{this._moving||this._onDidRemovePanel.fire(r.panel)}),s.model.onDidActivePanelChange(r=>{this._moving||r.panel===this.activePanel&&this._onDidActivePanelChange.value!==r.panel&&this._onDidActivePanelChange.fire(r.panel)}),vr.any(s.model.onDidPanelTitleChange,s.model.onDidPanelParametersChange)(()=>{this._bufferOnDidLayoutChange.fire()}));this._groups.set(s.id,{value:s,disposable:a})}return s.initialize(),s}createPanel(t,n){var s,a,r;const o=t.component,l=(s=t.tabComponent)!==null&&s!==void 0?s:this.options.defaultTabComponent,c=new OA(this,t.id,o,l),d=new ao(t.id,o,l,this,this._api,n,c,{renderer:t.renderer,minimumWidth:t.minimumWidth,minimumHeight:t.minimumHeight,maximumWidth:t.maximumWidth,maximumHeight:t.maximumHeight});return d.init({title:(a=t.title)!==null&&a!==void 0?a:t.id,params:(r=t==null?void 0:t.params)!==null&&r!==void 0?r:{}}),d}createGroupAtLocation(t,n,s){const a=this.createGroup(s);return this.doAddGroup(a,t,n),a}findGroup(t){var n;return(n=Array.from(this._groups.values()).find(s=>s.value.model.containsPanel(t)))===null||n===void 0?void 0:n.value}orientationAtLocation(t){const n=this.gridview.orientation;return t.length%2==1?n:ai(n)}updateDropTargetModel(t){"dndEdges"in t&&(this._rootDropTarget.disabled=typeof t.dndEdges=="boolean"&&t.dndEdges===!1,typeof t.dndEdges=="object"&&t.dndEdges!==null?this._rootDropTarget.setOverlayModel(t.dndEdges):this._rootDropTarget.setOverlayModel(tj)),"rootOverlayModel"in t&&this.updateDropTargetModel({dndEdges:t.dndEdges})}updateTheme(){var t,n;const s=(t=this._options.theme)!==null&&t!==void 0?t:l8;switch(this._themeClassnames.setClassNames(s.className),this.gridview.margin=(n=s.gap)!==null&&n!==void 0?n:0,s.dndOverlayMounting){case"absolute":this.rootDropTargetContainer.disabled=!1;break;case"relative":default:this.rootDropTargetContainer.disabled=!0;break}}}class _8 extends yA{get orientation(){return this.gridview.orientation}set orientation(t){this.gridview.orientation=t}get options(){return this._options}get deserializer(){return this._deserializer}set deserializer(t){this._deserializer=t}constructor(t,n){var s;super(t,{proportionalLayout:(s=n.proportionalLayout)!==null&&s!==void 0?s:!0,orientation:n.orientation,styles:n.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:n.disableAutoResizing,className:n.className}),this._onDidLayoutfromJSON=new te,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidRemoveGroup=new te,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new te,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidActiveGroupChange=new te,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._options=n,this.addDisposables(this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this.onDidAdd(a=>{this._onDidAddGroup.fire(a)}),this.onDidRemove(a=>{this._onDidRemoveGroup.fire(a)}),this.onDidActiveChange(a=>{this._onDidActiveGroupChange.fire(a)}))}updateOptions(t){super.updateOptions(t);const n=typeof t.orientation=="string"&&this.gridview.orientation!==t.orientation;this._options=Object.assign(Object.assign({},this.options),t),n&&(this.gridview.orientation=t.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}removePanel(t){this.removeGroup(t)}toJSON(){var t;return{grid:this.gridview.serialize(),activePanel:(t=this.activeGroup)===null||t===void 0?void 0:t.id}}setVisible(t,n){this.gridview.setViewVisible(Ht(t.element),n)}setActive(t){this._groups.forEach((n,s)=>{n.value.setActive(t===n.value)})}focus(){var t;(t=this.activeGroup)===null||t===void 0||t.focus()}fromJSON(t){this.clear();const{grid:n,activePanel:s}=t;try{const a=[],r=this.width,o=this.height;if(this.gridview.deserialize(n,{fromJSON:l=>{const{data:c}=l,d=this.options.createComponent({id:c.id,name:c.component});return a.push(()=>d.init({params:c.params,minimumWidth:c.minimumWidth,maximumWidth:c.maximumWidth,minimumHeight:c.minimumHeight,maximumHeight:c.maximumHeight,priority:c.priority,snap:!!c.snap,accessor:this,isVisible:l.visible})),this._onDidAddGroup.fire(d),this.registerPanel(d),d}}),this.layout(r,o,!0),a.forEach(l=>l()),typeof s=="string"){const l=this.getPanel(s);l&&this.doSetGroupActive(l)}}catch(a){for(const r of this.groups)r.dispose(),this._groups.delete(r.id),this._onDidRemoveGroup.fire(r);throw this.clear(),a}this._onDidLayoutfromJSON.fire()}clear(){const t=this.activeGroup,n=Array.from(this._groups.values());for(const s of n)s.disposable.dispose(),this.doRemoveGroup(s.value,{skipActive:!0});t&&this.doSetGroupActive(void 0),this.gridview.clear()}movePanel(t,n){var s;let a;const r=this.gridview.remove(t),o=(s=this._groups.get(n.reference))===null||s===void 0?void 0:s.value;if(!o)throw new Error(`reference group ${n.reference} does not exist`);const l=Ih(n.direction);if(l==="center")throw new Error(`${l} not supported as an option`);{const c=Ht(o.element);a=ti(this.gridview.orientation,c,l)}this.doAddGroup(r,a,n.size)}addPanel(t){var n,s,a,r;let o=(n=t.location)!==null&&n!==void 0?n:[0];if(!((s=t.position)===null||s===void 0)&&s.referencePanel){const c=(a=this._groups.get(t.position.referencePanel))===null||a===void 0?void 0:a.value;if(!c)throw new Error(`reference group ${t.position.referencePanel} does not exist`);const d=Ih(t.position.direction);if(d==="center")throw new Error(`${d} not supported as an option`);{const h=Ht(c.element);o=ti(this.gridview.orientation,h,d)}}const l=this.options.createComponent({id:t.id,name:t.component});return l.init({params:(r=t.params)!==null&&r!==void 0?r:{},minimumWidth:t.minimumWidth,maximumWidth:t.maximumWidth,minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight,priority:t.priority,snap:!!t.snap,accessor:this,isVisible:!0}),this.registerPanel(l),this.doAddGroup(l,o,t.size),this.doSetGroupActive(l),l}registerPanel(t){const n=new Ge(t.api.onDidFocusChange(s=>{s.isFocused&&this._groups.forEach(a=>{const r=a.value;r!==t?r.setActive(!1):r.setActive(!0)})}));this._groups.set(t.id,{value:t,disposable:n})}moveGroup(t,n,s){const a=this.getPanel(n);if(!a)throw new Error("invalid operation");const r=Ht(t.element),o=ti(this.gridview.orientation,r,s),[l,c]=Pi(o),d=Ht(a.element),[h,f]=Pi(d);if(vA(h,l)){this.gridview.moveView(h,f,c);return}const m=this.doRemoveGroup(a,{skipActive:!0,skipDispose:!0}),p=Ht(t.element),y=ti(this.gridview.orientation,p,s);this.doAddGroup(m,y)}removeGroup(t){super.removeGroup(t)}dispose(){super.dispose(),this._onDidLayoutfromJSON.dispose()}}class j8 extends Pb{get panels(){return this.splitview.getViews()}get options(){return this._options}get length(){return this._panels.size}get orientation(){return this.splitview.orientation}get splitview(){return this._splitview}set splitview(t){this._splitview&&this._splitview.dispose(),this._splitview=t,this._splitviewChangeDisposable.value=new Ge(this._splitview.onDidSashEnd(()=>{this._onDidLayoutChange.fire(void 0)}),this._splitview.onDidAddView(n=>this._onDidAddView.fire(n)),this._splitview.onDidRemoveView(n=>this._onDidRemoveView.fire(n)))}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get height(){return this.splitview.orientation===Me.HORIZONTAL?this.splitview.orthogonalSize:this.splitview.size}get width(){return this.splitview.orientation===Me.HORIZONTAL?this.splitview.size:this.splitview.orthogonalSize}constructor(t,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._splitviewChangeDisposable=new On,this._panels=new Map,this._onDidLayoutfromJSON=new te,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidAddView=new te,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new te,this.onDidRemoveView=this._onDidRemoveView.event,this._onDidLayoutChange=new te,this.onDidLayoutChange=this._onDidLayoutChange.event,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new am(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),t.appendChild(this.element),this._options=n,this.splitview=new Yc(this.element,n),this.addDisposables(this._onDidAddView,this._onDidLayoutfromJSON,this._onDidRemoveView,this._onDidLayoutChange)}updateOptions(t){var n,s;"className"in t&&this._classNames.setClassNames((n=t.className)!==null&&n!==void 0?n:""),"disableResizing"in t&&(this.disableResizing=(s=t.disableAutoResizing)!==null&&s!==void 0?s:!1),typeof t.orientation=="string"&&(this.splitview.orientation=t.orientation),this._options=Object.assign(Object.assign({},this.options),t),this.splitview.layout(this.splitview.size,this.splitview.orthogonalSize)}focus(){var t;(t=this._activePanel)===null||t===void 0||t.focus()}movePanel(t,n){this.splitview.moveView(t,n)}setVisible(t,n){const s=this.panels.indexOf(t);this.splitview.setViewVisible(s,n)}setActive(t,n){this._activePanel=t,this.panels.filter(s=>s!==t).forEach(s=>{s.api._onDidActiveChange.fire({isActive:!1}),n||s.focus()}),t.api._onDidActiveChange.fire({isActive:!0}),n||t.focus()}removePanel(t,n){const s=this._panels.get(t.id);if(!s)throw new Error(`unknown splitview panel ${t.id}`);s.dispose(),this._panels.delete(t.id);const a=this.panels.findIndex(l=>l===t);this.splitview.removeView(a,n).dispose();const o=this.panels;o.length>0&&this.setActive(o[o.length-1])}getPanel(t){return this.panels.find(n=>n.id===t)}addPanel(t){var n;if(this._panels.has(t.id))throw new Error(`panel ${t.id} already exists`);const s=this.options.createComponent({id:t.id,name:t.component});s.orientation=this.splitview.orientation,s.init({params:(n=t.params)!==null&&n!==void 0?n:{},minimumSize:t.minimumSize,maximumSize:t.maximumSize,snap:t.snap,priority:t.priority,accessor:this});const a=typeof t.size=="number"?t.size:Es.Distribute,r=typeof t.index=="number"?t.index:void 0;return this.splitview.addView(s,a,r),this.doAddView(s),this.setActive(s),s}layout(t,n){const[s,a]=this.splitview.orientation===Me.HORIZONTAL?[t,n]:[n,t];this.splitview.layout(s,a)}doAddView(t){const n=t.api.onDidFocusChange(s=>{s.isFocused&&this.setActive(t,!0)});this._panels.set(t.id,n)}toJSON(){var t;return{views:this.splitview.getViews().map((s,a)=>({size:this.splitview.getViewSize(a),data:s.toJSON(),snap:!!s.snap,priority:s.priority})),activeView:(t=this._activePanel)===null||t===void 0?void 0:t.id,size:this.splitview.size,orientation:this.splitview.orientation}}fromJSON(t){this.clear();const{views:n,orientation:s,size:a,activeView:r}=t,o=[],l=this.width,c=this.height;if(this.splitview=new Yc(this.element,{orientation:s,proportionalLayout:this.options.proportionalLayout,descriptor:{size:a,views:n.map(d=>{const h=d.data;if(this._panels.has(h.id))throw new Error(`panel ${h.id} already exists`);const f=this.options.createComponent({id:h.id,name:h.component});return o.push(()=>{var m;f.init({params:(m=h.params)!==null&&m!==void 0?m:{},minimumSize:h.minimumSize,maximumSize:h.maximumSize,snap:d.snap,priority:d.priority,accessor:this})}),f.orientation=s,this.doAddView(f),setTimeout(()=>{this._onDidAddView.fire(f)},0),{size:d.size,view:f}})}}),this.layout(l,c),o.forEach(d=>d()),typeof r=="string"){const d=this.getPanel(r);d&&this.setActive(d)}this._onDidLayoutfromJSON.fire()}clear(){for(const t of this._panels.values())t.dispose();for(this._panels.clear();this.splitview.length>0;)this.splitview.removeView(0,Es.Distribute,!0).dispose()}dispose(){for(const n of this._panels.values())n.dispose();this._panels.clear();const t=this.splitview.getViews();this._splitviewChangeDisposable.dispose(),this.splitview.dispose();for(const n of t)n.dispose();this.element.remove(),super.dispose()}}class nj extends Ge{get element(){return this._element}constructor(){super(),this._expandedIcon=Z5(),this._collapsedIcon=EA(),this.disposable=new On,this.apiRef={api:null},this._element=document.createElement("div"),this.element.className="dv-default-header",this._content=document.createElement("span"),this._expander=document.createElement("div"),this._expander.className="dv-pane-header-icon",this.element.appendChild(this._expander),this.element.appendChild(this._content),this.addDisposables(Fe(this._element,"click",()=>{var t;(t=this.apiRef.api)===null||t===void 0||t.setExpanded(!this.apiRef.api.isExpanded)}))}init(t){this.apiRef.api=t.api,this._content.textContent=t.title,this.updateIcon(),this.disposable.value=t.api.onDidExpansionChange(()=>{this.updateIcon()})}updateIcon(){var t;const n=!!(!((t=this.apiRef.api)===null||t===void 0)&&t.isExpanded);Pe(this._expander,"collapsed",!n),n?(this._expander.contains(this._collapsedIcon)&&this._collapsedIcon.remove(),this._expander.contains(this._expandedIcon)||this._expander.appendChild(this._expandedIcon)):(this._expander.contains(this._expandedIcon)&&this._expandedIcon.remove(),this._expander.contains(this._collapsedIcon)||this._expander.appendChild(this._collapsedIcon))}update(t){}dispose(){this.disposable.dispose(),super.dispose()}}const N8=Lb(),sj=22,ij=0,aj=Number.MAX_SAFE_INTEGER;class rj extends U5{constructor(t){super({accessor:t.accessor,id:t.id,component:t.component,headerComponent:t.headerComponent,orientation:t.orientation,isExpanded:t.isExpanded,disableDnd:t.disableDnd,headerSize:t.headerSize,minimumBodySize:t.minimumBodySize,maximumBodySize:t.maximumBodySize}),this.options=t}getBodyComponent(){return this.options.body}getHeaderComponent(){return this.options.header}}class k8 extends Pb{get id(){return this._id}get panels(){return this.paneview.getPanes()}set paneview(t){this._paneview=t,this._disposable.value=new Ge(this._paneview.onDidChange(()=>{this._onDidLayoutChange.fire(void 0)}),this._paneview.onDidAddView(n=>this._onDidAddView.fire(n)),this._paneview.onDidRemoveView(n=>this._onDidRemoveView.fire(n)))}get paneview(){return this._paneview}get minimumSize(){return this.paneview.minimumSize}get maximumSize(){return this.paneview.maximumSize}get height(){return this.paneview.orientation===Me.HORIZONTAL?this.paneview.orthogonalSize:this.paneview.size}get width(){return this.paneview.orientation===Me.HORIZONTAL?this.paneview.size:this.paneview.orthogonalSize}get options(){return this._options}constructor(t,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._id=N8.next(),this._disposable=new On,this._viewDisposables=new Map,this._onDidLayoutfromJSON=new te,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidLayoutChange=new te,this.onDidLayoutChange=this._onDidLayoutChange.event,this._onDidDrop=new te,this.onDidDrop=this._onDidDrop.event,this._onDidAddView=new te,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new te,this.onDidRemoveView=this._onDidRemoveView.event,this._onUnhandledDragOverEvent=new te,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.element.style.height="100%",this.element.style.width="100%",this.addDisposables(this._onDidLayoutChange,this._onDidLayoutfromJSON,this._onDidDrop,this._onDidAddView,this._onDidRemoveView,this._onUnhandledDragOverEvent),this._classNames=new am(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),t.appendChild(this.element),this._options=n,this.paneview=new X_(this.element,{orientation:Me.VERTICAL}),this.addDisposables(this._disposable)}setVisible(t,n){const s=this.panels.indexOf(t);this.paneview.setViewVisible(s,n)}focus(){}updateOptions(t){var n,s;"className"in t&&this._classNames.setClassNames((n=t.className)!==null&&n!==void 0?n:""),"disableResizing"in t&&(this.disableResizing=(s=t.disableAutoResizing)!==null&&s!==void 0?s:!1),this._options=Object.assign(Object.assign({},this.options),t)}addPanel(t){var n,s;const a=this.options.createComponent({id:t.id,name:t.component});let r;t.headerComponent&&this.options.createHeaderComponent&&(r=this.options.createHeaderComponent({id:t.id,name:t.headerComponent})),r||(r=new nj);const o=new rj({id:t.id,component:t.component,headerComponent:t.headerComponent,header:r,body:a,orientation:Me.VERTICAL,isExpanded:!!t.isExpanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(n=t.headerSize)!==null&&n!==void 0?n:sj,minimumBodySize:ij,maximumBodySize:aj});this.doAddPanel(o);const l=typeof t.size=="number"?t.size:Es.Distribute,c=typeof t.index=="number"?t.index:void 0;return o.init({params:(s=t.params)!==null&&s!==void 0?s:{},minimumBodySize:t.minimumBodySize,maximumBodySize:t.maximumBodySize,isExpanded:t.isExpanded,title:t.title,containerApi:new Xc(this),accessor:this}),this.paneview.addPane(o,l,c),o.orientation=this.paneview.orientation,o}removePanel(t){const s=this.panels.findIndex(a=>a===t);this.paneview.removePane(s),this.doRemovePanel(t)}movePanel(t,n){this.paneview.moveView(t,n)}getPanel(t){return this.panels.find(n=>n.id===t)}layout(t,n){const[s,a]=this.paneview.orientation===Me.HORIZONTAL?[t,n]:[n,t];this.paneview.layout(s,a)}toJSON(){const t=a=>a===Number.MAX_SAFE_INTEGER||a===Number.POSITIVE_INFINITY?void 0:a,n=a=>a<=0?void 0:a;return{views:this.paneview.getPanes().map((a,r)=>({size:this.paneview.getViewSize(r),data:a.toJSON(),minimumSize:n(a.minimumBodySize),maximumSize:t(a.maximumBodySize),headerSize:a.headerSize,expanded:a.isExpanded()})),size:this.paneview.size}}fromJSON(t){this.clear();const{views:n,size:s}=t,a=[],r=this.width,o=this.height;this.paneview=new X_(this.element,{orientation:Me.VERTICAL,descriptor:{size:s,views:n.map(l=>{var c,d,h;const f=l.data,m=this.options.createComponent({id:f.id,name:f.component});let p;f.headerComponent&&this.options.createHeaderComponent&&(p=this.options.createHeaderComponent({id:f.id,name:f.headerComponent})),p||(p=new nj);const y=new rj({id:f.id,component:f.component,headerComponent:f.headerComponent,header:p,body:m,orientation:Me.VERTICAL,isExpanded:!!l.expanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(c=l.headerSize)!==null&&c!==void 0?c:sj,minimumBodySize:(d=l.minimumSize)!==null&&d!==void 0?d:ij,maximumBodySize:(h=l.maximumSize)!==null&&h!==void 0?h:aj});return this.doAddPanel(y),a.push(()=>{var g;y.init({params:(g=f.params)!==null&&g!==void 0?g:{},minimumBodySize:l.minimumSize,maximumBodySize:l.maximumSize,title:f.title,isExpanded:!!l.expanded,containerApi:new Xc(this),accessor:this}),y.orientation=this.paneview.orientation}),setTimeout(()=>{this._onDidAddView.fire(y)},0),{size:l.size,view:y}})}}),this.layout(r,o),a.forEach(l=>l()),this._onDidLayoutfromJSON.fire()}clear(){for(const[t,n]of this._viewDisposables.entries())n.dispose();this._viewDisposables.clear(),this.paneview.dispose()}doAddPanel(t){const n=new Ge(t.onDidDrop(s=>{this._onDidDrop.fire(s)}),t.onUnhandledDragOverEvent(s=>{this._onUnhandledDragOverEvent.fire(s)}));this._viewDisposables.set(t.id,n)}doRemovePanel(t){const n=this._viewDisposables.get(t.id);n&&(n.dispose(),this._viewDisposables.delete(t.id))}dispose(){super.dispose();for(const[t,n]of this._viewDisposables.entries())n.dispose();this._viewDisposables.clear(),this.element.remove(),this.paneview.dispose()}}class S8 extends Gb{get priority(){return this._priority}set orientation(t){this._orientation=t}get orientation(){return this._orientation}get minimumSize(){const t=typeof this._minimumSize=="function"?this._minimumSize():this._minimumSize;return t!==this._evaluatedMinimumSize&&(this._evaluatedMinimumSize=t,this.updateConstraints()),t}get maximumSize(){const t=typeof this._maximumSize=="function"?this._maximumSize():this._maximumSize;return t!==this._evaluatedMaximumSize&&(this._evaluatedMaximumSize=t,this.updateConstraints()),t}get snap(){return this._snap}constructor(t,n){super(t,n,new CA(t,n)),this._evaluatedMinimumSize=0,this._evaluatedMaximumSize=Number.POSITIVE_INFINITY,this._minimumSize=0,this._maximumSize=Number.POSITIVE_INFINITY,this._snap=!1,this._onDidChange=new te,this.onDidChange=this._onDidChange.event,this.api.initialize(this),this.addDisposables(this._onDidChange,this.api.onWillVisibilityChange(s=>{const{isVisible:a}=s,{accessor:r}=this._params;r.setVisible(this,a)}),this.api.onActiveChange(()=>{const{accessor:s}=this._params;s.setActive(this)}),this.api.onDidConstraintsChangeInternal(s=>{(typeof s.minimumSize=="number"||typeof s.minimumSize=="function")&&(this._minimumSize=s.minimumSize),(typeof s.maximumSize=="number"||typeof s.maximumSize=="function")&&(this._maximumSize=s.maximumSize),this.updateConstraints()}),this.api.onDidSizeChange(s=>{this._onDidChange.fire({size:s.size})}))}setVisible(t){this.api._onDidVisibilityChange.fire({isVisible:t})}setActive(t){this.api._onDidActiveChange.fire({isActive:t})}layout(t,n){const[s,a]=this.orientation===Me.HORIZONTAL?[t,n]:[n,t];super.layout(s,a)}init(t){super.init(t),this._priority=t.priority,t.minimumSize&&(this._minimumSize=t.minimumSize),t.maximumSize&&(this._maximumSize=t.maximumSize),t.snap&&(this._snap=t.snap)}toJSON(){const t=s=>s===Number.MAX_SAFE_INTEGER||s===Number.POSITIVE_INFINITY?void 0:s,n=s=>s<=0?void 0:s;return Object.assign(Object.assign({},super.toJSON()),{minimumSize:n(this.minimumSize),maximumSize:t(this.maximumSize)})}updateConstraints(){this.api._onDidConstraintsChange.fire({maximumSize:this._evaluatedMaximumSize,minimumSize:this._evaluatedMinimumSize})}}function C8(e,t){return new w8(e,t).api}function D8(e,t){const n=new j8(e,t);return new wA(n)}function E8(e,t){const n=new _8(e,t);return new _A(n)}function A8(e,t){const n=new k8(e,t);return new Xc(n)}const zA=(e,t)=>{const[n,s]=Te.useState(),a=Te.useRef(e.componentProps);return Te.useImperativeHandle(t,()=>({update:r=>{a.current=Object.assign(Object.assign({},a.current),r),s(Date.now())}}),[]),Te.createElement(e.component,a.current)};zA.displayName="DockviewReactJsBridge";const R8=(()=>{let e=1;return{next:()=>`dockview_react_portal_key_${(e++).toString()}`}})(),T8=Te.createContext({});class Pr{constructor(t,n,s,a,r){this.parent=t,this.portalStore=n,this.component=s,this.parameters=a,this.context=r,this._initialProps={},this.disposed=!1,this.createPortal()}update(t){if(this.disposed)throw new Error("invalid operation: resource is already disposed");this.componentInstance?this.componentInstance.update(t):this._initialProps=Object.assign(Object.assign({},this._initialProps),t)}createPortal(){if(this.disposed)throw new Error("invalid operation: resource is already disposed");if(!O8(this.component))throw new Error("Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components");const t=Te.createElement(Te.forwardRef(zA),{component:this.component,componentProps:this.parameters,ref:a=>{this.componentInstance=a,Object.keys(this._initialProps).length>0&&(this.componentInstance.update(this._initialProps),this._initialProps={})}}),n=this.context?Te.createElement(T8.Provider,{value:this.context},t):t,s=t0.createPortal(n,this.parent,R8.next());this.ref={portal:s,disposable:this.portalStore.addPortal(s)}}dispose(){var t;(t=this.ref)===null||t===void 0||t.disposable.dispose(),this.disposed=!0}}const lm=()=>{const[e,t]=Te.useState([]);Te.useDebugValue(`Portal count: ${e.length}`);const n=Te.useCallback(s=>{t(r=>[...r,s]);let a=!1;return Zt.from(()=>{if(a)throw new Error("invalid operation: resource already disposed");a=!0,t(r=>r.filter(o=>o!==s))})},[]);return[e,n]};function O8(e){return typeof e=="function"||!!(e!=null&&e.$$typeof)}class oj{get element(){return this._element}constructor(t,n,s){this.id=t,this.component=n,this.reactPortalStore=s,this._onDidFocus=new te,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new te,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(t){this.part=new Pr(this.element,this.reactPortalStore,this.component,{params:t.params,api:t.api,containerApi:t.containerApi})}update(t){var n;(n=this.part)===null||n===void 0||n.update({params:t.params})}layout(t,n){}dispose(){var t;this._onDidFocus.dispose(),this._onDidBlur.dispose(),(t=this.part)===null||t===void 0||t.dispose()}}class lj{get element(){return this._element}constructor(t,n,s){this.id=t,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(t){this.part=new Pr(this.element,this.reactPortalStore,this.component,{params:t.params,api:t.api,containerApi:t.containerApi,tabLocation:t.tabLocation})}update(t){var n;(n=this.part)===null||n===void 0||n.update({params:t.params})}layout(t,n){}dispose(){var t;(t=this.part)===null||t===void 0||t.dispose()}}class cj{get element(){return this._element}constructor(t,n,s){this.id=t,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(t){this.part=new Pr(this.element,this.reactPortalStore,this.component,{group:t.group,containerApi:t.containerApi})}focus(){}update(t){var n,s,a;this.parameters&&(this.parameters.params=t.params),(n=this.part)===null||n===void 0||n.update({params:(a=(s=this.parameters)===null||s===void 0?void 0:s.params)!==null&&a!==void 0?a:{}})}layout(t,n){}dispose(){var t;(t=this.part)===null||t===void 0||t.dispose()}}class z8{get element(){return this._element}get part(){return this._part}constructor(t,n,s){this.component=t,this.reactPortalStore=n,this._group=s,this.mutableDisposable=new On,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(t){this.mutableDisposable.value=new Ge(this._group.model.onDidAddPanel(()=>{this.updatePanels()}),this._group.model.onDidRemovePanel(()=>{this.updatePanels()}),this._group.model.onDidActivePanelChange(()=>{this.updateActivePanel()}),t.api.onDidActiveChange(()=>{this.updateGroupActive()})),this._part=new Pr(this.element,this.reactPortalStore,this.component,{api:t.api,containerApi:t.containerApi,panels:this._group.model.panels,activePanel:this._group.model.activePanel,isGroupActive:this._group.api.isActive,group:this._group})}dispose(){var t;this.mutableDisposable.dispose(),(t=this._part)===null||t===void 0||t.dispose()}update(t){var n;(n=this._part)===null||n===void 0||n.update(t.params)}updatePanels(){this.update({params:{panels:this._group.model.panels}})}updateActivePanel(){this.update({params:{activePanel:this._group.model.activePanel}})}updateGroupActive(){this.update({params:{isGroupActive:this._group.api.isActive}})}}function Qr(e,t){return e?n=>new z8(e,t,n):void 0}const mu="props.defaultTabComponent";function M8(e){return mx.reduce((n,s)=>(s in e&&(n[s]=e[s]),n),{})}const MA=Te.forwardRef((e,t)=>{const n=Te.useRef(null),s=Te.useRef(),[a,r]=lm();Te.useImperativeHandle(t,()=>n.current,[]);const o=Te.useRef({});return Te.useEffect(()=>{const l={};mx.forEach(c=>{const d=c,h=e[d];d in e&&h!==o.current[d]&&(l[d]=h)}),s.current&&s.current.updateOptions(l),o.current=e},mx.map(l=>e[l])),Te.useEffect(()=>{var l;if(!n.current)return;const c=(l=e.tabComponents)!==null&&l!==void 0?l:{};e.defaultTabComponent&&(c[mu]=e.defaultTabComponent);const d={createLeftHeaderActionComponent:Qr(e.leftHeaderActionsComponent,{addPortal:r}),createRightHeaderActionComponent:Qr(e.rightHeaderActionsComponent,{addPortal:r}),createPrefixHeaderActionComponent:Qr(e.prefixHeaderActionsComponent,{addPortal:r}),createComponent:p=>new oj(p.id,e.components[p.name],{addPortal:r}),createTabComponent(p){return new lj(p.id,c[p.name],{addPortal:r})},createWatermarkComponent:e.watermarkComponent?()=>new cj("watermark",e.watermarkComponent,{addPortal:r}):void 0,defaultTabComponent:e.defaultTabComponent?mu:void 0},h=C8(n.current,Object.assign(Object.assign({},M8(e)),d)),{clientWidth:f,clientHeight:m}=n.current;return h.layout(f,m),e.onReady&&e.onReady({api:h}),s.current=h,()=>{s.current=void 0,h.dispose()}},[]),Te.useEffect(()=>{if(!s.current)return()=>{};const l=s.current.onDidDrop(c=>{e.onDidDrop&&e.onDidDrop(c)});return()=>{l.dispose()}},[e.onDidDrop]),Te.useEffect(()=>{if(!s.current)return()=>{};const l=s.current.onWillDrop(c=>{e.onWillDrop&&e.onWillDrop(c)});return()=>{l.dispose()}},[e.onWillDrop]),Te.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:l=>new oj(l.id,e.components[l.name],{addPortal:r})})},[e.components]),Te.useEffect(()=>{var l;if(!s.current)return;const c=(l=e.tabComponents)!==null&&l!==void 0?l:{};e.defaultTabComponent&&(c[mu]=e.defaultTabComponent),s.current.updateOptions({defaultTabComponent:e.defaultTabComponent?mu:void 0,createTabComponent(d){return new lj(d.id,c[d.name],{addPortal:r})}})},[e.tabComponents,e.defaultTabComponent]),Te.useEffect(()=>{s.current&&s.current.updateOptions({createWatermarkComponent:e.watermarkComponent?()=>new cj("watermark",e.watermarkComponent,{addPortal:r}):void 0})},[e.watermarkComponent]),Te.useEffect(()=>{s.current&&s.current.updateOptions({createRightHeaderActionComponent:Qr(e.rightHeaderActionsComponent,{addPortal:r})})},[e.rightHeaderActionsComponent]),Te.useEffect(()=>{s.current&&s.current.updateOptions({createLeftHeaderActionComponent:Qr(e.leftHeaderActionsComponent,{addPortal:r})})},[e.leftHeaderActionsComponent]),Te.useEffect(()=>{s.current&&s.current.updateOptions({createPrefixHeaderActionComponent:Qr(e.prefixHeaderActionsComponent,{addPortal:r})})},[e.prefixHeaderActionsComponent]),Te.createElement("div",{style:{height:"100%",width:"100%"},ref:n},a)});MA.displayName="DockviewComponent";class dj extends S8{constructor(t,n,s,a){super(t,n),this.reactComponent=s,this.reactPortalStore=a}getComponent(){var t,n;return new Pr(this.element,this.reactPortalStore,this.reactComponent,{params:(n=(t=this._params)===null||t===void 0?void 0:t.params)!==null&&n!==void 0?n:{},api:this.api,containerApi:new wA(this._params.accessor)})}}function $8(e){return lx.reduce((n,s)=>(s in e&&(n[s]=e[s]),n),{})}const L8=Te.forwardRef((e,t)=>{const n=Te.useRef(null),s=Te.useRef(),[a,r]=lm();Te.useImperativeHandle(t,()=>n.current,[]);const o=Te.useRef({});return Te.useEffect(()=>{const l={};lx.forEach(c=>{const d=c,h=e[d];d in e&&h!==o.current[d]&&(l[d]=h)}),s.current&&s.current.updateOptions(l),o.current=e},lx.map(l=>e[l])),Te.useEffect(()=>{if(!n.current)return()=>{};const l={createComponent:f=>new dj(f.id,f.name,e.components[f.name],{addPortal:r})},c=D8(n.current,Object.assign(Object.assign({},$8(e)),l)),{clientWidth:d,clientHeight:h}=n.current;return c.layout(d,h),e.onReady&&e.onReady({api:c}),s.current=c,()=>{s.current=void 0,c.dispose()}},[]),Te.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:l=>new dj(l.id,l.name,e.components[l.name],{addPortal:r})})},[e.components]),Te.createElement("div",{style:{height:"100%",width:"100%"},ref:n},a)});L8.displayName="SplitviewComponent";class uj extends TA{constructor(t,n,s,a){super(t,n),this.reactComponent=s,this.reactPortalStore=a}getComponent(){var t,n;return new Pr(this.element,this.reactPortalStore,this.reactComponent,{params:(n=(t=this._params)===null||t===void 0?void 0:t.params)!==null&&n!==void 0?n:{},api:this.api,containerApi:new _A(this._params.accessor)})}}function P8(e){return hx.reduce((n,s)=>(s in e&&(n[s]=e[s]),n),{})}const I8=Te.forwardRef((e,t)=>{const n=Te.useRef(null),s=Te.useRef(),[a,r]=lm();Te.useImperativeHandle(t,()=>n.current,[]);const o=Te.useRef({});return Te.useEffect(()=>{const l={};hx.forEach(c=>{const d=c,h=e[d];d in e&&h!==o.current[d]&&(l[d]=h)}),s.current&&s.current.updateOptions(l),o.current=e},hx.map(l=>e[l])),Te.useEffect(()=>{if(!n.current)return()=>{};const l={createComponent:f=>new uj(f.id,f.name,e.components[f.name],{addPortal:r})},c=E8(n.current,Object.assign(Object.assign({},P8(e)),l)),{clientWidth:d,clientHeight:h}=n.current;return c.layout(d,h),e.onReady&&e.onReady({api:c}),s.current=c,()=>{s.current=void 0,c.dispose()}},[]),Te.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:l=>new uj(l.id,l.name,e.components[l.name],{addPortal:r})})},[e.components]),Te.createElement("div",{style:{height:"100%",width:"100%"},ref:n},a)});I8.displayName="GridviewComponent";class pu{get element(){return this._element}constructor(t,n,s){this.id=t,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%"}init(t){this.part=new Pr(this.element,this.reactPortalStore,this.component,{params:t.params,api:t.api,title:t.title,containerApi:t.containerApi})}toJSON(){return{id:this.id}}update(t){var n;(n=this.part)===null||n===void 0||n.update(t.params)}dispose(){var t;(t=this.part)===null||t===void 0||t.dispose()}}function G8(e){return fx.reduce((n,s)=>(s in e&&(n[s]=e[s]),n),{})}const H8=Te.forwardRef((e,t)=>{const n=Te.useRef(null),s=Te.useRef(),[a,r]=lm();Te.useImperativeHandle(t,()=>n.current,[]);const o=Te.useRef({});return Te.useEffect(()=>{const l={};fx.forEach(c=>{const d=c,h=e[d];d in e&&h!==o.current[d]&&(l[d]=h)}),s.current&&s.current.updateOptions(l),o.current=e},fx.map(l=>e[l])),Te.useEffect(()=>{var l;if(!n.current)return()=>{};const c=(l=e.headerComponents)!==null&&l!==void 0?l:{},d={createComponent:p=>new pu(p.id,e.components[p.name],{addPortal:r}),createHeaderComponent:p=>new pu(p.id,c[p.name],{addPortal:r})},h=A8(n.current,Object.assign(Object.assign({},G8(e)),d)),{clientWidth:f,clientHeight:m}=n.current;return h.layout(f,m),e.onReady&&e.onReady({api:h}),s.current=h,()=>{s.current=void 0,h.dispose()}},[]),Te.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:l=>new pu(l.id,e.components[l.name],{addPortal:r})})},[e.components]),Te.useEffect(()=>{var l;if(!s.current)return;const c=(l=e.headerComponents)!==null&&l!==void 0?l:{};s.current.updateOptions({createHeaderComponent:d=>new pu(d.id,c[d.name],{addPortal:r})})},[e.headerComponents]),Te.useEffect(()=>{if(!s.current)return()=>{};const l=s.current.onDidDrop(c=>{e.onDidDrop&&e.onDidDrop(c)});return()=>{l.dispose()}},[e.onDidDrop]),Te.createElement("div",{style:{height:"100%",width:"100%"},ref:n},a)});H8.displayName="PaneviewComponent";const V8={get pathname(){return window.location.pathname},get search(){return window.location.search},get hash(){return window.location.hash},replace:e=>window.location.replace(e),setSearch:e=>window.history.replaceState(window.history.state,"",`${window.location.pathname}${e}`)},Bb=u.createContext(null);function xl(){return u.useContext(Bb)??V8}const $A=u.createContext(null);function Ed(e=window.location.pathname){const[t]=e.split("/").filter(Boolean);return t?`/${t}/`:"/"}function Oa(e){const t=e.indexOf("#"),n=t<0?"":e.slice(t),s=t<0?e:e.slice(0,t),a=s.indexOf("?");return{path:a<0?s:s.slice(0,a),search:a<0?"":s.slice(a),hash:n}}const Wb=/^#(?:(releases)|release=(.+)|planned(?:=(.+))?)$/,LA=/^#task=(.+)$/,PA=/^#issue=(.+)$/;function hj(e,t){const n=Oa(e),s=Oa(t),a=r=>Wb.test(r)||LA.test(r)||PA.test(r);return n.path===s.path&&n.search===s.search&&!a(n.hash)&&!a(s.hash)}function px(e,t=document.baseURI){let n;try{n=new URL(e,t)}catch{return null}if(n.origin!==window.location.origin)return null;const s=Ed(window.location.pathname);return!n.pathname.startsWith(s)&&`${n.pathname}/`!==s?null:`${n.pathname.slice(s.length)}${n.search}${n.hash}`}const IA=1,Vu=12,Fb="page";function U8(e,t){if(!Jr(e)||e.version!==IA)return null;const n=e.dockview;if(!Jr(n)||!Jr(n.grid)||!Jr(n.panels))return null;const s=Object.entries(n.panels);if(s.length===0||s.length>Vu)return null;for(const[a,r]of s){if(!Jr(r)||r.id!==a||r.contentComponent!==Fb)return null;const o=Jr(r.params)?r.params.address:void 0;if(typeof o!="string"||!t(o))return null}return n}function B8(e){return{version:IA,dockview:e}}async function W8(e=fetch){try{const t=await e("api/dock-layout",{headers:{Accept:"application/json"}});return t.ok?{layout:(await t.json()).layout??null}:(await Xi(t),{unavailable:!0})}catch{return{unavailable:!0}}}const F8="The layout was not saved",q8="This tab keeps the layout and saves it again on your next change.",kp="The viewer did not answer.";async function Y8(e,t=fetch){let n;try{n=await t("api/dock-layout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({layout:e})})}catch{return{failed:kp}}if((n.ok||n.status===404||n.status>=500)&&await Xi(n),n.ok)return{saved:!0};if(n.status===404)return{absent:!0};if(n.status>=500)return{failed:kp};let s="";try{const a=await n.json();typeof a.error=="string"&&(s=a.error)}catch{}return{failed:s?/[.!?]$/.test(s)?s:`${s}.`:kp}}function X8(e){const t=e.delay??500;let n,s,a=!1,r=!1,o=Promise.resolve();const l=()=>{n=void 0;const c=s;return s=void 0,!c||r||(o=o.then(async()=>{const d=c();if(!d)return;const h=await e.save(d);"absent"in h?r=!0:"saved"in h?a=!1:a||(a=!0,e.error(`${F8}. ${h.failed} ${q8}`))})),o};return{schedule(c){r||(s=c,n!==void 0&&clearTimeout(n),n=setTimeout(l,t))},flush(){return n!==void 0&&clearTimeout(n),l()},dispose(){n!==void 0&&clearTimeout(n),n=void 0,s=void 0}}}function Jr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const K8={read:()=>W8(),save:e=>Y8(e)},fj=320,mj=200,pj="sdlc-dock-pane-close";function gj(e){return px(e,`${window.location.origin}${Ed()}`)}const cm=u.createContext(null),Z8="(max-width: 767px)";function Q8(){const e=typeof window<"u"&&window.matchMedia?window.matchMedia(Z8):null,[t,n]=u.useState((e==null?void 0:e.matches)??!1);return u.useEffect(()=>{if(!e)return;const s=()=>n(e.matches);return e.addEventListener("change",s),()=>e.removeEventListener("change",s)},[e]),t}const J8={threads:Rc,tasks:mf,queues:Ev,blockers:MS,worktrees:Dv,workspaces:zS,chart:LS},e9={tasks:mf,issues:R$,releases:Tc};function t9(e){return e.kind==="home"?$S:e.kind==="org"?J8[e.page]:e.kind==="project"?e.page?e9[e.page]:OS:MM}function n9(e,t){const n=mc(e,t);return(e.kind==="org"||e.kind==="project")&&e.item!==void 0?`${e.item} · ${n}`:n}function GA(e){var s;const{projects:t}=ss(),n=e.kind==="project"?(s=t==null?void 0:t.find(a=>a.id===e.project))==null?void 0:s.name:void 0;return n9(e,n)}function Sp(){return`${window.location.pathname.slice(Ed().length)}${window.location.search}${window.location.hash}`}function xj(e,t){var r;let n;try{n=decodeURIComponent(t.slice(1))}catch{n=t.slice(1)}const s=document.querySelector(`[data-dock-pane="${e}"]`),a=[...(s==null?void 0:s.querySelectorAll("[id]"))??[]].find(o=>o.id===n);(r=a==null?void 0:a.scrollIntoView)==null||r.call(a)}function sa(e,t){var s;const n=(s=e.getPanel(t))==null?void 0:s.params;return typeof(n==null?void 0:n.address)=="string"?n.address:null}function s9(e){const t=e.toJSON(),{maximizedNode:n,...s}=t.grid;return B8({...t,grid:s})}function i9({api:e,params:t}){const n=u.useContext(cm),s=e.id,{go:a,open:r}=n,o=u.useMemo(()=>{const{path:h,search:f,hash:m}=Oa(t.address);return{pathname:`${Ed()}${h}`,search:f,hash:m,replace:p=>{const y=gj(p);y===null?window.location.assign(p):a(s,y,"replace")},setSearch:p=>a(s,`${h}${p}`,"query")}},[t.address,s,a]),l=u.useCallback(h=>{const f=gj(h);f===null?window.location.assign(h):r(s,f)},[s,r]),c=u.useCallback(h=>n.report(s,h),[n,s]),d=GA(n.pageOf(s));return i.jsx(Bb.Provider,{value:o,children:i.jsx($A.Provider,{value:c,children:i.jsx("div",{className:"dock-pane",role:"region","aria-label":d,"data-dock-pane":s,"data-dock-address":`${o.pathname}${o.search}`,"data-dock-active":n.active===s?"":void 0,children:i.jsx(a9,{navigate:o.replace,open:l},t.nav??0)})})})}function a9({navigate:e,open:t}){const n=u.useContext(cm);return i.jsx(i.Fragment,{children:n.renderPane(e,t)})}function r9({api:e}){const t=u.useContext(cm),n=t.pageOf(e.id),s=GA(n),a=t9(n);return i.jsxs("div",{className:"dock-tab",children:[i.jsx(a,{className:"dock-tab-icon","aria-hidden":"true"}),i.jsx("span",{className:"dock-tab-label",children:s}),i.jsx("button",{type:"button",className:"dock-tab-close","aria-label":`Close ${s}`,onPointerDown:r=>r.stopPropagation(),onMouseDown:r=>r.stopPropagation(),onClick:r=>{r.stopPropagation(),t.close(e.id)},children:i.jsx(xd,{"aria-hidden":"true"})})]})}const o9={[Fb]:i9},l9={name:"viewer",className:"dockview-theme-viewer"};function c9({renderPane:e,pageOf:t,known:n,error:s,store:a=K8}){const[r,o]=u.useState(null),[l,c]=u.useState(null),[d,h]=u.useState(null),[f,m]=u.useState(0),[,p]=u.useState(0),[y,g]=u.useState({}),b=Q8(),v=u.useRef(null),x=u.useRef(null),w=u.useRef(!1),_=u.useRef(1),S=u.useRef(!1),k=u.useRef(s);k.current=s;const j=u.useRef(a),N=u.useMemo(()=>X8({save:q=>j.current.save(q),error:q=>k.current(q)}),[]);u.useEffect(()=>()=>N.dispose(),[N]);const O=u.useRef(!1),T=u.useRef(n);T.current=n;const P=u.useCallback(()=>{const q=x.current;!q||!w.current||O.current||N.schedule(()=>q.panels.some(Z=>{const Q=sa(q,Z.id);return Q!==null&&!T.current(Q)})?null:s9(q))},[N]);u.useEffect(()=>{let q=!0;return j.current.read().then(B=>{q&&c(B)}),()=>{q=!1}},[]);const L=u.useCallback((q,B,Z)=>{const Q=`${Ed()}${B}`,ie={...window.history.state??{},dockPane:q};Z?window.history.pushState(ie,"",Q):window.history.replaceState(ie,"",Q)},[]),G=u.useCallback((q,B,Z)=>{const Q=x.current,ie=Q==null?void 0:Q.getPanel(q);if(!Q||!ie)return;const ce=ie.params,$=Z==="query"||Z==="hash";ie.api.updateParameters({address:B,nav:(ce.nav??0)+($?0:1)}),$||g(F=>{const{[q]:ee,...se}=F;return se}),q===v.current&&L(q,B,Z==="push"||Z==="hash"),p(F=>F+1),P()},[P,L]),A=u.useCallback((q,B,Z="push")=>{var ie;const Q=(ie=x.current)==null?void 0:ie.getPanel(q);Q&&(v.current!==q&&(Q.api.setActive(),v.current=q,h(q)),G(q,B,Z))},[G]),D=u.useCallback(q=>{const B=y[q];if(B)return B;const Z=x.current?sa(x.current,q):null;return t(Z??"")},[y,t]),C=u.useCallback((q,B)=>{g(Z=>JSON.stringify(Z[q])===JSON.stringify(B)?Z:{...Z,[q]:B})},[]),R=u.useCallback(q=>{var ce,$;const B=(ce=x.current)==null?void 0:ce.getPanel(q);if(!B||((($=x.current)==null?void 0:$.panels.length)??0)<=1)return;const Z=()=>B.api.close(),Q=document.querySelector(`[data-dock-pane="${q}"]`),ie=new CustomEvent(pj,{cancelable:!0,detail:{close:Z}});(!Q||Q.dispatchEvent(ie))&&Z()},[]),E=u.useCallback((q,B,Z,Q)=>{const ie=x.current;if(!ie||ie.panels.length>=Vu)return;let ce=`pane-${_.current}`;for(;ie.getPanel(ce);)ce=`pane-${_.current+=1}`;_.current+=1;const $=Q?{referenceGroup:Q,direction:Z}:B?{referencePanel:B,direction:Z}:{direction:Z==="within"?"right":Z};ie.addPanel({id:ce,component:Fb,params:{address:q,nav:0},position:$})},[]);u.useEffect(()=>{if(!r||!l||w.current)return;const q=Sp(),B="layout"in l?U8(l.layout,n):null;let Z=!1;if(B)try{r.fromJSON(B),Z=r.panels.length>0}catch{r.clear()}for(const ie of r.panels){const ce=/^pane-(\d+)$/.exec(ie.id);ce&&(_.current=Math.max(_.current,Number(ce[1])+1))}Z||E(q,null,"right");const Q=r.activePanel??r.panels[0];if(Q){if(v.current=Q.id,h(Q.id),Z&&sa(r,Q.id)!==q){const ie=Q.params;Q.api.updateParameters({address:q,nav:(ie.nav??0)+1})}L(Q.id,q,!1)}for(const ie of r.groups)ie.api.setConstraints({minimumWidth:fj,minimumHeight:mj});m(r.panels.length),w.current=!0},[r,l,n,E,L]);const M=u.useCallback(q=>{var Z,Q;const B=((Z=q.nativeEvent.dataTransfer)==null?void 0:Z.types)??[];!q.getData()&&Array.from(B).includes("text/uri-list")&&(((Q=x.current)==null?void 0:Q.panels.length)??0)<Vu&&q.accept()},[]);u.useEffect(()=>{if(!r)return;const q=[r.onDidAddGroup(B=>B.api.setConstraints({minimumWidth:fj,minimumHeight:mj})),r.onUnhandledDragOverEvent(M),r.onDidActivePanelChange(B=>{if(!B)return;v.current=B.id,h(B.id);const Z=sa(r,B.id);Z!==null&&!S.current&&L(B.id,Z,!1),P()}),r.onDidLayoutChange(()=>{m(r.panels.length),P()}),r.onDidRemovePanel(B=>g(Z=>{const{[B.id]:Q,...ie}=Z;return ie}))];return()=>{for(const B of q)B.dispose()}},[r,P,L,M]),u.useEffect(()=>{if(!r)return;const q=B=>{var ge,de,Le,Ee;if(B.defaultPrevented||B.button!==0||B.metaKey||B.ctrlKey||B.shiftKey)return;const Z=(de=(ge=B.target)==null?void 0:ge.closest)==null?void 0:de.call(ge,"a[href]");if(!Z||Z.target&&Z.target!=="_self"||Z.hasAttribute("download"))return;const Q=((Le=Z.closest("[data-dock-pane]"))==null?void 0:Le.dataset.dockPane)??v.current;if(!Q||!r.getPanel(Q))return;const ie=Z.getAttribute("href")??"",ce=Oa(sa(r,Q)??""),$=ie.startsWith("#")&&ie.length>1?`${ce.path}${ce.search}${ie}`:px(Z.href);if($===null||!n($))return;if(B.altKey){B.preventDefault(),E($,Q,"right");return}const F=Oa(sa(r,Q)??""),ee=Oa($),se=hj(sa(r,Q)??"",$);if(B.preventDefault(),se&&ee.hash&&F.hash===ee.hash){v.current!==Q&&((Ee=r.getPanel(Q))==null||Ee.api.setActive()),xj(Q,ee.hash);return}A(Q,$,se&&ee.hash?"hash":"push"),se&&ee.hash&&xj(Q,ee.hash)};return document.addEventListener("click",q),()=>document.removeEventListener("click",q)},[r,n,A,E]),u.useEffect(()=>{if(!r)return;const q=B=>{var ge;const Z=(ge=B.state)==null?void 0:ge.dockPane,Q=typeof Z=="string"&&r.getPanel(Z)?Z:v.current,ie=Q?r.getPanel(Q):void 0;if(!ie)return;v.current!==ie.id&&(S.current=!0,ie.api.setActive(),S.current=!1,v.current=ie.id);const ce=ie.params,$=Sp();if(ce.address===$)return;if(hj(ce.address,$)){ie.api.updateParameters({address:$,nav:ce.nav??0}),L(ie.id,$,!1),p(de=>de+1),P();return}const F=()=>{ie.api.updateParameters({address:$,nav:(ie.params.nav??0)+1}),L(ie.id,$,!1),p(de=>de+1),P()},ee=document.querySelector(`[data-dock-pane="${ie.id}"]`),se=new CustomEvent(pj,{cancelable:!0,detail:{close:F}});!ee||ee.dispatchEvent(se)?F():L(ie.id,ce.address,!0)};return window.addEventListener("popstate",q),()=>window.removeEventListener("popstate",q)},[r,P,L]),u.useEffect(()=>{if(O.current=b,!r||!w.current)return;const q=r.activePanel;b&&q&&r.groups.length>1?r.maximizeGroup(q):!b&&r.hasMaximizedGroup()&&(r.exitMaximizedGroup(),P())},[r,b,f,d,P]);const H=u.useCallback(q=>{x.current=q.api,o(q.api)},[]),z=u.useCallback(q=>{var Q,ie,ce;if(q.getData())return;const B=(ie=(Q=q.nativeEvent.dataTransfer)==null?void 0:Q.getData("text/uri-list").split(`
|
|
433
|
+
`)[0])==null?void 0:ie.trim(),Z=B?px(B):null;Z===null||!n(Z)||E(Z,null,NA(q.position),(ce=q.group)==null?void 0:ce.id)},[n,E]),K=r&&d?sa(r,d):null,oe=d?D(d):t(Sp()),re=f>=Vu,ve=q=>()=>{d&&K!==null&&E(K,d,q)},ke=b?void 0:[{label:"Split right",icon:DM,onSelect:ve("right"),disabled:re||!d},{label:"Split down",icon:w$,onSelect:ve("below"),disabled:re||!d}],ae=u.useMemo(()=>({active:d,pageOf:D,report:C,go:G,open:A,close:R,renderPane:e}),[d,D,C,G,A,R,e]),Ne=["viewer-dock",f<=1?"dock-single":"",b?"dock-mobile":""].filter(Boolean).join(" ");return i.jsx(cm.Provider,{value:ae,children:i.jsx(sA,{page:oe,headerActions:ke,children:i.jsx("div",{className:"viewer-dock-host",children:l===null?i.jsx("div",{className:"dock-loading",children:"Loading…"}):i.jsx(MA,{className:Ne,theme:l9,components:o9,defaultTabComponent:r9,onReady:H,onDidDrop:z,disableFloatingGroups:!0,disableTabsOverflowList:!0,noPanelsOverlay:"emptyGroup"})})})})}const d9=new Set(["not_terminal","another_process","continued","no_open","pending"]);function u9(e){return e==="terminal_denied"?"you":d9.has(e)?"muted":"alert"}function h9(e){return e.replace(/\.*$/,".")}function vj(e){return e.commands?{...e,commands:{...e.commands,open_thread:(t,n)=>f9(t,n)}}:e}async function f9(e,t,n=rA){let s=!1;for(;;){const a=await n(e,s);if("done"in a)return{opened:!0};const{reason:r,error:o,where:l}=a.refused;if(r==="closed"&&!s){if(!await t(l))return{declined:!0};s=!0;continue}return{note:{text:h9(o),role:u9(r),...r==="outdated"?{outdated:!0}:{}}}}}const HA=[["stage","Stage"],["blocker","Blocker"],["recent","Recent"]],m9=10,VA="Threads you pinned; they stay first in every order";function gx(e,t,n){var L,G;const{order:s,folded:a,showAll:r,narrowed:o,max:l=m9}=n,c=new Map(e.map(A=>[A.key,A])),d=A=>A.pinned===!0,h=A=>{var C;if(d(A)||!A.blockedBy||!c.has(A.blockedBy))return!1;const D=new Set([A.key]);for(let R=A.blockedBy;R&&c.has(R);R=(C=c.get(R))==null?void 0:C.blockedBy){if(D.has(R))return!1;D.add(R)}return!0},f=new Map;for(const A of e){if(!h(A))continue;const D=f.get(A.blockedBy)??[];D.push(A),f.set(A.blockedBy,D)}const m=A=>f.get(A.key)??[],p=A=>Math.max(A.mtimeMs??0,...m(A).map(p)),y=A=>!!A.needsYou||m(A).some(y),g=A=>A.activeSince!==void 0,b=(A,D)=>g(A)!==g(D)?g(A)?-1:1:y(A)!==y(D)?y(A)?-1:1:g(A)?A.activeSince-D.activeSince||A.key.localeCompare(D.key):p(D)-p(A),v=(A,D)=>Number(g(D))-Number(g(A))||(g(A)?D.activeSince-A.activeSince:(D.mtimeMs??0)-(A.mtimeMs??0))||A.key.localeCompare(D.key),x=r||o,w=!o,_=(A,D=0)=>s==="blocker"?[{row:A,depth:D},...m(A).flatMap(C=>_(C,D+1))]:[{row:A,depth:0}],S=A=>s==="blocker"?1+m(A).reduce((D,C)=>D+S(C),0):1,k=A=>A.reduce((D,C)=>D+S(C),0),j=(A,D,C,R,E,M)=>{const H=!E||!a.has(A);return{key:A,label:D,...M?{hint:M}:{},count:R,folds:E,open:H,rows:H?C.flatMap(z=>_(z)):[]}},N=e.filter(d),O=e.filter(A=>!d(A)),T=[];N.length&&T.push(j("pinned","Pinned",N,k(N),w,VA));let P=null;if(s==="stage"){const A=new Set(t.map(([R])=>R)),D=new Map(t.map(([R])=>[R,[]]));for(const R of O)(L=D.get(R.stage&&A.has(R.stage)?R.stage:"none"))==null||L.push(R);for(const[R,E,M]of t){const H=(D.get(R)??[]).sort(b);if(!H.length)continue;const z=R==="none"&&!x?H.slice(0,l):H;T.push({...j(R,E,z,H.length,w&&R!=="none",M),count:H.length})}const C=((G=D.get("none"))==null?void 0:G.length)??0;!o&&C>l&&(P={total:C,unstaged:!0})}else{const A=s==="recent"?[...O].sort(v):O.filter(D=>!h(D)).sort(b);if(A.length){const D=x?A:A.slice(0,l),C=j("others",N.length?"Other threads":null,D,k(A),!!N.length&&w);T.push(C),!o&&C.open&&A.length>l&&(P={total:A.length,unstaged:!1})}}return{groups:T,more:P}}function p9(e,t,n,s){const r=gx(e,t,{...n,folded:new Set,showAll:!0}).groups.find(c=>c.rows.some(d=>d.row.key===s));if(!r)return null;const l=!gx(e,t,{...n,folded:new Set}).groups.some(c=>c.rows.some(d=>d.row.key===s));return{group:r.key,capped:l}}const g9=15e3,x9=10,bj="idle-sessions-list",yj="idle-sessions-heading",wj="idle-sessions-confirm-text";function UA(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}const v9=e=>`${Number.isInteger(e)?e:e.toFixed(1)} h`,BA=e=>e===1?"1 session":`${e} sessions`;function b9(e){const t=e.released.length?`Closed ${BA(e.released.length)}.`:"Closed no sessions.";return e.kept.length?`${t} Kept ${e.kept.length}:`:t}function y9({row:e}){const t=[e.name,e.retired?"continued in another session":"",`idle ${v9(e.idle_hours)}`,UA(e.memory_mb)].filter(Boolean).join(" · ");return i.jsxs("li",{children:[i.jsx("p",{className:"idle-name",children:e.title}),i.jsxs("p",{className:"caption",children:[i.jsxs("span",{className:"muted",children:[t,e.unfinished&&" ·"]}),e.unfinished&&i.jsx("span",{className:"idle-unfinished",children:" unfinished work"})]})]})}function w9(){const[e,t]=u.useState(null),[n,s]=u.useState(!1),[a,r]=u.useState(!1),[o,l]=u.useState(null),[c,d]=u.useState(null),[h,f]=u.useState(""),m=u.useRef(""),p=u.useRef(null),y=u.useRef(null),g=u.useRef(null),b=u.useRef(null),v=u.useRef(0),x=u.useRef(0),w=u.useCallback(async()=>{const G=++v.current,A=await WU();if(!A||G<x.current)return;x.current=G,f("");const D=JSON.stringify(A);D!==m.current&&(m.current=D,t(A))},[]);u.useEffect(()=>{const G=setTimeout(w,0),A=setInterval(w,g9);return()=>{clearTimeout(G),clearInterval(A)}},[w]),u.useEffect(()=>{var A;const G=b.current;G&&(b.current=null,(A={cancel:y,close:p,dismiss:g}[G].current)==null||A.focus())});const _=(e==null?void 0:e.sessions.length)??0;if(u.useEffect(()=>{a&&!_&&o===null&&r(!1)},[a,_,o]),!_&&!c&&!h&&o===null)return null;const S=()=>{o===null&&(r(!0),b.current="cancel")},k=()=>{o===null&&(r(!1),b.current="close")},j=async()=>{if(o!==null)return;l(_),d(null),f("");const G=await FU();x.current=v.current+1,await w(),l(null),r(!1),s(!1),"error"in G?(f(`The sessions were not closed: ${G.error.replace(/\.+$/,"")}.`),b.current="close"):(d(G.done),b.current="dismiss")},N=()=>{d(null),b.current="close"},O=G=>{G.key==="Escape"&&(G.preventDefault(),k())},T=o!==null?`Closing ${BA(o)}…`:c?b9(c):"",P=(e==null?void 0:e.sessions.slice(0,x9))??[],L=_-P.length;return i.jsxs("div",{className:"idle",role:"group",..._?{"aria-labelledby":yj}:{"aria-label":"Idle sessions"},children:[h&&i.jsx("div",{className:"alert",role:"alert",children:h}),_>0&&e&&i.jsxs("div",{className:"idle-head",children:[i.jsxs("div",{className:"idle-title",children:[i.jsxs("h2",{className:"group",id:yj,"aria-label":`Idle sessions, ${_}`,children:["Idle sessions",i.jsx("span",{className:"count",children:_})]}),i.jsxs("p",{className:"caption muted",children:["over ",e.idle_over," h · ",UA(e.memory_mb)]})]}),i.jsxs("div",{className:"tools",children:[i.jsx("button",{type:"button",className:"pin","aria-expanded":n,"aria-controls":bj,"aria-label":n?"Hide the idle sessions list":"Show the idle sessions list",onClick:()=>s(G=>!G),children:n?"Hide":"Show"}),i.jsx("button",{type:"button",className:"pin",ref:p,"aria-expanded":a,"aria-label":"Close idle sessions…",onClick:S,children:"Close idle…"})]})]}),_>0&&i.jsxs("ul",{className:"idle-list",id:bj,hidden:!n,"aria-label":`Sessions idle over ${e==null?void 0:e.idle_over} hours, longest idle first`,children:[P.map(G=>i.jsx(y9,{row:G},G.session)),L>0&&i.jsx("li",{children:i.jsxs("p",{className:"caption muted",children:["…and ",L," more"]})})]}),a&&_>0&&i.jsxs("div",{className:"idle-confirm",role:"group","aria-label":"Close idle sessions","aria-describedby":wj,onKeyDown:O,children:[i.jsxs("p",{id:wj,children:[_===1?"Close this session?":`Close these ${_} sessions?`," Each transcript stays, so reopening a conversation resumes it, and a thread with unfinished work goes on with Continue on its card. A session that is busy or has background work running is kept."]}),i.jsxs("div",{className:"tools start",children:[i.jsx("button",{type:"button",className:"pin","aria-disabled":o!==null?!0:void 0,"aria-busy":o!==null?!0:void 0,onClick:j,children:o!==null?`Closing ${o}…`:`Close ${_}`}),i.jsx("button",{type:"button",className:"pin",ref:y,"aria-disabled":o!==null?!0:void 0,onClick:k,children:"Cancel"})]})]}),i.jsx("p",{className:"idle-status",role:"status",children:T}),c&&i.jsxs(i.Fragment,{children:[c.kept.length>0&&i.jsx("ul",{className:"idle-list","aria-label":"Kept sessions",children:c.kept.map(G=>i.jsxs("li",{children:[i.jsx("p",{className:"idle-name",children:G.title}),i.jsx("p",{className:"caption muted",children:G.why})]},G.session))}),i.jsx("div",{className:"tools start",children:i.jsx("button",{type:"button",className:"pin",ref:g,"aria-label":"Dismiss the close result",onClick:N,children:"Dismiss"})})]})]})}const _j={ok:"lime",you:"amber",alert:"red",waiting:"blue",blocked:"purple",muted:"grey",plain:"grey"};function vl(e){return e&&Object.hasOwn(_j,e)?_j[e]:"grey"}function jj(e){const t=Math.max(0,e);return t<3600?`${Math.max(1,Math.round(t/60))}m`:t<86400?`${Math.round(t/3600)}h`:`${Math.round(t/86400)}d`}function _9(e){const t=Math.max(0,e),[n,s]=t<3600?[Math.max(1,Math.round(t/60)),"minute"]:t<86400?[Math.round(t/3600),"hour"]:[Math.round(t/86400),"day"];return`${n} ${s}${n===1?"":"s"}`}const WA=/ · \d+ unowned issues?, (?:oldest )?\d+[mhd](?= · |$)/;function j9(e){return WA.test(e)}function N9(e){return e.replace(WA,"")}function k9(e,t){const n=e.projects.length>1,s=r=>n?`${r}: `:"",a=[];for(const r of e.projects){if(!r.unowned||r.unowned.count<1)continue;const{count:o}=r.unowned,l=Date.parse(r.unowned.oldest_since)/1e3,c=t-(Number.isFinite(l)?l:t),d=o===1?`1 unowned issue, ${jj(c)}`:`${o} unowned issues, oldest ${jj(c)}`;a.push({project:r.project,label:`${s(r.project)}${d}`,tail:`. Oldest waited ${_9(c)}: opens Issues`,href:`proj/${encodeURIComponent(r.project)}/issues`})}return a}const S9=1e4,C9=6e4,D9=2,Cp="#thread-",E9=["pin","archive-thread","details-toggle","holds-toggle"],A9=2e4,R9=300,T9="Its work goes to whoever carries it on, or it stays in the list as left work if nobody can.",O9=AD("Threads"),z9={working:"▶",prod:"↑",planned:"○"},Nj=3,gu=2,kj=["working","ready","prod","waiting","blocked","paused","planned"],M9={ready:"results ready",prod:"ready for prod"};function $9(e){const t=kj.map(s=>[s,e.filter(a=>a.state===s).length]),n=[...new Set(e.map(s=>s.state).filter(s=>!kj.includes(s)))].map(s=>[s,e.filter(a=>a.state===s).length]);return[...t,...n].filter(([,s])=>s>0).map(([s,a])=>`${a} ${M9[s]??s}`).join(" · ")}const L9={Terminal:"Opening in Terminal · if macOS asks whether sdlc viewer may control Terminal, allow it.","VS Code":"Opening in VS Code, in the window on this thread's folder.","Claude app":"Opening in the Claude app."};function P9(e){return e.agent!=="Claude"?null:e.where==="VS Code"?"Open in VS Code":e.where==="Claude app"?e.open?"Open in Claude app":null:e.where==="Terminal"?"Open in Terminal":null}const xx=[["running","Running"],["you","Needs you"],["blocked","Blocked"],["paused","Paused"],["idle","Idle"]],vx=[["claude","Claude"],["codex","Codex"]],Sj={paused:"Parked on purpose (status paused); waiting on nothing",idle:"Not running, not asking for you, not blocked, and not paused; includes done and ready for production, and threads in line in a promotion queue"},Cj=e=>e.kind??"idle",Dj=e=>e.agent==="Codex"?"codex":"claude";function Ej(e,t,n,s){const a=n.toLowerCase().split(/\s+/).filter(Boolean),r=xx.map(([g])=>g).filter(g=>s.has(g)),o=vx.map(([g])=>g).filter(g=>s.has(g)),l=g=>!r.length||r.includes(Cj(g)),c=g=>!o.length||o.includes(Dj(g)),d=g=>{if(!a.length)return!0;const b=g.search??g.title.toLowerCase();return a.every(v=>b.includes(v))},h=e.filter(d),f={};for(const[g]of xx)f[g]=h.filter(b=>c(b)&&Cj(b)===g).length;for(const[g]of vx)f[g]=h.filter(b=>l(b)&&Dj(b)===g).length;const m=[],p=[],y=[];return e.forEach((g,b)=>{y.length=Math.min(y.length,g.depth);const v=g.depth>0?y[g.depth-1]??null:null,x=d(g)&&l(g)&&c(g);let w=null;x&&(w=v?{depth:v.depth+1,pinned:v.pinned}:{depth:0,pinned:b<t&&g.pinned!==!1},(w.pinned?m:p).push({row:g,depth:w.depth})),y.push(w)}),{rows:[...m,...p],pinned:m.length,counts:f,narrowed:a.length+r.length+o.length>0}}const FA="sdlc-viewer:threads-arrange",Aj={order:"blocker",compact:!1,folded:[],showAll:!1,archived:!1};function I9(){try{const e=JSON.parse(window.localStorage.getItem(FA)??"{}");return{order:HA.some(([t])=>t===e.order)?e.order:Aj.order,compact:e.compact===!0,folded:Array.isArray(e.folded)?e.folded.filter(t=>typeof t=="string"):[],showAll:e.showAll===!0,archived:e.archived===!0}}catch{return Aj}}function G9(e){try{window.localStorage.setItem(FA,JSON.stringify(e))}catch{}}const H9=new Set(["not_terminal","another_process","continued","no_open","pending"]);function Dp({label:e,count:t,hint:n,fold:s}){const a=n?`hint-${e.toLowerCase().replace(/\W+/g,"-")}`:void 0;return i.jsxs(i.Fragment,{children:[s?i.jsx("h2",{className:"group",children:i.jsxs("button",{type:"button",className:"group-fold","aria-expanded":s.open,"aria-label":`${e}, ${t}`,"aria-describedby":a,onClick:s.onToggle,children:[i.jsx("span",{className:"chevron","aria-hidden":"true",children:s.open?"▾":"▸"}),e,i.jsx("span",{className:"count",children:t})]})}):i.jsxs("h2",{className:"group","aria-label":`${e}, ${t}`,"aria-describedby":a,children:[e,i.jsx("span",{className:"count",children:t})]}),n&&i.jsx("span",{className:"sr-only",id:a,children:n})]})}function xu({text:e,role:t}){return i.jsx("span",{className:`badge tone-${vl(t)}`,children:e})}function V9({serves:e}){const t=e.slice(0,D9),n=e.length-t.length;return i.jsxs("p",{className:"caption muted serves",children:[t.map((s,a)=>i.jsxs("span",{children:[a>0&&", ",i.jsxs("a",{href:`releases?planned=${encodeURIComponent(s.planned_release)}`,"aria-label":`serves ${s.name}, ${s.level}: open it in Planned releases`,children:["serves ",s.name," (",s.level,")"]})]},s.planned_release)),n>0&&i.jsxs(i.Fragment,{children:[i.jsxs("span",{"aria-hidden":"true",children:[", +",n," more"]}),i.jsxs("span",{className:"sr-only",children:[", and ",n," more planned releases"]})]})]})}const U9=4;function Rj({track:e}){return i.jsxs("span",{className:"track",children:[i.jsx("span",{className:"track-dots","aria-hidden":"true",children:Array.from({length:U9},(t,n)=>i.jsx("span",{className:["track-dot",n<=e.reached?"reached":"",n===e.target?"target":""].filter(Boolean).join(" ")},n))}),e.label,e.detail&&i.jsxs("span",{className:"sr-only",children:[". ",e.detail]})]})}function B9({tags:e,track:t,brief:n=!1}){const s=t?Math.min(Math.max(t.at??e.length,0),e.length):-1,a=n?e.filter(o=>!o.full):e,r=t?s-(n?e.slice(0,s).filter(o=>o.full).length:0):-1;return i.jsxs(i.Fragment,{children:[a.map((o,l)=>i.jsxs(u.Fragment,{children:[l===r&&t&&i.jsxs(i.Fragment,{children:[" ",i.jsx(Rj,{track:t})]})," · ",i.jsxs("span",{className:`tag tone-${vl(o.role)}`,children:[o.text,o.detail&&i.jsxs("span",{className:"sr-only",children:[". ",o.detail]})]})]},`t${l}`)),r===a.length&&t&&i.jsxs(i.Fragment,{children:[" ",i.jsx(Rj,{track:t})]})]})}function Tj({id:e,href:t}){return t?i.jsx("a",{className:"id-link",href:t,children:e}):i.jsx("span",{className:"id-text",children:e})}function W9(){return u.useMemo(()=>hA({fetcher:(...e)=>fetch(...e)}),[])}function F9(e){if(e.status==="failed")return"failed";if(e.status!=="ok")return null;const t=k9(e.summary,Date.now()/1e3);return t.length?t:null}function q9({lines:e}){return e==="failed"?i.jsx("p",{className:"unowned-issues muted",children:"Unowned issues: Not available"}):e?i.jsx("ul",{className:"unowned-issues",role:"list","aria-label":"Unowned issues",children:e.map(t=>i.jsx("li",{children:i.jsxs("a",{href:t.href,children:[t.label,i.jsx("span",{className:"sr-only",children:t.tail})]})},t.project))}):null}function Y9({onConnection:e,org:t=null,project:n=null}){const[s,a]=u.useState(null),[r,o]=u.useState(!1),l=W9(),c=F9(eA(l)),d=!!(s&&j9(s.line)),h=c==="failed"&&d?null:c,f=s&&Array.isArray(h)?N9(s.line):s==null?void 0:s.line,[m,p]=u.useState(""),[y,g]=u.useState(!1),[b,v]=u.useState(null),[x,w]=u.useState(""),[_,S]=u.useState(!1),[k,j]=u.useState(null),[N,O]=u.useState(null),[T,P]=u.useState(""),L=u.useRef(null),[G,A]=u.useState(0),D=u.useRef(new Map),C=u.useRef(new Map),R=u.useRef(null),[E,M]=u.useState(null),[H,z]=u.useState(null),[K,oe]=u.useState(null),[re,ve]=u.useState(""),[ke,ae]=u.useState(()=>new Set),[Ne,q]=u.useState(null),[B,Z]=u.useState(I9),Q=I=>Z(ue=>{const fe={...ue,...I};return G9(fe),fe}),[ie,ce]=u.useState({groups:[],all:!1}),[$,F]=u.useState(()=>new Set),[ee,se]=u.useState(()=>new Set),ge=u.useRef(B.archived),de=u.useRef(0),Le=u.useRef(null),Ee=u.useRef(""),W=u.useRef(""),_e=u.useRef(""),He=u.useRef(null),Dt=I=>{var ue;return[...((ue=He.current)==null?void 0:ue.querySelectorAll('[id^="thread-"]'))??[]].find(fe=>fe.id===`thread-${I}`)??null},en=u.useContext(Bb),zt=en?en.hash:null,tt=u.useRef(null),ft=u.useRef(null),It=u.useRef(null),zn=I=>{var fe;if(!(I instanceof HTMLButtonElement)||!((fe=He.current)!=null&&fe.contains(I))||!I.dataset.key)return null;const ue=E9.find(De=>I.classList.contains(De));return ue?`${ue} ${I.dataset.key}`:null},gn=I=>{It.current=zn(I.target)},Mn=()=>{setTimeout(()=>{zn(document.activeElement)||(It.current=null)},0)},xe=u.useCallback(async()=>{const I=++de.current,ue=await aA(ge.current);if(I!==de.current)return;const fe=L.current;if(fe&&I>fe.after&&A(Ve=>Ve+1),"none"in ue){o(!0),p(""),e("live");return}if("error"in ue){p(ue.error),e("disconnected");return}o(!1),p(""),w(""),P(""),e("live");const De=JSON.stringify(ue.data);De!==Ee.current&&(Ee.current=De,a(ue.data))},[e]);u.useEffect(()=>{let I=!0;const ue=C.current;BU().then(Ve=>I&&g(Ve)),qU().then(Ve=>I&&S(Ve));const fe=setTimeout(xe,0),De=setInterval(xe,S9);return()=>{I=!1,clearTimeout(fe),clearInterval(De);for(const Ve of ue.values())clearTimeout(Ve);ue.clear()}},[xe]),u.useEffect(()=>{let I=!0;const ue=()=>UU().then(De=>{I&&De&&M(Ve=>JSON.stringify(Ve)===JSON.stringify(De)?Ve:De)});ue();const fe=setInterval(ue,C9);return()=>{I=!1,clearInterval(fe)}},[]),u.useEffect(()=>{const I=fe=>{var Y,he;if(!fe.startsWith(Cp)){oe(null);return}if(fe===W.current)return;let De;try{De=decodeURIComponent(fe.slice(Cp.length))}catch{De=fe.slice(Cp.length)}const Ve=Dt(De);if(!Ve){if(!He.current||!s)return;const Qe=_e.current!==fe;if(_e.current=fe,s.threads.some(gt=>gt.key===De)){const gt=(re||ke.size)&&!Ej(s.threads,s.pinnedCount??0,re,ke).rows.some(At=>At.row.key===De),Vt=s.stages&&(Qe||!gt)?p9(s.threads,s.stages,{order:B.order,folded:new Set,showAll:!1,narrowed:!1},De):null,Et=Vt!==null&&B.folded.includes(Vt.group)&&!ie.groups.includes(Vt.group),Ut=Vt!==null&&Vt.capped&&!B.showAll&&!ie.all;Qe&&(re||ke.size)&&(ve(""),ae(new Set)),Qe&&(re||ke.size)||Et||Ut?(Et||Ut)&&ce(At=>({groups:Et&&Vt?[...At.groups,Vt.group]:At.groups,all:At.all||Ut})):W.current=fe,oe(null);return}oe(De);return}W.current=fe,oe(null),z(De);const tn=Ve.closest("[data-dock-pane]");(!tn||tn.hasAttribute("data-dock-active"))&&((Y=Ve.querySelector(".thread-title"))==null||Y.focus({preventScroll:!0})),(he=Ve.scrollIntoView)==null||he.call(Ve,{block:"center"})},ue=()=>{W.current="",_e.current="",I(window.location.hash)};if(zt!==null){tt.current!==null&&tt.current!==zt&&(W.current="",_e.current=""),tt.current=zt,I(zt);return}return I(window.location.hash),window.addEventListener("hashchange",ue),()=>window.removeEventListener("hashchange",ue)},[s,re,ke,B,ie,zt]),u.useEffect(()=>{if(!H)return;const I=()=>z(null);return document.addEventListener("pointerdown",I,!0),document.addEventListener("keydown",I,!0),()=>{document.removeEventListener("pointerdown",I,!0),document.removeEventListener("keydown",I,!0)}},[H]),u.useLayoutEffect(()=>{const I=It.current??(ft.current?`pin ${ft.current}`:null);if(!I||!He.current)return;const[ue,fe]=[I.slice(0,I.indexOf(" ")),I.slice(I.indexOf(" ")+1)],De=document.activeElement;if(De&&De!==document.body&&!He.current.contains(De)){It.current=null;return}const Ve=[...He.current.querySelectorAll(`button.${ue}`)].find(tn=>tn.dataset.key===fe);Ve?De!==Ve&&Ve.focus({preventScroll:fe!==ft.current}):It.current=null}),u.useLayoutEffect(()=>{var Y;const I=L.current;if(!I||!He.current)return;L.current=null;const ue=[...He.current.querySelectorAll("button.archive-thread")].find(he=>he.dataset.key===I.key);if(ue){ue.focus();return}const fe=I.order.indexOf(I.key),Ve=[...I.order.slice(fe+1),...I.order.slice(0,Math.max(fe,0)).reverse()].map(Dt).find(he=>he!==null),tn=Ve==null?void 0:Ve.querySelector(".thread-title");tn?tn.focus():(Y=R.current)==null||Y.focus()},[G]);const ne=async I=>{if(b)return;const ue=!I.pinned;ft.current=I.key,v(I.key);const fe=await ZU(I.key,ue);v(null),fe||a(De=>De&&{...De,threads:De.threads.map(Ve=>Ve.key===I.key?{...Ve,pinned:ue}:Ve)}),await xe(),w(fe?`The pin was not saved: ${fe}`:""),ft.current===I.key&&(ft.current=null)},[Se,Ye]=u.useState(()=>new Set),[nt,as]=u.useState({}),$n=is(),{confirm:rs,confirm_dialog:Zs}=al(),V=(I,ue)=>as(fe=>{const{[I]:De,...Ve}=fe;return ue?{...Ve,[I]:ue}:Ve}),$e=(I,ue)=>Ye(fe=>{const De=new Set(fe);return ue?De.add(I):De.delete(I),De}),Xe=Object.keys(nt).some(I=>!Se.has(I));u.useEffect(()=>{if(!Xe)return;const I=()=>as(ue=>Object.fromEntries(Object.entries(ue).filter(([fe])=>Se.has(fe))));return document.addEventListener("pointerdown",I,!0),document.addEventListener("click",I,!0),()=>{document.removeEventListener("pointerdown",I,!0),document.removeEventListener("click",I,!0)}},[Xe,Se]);const Mt=I=>setTimeout(()=>{var ue,fe;return(fe=[...((ue=He.current)==null?void 0:ue.querySelectorAll("button.open-thread"))??[]].find(De=>De.dataset.key===I))==null?void 0:fe.focus()},0),Ls=async(I,ue)=>{const fe=await rs({title:`Reopen ${I.title} in Terminal?`,description:`Its session is closed. It opens in a new Terminal window in ${ue??"the thread's folder"}, running claude --resume.`,action_label:"Reopen"});return Mt(I.key),fe},Ni=I=>{const ue=D.current.get(I);if(ue&&Date.now()-ue.at<A9)return ue.detail;const fe=XU(I).then(De=>((De===null||De.failed)&&D.current.delete(I),(De==null?void 0:De.detail)??null));return D.current.set(I,{at:Date.now(),detail:fe}),fe},ki=I=>setTimeout(()=>{var ue,fe;return(fe=[...((ue=He.current)==null?void 0:ue.querySelectorAll("button.archive-thread"))??[]].find(De=>De.dataset.key===I))==null?void 0:fe.focus()},0),Xa=async I=>{var Ve;if(k||N)return;const ue=I.archiveAction==="archive";if(ue){O(I.key);const tn=await Ni(I.key);O(null);const Y=await rs({title:`Archive ${I.title}?`,description:tn??T9,action_label:"Archive"});if(ki(I.key),!Y){D.current.delete(I.key);return}}const fe=[...((Ve=He.current)==null?void 0:Ve.querySelectorAll("article.thread"))??[]].map(tn=>tn.id.slice(7));j(I.key);const De=await KU(I.key,ue);D.current.delete(I.key),j(null),L.current={key:I.key,order:fe,after:de.current},await xe(),P(De?`The archive was not saved: ${De.replace(/\.*$/,".")}`:"")},Ir=async I=>{if(Se.has(I.key))return;let ue=!1;for(;;){$e(I.key,!0),V(I.key,{key:I.key,text:L9[I.where??""]??"Opening.",role:"waiting"});const fe=await rA(I.key,ue);if($e(I.key,!1),"done"in fe){V(I.key,null);return}const{reason:De,error:Ve,where:tn}=fe.refused;if(De==="closed"&&!ue){if(V(I.key,null),!await Ls(I,tn))return;ue=!0;continue}const Y=De==="outdated"?`${Ve.replace(/\.*$/,".")} ${$n}`:Ve.replace(/\.*$/,"."),he=De==="terminal_denied"?"you":H9.has(De)?"muted":"alert";V(I.key,{key:I.key,text:Y,role:he});return}},Oe=(s==null?void 0:s.threads)??[],ht=!r&&Oe.length>0,ln=Ej(Oe,(s==null?void 0:s.pinnedCount)??0,re,ke),cn=ln.pinned,Ln=ln.rows,os=Array.isArray(s==null?void 0:s.stages)?s.stages:null,Ka=new Set(B.folded.filter(I=>!ie.groups.includes(I))),Za=B.showAll||ie.all,Fn=os?gx(Ln.map(I=>I.row),os,{order:B.order,folded:Ka,showAll:Za,narrowed:ln.narrowed}):null,Qa=os?(s==null?void 0:s.archived)??0:0,um=I=>{ce(ue=>({...ue,groups:ue.groups.filter(fe=>fe!==I)})),Q({folded:Ka.has(I)?B.folded.filter(ue=>ue!==I):[...B.folded.filter(ue=>ue!==I),I]})},hm=()=>{ce(I=>({...I,all:!1})),Q({showAll:!Za})},bl=()=>{const I=!B.archived;ge.current=I,Q({archived:I}),xe()},yl=I=>F(ue=>{const fe=new Set(ue);return fe.has(I)?fe.delete(I):fe.add(I),fe}),fm=I=>se(ue=>{const fe=new Set(ue);return fe.has(I)?fe.delete(I):fe.add(I),fe}),Ja=(I,ue)=>i.jsx(X9,{depth:ue,row:E!=null&&E[I.key]?{...I,serves:E[I.key]}:I,arrived:H===I.key,pinnable:y&&typeof I.pinned=="boolean",pinning:b,onPin:()=>ne(I),archiveAction:_?I.archiveAction:void 0,archiving:k,previewing:N,onArchive:()=>Xa(I),onArchiveHover:fe=>{const De=C.current,Ve=De.get(I.key);if(!fe){clearTimeout(Ve),De.delete(I.key);return}I.archiveAction!=="archive"||Ve!==void 0||De.set(I.key,setTimeout(()=>{De.delete(I.key),Ni(I.key)},R9))},opening:Se.has(I.key),note:nt[I.key]??null,onOpen:()=>Ir(I),org:t,project:n,compact:!!os&&B.compact,detailsOpen:$.has(I.key),onDetails:()=>yl(I.key),holdsOpen:ee.has(I.key),onHolds:()=>fm(I.key)});u.useEffect(()=>{if(!ht)return;const I=ue=>{var De,Ve;if(ue.key!=="/"||ue.ctrlKey||ue.metaKey||ue.altKey||ue.defaultPrevented)return;const fe=document.activeElement;fe&&(/^(INPUT|TEXTAREA|SELECT)$/.test(fe.tagName)||fe.isContentEditable)||document.querySelector('[role="dialog"], [role="alertdialog"], dialog[open]')||(ue.preventDefault(),(De=Le.current)==null||De.focus(),(Ve=Le.current)==null||Ve.select())};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[ht]);const mm=I=>ae(ue=>{const fe=new Set(ue);return fe.has(I)?fe.delete(I):fe.add(I),fe}),Gr=()=>{var I;ve(""),ae(new Set),(I=Le.current)==null||I.focus()},Hr=(I,ue)=>{const fe=ln.counts[I]??0,De=ke.has(I),Ve=Sj[I];return i.jsxs("button",{type:"button",className:"filter-chip","aria-pressed":De,"aria-describedby":Ve?`chip-hint-${I}`:void 0,disabled:fe===0&&!De&&Ne!==I,onFocus:()=>q(I),onBlur:()=>q(tn=>tn===I?null:tn),onClick:()=>mm(I),children:[ue," ",fe]},I)};return i.jsxs(i.Fragment,{children:[Zs,i.jsxs("header",{className:"main-head",children:[i.jsx("h1",{ref:R,tabIndex:-1,children:"Threads"}),s&&!r&&i.jsx("p",{className:"muted",children:f})]}),i.jsx(q9,{lines:h}),i.jsxs("section",{className:"card threads","aria-label":"Threads",children:[i.jsx(w9,{}),m&&i.jsxs("div",{className:"alert",role:"alert",children:["Threads unavailable: ",m.replace(/\.+$/,""),". Retrying every 10 s."]}),x&&i.jsx("div",{className:"alert",role:"alert",children:x}),T&&i.jsx("div",{className:"alert",role:"alert",children:T}),i.jsx("p",{className:"caption muted not-listed",role:"status",children:K!==null&&!r?os?i.jsxs(i.Fragment,{children:["Thread ",K," is not in this list.",!B.archived&&Qa>0?" Show archived lists archived threads.":null]}):i.jsxs(i.Fragment,{children:["Thread ",K," is not in this list. ",i.jsx("code",{children:"sdlc view --all"})," lists older threads."]}):null}),ht&&i.jsxs("div",{className:"threads-toolbar",children:[i.jsxs("div",{className:"threads-find",children:[i.jsxs("div",{className:"search-field",children:[i.jsx("input",{ref:Le,type:"search",placeholder:"Search threads","aria-label":"Search threads","aria-keyshortcuts":"/",value:re,onChange:I=>ve(I.target.value),onKeyDown:I=>{I.key==="Escape"&&(I.preventDefault(),re?ve(""):I.currentTarget.blur())}}),re&&i.jsx("button",{type:"button",className:"search-clear","aria-label":"Clear search",onClick:()=>{var I;ve(""),(I=Le.current)==null||I.focus()},children:i.jsx("span",{"aria-hidden":"true",children:"×"})})]}),os&&i.jsx("select",{className:"order-select","aria-label":"Order threads",value:B.order,onChange:I=>Q({order:I.target.value}),children:HA.map(([I,ue])=>i.jsx("option",{value:I,children:ue},I))})]}),i.jsxs("div",{className:"filter-row",children:[i.jsx("div",{className:"filter-group",role:"group","aria-label":"Status",children:xx.map(([I,ue])=>Hr(I,ue))}),i.jsx("div",{className:"filter-group",role:"group","aria-label":"Agent",children:vx.map(([I,ue])=>Hr(I,ue))}),os&&i.jsx("button",{type:"button",className:"filter-chip","aria-pressed":B.compact,onClick:()=>Q({compact:!B.compact}),children:"Compact"})]}),Object.entries(Sj).map(([I,ue])=>i.jsx("span",{className:"sr-only",id:`chip-hint-${I}`,children:ue},I)),i.jsx("p",{className:"caption muted narrowed",role:"status",children:ln.narrowed?i.jsxs(i.Fragment,{children:[Ln.length," of ",Oe.length," threads ·"," ",i.jsx("button",{type:"button",className:"clear-filters","aria-label":"Clear search and filters",onClick:Gr,children:"Clear"})]}):null})]}),r?i.jsx("p",{className:"muted",children:O9}):i.jsxs("div",{className:"thread-list",ref:He,onFocus:gn,onBlur:Mn,children:[Fn==null?void 0:Fn.groups.map(I=>i.jsxs("div",{children:[I.label!==null&&i.jsx(Dp,{label:I.label,count:I.count,hint:I.hint,fold:I.folds?{open:I.open,onToggle:()=>um(I.key)}:void 0}),I.rows.map(({row:ue,depth:fe})=>i.jsx("div",{children:Ja(ue,fe)},ue.key))]},`group-${I.key}`)),!Fn&&Ln.map(({row:I,depth:ue},fe)=>i.jsxs("div",{children:[cn>0&&fe===0&&i.jsx(Dp,{label:"Pinned",count:cn,hint:VA}),cn>0&&fe===cn&&i.jsx(Dp,{label:"Other threads",count:Ln.length-cn}),Ja(I,ue)]},I.key)),s&&!Oe.length&&i.jsx("p",{className:"muted empty",children:"No threads at work or waiting."}),Oe.length>0&&!Ln.length&&i.jsx("p",{className:"muted empty",children:"No threads match."}),s&&s.hidden>0&&i.jsxs("p",{className:"caption muted",children:[s.hidden," older thread(s) not shown; sdlc view --all lists them."]}),(Fn==null?void 0:Fn.more)&&i.jsx("button",{type:"button",className:"list-more","aria-expanded":Za,onClick:hm,children:Fn.more.unstaged?Za?"Show fewer without a stage":`Show all without a stage (${Fn.more.total})`:Za?"Show fewer":`Show all (${Fn.more.total})`}),Qa>0&&i.jsx("button",{type:"button",className:"list-more",onClick:bl,children:B.archived?"Hide archived":`Show ${Qa} archived`})]})]})]})}function X9({row:e,depth:t,arrived:n,pinnable:s,pinning:a,onPin:r,archiveAction:o,archiving:l=null,previewing:c=null,onArchive:d,onArchiveHover:h,opening:f,note:m,onOpen:p,org:y,project:g,compact:b=!1,detailsOpen:v=!1,onDetails:x,holdsOpen:w=!1,onHolds:_}){const S=b&&!v,k=A=>y?`org/${encodeURIComponent(y)}/tasks/${encodeURIComponent(A)}`:null,j=A=>g?`proj/${encodeURIComponent(g)}/issues/${encodeURIComponent(A)}`:null,N=[e.where||e.agent,e.phase,e.age,e.waitsOn?`waits on ${e.waitsOn}`:""].filter(Boolean).join(" · "),O=P9(e),T=l===e.key?o==="archive"?"Archiving":"Unarchiving":o==="archive"?"Archive":"Unarchive",P=`open-note-${e.key}`,[L,G]=u.useState(!1);return i.jsxs("article",{className:["thread",n?"arrived":"",b?"compact-card":""].filter(Boolean).join(" "),id:`thread-${e.key}`,style:{marginLeft:Math.min(t*22,110)},children:[b&&i.jsx("button",{type:"button",className:"details-toggle","data-key":e.key,"aria-label":`Details of ${e.title}`,"aria-expanded":v,onClick:x,children:i.jsx("span",{"aria-hidden":"true",children:v?"▾":"▸"})}),i.jsxs("div",{className:"thread-head",children:[i.jsx("p",{className:"thread-title",tabIndex:-1,children:e.title}),i.jsxs("div",{className:"tools",children:[e.carried?i.jsxs(i.Fragment,{children:[i.jsx(xu,{text:e.carried,role:"waiting"}),e.carriedBatch&&i.jsx(xu,{text:e.carriedBatch.text,role:e.carriedBatch.role})]}):i.jsx(xu,{text:e.status,role:e.role}),e.archived&&i.jsx(xu,{text:"archived",role:"muted"}),O&&i.jsx("button",{type:"button",className:"open-thread","data-key":e.key,"aria-label":`${O}: ${e.title}`,"aria-describedby":P,"aria-disabled":f?!0:void 0,"aria-busy":f?!0:void 0,onClick:()=>{f||p()},children:f?"Opening…":O}),s&&i.jsx("button",{type:"button",className:e.pinned?"pin on":"pin","data-key":e.key,"aria-label":e.pinned?`Unpin ${e.title}`:`Pin ${e.title} to the top`,"aria-disabled":a?!0:void 0,"aria-busy":a===e.key?!0:void 0,onClick:()=>{a||r()},children:e.pinned?"Unpin":"Pin"}),o&&i.jsx("button",{type:"button",className:"archive-thread","data-key":e.key,"aria-label":`${T} ${e.title}`,"aria-disabled":l||c?!0:void 0,"aria-busy":l===e.key||c===e.key?!0:void 0,onPointerEnter:()=>h==null?void 0:h(!0),onFocus:()=>h==null?void 0:h(!0),onPointerLeave:()=>h==null?void 0:h(!1),onBlur:()=>h==null?void 0:h(!1),onClick:()=>{!l&&!c&&(d==null||d())},children:l===e.key?`${T}…`:T})]})]}),i.jsxs("p",{className:S?"caption muted meta one-line":"caption muted meta",children:[N,i.jsx(B9,{tags:e.tags??[],track:e.track,brief:S})]}),O&&i.jsx("p",{id:P,className:`caption open-note tone-${vl((m==null?void 0:m.role)??"muted")}`,role:(m==null?void 0:m.role)==="alert"||(m==null?void 0:m.role)==="you"?"alert":"status",children:(m==null?void 0:m.text)??null}),!S&&e.serves&&e.serves.length>0&&i.jsx(V9,{serves:e.serves}),!S&&e.summary&&i.jsx("p",{className:"caption muted",children:e.summary}),!S&&e.carriedDetail&&i.jsx("p",{className:"line",children:e.carriedDetail}),!S&&e.step&&i.jsx(K9,{t:e}),e.lines.length>0&&i.jsx("p",{className:"caption muted lines-summary",children:$9(e.lines)}),S?null:i.jsx(Z9,{t:e,nested:t>0,allLines:L,setAllLines:G,allHolds:w,onHolds:_,taskHref:k,issueHref:j})]})}function K9({t:e}){return i.jsxs("p",{className:`caption tone-${vl(e.stepRole??"muted")}`,children:["step: ",e.step,e.stepEvidence&&i.jsxs(i.Fragment,{children:[" · ",i.jsx("span",{className:"id-text",children:e.stepEvidence})]}),e.stepRecent&&e.stepRecent.length>0&&i.jsxs("span",{className:"sr-only",children:[". Recent steps, newest first: ",e.stepRecent.join("; ")]})]})}function Oj({text:e,role:t,under:n,detail:s,nested:a}){const r=a&&n?n:void 0,o=[r?e:"",s??""].filter(Boolean).join(". ");return i.jsxs("p",{className:`line tone-${vl(t)}`,children:[r??e,o&&i.jsxs("span",{className:"sr-only",children:[". ",o]})]})}function Z9({t:e,nested:t,allLines:n,setAllLines:s,allHolds:a,onHolds:r,taskHref:o,issueHref:l}){return i.jsxs(i.Fragment,{children:[(n?e.lines:e.lines.slice(0,Nj)).map((c,d)=>i.jsxs("p",{className:`line tone-${vl(c.role)}`,children:[i.jsxs("span",{"aria-hidden":"true",children:[z9[c.state]??"•"," "]}),c.state==="working"&&i.jsx("span",{className:"sr-only",children:"Working: "}),c.task!==void 0&&i.jsx(Tj,{id:c.task,href:o(c.task)}),c.task!==void 0&&c.text?" ":null,c.text]},`l${d}`)),e.lines.length>Nj&&i.jsx("button",{type:"button",className:"lines-more","aria-expanded":n,"aria-label":n?`Show fewer lines of work of ${e.title}`:`Show all ${e.lines.length} lines of work of ${e.title}`,onClick:()=>s(c=>!c),children:n?"Show fewer":`Show all ${e.lines.length}`}),(e.routed??[]).map(c=>i.jsxs("p",{className:"line",children:["routed ",i.jsx(Tj,{id:c.issue,href:l(c.issue)}),c.title?` ${c.title}`:null]},`r${c.issue}`)),e.next&&i.jsxs("p",{className:"caption tone-amber",children:[i.jsx("span",{"aria-hidden":"true",children:"▸ "}),"next (",e.next.state,"): ",e.next.text,i.jsx("span",{className:"sr-only",children:". Say “nn” or approve it in the thread to start it."})]}),e.plannedFor&&i.jsxs("p",{className:"caption tone-grey",children:[i.jsx("span",{"aria-hidden":"true",children:"▸ "}),"planned for ",e.plannedFor.tag,": ",e.plannedFor.text]}),e.reason&&i.jsx(Oj,{...e.reason,nested:t}),(a||!e.holdsAll?e.holds:e.holds.slice(0,gu)).map((c,d)=>i.jsx(Oj,{...c,nested:t},`h${d}`)),e.holdsAll&&e.holds.length>gu&&i.jsx("button",{type:"button",className:"lines-more holds-toggle","data-key":e.key,"aria-expanded":a,"aria-label":a?`Show fewer holds of ${e.title}`:`+${e.holds.length-gu} more holds of ${e.title}`,onClick:r,children:a?"Show fewer holds":`+${e.holds.length-gu} more holds`}),(e.holdsMore??0)>0&&i.jsxs("p",{className:"caption tone-grey",children:["+",e.holdsMore," more holds"]}),e.plan&&i.jsx("p",{className:"caption muted",children:e.plan})]})}const Q9=5e3;function J9(){const[e,t]=u.useState([]),n=u.useRef(0),s=u.useRef(new Map),a=u.useCallback(c=>{const d=s.current.get(c);d&&clearTimeout(d),s.current.delete(c),t(h=>h.filter(f=>f.id!==c))},[]),r=u.useCallback((c,d)=>{const h=n.current+=1;t(f=>[...f.filter(m=>m.tone!=="error").slice(-2),{id:h,tone:c,message:d}]),c==="success"&&s.current.set(h,setTimeout(()=>a(h),Q9))},[a]);u.useEffect(()=>{const c=s.current;return()=>{for(const d of c.values())clearTimeout(d)}},[]);const o=u.useMemo(()=>({success:c=>r("success",c),error:c=>r("error",c)}),[r]),l=i.jsx("div",{"aria-live":"polite","aria-label":"Notifications",className:"pointer-events-none fixed right-4 bottom-4 z-100 flex max-w-[calc(100vw-2rem)] flex-col items-end gap-2",children:e.map(c=>i.jsxs("div",{"data-testid":"viewer-toast",className:"bg-popover text-popover-foreground pointer-events-auto flex w-80 max-w-full items-center gap-3 rounded-md border py-2 pr-2 pl-4 text-sm shadow-lg"+(c.tone==="error"?" border-destructive":""),children:[i.jsx("span",{className:"min-w-0 flex-1 break-words",children:c.message}),i.jsx(U,{type:"button",variant:"ghost",size:"control",className:"shrink-0",onClick:()=>a(c.id),children:"Dismiss"})]},c.id))});return{notify:o,toasts:l}}const eW=/^iss-\d{1,9}$/;function qb(e){return e.split("/").filter(Boolean).slice(1).join("/")}function dm(e,t=""){const n=e.split("/").filter(Boolean);if(n.length===0)return{page:{kind:"home"}};if(n.length===1){const[l]=n;return l==="threads"?{page:{kind:"org",page:"threads"},threads:!0}:l==="chat"?{forward:"threads"}:l==="tasks"?{page:{kind:"org",page:"tasks"},tasks:!0}:l==="issues"?{page:{kind:"home"},issues:!0}:l==="chart"?{page:{kind:"org",page:"chart"},chart:!0}:l==="worktrees"?{page:{kind:"org",page:"worktrees"},worktrees:!0}:l==="workspaces"?{page:{kind:"org",page:"workspaces"},workspaces:!0}:l==="queues"?{page:{kind:"org",page:"queues"},queues:!0}:l==="blockers"?{page:{kind:"org",page:"blockers"},blockers:!0}:l==="releases"?{page:{kind:"home"},releasesForward:!0}:{page:{kind:"not_found"}}}const[s,a,r,o]=n;if(s==="org"&&r==="tasks"&&o==="queues"&&n.length===4)return{forward:`org/${a}/queues${t}`};if(s==="org"&&r==="chat"&&n.length<=4)return{forward:`org/${a}/threads${o===void 0?"":`#thread-${o}`}`};if(s==="org"&&r==="tasks"&&n.length===4){const l=decodeURIComponent(o);return{page:{kind:"org",page:"tasks",item:l},org:decodeURIComponent(a),task:l}}if(s==="org"&&r==="issues"&&n.length<=4){const l=decodeURIComponent(a);return o===void 0?{page:{kind:"home"},org:l,issues:!0}:{page:{kind:"home"},org:l,issues:!0,issue:decodeURIComponent(o)}}if(s==="proj"&&r==="issues"&&n.length<=4){const l=decodeURIComponent(a),c={kind:"project",project:l,page:"issues"};if(o===void 0)return{page:c,issues:!0,project:l};const d=decodeURIComponent(o),h=new URLSearchParams(t);h.delete("from"),h.delete("reported");const f=h.toString();return{page:{...c,item:d,...f?{list_query:f}:{}},issues:!0,project:l,issue:d}}if(s==="org"&&n.length<=3){const l=decodeURIComponent(a);if(r===void 0)return{page:{kind:"home"},org:l};if(r==="threads")return{page:{kind:"org",page:"threads"},org:l,threads:!0};if(r==="tasks")return{page:{kind:"org",page:"tasks"},org:l,tasks:!0};if(r==="chart")return{page:{kind:"org",page:"chart"},org:l,chart:!0};if(r==="worktrees")return{page:{kind:"org",page:"worktrees"},org:l,worktrees:!0};if(r==="workspaces")return{page:{kind:"org",page:"workspaces"},org:l,workspaces:!0};if(r==="queues")return{page:{kind:"org",page:"queues"},org:l,queues:!0};if(r==="blockers")return{page:{kind:"org",page:"blockers"},org:l,blockers:!0};if(r==="releases")return{page:{kind:"home"},org:l,releasesForward:!0}}if(s==="proj"&&n.length<=3){const l=decodeURIComponent(a);if(r===void 0)return{page:{kind:"project",project:l}};if(r==="tasks")return{page:{kind:"project",project:l,page:"tasks"},tasks:!0};if(r==="releases")return{page:{kind:"project",project:l,page:"releases"},releases:!0}}return{page:{kind:"not_found"}}}const zj={label:"Local viewer",can:()=>!1},tW={connecting:"Connecting…",live:"Live · refreshes every 10s",disconnected:"Disconnected"},Mj=()=>i.jsx(iA,{title:"Page not found",more:"This release has no page for the graph's nodes. Read the graph in a terminal with sdlc workspace find <words> and sdlc workspace show <id>.",children:"There is no page at this address in this viewer."});function nW({routeOrg:e}){const{org:t,engine:n}=ss(),{project:s}=Ad(),[a,r]=u.useState("connecting");return n===null?i.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:i.jsx(ji,{page:"Threads"})}):i.jsxs("div",{className:"main viewer-panel",children:[i.jsxs("p",{className:"connection",role:"status",children:[i.jsx("span",{className:`dot ${a}`,"aria-hidden":"true"}),tW[a]]}),i.jsx(Y9,{onConnection:r,org:(t==null?void 0:t.slug)??e??null,project:s})]})}const Ya=()=>i.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading…"});function sW({route:e,navigate:t}){var h;const{org:n,projects:s,loading:a,none:r}=ss(),o=e.page.kind==="project"?e.page.project:null,l=o!==null&&s!==null&&!((h=s.find(f=>f.id===o))!=null&&h.current),c=e.org===void 0&&!l&&!a&&n!==null?`org/${encodeURIComponent(n.slug)}/tasks`:null;if(u.useEffect(()=>{c&&t(c)},[c,t]),o!==null&&l)return i.jsx(Wc,{project:o});if(c||e.org===void 0&&a)return i.jsx(Ya,{});const d=(n==null?void 0:n.slug)??e.org;return d===void 0&&o!==null?i.jsx(Wc,{project:o}):d===void 0&&r?i.jsx(gl,{}):d===void 0?i.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Tasks open once the organization reads."}):i.jsx(w3,{org:d})}function iW({route:e,navigate:t}){const{org:n,loading:s,none:a}=ss(),r=xl(),o=e.org===void 0&&!s&&n!==null?`org/${encodeURIComponent(n.slug)}/queues${r.search}`:null;if(u.useEffect(()=>{o&&t(o)},[o,t]),o||e.org===void 0&&s)return i.jsx(Ya,{});const l=(n==null?void 0:n.slug)??e.org;if(l===void 0&&a)return i.jsx(gl,{});if(l===void 0)return i.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Queues open once the organization reads."});const c=new URLSearchParams(r.search).get("queue");return i.jsx(RH,{org:l,open:c,path:`/org/${encodeURIComponent(l)}/queues`})}function aW({route:e,navigate:t}){var g;const{org:n,projects:s}=ss(),{project:a,settled:r}=Ad(),o=e.project??null,l=o!==null&&s!==null&&!((g=s.find(b=>b.id===o))!=null&&g.current),c=xl(),d=c.search,h=o===null&&a!==null?`proj/${encodeURIComponent(a)}/issues${e.issue?`/${encodeURIComponent(e.issue)}`:""}${d}`:null;u.useEffect(()=>{h&&t(h)},[h,t]);const[f,m]=u.useState(()=>c.search.replace(/^\?/,"")),p=u.useCallback(b=>{c.setSearch(b?`?${b}`:""),m(b)},[c]);if(o!==null&&l)return i.jsx(Wc,{project:o});if(h||o===null&&!r)return i.jsx(Ya,{});if(o===null)return i.jsx(gl,{});const y=encodeURIComponent((n==null?void 0:n.slug)??e.org??"");if(e.issue!==void 0){const b=new URLSearchParams(f).get("from");return i.jsx(uH,{org:y,project:o,issue_id:e.issue,from:b,query:f})}return i.jsx(KG,{org:y,project:o,query:f,onQuery:p})}function rW({issue:e,navigate:t,home:n}){const{project:s,settled:a}=Ad(),r=s!==null?`proj/${encodeURIComponent(s)}/issues/${encodeURIComponent(e)}`:null;return u.useEffect(()=>{r&&t(r)},[r,t]),r||!a?i.jsx(Ya,{}):n}function Ad(){var r;const{projects:e,loading:t,none:n,failure:s}=ss();return{project:((r=e==null?void 0:e.find(o=>o.current))==null?void 0:r.id)??null,settled:!t&&(e!==null||n!==null||!!(s!=null&&s.shown))}}function oW({navigate:e}){const{project:t,settled:n}=Ad(),{search:s}=xl(),a=t!==null?`proj/${encodeURIComponent(t)}/releases${s}`:null;return u.useEffect(()=>{a&&e(a)},[a,e]),a||!n?i.jsx(Ya,{}):i.jsx(gl,{})}function $j(e){const t=new URLSearchParams(e);return{release:t.get("release"),planned:t.has("planned")?t.get("planned")??"":null}}function lW({route:e}){var f;const{org:t,projects:n,loading:s}=ss(),a=e.page.kind==="project"?e.page.project:"",r=xl(),[o,l]=u.useState(()=>$j(r.search));if(s)return i.jsx(Ya,{});if(n!==null&&!((f=n.find(m=>m.id===a))!=null&&f.current))return i.jsx(Wc,{project:a});const d=`/proj/${encodeURIComponent(a)}/releases`,h=m=>{const p=new URLSearchParams;m!=null&&m.startsWith("planned:")?p.set("planned",m.slice(8)):m&&p.set("release",m);const y=p.size>0?`?${p.toString()}`:"";r.setSearch(y),l($j(y))};return i.jsx(EU,{org:(t==null?void 0:t.slug)??"",query:o,onSelect:h,home:d})}function cW({hash:e,navigate:t,home:n}){const{project:s,settled:a}=Ad(),r=Wb.exec(e),o=r!=null&&r[2]?Hh(r[2]):null,l=r!=null&&r[3]?Hh(r[3]):null,c=o!==null?`?release=${encodeURIComponent(o)}`:e.startsWith("#planned")?`?planned${l!==null?`=${encodeURIComponent(l)}`:""}`:"",d=s!==null?`proj/${encodeURIComponent(s)}/releases${c}`:null;return u.useEffect(()=>{d&&t(d)},[d,t]),d||!a?i.jsx(Ya,{}):n}function Ep({route:e,navigate:t}){const{org:n}=ss(),s=xl(),a=u.useContext($A);let r=e.page;const o=e.org!==void 0&&n!==null&&e.org!==n.slug;o&&(r={kind:"not_found"});let l;if(o)l=i.jsx(Mj,{});else if("threads"in e)l=i.jsx(nW,{routeOrg:e.org});else if("task"in e){const d=new URLSearchParams(s.search).get("from");l=i.jsx(eG,{org:encodeURIComponent(e.org),task_id:e.task,from:d})}else"tasks"in e?l=i.jsx(sW,{route:e,navigate:t}):"issues"in e?l=i.jsx(aW,{route:e,navigate:t}):"chart"in e?l=i.jsx($V,{}):"worktrees"in e?l=i.jsx(BB,{org:(n==null?void 0:n.slug)??e.org}):"workspaces"in e?l=i.jsx(jB,{org:(n==null?void 0:n.slug)??e.org}):"queues"in e?l=i.jsx(iW,{route:e,navigate:t}):"blockers"in e?l=i.jsx(cB,{org:(n==null?void 0:n.slug)??e.org}):"releasesForward"in e?l=i.jsx(oW,{navigate:t}):"releases"in e?l=i.jsx(lW,{route:e}):r.kind==="home"?l=i.jsx(gl,{}):r.kind==="project"?l=i.jsx(Wc,{project:r.project}):l=i.jsx(Mj,{});const c=JSON.stringify(r);return u.useEffect(()=>{a==null||a(JSON.parse(c))},[a,c]),a?i.jsx(i.Fragment,{children:l}):i.jsx(sA,{page:r,children:l})}function dW({task:e,navigate:t,home:n}){const{org:s,loading:a,none:r,failure:o}=ss(),l=s!==null?`org/${encodeURIComponent(s.slug)}/tasks/${encodeURIComponent(e)}`:null,c=!a&&(r!==null||!!(o!=null&&o.shown));return u.useEffect(()=>{l&&t(l)},[l,t]),l||!c?i.jsx(Ya,{}):n}const uW=e=>window.location.replace(e);function Hh(e){try{return decodeURIComponent(e)}catch{return null}}function Lj({navigate:e}){const t=xl(),n=dm(qb(t.pathname),t.search),s=LA.exec(t.hash),a=s?Hh(s[1]):null,r=PA.exec(t.hash),o=r?Hh(r[1]):null,l=o!==null&&eW.test(o)?o:null,c=Wb.test(t.hash)?t.hash:null,d=s!==null&&a===null||r!==null&&l===null,h="forward"in n?n.forward:null;if(u.useEffect(()=>{h&&e(h)},[h,e]),"forward"in n)return null;const f=i.jsx(Ep,{route:{page:{kind:"home"}},navigate:e});return d?i.jsx(Ep,{route:{page:{kind:"not_found"}},navigate:e}):a!==null?i.jsx(dW,{task:a,navigate:e,home:f}):l!==null?i.jsx(rW,{issue:l,navigate:e,home:f}):c!==null?i.jsx(cW,{hash:c,navigate:e,home:f}):i.jsx(Ep,{route:n,navigate:e})}function hW(e){const{path:t,search:n}=Oa(e),s=dm(t,n);return"forward"in s?{kind:"home"}:s.page}function fW(e){const{path:t,search:n}=Oa(e),s=dm(t,n);return"forward"in s||s.page.kind!=="not_found"}function mW({navigate:e=uW,data:t,dock:n=!1,dockStore:s}){const a=dm(qb(window.location.pathname),window.location.search),[r,o]=u.useState(null),{notify:l,toasts:c}=J9(),d=!n&&"forward"in a?a.forward:null;u.useEffect(()=>{d&&e(d)},[d,e]);const[h,f]=u.useState(!1);u.useEffect(()=>{if(t)return;let g=!0;return e5().then(b=>{g&&f(b)}),()=>{g=!1}},[t]);const m=u.useMemo(()=>{if(t)return null;const g=KB();return{seams:{probe:{source:async()=>({label:"Local workspace"})},shell:g,tasks:vj(n5()),org:t5(),worktrees:i5(),workspaces:r5(),queues:ZB(),blockers:a5(),releases:s5()},issues:g.issues}},[t]),p=u.useMemo(()=>{if(t||!m)return t;const{report:g,reportCollections:b,...v}=m.issues;return{...m.seams,issues:vj({...v,...h?{report:g,reportCollections:b}:{},commands:{}})}},[t,m,h]),y=(g,b)=>i.jsx(Wg,{data:p,router:{...Iu,navigate:v=>b(Iu.href(v))},identity:zj,notify:l,children:i.jsx(Lj,{navigate:g})});return d||!n&&"forward"in a||!p.shell?null:i.jsx("div",{className:"app-ui dark",ref:o,children:i.jsxs(G$,{container:r,children:[i.jsx(Wg,{data:p,router:Iu,identity:zj,notify:l,children:i.jsx(t3,{shell:p.shell,children:n?i.jsx(c9,{renderPane:y,pageOf:hW,known:fW,error:l.error,store:s}):i.jsx(Lj,{navigate:e})})}),c]})})}dI();V2.createRoot(document.getElementById("root")).render(i.jsx(u.StrictMode,{children:qb(window.location.pathname)==="app-ui-probe"?i.jsx(eB,{}):i.jsx(mW,{dock:!0})}));
|